From 5dacdee9b54c78372b68140e2b068d03a620eab9 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期三, 02 七月 2025 19:00:52 +0800 Subject: [PATCH] 修改bug --- ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TOrderLogisticsController.java | 127 +++++++---------------------------------- 1 files changed, 23 insertions(+), 104 deletions(-) diff --git a/ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TOrderLogisticsController.java b/ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TOrderLogisticsController.java index b9056dc..409724e 100644 --- a/ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TOrderLogisticsController.java +++ b/ManagementQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TOrderLogisticsController.java @@ -3,30 +3,25 @@ import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.plugins.Page; import com.stylefeng.guns.core.base.controller.BaseController; +import com.stylefeng.guns.core.beetl.ShiroExtUtil; import com.stylefeng.guns.core.common.constant.factory.PageFactory; -import com.stylefeng.guns.core.shiro.ShiroKit; import com.stylefeng.guns.core.shiro.ShiroUser; import com.stylefeng.guns.core.util.SinataUtil; import com.stylefeng.guns.core.util.ToolUtil; -import com.stylefeng.guns.modular.cloudPayment.example.AllocationExample; -import com.stylefeng.guns.modular.cloudPayment.req.AllocationReq; -import com.stylefeng.guns.modular.system.controller.util.Base64Util; import com.stylefeng.guns.modular.system.dao.OrderCancelMapper; import com.stylefeng.guns.modular.system.model.*; import com.stylefeng.guns.modular.system.service.*; import com.stylefeng.guns.modular.system.util.*; -import com.unionpay.upyzt.exception.UpyztException; -import com.unionpay.upyzt.resp.AllocationResp; import org.springframework.beans.BeanUtils; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; -import org.springframework.ui.Model; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.PrintWriter; import java.math.BigDecimal; import java.util.Date; import java.util.HashMap; @@ -62,18 +57,21 @@ @Autowired private IIncomeService incomeService; - + @Autowired private ITDriverService tDriverService; - + @Autowired private ITTimeoutAppealService timeoutAppealService; - + @Autowired private PayMoneyUtil payMoneyUtil; @Autowired private IUserCouponRecordService userCouponRecordService; - + + @Resource + private ShiroExtUtil shiroExtUtil; + /** * 跳转到小件物流订单首页 */ @@ -81,7 +79,7 @@ public String index() { return PREFIX + "tOrderLogistics.html"; } - + /** * 跳转到添加小件物流订单 */ @@ -123,14 +121,14 @@ Integer state) { String beginTime = null; String endTime = null; - if (SinataUtil.isNotEmpty(insertTime)){ + if (SinataUtil.isNotEmpty(insertTime)) { String[] timeArray = insertTime.split(" - "); beginTime = timeArray[0]; endTime = timeArray[1]; } Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); - page.setRecords(tOrderLogisticsService.getLogisticsOrderList(page,beginTime,endTime,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(), - orderNum,orderSource,type,userName,userPhone,recipient,recipientPhone,driver,state)); + page.setRecords(tOrderLogisticsService.getLogisticsOrderList(page, beginTime, endTime, shiroExtUtil.getUser().getRoleType(), shiroExtUtil.getUser().getObjectId(), + orderNum, orderSource, type, userName, userPhone, recipient, recipientPhone, driver, state)); return super.packForBT(page); } @@ -143,20 +141,17 @@ @RequestMapping(value = "/cancel") @ResponseBody public Object cancel(@RequestParam Integer tOrderLogisticsId) { - try{ - ShiroUser user = ShiroKit.getUser(); + try { + ShiroUser user = shiroExtUtil.getUser(); TOrderLogistics tOrderLogistics = tOrderLogisticsService.selectById(tOrderLogisticsId); tOrderLogistics.setState(10); - + //已支付的情况下进行退款操作 - if(null != tOrderLogistics.getPayType() && null != tOrderLogistics.getPayMoney()) { - if (tOrderLogistics.getPayType() ==3) {//余额支付 + if (null != tOrderLogistics.getPayType() && null != tOrderLogistics.getPayMoney()) { + if (tOrderLogistics.getPayType() == 3) {//余额支付 TUser tUser = userService.selectById(tOrderLogistics.getUserId()); tUser.setBalance(tUser.getBalance().add(tOrderLogistics.getPayMoney())); userService.updateById(tUser); - if(tOrderLogistics.getPayMoney().doubleValue()>0) { - createAllocationReqUser(1, tUser.getId(), 1, tOrderLogistics.getPayMoney().doubleValue()); - } } else { System.out.println("其他支付"); if(tOrderLogistics.getOrderSource()==4){ @@ -164,9 +159,6 @@ TDriver driver = itDriverService.selectById(tOrderLogistics.getDriverId()); driver.setBalance(driver.getBalance().add(tOrderLogistics.getPayMoney())); itDriverService.updateById(driver); - if(tOrderLogistics.getPayMoney().doubleValue()>0) { - createAllocationReq(1, driver.getId(), 1, tOrderLogistics.getPayMoney().doubleValue()); - } }else { System.out.println("退用户"); // TUser tUser = userService.selectById(tOrderLogistics.getUserId()); @@ -267,79 +259,6 @@ @Autowired private IUserWithdrawalService userWithdrawalService; - public String createAllocationReq(Integer companyId,Integer userId,int type,double money){ - List<TEnterpriseWithdrawal> tEnterpriseWithdrawals = tEnterpriseWithdrawalService.selectList(new EntityWrapper<TEnterpriseWithdrawal>().eq("companyId", companyId)); - TDriver tUser = tDriverService.selectById(userId); - List<UserWithdrawal> userWithdrawals = userWithdrawalService.selectList(new EntityWrapper<UserWithdrawal>().eq("phone", tUser.getPhone())); - if(userWithdrawals.size()==0){ - return "error"; - } - - AllocationReq allocationReq= new AllocationReq(); - allocationReq.setOutOrderNo(ToolUtil.getRandomString(32)); - if(type==1){ - - allocationReq.setPayBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId()); - allocationReq.setRecvBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId()); - - allocationReq.setPassword(Base64Util.decode(tEnterpriseWithdrawals.get(0).getTransactionAuthorizationCode())); - }else { - allocationReq.setRecvBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId()); - allocationReq.setPayBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId()); - allocationReq.setPassword(Base64Util.decode(userWithdrawals.get(0).getTransactionAuthorizationCode())); - } - money=money*100; - allocationReq.setAmount((int)money); - allocationReq.setProductName("分账"); - allocationReq.setProductCount(1); - allocationReq.setOrderNo(ToolUtil.getRandomString(32)); - allocationReq.setOrderAmount(1l); - try { - AllocationResp allocationResp = AllocationExample.create(allocationReq); - System.out.println(allocationResp); - return "ok"; - } catch (UpyztException e) { - e.printStackTrace(); - return e.getMessage(); - } - - } - public String createAllocationReqUser(Integer companyId,Integer userId,int type,double money){ - List<TEnterpriseWithdrawal> tEnterpriseWithdrawals = tEnterpriseWithdrawalService.selectList(new EntityWrapper<TEnterpriseWithdrawal>().eq("companyId", companyId)); - TUser tUser = userService.selectById(userId); - List<UserWithdrawal> userWithdrawals = userWithdrawalService.selectList(new EntityWrapper<UserWithdrawal>().eq("phone", tUser.getPhone())); - if(userWithdrawals.size()==0){ - return "error"; - } - AllocationReq allocationReq= new AllocationReq(); - allocationReq.setOutOrderNo(ToolUtil.getRandomString(32)); - if(type==1){ - - allocationReq.setPayBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId()); - allocationReq.setRecvBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId()); - - allocationReq.setPassword(Base64Util.decode(tEnterpriseWithdrawals.get(0).getTransactionAuthorizationCode())); - }else { - allocationReq.setRecvBalanceAcctId(tEnterpriseWithdrawals.get(0).getBalanceAcctId()); - allocationReq.setPayBalanceAcctId(userWithdrawals.get(0).getBalanceAcctId()); - allocationReq.setPassword(Base64Util.decode(userWithdrawals.get(0).getTransactionAuthorizationCode())); - } - money=money*100; - allocationReq.setAmount((int)money); - allocationReq.setProductName("分账"); - allocationReq.setProductCount(1); - allocationReq.setOrderNo(ToolUtil.getRandomString(32)); - allocationReq.setOrderAmount(1l); - try { - AllocationResp allocationResp = AllocationExample.create(allocationReq); - System.out.println(allocationResp); - return "ok"; - } catch (UpyztException e) { - e.printStackTrace(); - return e.getMessage(); - } - - } /** * 删除小件物流订单 -- Gitblit v1.7.1