diff --git a/.gitignore b/.gitignore index d2798fb1..dd7919d3 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,10 @@ hai-schedule/target/* hai-schedule/log/* hai-schedule/hai-schedule.iml +v1/target/* +v1/log/* +v1/hai-schedule.iml + diff --git a/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java b/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java index 5745bb27..8f99b16a 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java @@ -14,6 +14,8 @@ import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.XmlUtil; import com.hai.common.pay.util.sdk.WXPayConstants; +import com.hai.common.security.SessionObject; +import com.hai.common.security.UserCenter; import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.WxUtils; import com.hai.config.HuiLianTongUnionCardConfig; @@ -39,6 +41,7 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.util.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -55,11 +58,14 @@ import java.util.*; public class OutRechargeOrderController { private static Logger log = LoggerFactory.getLogger(HighMerchantStoreController.class); + @Autowired + private UserCenter userCenter; + @Resource private OutRechargeOrderService outRechargeOrderService; @Resource - private OutRechargeChildOrderService outRechargeChildOrderService; + private OutRechargeChildOrderService outRechargeChildOrderService; @RequestMapping(value = "/getOrderById", method = RequestMethod.GET) @@ -85,7 +91,7 @@ public class OutRechargeOrderController { // 查询充值子订单 Map childOrderMap = new HashMap<>(); - childOrderMap.put("parent_order_id" , orderId); + childOrderMap.put("parent_order_id", orderId); List childOrderList = outRechargeChildOrderService.getListRechargeChildOrder(childOrderMap); @@ -98,88 +104,76 @@ public class OutRechargeOrderController { } -// @RequestMapping(value="/importRechargeOrder",method = RequestMethod.POST) -// @ResponseBody -// @ApiOperation(value = "导入话费充值订单") -// public ResponseData importRechargeOrder( @RequestParam(value = "file" , required = true) MultipartFile files, -// HttpServletRequest request) { -// try { -// -// ImportRechargeOrderListener importRechargeOrderListener = new ImportRechargeOrderListener(); -// importRechargeOrderListener.initData(outRechargeOrderService); -// EasyExcel.read(files.getInputStream(), ExportOutRechargeOrder.class, importRechargeOrderListener).sheet().doRead(); -// -// Map map = new HashMap<>(); -// map.put("errorData", importRechargeOrderListener.getErrorData()); -// map.put("errorTotal", importRechargeOrderListener.getErrorData().size()); -// -// return ResponseMsgUtil.success(map); -// -// } catch (Exception e) { -// log.error("HighCouponController -> importStock() error!",e); -// return ResponseMsgUtil.exception(e); -// } -// } + @RequestMapping(value="/importRechargeOrder",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "导入话费充值订单") + public ResponseData importRechargeOrder( @RequestParam(value = "file" , required = true) MultipartFile files, + HttpServletRequest request) { + try { + + ImportRechargeOrderListener importRechargeOrderListener = new ImportRechargeOrderListener(); + importRechargeOrderListener.initData(outRechargeOrderService); + EasyExcel.read(files.getInputStream(), ExportOutRechargeOrder.class, importRechargeOrderListener).sheet().doRead(); + + Map map = new HashMap<>(); + map.put("errorData", importRechargeOrderListener.getErrorData()); + map.put("errorTotal", importRechargeOrderListener.getErrorData().size()); + + return ResponseMsgUtil.success(map); + + } catch (Exception e) { + log.error("HighCouponController -> importStock() error!",e); + return ResponseMsgUtil.exception(e); + } + } @RequestMapping(value = "/getOrderList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取订单") public ResponseData getUserOrderList( - @RequestParam(name = "status", required = false) Integer status, + @RequestParam(name = "payStatus", required = false) Integer payStatus, + @RequestParam(name = "rechargeStatus", required = false) String rechargeStatus, @RequestParam(name = "orderNo", required = false) String orderNo, - @RequestParam(name = "rechargeModel", required = false) String rechargeModel, + @RequestParam(name = "operatorType", required = false) String operatorType, + @RequestParam(name = "laborUnionCard", required = false) String laborUnionCard, @RequestParam(name = "rechargeContent", required = false) String rechargeContent, - @RequestParam(name = "rechargeType", required = false) String rechargeType, @RequestParam(name = "userPhone", required = false) String userPhone, - @RequestParam(name = "idCard", required = false) String idCard, + @RequestParam(name = "rechargeType", required = false) String rechargeType, @RequestParam(name = "payType", required = false) Integer payType, - @RequestParam(name = "code", required = false) Integer code, @RequestParam(name = "payTimeS", required = false) Long payTimeS, @RequestParam(name = "payTimeE", required = false) Long payTimeE, + @RequestParam(name = "createTimeS", required = false) Long createTimeS, + @RequestParam(name = "createTimeE", required = false) Long createTimeE, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { try { - Map map = new HashMap<>(); + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); - if (status != null) { - map.put("status", status.toString()); - } - if (StringUtils.isNotBlank(orderNo)) { - map.put("orderNo", orderNo); - } - if (StringUtils.isNotBlank(rechargeModel)) { - map.put("rechargeModel", rechargeModel); - } - - if (StringUtils.isNotBlank(rechargeContent)) { - map.put("rechargeContent", rechargeContent); - } - if (StringUtils.isNotBlank(rechargeType)) { - map.put("rechargeType", rechargeType); - } + Map map = new HashMap<>(); - if (StringUtils.isNotBlank(userPhone)) { - map.put("userPhone", userPhone); - } - if (StringUtils.isNotBlank(idCard)) { - map.put("idCard", idCard); - } - if (payType != null) { - map.put("payType" , payType.toString()); - } - if (code != null) { - map.put("code" , code.toString()); - } - if (payTimeS != null) { + map.put("companyId", userInfoModel.getBsCompany().getId()); + map.put("rechargeStatus", rechargeStatus); + map.put("payStatus", payStatus); + map.put("orderNo", orderNo); + map.put("operatorType", operatorType); + map.put("laborUnionCard", laborUnionCard); + map.put("rechargeContent", rechargeContent); + map.put("userPhone", userPhone); + map.put("rechargeType", rechargeType); + map.put("payType", payType); + if (payTimeS != null && payTimeE != null ) { map.put("payTimeS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(payTimeS)); - } - if (payTimeE != null) { map.put("payTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(payTimeE)); } + if (createTimeS != null && createTimeE != null) { + map.put("createTimeS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTimeS)); + map.put("createTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTimeE)); + } - PageHelper.startPage(pageNum,pageSize); + PageHelper.startPage(pageNum, pageSize); return ResponseMsgUtil.success(new PageInfo<>(outRechargeOrderService.getListRechargeOrder(map))); } catch (Exception e) { @@ -192,35 +186,47 @@ public class OutRechargeOrderController { @RequestMapping(value = "/exportOrderList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "导出订单") - public ResponseData exportOrderList(@RequestParam(name = "status", required = false) Integer status, - @RequestParam(name = "orderNo", required = false) String orderNo, - @RequestParam(name = "rechargeModel", required = false) String rechargeModel, - @RequestParam(name = "rechargeContent", required = false) String rechargeContent, - @RequestParam(name = "userPhone", required = false) String userPhone, - @RequestParam(name = "idCard", required = false) String idCard, - @RequestParam(name = "rechargeType", required = false) String rechargeType, - @RequestParam(name = "payType", required = false) Integer payType, - @RequestParam(name = "code", required = false) Integer code, - @RequestParam(name = "createTimeS", required = false) Long createTimeS, - @RequestParam(name = "createTimeE", required = false) Long createTimeE, - @RequestParam(name = "payTimeS", required = false) Long payTimeS, - @RequestParam(name = "payTimeE", required = false) Long payTimeE) { + public ResponseData exportOrderList( + @RequestParam(name = "payStatus", required = false) Integer payStatus, + @RequestParam(name = "rechargeStatus", required = false) String rechargeStatus, + @RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "operatorType", required = false) String operatorType, + @RequestParam(name = "laborUnionCard", required = false) String laborUnionCard, + @RequestParam(name = "rechargeContent", required = false) String rechargeContent, + @RequestParam(name = "userPhone", required = false) String userPhone, + @RequestParam(name = "rechargeType", required = false) String rechargeType, + @RequestParam(name = "payType", required = false) Integer payType, + @RequestParam(name = "payTimeS", required = false) Long payTimeS, + @RequestParam(name = "payTimeE", required = false) Long payTimeE, + @RequestParam(name = "createTimeS", required = false) Long createTimeS, + @RequestParam(name = "createTimeE", required = false) Long createTimeE, + HttpServletRequest request + ) { try { - Map map = new HashMap<>(); - map.put("status", status); + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + + Map map = new HashMap<>(); + + map.put("companyId", userInfoModel.getBsCompany().getId()); + map.put("rechargeStatus", rechargeStatus); + map.put("payStatus", payStatus); map.put("orderNo", orderNo); - map.put("rechargeModel", rechargeModel); + map.put("operatorType", operatorType); + map.put("laborUnionCard", laborUnionCard); map.put("rechargeContent", rechargeContent); map.put("userPhone", userPhone); - map.put("idCard", idCard); - map.put("payType", payType); - map.put("code", code); map.put("rechargeType", rechargeType); - map.put("createTimeS", createTimeS); - map.put("createTimeE", createTimeE); - map.put("payTimeS", payTimeS); - map.put("payTimeE", payTimeE); + map.put("payType", payType); + if (payTimeS != null && payTimeE != null ) { + map.put("payTimeS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(payTimeS)); + map.put("payTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(payTimeE)); + } + if (createTimeS != null && createTimeE != null) { + map.put("createTimeS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTimeS)); + map.put("createTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTimeE)); + } List list = outRechargeOrderService.getOrderCount(map); String name = "/outRechargeOrder/充值订单" + System.currentTimeMillis() + ".xlsx"; @@ -237,28 +243,28 @@ public class OutRechargeOrderController { @ResponseBody @ApiOperation(value = "查询时间订单统计") public ResponseData getOrderCountList( - @RequestParam(name = "finishTimeS", required = false) Long finishTimeS, - @RequestParam(name = "finishTimeE", required = false) Long finishTimeE, - @RequestParam(name = "status", required = false) Integer status, - @RequestParam(name = "pageNum", required = true) Integer pageNum, - @RequestParam(name = "pageSize", required = true) Integer pageSize, - HttpServletRequest request) { + @RequestParam(name = "finishTimeS", required = false) Long finishTimeS, + @RequestParam(name = "finishTimeE", required = false) Long finishTimeE, + @RequestParam(name = "status", required = false) Integer status, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize, + HttpServletRequest request) { try { - Map map = new HashMap<>(); + Map map = new HashMap<>(); - if (finishTimeS != null){ + if (finishTimeS != null) { map.put("finishTimeS", finishTimeS.toString()); } - if (finishTimeE != null){ + if (finishTimeE != null) { map.put("finishTimeE", finishTimeE.toString()); } - if (status != null){ + if (status != null) { map.put("status", status.toString()); } - PageHelper.startPage(pageNum,pageSize); + PageHelper.startPage(pageNum, pageSize); return ResponseMsgUtil.success(new PageInfo<>(outRechargeOrderService.getListOrderCount(map))); } catch (Exception e) { @@ -275,16 +281,16 @@ public class OutRechargeOrderController { @RequestParam(name = "finishTimeE", required = false) Long finishTimeE) { try { - Map map = new HashMap<>(); + Map map = new HashMap<>(); - if (finishTimeS != null){ + if (finishTimeS != null) { map.put("finishTimeS", finishTimeS.toString()); } - if (finishTimeE != null){ + if (finishTimeE != null) { map.put("finishTimeE", finishTimeE.toString()); } - if (status != null){ + if (status != null) { map.put("status", status.toString()); } @@ -311,17 +317,17 @@ public class OutRechargeOrderController { HttpServletRequest request) { try { - Map map = new HashMap<>(); + Map map = new HashMap<>(); - if (finishTimeS != null){ + if (finishTimeS != null) { map.put("finishTimeS", finishTimeS.toString()); } - if (finishTimeE != null){ + if (finishTimeE != null) { map.put("finishTimeE", finishTimeE.toString()); } - PageHelper.startPage(pageNum,pageSize); + PageHelper.startPage(pageNum, pageSize); return ResponseMsgUtil.success(new PageInfo<>(outRechargeOrderService.getUserCountList(map))); } catch (Exception e) { @@ -334,16 +340,16 @@ public class OutRechargeOrderController { @ResponseBody @ApiOperation(value = "导出员工订单") public ResponseData exportUserOrderListCount(@RequestParam(name = "finishTimeS", required = false) Long finishTimeS, - @RequestParam(name = "finishTimeE", required = false) Long finishTimeE) { + @RequestParam(name = "finishTimeE", required = false) Long finishTimeE) { try { - Map map = new HashMap<>(); + Map map = new HashMap<>(); - if (finishTimeS != null){ + if (finishTimeS != null) { map.put("finishTimeS", finishTimeS.toString()); } - if (finishTimeE != null){ + if (finishTimeE != null) { map.put("finishTimeE", finishTimeE.toString()); } diff --git a/hai-bweb/src/main/java/com/bweb/excelListener/ImportRechargeOrderListener.java b/hai-bweb/src/main/java/com/bweb/excelListener/ImportRechargeOrderListener.java index 923ba542..6bc3aae8 100644 --- a/hai-bweb/src/main/java/com/bweb/excelListener/ImportRechargeOrderListener.java +++ b/hai-bweb/src/main/java/com/bweb/excelListener/ImportRechargeOrderListener.java @@ -32,7 +32,7 @@ public class ImportRechargeOrderListener extends AnalysisEventListener addOrder() error!",e); + log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @@ -101,7 +99,7 @@ public class OutRechargeOrderController { public ResponseData cancelOrder(@RequestParam(name = "orderId", required = true) Long orderId) { try { - OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderId(orderId); + OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderId(orderId); if (outRechargeOrder.getPayStatus() == 101 && (outRechargeOrder.getRechargeStatus() != 201 || outRechargeOrder.getRechargeStatus() != 202)) { outRechargeOrderService.cancelOrder(orderId); @@ -124,7 +122,6 @@ public class OutRechargeOrderController { public ResponseData getUserOrderList( @RequestParam(name = "status", required = false) Integer status, @RequestParam(name = "orderNo", required = false) String orderNo, - @RequestParam(name = "rechargeModel", required = false) String rechargeModel, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { @@ -134,19 +131,12 @@ public class OutRechargeOrderController { SessionObject sessionObject = userCenter.getSessionObject(request); HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); - Map map = new HashMap<>(); + Map map = new HashMap<>(); map.put("userId", userInfoModel.getHighUser().getId().toString()); - if (status != null) { - map.put("status", status.toString()); - } - if (StringUtils.isNotBlank(orderNo)) { - map.put("orderNo", orderNo); - } - if (StringUtils.isNotBlank(rechargeModel)) { - map.put("rechargeModel", rechargeModel); - } + map.put("payStatus", status.toString()); + map.put("orderNo", orderNo); - PageHelper.startPage(pageNum,pageSize); + PageHelper.startPage(pageNum, pageSize); return ResponseMsgUtil.success(new PageInfo<>(outRechargeOrderService.getListRechargeOrder(map))); } catch (Exception e) { diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java index f49e434c..622b2dfb 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java @@ -94,7 +94,7 @@ public class HighOrderSchedule { */ @Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 public void initRechargeOrder() { - Map map = new HashMap<>(); + Map map = new HashMap<>(); map.put("status" , String.valueOf(102)); map.put("rechargeStatus" , String.valueOf(204)); List orderList = outRechargeOrderService.getListRechargeOrder(map); diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java index a86c1a62..c56c39f3 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java @@ -769,7 +769,7 @@ public interface HighOrderMapperExt { "" }) BigDecimal rechargePriceTotal(@Param("map") Map map); @@ -787,7 +787,7 @@ public interface HighOrderMapperExt { "" }) Long rechargePriceCount(@Param("map") Map map); @@ -845,7 +845,7 @@ public interface HighOrderMapperExt { "left join ( " + "select date(create_timed) as datetime, " + "sum(pay_real_price) as num " + - "from out_recharge_order where status in (2,3)" + + "from out_recharge_order where pay_status in (102,100)" + "group by date(create_timed) " + ") b " + "on a.click_date = b.datetime " + @@ -907,7 +907,7 @@ public interface HighOrderMapperExt { "left join ( " + "select date(create_timed) as datetime, " + "count(*) as num " + - "from out_recharge_order where status in (2,3)" + + "from out_recharge_order where pay_status in (102,100)" + "group by date(create_timed) " + ") b " + "on a.click_date = b.datetime " + diff --git a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java index 6b08cdc8..cbd3f4de 100644 --- a/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java @@ -64,43 +64,30 @@ public interface OutRechargeOrderMapperExt { @Select({"" diff --git a/hai-service/src/main/java/com/hai/model/OutRechargeOrderModel.java b/hai-service/src/main/java/com/hai/model/OutRechargeOrderModel.java index 35f1ccbf..b53fefc0 100644 --- a/hai-service/src/main/java/com/hai/model/OutRechargeOrderModel.java +++ b/hai-service/src/main/java/com/hai/model/OutRechargeOrderModel.java @@ -8,122 +8,137 @@ import java.util.Date; public class OutRechargeOrderModel extends OutRechargeOrder { private String orderNo; - private String userName; - private String userPhone; - private String rechargeModelName; - private String rechargeContent; - private String rechargeName; - private String remarks; + private String operatorName; + private String rechargeTypeName; private String payTypeName; - private BigDecimal orderPrice; + private String rechargeContent; + private BigDecimal rechargePrice; private BigDecimal payPrice; + private BigDecimal discountDeductionPrice; + private BigDecimal integralDeductionPrice; private BigDecimal payRealPrice; - private String statusName; + private String userName; + private String userPhone; private Date createTime; private Date payTime; - private Date cancelTime; - private Date finishTime; - private Date refundTime; - private BigDecimal refundFee; - private String outRefundNo; - private String refundId; - private String cardNo; - private String rechargeTypeName; + private String payStatusName; + private String rechargeStatusName; + @Override public String getOrderNo() { return orderNo; } + @Override public void setOrderNo(String orderNo) { this.orderNo = orderNo; } - public String getUserName() { - return userName; + @Override + public String getOperatorName() { + return operatorName; } - public void setUserName(String userName) { - this.userName = userName; + @Override + public void setOperatorName(String operatorName) { + this.operatorName = operatorName; } - public String getUserPhone() { - return userPhone; + + public String getRechargeTypeName() { + return rechargeTypeName; } - public void setUserPhone(String userPhone) { - this.userPhone = userPhone; + public void setRechargeTypeName(String rechargeTypeName) { + this.rechargeTypeName = rechargeTypeName; } - public String getRechargeModelName() { - return rechargeModelName; + public String getPayTypeName() { + return payTypeName; } - public void setRechargeModelName(String rechargeModelName) { - this.rechargeModelName = rechargeModelName; + public void setPayTypeName(String payTypeName) { + this.payTypeName = payTypeName; } + @Override public String getRechargeContent() { return rechargeContent; } + @Override public void setRechargeContent(String rechargeContent) { this.rechargeContent = rechargeContent; } - public String getRechargeName() { - return rechargeName; - } - - public void setRechargeName(String rechargeName) { - this.rechargeName = rechargeName; - } - - public String getRemarks() { - return remarks; + @Override + public BigDecimal getRechargePrice() { + return rechargePrice; } - public void setRemarks(String remarks) { - this.remarks = remarks; + @Override + public void setRechargePrice(BigDecimal rechargePrice) { + this.rechargePrice = rechargePrice; } - public String getPayTypeName() { - return payTypeName; + @Override + public BigDecimal getPayPrice() { + return payPrice; } - public void setPayTypeName(String payTypeName) { - this.payTypeName = payTypeName; + @Override + public void setPayPrice(BigDecimal payPrice) { + this.payPrice = payPrice; } - public BigDecimal getOrderPrice() { - return orderPrice; + @Override + public BigDecimal getDiscountDeductionPrice() { + return discountDeductionPrice; } - public void setOrderPrice(BigDecimal orderPrice) { - this.orderPrice = orderPrice; + @Override + public void setDiscountDeductionPrice(BigDecimal discountDeductionPrice) { + this.discountDeductionPrice = discountDeductionPrice; } - public BigDecimal getPayPrice() { - return payPrice; + @Override + public BigDecimal getIntegralDeductionPrice() { + return integralDeductionPrice; } - public void setPayPrice(BigDecimal payPrice) { - this.payPrice = payPrice; + @Override + public void setIntegralDeductionPrice(BigDecimal integralDeductionPrice) { + this.integralDeductionPrice = integralDeductionPrice; } + @Override public BigDecimal getPayRealPrice() { return payRealPrice; } + @Override public void setPayRealPrice(BigDecimal payRealPrice) { this.payRealPrice = payRealPrice; } - public String getStatusName() { - return statusName; + @Override + public String getUserName() { + return userName; + } + + @Override + public void setUserName(String userName) { + this.userName = userName; + } + + @Override + public String getUserPhone() { + return userPhone; } - public void setStatusName(String statusName) { - this.statusName = statusName; + @Override + public void setUserPhone(String userPhone) { + this.userPhone = userPhone; } public Date getCreateTime() { @@ -134,75 +149,29 @@ public class OutRechargeOrderModel extends OutRechargeOrder { this.createTime = createTime; } + @Override public Date getPayTime() { return payTime; } + @Override public void setPayTime(Date payTime) { this.payTime = payTime; } - public Date getCancelTime() { - return cancelTime; - } - - public void setCancelTime(Date cancelTime) { - this.cancelTime = cancelTime; - } - - public Date getFinishTime() { - return finishTime; - } - - public void setFinishTime(Date finishTime) { - this.finishTime = finishTime; - } - - public Date getRefundTime() { - return refundTime; + public String getPayStatusName() { + return payStatusName; } - public void setRefundTime(Date refundTime) { - this.refundTime = refundTime; + public void setPayStatusName(String payStatusName) { + this.payStatusName = payStatusName; } - public BigDecimal getRefundFee() { - return refundFee; + public String getRechargeStatusName() { + return rechargeStatusName; } - public void setRefundFee(BigDecimal refundFee) { - this.refundFee = refundFee; - } - - public String getOutRefundNo() { - return outRefundNo; - } - - public void setOutRefundNo(String outRefundNo) { - this.outRefundNo = outRefundNo; - } - - public String getRefundId() { - return refundId; - } - - public void setRefundId(String refundId) { - this.refundId = refundId; - } - - public String getCardNo() { - return cardNo; - } - - public void setCardNo(String cardNo) { - this.cardNo = cardNo; - } - - public String getRechargeTypeName() { - return rechargeTypeName; - } - - public void setRechargeTypeName(String rechargeTypeName) { - this.rechargeTypeName = rechargeTypeName; + public void setRechargeStatusName(String rechargeStatusName) { + this.rechargeStatusName = rechargeStatusName; } } diff --git a/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java b/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java index 8c63c654..b47cddec 100644 --- a/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java +++ b/hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java @@ -23,7 +23,7 @@ public interface OutRechargeOrderService { * @Param [map] * @return java.util.List **/ - List getListRechargeOrder(Map map); + List getListRechargeOrder(Map map); /** * @Author Sum1Dream diff --git a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java index dd9e36d4..8d402a57 100644 --- a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java @@ -76,7 +76,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { private HighDiscountAgentCodeService highDiscountAgentCodeService; @Resource - private OutRechargeChildOrderService outRechargeChildOrderService; + private OutRechargeChildOrderService outRechargeChildOrderService; @Resource private BsRequestRecordService bsRequestRecordService; @@ -92,51 +92,53 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { @Override - public List getListRechargeOrder(Map map) { + public List getListRechargeOrder(Map map) { OutRechargeOrderExample example = new OutRechargeOrderExample(); OutRechargeOrderExample.Criteria criteria = example.createCriteria(); if (MapUtils.getLong(map, "userId") != null) { criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId")); } - - + if (MapUtils.getLong(map, "companyId") != null) { + criteria.andCompanyIdEqualTo(MapUtils.getLong(map, "companyId")); + } if (MapUtils.getInteger(map, "payType") != null) { criteria.andPayTypeEqualTo(MapUtils.getInteger(map, "payType")); } - + if (MapUtils.getInteger(map, "laborUnionCard") != null) { + criteria.andLaborUnionCardEqualTo(MapUtils.getString(map, "laborUnionCard")); + } + if (MapUtils.getInteger(map, "payStatus") != null) { + criteria.andPayStatusEqualTo(MapUtils.getInteger(map, "payStatus")); + } + if (MapUtils.getInteger(map, "rechargeType") != null) { + criteria.andRechargeTypeEqualTo(MapUtils.getInteger(map, "rechargeType")); + } if (MapUtils.getString(map, "orderNo") != null) { criteria.andOrderNoLike("%" + MapUtils.getString(map, "orderNo") + "%"); } if (MapUtils.getString(map, "userPhone") != null) { criteria.andUserPhoneEqualTo(MapUtils.getString(map, "userPhone")); } - if (MapUtils.getString(map, "rechargeContent") != null) { criteria.andRechargeContentLike("%" + MapUtils.getString(map, "rechargeContent") + "%"); } - - if (MapUtils.getString(map, "phone") != null) { - criteria.andUserPhoneEqualTo(MapUtils.getString(map, "phone")); - } - - if (MapUtils.getInteger(map, "status") != null) { - criteria.andPayStatusEqualTo(MapUtils.getInteger(map, "status")); + if (MapUtils.getInteger(map, "operatorType") != null) { + criteria.andOperatorTypeEqualTo(MapUtils.getInteger(map, "operatorType")); } if (MapUtils.getInteger(map, "rechargeStatus") != null) { criteria.andRechargeStatusEqualTo(MapUtils.getInteger(map, "rechargeStatus")); } - - if (StringUtils.isNotBlank(map.get("payTimeS")) && StringUtils.isNotBlank(map.get("payTimeE"))) { + if (StringUtils.isNotBlank(MapUtils.getString(map, "payTimeS")) && StringUtils.isNotBlank(MapUtils.getString(map, "payTimeE"))) { criteria.andPayTimeBetween( - DateUtil.format(map.get("payTimeS") , "yyyy-MM-dd HH:mm:ss") , - DateUtil.format(map.get("payTimeE") , "yyyy-MM-dd HH:mm:ss")); + DateUtil.format(MapUtils.getString(map, "payTimeS"), "yyyy-MM-dd HH:mm:ss"), + DateUtil.format(MapUtils.getString(map, "payTimeE"), "yyyy-MM-dd HH:mm:ss")); } - if (StringUtils.isNotBlank(map.get("createTimeS")) && StringUtils.isNotBlank(map.get("createTimeE"))) { + if (StringUtils.isNotBlank(MapUtils.getString(map, "createTimeS")) && StringUtils.isNotBlank(MapUtils.getString(map, "createTimeE"))) { criteria.andCreateTimedBetween( - DateUtil.format(map.get("createTimeS") , "yyyy-MM-dd HH:mm:ss") , - DateUtil.format(map.get("createTimeE") , "yyyy-MM-dd HH:mm:ss")); + DateUtil.format(MapUtils.getString(map, "createTimeS"), "yyyy-MM-dd HH:mm:ss"), + DateUtil.format(MapUtils.getString(map, "createTimeE"), "yyyy-MM-dd HH:mm:ss")); } example.setOrderByClause("create_timed desc"); @@ -158,7 +160,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { @Override @Transactional( isolation = Isolation.SERIALIZABLE, - propagation= Propagation.REQUIRES_NEW) + propagation = Propagation.REQUIRES_NEW) public OutRechargeOrder insertOrder(JSONObject object) throws Exception { OutRechargeOrder outRechargeOrder = new OutRechargeOrder(); @@ -173,7 +175,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { String rechargeContent = object.getString("rechargeContent"); // 查询产品详情 - OutRechargePriceModel outRechargePrice = outRechargePriceService.findById(goodsId , null); + OutRechargePriceModel outRechargePrice = outRechargePriceService.findById(goodsId, null); Map listMap = new HashMap<>(); listMap.put("productType", "3"); @@ -184,7 +186,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { BsProductDiscount bsProductDiscount = bsConfigService.getProductDiscountByMap(listMap); // 判断充值系统是否关闭 - if (!secConfigService.isConfig("RECHARGE" , "1")) { + if (!secConfigService.isConfig("RECHARGE", "1")) { throw ErrorHelp.genException(SysCode.System, ErrorCode.RECHARGE_CLOSE, ""); } @@ -215,7 +217,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { if (highDiscountUserRel.getHighDiscount().getDiscountType() == 1) { // 如果商品支付总额 小于 满减价格 if (outRechargePrice.getRechargePrice().compareTo(highDiscountUserRel.getHighDiscount().getDiscountCondition()) < 0) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_MEMBER_ERROR, "订单未达到"+highDiscountUserRel.getHighDiscount().getDiscountCondition()+"元,无法使用此优惠券"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_MEMBER_ERROR, "订单未达到" + highDiscountUserRel.getHighDiscount().getDiscountCondition() + "元,无法使用此优惠券"); } // 计算支付金额 = 商品充值总额 - 满减额度 payPrice = outRechargePrice.getRechargePrice().subtract(highDiscountUserRel.getHighDiscount().getDiscountPrice()); @@ -286,14 +288,14 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { } - outRechargeOrder.setUserId(object.getLong("userId")); + outRechargeOrder.setUserId(user.getId()); outRechargeOrder.setIntegralNum(object.getBigDecimal("integralNum")); outRechargeOrder.setRechargeContent(rechargeContent); outRechargeOrder.setCompanyId(outRechargePrice.getCompanyId()); - outRechargeOrder.setUserName(object.getString("username")); + outRechargeOrder.setUserName(user.getName()); outRechargeOrder.setRechargeType(outRechargePrice.getRechargeType()); - outRechargeOrder.setUserPhone(object.getString("phone")); - outRechargeOrder.setOrderNo("RCG" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5)); + outRechargeOrder.setUserPhone(user.getPhone()); + outRechargeOrder.setOrderNo("RCG" + DateUtil.date2String(new Date(), "yyyyMMddHHmmss") + IDGenerator.nextId(5)); outRechargeOrder.setCreateTimed(new Date()); outRechargeOrder.setGoodsId(goodsId); outRechargeOrder.setRechargePrice(outRechargePrice.getRechargePrice()); @@ -315,7 +317,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { // 101.待支付 102.已支付 100.已完成 104.已取消 105.已退款 outRechargeOrder.setPayStatus(102); outRechargeOrder.setPayTime(new Date()); - outRechargeOrder.setPaySerialNo("22" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5)); + outRechargeOrder.setPaySerialNo("22" + DateUtil.date2String(new Date(), "yyyyMMddHHmmss") + IDGenerator.nextId(5)); } else { // 201:充值中 202:充值成功 203:充值失败 204:未充值 outRechargeOrder.setRechargeStatus(204); @@ -355,9 +357,9 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { } @Override - @Transactional(propagation= Propagation.REQUIRES_NEW) + @Transactional(propagation = Propagation.REQUIRES_NEW) public void updateOrderList(List rechargeOrders) throws Exception { - for (OutRechargeOrder list:rechargeOrders) { + for (OutRechargeOrder list : rechargeOrders) { // if (list.getStatus() == 3) { // outRechargeOrderMapper.updateByPrimaryKey(list); // } else if (list.getStatus() == 6) { @@ -368,7 +370,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { } @Override - @Transactional(propagation= Propagation.REQUIRES_NEW) + @Transactional(propagation = Propagation.REQUIRES_NEW) public void cancelOrder(Long orderId) { OutRechargeOrder order = findByOrderId(orderId); if (order != null && order.getPayStatus() == 101) { @@ -400,11 +402,12 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { } @Override - @Transactional(propagation= Propagation.REQUIRES_NEW) + @Transactional(propagation = Propagation.REQUIRES_NEW) public void finishOrder(Long orderId) { OutRechargeOrder order = findByOrderId(orderId); if (order != null) { -// order.setStatus(3); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已取消 5.已退款 + order.setRechargeStatus(202); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已取消 5.已退款 + order.setPayStatus(100); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已取消 5.已退款 order.setFinishTime(new Date()); updateOrder(order); } @@ -412,24 +415,24 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { @Override public List getOrderCount(Map map) throws Exception { - if(MapUtils.getLong(map, "createTimeS") != null) { + + + if (MapUtils.getLong(map, "createTimeS") != null) { map.put("createTimeS", DateUtil.date2String(new Date(MapUtils.getLong(map, "createTimeS")), "yyyy-MM-dd HH:mm:ss")); } - if(MapUtils.getLong(map, "createTimeE") != null) { + if (MapUtils.getLong(map, "createTimeE") != null) { map.put("createTimeE", DateUtil.date2String(new Date(MapUtils.getLong(map, "createTimeE")), "yyyy-MM-dd HH:mm:ss")); } - if(MapUtils.getLong(map, "payTimeS") != null) { + if (MapUtils.getLong(map, "payTimeS") != null) { map.put("payTimeS", DateUtil.date2String(new Date(MapUtils.getLong(map, "payTimeS")), "yyyy-MM-dd HH:mm:ss")); } - - if(MapUtils.getLong(map, "payTimeE") != null) { + if (MapUtils.getLong(map, "payTimeE") != null) { map.put("payTimeE", DateUtil.date2String(new Date(MapUtils.getLong(map, "payTimeE")), "yyyy-MM-dd HH:mm:ss")); } - return outRechargeOrderMapper.selectOrderCount(map); } @@ -479,7 +482,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { } else { fTimeE = DateUtil.date2String(new Date(), "yyyy-MM-dd HH:mm:ss"); } - return outRechargeOrderMapperExt.getListOrderCount(fTimeS , fTimeE , status); + return outRechargeOrderMapperExt.getListOrderCount(fTimeS, fTimeE, status); } @Override @@ -515,14 +518,14 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { } else { fTimeE = DateUtil.date2String(new Date(), "yyyy-MM-dd HH:mm:ss"); } - return outRechargeOrderMapperExt.getListUserCount(fTimeS , fTimeE); + return outRechargeOrderMapperExt.getListUserCount(fTimeS, fTimeE); } @Override public void hltUnionCardPay(HighUserCard userCard, OutRechargeOrder order) throws Exception { String goodsDesc = "充值话费"; - String tranDesc = order.getRechargeContent() + "充值" + order.getPayRealPrice() +"元话费"; + String tranDesc = order.getRechargeContent() + "充值" + order.getPayRealPrice() + "元话费"; String instCode = "11101290"; String businessType = "hisen_consume"; @@ -530,7 +533,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { JSONObject consumption = HuiLianTongUnionCardConfig.consumption(order.getOrderNo(), userCard.getCardNo(), order.getPayRealPrice(), businessType, instCode, goodsDesc, tranDesc); System.out.println("工会卡支付响应参数" + consumption.toJSONString()); - Map dataMap = new HashMap<>(); + Map dataMap = new HashMap<>(); dataMap.put("orderNo", order.getOrderNo()); dataMap.put("cardType", "ghk"); dataMap.put("cardNo", userCard.getCardNo()); @@ -550,7 +553,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { payPush.setReturnContent(consumption.toJSONString()); highGasOrderPushMapper.insert(payPush); - if(!consumption.getString("respCode").equals("0000")) { + if (!consumption.getString("respCode").equals("0000")) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumption.getString("respMessage")); } JSONObject consumptionResult = HuiLianTongUnionCardConfig.resolveResponse(consumption.getString("data")); @@ -609,23 +612,23 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { } else { // 微信退款 if (order.getPayType() == 2) { - Map param = new HashMap<>(); + Map param = new HashMap<>(); param.put("appid", "wx637bd6f7314daa46"); param.put("mch_id", "1289663601"); - param.put("sub_mch_id" , "1614670195"); + param.put("sub_mch_id", "1614670195"); param.put("nonce_str", WxUtils.makeNonStr()); param.put("transaction_id", order.getPaySerialNo()); - param.put("out_refund_no", "HFR"+new Date().getTime()); + param.put("out_refund_no", "HFR" + new Date().getTime()); param.put("total_fee", String.valueOf(order.getPayRealPrice().multiply(new BigDecimal("100")).intValue())); param.put("refund_fee", String.valueOf(order.getPayRealPrice().multiply(new BigDecimal("100")).intValue())); param.put("sign_type", "HMAC-SHA256"); - String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5" , WXPayConstants.SignType.HMACSHA256); + String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5", WXPayConstants.SignType.HMACSHA256); param.put("sign", signStr); String resultXmL = doRefundRequest(param.get("mch_id"), WxUtils.mapToXml(param)); OrderRefundModel orderRefundModel = XmlUtil.getObjectFromXML(resultXmL, OrderRefundModel.class); - if(orderRefundModel.getResult_code().equals("SUCCESS")) { + if (orderRefundModel.getResult_code().equals("SUCCESS")) { order.setPayStatus(105); order.setRechargeStatus(203); order.setRefundTime(new Date()); @@ -634,16 +637,16 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { order.setRefundFee(new BigDecimal(orderRefundModel.getRefund_fee()).divide(new BigDecimal("100"))); outRechargeOrderService.updateOrder(order); } else { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!错误代码:"+orderRefundModel.getErr_code()+",错误描述"+orderRefundModel.getErr_code_des()); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!错误代码:" + orderRefundModel.getErr_code() + ",错误描述" + orderRefundModel.getErr_code_des()); } } // 工会卡退款 if (order.getPayType() == 3) { - JSONObject jsonObject = HuiLianTongUnionCardConfig.refund( "HFR"+new Date().getTime() , order.getOrderNo()); + JSONObject jsonObject = HuiLianTongUnionCardConfig.refund("HFR" + new Date().getTime(), order.getOrderNo()); if (jsonObject == null) { - jsonObject = HuiLianTongUnionCardConfig.refund( "HFR"+new Date().getTime() , order.getOrderNo()); + jsonObject = HuiLianTongUnionCardConfig.refund("HFR" + new Date().getTime(), order.getOrderNo()); } JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data")); @@ -652,7 +655,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { order.setPayStatus(105); order.setRechargeStatus(203); order.setRefundTime(new Date()); - order.setOutRefundNo("HFR"+new Date().getTime() ); + order.setOutRefundNo("HFR" + new Date().getTime()); order.setRefundFee(order.getPayRealPrice()); order.setRefundId(dataObject.getString("orderId")); outRechargeOrderService.updateOrder(order); @@ -694,7 +697,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { } - public String doRefundRequest(String mchId,String data) throws Exception { + public String doRefundRequest(String mchId, String data) throws Exception { //小程序退款需要调用双向证书的认证 CloseableHttpClient httpClient = goodsOrderService.readCertificate(mchId); @@ -717,7 +720,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { } finally { response.close(); } - } catch (Exception e){ + } catch (Exception e) { throw new RuntimeException(e); } finally { httpClient.close(); @@ -728,13 +731,13 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { public void pollRequest(OutRechargeOrder outRechargeOrder) throws Exception { // 查询充值产品 - OutRechargePriceModel outRechargePrice = outRechargePriceService.findById(outRechargeOrder.getGoodsId() , null); + OutRechargePriceModel outRechargePrice = outRechargePriceService.findById(outRechargeOrder.getGoodsId(), null); // 查询充值子订单 Map childOrderMap = new HashMap<>(); - childOrderMap.put("parent_order_id" , outRechargeOrder.getId()); - childOrderMap.put("status" , 102); + childOrderMap.put("parent_order_id", outRechargeOrder.getId()); + childOrderMap.put("status", 102); List childOrderList = outRechargeChildOrderService.getListRechargeChildOrder(childOrderMap); @@ -756,21 +759,21 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { JSONObject object = new JSONObject(); - String orderNo = "CZ" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5); + String orderNo = "CZ" + DateUtil.date2String(new Date(), "yyyyMMddHHmmss") + IDGenerator.nextId(5); String[] rechargePlatform = outRechargePrice.getRechargePlatform().split("-"); for (String s : rechargePlatform) { // 尖椒充值 if (s.equals("1") && (type == 2 || type == 0)) { - object.put("out_order_id" ,orderNo ); - object.put("amount" , outRechargePrice.getRechargePrice()); - object.put("mobile" , outRechargeOrder.getRechargeContent()); + object.put("out_order_id", orderNo); + object.put("amount", outRechargePrice.getRechargePrice()); + object.put("mobile", outRechargeOrder.getRechargeContent()); if (outRechargePrice.getRechargeType() == 1) { - object.put("is_fast" , 1); + object.put("is_fast", 1); } - JSONObject returnObject = RechargeConfig.rechargeOrderByJj(object); - object.put("return_content" , returnObject); + JSONObject returnObject = RechargeConfig.rechargeOrderByJj(object); + object.put("return_content", returnObject); if (returnObject != null && returnObject.getLong("code") == 200) { childOrder.setStatus(102); } else { @@ -780,11 +783,11 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { break; } if (s.equals("2") && (type == 1 || type == 0)) { - object.put("out_trade_num" , orderNo); - object.put("product_id" , outRechargePrice.getGoodsId()); - object.put("mobile" , outRechargeOrder.getRechargeContent()); - JSONObject returnObject = RechargeConfig.rechargeOrderByLy(object); - object.put("return_content" , returnObject); + object.put("out_trade_num", orderNo); + object.put("product_id", outRechargePrice.getGoodsId()); + object.put("mobile", outRechargeOrder.getRechargeContent()); + JSONObject returnObject = RechargeConfig.rechargeOrderByLy(object); + object.put("return_content", returnObject); if (returnObject != null && returnObject.getLong("errno") == 0) { childOrder.setStatus(102); } else {