From 3be28f5226b5ee46d9e19e106b6627a09c0b4a3c Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 24 Jun 2024 09:17:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BsGasOilGunNoController.java | 6 + .../controller/BsGasOilPriceController.java | 11 + .../controller/BsMerchantUserController.java | 26 +- .../controller/BsOrderRefundController.java | 168 ++ .../controller/order/OrderPayController.java | 2 +- .../java/com/hfkj/common/utils/DateUtil.java | 2 +- .../java/com/hfkj/config/CommonSysConfig.java | 5 + .../com/hfkj/dao/BsAgentMerMapperExt.java | 4 +- .../com/hfkj/dao/BsOrderRefundMapper.java | 192 ++ .../com/hfkj/dao/BsOrderRefundMapperExt.java | 7 + .../hfkj/dao/BsOrderRefundSqlProvider.java | 556 +++++ .../java/com/hfkj/entity/BsOrderRefund.java | 492 ++++ .../com/hfkj/entity/BsOrderRefundExample.java | 2054 +++++++++++++++++ .../java/com/hfkj/model/AgentMerAllot.java | 2 +- .../service/gas/BsGasOilGunNoService.java | 2 +- .../gas/impl/BsGasOilGunNoServiceImpl.java | 9 +- .../gas/impl/BsGasOilPriceServiceImpl.java | 5 +- .../gas/impl/BsGasStaffServiceImpl.java | 24 +- .../impl/BsMerchantQrCodeServiceImpl.java | 18 +- .../impl/BsMerchantUserServiceImpl.java | 4 + .../service/order/BsOrderRefundService.java | 55 + .../order/impl/BsOrderRefundServiceImpl.java | 278 +++ .../resources/dev/commonConfig.properties | 2 + 23 files changed, 3902 insertions(+), 22 deletions(-) create mode 100644 bweb/src/main/java/com/bweb/controller/BsOrderRefundController.java create mode 100644 service/src/main/java/com/hfkj/dao/BsOrderRefundMapper.java create mode 100644 service/src/main/java/com/hfkj/dao/BsOrderRefundMapperExt.java create mode 100644 service/src/main/java/com/hfkj/dao/BsOrderRefundSqlProvider.java create mode 100644 service/src/main/java/com/hfkj/entity/BsOrderRefund.java create mode 100644 service/src/main/java/com/hfkj/entity/BsOrderRefundExample.java create mode 100644 service/src/main/java/com/hfkj/service/order/BsOrderRefundService.java create mode 100644 service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java diff --git a/bweb/src/main/java/com/bweb/controller/BsGasOilGunNoController.java b/bweb/src/main/java/com/bweb/controller/BsGasOilGunNoController.java index 87796d8..1efd43e 100644 --- a/bweb/src/main/java/com/bweb/controller/BsGasOilGunNoController.java +++ b/bweb/src/main/java/com/bweb/controller/BsGasOilGunNoController.java @@ -14,6 +14,7 @@ import com.hfkj.model.SecUserSessionObject; import com.hfkj.service.gas.BsGasOilGunNoService; import com.hfkj.service.gas.BsGasOilPriceService; import com.hfkj.service.BsMerchantService; +import com.hfkj.service.gas.BsGasService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; @@ -39,6 +40,8 @@ public class BsGasOilGunNoController { @Resource private BsMerchantService merchantService; @Resource + private BsGasService gasService; + @Resource private UserCenter userCenter; @RequestMapping(value = "/createOilGunNo", method = RequestMethod.POST) @@ -87,6 +90,8 @@ public class BsGasOilGunNoController { oilGunNo.setStatus(1); gasOilGunNoService.editData(oilGunNo); + // 删除油站缓存 + gasService.clean(oilPrice.getMerNo()); return ResponseMsgUtil.success("操作成功"); } catch (Exception e) { @@ -107,6 +112,7 @@ public class BsGasOilGunNoController { gasOilGunNoService.delete(body.getLong("gunNoId")); + return ResponseMsgUtil.success("操作成功"); } catch (Exception e) { diff --git a/bweb/src/main/java/com/bweb/controller/BsGasOilPriceController.java b/bweb/src/main/java/com/bweb/controller/BsGasOilPriceController.java index 6e35de7..f3cdf24 100644 --- a/bweb/src/main/java/com/bweb/controller/BsGasOilPriceController.java +++ b/bweb/src/main/java/com/bweb/controller/BsGasOilPriceController.java @@ -14,6 +14,7 @@ import com.hfkj.model.SecUserSessionObject; import com.hfkj.service.gas.BsGasOilPriceService; import com.hfkj.service.BsMerchantService; import com.hfkj.service.CommonService; +import com.hfkj.service.gas.BsGasService; import com.hfkj.sysenum.gas.GasOilPriceStatusEnum; import com.hfkj.sysenum.SecUserObjectTypeEnum; import io.swagger.annotations.Api; @@ -43,6 +44,8 @@ public class BsGasOilPriceController { private UserCenter userCenter; @Resource private CommonService commonService; + @Resource + private BsGasService gasService; @RequestMapping(value = "/createOil", method = RequestMethod.POST) @ResponseBody @@ -102,6 +105,8 @@ public class BsGasOilPriceController { oilPrice.setStatus(GasOilPriceStatusEnum.status1.getNumber()); gasOilPriceService.editOilPrice(oilPrice); + // 删除缓存 + gasService.clean(oilPrice.getMerNo()); return ResponseMsgUtil.success("操作成功"); } catch (Exception e) { @@ -135,6 +140,8 @@ public class BsGasOilPriceController { oilPrice.setStatus(GasOilPriceStatusEnum.status1.getNumber()); gasOilPriceService.editOilPrice(oilPrice); + // 删除缓存 + gasService.clean(oilPrice.getMerNo()); return ResponseMsgUtil.success("操作成功"); } catch (Exception e) { @@ -168,6 +175,8 @@ public class BsGasOilPriceController { oilPrice.setStatus(GasOilPriceStatusEnum.status2.getNumber()); gasOilPriceService.editOilPrice(oilPrice); + // 删除缓存 + gasService.clean(oilPrice.getMerNo()); return ResponseMsgUtil.success("操作成功"); } catch (Exception e) { log.error("BsMerchantController --> disableOil() error!", e); @@ -199,6 +208,8 @@ public class BsGasOilPriceController { } gasOilPriceService.delete(oilPrice); + // 删除缓存 + gasService.clean(oilPrice.getMerNo()); return ResponseMsgUtil.success("操作成功"); } catch (Exception e) { log.error("BsMerchantController --> disableOil() error!", e); diff --git a/bweb/src/main/java/com/bweb/controller/BsMerchantUserController.java b/bweb/src/main/java/com/bweb/controller/BsMerchantUserController.java index 095982b..09da791 100644 --- a/bweb/src/main/java/com/bweb/controller/BsMerchantUserController.java +++ b/bweb/src/main/java/com/bweb/controller/BsMerchantUserController.java @@ -2,10 +2,16 @@ package com.bweb.controller; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.hfkj.common.exception.ErrorCode; +import com.hfkj.common.exception.ErrorHelp; +import com.hfkj.common.exception.SysCode; +import com.hfkj.common.security.UserCenter; import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.entity.BsMerchantUser; import com.hfkj.model.ResponseData; +import com.hfkj.model.SecUserSessionObject; import com.hfkj.service.BsMerchantUserService; +import com.hfkj.sysenum.SecUserObjectTypeEnum; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.slf4j.Logger; @@ -29,17 +35,31 @@ public class BsMerchantUserController { @Resource private BsMerchantUserService merchantUserService; + @Resource + private UserCenter userCenter; @RequestMapping(value = "/queryList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询列表") - public ResponseData queryList(@RequestParam(value = "merId", required = false) Long merId, + public ResponseData queryList(@RequestParam(value = "merNo", required = false) String merNo, + @RequestParam(value = "userPhone", required = false) String userPhone, @RequestParam(value = "pageNum", required = true) Integer pageNum, @RequestParam(value = "pageSize", required = true) Integer pageSize) { try { - + SecUserSessionObject userSession = userCenter.getSessionModel(SecUserSessionObject.class); + if (userSession == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); + } Map param = new HashMap<>(); - param.put("merId", merId); + param.put("userPhone", userPhone); + + if (userSession.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) { + param.put("merNo", merNo); + } else if (userSession.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) { + param.put("merId", userSession.getAccount().getObjectId()); + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, ""); + } PageHelper.startPage(pageNum,pageSize); return ResponseMsgUtil.success(new PageInfo<>(merchantUserService.getList(param))); diff --git a/bweb/src/main/java/com/bweb/controller/BsOrderRefundController.java b/bweb/src/main/java/com/bweb/controller/BsOrderRefundController.java new file mode 100644 index 0000000..99275d5 --- /dev/null +++ b/bweb/src/main/java/com/bweb/controller/BsOrderRefundController.java @@ -0,0 +1,168 @@ +package com.bweb.controller; + +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hfkj.common.exception.ErrorCode; +import com.hfkj.common.exception.ErrorHelp; +import com.hfkj.common.exception.SysCode; +import com.hfkj.common.security.UserCenter; +import com.hfkj.common.utils.ResponseMsgUtil; +import com.hfkj.entity.BsOrderRefund; +import com.hfkj.model.ResponseData; +import com.hfkj.model.SecUserSessionObject; +import com.hfkj.model.UserSessionObject; +import com.hfkj.service.order.BsOrderChildService; +import com.hfkj.service.order.BsOrderRefundService; +import com.hfkj.sysenum.SecUserObjectTypeEnum; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; + +/** + * @className: OrderController + * @author: HuRui + * @date: 2024/4/30 + **/ +@Controller +@RequestMapping(value="/refund") +@Api(value="订单退款业务") +public class BsOrderRefundController { + + Logger log = LoggerFactory.getLogger(BsOrderRefundController.class); + @Resource + private UserCenter userCenter; + @Resource + private BsOrderRefundService orderRefundService; + @Resource + private BsOrderChildService orderChildService; + @RequestMapping(value="/tradeOrder",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "退款交易订单") + public ResponseData tradeOrder(@RequestBody JSONObject body) { + try { + // 用户session + SecUserSessionObject userSession = userCenter.getSessionModel(SecUserSessionObject.class); + if (userSession == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); + } + if (body == null || StringUtils.isBlank(body.getString("orderNo"))) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + return ResponseMsgUtil.success(orderRefundService.tradeOrderRefund(body.getString("orderNo"),body.getString("remark"))); + + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/tradeOrderChild",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "退款交易子订单") + public ResponseData tradeOrderChild(@RequestBody JSONObject body) { + try { + // 用户session + SecUserSessionObject userSession = userCenter.getSessionModel(SecUserSessionObject.class); + if (userSession == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); + } + if (body == null + || StringUtils.isBlank(body.getString("childOrderNo")) + || body.getInteger("productCount") == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + return ResponseMsgUtil.success(orderRefundService.tradeOrderChildRefund( + body.getString("childOrderNo"), + body.getInteger("productCount"), + body.getString("remark") + )); + + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/queryRefund",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询退款订单") + public ResponseData queryRefund(@RequestParam(value = "refundOrderNo" , required = false) String refundOrderNo) { + try { + if (StringUtils.isBlank(refundOrderNo)) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + // 查询退款 + BsOrderRefund refund = orderRefundService.getRefund(refundOrderNo); + if (refund == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的退款"); + } + + Map map = new HashMap<>(); + map.put("refund", refund); + map.put("orderChild", orderChildService.getDetail(refund.getOrderChildNo())); + return ResponseMsgUtil.success(map); + + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/queryList",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询退款订单列表") + public ResponseData queryList(@RequestParam(value = "merId" , required = false) Long merId, + @RequestParam(value = "userPhone" , required = false) String userPhone, + @RequestParam(value = "orderNo" , required = false) String orderNo, + @RequestParam(value = "orderChildNo" , required = false) String orderChildNo, + @RequestParam(value = "refundOrderNo" , required = false) String refundOrderNo, + @RequestParam(value = "refundStatus" , required = false) Integer refundStatus, + @RequestParam(value = "createTimeS" , required = false) Long createTimeS, + @RequestParam(value = "createTimeE" , required = false) Long createTimeE, + @RequestParam(value = "pageNum" , required = true) Integer pageNum, + @RequestParam(value = "pageSize" , required = true) Integer pageSize) { + try { + // 用户session + SecUserSessionObject userSession = userCenter.getSessionModel(SecUserSessionObject.class); + if (userSession == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); + } + + Map param = new HashMap<>(); + if (userSession.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type1.getCode())) { + param.put("merId", merId); + } else if (userSession.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) { + param.put("merId", userSession.getAccount().getObjectId()); + }else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, ""); + } + param.put("userPhone", userPhone); + param.put("orderNo", orderNo); + param.put("orderChildNo", orderChildNo); + param.put("refundOrderNo", refundOrderNo); + param.put("refundStatus", refundStatus); + param.put("createTimeS", createTimeS); + param.put("createTimeE", createTimeE); + + PageHelper.startPage(pageNum, pageSize); + return ResponseMsgUtil.success(new PageInfo<>(orderRefundService.getRefundList(param))); + + } catch (Exception e) { + log.error("error!",e); + return ResponseMsgUtil.exception(e); + } + } + + +} diff --git a/cweb/src/main/java/com/cweb/controller/order/OrderPayController.java b/cweb/src/main/java/com/cweb/controller/order/OrderPayController.java index 45a7966..c2de1ca 100644 --- a/cweb/src/main/java/com/cweb/controller/order/OrderPayController.java +++ b/cweb/src/main/java/com/cweb/controller/order/OrderPayController.java @@ -75,7 +75,7 @@ public class OrderPayController { } order.setPayType(OrderPayTypeEnum.type1.getCode()); // 请求支付渠道 - Map preorder = HuiPayService.preorder(merPay.getChannelMerNo(), merPay.getChannelMerKey(), body.getString("userId"), merPay.getLedgerAccountFlag(), order); + Map preorder = HuiPayService.preorder(merPay.getChannelMerNo(), merPay.getChannelMerKey(), body.getString("openId"), merPay.getLedgerAccountFlag(), order); // 交易入账 BsOrderSettle orderSettle = new BsOrderSettle(); diff --git a/service/src/main/java/com/hfkj/common/utils/DateUtil.java b/service/src/main/java/com/hfkj/common/utils/DateUtil.java index 5ad9435..b99d58b 100644 --- a/service/src/main/java/com/hfkj/common/utils/DateUtil.java +++ b/service/src/main/java/com/hfkj/common/utils/DateUtil.java @@ -39,7 +39,7 @@ public class DateUtil { Calendar calendar = Calendar.getInstance(); return calendar.get(Calendar.YEAR); } - public static String date2String(Date date,String format) throws Exception{ + public static String date2String(Date date,String format) { String str = null; SimpleDateFormat sdf = new SimpleDateFormat(format); if(date != null){ diff --git a/service/src/main/java/com/hfkj/config/CommonSysConfig.java b/service/src/main/java/com/hfkj/config/CommonSysConfig.java index dff479c..87f9ee3 100644 --- a/service/src/main/java/com/hfkj/config/CommonSysConfig.java +++ b/service/src/main/java/com/hfkj/config/CommonSysConfig.java @@ -19,4 +19,9 @@ public class CommonSysConfig { * 【惠支付】支付渠道回调地址 */ private String huiPayPreorderNotifyUrl; + + /** + * 【嗨加油】域名 + */ + private String domainName; } diff --git a/service/src/main/java/com/hfkj/dao/BsAgentMerMapperExt.java b/service/src/main/java/com/hfkj/dao/BsAgentMerMapperExt.java index ed81b57..f956722 100644 --- a/service/src/main/java/com/hfkj/dao/BsAgentMerMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/BsAgentMerMapperExt.java @@ -37,6 +37,7 @@ public interface BsAgentMerMapperExt { @Select({"