Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/qijisheng
# Conflicts:
# ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
| | |
| | | @TableField("audit_status") |
| | | private Integer auditStatus; |
| | | |
| | | @ApiModelProperty(value = "状态(1=处理中,2=成功)") |
| | | @ApiModelProperty(value = "状态(1=处理中,2=成功,3=失败)") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "处理结果") |
| | | @TableField("remark") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "到账时间") |
| | | @TableField("arrival_time") |
| | |
| | | @TableField("audit_msg") |
| | | private String auditMsg; |
| | | |
| | | @ApiModelProperty(value = "状态(1=申请中,2=已到账)") |
| | | @ApiModelProperty(value = "状态(1=申请中,2=已到账,3=失败)") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "处理结果") |
| | | @TableField("remark") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "到账时间") |
| | | @TableField("arrival_time") |
| | | private LocalDateTime arrivalTime; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/user/queryUserByUserNameAndRoleType") |
| | | R<SysUser> queryUserByUserNameAndRoleType(@RequestParam("roleType") String userName, @RequestParam("roleType") Integer roleType); |
| | | R<SysUser> queryUserByUserNameAndRoleType(@RequestParam("userName") String userName, @RequestParam("roleType") Integer roleType); |
| | | |
| | | /** |
| | | * 新增加用户信息 |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/queryUserByUserNameAndRoleType") |
| | | public R<SysUser> queryUserByUserNameAndRoleType(@RequestParam("roleType") String userName, @RequestParam("roleType") Integer roleType){ |
| | | public R<SysUser> queryUserByUserNameAndRoleType(@RequestParam("userName") String userName, @RequestParam("roleType") Integer roleType){ |
| | | SysUser user = userService.getOne(Wrappers.lambdaQuery(SysUser.class) |
| | | .eq(SysUser::getUserName, userName) |
| | | .eq(SysUser::getDelFlag, "0") |
| | |
| | | SysUser data = sysUserClient.getSysUser(userid).getData(); |
| | | Integer shopId = null; |
| | | Set<Long> userId = null; |
| | | Set<Long> userIdT = null; |
| | | if(data.getRoleType() == 2){ |
| | | shopId = data.getObjectId(); |
| | | userId = orderClient.getAppUserByShoppingShop(shopId).getData(); |
| | | } |
| | | UserStatistics userStatistics = appUserMapper.getUserStatistics(shopId, userId); |
| | | UserStatistics userStatistics1 = appUserMapper.getUserStatistics(shopId, userIdT); |
| | | userStatistics.setShopUser(userStatistics1.getShopUser()); |
| | | return R.ok(userStatistics); |
| | | } |
| | | |
| | |
| | | @PostMapping("/withdrawalCallback") |
| | | public Object withdrawalCallback(@RequestBody SinglePayCallbackResult singlePayCallbackResult){ |
| | | Integer status = singlePayCallbackResult.getStatus(); |
| | | String merchantOrderNo = singlePayCallbackResult.getMerchantOrderNo(); |
| | | WithdrawalRequests withdrawalRequests = withdrawalRequestsService.getById(merchantOrderNo); |
| | | if(203 == status || 205 == status){ |
| | | String merchantOrderNo = singlePayCallbackResult.getMerchantOrderNo(); |
| | | WithdrawalRequests withdrawalRequests = withdrawalRequestsService.getById(merchantOrderNo); |
| | | if(1 == withdrawalRequests.getStatus()){ |
| | | withdrawalRequests.setStatus(2); |
| | | withdrawalRequests.setArrivalTime(LocalDateTime.now()); |
| | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("statusCode", 2001); |
| | | return jsonObject; |
| | | }else{ |
| | | //回退扣除的金额,添加明细记录 |
| | | //修改用户的可提现金额 |
| | | BigDecimal withdrawalAmount = withdrawalRequests.getWithdrawalAmount(); |
| | | AppUser appUser = appUserService.getById(withdrawalRequests.getAppUserId()); |
| | | BigDecimal withdrawableAmount = appUser.getWithdrawableAmount(); |
| | | BigDecimal withdrawnAmount = appUser.getWithdrawnAmount(); |
| | | BigDecimal balance = appUser.getBalance(); |
| | | appUser.setWithdrawableAmount(withdrawableAmount.add(withdrawalAmount).setScale(2, RoundingMode.HALF_EVEN)); |
| | | appUser.setWithdrawnAmount(withdrawnAmount.subtract(withdrawalAmount).setScale(2, RoundingMode.HALF_EVEN)); |
| | | appUser.setBalance(appUser.getBalance().add(withdrawalAmount).setScale(2, RoundingMode.HALF_EVEN)); |
| | | appUserService.updateById(appUser); |
| | | //添加变动明细 |
| | | BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord(); |
| | | balanceChangeRecord.setAppUserId(appUser.getId()); |
| | | balanceChangeRecord.setVipId(appUser.getVipId()); |
| | | balanceChangeRecord.setOrderId(withdrawalRequests.getId()); |
| | | balanceChangeRecord.setChangeType(2); |
| | | balanceChangeRecord.setBeforeAmount(balance); |
| | | balanceChangeRecord.setChangeAmount(withdrawalAmount); |
| | | balanceChangeRecord.setAfterAmount(appUser.getBalance()); |
| | | balanceChangeRecord.setDelFlag(0); |
| | | balanceChangeRecord.setCreateTime(LocalDateTime.now()); |
| | | balanceChangeRecordService.save(balanceChangeRecord); |
| | | |
| | | withdrawalRequests.setStatus(3); |
| | | withdrawalRequests.setRemark(singlePayCallbackResult.getErrorCodeDesc()); |
| | | withdrawalRequestsService.updateById(withdrawalRequests); |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("statusCode", 2001); |
| | | return jsonObject; |
| | | } |
| | | return new JSONObject(); |
| | | } |
| | | } |
| | | |
| | |
| | | List<WithdrawalRequests> waitAuditList = withdrawalRequestsService.list(new LambdaQueryWrapper<WithdrawalRequests>() |
| | | .eq(WithdrawalRequests::getAppUserId, userId) |
| | | .eq(WithdrawalRequests::getAuditStatus, WithdrawalAuditStatus.WAIT_AUDIT)); |
| | | |
| | | BigDecimal reduce = waitAuditList.stream().map(WithdrawalRequests::getWithdrawalAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | WalletVO walletVO = new WalletVO(); |
| | | walletVO.setWithdrawalAmount(appUser.getWithdrawableAmount()); |
| | | walletVO.setWithdrawnAmount(appUser.getWithdrawnAmount()); |
| | | walletVO.setWithdrawnAmount(appUser.getWithdrawnAmount().subtract(reduce)); |
| | | walletVO.setVipWithdrawalMinAmount(data.getVipWithdrawalMinAmount()); |
| | | walletVO.setTotalRechargeAmount(appUser.getTotalRechargeAmount()); |
| | | walletVO.setTotalRedPacketAmount(appUser.getTotalRedPacketAmount()); |
| | | walletVO.setTotalDistributionAmount(appUser.getTotalDistributionAmount()); |
| | | walletVO.setAuditAmount(waitAuditList.stream() |
| | | .map(WithdrawalRequests::getWithdrawalAmount) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | walletVO.setAuditAmount(reduce); |
| | | walletVO.setBalance(appUser.getBalance()); |
| | | return walletVO; |
| | | } |
| | |
| | | .divide(VIP_WITHDRAWAL_FEE_DENOMINATOR, 2, RoundingMode.HALF_UP); |
| | | // 减去手续费 |
| | | BigDecimal multiply = params.getWithdrawalAmount().multiply(vipWithdrawalFee); |
| | | params.setWithdrawalAmount(params.getWithdrawalAmount() |
| | | .subtract(multiply)); |
| | | params.setWithdrawalAmount(params.getWithdrawalAmount().subtract(multiply)); |
| | | |
| | | WithdrawalRequests withdrawalRequests = new WithdrawalRequests(); |
| | | BeanUtils.copyBeanProp(withdrawalRequests, params); |
| | |
| | | withdrawalRequests.setBankCardNumber(appUserBank.getBankNumber()); |
| | | } |
| | | withdrawalRequests.setWithdrawalAmount(withdrawalAmount); |
| | | withdrawalRequests.setArrivalAmount(withdrawalRequests.getWithdrawalAmount()); |
| | | withdrawalRequests.setArrivalAmount(params.getWithdrawalAmount()); |
| | | withdrawalRequests.setServiceCharge(multiply); |
| | | withdrawalRequests.setDelFlag(0); |
| | | withdrawalRequests.setAppUserId(SecurityUtils.getUserId()); |
| | |
| | | t_app_user tau |
| | | <where> |
| | | <if test="null != shopId"> |
| | | tau.shop_id = #{shopId} or tau.id in |
| | | <foreach collection="userId" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | tau.shop_id = #{shopId} |
| | | <if test="null != userId"> |
| | | or tau.id in |
| | | <foreach collection="userId" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | </if> |
| | | and tau.del_flag = 0 |
| | | and tau.`status` !=3 |
| | |
| | | if (order.getOrderType().equals(1)) { |
| | | serviceTotal++; |
| | | serviceTotalMoney = serviceTotalMoney.add(order.getPaymentAmount()); |
| | | }else if (order.getOrderType().equals(2)){ |
| | | total++; |
| | | totalMoney = totalMoney.add(order.getPaymentAmount()); |
| | | }else if (order.getOrderType().equals(2) && 1 == order.getDistributionMode()){ |
| | | singleTotal++; |
| | | singleTotalMoney = singleTotalMoney.add(order.getPaymentAmount()); |
| | | total++; |
| | | totalMoney = totalMoney.add(order.getPaymentAmount()); |
| | | } |
| | | total++; |
| | | totalMoney = totalMoney.add(order.getPaymentAmount()); |
| | | } |
| | | orderStatisticsDetail.setDate(key); |
| | | orderStatisticsDetail.setServiceTotal(serviceTotal); |
| | |
| | | |
| | | /** |
| | | * 确认发货操作 |
| | | * @param orderId |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @Override |
| | |
| | | public static MapTrackKD100Vo kd100MapTrack(String com, String num, String from, String to){ |
| | | QueryTrackReq queryTrackReq = new QueryTrackReq(); |
| | | QueryTrackParam queryTrackParam = new QueryTrackParam(); |
| | | queryTrackParam.setCom(CompanyConstant.YD); |
| | | // queryTrackParam.setCom(CompanyConstant.YD); |
| | | queryTrackParam.setCom(com); |
| | | queryTrackParam.setNum(num); |
| | | queryTrackParam.setFrom(from); |
| | | queryTrackParam.setTo(to); |
| | |
| | | return mapTrackKD100Vo; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | ExpressDeliveryUtil.kd100MapTrack("zhongtong", "75617413683310", "湖南省长沙市", "四川省成都市"); |
| | | } |
| | | |
| | | } |
| | |
| | | private Long appUserId; |
| | | @ApiModelProperty("售后订单id") |
| | | private String refundPassId; |
| | | |
| | | public BigDecimal getGetPoint(){ |
| | | return point; |
| | | } |
| | | } |
| | |
| | | private Integer refundMethod; |
| | | @ApiModelProperty("售后状态(1待审核2已完成3已拒绝4待退货5待平台收货)") |
| | | private Integer status; |
| | | |
| | | |
| | | private String orderNumber; |
| | | private String userName; |
| | | private Integer passStatus; |
| | | |
| | | public void setOrderNumber(String orderNumber) { |
| | | this.orderNumber = orderNumber; |
| | | this.setCode(orderNumber); |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName; |
| | | this.setName(userName); |
| | | } |
| | | |
| | | public void setPassStatus(Integer passStatus) { |
| | | this.passStatus = passStatus; |
| | | this.setStatus(passStatus); |
| | | } |
| | | } |
| | |
| | | and order_status in (4, 8) |
| | | </if> |
| | | <if test="null != item.shopId"> |
| | | and shop_id = #{item.shopId} and address_json is null |
| | | and shop_id = #{item.shopId} and distribution_mode != 2 |
| | | </if> |
| | | order by create_time desc |
| | | </select> |
| | | <select id="getOrderStatistics" resultType="com.ruoyi.order.vo.OrderStatistics"> |
| | | SELECT |
| | | count(*) as total, |
| | | SUM( CASE WHEN tor.order_type = 2 and distribution_mode = 2 THEN 0 ELSE 1 END ) as total, |
| | | SUM( CASE WHEN tor.order_type = 1 THEN 1 ELSE 0 END ) as serviceTotal, |
| | | SUM( CASE WHEN tor.order_type = 2 and distribution_mode = 1 THEN 1 ELSE 0 END ) as singleTotal, |
| | | SUM( tor.total_amount ) as totalMoney, |
| | |
| | | @GetMapping("/list") |
| | | public R<List<Share>> list(@RequestParam Integer objectId) { |
| | | List<Share> list = shareService.list(new LambdaQueryWrapper<Share>() |
| | | .eq(Share::getObjectId, objectId).eq(Share::getDelFlag, 0).or().eq(Share::getAddType, 1).eq(Share::getDelFlag, 0)); |
| | | .eq(Share::getObjectId, objectId) |
| | | .eq(Share::getDelFlag, 0).or() |
| | | .eq(Share::getAddType, 1) |
| | | .eq(Share::getDelFlag, 0)); |
| | | return R.ok(list); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "广告管理-分享管理-编辑", tags = {"管理后台"}) |
| | | @PostMapping("/manage/edit") |
| | | public R<Void> manageedit(@RequestBody Share share) { |
| | | if (share.getAuditStatus()==2){ |
| | | if (null == share.getAuditStatus() || share.getAuditStatus()==2){ |
| | | share.setAuditStatus(0); |
| | | } |
| | | shareService.updateById(share); |
| | |
| | | |
| | | @ApiOperation(value = "广告管理-分享管理-列表", tags = {"管理后台"}) |
| | | @GetMapping("/manage/list") |
| | | public R<Page<Share>> managelist(String name, Integer addType, @RequestParam Integer pageNum, Integer pageSize) { |
| | | public R<Page<Share>> managelist(String name, |
| | | Integer addType, |
| | | Integer auditStatus, |
| | | @RequestParam Integer pageNum, Integer pageSize) { |
| | | //判断当前登陆人是平台还是门店 |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserClient.getSysUser(userid).getData(); |
| | | if (sysUser.getRoleType()==1) { |
| | | Page<Share> page = shareService.lambdaQuery().eq(Share::getAuditStatus, 1).eq(Share::getDelFlag, 0).like(name != null, Share::getName, name) |
| | | .eq(addType != null , Share::getAddType, addType).page(Page.of(pageNum, pageSize)); |
| | | Page<Share> page = shareService.lambdaQuery() |
| | | .eq(Share::getAuditStatus, 1) |
| | | .eq(Share::getDelFlag, 0) |
| | | .like(name != null, Share::getName, name) |
| | | .eq(addType != null , Share::getAddType, addType) |
| | | .page(Page.of(pageNum, pageSize)); |
| | | return R.ok(page); |
| | | }else { |
| | | Page<Share> page = shareService.lambdaQuery().eq(Share::getAddType,3).eq(Share::getDelFlag, 0).eq(Share::getObjectId, sysUser.getObjectId()) |
| | | Page<Share> page = shareService.lambdaQuery() |
| | | .eq(auditStatus!= null, Share::getAuditStatus, auditStatus) |
| | | .eq(Share::getAddType,3) |
| | | .eq(Share::getDelFlag, 0) |
| | | .eq(Share::getObjectId, sysUser.getObjectId()) |
| | | .like(name != null, Share::getName, name).page(Page.of(pageNum, pageSize)); |
| | | return R.ok(page); |
| | | } |
| | |
| | | if (!shopService.cheUserByPhone(phone)) { |
| | | return R.fail("该手机号未注册"); |
| | | } |
| | | if (shop.getPid()!=null){ |
| | | if (shop.getPid() != null && shop.getPid() != 0){ |
| | | Shop shopP = shopService.getById(shop.getPid()); |
| | | if (shopP.getPid()!=null&&shopP.getPid()!=0&& shopP.getPid().equals(shop.getId())){ |
| | | return R.fail("门店之间不能互相作为上级门店"); |
| | |
| | | } |
| | | shop.setStatus(status); |
| | | shopService.updateById(shop); |
| | | //处理员工等数据 |
| | | UserShop userSh = new UserShop(); |
| | | userSh.setShopId(id); |
| | | List<UserShop> data = userShopClient.getUserShop(userSh).getData(); |
| | | for (UserShop datum : data) { |
| | | UserShop userShop = new UserShop(); |
| | | userShop.setUserId(datum.getUserId()); |
| | | List<UserShop> data1 = userShopClient.getUserShop(userShop).getData(); |
| | | long count = data1.stream().filter(s -> !s.getShopId().equals(id)).count(); |
| | | if(0 == count){ |
| | | SysUser sysUser = sysUserClient.getSysUser(datum.getUserId()).getData(); |
| | | sysUser.setStatus(status == 1 ? "0" : "1"); |
| | | sysUserClient.updateUser(sysUser); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | @PostMapping("/withdrawalCallback") |
| | | public Object withdrawalCallback(@RequestBody SinglePayCallbackResult singlePayCallbackResult){ |
| | | Integer status = singlePayCallbackResult.getStatus(); |
| | | String merchantOrderNo = singlePayCallbackResult.getMerchantOrderNo(); |
| | | ShopWithdraw shopWithdraw = shopWithdrawService.getById(merchantOrderNo); |
| | | if(203 == status || 205 == status){ |
| | | String merchantOrderNo = singlePayCallbackResult.getMerchantOrderNo(); |
| | | ShopWithdraw shopWithdraw = shopWithdrawService.getById(merchantOrderNo); |
| | | if(1 == shopWithdraw.getStatus()){ |
| | | shopWithdraw.setStatus(2); |
| | | shopWithdraw.setArrivalTime(LocalDateTime.now()); |
| | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("statusCode", 2001); |
| | | return jsonObject; |
| | | }else{ |
| | | //回退金额和添加变动明细 |
| | | Shop shop = shopService.getById(shopWithdraw.getShopId()); |
| | | BigDecimal balance = shop.getBalance(); |
| | | BigDecimal canWithdrawMoney = shop.getCanWithdrawMoney(); |
| | | BigDecimal withdrawMoney = shop.getWithdrawMoney(); |
| | | shop.setBalance(balance.add(shopWithdraw.getMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | shop.setCanWithdrawMoney(canWithdrawMoney.add(shopWithdraw.getMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | shop.setWithdrawMoney(withdrawMoney.subtract(shopWithdraw.getMoney()).setScale(2, RoundingMode.HALF_EVEN)); |
| | | shopService.updateById(shop); |
| | | //添加门店变动明细 |
| | | ShopBalanceStatement shopBalanceStatement = new ShopBalanceStatement(); |
| | | shopBalanceStatement.setShopId(shop.getId()); |
| | | shopBalanceStatement.setType(4); |
| | | shopBalanceStatement.setHistoricalBalance(balance); |
| | | shopBalanceStatement.setVariableAmount(shopWithdraw.getMoney()); |
| | | shopBalanceStatement.setBalance(shop.getBalance()); |
| | | shopBalanceStatement.setCreateUserId(shopWithdraw.getAuditUserId()); |
| | | shopBalanceStatement.setCreateTime(LocalDateTime.now()); |
| | | shopBalanceStatement.setObjectId(shopWithdraw.getId()); |
| | | shopBalanceStatementService.save(shopBalanceStatement); |
| | | shopWithdraw.setStatus(3); |
| | | shopWithdraw.setRemark(singlePayCallbackResult.getErrorCodeDesc()); |
| | | shopWithdrawService.updateById(shopWithdraw); |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("statusCode", 2001); |
| | | return jsonObject; |
| | | } |
| | | return new JSONObject(); |
| | | } |
| | | } |
| | | |