diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java b/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java index 7da0f4ff..be53f3ea 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighCouponAgentController.java @@ -464,12 +464,13 @@ public class HighCouponAgentController { JSONObject jsonObject = JSONObject.parseObject(reqBody); Long couponAgentCodeId = jsonObject.getLong("couponAgentCodeId"); + String phone = jsonObject.getString("phone"); String remark = jsonObject.getString("remark"); if (couponAgentCodeId == null) { log.error("HighMerchantStoreController -> useCouponCode() error!","参数错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } - return ResponseMsgUtil.success(highCouponAgentService.generateCode(couponAgentCodeId,remark)); + return ResponseMsgUtil.success(highCouponAgentService.generateCode(couponAgentCodeId,phone,remark)); } catch (Exception e) { log.error("HighCouponAgentController --> generateCode() error!", e); diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java b/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java index 5b41ccf7..d8eec255 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java @@ -153,8 +153,10 @@ public class HighCouponController { salesEndTime.set(Calendar.SECOND, 59); highCoupon.setSalesEndTime(salesEndTime.getTime()); - String setCouponKey = DateUtil.date2String(new Date(), "yyyyMMddHHmmss"); //订单号生成 年月日小时分秒 + 5位随机数 - highCoupon.setCouponKey(setCouponKey); + if (StringUtils.isBlank(highCoupon.getCouponKey())) { + String setCouponKey = DateUtil.date2String(new Date(), "yyyyMMddHHmmss"); //订单号生成 年月日小时分秒 + 5位随机数 + highCoupon.setCouponKey(setCouponKey); + } highCoupon.setCompanyId(merchant.getCompanyId()); highCoupon.setOperatorId(userInfoModel.getSecUser().getId()); highCoupon.setOperatorName(userInfoModel.getSecUser().getUserName()); @@ -263,6 +265,7 @@ public class HighCouponController { log.error("HighCouponController -> updateCoupon() error!","未找到商户"); throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOF_FOUND, ""); } + coupon.setCouponKey(highCoupon.getCouponKey()); coupon.setCouponSource(highCoupon.getCouponSource()); coupon.setMerchantId(highCoupon.getMerchantId()); coupon.setCouponName(highCoupon.getCouponName()); @@ -312,7 +315,7 @@ public class HighCouponController { } // 中石化 - if (coupon.getCouponSource() != null && coupon.getCouponSource() != 4) { + if (coupon.getCouponSource() != null && (coupon.getCouponSource() != 4 && coupon.getCouponSource() != 5)) { // 根据卡卷查询 销售码库存 if (highCouponCodeService.getStockCountByCoupon(coupon.getId()) == 0) { log.error("HighCouponController -> upShelfApprove() error!","卡卷库存数量错误"); diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java b/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java index 5a140130..93809c8e 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java @@ -21,14 +21,9 @@ import com.hai.entity.HighOrder; import com.hai.entity.HighTyAgent; import com.hai.entity.HighTySalesman; import com.hai.entity.OutRechargeOrder; -import com.hai.model.HighOrderModel; -import com.hai.model.OrderRefundModel; -import com.hai.model.ResponseData; -import com.hai.model.UserInfoModel; -import com.hai.service.HighCouponCodeService; -import com.hai.service.HighOrderService; -import com.hai.service.HighTyAgentService; -import com.hai.service.HighTySalesmanService; +import com.hai.enum_type.UserObjectTypeEnum; +import com.hai.model.*; +import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.collections4.MapUtils; @@ -62,6 +57,9 @@ public class HighOrderController { @Resource private HighOrderService highOrderService; + @Resource + private HighCouponService couponService; + @Resource private HighCouponCodeService highCouponCodeService; @@ -117,39 +115,6 @@ public class HighOrderController { } - @RequestMapping(value = "/getOrderCouponList", method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "获取卡券订单列表") - public ResponseData getUserOrderList(@RequestParam(name = "pageNum", required = true) Integer pageNum, - @RequestParam(name = "pageSize", required = true) Integer pageSize, - @RequestParam(name = "status", required = false) Integer status, - @RequestParam(name = "couponId", required = false) Integer couponId, - @RequestParam(name = "salesCode", required = false) Integer salesCode, - HttpServletRequest request) { - try { - - Map map = new HashMap<>(); - - SessionObject sessionObject = userCenter.getSessionObject(request); - UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); - if (userInfoModel.getBsCompany() == null) { - log.error("HighCouponController -> getCouponList() error!","权限不足"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); - } -// map.put("companyId", userInfoModel.getBsCompany().getId()); - map.put("couponId", couponId); - map.put("salesCode", salesCode); - map.put("status", status); - - PageHelper.startPage(pageNum,pageSize); - return ResponseMsgUtil.success(new PageInfo<>(highCouponCodeService.getCouponCodeList(map))); - - } catch (Exception e) { - log.error("HighOrderController --> getUserOrderList() error!", e); - return ResponseMsgUtil.exception(e); - } - } - @RequestMapping(value = "/getOrderBList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取用户订单") diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java b/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java new file mode 100644 index 00000000..5b8a8ff0 --- /dev/null +++ b/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java @@ -0,0 +1 @@ +package com.bweb.controller; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.alipay.api.domain.ForbbidenTime; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.utils.DateUtil; import com.hai.common.utils.IDGenerator; import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.HuiLianTongConfig; import com.hai.config.HuiLianTongUnionCardConfig; import com.hai.config.QianZhuConfig; import com.hai.config.WxOrderConfig; import com.hai.entity.*; import com.hai.model.OrderRefundModel; import com.hai.model.ResponseData; import com.hai.service.*; 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 javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private OutRechargeOrderService outRechargeOrderService; @Resource private HighOrderService highOrderService; @Resource private HighUserService highUserService; @Resource private HighOilCardService oilCardService; @Resource private ApiProductService apiProductService; @Resource private BsRechargeCodeService rechargeCodeService; @Resource private OutRechargePriceService rechargePriceService; @RequestMapping(value = "/kfcRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "KFC退款") public ResponseData kfcRefund(@RequestParam(name = "orderNo", required = true) String orderNo,HttpServletRequest request) { try { OrderRefundModel orderRefundModel = null; if (StringUtils.isNotBlank(orderNo)) { // 查询订单 HighOrder order = highOrderService.getOrderByOrderNo(orderNo); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 6.退款中 7.拒绝退款 if (order != null && order.getOrderStatus() == 2) { orderRefundModel = WxOrderConfig.orderToRefund(order.getPaySerialNo(), order.getPayRealPrice(), "1609882817", order.getPayRealPrice()); if(orderRefundModel.getResult_code().equals("SUCCESS")) { for (HighChildOrder childOrder : order.getHighChildOrderList()) { childOrder.setChildOrderStatus(4); } order.setOrderStatus(4); //order.setRefundTime(new Date()); //order.setRefundPrice(order.getPayRealPrice()); highOrderService.updateOrder(order); return ResponseMsgUtil.success(orderRefundModel); } } } return ResponseMsgUtil.success(orderRefundModel); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/oilCardRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "油卡退款") public ResponseData oilCardRefund(@RequestParam(name = "orderNo", required = true) String orderNo,HttpServletRequest request) { try { oilCardService.refund(orderNo); return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value="/resolveResponse",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "解析") public ResponseData resolveResponse( @RequestParam(name = "data", required = false) String data ) { try { JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(data); return ResponseMsgUtil.success(cardInfoObject); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value="/consumption",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡重新发起充值") public ResponseData consumption( @RequestParam(name = "orderNo", required = false) String orderNo ) { try { OutRechargeOrder order = outRechargeOrderService.findByOrderNo(orderNo); String goodsDesc = "重新充值"; String tranDesc = order.getRechargeContent() + "重新充值" + order.getPayRealPrice() + "元"; String instCode = "11101527"; String businessType = "hisen_consume"; String orderNoPost = "AGAIN" + DateUtil.date2String(new Date(), "yyyyMMddHHmmss") + IDGenerator.nextId(5); // 工会卡支付 JSONObject consumption = HuiLianTongUnionCardConfig.consumption(orderNoPost, order.getLaborUnionCard(), order.getPayRealPrice(), businessType, instCode, goodsDesc, tranDesc); JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(consumption.getString("data")); return ResponseMsgUtil.success(cardInfoObject); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getHuiLianTongCardConsume", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询汇联通工会卡消费记录") public ResponseData getHuiLianTongCardConsume(@RequestParam(name = "businessType", required = true) String businessType, @RequestParam(name = "cardNo", required = true) String cardNo, @RequestParam(name = "sdate", required = true) Long sdate, @RequestParam(name = "edate", required = true) Long edate, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { try { JSONObject consumptionRecord = HuiLianTongUnionCardConfig.queryConsumptionRecordByBusiness(businessType, cardNo, sdate, edate, pageNum, pageSize); if (StringUtils.isBlank(consumptionRecord.getString("data"))) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, ""); } JSONArray array = HuiLianTongUnionCardConfig.resolveResponse(consumptionRecord.getString("data")).getJSONArray("records"); // // String s = "HFR1"; // String s1 = "AGAIN1"; // // List list = new ArrayList<>(); // // // for (Object data : array) { // JSONObject dataObject = (JSONObject) data; // if (!StringUtils.contains(dataObject.getString("orderNo"),s) && !StringUtils.contains(dataObject.getString("orderNo"),s1)) { // list.add(dataObject); // } // return ResponseMsgUtil.success(array); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardConsume() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/orderToRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "积分充值退款") public ResponseData orderToRefund(@RequestParam(name = "orderId", required = true) Long orderId ,HttpServletRequest request) { try { HighOrder highOrder = highOrderService.getOrderById(orderId); // 微信退款 OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(), highOrder.getPayRealPrice(), highOrder.getPayRealPrice()); if(orderRefundModel.getResult_code().equals("SUCCESS")) { for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { childOrder.setChildOrderStatus(4); } highOrder.setOrderStatus(4); //highOrder.setRefundTime(new Date()); //highOrder.setRefundPrice(highOrder.getPayRealPrice()); highOrderService.updateOrder(highOrder); } if (highUserService.findGoldRepeat(3 , highOrder.getId())) { String remark = "订单" + highOrder.getOrderNo() + "退款积分:" + highOrder.getPayRealPrice().multiply(BigDecimal.valueOf(100)).intValue(); highUserService.goldHandle(highOrder.getMemId(), highOrder.getPayRealPrice().multiply(BigDecimal.valueOf(100)).intValue(), 2, 3, highOrder.getId() , remark); }else { log.error("orderToPay error!", "已有退款记录"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已有退款记录"); } return ResponseMsgUtil.success(orderRefundModel); } catch (Exception e) { log.error("HighOrderController --> orderToRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/orderToRefundByHlt", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "汇联通充值退款") public ResponseData orderToRefundByHlt(@RequestParam(name = "orderId", required = true) Long orderId ,HttpServletRequest request) { try { HighOrder highOrder = highOrderService.getOrderById(orderId); // 微信退款 OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(), highOrder.getPayRealPrice(), WxOrderConfig.MCH_ID_1619676214 , highOrder.getPayRealPrice()); if(orderRefundModel.getResult_code().equals("SUCCESS")) { for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { childOrder.setChildOrderStatus(4); } highOrder.setOrderStatus(4); //highOrder.setRefundTime(new Date()); //highOrder.setRefundPrice(highOrder.getPayRealPrice()); highOrderService.updateOrder(highOrder); } return ResponseMsgUtil.success(orderRefundModel); } catch (Exception e) { log.error("HighOrderController --> orderToRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/rechargeOrderToRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "话费退款") public ResponseData rechargeOrderToRefund( @RequestParam(name = "orderId", required = true) Long orderId) { try { outRechargeOrderService.rechargeOrderToRefund(orderId); return ResponseMsgUtil.success("退款成功"); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getStarbucksProducts", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "更新星巴克商品") public ResponseData getStarbucksProducts(HttpServletRequest request) { try { JSONObject jsonObject = QianZhuConfig.getStarbucksProducts(1 , 200); JSONObject object = jsonObject.getJSONObject("data"); JSONArray array = object.getJSONArray("items"); for (Object data : array) { JSONObject dataObject = (JSONObject) data; ApiStarbucksProducts starbucksProducts = apiProductService.findStarbucksProductsByGoodsId(dataObject.getLong("id")); if (dataObject.getInteger("shelfStatus") == 5) { if (starbucksProducts == null) { starbucksProducts = new ApiStarbucksProducts(); } starbucksProducts.setCategoryName(dataObject.getString("categoryName")); starbucksProducts.setCream(dataObject.getString("cream")); starbucksProducts.setCupSize(dataObject.getString("cupSize")); starbucksProducts.setDefaultImage(dataObject.getString("defaultImage")); starbucksProducts.setDes(dataObject.getString("des")); starbucksProducts.setEspresso(dataObject.getString("espresso")); starbucksProducts.setMarketGrandePrice(dataObject.getBigDecimal("marketGrandePrice")); starbucksProducts.setMarketTallPrice(dataObject.getBigDecimal("marketTallPrice")); starbucksProducts.setMarketVentiPrice(dataObject.getBigDecimal("marketVentiPrice")); starbucksProducts.setSalesGrandePrice(dataObject.getBigDecimal("salesGrandePrice")); starbucksProducts.setSalesTallPrice(dataObject.getBigDecimal("salesTallPrice")); starbucksProducts.setSalesVentiPrice(dataObject.getBigDecimal("salesVentiPrice")); starbucksProducts.setMilk(dataObject.getString("milk")); starbucksProducts.setMilkBubble(dataObject.getString("milkBubble")); starbucksProducts.setName(dataObject.getString("name")); starbucksProducts.setTemperature(dataObject.getString("temperature")); if (starbucksProducts.getId() == null) { starbucksProducts.setCreateTime(new Date()); starbucksProducts.setOperatorId(9999L); starbucksProducts.setOperatorName("系统生成"); starbucksProducts.setStatus(100); starbucksProducts.setGoodsId(dataObject.getLong("id")); apiProductService.insertStarbucksProducts(starbucksProducts); } else { starbucksProducts.setUpdateTime(new Date()); apiProductService.updateStarbucksProducts(starbucksProducts); } } } return ResponseMsgUtil.success("商品生成成功"); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getKfcStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询肯德基门店") public ResponseData getKfcStore(HttpServletRequest request) { try { JSONObject jsonObject = QianZhuConfig.getKfcStore(); JSONArray object = jsonObject.getJSONArray("data"); for (Object data : object) { JSONObject dataObject = (JSONObject) data; Map mapStore = new HashMap<>(); mapStore.put("storeCode" , dataObject.getString("storeCode")); ApiKfcStores apiKfcStores = apiProductService.findKfcStores(mapStore); if (apiKfcStores == null) { apiKfcStores = new ApiKfcStores(); } apiKfcStores.setProvinceCode(dataObject.getString("provinceCode")); apiKfcStores.setProvinceName(dataObject.getString("provinceName")); apiKfcStores.setCityCode(dataObject.getString("cityCode")); apiKfcStores.setCityName(dataObject.getString("cityName")); apiKfcStores.setCityNameFirstLetter(dataObject.getString("cityNameFirstLetter")); apiKfcStores.setKfcCityId(dataObject.getInteger("kfcCityId")); apiKfcStores.setKfcCityCode(dataObject.getString("kfcCityCode")); apiKfcStores.setStoreName(dataObject.getString("storeName")); apiKfcStores.setStoreCode(dataObject.getString("storeCode")); apiKfcStores.setLon(dataObject.getString("lon")); apiKfcStores.setLat(dataObject.getString("lat")); apiKfcStores.setAddress(dataObject.getString("address")); apiKfcStores.setStartTime(dataObject.getString("startTime")); apiKfcStores.setEndTime(dataObject.getString("endTime")); apiKfcStores.setStoreStatus(dataObject.getInteger("storeStatus")); apiKfcStores.setShelfStatus(dataObject.getInteger("shelfStatus")); if (apiKfcStores.getId() == null) { apiKfcStores.setCreateTime(new Date()); apiKfcStores.setOperatorId(9999L); apiKfcStores.setOperatorName("系统生成"); apiKfcStores.setStatus(100); apiProductService.insertKfcStore(apiKfcStores); } else { apiKfcStores.setUpdateTime(new Date()); apiProductService.updateKfcStore(apiKfcStores); } } return ResponseMsgUtil.success("生成成功"); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/insertCity", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "插入城市") public ResponseData insertCity(HttpServletRequest request) { try { JSONObject jsonObject = QianZhuConfig.getAllCities(); JSONArray object = jsonObject.getJSONArray("data"); for (Object data : object) { JSONObject dataObject = (JSONObject) data; ApiCity apiCity = new ApiCity(); apiCity.setCityInitial(dataObject.getString("cityInitial")); apiCity.setCityCode(dataObject.getString("cityCode")); apiCity.setCityName(dataObject.getString("cityName")); apiCity.setProvinceCode(dataObject.getString("provinceCode")); apiCity.setProvinceName(dataObject.getString("provinceName")); apiCity.setCreateTime(new Date()); apiCity.setUpdateTime(new Date()); apiCity.setOperatorId(9999L); apiCity.setOperatorName("系统生成"); apiCity.setStatus(100); apiProductService.insertCity(apiCity); } return ResponseMsgUtil.success("生成成功"); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/updatePrice", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "更新价格") public ResponseData updatePrice() { try { List list = rechargePriceService.getListRechargePrice(new HashMap<>()); for (OutRechargePrice rechargePrice : list) { BsRechargeCode rechargeCode = new BsRechargeCode(); if (rechargePrice.getGoodsId() != null) { rechargeCode.setStatus(100); rechargeCode.setUpdateTime(new Date()); rechargeCode.setCreateTime(new Date()); rechargeCode.setGoodsId(rechargePrice.getGoodsId().toString()); rechargeCode.setOperatorName("系统自动更新"); rechargeCode.setType(1); rechargeCode.setSourceId(rechargePrice.getId().toString()); rechargeCode.setRechargePlatform(2); rechargeCodeService.insertRechargeCode(rechargeCode); } } return ResponseMsgUtil.success("生成成功"); } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/test", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "测试") public ResponseData test(@RequestBody JSONObject object) { try { return ResponseMsgUtil.success(HuiLianTongConfig.test(object)); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/下单", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "支付") public ResponseData insertV2() { try { String orderNo = "HF2022080818504922206"; JSONObject object = QianZhuConfig.insertV2("PLM100024", orderNo, "15585850137"); object.put("orderNo", orderNo); return ResponseMsgUtil.success(object); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file diff --git a/hai-bweb/src/main/resources/dev/application.yml b/hai-bweb/src/main/resources/dev/application.yml index 12afce1e..fdea2024 100644 --- a/hai-bweb/src/main/resources/dev/application.yml +++ b/hai-bweb/src/main/resources/dev/application.yml @@ -68,7 +68,6 @@ mybatis: - classpath*:sqlmap*/*.xml type-aliases-package: org.springboot.sample.entity - jetcache: statIntervalMinutes: 15 areaInCacheName: false diff --git a/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java b/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java index ad89d1d8..262691f1 100644 --- a/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java +++ b/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java @@ -124,6 +124,9 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/highGas/*") .excludePathPatterns("/wechat/*") .excludePathPatterns("/tuanyou/*") + .excludePathPatterns("/notify/*") + .excludePathPatterns("/highOrder/getOrderByOrderNo") + .excludePathPatterns("/coupon/getUserCouponByOrderNo") .excludePathPatterns("/unionPay/*") .excludePathPatterns("/highGas/*") .excludePathPatterns("/common/*") diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java b/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java index faebbc10..6a579f3d 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java @@ -1,17 +1,21 @@ package com.cweb.controller; +import com.alibaba.fastjson.JSONObject; +import com.cweb.config.SysConst; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.hai.common.QRCodeGenerator; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; +import com.hai.common.utils.DateUtil; +import com.hai.common.utils.IDGenerator; import com.hai.common.utils.ResponseMsgUtil; -import com.hai.entity.BsCompany; -import com.hai.entity.HighCoupon; -import com.hai.entity.HighUserCoupon; -import com.hai.entity.SecRegion; +import com.hai.config.ChongQingCNPCService; +import com.hai.config.CommonSysConst; +import com.hai.entity.*; import com.hai.model.HighUserCouponModel; import com.hai.model.HighUserModel; import com.hai.model.ResponseData; @@ -27,6 +31,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.net.URLEncoder; import java.util.*; /** @@ -56,6 +61,12 @@ public class HighCouponController { @Resource private HighUserCouponService highUserCouponService; + @Resource + private HighCouponCodeOtherService couponCodeOtherService; + + @Resource + private HighOrderService orderService; + @Resource private HighMerchantStoreService highMerchantStoreService; @@ -201,6 +212,90 @@ public class HighCouponController { } } + @RequestMapping(value = "/getUserCouponByOrderNo", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据订单号 查询用户卡券") + public ResponseData getUserCouponByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo, HttpServletRequest request) { + try { + // 用户 + SessionObject sessionObject = userCenter.getSessionObject(request); + HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); + + HighOrder order = orderService.getOrderByOrderNo(orderNo); + if (order == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单"); + } + + // 查询最新一张可用的卡券 + HighUserCoupon newCoupon = highUserCouponService.getUserCouponByOrder(userInfoModel.getHighUser().getId(), order.getId()); + + if (newCoupon != null) { + Map map = new HashMap<>(); + map.put("highUserCoupon", newCoupon); + map.put("couponInfo", highCouponService.getCouponById(newCoupon.getCouponId())); + map.put("couponCodeInfo", highCouponCodeService.getCouponCodeById(newCoupon.getCouponCodeId())); + return ResponseMsgUtil.success(map); + } + return ResponseMsgUtil.success(null); + + } catch (Exception e) { + log.error("HighCouponController --> getUserNewCouponDetail() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/getVerifyQRCode", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "获取核销二维码") + public ResponseData getVerifyQRCode(@RequestParam(name = "userCouponId", required = true) Long userCouponId) { + try { + // 用户 + HighUserModel userInfoModel = userCenter.getSessionModel(HighUserModel.class); + if (userInfoModel == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "用户信息错误"); + } + + // 查询最新一张可用的卡券 + HighUserCoupon userCoupon = highUserCouponService.getDetailById(userCouponId); + if (userCoupon == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "生成失败"); + } + if (!userCoupon.getStatus().equals(1)) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "状态异常,无法生成"); + } + if (!userCoupon.getUserId().equals(userInfoModel.getHighUser().getId())) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "用户异常,无法生成"); + } + + HighCouponCodeOther couponCodeOther = couponCodeOtherService.getDetailByCouNo(userCoupon.getQrCodeImg()); + if (couponCodeOther == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到卡券订单"); + } + + HighOrder order = orderService.getOrderById(couponCodeOther.getOrderId()); + if (order == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到交易订单"); + } + + // 类型: 1 贵州中石化 2 重庆中石油 + if (couponCodeOther.getType() != null && couponCodeOther.getType().equals(2)) { + // 获取动态核销码 + JSONObject code = ChongQingCNPCService.getCNPCCheckCode(couponCodeOther.getCouNo(), order.getOrderNo()); + + // 生成二维码 + String qrCodeImgUrl = DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(1) +".jpg"; + QRCodeGenerator.generateQRCodeImage(code.getString("checkCode"), 350, 350, SysConst.getSysConfig().getFileUrl()+"/temporary/"+qrCodeImgUrl); + return ResponseMsgUtil.success(qrCodeImgUrl); + } + + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "生成失败"); + + } catch (Exception e) { + log.error("HighCouponController --> getVerifyQRCode() error!", e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value = "/againReceiveCoupon", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "卡卷过期,再次领取") diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java index f5085b68..16125252 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java @@ -211,7 +211,7 @@ public class HighOrderController { childOrder.setGoodsPrice(coupon.getDiscountPrice()); } // 贵州中石化 - if (coupon.getCouponSource() != 4) { + if (coupon.getCouponSource() != 4 && coupon.getCouponSource() != 5) { if (highCouponCodeService.getStockCountByCoupon(coupon.getId()) <= 0) { log.error("HighOrderController --> addOrder() error!", "卡卷库存数量不足"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "系统维护中"); @@ -572,6 +572,20 @@ public class HighOrderController { } } + @RequestMapping(value = "/getOrderByOrderNo", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据订单号查询订单详情") + public ResponseData getOrderByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo) { + try { + + return ResponseMsgUtil.success(highOrderService.getOrderByOrderNo(orderNo)); + + } catch (Exception e) { + log.error("HighOrderController --> getOrderByOrderNo() error!", e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value = "/getOrderById", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据id查询订单详情") diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java b/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java new file mode 100644 index 00000000..4ea57193 --- /dev/null +++ b/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java @@ -0,0 +1 @@ +package com.cweb.controller; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.cweb.config.SysConst; import com.hai.common.Base64Util; import com.hai.common.exception.ErrorCode; 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.utils.*; import com.hai.config.*; import com.hai.dao.HighGasOrderPushMapper; import com.hai.entity.*; import com.hai.enum_type.MerchantStoreSourceType; import com.hai.model.*; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; import org.bouncycastle.util.encoders.UrlBase64; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.util.IdGenerator; import org.springframework.web.bind.annotation.*; import sun.nio.cs.StreamEncoder; import javax.annotation.Resource; import javax.net.ssl.SSLContext; import javax.servlet.http.HttpServletRequest; import java.io.*; import java.math.BigDecimal; import java.nio.charset.StandardCharsets; import java.security.KeyStore; import java.util.*; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private HighMerchantService highMerchantService; @Resource private HighMerchantStoreService highMerchantStoreService; @Resource private HighGasOilPriceService highGasOilPriceService; @Resource private HighOrderService highOrderService; @Resource private HighProfitSharingRecordService highProfitSharingRecordService; @Resource private HighGasOilGunNoService gasOilGunNoService; @Resource private HighGasOrderPushMapper highGasOrderPushMapper; @Resource private HuiLianTongConfig huiLianTongConfig; @Resource private UnionPayConfig unionPayConfig; @Resource private UnionStagingPayConfig unionStagingPayConfig; @Resource private UnionUserConfig unionUserConfig; @Resource private OutRechargeOrderService outRechargeOrderService; @Resource private HighOilCardService oilCardService; @Resource private BaiduVoiceService baiduVoiceService; @Resource private MqttProviderConfig mqttProviderConfig; @Autowired private WebSocket webSocket; @Resource private ShellGroupService shellGroupService; @Resource private HighGasService gasService; @Resource private JinZhuJiaYouService jinZhuJiaYouService; /* @RequestMapping(value = "/spPrint", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "发送打印机消息") public ResponseData spPrint(@RequestParam(name = "orderNo", required = true) String orderNo, HttpServletRequest request) { try { HighOrder highOrder = highOrderService.getOrderByOrderNo(orderNo); for (HighChildOrder highChildOrder : highOrder.getHighChildOrderList()) { HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId()); new Thread(() -> { try { SpPrinterConfig sp = new SpPrinterConfig(); sp.print(store.getDeviceSn(), SpPrinterTemplate.oilCashierStubTemp( highChildOrder.getGoodsName(), highOrder.getOrderNo(), DateUtil.date2String(highOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"), "嗨森逛", highChildOrder.getGasGunNo(), highChildOrder.getGasOilNo(), highChildOrder.getGasOilLiters().toString(), highOrder.getTotalPrice().toString(), new HashMap<>(), false ), 1); Thread.sleep(6000); sp.print(store.getDeviceSn(), SpPrinterTemplate.oilClientStubTemp( highChildOrder.getGoodsName(), highOrder.getOrderNo(), DateUtil.date2String(highOrder.getPayTime(), "yyyy-MM-dd HH:mm:ss"), "嗨森逛", highChildOrder.getGasGunNo(), highChildOrder.getGasOilNo(), highChildOrder.getGasOilLiters().toString(), highOrder.getTotalPrice().toString(), new HashMap<>(), false ), 1); } catch (Exception e) { e.printStackTrace(); } }).start(); } return ResponseMsgUtil.success("发送成功"); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e); return ResponseMsgUtil.exception(e); } } */ @RequestMapping(value = "/queryGasInfoByGasId", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据油站 id 拉取最新的油站数据") public ResponseData queryGasInfoByGasId(@RequestParam(name = "gasId", required = true) String gasId, HttpServletRequest request) { try { return ResponseMsgUtil.success(TuanYouConfig.queryGasInfoByGasId(gasId)); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/initTYMerchantStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "初始化加油站") public ResponseData initTYMerchantStore(@RequestParam(name = "merchantId", required = true) Long merchantId) throws Exception { HighMerchantModel merchant = highMerchantService.getMerchantById(merchantId); if (merchant == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户"); } JSONObject jsonObjectP = TuanYouConfig.queryGasInfoListByPage(1, 1000); JSONObject resultObjectP = jsonObjectP.getObject("result", JSONObject.class); for (int i = 1; i <= resultObjectP.getInteger("totalPageNum").intValue(); i++) { JSONObject jsonObject = TuanYouConfig.queryGasInfoListByPage(i, 1000); JSONObject resultObject = jsonObject.getObject("result", JSONObject.class); JSONArray jsonArray = resultObject.getJSONArray("gasInfoList"); HighMerchantStore highMerchantStore; HighGasOilPrice highGasOilPrice; for (Object gasObject : jsonArray) { JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(gasObject)); HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreByKey(object.getString("gasId")); if (store != null) { store.setType(1); store.setMerchantId(merchant.getId()); store.setCompanyId(merchant.getCompanyId()); store.setStoreKey(object.getString("gasId")); store.setStoreName(object.getString("gasName")); store.setStoreLogo(object.getString("gasLogoSmall")); store.setRegionId(object.getLong("provinceCode")); store.setRegionName(object.getString("provinceName")); store.setAddress(object.getString("gasAddress")); store.setLongitude(object.getString("gasAddressLongitude")); store.setLatitude(object.getString("gasAddressLatitude")); store.setStatus(object.getInteger("gasStatus")); store.setOperatorId(0L); store.setOperatorName("系统创建"); store.setUpdateTime(new Date()); store.setExt1(object.getString("gasSourceId")); highMerchantStoreService.updateMerchantStoreDetail(store); JSONArray oilPriceList = object.getJSONArray("oilPriceList"); for (Object oilPrice : oilPriceList) { JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); // 查询门店油号 highGasOilPrice = highGasOilPriceService.getGasOilPriceByStoreAndOilNo(store.getId(), oilPriceObject.getInteger("oilNo")); if (highGasOilPrice == null) { highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); } else { highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); } highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } else { highMerchantStore = new HighMerchantStore(); highMerchantStore.setType(1); highMerchantStore.setMerchantId(merchant.getId()); highMerchantStore.setCompanyId(merchant.getCompanyId()); highMerchantStore.setStoreKey(object.getString("gasId")); highMerchantStore.setStoreName(object.getString("gasName")); highMerchantStore.setStoreLogo(object.getString("gasLogoSmall")); highMerchantStore.setRegionId(object.getLong("provinceCode")); highMerchantStore.setRegionName(object.getString("provinceName")); highMerchantStore.setAddress(object.getString("gasAddress")); highMerchantStore.setLongitude(object.getString("gasAddressLongitude")); highMerchantStore.setLatitude(object.getString("gasAddressLatitude")); highMerchantStore.setStatus(1); highMerchantStore.setOperatorId(0L); highMerchantStore.setOperatorName("系统创建"); highMerchantStore.setCreateTime(new Date()); highMerchantStore.setUpdateTime(new Date()); highMerchantStore.setExt1(object.getString("gasSourceId")); HighMerchantStoreModel merchantStoreModel = new HighMerchantStoreModel(); BeanUtils.copyProperties(highMerchantStore, merchantStoreModel); highMerchantStoreService.insertMerchantStore(merchantStoreModel); JSONArray oilPriceList = object.getJSONArray("oilPriceList"); for (Object oilPrice : oilPriceList) { JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(merchantStoreModel.getId()); highGasOilPrice.setOilNo(oilPriceObject.getInteger("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } } } return ResponseMsgUtil.success("初始化完成"); } @RequestMapping(value = "/detectTYMerchantStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "检测加油站") public ResponseData detectTYMerchantStore(@RequestParam(name = "merchantId", required = true) Long merchantId) throws Exception { HighMerchantModel merchant = highMerchantService.getMerchantById(merchantId); if (merchant == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到商户"); } Map param = new HashMap<>(); param.put("merchantId", merchant.getId()); List stores = highMerchantStoreService.getMerchantStoreList(param); for (HighMerchantStore store : stores) { JSONObject jsonObject = TuanYouConfig.queryGasInfoByGasId(store.getStoreKey()); if (jsonObject != null && jsonObject.getString("code").equals("200")) { JSONObject result = jsonObject.getJSONObject("result"); store.setStatus(result.getInteger("gasStatus")); } else { store.setStatus(0); } highMerchantStoreService.updateMerchantStoreDetail(store); } return ResponseMsgUtil.success("初始化完成"); } /* @RequestMapping(value = "/pushTuanYouOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "推送团油订单") public ResponseData pushTuanYouOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); for (HighChildOrder highChildOrder : order.getHighChildOrderList()) { HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId()); // 推送团油订单 Map paramMap = new HashMap<>(); paramMap.put("gasId", store.getStoreKey()); paramMap.put("oilNo", highChildOrder.getGasOilNo()); paramMap.put("gunNo", highChildOrder.getGasGunNo()); BigDecimal priceGun = highChildOrder.getGasPriceGun(); BigDecimal priceVip = highChildOrder.getGasPriceVip(); paramMap.put("priceGun", priceGun); // 枪单价 paramMap.put("priceVip", priceVip); // 优惠价 paramMap.put("driverPhone", order.getMemPhone()); // paramMap.put("driverPhone", "17726395120"); paramMap.put("thirdSerialNo", order.getOrderNo()); paramMap.put("refuelingAmount", highChildOrder.getTotalPrice()); // 油品类型 1:汽油:2:柴油;3:天然气 if (highChildOrder.getGasOilType() == 1) { paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouGasolineAccount()); } else if (highChildOrder.getGasOilType() == 2) { paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouDieselAccount()); } JSONObject orderPushObject = TuanYouConfig.refuelingOrderPush(paramMap); // 推送团油订单记录 HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); highGasOrderPush.setCreateTime(new Date()); highGasOrderPush.setCode(orderPushObject.getString("code")); highGasOrderPush.setRequestContent(JSONObject.toJSONString(paramMap)); highGasOrderPush.setReturnContent(orderPushObject.toJSONString()); highGasOrderPushMapper.insert(highGasOrderPush); if (orderPushObject != null && orderPushObject.getString("code").equals("200")) { highChildOrder.setGasOrderNo(orderPushObject.getJSONObject("result").getString("orderNo")); } highOrderService.updateOrder(order); } return ResponseMsgUtil.success(order); } catch (Exception e) { log.error("HighOrderController --> getOrderById() error!", e); return ResponseMsgUtil.exception(e); } } */ @RequestMapping(value = "/queryCompanyAccountInfo2JD", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询团油余额") public ResponseData queryCompanyAccountInfo2JD() { try { return ResponseMsgUtil.success(TuanYouConfig.queryCompanyAccountInfo2JD()); } catch (Exception e) { log.error("HighOrderController --> queryCompanyAccountInfo2JD() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryCompanyPriceDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询团油余额") public ResponseData queryCompanyPriceDetail() { try { return ResponseMsgUtil.success(TuanYouConfig.queryCompanyPriceDetail("LW000115995", "92")); } catch (Exception e) { log.error("HighOrderController --> queryCompanyAccountInfo2JD() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/starbucksOrdersPay", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "星巴克支付") public ResponseData starbucksOrdersPay(@RequestParam(name = "orderNo", required = true) String orderNo) { try { return ResponseMsgUtil.success(QianZhuConfig.starbucksOrdersPay(orderNo)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/payKfcOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "肯德基支付") public ResponseData payKfcOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { try { return ResponseMsgUtil.success(QianZhuConfig.payKfcOrder(orderNo)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/wxSplitAccount", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "微信分账") public ResponseData wxSplitAccount() { try { HighOrder orderNo = highOrderService.getOrderByOrderNo("HF2021101812025050304"); wxProfitsharing(orderNo.getOrderNo(), orderNo.getPaySerialNo(), orderNo.getPayRealPrice()); return ResponseMsgUtil.success("分账成功"); } catch (Exception e) { log.error("HighOrderController --> getOrderById() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryStaging", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "分期查询") public ResponseData queryStaging(@RequestParam(name = "oriOrgTrace", required = true) String oriOrgTrace, HttpServletRequest request) { try { String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0, 4) + CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4, CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length()) + DateUtil.format(new Date(), DateUtil.YMDHMS) + IDGenerator.nextId(6); return ResponseMsgUtil.success(UnionStagingPayConfig.queryStaging(orgTrace, oriOrgTrace, "", new Date(), request)); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } /* @RequestMapping(value = "/orderToRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "退款") public ResponseData orderToRefund(HttpServletRequest request) { try { OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund("4200001301202202035413938093", new BigDecimal("30.80"), new BigDecimal("16.90")); return ResponseMsgUtil.success(orderRefundModel); } catch (Exception e) { log.error("HighOrderController --> orderToRefund() error!", e); return ResponseMsgUtil.exception(e); } }*/ @RequestMapping(value = "/query", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "订单查询") public ResponseData query(@RequestParam(name = "oriOrgTrace", required = true) String oriOrgTrace, HttpServletRequest request) { try { String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0, 4) + CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4, CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length()) + DateUtil.format(new Date(), DateUtil.YMDHMS) + IDGenerator.nextId(6); return ResponseMsgUtil.success(UnionStagingPayConfig.query(orgTrace, oriOrgTrace, "", new Date(), request)); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } public void wxProfitsharing(String transaction_id, String out_order_no, BigDecimal amount) { try { Map param = new LinkedHashMap<>(); param.put("appid", "wx637bd6f7314daa46"); param.put("mch_id", "1289663601"); param.put("sub_mch_id", "1609882817"); // 个体户黎杨珍 param.put("transaction_id", transaction_id); param.put("out_order_no", out_order_no); param.put("nonce_str", WxUtils.makeNonStr()); // 分账金额 BigDecimal porofitSharingAmount = amount; List> receiversList = new ArrayList<>(); Map receiversMap = new LinkedHashMap<>(); receiversMap.put("type", "MERCHANT_ID"); receiversMap.put("account", "1603942866"); receiversMap.put("amount", porofitSharingAmount.multiply(new BigDecimal("100")).intValue()); receiversMap.put("description", "分给商户【惠昕石化】"); receiversList.add(receiversMap); param.put("receivers", JSONObject.toJSONString(receiversList)); String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5", WXPayConstants.SignType.HMACSHA256); param.put("sign", signStr); String resultXmL = this.doRefundRequest(param.get("mch_id"), null, WxUtils.mapToXml(param)); // 请求分账返回的结果 ResultProfitSharing resultProfitSharing = XmlUtil.getObjectFromXML(resultXmL, ResultProfitSharing.class); if (!resultProfitSharing.getResult_code().equals("FAIL")) { HighProfitSharingRecord sharingRecord = new HighProfitSharingRecord(); sharingRecord.setOutOrderNo(resultProfitSharing.getOut_order_no()); sharingRecord.setTransactionId(resultProfitSharing.getTransaction_id()); sharingRecord.setOrderId(resultProfitSharing.getOrder_id()); sharingRecord.setStatus(resultProfitSharing.getResult_code()); sharingRecord.setPrice(amount); sharingRecord.setCreateTime(new Date()); sharingRecord.setContent(resultXmL); highProfitSharingRecordService.insert(sharingRecord); } } catch (Exception e) { log.error("CmsContentController --> getCorporateAdvertising() error!", e); } } public CloseableHttpClient readCertificate(String mchId) throws Exception { /** * 注意PKCS12证书 是从微信商户平台-》账户设置-》 API安全 中下载的 */ KeyStore keyStore = KeyStore.getInstance("PKCS12"); //P12文件目录 证书路径,这里需要你自己修改,linux下还是windows下的根路径 FileInputStream instream = new FileInputStream("/home/project/wx_cert/1289663601_apiclient_cert.p12"); // FileInputStream instream = new FileInputStream("G:\\hurui-project/hai-parent/hai-service/src/main/java/privatekey/1289663601_apiclient_cert.p12"); try { keyStore.load(instream, "1289663601".toCharArray());//这里写密码..默认是你的MCHID } finally { instream.close(); } SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore, "1289663601".toCharArray()).build();//这里也是写密码的 SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext, SSLConnectionSocketFactory.getDefaultHostnameVerifier()); // Allow TLSv1 protocol only return HttpClients.custom().setSSLSocketFactory(sslsf).build(); } public String doRefundRequest(String mchId, String url, String data) throws Exception { //小程序退款需要调用双向证书的认证 CloseableHttpClient httpClient = readCertificate(mchId); try { HttpPost httpost = new HttpPost("https://api.mch.weixin.qq.com/secapi/pay/profitsharing"); // 设置响应头信息 httpost.addHeader("Connection", "keep-alive"); httpost.addHeader("Accept", "*/*"); httpost.addHeader("Content-Type", "text/xml"); httpost.addHeader("Host", "api.mch.weixin.qq.com"); httpost.addHeader("X-Requested-With", "XMLHttpRequest"); httpost.addHeader("Cache-Control", "max-age=0"); httpost.addHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) "); httpost.setEntity(new StringEntity(data, "UTF-8")); CloseableHttpResponse response = httpClient.execute(httpost); try { HttpEntity entity = response.getEntity(); String jsonStr = EntityUtils.toString(response.getEntity(), "UTF-8"); EntityUtils.consume(entity); return jsonStr; } finally { response.close(); } } catch (Exception e) { throw new RuntimeException(e); } finally { httpClient.close(); } } @RequestMapping(value = "/websocket", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "websocket") public ResponseData websocket(@RequestParam(name = "orderNo", required = true) String orderNo ) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); if (order.getHighChildOrderList().get(0).getGoodsType().equals(3)) { Map pushMsg = new HashMap<>(); pushMsg.put("userId", order.getHighChildOrderList().get(0).getGoodsId()); Map msgContent = new HashMap<>(); msgContent.put("order", highOrderService.getGasOrderDetail(order.getOrderNo())); msgContent.put("voice", baiduVoiceService.text2audio(order.getHighChildOrderList().get(0).getGoodsName() + "加油站,收款:" + order.getTotalPrice())); pushMsg.put("message", JSONObject.toJSONString(msgContent)); HttpsUtils.doPost("http://127.0.0.1:9901/msg/test/websocket", pushMsg, new HashMap<>()); } return ResponseMsgUtil.success("null"); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/gasStationQueryDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "gasStationQueryDetail") public ResponseData gasStationQueryDetail() { try { return ResponseMsgUtil.success(shellGroupService.gasStationQueryDetail("0001")); } catch (Exception e) { log.error("HighOrderController --> gasStationQueryDetail() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/gasPageQueryAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "gasPageQueryAllStation") public ResponseData gasPageQueryAllStation() { try { gasService.getJiaHaoYouAllStation(); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighOrderController --> gasPageQueryAllStation() error!", e); return ResponseMsgUtil.exception(e); } } /* @RequestMapping(value = "/gasSyncPayment", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "gasSyncPayment") public ResponseData gasSyncPayment() { try { HighOrder order = highOrderService.getOrderByOrderNo("HF2022071114274054900"); for (HighChildOrder childOrder : order.getHighChildOrderList()) { HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(childOrder.getGoodsId()); // 推送壳牌 JSONObject syncPayment = shellGroupService.gasSyncPayment(order.getOrderNo(), // store.getStoreKey(), "0001", new Date(), order.getTotalPrice(), "92", "1", order.getPayRealPrice(), childOrder.getGasDiscount() ); } return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighOrderController --> gasPageQueryAllStation() error!", e); return ResponseMsgUtil.exception(e); } }*/ @RequestMapping(value = "/gasSyncRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "gasSyncRefund") public ResponseData gasSyncRefund() { try { shellGroupService.gasSyncRefund(new Date(1659511289000L), "1659511289357"); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighOrderController --> gasSyncRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getJzStationListPage", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "getJzStationListPage") public ResponseData getJzStationListPage() { try { gasService.getJinZhuAllStation(); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighOrderController --> gasSyncRefund() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/test", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "test") public ResponseData test() { try { JSONObject data = HuiLianTongUnionCardConfig.resolveResponse("Gbkl57c3fECXJRiCSOspjsb3bIyyFrE4TyMKKGsSAMzeXLElQQU00GoYZSYkJYg1G2Xlic2QvOd3\\nhJC7bc6qAg+9aoZr3IJi"); return ResponseMsgUtil.success(data); } catch (Exception e) { log.error("HighOrderController --> gasSyncRefund() error!", e); return ResponseMsgUtil.exception(e); } } public static String hexStringToString(String s) { if (s == null || s.equals("")) { return null; } s = s.replace(" ", ""); byte[] baKeyword = new byte[s.length() / 2]; for (int i = 0; i < baKeyword.length; i++) { try { baKeyword[i] = (byte) (0xff & Integer.parseInt(s.substring(i * 2, i * 2 + 2), 16)); } catch (Exception e) { e.printStackTrace(); } } try { s = new String(baKeyword, "UTF-8"); } catch (Exception e1) { e1.printStackTrace(); } return s; } /** * 获取打印内容,适用于云打印机 * * @param printText 打印文本 * @param pageCount 打印联数 * @param encodingStr 编码方式,默认UTF-8 * @return */ public byte[] getPrinterBytes(final byte[] printText, final int pageCount, String encodingStr) { try { byte[] array = new byte[printText.length + 9]; array[0] = 30; array[1] = 16; array[2] = (byte) pageCount;//打印份数 int num = array.length - 5; array[3] = (byte) (num >> 8); //array[4] = (byte)((uint)num & 0xFFu); array[4] = (byte) (num & 0xFF); for (int i = 0; i < printText.length; i++) { array[i + 5] = printText[i]; } array[array.length - 4] = 27; array[array.length - 3] = 99; byte[] crc16CodeArray = getCRC(printText); array[array.length - 2] = crc16CodeArray[0]; array[array.length - 1] = crc16CodeArray[1]; return array; /* if(encodingStr.equals("")){ encodingStr="UTF-8"; } byte[] msgByte = printText; // 消息数组 final byte[] dataByte = new byte[msgByte.length + 9]; dataByte[0] = 0x1E; dataByte[1] = 0x10; dataByte[2] = (byte) pageCount;// 打印多联 // 有效数据长度 final int len = dataByte.length - 5; dataByte[3] = (byte) (len >> 8); dataByte[4] = (byte) (len & 0xff); // 数据内容 System.arraycopy(msgByte, 0, dataByte, 5, msgByte.length); // 标识字节 dataByte[dataByte.length - 4] = 0x1b; dataByte[dataByte.length - 3] = 0x63; // 打印内容CRC校验 final byte[] dtCRC = getCRC(msgByte); dataByte[dataByte.length - 2] = (byte) (dtCRC[0]); dataByte[dataByte.length - 1] = (byte) (dtCRC[1]); msgByte = dataByte; return msgByte;*/ } catch (Exception ex) { System.out.println(ex.getStackTrace()); } return null; } /** * 获取打印内容,适用于云打印机 * * @param printText 打印文本 * @param pageCount 打印联数 * @param encodingStr 编码方式,默认UTF-8 * @return */ public byte[] getPrinterBytes(final String printText, final int pageCount, String encodingStr) { try { if (encodingStr.equals("")) { encodingStr = "UTF-8"; } byte[] msgByte = printText.getBytes(encodingStr); // 消息数组 final byte[] dataByte = new byte[msgByte.length + 9]; dataByte[0] = 0x1E; dataByte[1] = 0x10; dataByte[2] = (byte) pageCount;// 打印多联 // 有效数据长度 final int len = dataByte.length - 5; dataByte[3] = (byte) (len >> 8); dataByte[4] = (byte) (len & 0xff); // 数据内容 System.arraycopy(msgByte, 0, dataByte, 5, msgByte.length); // 标识字节 dataByte[dataByte.length - 4] = 0x1b; dataByte[dataByte.length - 3] = 0x63; // 打印内容CRC校验 final byte[] dtCRC = getCRC(msgByte); dataByte[dataByte.length - 2] = (byte) (dtCRC[0]); dataByte[dataByte.length - 1] = (byte) (dtCRC[1]); msgByte = dataByte; return msgByte; } catch (Exception ex) { System.out.println(ex.getStackTrace()); } return null; } private static int[] CRC16Table = {0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78}; private static byte[] getCRC(byte[] bytes) { int crc = 0xFFFF; // 初始值 for (byte b : bytes) { crc = (crc >> 8) ^ CRC16Table[(crc ^ b) & 0xff]; } byte[] b = new byte[2]; b[0] = (byte) ((crc >> 8) ^ 0xff); b[1] = (byte) ((crc & 0xff) ^ 0xff); return b; } private static final char[] HEXES = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; /** * byte数组 转换成 16进制小写字符串 */ private String bytes2Hex(byte[] bytes) { if (bytes == null || bytes.length == 0) { return null; } StringBuilder hex = new StringBuilder(); for (byte b : bytes) { hex.append(HEXES[(b >> 4) & 0x0F]); hex.append(HEXES[b & 0x0F]); } return hex.toString(); } @RequestMapping(value = "/insertV2", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "支付") public ResponseData insertV2() { try { String orderNo = "HF2022080818504922206"; JSONObject object = QianZhuConfig.insertV2("PLM100024", orderNo, "15585850137"); object.put("orderNo", orderNo); return ResponseMsgUtil.success(object); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } /* @RequestMapping(value = "/QueryV2", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询订单号") public ResponseData QueryV2(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); JSONObject orderObject = QianZhuConfig.QueryV2(orderNo); if (orderObject != null && orderObject.getLong("Code") == 999) { // 订单失败 // 订单状态 1:订单正在处理中 2;订单成功: 3 订单失败 if (orderObject.getJSONObject("Data").getInteger("OrderState") == 3) { // 订单失败 if (order.getOrderStatus() == 2) { highOrderService.thirdOrderToRefund(order.getId()); } else { highOrderService.thirdCancelOrder(order.getId()); } } // 订单状态 1:订单正在处理中 2;订单成功: 3 订单失败 if (orderObject.getJSONObject("Data").getInteger("OrderState") == 2) { for (HighChildOrder childOrder : order.getHighChildOrderList()) { childOrder.setChildOrdeStatus(3); } order.setOrderStatus(3); order.setFinishTime(new Date()); highOrderService.updateOrder(order); } } return ResponseMsgUtil.success(QianZhuConfig.QueryV2(orderNo)); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } */ @RequestMapping(value = "/getKfcOrderByOrderNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询肯德基订单") public ResponseData getKfcOrderByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo) { try { return ResponseMsgUtil.success(QianZhuConfig.getKfcOrderByOrderNo(orderNo)); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/starbucksOrderByOrderNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询星巴克订单") public ResponseData starbucksOrderByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo) { try { return ResponseMsgUtil.success(QianZhuConfig.starbucksOrderByOrderNo(orderNo)); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/thirdOrderToRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "第三方退款") public ResponseData thirdOrderToRefund(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); highOrderService.thirdOrderToRefund(order.getId()); return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/rechargeOrderByCy", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "城宇话费充值 ") public ResponseData rechargeOrderByCy() { try { JSONObject object = new JSONObject(); object.put("mobile" , "18090580471"); object.put("productId" , 172); object.put("agentOrderId" , "RCG" + DateUtil.date2String(new Date(), "yyyyMMddHHmmss") + IDGenerator.nextId(5)); return ResponseMsgUtil.success(RechargeConfig.rechargeOrderByCy(object)); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryRechargeByCy", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "城宇查询订单") public ResponseData queryRechargeByCy(@RequestParam(name = "orderNo", required = true) String orderNo) { try { JSONObject object = new JSONObject(); object.put("orderNo" , orderNo); return ResponseMsgUtil.success(RechargeConfig.queryRechargeByCy(object)); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/postIp", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "请求ip地址") public ResponseData postIp(HttpServletRequest request) { try { request.getHeader("regionId"); if (request.getHeader("regionId") != null && request.getHeader("regionId").length() != 0) { System.out.println("111"); } return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsgcs.dctpay.com/brest/openApi/test")); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file diff --git a/hai-cweb/src/main/java/com/cweb/controller/NotifyController.java b/hai-cweb/src/main/java/com/cweb/controller/NotifyController.java new file mode 100644 index 00000000..ae356fb4 --- /dev/null +++ b/hai-cweb/src/main/java/com/cweb/controller/NotifyController.java @@ -0,0 +1,114 @@ +package com.cweb.controller; + +import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; +import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; +import cn.binarywang.wx.miniapp.bean.WxMaUserInfo; +import com.alibaba.fastjson.JSONObject; +import com.cweb.config.SysConst; +import com.cweb.config.WxMaConfiguration; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; +import com.hai.common.security.SessionObject; +import com.hai.common.security.UserCenter; +import com.hai.common.utils.*; +import com.hai.config.ChongQingCNPCService; +import com.hai.config.CommonSysConst; +import com.hai.dao.HighGasOrderPushMapper; +import com.hai.entity.*; +import com.hai.enum_type.OrderPushType; +import com.hai.model.HighUserModel; +import com.hai.model.ResponseData; +import com.hai.service.HighCouponCodeOtherService; +import com.hai.service.HighUserService; +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.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.*; + +@Controller +@RequestMapping(value = "/notify") +@Api(value = "通知") +public class NotifyController { + + private static final Logger log = LoggerFactory.getLogger(NotifyController.class); + + @Resource + private HighCouponCodeOtherService couponCodeOtherService; + + @Resource + private HighGasOrderPushMapper highGasOrderPushMapper; + + @RequestMapping(value = "/cqCnpcNotify", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "重庆中石油通知") + public Object cqCnpcNotify(@RequestBody String paramsStr) { + System.out.println(paramsStr); + log.info(paramsStr); + try { + if (StringUtils.isNotBlank(paramsStr)) { + + JSONObject sendMessage = JSONObject.parseObject(paramsStr).getJSONObject("sendMessage"); + JSONObject body = ChongQingCNPCService.decryptBody(sendMessage.getString("body")); + couponCodeOtherService.cqCnpcUseNotify(body); + + HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); + highGasOrderPush.setType(OrderPushType.type10.getType()); + highGasOrderPush.setOrderNo(body.getString("tradeId")); + highGasOrderPush.setCreateTime(new Date()); + highGasOrderPush.setRequestContent("核销回调"); + highGasOrderPush.setReturnContent(paramsStr); + highGasOrderPushMapper.insert(highGasOrderPush); + + Map param = new HashMap<>(); + param.put("status", 1); + param.put("msg", "成功"); + String verifyCode = AESTool.Encrypt(JSONObject.toJSONString(param), CommonSysConst.getSysConfig().getChongQingCnpcMerKey()); + + Map returnContent = new HashMap<>(); + Map returnPostMessage = new HashMap<>(); + + Map returnHead = new HashMap<>(); + returnHead.put("verifyCode", MD5Util.encode((verifyCode + CommonSysConst.getSysConfig().getChongQingCnpcMerKey()).getBytes()).toLowerCase()); + returnHead.put("requestType", "couponNotice"); + returnPostMessage.put("head", returnHead); + + returnPostMessage.put("body", verifyCode); + returnContent.put("postMessage", returnPostMessage); + return returnContent; + } else { + Map param = new HashMap<>(); + param.put("status", 0); + param.put("msg", "解析参数错误"); + String verifyCode = AESTool.Encrypt(JSONObject.toJSONString(param), CommonSysConst.getSysConfig().getChongQingCnpcMerKey()); + + Map returnContent = new HashMap<>(); + Map returnPostMessage = new HashMap<>(); + + Map returnHead = new HashMap<>(); + returnHead.put("verifyCode", MD5Util.encode((verifyCode + CommonSysConst.getSysConfig().getChongQingCnpcMerKey()).getBytes()).toLowerCase()); + returnHead.put("requestType", "couponNotice"); + returnPostMessage.put("head", returnHead); + + returnPostMessage.put("body", verifyCode); + returnContent.put("postMessage", returnPostMessage); + return returnContent; + } + + } catch (Exception e) { + return null; + // return ResponseMsgUtil.exception(e); + } + } + +} diff --git a/hai-cweb/src/main/java/com/cweb/controller/pay/UnionPayController.java b/hai-cweb/src/main/java/com/cweb/controller/pay/UnionPayController.java index 7ab84bff..81cd0989 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/pay/UnionPayController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/pay/UnionPayController.java @@ -227,6 +227,8 @@ public class UnionPayController { // 卡卷关联用户 HighUserCoupon highUserCoupon = new HighUserCoupon(); + highUserCoupon.setOrderId(order.getId()); + highUserCoupon.setChildOrderId(highChildOrder.getId()); highUserCoupon.setMerchantId(coupon.getMerchantId()); highUserCoupon.setCouponId(coupon.getId()); highUserCoupon.setUserId(order.getMemId()); @@ -248,6 +250,55 @@ public class UnionPayController { highGasOrderPush.setReturnContent(returnParam.toJSONString()); highGasOrderPushMapper.insert(highGasOrderPush); + } else if (coupon.getCouponSource() == 5) { + // 给用户发码 + JSONObject sendResponse = ChongQingCNPCService.sendCNPCTicket(coupon.getCouponKey(), order.getOrderNo(), highChildOrder.getSaleCount(), order.getMemPhone()); + + // 推送记录 + JSONObject sendRequest = new JSONObject(); + sendRequest.put("requestCode", coupon.getCouponKey()); + sendRequest.put("tradeId", order.getOrderNo()); + sendRequest.put("ticketSum", highChildOrder.getSaleCount()); + sendRequest.put("phone", order.getMemPhone()); + + HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); + highGasOrderPush.setType(OrderPushType.type10.getType()); + highGasOrderPush.setOrderNo(order.getOrderNo()); + highGasOrderPush.setCreateTime(new Date()); + highGasOrderPush.setRequestContent(sendRequest.toJSONString()); + highGasOrderPush.setReturnContent(sendResponse.toJSONString()); + highGasOrderPushMapper.insert(highGasOrderPush); + + JSONObject couponDetail = sendResponse.getJSONObject("ticketDetail"); + JSONArray codeList = sendResponse.getJSONArray("codeList"); + + for (Object data : codeList) { + HighCouponCodeOther couponCodeOther = new HighCouponCodeOther(); + couponCodeOther.setType(2); + couponCodeOther.setOrderId(order.getId()); + couponCodeOther.setChildOrderId(highChildOrder.getId()); + couponCodeOther.setCouTypeCode(couponDetail.getString("requestCode")); + couponCodeOther.setCouNo(ChongQingCNPCService.decryptCouponCode(String.valueOf(data))); + couponCodeOther.setActiveTime(DateUtil.format(couponDetail.getString("effectiveTime"), "yyyy-MM-dd")); + couponCodeOther.setValidStartDate(DateUtil.format(couponDetail.getString("effectiveTime"), "yyyy-MM-dd")); + couponCodeOther.setValidEndDate(DateUtil.format(couponDetail.getString("expiredDate"), "yyyy-MM-dd")); + couponCodeOther.setStatus(20); + couponCodeOther.setCreateTime(new Date()); + highCouponCodeOtherMapper.insert(couponCodeOther); + + // 卡卷关联用户 + HighUserCoupon highUserCoupon = new HighUserCoupon(); + highUserCoupon.setOrderId(order.getId()); + highUserCoupon.setChildOrderId(highChildOrder.getId()); + highUserCoupon.setMerchantId(coupon.getMerchantId()); + highUserCoupon.setCouponId(coupon.getId()); + highUserCoupon.setUserId(order.getMemId()); + highUserCoupon.setCreateTime(new Date()); + highUserCoupon.setQrCodeImg(couponCodeOther.getCouNo()); + highUserCoupon.setUseEndTime(couponCodeOther.getValidEndDate()); + highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 + highUserCouponMapper.insert(highUserCoupon); + } } else { HighCouponCode code = highCouponCodeService.getCouponCodeByOrderId(highChildOrder.getId()); code.setStatus(2); // 状态:1.待销售 2.未使用 3.已使用 99.预支付 @@ -255,6 +306,8 @@ public class UnionPayController { highCouponCodeService.updateCouponCode(code); // 卡卷关联用户 HighUserCoupon highUserCoupon = new HighUserCoupon(); + highUserCoupon.setOrderId(order.getId()); + highUserCoupon.setChildOrderId(highChildOrder.getId()); highUserCoupon.setMerchantId(code.getMerchantId()); highUserCoupon.setCouponId(code.getCouponId()); highUserCoupon.setUserId(order.getMemId()); diff --git a/hai-cweb/src/main/resources/dev/logback.xml b/hai-cweb/src/main/resources/dev/logback.xml index dcda78c9..8d23e06c 100644 --- a/hai-cweb/src/main/resources/dev/logback.xml +++ b/hai-cweb/src/main/resources/dev/logback.xml @@ -69,4 +69,25 @@ + + + + log/ChongQingCNPCService.log + + log/ChongQingCNPCService.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + + diff --git a/hai-order/src/main/java/com/web/controller/OrderBWebController.java b/hai-order/src/main/java/com/web/controller/OrderBWebController.java deleted file mode 100644 index f04a891c..00000000 --- a/hai-order/src/main/java/com/web/controller/OrderBWebController.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.web.controller; - -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.hai.common.exception.ErrorCode; -import com.hai.common.exception.ErrorHelp; -import com.hai.common.exception.SysCode; -import com.hai.common.security.UserCenter; -import com.hai.common.utils.ResponseMsgUtil; -import com.hai.enum_type.UserObjectTypeEnum; -import com.hai.model.ResponseData; -import com.hai.model.UserInfoModel; -import com.hai.order.service.OrderService; -import com.hai.order.service.OrderServiceExt; -import com.hai.service.HighGasOrderService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; - -import javax.annotation.Resource; -import java.util.HashMap; -import java.util.Map; - -/** - * @className: OrderExtController - * @author: HuRui - * @date: 2022/9/14 - **/ -@Controller -@RequestMapping(value = "bweb") -@Api(value = "订单业务") -public class OrderBWebController { - - private static Logger log = LoggerFactory.getLogger(OrderBWebController.class); - - @Resource - private UserCenter userCenter; - - @Resource - private OrderService orderService; - - @Resource - private OrderServiceExt orderServiceExt; - - @Resource - private HighGasOrderService gasOrderService; - - @RequestMapping(value="/getCouponOrderList",method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "查询卡券订单列表") - public ResponseData getCouponOrderList(@RequestParam(name = "companyId", required = false) Long companyId, - @RequestParam(name = "orderNo", required = false) String orderNo, - @RequestParam(name = "orderStatus", required = false) Integer orderStatus, - @RequestParam(name = "childOrderNo", required = false) String childOrderNo, - @RequestParam(name = "goodsId", required = false) Long goodsId, - @RequestParam(name = "goodsName", required = false) String goodsName, - @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, - @RequestParam(name = "refundTimeS", required = false) Long refundTimeS, - @RequestParam(name = "refundTimeE", required = false) Long refundTimeE, - @RequestParam(name = "pageNum", required = true) Integer pageNum, - @RequestParam(name = "pageSize", required = true) Integer pageSize - ) { - try { - Map param = new HashMap<>(); - param.put("companyId", companyId); - param.put("orderNo", orderNo); - param.put("orderStatus", orderStatus); - param.put("childOrderNo", childOrderNo); - param.put("goodsId", goodsId); - param.put("goodsName", goodsName); - param.put("createTimeS", createTimeS); - param.put("createTimeE", createTimeE); - param.put("payTimeS", payTimeS); - param.put("payTimeE", payTimeE); - param.put("refundTimeS", refundTimeS); - param.put("refundTimeE", refundTimeE); - - PageHelper.startPage(pageNum, pageSize); - return ResponseMsgUtil.success(orderServiceExt.getOrderCouponList(param)); - - } catch (Exception e) { - log.error("OrderExtController -> getCouponOrderList() error!",e); - return ResponseMsgUtil.exception(e); - } - } - - - @RequestMapping(value="/getGasOrderList",method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "查询油站订单列表") - public ResponseData getGasOrderList(@RequestParam(name = "companyId", required = false) Long companyId, - @RequestParam(name = "merId", required = false) Long merId, - @RequestParam(name = "storeId", required = false) Long storeId, - @RequestParam(name = "orderNo", required = false) String orderNo, - @RequestParam(name = "childOrderNo", required = false) String childOrderNo, - @RequestParam(name = "gasOilType", required = false) Integer gasOilType, - @RequestParam(name = "gasOilNo", required = false) String gasOilNo, - @RequestParam(name = "status", required = false) Integer status, - @RequestParam(name = "gasSalesmanId", required = false) Long gasSalesmanId, - @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, - @RequestParam(name = "refundTimeS", required = false) Long refundTimeS, - @RequestParam(name = "refundTimeE", required = false) Long refundTimeE, - @RequestParam(name = "pageNum", required = true) Integer pageNum, - @RequestParam(name = "pageSize", required = true) Integer pageSize - ) { - try { - UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); - if (userInfoModel == null) { - log.error("OrderBWebController -> getGasOrderList() error!", "用户身份错误或已过期"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, ""); - } - Map param = new HashMap<>(); - if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) { - param.put("companyId", companyId); - param.put("merId", merId); - param.put("storeId", storeId); - - } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) { - param.put("companyId", userInfoModel.getBsCompany().getId()); - param.put("merId", merId); - param.put("storeId", storeId); - - } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type2.getType())) { - param.put("merId", userInfoModel.getMerchant().getId()); - param.put("storeId", storeId); - - } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type3.getType())) { - param.put("storeId", userInfoModel.getMerchantStore().getId()); - - } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type6.getType())) { - param.put("gasAgentId", userInfoModel.getMerchantStore().getId()); - param.put("gasSalesmanId", gasSalesmanId); - - } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type7.getType())) { - param.put("gasSalesmanId", userInfoModel.getMerchantStore().getId()); - - } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type8.getType())) { - param.put("gasStaffId", userInfoModel.getGasStaff().getId()); - - } else { - log.error("OrderBWebController -> getGasOrderList() error!", "未知用户身份"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知用户身份"); - } - param.put("orderNo", orderNo); - param.put("childOrderNo", childOrderNo); - param.put("status", status); - param.put("createTimeS", createTimeS); - param.put("createTimeE", createTimeE); - param.put("payTimeS", payTimeS); - param.put("payTimeE", payTimeE); - param.put("refundTimeS", refundTimeS); - param.put("refundTimeE", refundTimeE); - - PageHelper.startPage(pageNum, pageSize); - return ResponseMsgUtil.success(new PageInfo<>(gasOrderService.getGasOrderList(param))); - - } catch (Exception e) { - log.error("OrderExtController -> getCouponOrderList() error!",e); - return ResponseMsgUtil.exception(e); - } - } - -} diff --git a/hai-order/src/main/java/com/web/controller/TestController.java b/hai-order/src/main/java/com/web/controller/TestController.java index 20db0f9b..26f9fbf9 100644 --- a/hai-order/src/main/java/com/web/controller/TestController.java +++ b/hai-order/src/main/java/com/web/controller/TestController.java @@ -1 +1 @@ -package com.web.controller; import com.alibaba.fastjson.JSONObject; import com.hai.common.utils.*; import com.hai.config.HuiLianTongConfig; import com.hai.config.HuiLianTongUnionCardConfig; import com.hai.entity.HighOrder; import com.hai.model.ResponseData; import com.hai.order.model.CreateOrderModel; import com.hai.order.service.OrderService; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.rocketmq.client.producer.SendCallback; import org.apache.rocketmq.client.producer.SendResult; import org.apache.rocketmq.common.message.Message; import org.apache.rocketmq.spring.core.RocketMQTemplate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.integration.support.MessageBuilder; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class TestController { private static Logger log = LoggerFactory.getLogger(TestController.class); @Autowired private RocketMQTemplate rocketMQTemplate; @Resource private OrderService orderService; @Resource private RedisUtil redisUtil; @Autowired private RedisTemplate redisTemplate; @RequestMapping(value = "/q", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "") public ResponseData q() { try { JSONObject order = HuiLianTongConfig.getPayOrderByCouNo("3D3F3D3D3F373F36373836373D3F3A37383C3F"); if (order != null){ return ResponseMsgUtil.success(HuiLianTongUnionCardConfig.resolveResponse(order.getString("data"))); } return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighUserCardController --> rocketMq() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/rocketMq", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "") public ResponseData rocketMq(@RequestParam(name = "topicGroup", required = true) String topicGroup, @RequestParam(name = "body", required = true) String body) { try { long startTime = System.currentTimeMillis(); // org.springframework.messaging.Message message = MessageBuilder.withPayload(order).build(); CreateOrderModel createOrder = new CreateOrderModel(); //发送对象消息 HighOrder order = rocketMQTemplate.sendAndReceive("order-topic:create", createOrder, HighOrder.class); System.out.println("订单号:" + order.getOrderNo()); // SendResult sendResult = rocketMQTemplate.syncSend("order-topic:create", message, 3000); /*List list = new LinkedList<>(); for (int i = 0; i <= 100;i++) { list.add(orderService.getDetailByOrderNo("HF2022080918014365701")); *//* list.add(orderService.getDetailByOrderNo("HF2022080918014365701"));*//* *//* updateUserWithRedisLock("coupon_" + couponKey, i+""); new Thread(() -> {*//* *//* redisTemplate.opsForValue().setIfAbsent("coupon_" + couponKey, i); System.out.println("加入数据" + i);*//* // redisTemplate.delete("coupon" + couponKey); // System.out.println("释放数据" + index); *//* });*//* }*/ System.out.println(System.currentTimeMillis() - startTime); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighUserCardController --> rocketMq() error!", e); return ResponseMsgUtil.exception(e); } } public void updateUserWithRedisLock(String couponKey, String value) throws InterruptedException { // 占分布式锁,去redis占坑 // 1. 分布式锁占坑 Boolean lock = redisTemplate.opsForValue().setIfAbsent("coupon" + couponKey, value); if(lock) { //加锁成功... // todo business System.out.println("加锁成功: " + value); redisTemplate.delete("coupon" + couponKey); //删除key,释放锁 } else { System.out.println("加锁失败"); /* Thread.sleep(100); // 加锁失败,重试 updateUserWithRedisLock("sysUser");*/ } } } \ No newline at end of file +package com.web.controller; import com.alibaba.fastjson.JSONObject; import com.hai.common.utils.*; import com.hai.config.HuiLianTongConfig; import com.hai.config.HuiLianTongUnionCardConfig; import com.hai.entity.HighOrder; import com.hai.model.ResponseData; import com.hai.order.model.CreateOrderModel; import com.hai.order.service.OrderService; import com.hai.order.type.OrderStatus; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.rocketmq.client.producer.SendCallback; import org.apache.rocketmq.client.producer.SendResult; import org.apache.rocketmq.common.message.Message; import org.apache.rocketmq.spring.core.RocketMQTemplate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.integration.support.MessageBuilder; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.ArrayList; import java.util.Date; import java.util.LinkedList; import java.util.List; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class TestController { private static Logger log = LoggerFactory.getLogger(TestController.class); @Autowired private RocketMQTemplate rocketMQTemplate; @Resource private OrderService orderService; @Resource private RedisUtil redisUtil; @Autowired private RedisTemplate redisTemplate; @RequestMapping(value = "/q", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "") public ResponseData q(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = orderService.getOrderDetailByNo(orderNo); if (order != null) { orderService.refundOrder(orderNo, DateUtil.date2String(new Date(), "yyyy-MM-dd HH:mm:ss")); // order.setRefundTime(new Date()); // orderService.updateOrderData(order); return ResponseMsgUtil.success("修改成功"); } return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighUserCardController --> rocketMq() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/rocketMq", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "") public ResponseData rocketMq(@RequestParam(name = "topicGroup", required = true) String topicGroup, @RequestParam(name = "body", required = true) String body) { try { long startTime = System.currentTimeMillis(); // org.springframework.messaging.Message message = MessageBuilder.withPayload(order).build(); CreateOrderModel createOrder = new CreateOrderModel(); //发送对象消息 HighOrder order = rocketMQTemplate.sendAndReceive("order-topic:create", createOrder, HighOrder.class); System.out.println("订单号:" + order.getOrderNo()); // SendResult sendResult = rocketMQTemplate.syncSend("order-topic:create", message, 3000); /*List list = new LinkedList<>(); for (int i = 0; i <= 100;i++) { list.add(orderService.getDetailByOrderNo("HF2022080918014365701")); *//* list.add(orderService.getDetailByOrderNo("HF2022080918014365701"));*//* *//* updateUserWithRedisLock("coupon_" + couponKey, i+""); new Thread(() -> {*//* *//* redisTemplate.opsForValue().setIfAbsent("coupon_" + couponKey, i); System.out.println("加入数据" + i);*//* // redisTemplate.delete("coupon" + couponKey); // System.out.println("释放数据" + index); *//* });*//* }*/ System.out.println(System.currentTimeMillis() - startTime); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighUserCardController --> rocketMq() error!", e); return ResponseMsgUtil.exception(e); } } public void updateUserWithRedisLock(String couponKey, String value) throws InterruptedException { // 占分布式锁,去redis占坑 // 1. 分布式锁占坑 Boolean lock = redisTemplate.opsForValue().setIfAbsent("coupon" + couponKey, value); if(lock) { //加锁成功... // todo business System.out.println("加锁成功: " + value); redisTemplate.delete("coupon" + couponKey); //删除key,释放锁 } else { System.out.println("加锁失败"); /* Thread.sleep(100); // 加锁失败,重试 updateUserWithRedisLock("sysUser");*/ } } } \ No newline at end of file diff --git a/hai-order/src/main/java/com/web/controller/business/OrderCouponController.java b/hai-order/src/main/java/com/web/controller/business/OrderCouponController.java new file mode 100644 index 00000000..90572cb4 --- /dev/null +++ b/hai-order/src/main/java/com/web/controller/business/OrderCouponController.java @@ -0,0 +1,189 @@ +package com.web.controller.business; + +import com.alibaba.excel.EasyExcel; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; +import com.hai.common.security.UserCenter; +import com.hai.common.utils.ResponseMsgUtil; +import com.hai.entity.HighCoupon; +import com.hai.entity.HighGasOrder; +import com.hai.enum_type.UserObjectTypeEnum; +import com.hai.enum_type.UserRoleTypeEnum; +import com.hai.model.ResponseData; +import com.hai.model.UserInfoModel; +import com.hai.order.model.ExportGasOrderModel; +import com.hai.order.model.OrderCouponModel; +import com.hai.order.service.OrderService; +import com.hai.order.service.OrderServiceExt; +import com.hai.order.type.OrderOilStatus; +import com.hai.service.HighCouponService; +import com.hai.service.HighGasOrderService; +import com.web.config.SysConst; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.io.File; +import java.math.BigDecimal; +import java.util.*; + +@Controller +@RequestMapping(value = "coupon") +@Api(value = "卡券订单业务") +public class OrderCouponController { + + private static Logger log = LoggerFactory.getLogger(OrderCouponController.class); + + @Resource + private UserCenter userCenter; + + @Resource + private OrderService orderService; + + @Resource + private HighCouponService couponService; + + @Resource + private OrderServiceExt orderServiceExt; + + @RequestMapping(value = "/getOrderList", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询卡券订单列表") + public ResponseData getOrderList(@RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "memPhone", required = false) String memPhone, + @RequestParam(name = "couponName", required = false) String couponName, + @RequestParam(name = "payType", required = false) Integer payType, + @RequestParam(name = "orderStatus", required = false) Integer orderStatus, + @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, + @RequestParam(name = "finishTimeS", required = false) Long finishTimeS, + @RequestParam(name = "finishTimeE", required = false) Long finishTimeE, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize, + HttpServletRequest request) { + try { + + UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); + if (userInfoModel == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } + + Map map = new HashMap<>(); + if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) { + + } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) { + map.put("goodsId", couponService.getCouponIdsByCompanyId(userInfoModel.getBsCompany().getId())); + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } + + map.put("orderNo", orderNo); + map.put("memPhone", memPhone); + map.put("couponName", couponName); + map.put("payType", payType); + map.put("orderStatus", orderStatus); + map.put("createTimeS", createTimeS); + map.put("createTimeE", createTimeE); + map.put("payTimeS", payTimeS); + map.put("payTimeE", payTimeE); + map.put("finishTimeS", finishTimeS); + map.put("finishTimeE", finishTimeE); + + PageHelper.startPage(pageNum,pageSize); + return ResponseMsgUtil.success(new PageInfo<>(orderServiceExt.getOrderCouponList(map))); + + } catch (Exception e) { + log.error("OrderCouponController --> getOrderList() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + + + @RequestMapping(value = "/exportOrderCouponExcel", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "导出卡券订单") + public ResponseData exportOrderCouponExcel(@RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "memPhone", required = false) String memPhone, + @RequestParam(name = "couponName", required = false) String couponName, + @RequestParam(name = "payType", required = false) Integer payType, + @RequestParam(name = "orderStatus", required = false) Integer orderStatus, + @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, + @RequestParam(name = "finishTimeS", required = false) Long finishTimeS, + @RequestParam(name = "finishTimeE", required = false) Long finishTimeE, + HttpServletRequest request) { + try { + + UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); + if (userInfoModel == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } + Map map = new HashMap<>(); + if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) { + + } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) { + map.put("goodsId", couponService.getCouponIdsByCompanyId(userInfoModel.getBsCompany().getId())); + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } + map.put("orderNo", orderNo); + map.put("memPhone", memPhone); + map.put("couponName", couponName); + map.put("payType", payType); + map.put("orderStatus", orderStatus); + map.put("createTimeS", createTimeS); + map.put("createTimeE", createTimeE); + map.put("payTimeS", payTimeS); + map.put("payTimeE", payTimeE); + map.put("finishTimeS", finishTimeS); + map.put("finishTimeE", finishTimeE); + + List list = orderServiceExt.getOrderCouponList(map); + + String fileName = "/temporary/" + System.currentTimeMillis() + ".xlsx"; + EasyExcel.write(SysConst.getSysConfig().getFileUrl() + fileName, OrderCouponModel.class) + .sheet("卡券订单") + .doWrite(list); + + return ResponseMsgUtil.success(fileName); + + } catch (Exception e) { + log.error("HighOrderController --> getUserOrderList() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/getOrderDetail",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询卡券订单详情") + public ResponseData getOrderDetail(@RequestParam(name = "orderNo", required = false) String orderNo) { + try { + + Map param = new HashMap<>(); + param.put("tradeOrder", orderService.getOrderDetailByNo(orderNo)); + + return ResponseMsgUtil.success(param); + + } catch (Exception e) { + log.error("OrderCouponController -> getOrderDetail() error!",e); + return ResponseMsgUtil.exception(e); + } + } + +} diff --git a/hai-order/src/main/java/com/web/controller/business/OrderOilController.java b/hai-order/src/main/java/com/web/controller/business/OrderOilController.java new file mode 100644 index 00000000..270c9a6c --- /dev/null +++ b/hai-order/src/main/java/com/web/controller/business/OrderOilController.java @@ -0,0 +1,383 @@ +package com.web.controller.business; + +import com.alibaba.excel.EasyExcel; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; +import com.hai.common.security.UserCenter; +import com.hai.common.utils.ResponseMsgUtil; +import com.hai.entity.HighGasOrder; +import com.hai.enum_type.UserObjectTypeEnum; +import com.hai.enum_type.UserRoleTypeEnum; +import com.hai.model.ResponseData; +import com.hai.model.UserInfoModel; +import com.hai.order.model.ExportGasOrderModel; +import com.hai.order.service.OrderService; +import com.hai.order.service.OrderServiceExt; +import com.hai.order.type.OrderOilStatus; +import com.hai.service.HighGasOrderService; +import com.web.config.SysConst; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; +import java.io.File; +import java.math.BigDecimal; +import java.util.*; + +@Controller +@RequestMapping(value = "oil") +@Api(value = "加油订单业务") +public class OrderOilController { + + private static Logger log = LoggerFactory.getLogger(OrderOilController.class); + + @Resource + private UserCenter userCenter; + + @Resource + private OrderService orderService; + + @Resource + private OrderServiceExt orderServiceExt; + + @Resource + private HighGasOrderService gasOrderService; + + @RequestMapping(value="/getOilOrderList",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询油站订单列表") + public ResponseData getOilOrderList(@RequestParam(name = "companyId", required = false) Long companyId, + @RequestParam(name = "merId", required = false) Long merId, + @RequestParam(name = "storeId", required = false) Long storeId, + @RequestParam(name = "storeName", required = false) String storeName, + @RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "childOrderNo", required = false) String childOrderNo, + @RequestParam(name = "memPhone", required = false) String memPhone, + @RequestParam(name = "gasOilType", required = false) Integer gasOilType, + @RequestParam(name = "status", required = false) Integer status, + @RequestParam(name = "gasOrgId", required = false) Long gasOrgId, + @RequestParam(name = "gasAgentId", required = false) Long gasAgentId, + @RequestParam(name = "gasSalesmanId", required = false) Long gasSalesmanId, + @RequestParam(name = "gasStaffName", required = false) String gasStaffName, + @RequestParam(name = "gasOilNo", required = false) String gasOilNo, + @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, + @RequestParam(name = "refundTimeS", required = false) Long refundTimeS, + @RequestParam(name = "refundTimeE", required = false) Long refundTimeE, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize + ) { + try { + UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); + if (userInfoModel == null) { + log.error("OrderBWebController -> getGasOrderList() error!", "用户身份错误或已过期"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, ""); + } + Map param = new HashMap<>(); + if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) { + param.put("companyId", companyId); + param.put("merId", merId); + param.put("storeId", storeId); + param.put("storeName", storeName); + param.put("gasOrgId", gasOrgId); + param.put("gasAgentId", gasAgentId); + param.put("gasStaffName", gasStaffName); + + } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) { + param.put("companyId", userInfoModel.getBsCompany().getId()); + param.put("merId", merId); + param.put("storeId", storeId); + param.put("storeName", storeName); + param.put("gasStaffName", gasStaffName); + + } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type2.getType())) { + param.put("merId", userInfoModel.getMerchant().getId()); + param.put("storeId", storeId); + param.put("storeName", storeName); + param.put("gasStaffName", gasStaffName); + + } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type3.getType())) { + param.put("storeId", userInfoModel.getMerchantStore().getId()); + param.put("gasStaffName", gasStaffName); + + } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type6.getType())) { + param.put("gasAgentId", userInfoModel.getHighTyAgent().getId()); + param.put("gasSalesmanId", gasSalesmanId); + param.put("storeId", storeId); + param.put("storeName", storeName); + param.put("gasStaffName", gasStaffName); + + } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type7.getType())) { + param.put("gasSalesmanId", userInfoModel.getHighTySalesman().getId()); + param.put("storeId", storeId); + param.put("storeName", storeName); + param.put("gasStaffName", gasStaffName); + + } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type8.getType())) { + param.put("gasStaffId", userInfoModel.getGasStaff().getId()); + param.put("storeId", storeId); + param.put("storeName", storeName); + + } else { + log.error("OrderBWebController -> getGasOrderList() error!", "未知用户身份"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知用户身份"); + } + + param.put("gasOrgId", gasOrgId); + param.put("gasAgentId", gasAgentId); + param.put("gasSalesmanId", gasAgentId); + param.put("memPhone", memPhone); + param.put("gasOilNo", gasOilNo); + param.put("orderNo", orderNo); + param.put("childOrderNo", childOrderNo); + param.put("status", status); + param.put("createTimeS", createTimeS); + param.put("createTimeE", createTimeE); + param.put("payTimeS", payTimeS); + param.put("payTimeE", payTimeE); + param.put("refundTimeS", refundTimeS); + param.put("refundTimeE", refundTimeE); + + PageHelper.startPage(pageNum, pageSize); + return ResponseMsgUtil.success(new PageInfo<>(gasOrderService.getGasOrderList(param))); + + } catch (Exception e) { + log.error("OrderExtController -> getCouponOrderList() error!",e); + return ResponseMsgUtil.exception(e); + } + } + + + @RequestMapping(value="/getOilOrderDetail",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询油站详情") + public ResponseData getOilOrderDetail(@RequestParam(name = "orderNo", required = true) String orderNo) { + try { + Map map = new HashMap<>(); + map.put("tradeOrder", orderService.getOrderDetailByNo(orderNo)); + map.put("gasOrder", gasOrderService.getDetailByOrderNo(orderNo)); + + return ResponseMsgUtil.success(map); + + } catch (Exception e) { + log.error("OrderExtController -> getGasOrderDetail() error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/exportOilOrder",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "导出加油订单") + public ResponseData exportOilOrder(@RequestParam(name = "companyId", required = false) Long companyId, + @RequestParam(name = "merId", required = false) Long merId, + @RequestParam(name = "storeId", required = false) Long storeId, + @RequestParam(name = "storeName", required = false) String storeName, + @RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "childOrderNo", required = false) String childOrderNo, + @RequestParam(name = "memPhone", required = false) String memPhone, + @RequestParam(name = "gasOilType", required = false) Integer gasOilType, + @RequestParam(name = "status", required = false) Integer status, + @RequestParam(name = "gasOrgId", required = false) Long gasOrgId, + @RequestParam(name = "gasAgentId", required = false) Long gasAgentId, + @RequestParam(name = "gasSalesmanId", required = false) Long gasSalesmanId, + @RequestParam(name = "gasStaffName", required = false) String gasStaffName, + @RequestParam(name = "gasOilNo", required = false) String gasOilNo, + @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, + @RequestParam(name = "refundTimeS", required = false) Long refundTimeS, + @RequestParam(name = "refundTimeE", required = false) Long refundTimeE + ) { + try { + UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); + if (userInfoModel == null) { + log.error("OrderBWebController -> exportGasOrderList() error!", "用户身份错误或已过期"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, ""); + } + Map param = new HashMap<>(); + if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) { + param.put("companyId", companyId); + param.put("merId", merId); + param.put("storeId", storeId); + param.put("storeName", storeName); + param.put("gasOrgId", gasOrgId); + param.put("gasAgentId", gasAgentId); + param.put("gasStaffName", gasStaffName); + + } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) { + param.put("companyId", userInfoModel.getBsCompany().getId()); + param.put("merId", merId); + param.put("storeId", storeId); + param.put("storeName", storeName); + param.put("gasStaffName", gasStaffName); + + } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type2.getType())) { + param.put("merId", userInfoModel.getMerchant().getId()); + param.put("storeId", storeId); + param.put("storeName", storeName); + param.put("gasStaffName", gasStaffName); + + } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type3.getType())) { + param.put("storeId", userInfoModel.getMerchantStore().getId()); + param.put("gasStaffName", gasStaffName); + + } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type6.getType())) { + param.put("gasAgentId", userInfoModel.getHighTyAgent().getId()); + param.put("gasSalesmanId", gasSalesmanId); + param.put("storeId", storeId); + param.put("storeName", storeName); + param.put("gasStaffName", gasStaffName); + + } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type7.getType())) { + param.put("gasSalesmanId", userInfoModel.getHighTySalesman().getId()); + param.put("storeId", storeId); + param.put("storeName", storeName); + param.put("gasStaffName", gasStaffName); + + } else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type8.getType())) { + param.put("gasStaffId", userInfoModel.getGasStaff().getId()); + param.put("storeId", storeId); + param.put("storeName", storeName); + + } else { + log.error("OrderBWebController -> getGasOrderList() error!", "未知用户身份"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知用户身份"); + } + + param.put("gasOrgId", gasOrgId); + param.put("gasAgentId", gasAgentId); + param.put("gasSalesmanId", gasAgentId); + param.put("memPhone", memPhone); + param.put("gasOilNo", gasOilNo); + param.put("orderNo", orderNo); + param.put("childOrderNo", childOrderNo); + param.put("status", status); + param.put("createTimeS", createTimeS); + param.put("createTimeE", createTimeE); + param.put("payTimeS", payTimeS); + param.put("payTimeE", payTimeE); + param.put("refundTimeS", refundTimeS); + param.put("refundTimeE", refundTimeE); + + // 查询数据 + List orderList = gasOrderService.getGasOrderList(param); + + List dataList = new ArrayList<>(); + ExportGasOrderModel model; + + for (HighGasOrder gasOrder : orderList) { + model = new ExportGasOrderModel(); + model.setOrderNo(gasOrder.getOrderNo()); + model.setStoreName(gasOrder.getStoreName()); + model.setGasStaffName(gasOrder.getGasStaffName()); + model.setMemPhone(gasOrder.getMemPhone()); + model.setGasRefuelPrice(gasOrder.getGasRefuelPrice()); + model.setGasOilLiters(gasOrder.getGasOilLiters()); + model.setGasDiscount(gasOrder.getGasDiscount().compareTo(new BigDecimal("1")) != 0?gasOrder.getGasDiscount().multiply(new BigDecimal("100")).setScale(2).toString():"无"); + model.setGasOilSubsidy(gasOrder.getGasOilSubsidy()); + model.setGasOilNo(gasOrder.getGasOilNo() + "#"); + model.setGasGunNo(gasOrder.getGasGunNo() + "号枪"); + model.setGasPricePlatform(gasOrder.getGasPricePlatform()); + model.setGasPriceGun(gasOrder.getGasPriceGun()); + model.setGasPriceOfficial(gasOrder.getGasPriceOfficial()); + model.setDeductionPrice(gasOrder.getDeductionPrice()); + model.setPayablePrice(gasOrder.getPayablePrice()); + model.setPayGold(gasOrder.getPayGold()); + model.setPayPrice(gasOrder.getPayPrice()!=null?gasOrder.getPayPrice().toString():"未支付"); + model.setStatus(OrderOilStatus.getNameByType(gasOrder.getStatus())); + model.setCreateTime(gasOrder.getCreateTime()); + model.setPayTime(gasOrder.getPayTime()); + model.setRefundTime(gasOrder.getRefundTime()); + model.setCancelTime(gasOrder.getCancelTime()); + model.setCompanyName(gasOrder.getMerName()); + model.setMerName(gasOrder.getMerName()); + model.setGasSalesmanName(gasOrder.getGasSalesmanName()); + model.setGasAgentName(gasOrder.getGasAgentName()); + model.setGasOrgName(gasOrder.getGasOrgName()); + dataList.add(model); + } + + String fileUrl = SysConst.getSysConfig().getFileUrl() + "/temporary/"; + String pathName = System.currentTimeMillis()+".xlsx"; + File file = new File(fileUrl); + if (!file.exists()) { + file.mkdirs(); + } + + Set includeColumnFiledNames = new HashSet(); + includeColumnFiledNames.add("orderNo"); + includeColumnFiledNames.add("memPhone"); + includeColumnFiledNames.add("gasRefuelPrice"); + includeColumnFiledNames.add("gasOilLiters"); + includeColumnFiledNames.add("gasDiscount"); + includeColumnFiledNames.add("gasOilSubsidy"); + includeColumnFiledNames.add("gasOilNo"); + includeColumnFiledNames.add("gasGunNo"); + includeColumnFiledNames.add("gasPricePlatform"); + includeColumnFiledNames.add("gasPriceGun"); + includeColumnFiledNames.add("gasPriceOfficial"); + includeColumnFiledNames.add("deductionPrice"); + includeColumnFiledNames.add("payablePrice"); + includeColumnFiledNames.add("payGold"); + includeColumnFiledNames.add("payPrice"); + includeColumnFiledNames.add("status"); + includeColumnFiledNames.add("createTime"); + includeColumnFiledNames.add("payTime"); + includeColumnFiledNames.add("refundTime"); + includeColumnFiledNames.add("cancelTime"); + + if (!userInfoModel.getSecRole().getRoleType().equals(UserRoleTypeEnum.type3.getType()) + && !userInfoModel.getSecRole().getRoleType().equals(UserRoleTypeEnum.type10.getType())) { + includeColumnFiledNames.add("storeName"); + } + if (!userInfoModel.getSecRole().getRoleType().equals(UserRoleTypeEnum.type10.getType())) { + includeColumnFiledNames.add("gasStaffName"); + } + + if (userInfoModel.getSecRole().getRoleType().equals(UserRoleTypeEnum.type0.getType()) + || userInfoModel.getSecRole().getRoleType().equals(UserRoleTypeEnum.type1.getType())) { + includeColumnFiledNames.add("companyName"); + } + + if (userInfoModel.getSecRole().getRoleType().equals(UserRoleTypeEnum.type0.getType()) + || userInfoModel.getSecRole().getRoleType().equals(UserRoleTypeEnum.type1.getType()) + || userInfoModel.getSecRole().getRoleType().equals(UserRoleTypeEnum.type5.getType())) { + includeColumnFiledNames.add("merName"); + includeColumnFiledNames.add("gasOrgName"); + includeColumnFiledNames.add("gasAgentName"); + } + + if (userInfoModel.getSecRole().getRoleType().equals(UserRoleTypeEnum.type0.getType()) + || userInfoModel.getSecRole().getRoleType().equals(UserRoleTypeEnum.type1.getType()) + || userInfoModel.getSecRole().getRoleType().equals(UserRoleTypeEnum.type5.getType()) + || userInfoModel.getSecRole().getRoleType().equals(UserRoleTypeEnum.type8.getType())) { + includeColumnFiledNames.add("gasSalesmanName"); + } + + EasyExcel.write(fileUrl+pathName) + .head(ExportGasOrderModel.class) + .includeColumnFiledNames(includeColumnFiledNames) + .sheet("交易订单") + .doWrite(dataList); + return ResponseMsgUtil.success(pathName); + + } catch (Exception e) { + log.error("OrderExtController -> exportGasOrderList() error!",e); + return ResponseMsgUtil.exception(e); + } + } + +} diff --git a/hai-service/src/main/java/com/hai/common/utils/AESTool.java b/hai-service/src/main/java/com/hai/common/utils/AESTool.java new file mode 100644 index 00000000..1fa4bd33 --- /dev/null +++ b/hai-service/src/main/java/com/hai/common/utils/AESTool.java @@ -0,0 +1,126 @@ +package com.hai.common.utils; + +import javax.crypto.Cipher; +import javax.crypto.spec.SecretKeySpec; +import java.util.Calendar; + +/** + * @className: AESTool + * @author: HuRui + * @date: 2022/9/27 + **/ +public class AESTool { + + public static String Encrypt(String sSrc, String sKey) + { + try + { + return toHex(encryptBytes(sSrc.getBytes("utf-8"), sKey)); + } catch (Exception ex) { + throw new RuntimeException(ex.toString()); + } + } + + public static byte[] encrypt(byte[] sSrc, String sKey) { + try { + return encryptBytes(sSrc, sKey); + } catch (Exception ex) { + throw new RuntimeException(ex.toString()); + } + } + + public static byte[] encryptBytes(byte[] sSrc, String sKey) throws Exception + { + if (sKey == null) { + throw new Exception("Key为空null"); + } + + if (sKey.length() != 16) { + throw new Exception("Key长度不是16位"); + } + byte[] raw = sKey.getBytes("utf-8"); + + SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); + Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); + cipher.init(1, skeySpec); + byte[] encrypted = cipher.doFinal(sSrc); + return encrypted; + } + + public static String Decrypt(String sSrc, String sKey) + { + try { + return new String(decryptBytes(toBytes(sSrc), sKey), "utf-8"); + } catch (Exception ex) { + throw new RuntimeException(ex.toString()); + } + } + + public static byte[] decrypt(byte[] sSrc, String sKey) { + try { + return decryptBytes(sSrc, sKey); + } catch (Exception ex) { + throw new RuntimeException(ex.toString()); + } + } + + + public static byte[] decryptBytes(byte[] sSrc, String sKey) + throws Exception + { + if (sKey == null) { + throw new Exception("Key为空null"); + } + + if (sKey.length() != 16) { + throw new Exception("Key长度不是16位"); + } + byte[] raw = sKey.getBytes("utf-8"); + + SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); + Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); + cipher.init(2, skeySpec); + byte[] original = cipher.doFinal(sSrc); + return original; + } + + + + + public static String toHex(byte[] buf) + { + if (buf == null) + return ""; + StringBuffer result = new StringBuffer(2 * buf.length); + for (int i = 0; i < buf.length; i++) { + appendHex(result, buf[i]); + } + return result.toString(); + } + + private static void appendHex(StringBuffer sb, byte b) { + sb.append("0123456789ABCDEF".charAt(b >> 4 & 0xF)).append("0123456789ABCDEF".charAt(b & 0xF)); + } + + + + public static byte[] toBytes(String hexString) + { + int len = hexString.length() / 2; + byte[] result = new byte[len]; + for (int i = 0; i < len; i++) + result[i] = Integer.valueOf(hexString.substring(2 * i, 2 * i + 2), + 16).byteValue(); + return result; + } + + public static void main(String[] args) { + Calendar cal = Calendar.getInstance(); + cal.add(5, 10); + String str = "1,13439676580," + cal.getTimeInMillis(); + String key = "0123456789ABCDEF"; + String token = Encrypt(str, key); + System.out.println(token); + System.out.println(Decrypt(token, key)); + } +} diff --git a/hai-service/src/main/java/com/hai/common/utils/ExcelUtils.java b/hai-service/src/main/java/com/hai/common/utils/ExcelUtils.java new file mode 100644 index 00000000..63311c7d --- /dev/null +++ b/hai-service/src/main/java/com/hai/common/utils/ExcelUtils.java @@ -0,0 +1,29 @@ +package com.hai.common.utils; + +import java.util.ArrayList; +import java.util.List; + +/** + * excel工具类 + * @className: ExcelUtils + * @author: HuRui + * @date: 2022/9/20 + **/ +public class ExcelUtils { + + /** + * 生成头部 + * @param headList + * @return + */ + public static List> generationHead(List headList) { + List> list = new ArrayList<>(); + List head; + for (String headStr : headList) { + head = new ArrayList<>(); + head.add(headStr); + list.add(head); + } + return list; + } +} diff --git a/hai-service/src/main/java/com/hai/config/ChongQingCNPCService.java b/hai-service/src/main/java/com/hai/config/ChongQingCNPCService.java new file mode 100644 index 00000000..38dd8f38 --- /dev/null +++ b/hai-service/src/main/java/com/hai/config/ChongQingCNPCService.java @@ -0,0 +1,134 @@ +package com.hai.config; + +import com.alibaba.fastjson.JSONObject; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; +import com.hai.common.utils.AESTool; +import com.hai.common.utils.HttpsUtils; +import com.hai.common.utils.MD5Util; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.*; + +/** + * 重庆中石油 + * @className: CqPetroChina + * @author: HuRui + * @date: 2022/9/26 + **/ +public class ChongQingCNPCService { + + private static Logger log = LoggerFactory.getLogger(ChongQingCNPCService.class); + + /** + * 发放电子券 + * @param requestCode + * @param tradeId + * @param ticketSum + * @param phone + */ + public static JSONObject sendCNPCTicket(String requestCode, String tradeId, Integer ticketSum, String phone) throws Exception { + Map map = new HashMap<>(); + map.put("requestCode", requestCode); + map.put("tradeId", tradeId); + map.put("ticketSum", ticketSum); + map.put("phone", phone); + return request("sendCNPCTicket", map); + } + + /** + * 获取中石油跨界券核销码 + * @param couponNo + * @param tradeId + * @return + */ + public static JSONObject getCNPCCheckCode(String couponNo, String tradeId) throws Exception { + Map map = new HashMap<>(); + map.put("couponNo", couponNo); + map.put("tradeId", tradeId); + return request("getCNPCCheckCode", map); + } + + /** + * 获取电子券详情 + * @param couponNo + * @return + */ + public static JSONObject queryCoupon(String couponNo) throws Exception { + Map map = new HashMap<>(); + map.put("couponNo", couponNo); + map.put("random", String.valueOf(new Random().nextInt(899999) + 100000)); + return request("queryCoupon", map); + } + + + /** + * 请求 + * @param actionType 接口类型 + * @param param 参数 + * @return + * @throws Exception + */ + public static JSONObject request(String actionType, Map param) throws Exception { + String verifyCode = AESTool.Encrypt(JSONObject.toJSONString(param), CommonSysConst.getSysConfig().getChongQingCnpcMerKey()); + + JSONObject header = new JSONObject(); + header.put("strVendorCode", CommonSysConst.getSysConfig().getChongQingCnpcMerNo()); + header.put("strActionType", actionType); + header.put("verifyCode", MD5Util.encode((verifyCode + CommonSysConst.getSysConfig().getChongQingCnpcMerKey()).getBytes()).toLowerCase()); + + JSONObject msg = new JSONObject(); + msg.put("head", header); + msg.put("body", verifyCode); + + Map reqParam = new HashMap<>(); + reqParam.put("sendMessage", msg); + + log.info("============start============"); + log.info("请求接口:" + actionType); + log.info("参数:" + JSONObject.toJSONString(param)); + log.info("请求参数:" + JSONObject.toJSONString(reqParam)); + JSONObject response = HttpsUtils.doPost(CommonSysConst.getSysConfig().getChongQingCnpcUrl(), reqParam, new HashMap<>()); + log.info("响应参数:" + response.toJSONString()); + log.info("============end============"); + + JSONObject postMessage = response.getJSONObject("postMessage"); + if (postMessage == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!"); + } + // 解密body + JSONObject body = decryptBody(response.getJSONObject("postMessage").getString("body")); + if (!body.getInteger("status").equals(1)) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, body.getString("info")); + } + return body; + } + + /** + * 解密body + * @param bodyStr body加密字符串 + * @return + */ + public static JSONObject decryptBody(String bodyStr) { + // 解密body + String decryptBody = AESTool.Decrypt(bodyStr, CommonSysConst.getSysConfig().getChongQingCnpcMerKey()); + return JSONObject.parseObject(decryptBody, JSONObject.class); + } + + /** + * 解密电子券码 + * @param couponCode 券码加密字符串 + * @return 核销码 + */ + public static String decryptCouponCode(String couponCode) { + return AESTool.Decrypt(couponCode, CommonSysConst.getSysConfig().getChongQingCnpcCouponSignKey()); + } + + public static void main(String[] args) { + //System.out.println(AESTool.Decrypt("A9D356D4614F874586EAF8678C8C3E7D8CD0EEF031ADA44DDAA3B342CE4BBE44F115AABE27324A6A1F049619139A1A889FCA0FB48EB6E1EA4B1B50F041961B2D686FE8B9696C02DF95BA99B342747D67ECC7847646C87993CF924F33C1308829","n2j30jxhl3rhuoci")); + System.out.println(AESTool.Decrypt("FD65F7651FF24F67FCCC2690F03650ABEEEFA7681C9C98A45BF82C7E17776A728B68E6E6C87A4C9F444A6D64CCB025604AC6E8CD4ACB2D2EF266857191370B205FFBAA95958C4801050E3B4AE2057220","n2j30jxhl3rhuoci")); + //System.out.println(AESTool.Decrypt("3549AD565800370205265D7518D26E5F40C90A61FDEB5DD73966126A5D25F5E9","5ojldakiz343a6yk")); + } +} diff --git a/hai-service/src/main/java/com/hai/config/CommonSysConfig.java b/hai-service/src/main/java/com/hai/config/CommonSysConfig.java index bc053361..67eba3af 100644 --- a/hai-service/src/main/java/com/hai/config/CommonSysConfig.java +++ b/hai-service/src/main/java/com/hai/config/CommonSysConfig.java @@ -15,6 +15,12 @@ public class CommonSysConfig { // 加油站默认图片 private String gasDefaultOilStationImg; + // 重庆壳牌 + private String ChongQingCnpcUrl; // 请求地址 + private String ChongQingCnpcMerNo; // 商户号 + private String ChongQingCnpcMerKey; // 商户秘钥 + private String ChongQingCnpcCouponSignKey; // 电子券签名秘钥 + private String tuanYouUrl; private String tuanYouAppKey; private String tuanYouAppSecret; @@ -101,6 +107,38 @@ public class CommonSysConfig { private String fileUrl; + public String getChongQingCnpcUrl() { + return ChongQingCnpcUrl; + } + + public void setChongQingCnpcUrl(String chongQingCnpcUrl) { + ChongQingCnpcUrl = chongQingCnpcUrl; + } + + public String getChongQingCnpcMerNo() { + return ChongQingCnpcMerNo; + } + + public void setChongQingCnpcMerNo(String chongQingCnpcMerNo) { + ChongQingCnpcMerNo = chongQingCnpcMerNo; + } + + public String getChongQingCnpcMerKey() { + return ChongQingCnpcMerKey; + } + + public void setChongQingCnpcMerKey(String chongQingCnpcMerKey) { + ChongQingCnpcMerKey = chongQingCnpcMerKey; + } + + public String getChongQingCnpcCouponSignKey() { + return ChongQingCnpcCouponSignKey; + } + + public void setChongQingCnpcCouponSignKey(String chongQingCnpcCouponSignKey) { + ChongQingCnpcCouponSignKey = chongQingCnpcCouponSignKey; + } + public String getJzAppId() { return jzAppId; } diff --git a/hai-service/src/main/java/com/hai/dao/HighCouponCodeOtherMapper.java b/hai-service/src/main/java/com/hai/dao/HighCouponCodeOtherMapper.java index c1520e09..a71f9aba 100644 --- a/hai-service/src/main/java/com/hai/dao/HighCouponCodeOtherMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighCouponCodeOtherMapper.java @@ -44,15 +44,17 @@ public interface HighCouponCodeOtherMapper extends HighCouponCodeOtherMapperExt "cou_type_code, cou_no, ", "`status`, active_time, ", "valid_start_date, valid_end_date, ", - "create_time, ext_1, ", - "ext_2, ext_3)", + "use_time, station_code, ", + "station_name, create_time, ", + "ext_1, ext_2, ext_3)", "values (#{type,jdbcType=INTEGER}, #{couponAgentCodeId,jdbcType=BIGINT}, ", "#{orderId,jdbcType=BIGINT}, #{childOrderId,jdbcType=BIGINT}, ", "#{couTypeCode,jdbcType=VARCHAR}, #{couNo,jdbcType=VARCHAR}, ", "#{status,jdbcType=INTEGER}, #{activeTime,jdbcType=TIMESTAMP}, ", "#{validStartDate,jdbcType=TIMESTAMP}, #{validEndDate,jdbcType=TIMESTAMP}, ", - "#{createTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", - "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + "#{useTime,jdbcType=TIMESTAMP}, #{stationCode,jdbcType=VARCHAR}, ", + "#{stationName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ", + "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(HighCouponCodeOther record); @@ -74,6 +76,9 @@ public interface HighCouponCodeOtherMapper extends HighCouponCodeOtherMapperExt @Result(column="active_time", property="activeTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="valid_start_date", property="validStartDate", jdbcType=JdbcType.TIMESTAMP), @Result(column="valid_end_date", property="validEndDate", jdbcType=JdbcType.TIMESTAMP), + @Result(column="use_time", property="useTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="station_code", property="stationCode", jdbcType=JdbcType.VARCHAR), + @Result(column="station_name", property="stationName", jdbcType=JdbcType.VARCHAR), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), @@ -84,8 +89,8 @@ public interface HighCouponCodeOtherMapper extends HighCouponCodeOtherMapperExt @Select({ "select", "id, `type`, coupon_agent_code_id, order_id, child_order_id, cou_type_code, cou_no, ", - "`status`, active_time, valid_start_date, valid_end_date, create_time, ext_1, ", - "ext_2, ext_3", + "`status`, active_time, valid_start_date, valid_end_date, use_time, station_code, ", + "station_name, create_time, ext_1, ext_2, ext_3", "from high_coupon_code_other", "where id = #{id,jdbcType=BIGINT}" }) @@ -101,6 +106,9 @@ public interface HighCouponCodeOtherMapper extends HighCouponCodeOtherMapperExt @Result(column="active_time", property="activeTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="valid_start_date", property="validStartDate", jdbcType=JdbcType.TIMESTAMP), @Result(column="valid_end_date", property="validEndDate", jdbcType=JdbcType.TIMESTAMP), + @Result(column="use_time", property="useTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="station_code", property="stationCode", jdbcType=JdbcType.VARCHAR), + @Result(column="station_name", property="stationName", jdbcType=JdbcType.VARCHAR), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), @@ -129,6 +137,9 @@ public interface HighCouponCodeOtherMapper extends HighCouponCodeOtherMapperExt "active_time = #{activeTime,jdbcType=TIMESTAMP},", "valid_start_date = #{validStartDate,jdbcType=TIMESTAMP},", "valid_end_date = #{validEndDate,jdbcType=TIMESTAMP},", + "use_time = #{useTime,jdbcType=TIMESTAMP},", + "station_code = #{stationCode,jdbcType=VARCHAR},", + "station_name = #{stationName,jdbcType=VARCHAR},", "create_time = #{createTime,jdbcType=TIMESTAMP},", "ext_1 = #{ext1,jdbcType=VARCHAR},", "ext_2 = #{ext2,jdbcType=VARCHAR},", diff --git a/hai-service/src/main/java/com/hai/dao/HighCouponCodeOtherSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighCouponCodeOtherSqlProvider.java index 43e013f4..e13ac9f3 100644 --- a/hai-service/src/main/java/com/hai/dao/HighCouponCodeOtherSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighCouponCodeOtherSqlProvider.java @@ -68,6 +68,18 @@ public class HighCouponCodeOtherSqlProvider { sql.VALUES("valid_end_date", "#{validEndDate,jdbcType=TIMESTAMP}"); } + if (record.getUseTime() != null) { + sql.VALUES("use_time", "#{useTime,jdbcType=TIMESTAMP}"); + } + + if (record.getStationCode() != null) { + sql.VALUES("station_code", "#{stationCode,jdbcType=VARCHAR}"); + } + + if (record.getStationName() != null) { + sql.VALUES("station_name", "#{stationName,jdbcType=VARCHAR}"); + } + if (record.getCreateTime() != null) { sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); } @@ -104,6 +116,9 @@ public class HighCouponCodeOtherSqlProvider { sql.SELECT("active_time"); sql.SELECT("valid_start_date"); sql.SELECT("valid_end_date"); + sql.SELECT("use_time"); + sql.SELECT("station_code"); + sql.SELECT("station_name"); sql.SELECT("create_time"); sql.SELECT("ext_1"); sql.SELECT("ext_2"); @@ -169,6 +184,18 @@ public class HighCouponCodeOtherSqlProvider { sql.SET("valid_end_date = #{record.validEndDate,jdbcType=TIMESTAMP}"); } + if (record.getUseTime() != null) { + sql.SET("use_time = #{record.useTime,jdbcType=TIMESTAMP}"); + } + + if (record.getStationCode() != null) { + sql.SET("station_code = #{record.stationCode,jdbcType=VARCHAR}"); + } + + if (record.getStationName() != null) { + sql.SET("station_name = #{record.stationName,jdbcType=VARCHAR}"); + } + if (record.getCreateTime() != null) { sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); } @@ -204,6 +231,9 @@ public class HighCouponCodeOtherSqlProvider { sql.SET("active_time = #{record.activeTime,jdbcType=TIMESTAMP}"); sql.SET("valid_start_date = #{record.validStartDate,jdbcType=TIMESTAMP}"); sql.SET("valid_end_date = #{record.validEndDate,jdbcType=TIMESTAMP}"); + sql.SET("use_time = #{record.useTime,jdbcType=TIMESTAMP}"); + sql.SET("station_code = #{record.stationCode,jdbcType=VARCHAR}"); + sql.SET("station_name = #{record.stationName,jdbcType=VARCHAR}"); sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); @@ -258,6 +288,18 @@ public class HighCouponCodeOtherSqlProvider { sql.SET("valid_end_date = #{validEndDate,jdbcType=TIMESTAMP}"); } + if (record.getUseTime() != null) { + sql.SET("use_time = #{useTime,jdbcType=TIMESTAMP}"); + } + + if (record.getStationCode() != null) { + sql.SET("station_code = #{stationCode,jdbcType=VARCHAR}"); + } + + if (record.getStationName() != null) { + sql.SET("station_name = #{stationName,jdbcType=VARCHAR}"); + } + if (record.getCreateTime() != null) { sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); } diff --git a/hai-service/src/main/java/com/hai/dao/HighGasOrderMapper.java b/hai-service/src/main/java/com/hai/dao/HighGasOrderMapper.java index a7c4d974..a648d288 100644 --- a/hai-service/src/main/java/com/hai/dao/HighGasOrderMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighGasOrderMapper.java @@ -42,8 +42,11 @@ public interface HighGasOrderMapper extends HighGasOrderMapperExt { "insert into high_gas_order (order_no, child_order_no, ", "channel_type, channel_order_no, ", "mem_id, mem_phone, ", + "company_id, company_name, ", "mer_id, mer_name, store_id, ", - "store_name, gas_refuel_price, ", + "store_name, deduction_price, ", + "payable_price, pay_gold, ", + "pay_price, gas_refuel_price, ", "gas_oil_no, gas_gun_no, ", "gas_oil_type, gas_price_platform, ", "gas_price_gun, gas_price_vip, ", @@ -57,17 +60,20 @@ public interface HighGasOrderMapper extends HighGasOrderMapperExt { "gas_salesman_id, gas_salesman_name, ", "gas_agent_id, gas_agent_name, ", "gas_org_id, gas_org_name, ", - "`status`, create_time, ", - "cancel_time, pay_time, ", - "finish_time, refund_time, ", + "pay_type, `status`, ", + "create_time, cancel_time, ", + "pay_time, refund_time, ", "refund_remarks, ext_1, ", "ext_2, ext_3, ext_4, ", "ext_5, ext_6)", "values (#{orderNo,jdbcType=VARCHAR}, #{childOrderNo,jdbcType=VARCHAR}, ", "#{channelType,jdbcType=INTEGER}, #{channelOrderNo,jdbcType=VARCHAR}, ", "#{memId,jdbcType=BIGINT}, #{memPhone,jdbcType=VARCHAR}, ", + "#{companyId,jdbcType=BIGINT}, #{companyName,jdbcType=VARCHAR}, ", "#{merId,jdbcType=BIGINT}, #{merName,jdbcType=VARCHAR}, #{storeId,jdbcType=BIGINT}, ", - "#{storeName,jdbcType=VARCHAR}, #{gasRefuelPrice,jdbcType=DECIMAL}, ", + "#{storeName,jdbcType=VARCHAR}, #{deductionPrice,jdbcType=DECIMAL}, ", + "#{payablePrice,jdbcType=DECIMAL}, #{payGold,jdbcType=INTEGER}, ", + "#{payPrice,jdbcType=DECIMAL}, #{gasRefuelPrice,jdbcType=DECIMAL}, ", "#{gasOilNo,jdbcType=VARCHAR}, #{gasGunNo,jdbcType=VARCHAR}, ", "#{gasOilType,jdbcType=INTEGER}, #{gasPricePlatform,jdbcType=DECIMAL}, ", "#{gasPriceGun,jdbcType=DECIMAL}, #{gasPriceVip,jdbcType=DECIMAL}, ", @@ -81,9 +87,9 @@ public interface HighGasOrderMapper extends HighGasOrderMapperExt { "#{gasSalesmanId,jdbcType=BIGINT}, #{gasSalesmanName,jdbcType=VARCHAR}, ", "#{gasAgentId,jdbcType=BIGINT}, #{gasAgentName,jdbcType=VARCHAR}, ", "#{gasOrgId,jdbcType=BIGINT}, #{gasOrgName,jdbcType=VARCHAR}, ", - "#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", - "#{cancelTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP}, ", - "#{finishTime,jdbcType=TIMESTAMP}, #{refundTime,jdbcType=TIMESTAMP}, ", + "#{payType,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, ", + "#{createTime,jdbcType=TIMESTAMP}, #{cancelTime,jdbcType=TIMESTAMP}, ", + "#{payTime,jdbcType=TIMESTAMP}, #{refundTime,jdbcType=TIMESTAMP}, ", "#{refundRemarks,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ", "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, #{ext4,jdbcType=VARCHAR}, ", "#{ext5,jdbcType=VARCHAR}, #{ext6,jdbcType=VARCHAR})" @@ -104,10 +110,16 @@ public interface HighGasOrderMapper extends HighGasOrderMapperExt { @Result(column="channel_order_no", property="channelOrderNo", jdbcType=JdbcType.VARCHAR), @Result(column="mem_id", property="memId", jdbcType=JdbcType.BIGINT), @Result(column="mem_phone", property="memPhone", jdbcType=JdbcType.VARCHAR), + @Result(column="company_id", property="companyId", jdbcType=JdbcType.BIGINT), + @Result(column="company_name", property="companyName", jdbcType=JdbcType.VARCHAR), @Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT), @Result(column="mer_name", property="merName", jdbcType=JdbcType.VARCHAR), @Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT), @Result(column="store_name", property="storeName", jdbcType=JdbcType.VARCHAR), + @Result(column="deduction_price", property="deductionPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="payable_price", property="payablePrice", jdbcType=JdbcType.DECIMAL), + @Result(column="pay_gold", property="payGold", jdbcType=JdbcType.INTEGER), + @Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL), @Result(column="gas_refuel_price", property="gasRefuelPrice", jdbcType=JdbcType.DECIMAL), @Result(column="gas_oil_no", property="gasOilNo", jdbcType=JdbcType.VARCHAR), @Result(column="gas_gun_no", property="gasGunNo", jdbcType=JdbcType.VARCHAR), @@ -135,11 +147,11 @@ public interface HighGasOrderMapper extends HighGasOrderMapperExt { @Result(column="gas_agent_name", property="gasAgentName", jdbcType=JdbcType.VARCHAR), @Result(column="gas_org_id", property="gasOrgId", jdbcType=JdbcType.BIGINT), @Result(column="gas_org_name", property="gasOrgName", jdbcType=JdbcType.VARCHAR), + @Result(column="pay_type", property="payType", jdbcType=JdbcType.INTEGER), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="cancel_time", property="cancelTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP), - @Result(column="finish_time", property="finishTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="refund_time", property="refundTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="refund_remarks", property="refundRemarks", jdbcType=JdbcType.VARCHAR), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @@ -154,13 +166,14 @@ public interface HighGasOrderMapper extends HighGasOrderMapperExt { @Select({ "select", "id, order_no, child_order_no, channel_type, channel_order_no, mem_id, mem_phone, ", - "mer_id, mer_name, store_id, store_name, gas_refuel_price, gas_oil_no, gas_gun_no, ", + "company_id, company_name, mer_id, mer_name, store_id, store_name, deduction_price, ", + "payable_price, pay_gold, pay_price, gas_refuel_price, gas_oil_no, gas_gun_no, ", "gas_oil_type, gas_price_platform, gas_price_gun, gas_price_vip, gas_price_official, ", "gas_price_cost, gas_price_cost_total, gas_price_channel_pay, gas_oil_liters, ", "gas_discount, gas_oil_subsidy, gas_liters_preferences, gas_price_preferences, ", "gas_class_group_id, gas_class_group_name, gas_class_group_task_id, gas_staff_id, ", "gas_staff_name, gas_salesman_id, gas_salesman_name, gas_agent_id, gas_agent_name, ", - "gas_org_id, gas_org_name, `status`, create_time, cancel_time, pay_time, finish_time, ", + "gas_org_id, gas_org_name, pay_type, `status`, create_time, cancel_time, pay_time, ", "refund_time, refund_remarks, ext_1, ext_2, ext_3, ext_4, ext_5, ext_6", "from high_gas_order", "where id = #{id,jdbcType=BIGINT}" @@ -173,10 +186,16 @@ public interface HighGasOrderMapper extends HighGasOrderMapperExt { @Result(column="channel_order_no", property="channelOrderNo", jdbcType=JdbcType.VARCHAR), @Result(column="mem_id", property="memId", jdbcType=JdbcType.BIGINT), @Result(column="mem_phone", property="memPhone", jdbcType=JdbcType.VARCHAR), + @Result(column="company_id", property="companyId", jdbcType=JdbcType.BIGINT), + @Result(column="company_name", property="companyName", jdbcType=JdbcType.VARCHAR), @Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT), @Result(column="mer_name", property="merName", jdbcType=JdbcType.VARCHAR), @Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT), @Result(column="store_name", property="storeName", jdbcType=JdbcType.VARCHAR), + @Result(column="deduction_price", property="deductionPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="payable_price", property="payablePrice", jdbcType=JdbcType.DECIMAL), + @Result(column="pay_gold", property="payGold", jdbcType=JdbcType.INTEGER), + @Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL), @Result(column="gas_refuel_price", property="gasRefuelPrice", jdbcType=JdbcType.DECIMAL), @Result(column="gas_oil_no", property="gasOilNo", jdbcType=JdbcType.VARCHAR), @Result(column="gas_gun_no", property="gasGunNo", jdbcType=JdbcType.VARCHAR), @@ -204,11 +223,11 @@ public interface HighGasOrderMapper extends HighGasOrderMapperExt { @Result(column="gas_agent_name", property="gasAgentName", jdbcType=JdbcType.VARCHAR), @Result(column="gas_org_id", property="gasOrgId", jdbcType=JdbcType.BIGINT), @Result(column="gas_org_name", property="gasOrgName", jdbcType=JdbcType.VARCHAR), + @Result(column="pay_type", property="payType", jdbcType=JdbcType.INTEGER), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="cancel_time", property="cancelTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP), - @Result(column="finish_time", property="finishTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="refund_time", property="refundTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="refund_remarks", property="refundRemarks", jdbcType=JdbcType.VARCHAR), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @@ -237,10 +256,16 @@ public interface HighGasOrderMapper extends HighGasOrderMapperExt { "channel_order_no = #{channelOrderNo,jdbcType=VARCHAR},", "mem_id = #{memId,jdbcType=BIGINT},", "mem_phone = #{memPhone,jdbcType=VARCHAR},", + "company_id = #{companyId,jdbcType=BIGINT},", + "company_name = #{companyName,jdbcType=VARCHAR},", "mer_id = #{merId,jdbcType=BIGINT},", "mer_name = #{merName,jdbcType=VARCHAR},", "store_id = #{storeId,jdbcType=BIGINT},", "store_name = #{storeName,jdbcType=VARCHAR},", + "deduction_price = #{deductionPrice,jdbcType=DECIMAL},", + "payable_price = #{payablePrice,jdbcType=DECIMAL},", + "pay_gold = #{payGold,jdbcType=INTEGER},", + "pay_price = #{payPrice,jdbcType=DECIMAL},", "gas_refuel_price = #{gasRefuelPrice,jdbcType=DECIMAL},", "gas_oil_no = #{gasOilNo,jdbcType=VARCHAR},", "gas_gun_no = #{gasGunNo,jdbcType=VARCHAR},", @@ -268,11 +293,11 @@ public interface HighGasOrderMapper extends HighGasOrderMapperExt { "gas_agent_name = #{gasAgentName,jdbcType=VARCHAR},", "gas_org_id = #{gasOrgId,jdbcType=BIGINT},", "gas_org_name = #{gasOrgName,jdbcType=VARCHAR},", + "pay_type = #{payType,jdbcType=INTEGER},", "`status` = #{status,jdbcType=INTEGER},", "create_time = #{createTime,jdbcType=TIMESTAMP},", "cancel_time = #{cancelTime,jdbcType=TIMESTAMP},", "pay_time = #{payTime,jdbcType=TIMESTAMP},", - "finish_time = #{finishTime,jdbcType=TIMESTAMP},", "refund_time = #{refundTime,jdbcType=TIMESTAMP},", "refund_remarks = #{refundRemarks,jdbcType=VARCHAR},", "ext_1 = #{ext1,jdbcType=VARCHAR},", diff --git a/hai-service/src/main/java/com/hai/dao/HighGasOrderSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighGasOrderSqlProvider.java index d70a6784..52908b0b 100644 --- a/hai-service/src/main/java/com/hai/dao/HighGasOrderSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighGasOrderSqlProvider.java @@ -52,6 +52,14 @@ public class HighGasOrderSqlProvider { sql.VALUES("mem_phone", "#{memPhone,jdbcType=VARCHAR}"); } + if (record.getCompanyId() != null) { + sql.VALUES("company_id", "#{companyId,jdbcType=BIGINT}"); + } + + if (record.getCompanyName() != null) { + sql.VALUES("company_name", "#{companyName,jdbcType=VARCHAR}"); + } + if (record.getMerId() != null) { sql.VALUES("mer_id", "#{merId,jdbcType=BIGINT}"); } @@ -68,6 +76,22 @@ public class HighGasOrderSqlProvider { sql.VALUES("store_name", "#{storeName,jdbcType=VARCHAR}"); } + if (record.getDeductionPrice() != null) { + sql.VALUES("deduction_price", "#{deductionPrice,jdbcType=DECIMAL}"); + } + + if (record.getPayablePrice() != null) { + sql.VALUES("payable_price", "#{payablePrice,jdbcType=DECIMAL}"); + } + + if (record.getPayGold() != null) { + sql.VALUES("pay_gold", "#{payGold,jdbcType=INTEGER}"); + } + + if (record.getPayPrice() != null) { + sql.VALUES("pay_price", "#{payPrice,jdbcType=DECIMAL}"); + } + if (record.getGasRefuelPrice() != null) { sql.VALUES("gas_refuel_price", "#{gasRefuelPrice,jdbcType=DECIMAL}"); } @@ -176,6 +200,10 @@ public class HighGasOrderSqlProvider { sql.VALUES("gas_org_name", "#{gasOrgName,jdbcType=VARCHAR}"); } + if (record.getPayType() != null) { + sql.VALUES("pay_type", "#{payType,jdbcType=INTEGER}"); + } + if (record.getStatus() != null) { sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); } @@ -192,10 +220,6 @@ public class HighGasOrderSqlProvider { sql.VALUES("pay_time", "#{payTime,jdbcType=TIMESTAMP}"); } - if (record.getFinishTime() != null) { - sql.VALUES("finish_time", "#{finishTime,jdbcType=TIMESTAMP}"); - } - if (record.getRefundTime() != null) { sql.VALUES("refund_time", "#{refundTime,jdbcType=TIMESTAMP}"); } @@ -244,10 +268,16 @@ public class HighGasOrderSqlProvider { sql.SELECT("channel_order_no"); sql.SELECT("mem_id"); sql.SELECT("mem_phone"); + sql.SELECT("company_id"); + sql.SELECT("company_name"); sql.SELECT("mer_id"); sql.SELECT("mer_name"); sql.SELECT("store_id"); sql.SELECT("store_name"); + sql.SELECT("deduction_price"); + sql.SELECT("payable_price"); + sql.SELECT("pay_gold"); + sql.SELECT("pay_price"); sql.SELECT("gas_refuel_price"); sql.SELECT("gas_oil_no"); sql.SELECT("gas_gun_no"); @@ -275,11 +305,11 @@ public class HighGasOrderSqlProvider { sql.SELECT("gas_agent_name"); sql.SELECT("gas_org_id"); sql.SELECT("gas_org_name"); + sql.SELECT("pay_type"); sql.SELECT("`status`"); sql.SELECT("create_time"); sql.SELECT("cancel_time"); sql.SELECT("pay_time"); - sql.SELECT("finish_time"); sql.SELECT("refund_time"); sql.SELECT("refund_remarks"); sql.SELECT("ext_1"); @@ -333,6 +363,14 @@ public class HighGasOrderSqlProvider { sql.SET("mem_phone = #{record.memPhone,jdbcType=VARCHAR}"); } + if (record.getCompanyId() != null) { + sql.SET("company_id = #{record.companyId,jdbcType=BIGINT}"); + } + + if (record.getCompanyName() != null) { + sql.SET("company_name = #{record.companyName,jdbcType=VARCHAR}"); + } + if (record.getMerId() != null) { sql.SET("mer_id = #{record.merId,jdbcType=BIGINT}"); } @@ -349,6 +387,22 @@ public class HighGasOrderSqlProvider { sql.SET("store_name = #{record.storeName,jdbcType=VARCHAR}"); } + if (record.getDeductionPrice() != null) { + sql.SET("deduction_price = #{record.deductionPrice,jdbcType=DECIMAL}"); + } + + if (record.getPayablePrice() != null) { + sql.SET("payable_price = #{record.payablePrice,jdbcType=DECIMAL}"); + } + + if (record.getPayGold() != null) { + sql.SET("pay_gold = #{record.payGold,jdbcType=INTEGER}"); + } + + if (record.getPayPrice() != null) { + sql.SET("pay_price = #{record.payPrice,jdbcType=DECIMAL}"); + } + if (record.getGasRefuelPrice() != null) { sql.SET("gas_refuel_price = #{record.gasRefuelPrice,jdbcType=DECIMAL}"); } @@ -457,6 +511,10 @@ public class HighGasOrderSqlProvider { sql.SET("gas_org_name = #{record.gasOrgName,jdbcType=VARCHAR}"); } + if (record.getPayType() != null) { + sql.SET("pay_type = #{record.payType,jdbcType=INTEGER}"); + } + if (record.getStatus() != null) { sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); } @@ -473,10 +531,6 @@ public class HighGasOrderSqlProvider { sql.SET("pay_time = #{record.payTime,jdbcType=TIMESTAMP}"); } - if (record.getFinishTime() != null) { - sql.SET("finish_time = #{record.finishTime,jdbcType=TIMESTAMP}"); - } - if (record.getRefundTime() != null) { sql.SET("refund_time = #{record.refundTime,jdbcType=TIMESTAMP}"); } @@ -524,10 +578,16 @@ public class HighGasOrderSqlProvider { sql.SET("channel_order_no = #{record.channelOrderNo,jdbcType=VARCHAR}"); sql.SET("mem_id = #{record.memId,jdbcType=BIGINT}"); sql.SET("mem_phone = #{record.memPhone,jdbcType=VARCHAR}"); + sql.SET("company_id = #{record.companyId,jdbcType=BIGINT}"); + sql.SET("company_name = #{record.companyName,jdbcType=VARCHAR}"); sql.SET("mer_id = #{record.merId,jdbcType=BIGINT}"); sql.SET("mer_name = #{record.merName,jdbcType=VARCHAR}"); sql.SET("store_id = #{record.storeId,jdbcType=BIGINT}"); sql.SET("store_name = #{record.storeName,jdbcType=VARCHAR}"); + sql.SET("deduction_price = #{record.deductionPrice,jdbcType=DECIMAL}"); + sql.SET("payable_price = #{record.payablePrice,jdbcType=DECIMAL}"); + sql.SET("pay_gold = #{record.payGold,jdbcType=INTEGER}"); + sql.SET("pay_price = #{record.payPrice,jdbcType=DECIMAL}"); sql.SET("gas_refuel_price = #{record.gasRefuelPrice,jdbcType=DECIMAL}"); sql.SET("gas_oil_no = #{record.gasOilNo,jdbcType=VARCHAR}"); sql.SET("gas_gun_no = #{record.gasGunNo,jdbcType=VARCHAR}"); @@ -555,11 +615,11 @@ public class HighGasOrderSqlProvider { sql.SET("gas_agent_name = #{record.gasAgentName,jdbcType=VARCHAR}"); sql.SET("gas_org_id = #{record.gasOrgId,jdbcType=BIGINT}"); sql.SET("gas_org_name = #{record.gasOrgName,jdbcType=VARCHAR}"); + sql.SET("pay_type = #{record.payType,jdbcType=INTEGER}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); sql.SET("cancel_time = #{record.cancelTime,jdbcType=TIMESTAMP}"); sql.SET("pay_time = #{record.payTime,jdbcType=TIMESTAMP}"); - sql.SET("finish_time = #{record.finishTime,jdbcType=TIMESTAMP}"); sql.SET("refund_time = #{record.refundTime,jdbcType=TIMESTAMP}"); sql.SET("refund_remarks = #{record.refundRemarks,jdbcType=VARCHAR}"); sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); @@ -602,6 +662,14 @@ public class HighGasOrderSqlProvider { sql.SET("mem_phone = #{memPhone,jdbcType=VARCHAR}"); } + if (record.getCompanyId() != null) { + sql.SET("company_id = #{companyId,jdbcType=BIGINT}"); + } + + if (record.getCompanyName() != null) { + sql.SET("company_name = #{companyName,jdbcType=VARCHAR}"); + } + if (record.getMerId() != null) { sql.SET("mer_id = #{merId,jdbcType=BIGINT}"); } @@ -618,6 +686,22 @@ public class HighGasOrderSqlProvider { sql.SET("store_name = #{storeName,jdbcType=VARCHAR}"); } + if (record.getDeductionPrice() != null) { + sql.SET("deduction_price = #{deductionPrice,jdbcType=DECIMAL}"); + } + + if (record.getPayablePrice() != null) { + sql.SET("payable_price = #{payablePrice,jdbcType=DECIMAL}"); + } + + if (record.getPayGold() != null) { + sql.SET("pay_gold = #{payGold,jdbcType=INTEGER}"); + } + + if (record.getPayPrice() != null) { + sql.SET("pay_price = #{payPrice,jdbcType=DECIMAL}"); + } + if (record.getGasRefuelPrice() != null) { sql.SET("gas_refuel_price = #{gasRefuelPrice,jdbcType=DECIMAL}"); } @@ -726,6 +810,10 @@ public class HighGasOrderSqlProvider { sql.SET("gas_org_name = #{gasOrgName,jdbcType=VARCHAR}"); } + if (record.getPayType() != null) { + sql.SET("pay_type = #{payType,jdbcType=INTEGER}"); + } + if (record.getStatus() != null) { sql.SET("`status` = #{status,jdbcType=INTEGER}"); } @@ -742,10 +830,6 @@ public class HighGasOrderSqlProvider { sql.SET("pay_time = #{payTime,jdbcType=TIMESTAMP}"); } - if (record.getFinishTime() != null) { - sql.SET("finish_time = #{finishTime,jdbcType=TIMESTAMP}"); - } - if (record.getRefundTime() != null) { sql.SET("refund_time = #{refundTime,jdbcType=TIMESTAMP}"); } 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 322a4b6c..c6de3a56 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java @@ -1284,4 +1284,5 @@ public interface HighOrderMapperExt { @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) }) List integralRebateOrder(); + } diff --git a/hai-service/src/main/java/com/hai/dao/HighUserCouponMapper.java b/hai-service/src/main/java/com/hai/dao/HighUserCouponMapper.java index 903c7a67..4e5edd64 100644 --- a/hai-service/src/main/java/com/hai/dao/HighUserCouponMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighUserCouponMapper.java @@ -40,21 +40,21 @@ public interface HighUserCouponMapper extends HighUserCouponMapperExt { @Insert({ "insert into high_user_coupon (merchant_id, coupon_id, ", - "user_id, coupon_code_id, ", - "store_id, create_time, ", - "consume_time, use_end_time, ", - "qr_code_img, `status`, ", - "`source`, source_id, ", - "ext_1, ext_2, ext_3, ", - "ext_4)", + "user_id, order_id, child_order_id, ", + "coupon_code_id, store_id, ", + "create_time, consume_time, ", + "use_end_time, qr_code_img, ", + "`status`, `source`, ", + "source_id, ext_1, ext_2, ", + "ext_3, ext_4)", "values (#{merchantId,jdbcType=BIGINT}, #{couponId,jdbcType=BIGINT}, ", - "#{userId,jdbcType=BIGINT}, #{couponCodeId,jdbcType=BIGINT}, ", - "#{storeId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, ", - "#{consumeTime,jdbcType=TIMESTAMP}, #{useEndTime,jdbcType=TIMESTAMP}, ", - "#{qrCodeImg,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ", - "#{source,jdbcType=INTEGER}, #{sourceId,jdbcType=BIGINT}, ", - "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, ", - "#{ext4,jdbcType=VARCHAR})" + "#{userId,jdbcType=BIGINT}, #{orderId,jdbcType=BIGINT}, #{childOrderId,jdbcType=BIGINT}, ", + "#{couponCodeId,jdbcType=BIGINT}, #{storeId,jdbcType=BIGINT}, ", + "#{createTime,jdbcType=TIMESTAMP}, #{consumeTime,jdbcType=TIMESTAMP}, ", + "#{useEndTime,jdbcType=TIMESTAMP}, #{qrCodeImg,jdbcType=VARCHAR}, ", + "#{status,jdbcType=INTEGER}, #{source,jdbcType=INTEGER}, ", + "#{sourceId,jdbcType=BIGINT}, #{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, ", + "#{ext3,jdbcType=VARCHAR}, #{ext4,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(HighUserCoupon record); @@ -69,6 +69,8 @@ public interface HighUserCouponMapper extends HighUserCouponMapperExt { @Result(column="merchant_id", property="merchantId", jdbcType=JdbcType.BIGINT), @Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT), @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), + @Result(column="order_id", property="orderId", jdbcType=JdbcType.BIGINT), + @Result(column="child_order_id", property="childOrderId", jdbcType=JdbcType.BIGINT), @Result(column="coupon_code_id", property="couponCodeId", jdbcType=JdbcType.BIGINT), @Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @@ -87,9 +89,9 @@ public interface HighUserCouponMapper extends HighUserCouponMapperExt { @Select({ "select", - "id, merchant_id, coupon_id, user_id, coupon_code_id, store_id, create_time, ", - "consume_time, use_end_time, qr_code_img, `status`, `source`, source_id, ext_1, ", - "ext_2, ext_3, ext_4", + "id, merchant_id, coupon_id, user_id, order_id, child_order_id, coupon_code_id, ", + "store_id, create_time, consume_time, use_end_time, qr_code_img, `status`, `source`, ", + "source_id, ext_1, ext_2, ext_3, ext_4", "from high_user_coupon", "where id = #{id,jdbcType=BIGINT}" }) @@ -98,6 +100,8 @@ public interface HighUserCouponMapper extends HighUserCouponMapperExt { @Result(column="merchant_id", property="merchantId", jdbcType=JdbcType.BIGINT), @Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT), @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), + @Result(column="order_id", property="orderId", jdbcType=JdbcType.BIGINT), + @Result(column="child_order_id", property="childOrderId", jdbcType=JdbcType.BIGINT), @Result(column="coupon_code_id", property="couponCodeId", jdbcType=JdbcType.BIGINT), @Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT), @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), @@ -128,6 +132,8 @@ public interface HighUserCouponMapper extends HighUserCouponMapperExt { "set merchant_id = #{merchantId,jdbcType=BIGINT},", "coupon_id = #{couponId,jdbcType=BIGINT},", "user_id = #{userId,jdbcType=BIGINT},", + "order_id = #{orderId,jdbcType=BIGINT},", + "child_order_id = #{childOrderId,jdbcType=BIGINT},", "coupon_code_id = #{couponCodeId,jdbcType=BIGINT},", "store_id = #{storeId,jdbcType=BIGINT},", "create_time = #{createTime,jdbcType=TIMESTAMP},", diff --git a/hai-service/src/main/java/com/hai/dao/HighUserCouponSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighUserCouponSqlProvider.java index 34f7b974..675b40e0 100644 --- a/hai-service/src/main/java/com/hai/dao/HighUserCouponSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighUserCouponSqlProvider.java @@ -40,6 +40,14 @@ public class HighUserCouponSqlProvider { sql.VALUES("user_id", "#{userId,jdbcType=BIGINT}"); } + if (record.getOrderId() != null) { + sql.VALUES("order_id", "#{orderId,jdbcType=BIGINT}"); + } + + if (record.getChildOrderId() != null) { + sql.VALUES("child_order_id", "#{childOrderId,jdbcType=BIGINT}"); + } + if (record.getCouponCodeId() != null) { sql.VALUES("coupon_code_id", "#{couponCodeId,jdbcType=BIGINT}"); } @@ -105,6 +113,8 @@ public class HighUserCouponSqlProvider { sql.SELECT("merchant_id"); sql.SELECT("coupon_id"); sql.SELECT("user_id"); + sql.SELECT("order_id"); + sql.SELECT("child_order_id"); sql.SELECT("coupon_code_id"); sql.SELECT("store_id"); sql.SELECT("create_time"); @@ -151,6 +161,14 @@ public class HighUserCouponSqlProvider { sql.SET("user_id = #{record.userId,jdbcType=BIGINT}"); } + if (record.getOrderId() != null) { + sql.SET("order_id = #{record.orderId,jdbcType=BIGINT}"); + } + + if (record.getChildOrderId() != null) { + sql.SET("child_order_id = #{record.childOrderId,jdbcType=BIGINT}"); + } + if (record.getCouponCodeId() != null) { sql.SET("coupon_code_id = #{record.couponCodeId,jdbcType=BIGINT}"); } @@ -215,6 +233,8 @@ public class HighUserCouponSqlProvider { sql.SET("merchant_id = #{record.merchantId,jdbcType=BIGINT}"); sql.SET("coupon_id = #{record.couponId,jdbcType=BIGINT}"); sql.SET("user_id = #{record.userId,jdbcType=BIGINT}"); + sql.SET("order_id = #{record.orderId,jdbcType=BIGINT}"); + sql.SET("child_order_id = #{record.childOrderId,jdbcType=BIGINT}"); sql.SET("coupon_code_id = #{record.couponCodeId,jdbcType=BIGINT}"); sql.SET("store_id = #{record.storeId,jdbcType=BIGINT}"); sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); @@ -250,6 +270,14 @@ public class HighUserCouponSqlProvider { sql.SET("user_id = #{userId,jdbcType=BIGINT}"); } + if (record.getOrderId() != null) { + sql.SET("order_id = #{orderId,jdbcType=BIGINT}"); + } + + if (record.getChildOrderId() != null) { + sql.SET("child_order_id = #{childOrderId,jdbcType=BIGINT}"); + } + if (record.getCouponCodeId() != null) { sql.SET("coupon_code_id = #{couponCodeId,jdbcType=BIGINT}"); } diff --git a/hai-service/src/main/java/com/hai/dao/order/OrderMapperExt.java b/hai-service/src/main/java/com/hai/dao/order/OrderMapperExt.java index f6e33b25..b7f4dd07 100644 --- a/hai-service/src/main/java/com/hai/dao/order/OrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/order/OrderMapperExt.java @@ -1,6 +1,6 @@ package com.hai.dao.order; -import com.hai.order.model.OrderCouponModal; +import com.hai.order.model.OrderCouponModel; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; @@ -23,49 +23,55 @@ public interface OrderMapperExt { @Select("SELECT count(1) FROM high_child_order where mem_id = #{userId} and child_order_status in (2,3) and goods_type = 1 and goods_id = #{couponId}") int userBuyCouponNum(@Param("userId") Long userId,@Param("couponId") Long couponId); - /** - * 查询卡券订单列表 - * @param param - * @return - */ - @Select("") - List queryOrderCouponList(@Param("param") Map param); + " where a.goods_type = 1" + + " and a.goods_id in (${param.goodsId}) " + + " and b.order_no like concat('%', #{param.orderNo}, '%') " + + " and b.mem_phone like concat('%', #{param.memPhone}, '%') " + + " and a.goods_name like concat('%', #{param.couponName}, '%') " + + " and b.pay_type = #{param.payType} " + + " and b.order_status = #{param.orderStatus} " + + " = #{param.createTimeS} ]]> " + + " " + + " = #{param.payTimeS} ]]> " + + " " + + " = #{param.finishTimeS} ]]> " + + " " + + " ORDER BY b.create_time desc" + + ""}) + List queryOrderCoupon(@Param("param") Map param); } diff --git a/hai-service/src/main/java/com/hai/entity/HighCouponCodeOther.java b/hai-service/src/main/java/com/hai/entity/HighCouponCodeOther.java index d24ceb61..a00c99c5 100644 --- a/hai-service/src/main/java/com/hai/entity/HighCouponCodeOther.java +++ b/hai-service/src/main/java/com/hai/entity/HighCouponCodeOther.java @@ -19,7 +19,7 @@ public class HighCouponCodeOther implements Serializable { private Long id; /** - * 类型: 1 汇联通 + * 类型: 1 贵州中石化 2 重庆中石油 */ private Integer type; @@ -68,6 +68,21 @@ public class HighCouponCodeOther implements Serializable { */ private Date validEndDate; + /** + * 核销时间 + */ + private Date useTime; + + /** + * 核销站点编号 + */ + private String stationCode; + + /** + * 核销站点名称 + */ + private String stationName; + /** * 创建时间 */ @@ -169,6 +184,30 @@ public class HighCouponCodeOther implements Serializable { this.validEndDate = validEndDate; } + public Date getUseTime() { + return useTime; + } + + public void setUseTime(Date useTime) { + this.useTime = useTime; + } + + public String getStationCode() { + return stationCode; + } + + public void setStationCode(String stationCode) { + this.stationCode = stationCode; + } + + public String getStationName() { + return stationName; + } + + public void setStationName(String stationName) { + this.stationName = stationName; + } + public Date getCreateTime() { return createTime; } @@ -224,6 +263,9 @@ public class HighCouponCodeOther implements Serializable { && (this.getActiveTime() == null ? other.getActiveTime() == null : this.getActiveTime().equals(other.getActiveTime())) && (this.getValidStartDate() == null ? other.getValidStartDate() == null : this.getValidStartDate().equals(other.getValidStartDate())) && (this.getValidEndDate() == null ? other.getValidEndDate() == null : this.getValidEndDate().equals(other.getValidEndDate())) + && (this.getUseTime() == null ? other.getUseTime() == null : this.getUseTime().equals(other.getUseTime())) + && (this.getStationCode() == null ? other.getStationCode() == null : this.getStationCode().equals(other.getStationCode())) + && (this.getStationName() == null ? other.getStationName() == null : this.getStationName().equals(other.getStationName())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) && (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) @@ -245,6 +287,9 @@ public class HighCouponCodeOther implements Serializable { result = prime * result + ((getActiveTime() == null) ? 0 : getActiveTime().hashCode()); result = prime * result + ((getValidStartDate() == null) ? 0 : getValidStartDate().hashCode()); result = prime * result + ((getValidEndDate() == null) ? 0 : getValidEndDate().hashCode()); + result = prime * result + ((getUseTime() == null) ? 0 : getUseTime().hashCode()); + result = prime * result + ((getStationCode() == null) ? 0 : getStationCode().hashCode()); + result = prime * result + ((getStationName() == null) ? 0 : getStationName().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); @@ -269,6 +314,9 @@ public class HighCouponCodeOther implements Serializable { sb.append(", activeTime=").append(activeTime); sb.append(", validStartDate=").append(validStartDate); sb.append(", validEndDate=").append(validEndDate); + sb.append(", useTime=").append(useTime); + sb.append(", stationCode=").append(stationCode); + sb.append(", stationName=").append(stationName); sb.append(", createTime=").append(createTime); sb.append(", ext1=").append(ext1); sb.append(", ext2=").append(ext2); diff --git a/hai-service/src/main/java/com/hai/entity/HighCouponCodeOtherExample.java b/hai-service/src/main/java/com/hai/entity/HighCouponCodeOtherExample.java index 42cb8649..27799024 100644 --- a/hai-service/src/main/java/com/hai/entity/HighCouponCodeOtherExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighCouponCodeOtherExample.java @@ -805,6 +805,206 @@ public class HighCouponCodeOtherExample { return (Criteria) this; } + public Criteria andUseTimeIsNull() { + addCriterion("use_time is null"); + return (Criteria) this; + } + + public Criteria andUseTimeIsNotNull() { + addCriterion("use_time is not null"); + return (Criteria) this; + } + + public Criteria andUseTimeEqualTo(Date value) { + addCriterion("use_time =", value, "useTime"); + return (Criteria) this; + } + + public Criteria andUseTimeNotEqualTo(Date value) { + addCriterion("use_time <>", value, "useTime"); + return (Criteria) this; + } + + public Criteria andUseTimeGreaterThan(Date value) { + addCriterion("use_time >", value, "useTime"); + return (Criteria) this; + } + + public Criteria andUseTimeGreaterThanOrEqualTo(Date value) { + addCriterion("use_time >=", value, "useTime"); + return (Criteria) this; + } + + public Criteria andUseTimeLessThan(Date value) { + addCriterion("use_time <", value, "useTime"); + return (Criteria) this; + } + + public Criteria andUseTimeLessThanOrEqualTo(Date value) { + addCriterion("use_time <=", value, "useTime"); + return (Criteria) this; + } + + public Criteria andUseTimeIn(List values) { + addCriterion("use_time in", values, "useTime"); + return (Criteria) this; + } + + public Criteria andUseTimeNotIn(List values) { + addCriterion("use_time not in", values, "useTime"); + return (Criteria) this; + } + + public Criteria andUseTimeBetween(Date value1, Date value2) { + addCriterion("use_time between", value1, value2, "useTime"); + return (Criteria) this; + } + + public Criteria andUseTimeNotBetween(Date value1, Date value2) { + addCriterion("use_time not between", value1, value2, "useTime"); + return (Criteria) this; + } + + public Criteria andStationCodeIsNull() { + addCriterion("station_code is null"); + return (Criteria) this; + } + + public Criteria andStationCodeIsNotNull() { + addCriterion("station_code is not null"); + return (Criteria) this; + } + + public Criteria andStationCodeEqualTo(String value) { + addCriterion("station_code =", value, "stationCode"); + return (Criteria) this; + } + + public Criteria andStationCodeNotEqualTo(String value) { + addCriterion("station_code <>", value, "stationCode"); + return (Criteria) this; + } + + public Criteria andStationCodeGreaterThan(String value) { + addCriterion("station_code >", value, "stationCode"); + return (Criteria) this; + } + + public Criteria andStationCodeGreaterThanOrEqualTo(String value) { + addCriterion("station_code >=", value, "stationCode"); + return (Criteria) this; + } + + public Criteria andStationCodeLessThan(String value) { + addCriterion("station_code <", value, "stationCode"); + return (Criteria) this; + } + + public Criteria andStationCodeLessThanOrEqualTo(String value) { + addCriterion("station_code <=", value, "stationCode"); + return (Criteria) this; + } + + public Criteria andStationCodeLike(String value) { + addCriterion("station_code like", value, "stationCode"); + return (Criteria) this; + } + + public Criteria andStationCodeNotLike(String value) { + addCriterion("station_code not like", value, "stationCode"); + return (Criteria) this; + } + + public Criteria andStationCodeIn(List values) { + addCriterion("station_code in", values, "stationCode"); + return (Criteria) this; + } + + public Criteria andStationCodeNotIn(List values) { + addCriterion("station_code not in", values, "stationCode"); + return (Criteria) this; + } + + public Criteria andStationCodeBetween(String value1, String value2) { + addCriterion("station_code between", value1, value2, "stationCode"); + return (Criteria) this; + } + + public Criteria andStationCodeNotBetween(String value1, String value2) { + addCriterion("station_code not between", value1, value2, "stationCode"); + return (Criteria) this; + } + + public Criteria andStationNameIsNull() { + addCriterion("station_name is null"); + return (Criteria) this; + } + + public Criteria andStationNameIsNotNull() { + addCriterion("station_name is not null"); + return (Criteria) this; + } + + public Criteria andStationNameEqualTo(String value) { + addCriterion("station_name =", value, "stationName"); + return (Criteria) this; + } + + public Criteria andStationNameNotEqualTo(String value) { + addCriterion("station_name <>", value, "stationName"); + return (Criteria) this; + } + + public Criteria andStationNameGreaterThan(String value) { + addCriterion("station_name >", value, "stationName"); + return (Criteria) this; + } + + public Criteria andStationNameGreaterThanOrEqualTo(String value) { + addCriterion("station_name >=", value, "stationName"); + return (Criteria) this; + } + + public Criteria andStationNameLessThan(String value) { + addCriterion("station_name <", value, "stationName"); + return (Criteria) this; + } + + public Criteria andStationNameLessThanOrEqualTo(String value) { + addCriterion("station_name <=", value, "stationName"); + return (Criteria) this; + } + + public Criteria andStationNameLike(String value) { + addCriterion("station_name like", value, "stationName"); + return (Criteria) this; + } + + public Criteria andStationNameNotLike(String value) { + addCriterion("station_name not like", value, "stationName"); + return (Criteria) this; + } + + public Criteria andStationNameIn(List values) { + addCriterion("station_name in", values, "stationName"); + return (Criteria) this; + } + + public Criteria andStationNameNotIn(List values) { + addCriterion("station_name not in", values, "stationName"); + return (Criteria) this; + } + + public Criteria andStationNameBetween(String value1, String value2) { + addCriterion("station_name between", value1, value2, "stationName"); + return (Criteria) this; + } + + public Criteria andStationNameNotBetween(String value1, String value2) { + addCriterion("station_name not between", value1, value2, "stationName"); + return (Criteria) this; + } + public Criteria andCreateTimeIsNull() { addCriterion("create_time is null"); return (Criteria) this; diff --git a/hai-service/src/main/java/com/hai/entity/HighGasOrder.java b/hai-service/src/main/java/com/hai/entity/HighGasOrder.java index 4bec4e73..5c3a5b4e 100644 --- a/hai-service/src/main/java/com/hai/entity/HighGasOrder.java +++ b/hai-service/src/main/java/com/hai/entity/HighGasOrder.java @@ -49,6 +49,16 @@ public class HighGasOrder implements Serializable { */ private String memPhone; + /** + * 公司id + */ + private Long companyId; + + /** + * 公司名称 + */ + private String companyName; + /** * 商户id */ @@ -69,6 +79,26 @@ public class HighGasOrder implements Serializable { */ private String storeName; + /** + * 优惠金额 + */ + private BigDecimal deductionPrice; + + /** + * 应付金额 + */ + private BigDecimal payablePrice; + + /** + * 积分抵扣 + */ + private Integer payGold; + + /** + * 支付金额 + */ + private BigDecimal payPrice; + /** * 【加油站】加油金额 */ @@ -204,6 +234,11 @@ public class HighGasOrder implements Serializable { */ private String gasOrgName; + /** + * 支付方式: 1:支付宝 2:微信 3:金币 4:汇联通工会卡 5:银联 + */ + private Integer payType; + /** * 订单状态: 1. 待支付 @@ -230,11 +265,6 @@ public class HighGasOrder implements Serializable { */ private Date payTime; - /** - * 完成时间 - */ - private Date finishTime; - /** * 退款时间 */ @@ -315,6 +345,22 @@ public class HighGasOrder implements Serializable { this.memPhone = memPhone; } + public Long getCompanyId() { + return companyId; + } + + public void setCompanyId(Long companyId) { + this.companyId = companyId; + } + + public String getCompanyName() { + return companyName; + } + + public void setCompanyName(String companyName) { + this.companyName = companyName; + } + public Long getMerId() { return merId; } @@ -347,6 +393,38 @@ public class HighGasOrder implements Serializable { this.storeName = storeName; } + public BigDecimal getDeductionPrice() { + return deductionPrice; + } + + public void setDeductionPrice(BigDecimal deductionPrice) { + this.deductionPrice = deductionPrice; + } + + public BigDecimal getPayablePrice() { + return payablePrice; + } + + public void setPayablePrice(BigDecimal payablePrice) { + this.payablePrice = payablePrice; + } + + public Integer getPayGold() { + return payGold; + } + + public void setPayGold(Integer payGold) { + this.payGold = payGold; + } + + public BigDecimal getPayPrice() { + return payPrice; + } + + public void setPayPrice(BigDecimal payPrice) { + this.payPrice = payPrice; + } + public BigDecimal getGasRefuelPrice() { return gasRefuelPrice; } @@ -563,6 +641,14 @@ public class HighGasOrder implements Serializable { this.gasOrgName = gasOrgName; } + public Integer getPayType() { + return payType; + } + + public void setPayType(Integer payType) { + this.payType = payType; + } + public Integer getStatus() { return status; } @@ -595,14 +681,6 @@ public class HighGasOrder implements Serializable { this.payTime = payTime; } - public Date getFinishTime() { - return finishTime; - } - - public void setFinishTime(Date finishTime) { - this.finishTime = finishTime; - } - public Date getRefundTime() { return refundTime; } @@ -686,10 +764,16 @@ public class HighGasOrder implements Serializable { && (this.getChannelOrderNo() == null ? other.getChannelOrderNo() == null : this.getChannelOrderNo().equals(other.getChannelOrderNo())) && (this.getMemId() == null ? other.getMemId() == null : this.getMemId().equals(other.getMemId())) && (this.getMemPhone() == null ? other.getMemPhone() == null : this.getMemPhone().equals(other.getMemPhone())) + && (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId())) + && (this.getCompanyName() == null ? other.getCompanyName() == null : this.getCompanyName().equals(other.getCompanyName())) && (this.getMerId() == null ? other.getMerId() == null : this.getMerId().equals(other.getMerId())) && (this.getMerName() == null ? other.getMerName() == null : this.getMerName().equals(other.getMerName())) && (this.getStoreId() == null ? other.getStoreId() == null : this.getStoreId().equals(other.getStoreId())) && (this.getStoreName() == null ? other.getStoreName() == null : this.getStoreName().equals(other.getStoreName())) + && (this.getDeductionPrice() == null ? other.getDeductionPrice() == null : this.getDeductionPrice().equals(other.getDeductionPrice())) + && (this.getPayablePrice() == null ? other.getPayablePrice() == null : this.getPayablePrice().equals(other.getPayablePrice())) + && (this.getPayGold() == null ? other.getPayGold() == null : this.getPayGold().equals(other.getPayGold())) + && (this.getPayPrice() == null ? other.getPayPrice() == null : this.getPayPrice().equals(other.getPayPrice())) && (this.getGasRefuelPrice() == null ? other.getGasRefuelPrice() == null : this.getGasRefuelPrice().equals(other.getGasRefuelPrice())) && (this.getGasOilNo() == null ? other.getGasOilNo() == null : this.getGasOilNo().equals(other.getGasOilNo())) && (this.getGasGunNo() == null ? other.getGasGunNo() == null : this.getGasGunNo().equals(other.getGasGunNo())) @@ -717,11 +801,11 @@ public class HighGasOrder implements Serializable { && (this.getGasAgentName() == null ? other.getGasAgentName() == null : this.getGasAgentName().equals(other.getGasAgentName())) && (this.getGasOrgId() == null ? other.getGasOrgId() == null : this.getGasOrgId().equals(other.getGasOrgId())) && (this.getGasOrgName() == null ? other.getGasOrgName() == null : this.getGasOrgName().equals(other.getGasOrgName())) + && (this.getPayType() == null ? other.getPayType() == null : this.getPayType().equals(other.getPayType())) && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getCancelTime() == null ? other.getCancelTime() == null : this.getCancelTime().equals(other.getCancelTime())) && (this.getPayTime() == null ? other.getPayTime() == null : this.getPayTime().equals(other.getPayTime())) - && (this.getFinishTime() == null ? other.getFinishTime() == null : this.getFinishTime().equals(other.getFinishTime())) && (this.getRefundTime() == null ? other.getRefundTime() == null : this.getRefundTime().equals(other.getRefundTime())) && (this.getRefundRemarks() == null ? other.getRefundRemarks() == null : this.getRefundRemarks().equals(other.getRefundRemarks())) && (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) @@ -743,10 +827,16 @@ public class HighGasOrder implements Serializable { result = prime * result + ((getChannelOrderNo() == null) ? 0 : getChannelOrderNo().hashCode()); result = prime * result + ((getMemId() == null) ? 0 : getMemId().hashCode()); result = prime * result + ((getMemPhone() == null) ? 0 : getMemPhone().hashCode()); + result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode()); + result = prime * result + ((getCompanyName() == null) ? 0 : getCompanyName().hashCode()); result = prime * result + ((getMerId() == null) ? 0 : getMerId().hashCode()); result = prime * result + ((getMerName() == null) ? 0 : getMerName().hashCode()); result = prime * result + ((getStoreId() == null) ? 0 : getStoreId().hashCode()); result = prime * result + ((getStoreName() == null) ? 0 : getStoreName().hashCode()); + result = prime * result + ((getDeductionPrice() == null) ? 0 : getDeductionPrice().hashCode()); + result = prime * result + ((getPayablePrice() == null) ? 0 : getPayablePrice().hashCode()); + result = prime * result + ((getPayGold() == null) ? 0 : getPayGold().hashCode()); + result = prime * result + ((getPayPrice() == null) ? 0 : getPayPrice().hashCode()); result = prime * result + ((getGasRefuelPrice() == null) ? 0 : getGasRefuelPrice().hashCode()); result = prime * result + ((getGasOilNo() == null) ? 0 : getGasOilNo().hashCode()); result = prime * result + ((getGasGunNo() == null) ? 0 : getGasGunNo().hashCode()); @@ -774,11 +864,11 @@ public class HighGasOrder implements Serializable { result = prime * result + ((getGasAgentName() == null) ? 0 : getGasAgentName().hashCode()); result = prime * result + ((getGasOrgId() == null) ? 0 : getGasOrgId().hashCode()); result = prime * result + ((getGasOrgName() == null) ? 0 : getGasOrgName().hashCode()); + result = prime * result + ((getPayType() == null) ? 0 : getPayType().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getCancelTime() == null) ? 0 : getCancelTime().hashCode()); result = prime * result + ((getPayTime() == null) ? 0 : getPayTime().hashCode()); - result = prime * result + ((getFinishTime() == null) ? 0 : getFinishTime().hashCode()); result = prime * result + ((getRefundTime() == null) ? 0 : getRefundTime().hashCode()); result = prime * result + ((getRefundRemarks() == null) ? 0 : getRefundRemarks().hashCode()); result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); @@ -803,10 +893,16 @@ public class HighGasOrder implements Serializable { sb.append(", channelOrderNo=").append(channelOrderNo); sb.append(", memId=").append(memId); sb.append(", memPhone=").append(memPhone); + sb.append(", companyId=").append(companyId); + sb.append(", companyName=").append(companyName); sb.append(", merId=").append(merId); sb.append(", merName=").append(merName); sb.append(", storeId=").append(storeId); sb.append(", storeName=").append(storeName); + sb.append(", deductionPrice=").append(deductionPrice); + sb.append(", payablePrice=").append(payablePrice); + sb.append(", payGold=").append(payGold); + sb.append(", payPrice=").append(payPrice); sb.append(", gasRefuelPrice=").append(gasRefuelPrice); sb.append(", gasOilNo=").append(gasOilNo); sb.append(", gasGunNo=").append(gasGunNo); @@ -834,11 +930,11 @@ public class HighGasOrder implements Serializable { sb.append(", gasAgentName=").append(gasAgentName); sb.append(", gasOrgId=").append(gasOrgId); sb.append(", gasOrgName=").append(gasOrgName); + sb.append(", payType=").append(payType); sb.append(", status=").append(status); sb.append(", createTime=").append(createTime); sb.append(", cancelTime=").append(cancelTime); sb.append(", payTime=").append(payTime); - sb.append(", finishTime=").append(finishTime); sb.append(", refundTime=").append(refundTime); sb.append(", refundRemarks=").append(refundRemarks); sb.append(", ext1=").append(ext1); diff --git a/hai-service/src/main/java/com/hai/entity/HighGasOrderExample.java b/hai-service/src/main/java/com/hai/entity/HighGasOrderExample.java index f9698624..53b7c9eb 100644 --- a/hai-service/src/main/java/com/hai/entity/HighGasOrderExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighGasOrderExample.java @@ -586,6 +586,136 @@ public class HighGasOrderExample { return (Criteria) this; } + public Criteria andCompanyIdIsNull() { + addCriterion("company_id is null"); + return (Criteria) this; + } + + public Criteria andCompanyIdIsNotNull() { + addCriterion("company_id is not null"); + return (Criteria) this; + } + + public Criteria andCompanyIdEqualTo(Long value) { + addCriterion("company_id =", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotEqualTo(Long value) { + addCriterion("company_id <>", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdGreaterThan(Long value) { + addCriterion("company_id >", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdGreaterThanOrEqualTo(Long value) { + addCriterion("company_id >=", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdLessThan(Long value) { + addCriterion("company_id <", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdLessThanOrEqualTo(Long value) { + addCriterion("company_id <=", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdIn(List values) { + addCriterion("company_id in", values, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotIn(List values) { + addCriterion("company_id not in", values, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdBetween(Long value1, Long value2) { + addCriterion("company_id between", value1, value2, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotBetween(Long value1, Long value2) { + addCriterion("company_id not between", value1, value2, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyNameIsNull() { + addCriterion("company_name is null"); + return (Criteria) this; + } + + public Criteria andCompanyNameIsNotNull() { + addCriterion("company_name is not null"); + return (Criteria) this; + } + + public Criteria andCompanyNameEqualTo(String value) { + addCriterion("company_name =", value, "companyName"); + return (Criteria) this; + } + + public Criteria andCompanyNameNotEqualTo(String value) { + addCriterion("company_name <>", value, "companyName"); + return (Criteria) this; + } + + public Criteria andCompanyNameGreaterThan(String value) { + addCriterion("company_name >", value, "companyName"); + return (Criteria) this; + } + + public Criteria andCompanyNameGreaterThanOrEqualTo(String value) { + addCriterion("company_name >=", value, "companyName"); + return (Criteria) this; + } + + public Criteria andCompanyNameLessThan(String value) { + addCriterion("company_name <", value, "companyName"); + return (Criteria) this; + } + + public Criteria andCompanyNameLessThanOrEqualTo(String value) { + addCriterion("company_name <=", value, "companyName"); + return (Criteria) this; + } + + public Criteria andCompanyNameLike(String value) { + addCriterion("company_name like", value, "companyName"); + return (Criteria) this; + } + + public Criteria andCompanyNameNotLike(String value) { + addCriterion("company_name not like", value, "companyName"); + return (Criteria) this; + } + + public Criteria andCompanyNameIn(List values) { + addCriterion("company_name in", values, "companyName"); + return (Criteria) this; + } + + public Criteria andCompanyNameNotIn(List values) { + addCriterion("company_name not in", values, "companyName"); + return (Criteria) this; + } + + public Criteria andCompanyNameBetween(String value1, String value2) { + addCriterion("company_name between", value1, value2, "companyName"); + return (Criteria) this; + } + + public Criteria andCompanyNameNotBetween(String value1, String value2) { + addCriterion("company_name not between", value1, value2, "companyName"); + return (Criteria) this; + } + public Criteria andMerIdIsNull() { addCriterion("mer_id is null"); return (Criteria) this; @@ -846,6 +976,246 @@ public class HighGasOrderExample { return (Criteria) this; } + public Criteria andDeductionPriceIsNull() { + addCriterion("deduction_price is null"); + return (Criteria) this; + } + + public Criteria andDeductionPriceIsNotNull() { + addCriterion("deduction_price is not null"); + return (Criteria) this; + } + + public Criteria andDeductionPriceEqualTo(BigDecimal value) { + addCriterion("deduction_price =", value, "deductionPrice"); + return (Criteria) this; + } + + public Criteria andDeductionPriceNotEqualTo(BigDecimal value) { + addCriterion("deduction_price <>", value, "deductionPrice"); + return (Criteria) this; + } + + public Criteria andDeductionPriceGreaterThan(BigDecimal value) { + addCriterion("deduction_price >", value, "deductionPrice"); + return (Criteria) this; + } + + public Criteria andDeductionPriceGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("deduction_price >=", value, "deductionPrice"); + return (Criteria) this; + } + + public Criteria andDeductionPriceLessThan(BigDecimal value) { + addCriterion("deduction_price <", value, "deductionPrice"); + return (Criteria) this; + } + + public Criteria andDeductionPriceLessThanOrEqualTo(BigDecimal value) { + addCriterion("deduction_price <=", value, "deductionPrice"); + return (Criteria) this; + } + + public Criteria andDeductionPriceIn(List values) { + addCriterion("deduction_price in", values, "deductionPrice"); + return (Criteria) this; + } + + public Criteria andDeductionPriceNotIn(List values) { + addCriterion("deduction_price not in", values, "deductionPrice"); + return (Criteria) this; + } + + public Criteria andDeductionPriceBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("deduction_price between", value1, value2, "deductionPrice"); + return (Criteria) this; + } + + public Criteria andDeductionPriceNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("deduction_price not between", value1, value2, "deductionPrice"); + return (Criteria) this; + } + + public Criteria andPayablePriceIsNull() { + addCriterion("payable_price is null"); + return (Criteria) this; + } + + public Criteria andPayablePriceIsNotNull() { + addCriterion("payable_price is not null"); + return (Criteria) this; + } + + public Criteria andPayablePriceEqualTo(BigDecimal value) { + addCriterion("payable_price =", value, "payablePrice"); + return (Criteria) this; + } + + public Criteria andPayablePriceNotEqualTo(BigDecimal value) { + addCriterion("payable_price <>", value, "payablePrice"); + return (Criteria) this; + } + + public Criteria andPayablePriceGreaterThan(BigDecimal value) { + addCriterion("payable_price >", value, "payablePrice"); + return (Criteria) this; + } + + public Criteria andPayablePriceGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("payable_price >=", value, "payablePrice"); + return (Criteria) this; + } + + public Criteria andPayablePriceLessThan(BigDecimal value) { + addCriterion("payable_price <", value, "payablePrice"); + return (Criteria) this; + } + + public Criteria andPayablePriceLessThanOrEqualTo(BigDecimal value) { + addCriterion("payable_price <=", value, "payablePrice"); + return (Criteria) this; + } + + public Criteria andPayablePriceIn(List values) { + addCriterion("payable_price in", values, "payablePrice"); + return (Criteria) this; + } + + public Criteria andPayablePriceNotIn(List values) { + addCriterion("payable_price not in", values, "payablePrice"); + return (Criteria) this; + } + + public Criteria andPayablePriceBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("payable_price between", value1, value2, "payablePrice"); + return (Criteria) this; + } + + public Criteria andPayablePriceNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("payable_price not between", value1, value2, "payablePrice"); + return (Criteria) this; + } + + public Criteria andPayGoldIsNull() { + addCriterion("pay_gold is null"); + return (Criteria) this; + } + + public Criteria andPayGoldIsNotNull() { + addCriterion("pay_gold is not null"); + return (Criteria) this; + } + + public Criteria andPayGoldEqualTo(Integer value) { + addCriterion("pay_gold =", value, "payGold"); + return (Criteria) this; + } + + public Criteria andPayGoldNotEqualTo(Integer value) { + addCriterion("pay_gold <>", value, "payGold"); + return (Criteria) this; + } + + public Criteria andPayGoldGreaterThan(Integer value) { + addCriterion("pay_gold >", value, "payGold"); + return (Criteria) this; + } + + public Criteria andPayGoldGreaterThanOrEqualTo(Integer value) { + addCriterion("pay_gold >=", value, "payGold"); + return (Criteria) this; + } + + public Criteria andPayGoldLessThan(Integer value) { + addCriterion("pay_gold <", value, "payGold"); + return (Criteria) this; + } + + public Criteria andPayGoldLessThanOrEqualTo(Integer value) { + addCriterion("pay_gold <=", value, "payGold"); + return (Criteria) this; + } + + public Criteria andPayGoldIn(List values) { + addCriterion("pay_gold in", values, "payGold"); + return (Criteria) this; + } + + public Criteria andPayGoldNotIn(List values) { + addCriterion("pay_gold not in", values, "payGold"); + return (Criteria) this; + } + + public Criteria andPayGoldBetween(Integer value1, Integer value2) { + addCriterion("pay_gold between", value1, value2, "payGold"); + return (Criteria) this; + } + + public Criteria andPayGoldNotBetween(Integer value1, Integer value2) { + addCriterion("pay_gold not between", value1, value2, "payGold"); + return (Criteria) this; + } + + public Criteria andPayPriceIsNull() { + addCriterion("pay_price is null"); + return (Criteria) this; + } + + public Criteria andPayPriceIsNotNull() { + addCriterion("pay_price is not null"); + return (Criteria) this; + } + + public Criteria andPayPriceEqualTo(BigDecimal value) { + addCriterion("pay_price =", value, "payPrice"); + return (Criteria) this; + } + + public Criteria andPayPriceNotEqualTo(BigDecimal value) { + addCriterion("pay_price <>", value, "payPrice"); + return (Criteria) this; + } + + public Criteria andPayPriceGreaterThan(BigDecimal value) { + addCriterion("pay_price >", value, "payPrice"); + return (Criteria) this; + } + + public Criteria andPayPriceGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("pay_price >=", value, "payPrice"); + return (Criteria) this; + } + + public Criteria andPayPriceLessThan(BigDecimal value) { + addCriterion("pay_price <", value, "payPrice"); + return (Criteria) this; + } + + public Criteria andPayPriceLessThanOrEqualTo(BigDecimal value) { + addCriterion("pay_price <=", value, "payPrice"); + return (Criteria) this; + } + + public Criteria andPayPriceIn(List values) { + addCriterion("pay_price in", values, "payPrice"); + return (Criteria) this; + } + + public Criteria andPayPriceNotIn(List values) { + addCriterion("pay_price not in", values, "payPrice"); + return (Criteria) this; + } + + public Criteria andPayPriceBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("pay_price between", value1, value2, "payPrice"); + return (Criteria) this; + } + + public Criteria andPayPriceNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("pay_price not between", value1, value2, "payPrice"); + return (Criteria) this; + } + public Criteria andGasRefuelPriceIsNull() { addCriterion("gas_refuel_price is null"); return (Criteria) this; @@ -2536,6 +2906,66 @@ public class HighGasOrderExample { return (Criteria) this; } + public Criteria andPayTypeIsNull() { + addCriterion("pay_type is null"); + return (Criteria) this; + } + + public Criteria andPayTypeIsNotNull() { + addCriterion("pay_type is not null"); + return (Criteria) this; + } + + public Criteria andPayTypeEqualTo(Integer value) { + addCriterion("pay_type =", value, "payType"); + return (Criteria) this; + } + + public Criteria andPayTypeNotEqualTo(Integer value) { + addCriterion("pay_type <>", value, "payType"); + return (Criteria) this; + } + + public Criteria andPayTypeGreaterThan(Integer value) { + addCriterion("pay_type >", value, "payType"); + return (Criteria) this; + } + + public Criteria andPayTypeGreaterThanOrEqualTo(Integer value) { + addCriterion("pay_type >=", value, "payType"); + return (Criteria) this; + } + + public Criteria andPayTypeLessThan(Integer value) { + addCriterion("pay_type <", value, "payType"); + return (Criteria) this; + } + + public Criteria andPayTypeLessThanOrEqualTo(Integer value) { + addCriterion("pay_type <=", value, "payType"); + return (Criteria) this; + } + + public Criteria andPayTypeIn(List values) { + addCriterion("pay_type in", values, "payType"); + return (Criteria) this; + } + + public Criteria andPayTypeNotIn(List values) { + addCriterion("pay_type not in", values, "payType"); + return (Criteria) this; + } + + public Criteria andPayTypeBetween(Integer value1, Integer value2) { + addCriterion("pay_type between", value1, value2, "payType"); + return (Criteria) this; + } + + public Criteria andPayTypeNotBetween(Integer value1, Integer value2) { + addCriterion("pay_type not between", value1, value2, "payType"); + return (Criteria) this; + } + public Criteria andStatusIsNull() { addCriterion("`status` is null"); return (Criteria) this; @@ -2776,66 +3206,6 @@ public class HighGasOrderExample { return (Criteria) this; } - public Criteria andFinishTimeIsNull() { - addCriterion("finish_time is null"); - return (Criteria) this; - } - - public Criteria andFinishTimeIsNotNull() { - addCriterion("finish_time is not null"); - return (Criteria) this; - } - - public Criteria andFinishTimeEqualTo(Date value) { - addCriterion("finish_time =", value, "finishTime"); - return (Criteria) this; - } - - public Criteria andFinishTimeNotEqualTo(Date value) { - addCriterion("finish_time <>", value, "finishTime"); - return (Criteria) this; - } - - public Criteria andFinishTimeGreaterThan(Date value) { - addCriterion("finish_time >", value, "finishTime"); - return (Criteria) this; - } - - public Criteria andFinishTimeGreaterThanOrEqualTo(Date value) { - addCriterion("finish_time >=", value, "finishTime"); - return (Criteria) this; - } - - public Criteria andFinishTimeLessThan(Date value) { - addCriterion("finish_time <", value, "finishTime"); - return (Criteria) this; - } - - public Criteria andFinishTimeLessThanOrEqualTo(Date value) { - addCriterion("finish_time <=", value, "finishTime"); - return (Criteria) this; - } - - public Criteria andFinishTimeIn(List values) { - addCriterion("finish_time in", values, "finishTime"); - return (Criteria) this; - } - - public Criteria andFinishTimeNotIn(List values) { - addCriterion("finish_time not in", values, "finishTime"); - return (Criteria) this; - } - - public Criteria andFinishTimeBetween(Date value1, Date value2) { - addCriterion("finish_time between", value1, value2, "finishTime"); - return (Criteria) this; - } - - public Criteria andFinishTimeNotBetween(Date value1, Date value2) { - addCriterion("finish_time not between", value1, value2, "finishTime"); - return (Criteria) this; - } - public Criteria andRefundTimeIsNull() { addCriterion("refund_time is null"); return (Criteria) this; diff --git a/hai-service/src/main/java/com/hai/entity/HighUserCoupon.java b/hai-service/src/main/java/com/hai/entity/HighUserCoupon.java index ea9f327e..e26fa6c3 100644 --- a/hai-service/src/main/java/com/hai/entity/HighUserCoupon.java +++ b/hai-service/src/main/java/com/hai/entity/HighUserCoupon.java @@ -35,6 +35,16 @@ public class HighUserCoupon implements Serializable { */ private Long userId; + /** + * 交易id + */ + private Long orderId; + + /** + * 子订单id + */ + private Long childOrderId; + /** * 卡卷销售码id */ @@ -132,6 +142,22 @@ public class HighUserCoupon implements Serializable { this.userId = userId; } + public Long getOrderId() { + return orderId; + } + + public void setOrderId(Long orderId) { + this.orderId = orderId; + } + + public Long getChildOrderId() { + return childOrderId; + } + + public void setChildOrderId(Long childOrderId) { + this.childOrderId = childOrderId; + } + public Long getCouponCodeId() { return couponCodeId; } @@ -252,6 +278,8 @@ public class HighUserCoupon implements Serializable { && (this.getMerchantId() == null ? other.getMerchantId() == null : this.getMerchantId().equals(other.getMerchantId())) && (this.getCouponId() == null ? other.getCouponId() == null : this.getCouponId().equals(other.getCouponId())) && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) + && (this.getOrderId() == null ? other.getOrderId() == null : this.getOrderId().equals(other.getOrderId())) + && (this.getChildOrderId() == null ? other.getChildOrderId() == null : this.getChildOrderId().equals(other.getChildOrderId())) && (this.getCouponCodeId() == null ? other.getCouponCodeId() == null : this.getCouponCodeId().equals(other.getCouponCodeId())) && (this.getStoreId() == null ? other.getStoreId() == null : this.getStoreId().equals(other.getStoreId())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) @@ -275,6 +303,8 @@ public class HighUserCoupon implements Serializable { result = prime * result + ((getMerchantId() == null) ? 0 : getMerchantId().hashCode()); result = prime * result + ((getCouponId() == null) ? 0 : getCouponId().hashCode()); result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode()); + result = prime * result + ((getOrderId() == null) ? 0 : getOrderId().hashCode()); + result = prime * result + ((getChildOrderId() == null) ? 0 : getChildOrderId().hashCode()); result = prime * result + ((getCouponCodeId() == null) ? 0 : getCouponCodeId().hashCode()); result = prime * result + ((getStoreId() == null) ? 0 : getStoreId().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); @@ -301,6 +331,8 @@ public class HighUserCoupon implements Serializable { sb.append(", merchantId=").append(merchantId); sb.append(", couponId=").append(couponId); sb.append(", userId=").append(userId); + sb.append(", orderId=").append(orderId); + sb.append(", childOrderId=").append(childOrderId); sb.append(", couponCodeId=").append(couponCodeId); sb.append(", storeId=").append(storeId); sb.append(", createTime=").append(createTime); diff --git a/hai-service/src/main/java/com/hai/entity/HighUserCouponExample.java b/hai-service/src/main/java/com/hai/entity/HighUserCouponExample.java index cbc2bfef..7ed05d6c 100644 --- a/hai-service/src/main/java/com/hai/entity/HighUserCouponExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighUserCouponExample.java @@ -365,6 +365,126 @@ public class HighUserCouponExample { return (Criteria) this; } + public Criteria andOrderIdIsNull() { + addCriterion("order_id is null"); + return (Criteria) this; + } + + public Criteria andOrderIdIsNotNull() { + addCriterion("order_id is not null"); + return (Criteria) this; + } + + public Criteria andOrderIdEqualTo(Long value) { + addCriterion("order_id =", value, "orderId"); + return (Criteria) this; + } + + public Criteria andOrderIdNotEqualTo(Long value) { + addCriterion("order_id <>", value, "orderId"); + return (Criteria) this; + } + + public Criteria andOrderIdGreaterThan(Long value) { + addCriterion("order_id >", value, "orderId"); + return (Criteria) this; + } + + public Criteria andOrderIdGreaterThanOrEqualTo(Long value) { + addCriterion("order_id >=", value, "orderId"); + return (Criteria) this; + } + + public Criteria andOrderIdLessThan(Long value) { + addCriterion("order_id <", value, "orderId"); + return (Criteria) this; + } + + public Criteria andOrderIdLessThanOrEqualTo(Long value) { + addCriterion("order_id <=", value, "orderId"); + return (Criteria) this; + } + + public Criteria andOrderIdIn(List values) { + addCriterion("order_id in", values, "orderId"); + return (Criteria) this; + } + + public Criteria andOrderIdNotIn(List values) { + addCriterion("order_id not in", values, "orderId"); + return (Criteria) this; + } + + public Criteria andOrderIdBetween(Long value1, Long value2) { + addCriterion("order_id between", value1, value2, "orderId"); + return (Criteria) this; + } + + public Criteria andOrderIdNotBetween(Long value1, Long value2) { + addCriterion("order_id not between", value1, value2, "orderId"); + return (Criteria) this; + } + + public Criteria andChildOrderIdIsNull() { + addCriterion("child_order_id is null"); + return (Criteria) this; + } + + public Criteria andChildOrderIdIsNotNull() { + addCriterion("child_order_id is not null"); + return (Criteria) this; + } + + public Criteria andChildOrderIdEqualTo(Long value) { + addCriterion("child_order_id =", value, "childOrderId"); + return (Criteria) this; + } + + public Criteria andChildOrderIdNotEqualTo(Long value) { + addCriterion("child_order_id <>", value, "childOrderId"); + return (Criteria) this; + } + + public Criteria andChildOrderIdGreaterThan(Long value) { + addCriterion("child_order_id >", value, "childOrderId"); + return (Criteria) this; + } + + public Criteria andChildOrderIdGreaterThanOrEqualTo(Long value) { + addCriterion("child_order_id >=", value, "childOrderId"); + return (Criteria) this; + } + + public Criteria andChildOrderIdLessThan(Long value) { + addCriterion("child_order_id <", value, "childOrderId"); + return (Criteria) this; + } + + public Criteria andChildOrderIdLessThanOrEqualTo(Long value) { + addCriterion("child_order_id <=", value, "childOrderId"); + return (Criteria) this; + } + + public Criteria andChildOrderIdIn(List values) { + addCriterion("child_order_id in", values, "childOrderId"); + return (Criteria) this; + } + + public Criteria andChildOrderIdNotIn(List values) { + addCriterion("child_order_id not in", values, "childOrderId"); + return (Criteria) this; + } + + public Criteria andChildOrderIdBetween(Long value1, Long value2) { + addCriterion("child_order_id between", value1, value2, "childOrderId"); + return (Criteria) this; + } + + public Criteria andChildOrderIdNotBetween(Long value1, Long value2) { + addCriterion("child_order_id not between", value1, value2, "childOrderId"); + return (Criteria) this; + } + public Criteria andCouponCodeIdIsNull() { addCriterion("coupon_code_id is null"); return (Criteria) this; diff --git a/hai-service/src/main/java/com/hai/enum_type/OrderPushType.java b/hai-service/src/main/java/com/hai/enum_type/OrderPushType.java index ae592c48..f98c3cdb 100644 --- a/hai-service/src/main/java/com/hai/enum_type/OrderPushType.java +++ b/hai-service/src/main/java/com/hai/enum_type/OrderPushType.java @@ -16,6 +16,7 @@ public enum OrderPushType { type7(7 , "汇联通会员充值订单"), type8(8 , "星巴克订单"), type9(9 , "会员充值订单"), + type10(10 , "重庆中石油"), ; private Integer type; diff --git a/hai-service/src/main/java/com/hai/enum_type/UserRoleTypeEnum.java b/hai-service/src/main/java/com/hai/enum_type/UserRoleTypeEnum.java new file mode 100644 index 00000000..df831fd0 --- /dev/null +++ b/hai-service/src/main/java/com/hai/enum_type/UserRoleTypeEnum.java @@ -0,0 +1,46 @@ +package com.hai.enum_type; + +/** + * @className: UserRoelTypeEnum + * @author: HuRui + * @date: 2022/9/21 + **/ +public enum UserRoleTypeEnum { + type0(0, "超级管理员"), + type1(1, "运营中心"), + type2(2, "商户角色"), + type3(3, "门店角色"), + type4(4, "代理商角色"), + type5(5, "分公司角色"), + type6(6, "充值后台人员"), + type7(7, "渠道公司角色"), + type8(8, "团油代理商"), + type9(9, "团油业务员"), + type10(10, "加油站员工"), + ; + + private Integer type; + + private String name; + + UserRoleTypeEnum(Integer type,String name) { + this.type = type; + this.name = name; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/hai-service/src/main/java/com/hai/order/model/ExportGasOrderModel.java b/hai-service/src/main/java/com/hai/order/model/ExportGasOrderModel.java new file mode 100644 index 00000000..64321e9b --- /dev/null +++ b/hai-service/src/main/java/com/hai/order/model/ExportGasOrderModel.java @@ -0,0 +1,127 @@ +package com.hai.order.model; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 导出油站订单模型 + * @className: ExportGasOrderModel + * @author: HuRui + * @date: 2022/9/20 + **/ +@Data +public class ExportGasOrderModel { + + @ColumnWidth(25) + @ExcelProperty("交易订单号") + private String orderNo; + + @ColumnWidth(25) + @ExcelProperty("加油站") + private String storeName; + + @ColumnWidth(15) + @ExcelProperty("加油员") + private String gasStaffName; + + @ColumnWidth(15) + @ExcelProperty("客户手机号") + private String memPhone; + + @ColumnWidth(15) + @ExcelProperty({ "加油信息", "加油金额"}) + private BigDecimal gasRefuelPrice; + + @ColumnWidth(15) + @ExcelProperty({ "加油信息", "加油升数"}) + private BigDecimal gasOilLiters; + + @ColumnWidth(10) + @ExcelProperty({ "加油信息", "油号"}) + private String gasOilNo; + + @ColumnWidth(10) + @ExcelProperty({ "加油信息", "油枪号"}) + private String gasGunNo; + + @ColumnWidth(10) + @ExcelProperty({ "加油信息", "平台折扣"}) + private String gasDiscount; + + @ColumnWidth(10) + @ExcelProperty({ "加油信息", "平台补贴"}) + private BigDecimal gasOilSubsidy; + + @ColumnWidth(10) + @ExcelProperty({ "加油信息", "平台价"}) + private BigDecimal gasPricePlatform; + + @ColumnWidth(10) + @ExcelProperty({ "加油信息", "油站价"}) + private BigDecimal gasPriceGun; + + @ColumnWidth(10) + @ExcelProperty({ "加油信息", "国标价"}) + private BigDecimal gasPriceOfficial; + + @ColumnWidth(15) + @ExcelProperty({ "支付信息", "加油优惠"}) + private BigDecimal deductionPrice; + + @ColumnWidth(15) + @ExcelProperty({ "支付信息", "应付金额"}) + private BigDecimal payablePrice; + + @ColumnWidth(15) + @ExcelProperty({ "支付信息", "积分抵扣"}) + private Integer payGold; + + @ColumnWidth(15) + @ExcelProperty({ "支付信息", "实付金额"}) + private String payPrice; + + @ColumnWidth(15) + @ExcelProperty("交易状态") + private String status; + + @ColumnWidth(22) + @ExcelProperty("创建时间") + private Date createTime; + + @ColumnWidth(22) + @ExcelProperty("支付时间") + private Date payTime; + + @ColumnWidth(22) + @ExcelProperty("退款时间") + private Date refundTime; + + @ColumnWidth(22) + @ExcelProperty("取消时间") + private Date cancelTime; + + @ColumnWidth(20) + @ExcelProperty("分公司") + private String companyName; + + @ColumnWidth(20) + @ExcelProperty("商户") + private String merName; + + @ColumnWidth(20) + @ExcelProperty("业务员") + private String gasSalesmanName; + + @ColumnWidth(20) + @ExcelProperty("代理商") + private String gasAgentName; + + @ColumnWidth(20) + @ExcelProperty("代理公司") + private String gasOrgName; + +} diff --git a/hai-service/src/main/java/com/hai/order/model/OrderCouponModal.java b/hai-service/src/main/java/com/hai/order/model/OrderCouponModal.java deleted file mode 100644 index 0d28ae19..00000000 --- a/hai-service/src/main/java/com/hai/order/model/OrderCouponModal.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.hai.order.model; - -import lombok.Data; - -import java.math.BigDecimal; -import java.util.Date; - -/** - * 卡券订单模型 - * @className: OrderCouponModal - * @author: HuRui - * @date: 2022/9/14 - **/ -@Data -public class OrderCouponModal { - - // 交易订单id - private Long orderId; - - // 交易订单号 - private String orderNo; - - // 第三方交易流水号 - private String paySerialNo; - - // 子订单id - private Long childOrderId; - - // 子订单号 - private String childOrderNo; - - // 用户手机号 - private String memPhone; - - // 积分抵扣 - private Integer integralDeduct; - - // 支付方式 - private Integer payType; - - // 产品id - private Long goodsId; - - // 产品名称 - private String goodsName; - - // 产品价格 - private BigDecimal goodsPrice; - - // 产品实际价格 - private BigDecimal goodsActualPrice; - - // 子订单状态 - private Integer childOrderStatus; - - // 创建时间 - private Date createTime; - - // 支付时间 - private Date payTime; - - // 完成时间 - private Date finishTime; - - // 取消时间 - private Date cancelTime; - - // 退款时间 - private Date refundTime; - - -} diff --git a/hai-service/src/main/java/com/hai/order/model/OrderCouponModel.java b/hai-service/src/main/java/com/hai/order/model/OrderCouponModel.java new file mode 100644 index 00000000..49088478 --- /dev/null +++ b/hai-service/src/main/java/com/hai/order/model/OrderCouponModel.java @@ -0,0 +1,62 @@ +package com.hai.order.model; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 卡券订单模型 + * @className: OrderCouponModel + * @author: HuRui + * @date: 2022/9/30 + **/ +@Data +public class OrderCouponModel { + + @ExcelProperty(value = "交易订单号") + private String orderNo; + + @ExcelProperty(value = "客户电话") + private String memPhone; + + @ExcelProperty(value = "卡券名称") + private String couponName; + + @ExcelProperty(value = "卡券面值") + private String couponPrice; + + @ExcelProperty(value = "总价格") + private BigDecimal totalPrice; + + @ExcelProperty(value = "优惠价格") + private BigDecimal deductionPrice; + + @ExcelProperty(value = "应付金额") + private BigDecimal payablePrice; + + @ExcelProperty(value = "积分抵扣") + private Long payGold; + + @ExcelProperty(value = "实付金额") + private BigDecimal payPrice; + + @ExcelProperty(value = "支付方式") + private String payType; + + @ExcelProperty(value = "支付卡号") + private String memCardNo; + + @ExcelProperty(value = "订单状态") + private String orderStatus; + + @ExcelProperty(value = "创建时间") + private Date createTime; + + @ExcelProperty(value = "支付时间") + private Date payTime; + + @ExcelProperty(value = "完成时间") + private Date finishTime; +} diff --git a/hai-service/src/main/java/com/hai/order/service/OrderCreateHandleService.java b/hai-service/src/main/java/com/hai/order/service/OrderCreateHandleService.java index 38ce4ee2..c44110ce 100644 --- a/hai-service/src/main/java/com/hai/order/service/OrderCreateHandleService.java +++ b/hai-service/src/main/java/com/hai/order/service/OrderCreateHandleService.java @@ -6,6 +6,7 @@ import com.hai.entity.HighOrder; import com.hai.model.ResponseData; import com.hai.order.model.CreateOrderCheckReturnData; import com.hai.order.model.CreateOrderChildModel; +import com.hai.order.model.CreateOrderModel; import java.util.List; @@ -38,7 +39,7 @@ public interface OrderCreateHandleService { * @param createOrderChild 子订单参数 * @return */ - HighChildOrder oilHandle(HighOrder order,HighDiscountUserRel discountUserRel, CreateOrderChildModel createOrderChild) throws Exception; + HighChildOrder oilHandle(HighOrder order, HighDiscountUserRel discountUserRel, CreateOrderModel createOrderModel,CreateOrderChildModel createOrderChild) throws Exception; /** * 优惠券包校验 diff --git a/hai-service/src/main/java/com/hai/order/service/OrderRefundHandleService.java b/hai-service/src/main/java/com/hai/order/service/OrderRefundHandleService.java new file mode 100644 index 00000000..262a751c --- /dev/null +++ b/hai-service/src/main/java/com/hai/order/service/OrderRefundHandleService.java @@ -0,0 +1,27 @@ +package com.hai.order.service; + +import com.hai.entity.HighChildOrder; + +/** + * 退款订单-业务处理 + * @className: CreateOrderCheckService + * @author: HuRui + * @date: 2022/8/25 + **/ +public interface OrderRefundHandleService { + + /** + * 卡券业务 + * @param childOrder 子订单 + * @return + * @throws Exception + */ + void couponHandle(HighChildOrder childOrder) ; + + /** + * 加油业务 + * @param childOrder + */ + void oilHandle(HighChildOrder childOrder) ; + +} diff --git a/hai-service/src/main/java/com/hai/order/service/OrderService.java b/hai-service/src/main/java/com/hai/order/service/OrderService.java index de180b51..33c15897 100644 --- a/hai-service/src/main/java/com/hai/order/service/OrderService.java +++ b/hai-service/src/main/java/com/hai/order/service/OrderService.java @@ -1,5 +1,6 @@ package com.hai.order.service; +import com.alicp.jetcache.anno.CacheUpdate; import com.hai.entity.HighChildOrder; import com.hai.entity.HighOrder; import com.hai.order.model.CreateOrderModel; diff --git a/hai-service/src/main/java/com/hai/order/service/OrderServiceExt.java b/hai-service/src/main/java/com/hai/order/service/OrderServiceExt.java index ee7fddec..3471b344 100644 --- a/hai-service/src/main/java/com/hai/order/service/OrderServiceExt.java +++ b/hai-service/src/main/java/com/hai/order/service/OrderServiceExt.java @@ -1,9 +1,7 @@ package com.hai.order.service; -import com.hai.entity.HighGasOrder; -import com.hai.model.OrderCountModel; -import com.hai.order.model.OrderCouponModal; -import org.apache.ibatis.annotations.Param; + +import com.hai.order.model.OrderCouponModel; import java.util.List; import java.util.Map; @@ -25,10 +23,10 @@ public interface OrderServiceExt { int userBuyCouponNum(Long userId,Long couponId); /** - * 查询卡券订单列表 + * 查询卡券订单 * @param param * @return */ - List getOrderCouponList(Map param); + List getOrderCouponList(Map param) throws Exception; } diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderCancelHandleServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderCancelHandleServiceImpl.java index b2d58a8b..eb01fcde 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderCancelHandleServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderCancelHandleServiceImpl.java @@ -5,6 +5,7 @@ import com.hai.entity.HighCouponCode; import com.hai.entity.HighGasOrder; import com.hai.order.service.OrderCancelHandleService; import com.hai.order.type.OrderChildStatus; +import com.hai.order.type.OrderOilStatus; import com.hai.service.HighCouponCodeService; import com.hai.service.HighGasOrderService; import org.springframework.stereotype.Service; @@ -43,7 +44,7 @@ public class OrderCancelHandleServiceImpl implements OrderCancelHandleService { HighGasOrder gasOrder = gasOrderService.getDetailByChildOrderNo(childOrder.getChildOrderNo()); if (gasOrder != null) { gasOrder.setCancelTime(new Date()); - gasOrder.setStatus(OrderChildStatus.STATUS5.getNumber()); + gasOrder.setStatus(OrderOilStatus.STATUS3.getNumber()); gasOrderService.updateGasOrder(gasOrder); } } diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java index 1e18a234..5906878a 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java @@ -19,11 +19,13 @@ import com.hai.model.GasPayPriceModel; import com.hai.model.HighMerchantModel; import com.hai.model.ResponseData; import com.hai.order.model.CreateOrderChildModel; +import com.hai.order.model.CreateOrderModel; import com.hai.order.service.OrderCreateHandleService; import com.hai.order.service.OrderService; import com.hai.order.service.OrderServiceExt; import com.hai.order.type.OrderChildGoodsType; import com.hai.order.type.OrderChildStatus; +import com.hai.order.type.OrderOilStatus; import com.hai.order.utils.OrderUtil; import com.hai.service.*; import org.apache.commons.lang3.StringUtils; @@ -51,6 +53,9 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { @Resource private CommonService commonService; + @Resource + private BsCompanyService companyService; + @Resource private OrderService orderService; @@ -255,7 +260,7 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { } @Override - public HighChildOrder oilHandle(HighOrder order,HighDiscountUserRel discountUserRel, CreateOrderChildModel createOrderChild) throws Exception { + public HighChildOrder oilHandle(HighOrder order, HighDiscountUserRel discountUserRel, CreateOrderModel createOrderModel, CreateOrderChildModel createOrderChild) throws Exception { // 查询油品类型 SecDictionary gasOilType = commonService.mappingSysCode("GAS_OIL_TYPE", createOrderChild.getGasOilNo()); if (gasOilType == null) { @@ -283,6 +288,11 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { if (merchant == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的油站"); } + // 查询分公司 + BsCompany company = companyService.getCompanyById(merchant.getCompanyId()); + if (company == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的分公司"); + } // 营销减免的金额 BigDecimal marketingPrice = merchantAccountMarketingService.getPrice(store.getMerchantId(), MerAccountMarketingType.type3.getType(), Integer.valueOf(createOrderChild.getGasOilNo())); @@ -317,6 +327,8 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { gasOrder.setChannelType(store.getSourceType()); gasOrder.setOrderNo(order.getOrderNo()); gasOrder.setChildOrderNo(childOrder.getChildOrderNo()); + gasOrder.setCompanyId(company.getId()); + gasOrder.setCompanyName(company.getName()); gasOrder.setMemId(childOrder.getMemId()); gasOrder.setMemPhone(childOrder.getMemPhone()); gasOrder.setMerId(store.getMerchantId()); @@ -327,7 +339,8 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { gasOrder.setGasOilNo(createOrderChild.getGasOilNo()); gasOrder.setGasGunNo(createOrderChild.getGasGunNo()); gasOrder.setGasOilType(Integer.parseInt(gasOilType.getExt1())); - gasOrder.setStatus(OrderChildStatus.STATUS1.getNumber()); + gasOrder.setStatus(OrderOilStatus.STATUS1.getNumber()); + gasOrder.setGasDiscount(new BigDecimal("0")); // 成本价 油站价 减 营销策略价 gasOrder.setGasPriceCost(priceModel.getPriceGun().subtract(marketingPrice)); @@ -337,10 +350,35 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { gasOrder.setGasPriceCostTotal(gasOrder.getGasRefuelPrice().multiply(gasOrder.getGasOilLiters()).setScale(2, BigDecimal.ROUND_HALF_DOWN)); } - // 使用了优惠价 + // 使用了优惠券 if (discountUserRel != null) { // 支付价格 childOrder.setGoodsActualPrice(childOrder.getGoodsPrice()); + + // 优惠券类型 1:满减 2:抵扣 3:折扣 + if (discountUserRel.getHighDiscount().getDiscountType() == 1) { + // 如果订单总额 小于 满减价格 + if (gasOrder.getGasRefuelPrice().compareTo(discountUserRel.getHighDiscount().getDiscountCondition()) > 1) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_MEMBER_ERROR, "订单未达到"+discountUserRel.getHighDiscount().getDiscountCondition()+"元,无法使用此优惠券"); + } + gasOrder.setDeductionPrice(discountUserRel.getHighDiscount().getDiscountPrice()); + } + else if (discountUserRel.getHighDiscount().getDiscountType() == 2) { + gasOrder.setDeductionPrice(discountUserRel.getHighDiscount().getDiscountPrice()); + } + else if (discountUserRel.getHighDiscount().getDiscountType() == 3) { + // 加油金额 * 折扣 + BigDecimal deductionPrice = gasOrder.getGasRefuelPrice() + .multiply(discountUserRel.getHighDiscount().getDiscountPrice()) + .setScale(2, BigDecimal.ROUND_HALF_DOWN); + gasOrder.setDeductionPrice(gasOrder.getGasRefuelPrice().subtract(deductionPrice)); + } + + gasOrder.setPayablePrice(gasOrder.getGasRefuelPrice().subtract(gasOrder.getDeductionPrice())); + if (gasOrder.getPayablePrice().compareTo(new BigDecimal("0")) < 0) { + gasOrder.setPayablePrice(new BigDecimal("0")); + } + // 油价信息 gasOrder.setGasPriceGun(priceModel.getPriceGun()); gasOrder.setGasPriceVip(priceModel.getPriceGun()); @@ -351,9 +389,13 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { gasOrder.setGasOilSubsidy(new BigDecimal("0")); gasOrder.setGasLitersPreferences(new BigDecimal("0")); gasOrder.setGasPricePreferences(priceModel.getPriceGun()); - } else { + } + else { // 支付价格 childOrder.setGoodsActualPrice(priceModel.getPayPrice()); + gasOrder.setDeductionPrice(priceModel.getTotalPreferences()); + gasOrder.setPayablePrice(priceModel.getPayPrice()); + // 油价信息 gasOrder.setGasPriceGun(priceModel.getPriceGun()); gasOrder.setGasPriceVip(priceModel.getPriceVip()); @@ -366,6 +408,8 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { gasOrder.setGasPricePreferences(priceModel.getPricePreferences()); } + gasOrder.setPayGold(createOrderModel.getPayGold()!=null?createOrderModel.getPayGold():0); + if (store.getSourceType().equals(MerchantStoreSourceType.type4.getNumber())) { // 查询金猪油品数据 JinZhuJiaYouOilNo jzOilNo = JinZhuJiaYouOilNo.getDataByOilNo(Integer.valueOf(gasOrder.getGasOilNo())); diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java index d1e87b31..2ec159a5 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java @@ -14,10 +14,7 @@ import com.hai.msg.entity.MsgTopic; import com.hai.order.service.OrderPaySuccessService; import com.hai.order.service.OrderService; import com.hai.order.topic.OrderTopic; -import com.hai.order.type.OrderChildGoodsType; -import com.hai.order.type.OrderChildStatus; -import com.hai.order.type.OrderPayType; -import com.hai.order.type.OrderStatus; +import com.hai.order.type.*; import com.hai.service.*; import org.apache.rocketmq.client.producer.SendCallback; import org.apache.rocketmq.client.producer.SendResult; @@ -140,7 +137,10 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { integralHandle(order,childOrder); } else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE3.getNumber())) { + order.setOrderStatus(OrderStatus.STATUS3.getNumber()); + order.setFinishTime(new Date()); oilHandle(order,childOrder); + orderService.updateOrderData(order); } else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE4.getNumber())) { @@ -217,7 +217,9 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { HighGasOrder gasOrder = gasOrderService.getDetailByChildOrderNo(childOrder.getChildOrderNo()); if (gasOrder != null) { gasOrder.setPayTime(new Date()); - gasOrder.setStatus(OrderChildStatus.STATUS2.getNumber()); + gasOrder.setStatus(OrderOilStatus.STATUS2.getNumber()); + gasOrder.setPayType(order.getPayType()); + gasOrder.setPayPrice(order.getPayPrice()); gasOrderService.updateGasOrder(gasOrder); // 查询油站 diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderRefundHandleServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderRefundHandleServiceImpl.java new file mode 100644 index 00000000..d8475c51 --- /dev/null +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderRefundHandleServiceImpl.java @@ -0,0 +1,46 @@ +package com.hai.order.service.impl; + +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; +import com.hai.entity.HighChildOrder; +import com.hai.entity.HighGasOrder; +import com.hai.order.service.OrderRefundHandleService; +import com.hai.order.type.OrderOilStatus; +import com.hai.service.HighGasOrderService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Date; + +/** + * @className: OrderRefundHandleServiceImpl + * @author: HuRui + * @date: 2022/9/23 + **/ +@Service("orderRefundHandleService") +public class OrderRefundHandleServiceImpl implements OrderRefundHandleService { + + @Resource + private HighGasOrderService gasOrderService; + + @Override + public void couponHandle(HighChildOrder childOrder) { + + } + + @Override + public void oilHandle(HighChildOrder childOrder) { + // 查询加油订单 + HighGasOrder gasOrder = gasOrderService.getDetailByChildOrderNo(childOrder.getChildOrderNo()); + if (gasOrder == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到加油订单"); + } + if (!gasOrder.getStatus().equals(OrderOilStatus.STATUS2.getNumber())) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "加油订单不处于已支付状态"); + } + gasOrder.setRefundTime(childOrder.getRefundTime()); + gasOrder.setStatus(OrderOilStatus.STATUS4.getNumber()); + gasOrderService.updateGasOrder(gasOrder); + } +} diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderRefundServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderRefundServiceImpl.java index c7875b47..238d0958 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderRefundServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderRefundServiceImpl.java @@ -60,8 +60,8 @@ public class OrderRefundServiceImpl implements OrderRefundService { @Override public HighOrderRefund createOrderChildRefund(HighChildOrder orderChild,String refundNo,Integer refundGoodsCount, String remarks) throws Exception { - if (orderChild.getChildOrderStatus().equals(OrderChildStatus.STATUS2.getNumber()) - || orderChild.getChildOrderStatus().equals(OrderChildStatus.STATUS3.getNumber())){ + if (!orderChild.getChildOrderStatus().equals(OrderChildStatus.STATUS2.getNumber()) + && !orderChild.getChildOrderStatus().equals(OrderChildStatus.STATUS3.getNumber())){ throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "子订单状态错误"); } if (orderChild.getSurplusRefundIntegral() <= 0 diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceExtImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceExtImpl.java index a19c2aaf..8f08ca01 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceExtImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceExtImpl.java @@ -1,13 +1,14 @@ package com.hai.order.service.impl; +import com.hai.common.utils.DateUtil; import com.hai.dao.order.OrderMapperExt; -import com.hai.entity.HighGasOrder; -import com.hai.order.model.OrderCouponModal; +import com.hai.order.model.OrderCouponModel; import com.hai.order.service.OrderServiceExt; -import com.hai.service.HighGasOrderService; +import org.apache.commons.collections4.MapUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.Date; import java.util.List; import java.util.Map; @@ -28,8 +29,32 @@ public class OrderServiceExtImpl implements OrderServiceExt { } @Override - public List getOrderCouponList(Map param) { - return orderMapperExt.queryOrderCouponList(param); + public List getOrderCouponList(Map param) throws Exception { + + if (MapUtils.getLong(param, "createTimeS") != null) { + param.put("createTimeS", DateUtil.date2String(new Date(MapUtils.getLong(param, "createTimeS")), DateUtil.Y_M_D_HMS)); + } + + if (MapUtils.getLong(param, "createTimeE") != null) { + param.put("createTimeE", DateUtil.date2String(new Date(MapUtils.getLong(param, "createTimeE")), DateUtil.Y_M_D_HMS)); + } + + if (MapUtils.getLong(param, "payTimeS") != null) { + param.put("payTimeS", DateUtil.date2String(new Date(MapUtils.getLong(param, "payTimeS")), DateUtil.Y_M_D_HMS)); + } + + if (MapUtils.getLong(param, "payTimeE") != null) { + param.put("payTimeE", DateUtil.date2String(new Date(MapUtils.getLong(param, "payTimeE")), DateUtil.Y_M_D_HMS)); + } + + if (MapUtils.getLong(param, "finishTimeS") != null) { + param.put("finishTimeS", DateUtil.date2String(new Date(MapUtils.getLong(param, "finishTimeS")), DateUtil.Y_M_D_HMS)); + } + + if (MapUtils.getLong(param, "finishTimeE") != null) { + param.put("finishTimeE", DateUtil.date2String(new Date(MapUtils.getLong(param, "finishTimeE")), DateUtil.Y_M_D_HMS)); + } + return orderMapperExt.queryOrderCoupon(param); } } diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java index 3ee526e5..fb2562f7 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java @@ -77,6 +77,9 @@ public class OrderServiceImpl implements OrderService { @Resource private OrderCancelHandleService orderCancelHandleService; + @Resource + private OrderRefundHandleService orderRefundHandleService; + @Resource private OrderPaySuccessService paySuccessService; @@ -106,7 +109,7 @@ public class OrderServiceImpl implements OrderService { isolation = Isolation.READ_COMMITTED, timeout = 10, rollbackFor = Exception.class) - @Cached(cacheType = CacheType.BOTH, name="order:", key = "#createOrderModel.orderNo", expire = 3600*24*30) // 缓存一个月 + @Cached(cacheType = CacheType.REMOTE, name="order:", key = "#createOrderModel.orderNo", expire = 3600*24*30) // 缓存一个月 public HighOrder createOrder(CreateOrderModel createOrderModel) throws Exception { HighDiscountUserRel discountUserRel = null; @@ -136,11 +139,11 @@ public class OrderServiceImpl implements OrderService { order.setOrderStatus(OrderStatus.STATUS1.getNumber()); order.setWhetherCheck(false); order.setWhetherRebate(false); + order.setProfitSharingStatus(false); order.setExceptionStatus(false); order.setCreateTime(new Date()); order.setPayGold(0); - /*********** 组装处理子订单 商品业务************/ List childOrderList = new ArrayList<>(); for (CreateOrderChildModel child : createOrderModel.getChildOrderList()) { @@ -161,7 +164,7 @@ public class OrderServiceImpl implements OrderService { // 加油订单 } else if (child.getGoodsType().equals(OrderChildGoodsType.TYPE3.getNumber())) { order.setProductType(OrderProductType.PRODUCT_TYPE6.getNumber()); - childOrderList.add(orderCreateHandleService.oilHandle(order, discountUserRel, child)); + childOrderList.add(orderCreateHandleService.oilHandle(order, discountUserRel, createOrderModel, child)); // 肯德基 } else if (child.getGoodsType().equals(OrderChildGoodsType.TYPE4.getNumber())) { @@ -288,7 +291,7 @@ public class OrderServiceImpl implements OrderService { // 积分金额小于应付金额 if (goldPrice.compareTo(order.getPayablePrice()) == -1) { // 扣除用户积分 - userService.goldHandle(order.getMemId(), order.getPayGold(), 2, 2, order.getId(), + userService.goldHandle(order.getMemId(), createOrderModel.getPayGold(), 2, 2, order.getId(), "抵扣积分订单:" + order.getOrderNo() + ",使用积分:" + order.getPayGold()); } @@ -307,18 +310,22 @@ public class OrderServiceImpl implements OrderService { throw ErrorHelp.genException(SysCode.System, ErrorCode.USER_PAY_PWD_ERROR, ""); } // 扣除用户积分 - userService.goldHandle(order.getMemId(), order.getPayGold(), 2, 2, order.getId(), + userService.goldHandle(order.getMemId(), createOrderModel.getPayGold(), 2, 2, order.getId(), "抵扣积分订单:" + order.getOrderNo() + ",使用积分:" + order.getPayGold()); order.setOrderStatus(OrderStatus.STATUS2.getNumber()); order.setPayRealPrice(order.getPayPrice()); order.setPayTime(new Date()); + order.setPayGold(createOrderModel.getPayGold()); for (HighChildOrder childOrder : order.getHighChildOrderList()) { childOrder.setChildOrderStatus(OrderChildStatus.STATUS2.getNumber()); } } } + order.setSurplusRefundPrice(new BigDecimal("0")); + order.setSurplusRefundIntegral(0); + // 订单入库前处理 for (HighChildOrder childOrder : order.getHighChildOrderList()) { childOrder.setOrderNo(order.getOrderNo()); @@ -340,30 +347,21 @@ public class OrderServiceImpl implements OrderService { } else { childOrder.setSurplusRefundIntegral(0); } + order.setSurplusRefundPrice(order.getSurplusRefundPrice().add(childOrder.getSurplusRefundPrice())); + order.setSurplusRefundIntegral(order.getSurplusRefundIntegral() + childOrder.getSurplusRefundIntegral()); } // 订单入库 HighOrder orderData = insertOrderData(order); if (orderData.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) { - SendCallback sendCallback = new SendCallback() { - @Override - public void onSuccess(SendResult sendResult) { - System.out.println("发送成功!"); - } - - @Override - public void onException(Throwable throwable) { - System.out.println("发送失败!"); - } - }; - // 10分钟后取消订单 + // 10分钟内未支付,自动取消订单 Message rocketMsg = MessageBuilder.withPayload(order).build(); - rocketMQTemplate.asyncSend(OrderTopic.ORDER_TOPIC_CANCEL.getTopic(), rocketMsg, sendCallback,1000,14); + rocketMQTemplate.syncSend(OrderTopic.ORDER_TOPIC_CANCEL.getTopic(), rocketMsg,1000,14); } else if (orderData.getOrderStatus().equals(OrderStatus.STATUS2.getNumber())) { // 异步处理业务 - paySuccessService.orderPaySuccessHandle(orderData.getOrderNo(), null, null, new BigDecimal("0"), null); + paySuccessService.orderPaySuccessHandle(orderData.getOrderNo(), OrderPayType.PAY_TYPE3, null, new BigDecimal("0"), null); } return orderData; } @@ -431,7 +429,7 @@ public class OrderServiceImpl implements OrderService { public HighOrder refundOrder(String orderNo, String remarks) throws Exception { HighOrder order = getOrderDetailByNo(orderNo); if (!order.getOrderStatus().equals(OrderStatus.STATUS2.getNumber()) - || !order.getOrderStatus().equals(OrderStatus.STATUS3.getNumber())) { + && !order.getOrderStatus().equals(OrderStatus.STATUS3.getNumber())) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } // 订单是否异常,订单没异常则需要校验产品业务是否支持退款 @@ -447,20 +445,26 @@ public class OrderServiceImpl implements OrderService { // 创建退款 order = orderRefundService.createOrderRefund(order, remarks); - // todo 退款金额,原路返回 - - - for (HighChildOrder childOrder : order.getHighChildOrderList()) { - childOrder.setRefundRemarks(remarks); - childOrder.setRefundTime(new Date()); - childOrder.setChildOrderStatus(OrderChildStatus.STATUS4.getNumber()); + if (childOrder.getGiveawayType() == false) { + childOrder.setRefundRemarks(remarks); + childOrder.setRefundTime(new Date()); + childOrder.setChildOrderStatus(OrderChildStatus.STATUS4.getNumber()); + + if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE3.getNumber())) { + orderRefundHandleService.oilHandle(childOrder); + } + } } order.setSurplusRefundIntegral(0); order.setSurplusRefundPrice(new BigDecimal("0")); order.setRefundTime(new Date()); order.setOrderStatus(OrderStatus.STATUS4.getNumber()); + + // todo 退款金额,原路返回 + + return updateOrderData(order); } @@ -522,7 +526,7 @@ public class OrderServiceImpl implements OrderService { } @Override - @Cached(cacheType = CacheType.BOTH,name="order:", key = "#orderNo",expire = 3600*24*30) + @Cached(cacheType = CacheType.REMOTE,name="order:", key = "#orderNo",expire = 3600*24*30) public HighOrder getOrderDetailByNo(String orderNo) { HighOrderExample orderExample = new HighOrderExample(); orderExample.createCriteria().andOrderNoEqualTo(orderNo); diff --git a/hai-service/src/main/java/com/hai/order/type/OrderOilStatus.java b/hai-service/src/main/java/com/hai/order/type/OrderOilStatus.java new file mode 100644 index 00000000..dd541ad6 --- /dev/null +++ b/hai-service/src/main/java/com/hai/order/type/OrderOilStatus.java @@ -0,0 +1,62 @@ +package com.hai.order.type; + +import java.util.Objects; + +/** + * @className: OrderOilStatus + * @author: HuRui + * @date: 2022/9/19 + **/ +public enum OrderOilStatus { + STATUS1(1, "待支付"), + STATUS2(2, "已支付"), + STATUS3(3, "已取消"), + STATUS4(4, "已退款"), + STATUS6(5, "退款中"), + STATUS8(6, "退款失败"), + ; + + private Integer number; + + private String name; + + OrderOilStatus(int number, String name) { + this.number = number; + this.name = name; + } + + /** + * 根据类型查询数据 + * @param type + * @return + */ + public static OrderOilStatus getDataByType(Integer type) { + for (OrderOilStatus ele : values()) { + if(Objects.equals(type,ele.getNumber())) return ele; + } + return null; + } + + public static String getNameByType(Integer type) { + for (OrderOilStatus ele : values()) { + if(Objects.equals(type,ele.getNumber())) return ele.getName(); + } + return null; + } + + public Integer getNumber() { + return number; + } + + public void setNumber(Integer number) { + this.number = number; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/hai-service/src/main/java/com/hai/order/type/OrderPayType.java b/hai-service/src/main/java/com/hai/order/type/OrderPayType.java index e46c9fd5..95a25155 100644 --- a/hai-service/src/main/java/com/hai/order/type/OrderPayType.java +++ b/hai-service/src/main/java/com/hai/order/type/OrderPayType.java @@ -11,8 +11,7 @@ import java.util.Objects; public enum OrderPayType { PAY_TYPE1(1, "支付宝"), PAY_TYPE2(2, "微信"), - @Deprecated - PAY_TYPE3(3, "金币"), + PAY_TYPE3(3, "积分抵扣"), PAY_TYPE4(4, "贵州汇联通工会卡"), PAY_TYPE5(5, "银联"), PAY_TYPE6(6, "银联分期"), diff --git a/hai-service/src/main/java/com/hai/service/HighCouponAgentService.java b/hai-service/src/main/java/com/hai/service/HighCouponAgentService.java index 198b87f5..d4fc6102 100644 --- a/hai-service/src/main/java/com/hai/service/HighCouponAgentService.java +++ b/hai-service/src/main/java/com/hai/service/HighCouponAgentService.java @@ -79,7 +79,7 @@ public interface HighCouponAgentService { * @Description 生成二维码 * @Date 2021/4/21 22:35 **/ - Map generateCode(Long couponAgentCodeId,String remark); + Map generateCode(Long couponAgentCodeId,String phone,String remark) throws Exception; /** * @Author 胡锐 diff --git a/hai-service/src/main/java/com/hai/service/HighCouponCodeOtherService.java b/hai-service/src/main/java/com/hai/service/HighCouponCodeOtherService.java index bc17227b..f888010a 100644 --- a/hai-service/src/main/java/com/hai/service/HighCouponCodeOtherService.java +++ b/hai-service/src/main/java/com/hai/service/HighCouponCodeOtherService.java @@ -1,5 +1,7 @@ package com.hai.service; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.hai.entity.HighCouponCodeOther; import java.util.List; @@ -13,6 +15,12 @@ public interface HighCouponCodeOtherService { */ void insertCouponCodeOther(HighCouponCodeOther couponCodeOther); + /** + * 修改 + * @param couponCodeOther + */ + void update(HighCouponCodeOther couponCodeOther); + /** * 查询列表 * @param map @@ -27,4 +35,17 @@ public interface HighCouponCodeOtherService { */ HighCouponCodeOther getDetailByCouponAgentCodeId(Long couponAgentCodeId); + /** + * 根据卡券号查询 + * @param couNo + * @return + */ + HighCouponCodeOther getDetailByCouNo(String couNo); + + /** + * 重庆中石化核销回调 + * @param param + */ + void cqCnpcUseNotify(JSONObject param); + } diff --git a/hai-service/src/main/java/com/hai/service/HighCouponService.java b/hai-service/src/main/java/com/hai/service/HighCouponService.java index 74e79dd7..7b98f940 100644 --- a/hai-service/src/main/java/com/hai/service/HighCouponService.java +++ b/hai-service/src/main/java/com/hai/service/HighCouponService.java @@ -129,6 +129,13 @@ public interface HighCouponService { **/ Long getCouponByCouponName(Long companyId,String couponName); + /** + * 拼接卡券id + * @param companyId + * @return + */ + String getCouponIdsByCompanyId(Long companyId); + /** * @Author 胡锐 * @Description 根据商户 查询处于已上架的卡卷 diff --git a/hai-service/src/main/java/com/hai/service/HighGasOrderService.java b/hai-service/src/main/java/com/hai/service/HighGasOrderService.java index 59ebaf9c..5c4a97c4 100644 --- a/hai-service/src/main/java/com/hai/service/HighGasOrderService.java +++ b/hai-service/src/main/java/com/hai/service/HighGasOrderService.java @@ -32,6 +32,13 @@ public interface HighGasOrderService { */ HighGasOrder getDetailByChildOrderNo(String childOrderNo); + /** + * 查询交易订单号获取详情 + * @param orderNo + * @return + */ + HighGasOrder getDetailByOrderNo(String orderNo); + /** * 查询油站订单列表 * @param param diff --git a/hai-service/src/main/java/com/hai/service/HighOrderService.java b/hai-service/src/main/java/com/hai/service/HighOrderService.java index bcc36c5c..a5088d21 100644 --- a/hai-service/src/main/java/com/hai/service/HighOrderService.java +++ b/hai-service/src/main/java/com/hai/service/HighOrderService.java @@ -83,6 +83,13 @@ public interface HighOrderService { **/ Integer getUndoneChildOrder(Long orderId); + /** + * 查询交易订单 + * @param orderId + * @return + */ + HighOrder getDetailById(Long orderId); + /** * @Author 胡锐 * @Description 查询子商品 diff --git a/hai-service/src/main/java/com/hai/service/HighUserCouponService.java b/hai-service/src/main/java/com/hai/service/HighUserCouponService.java index 5591e76e..f9cba8f7 100644 --- a/hai-service/src/main/java/com/hai/service/HighUserCouponService.java +++ b/hai-service/src/main/java/com/hai/service/HighUserCouponService.java @@ -56,6 +56,13 @@ public interface HighUserCouponService { **/ HighUserCoupon getUserNewCoupon(Long userId,Long couponId); + /** + * @Author 胡锐 + * @Description 查询最新一张可用的卡券 + * @Date 2021/4/20 21:01 + **/ + HighUserCoupon getUserCouponByOrder(Long userId,Long orderId); + /** * @Author 胡锐 * @Description 查询用户列表 diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java index 863eeaf8..3c7d2d18 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java @@ -8,7 +8,9 @@ import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.utils.DateUtil; +import com.hai.common.utils.MemberValidateUtil; import com.hai.common.utils.ResponseMsgUtil; +import com.hai.config.ChongQingCNPCService; import com.hai.config.HuiLianTongConfig; import com.hai.config.HuiLianTongUnionCardConfig; import com.hai.dao.*; @@ -292,7 +294,7 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService { @Override @Transactional(propagation= Propagation.REQUIRES_NEW) - public Map generateCode(Long couponAgentCodeId,String remark) { + public Map generateCode(Long couponAgentCodeId,String phone,String remark) throws Exception { // 查询卡券销售码 HighCouponAgentCode couponAgentCode = getCodeById(couponAgentCodeId); if (couponAgentCode == null) { @@ -301,6 +303,8 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService { if (couponAgentCode.getStatus() != 1) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "销售码已被销售"); } + couponAgentCode.setConvertUserPhone(phone); + couponAgentCode.setCouponCode(System.currentTimeMillis()+""); couponAgentCode.setStatus(2); // 状态:1.待销售 2.未使用 3.已使用 couponAgentCode.setRemark(remark); couponAgentCode.setSalesTime(new Date()); @@ -311,6 +315,11 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService { couponAgent.setSalesCount(couponAgent.getSalesCount() + 1); highCouponAgentRelMapper.updateByPrimaryKey(couponAgent); + // 卡券信息 + HighCoupon coupon = highCouponService.getCouponById(couponAgentCode.getCouponId()); + if (coupon == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到卡券"); + } HighCouponCode couponCode = null; if (couponAgentCode.getType() == 1) { @@ -320,6 +329,34 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService { highCouponCodeService.updateCouponCode(couponCode); } + if (coupon.getCouponSource().equals(5)) { + if (StringUtils.isBlank(phone)) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请填写客户手机号"); + } + if (!MemberValidateUtil.validatePhone(phone)) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "手机号格式错误"); + } + + // 给用户发码 + JSONObject response = ChongQingCNPCService.sendCNPCTicket(coupon.getCouponKey(), couponAgentCode.getConvertCode(), 1, phone); + JSONObject couponDetail = response.getJSONObject("ticketDetail"); + JSONArray codeList = response.getJSONArray("codeList"); + + for (Object data : codeList) { + HighCouponCodeOther couponCodeOther = new HighCouponCodeOther(); + couponCodeOther.setType(2); + couponCodeOther.setCouponAgentCodeId(couponAgentCodeId); + couponCodeOther.setCouTypeCode(couponDetail.getString("requestCode")); + couponCodeOther.setCouNo(ChongQingCNPCService.decryptCouponCode(String.valueOf(data))); + couponCodeOther.setActiveTime(new Date()); + couponCodeOther.setValidStartDate(DateUtil.format(couponDetail.getString("effectiveTime"), "yyyy-MM-dd")); + couponCodeOther.setValidEndDate(DateUtil.format(couponDetail.getString("expiredDate"), "yyyy-MM-dd")); + couponCodeOther.setStatus(20); + couponCodeOther.setCreateTime(new Date()); + highCouponCodeOtherMapper.insert(couponCodeOther); + } + } + Map map = new HashMap<>(); map.put("couponInfo", highCouponService.getCouponById(couponAgentCode.getCouponId())); map.put("couponCode", couponCode); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeOtherServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeOtherServiceImpl.java index 706fb3a8..ba65f315 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeOtherServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeOtherServiceImpl.java @@ -1,13 +1,18 @@ package com.hai.service.impl; +import com.alibaba.fastjson.JSONObject; +import com.hai.common.utils.DateUtil; +import com.hai.dao.HighCouponAgentCodeMapper; import com.hai.dao.HighCouponCodeOtherMapper; -import com.hai.entity.HighCouponCodeOther; -import com.hai.entity.HighCouponCodeOtherExample; +import com.hai.dao.HighUserCouponMapper; +import com.hai.entity.*; import com.hai.service.HighCouponCodeOtherService; +import com.hai.service.HighOrderService; import org.apache.commons.collections4.MapUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.Date; import java.util.List; import java.util.Map; @@ -17,6 +22,20 @@ public class HighCouponCodeOtherServiceImpl implements HighCouponCodeOtherServic @Resource private HighCouponCodeOtherMapper highCouponCodeOtherMapper; + @Resource + private HighUserCouponMapper highUserCouponMapper; + + @Resource + private HighCouponAgentCodeMapper highCouponAgentCodeMapper; + + @Resource + private HighOrderService highOrderService; + + @Override + public void update(HighCouponCodeOther couponCodeOther) { + highCouponCodeOtherMapper.updateByPrimaryKey(couponCodeOther); + } + @Override public void insertCouponCodeOther(HighCouponCodeOther couponCodeOther) { highCouponCodeOtherMapper.insert(couponCodeOther); @@ -51,4 +70,48 @@ public class HighCouponCodeOtherServiceImpl implements HighCouponCodeOtherServic } return null; } + + @Override + public HighCouponCodeOther getDetailByCouNo(String couNo) { + HighCouponCodeOtherExample example = new HighCouponCodeOtherExample(); + example.createCriteria().andCouNoEqualTo(couNo); + List list = highCouponCodeOtherMapper.selectByExample(example); + if (list.size() > 0) { + return list.get(0); + } + return null; + } + + @Override + public void cqCnpcUseNotify(JSONObject param) { + HighCouponCodeOther couponCodeOther = getDetailByCouNo(param.getString("couponNo")); + if (couponCodeOther != null) { + couponCodeOther.setUseTime(DateUtil.format(param.getString("useTime"), "yyyyMMddHHmmss")); + couponCodeOther.setStationCode(param.getString("stationCode")); + couponCodeOther.setStationName(param.getString("stationName")); + couponCodeOther.setStatus(40); + update(couponCodeOther); + + if (couponCodeOther.getChildOrderId() != null) { + HighUserCouponExample userCouponExample = new HighUserCouponExample(); + userCouponExample.createCriteria().andQrCodeImgEqualTo(couponCodeOther.getCouNo()).andStatusEqualTo(1); + List list = highUserCouponMapper.selectByExample(userCouponExample); + if (list.size() > 0) { + HighUserCoupon userCoupon = list.get(0); + userCoupon.setStatus(2); + userCoupon.setConsumeTime(couponCodeOther.getUseTime()); + highUserCouponMapper.updateByPrimaryKey(userCoupon); + } + highOrderService.childOrderComplete(couponCodeOther.getChildOrderId()); + } + + if (couponCodeOther.getCouponAgentCodeId() != null) { + HighCouponAgentCode agentCode = highCouponAgentCodeMapper.selectByPrimaryKey(couponCodeOther.getCouponAgentCodeId()); + if (agentCode == null) { + agentCode.setStatus(3); + highCouponAgentCodeMapper.updateByPrimaryKey(agentCode); + } + } + } + } } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java index 47c93310..1f58aa10 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java @@ -60,6 +60,7 @@ public class HighCouponServiceImpl implements HighCouponService { private HighApproveService highApproveService; + @Autowired private RedisTemplate redisTemplate; @@ -447,7 +448,7 @@ public class HighCouponServiceImpl implements HighCouponService { criteria.andCouponSourceNotEqualTo(MapUtils.getInteger(map, "notCouponSource")); } - example.setOrderByClause("create_time"); + example.setOrderByClause("create_time desc"); List coupons = highCouponMapper.selectByExample(example); if (coupons != null && coupons.size() > 0) { for (HighCoupon highCoupon : coupons) { @@ -519,6 +520,22 @@ public class HighCouponServiceImpl implements HighCouponService { return highCouponMapper.countByExample(example); } + @Override + public String getCouponIdsByCompanyId(Long companyId) { + HighCouponExample example = new HighCouponExample(); + example.createCriteria().andCompanyIdEqualTo(companyId); + List list = highCouponMapper.selectByExample(example); + String str = null; + for (HighCoupon coupon : list) { + if (StringUtils.isBlank(str)) { + str = coupon.getId().toString(); + } else { + str += ","+coupon.getId(); + } + } + return str; + } + @Override public List getCouponListByMerchant(Long merchantId) { HighCouponExample example = new HighCouponExample(); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighGasDiscountOilPriceServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighGasDiscountOilPriceServiceImpl.java index 457921b0..f11608de 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighGasDiscountOilPriceServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighGasDiscountOilPriceServiceImpl.java @@ -104,7 +104,7 @@ public class HighGasDiscountOilPriceServiceImpl implements HighGasDiscountOilPri if (store == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站"); } - // 是否是加油站 + // 是否是加油站· if (!store.getType().equals(1)) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站"); } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighGasOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighGasOrderServiceImpl.java index f4d5c085..affb6ea9 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighGasOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighGasOrderServiceImpl.java @@ -46,13 +46,24 @@ public class HighGasOrderServiceImpl implements HighGasOrderService { return null; } + @Override + public HighGasOrder getDetailByOrderNo(String orderNo) { + HighGasOrderExample example = new HighGasOrderExample(); + example.createCriteria().andOrderNoEqualTo(orderNo); + List list = gasOrderMapper.selectByExample(example); + if (list.size() > 0) { + return list.get(0); + } + return null; + } + @Override public List getGasOrderList(Map param) { HighGasOrderExample example = new HighGasOrderExample(); HighGasOrderExample.Criteria criteria = example.createCriteria(); if (MapUtils.getLong(param, "companyId") != null) { - + criteria.andCompanyIdEqualTo(MapUtils.getLong(param, "companyId")); } if (MapUtils.getLong(param, "merId") != null) { @@ -63,6 +74,22 @@ public class HighGasOrderServiceImpl implements HighGasOrderService { criteria.andStoreIdEqualTo(MapUtils.getLong(param, "storeId")); } + if (MapUtils.getLong(param, "gasOrgId") != null) { + criteria.andGasOrgIdEqualTo(MapUtils.getLong(param, "gasOrgId")); + } + + if (MapUtils.getLong(param, "gasAgentId") != null) { + criteria.andGasAgentIdEqualTo(MapUtils.getLong(param, "gasAgentId")); + } + + if (MapUtils.getLong(param, "gasSalesmanId") != null) { + criteria.andGasSalesmanIdEqualTo(MapUtils.getLong(param, "gasSalesmanId")); + } + + if (MapUtils.getLong(param, "gasStaffId") != null) { + criteria.andGasStaffIdEqualTo(MapUtils.getLong(param, "gasStaffId")); + } + if (StringUtils.isNotBlank(MapUtils.getString(param, "storeName"))) { criteria.andStoreNameLike("%"+MapUtils.getString(param, "storeName")+"%"); } @@ -83,6 +110,10 @@ public class HighGasOrderServiceImpl implements HighGasOrderService { criteria.andGasOilTypeEqualTo(MapUtils.getInteger(param, "storeId")); } + if (StringUtils.isNotBlank(MapUtils.getString(param, "gasStaffName"))) { + criteria.andGasStaffNameLike("%"+MapUtils.getString(param, "gasStaffName")+"%"); + } + if (StringUtils.isNotBlank(MapUtils.getString(param, "gasOilNo"))) { criteria.andGasOilNoEqualTo(MapUtils.getString(param, "gasOilNo")); } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 92abfd02..2fdf6eaf 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -193,7 +193,7 @@ public class HighOrderServiceImpl implements HighOrderService { if (childOrder.getGoodsType() == 1) { // 查询卡券 HighCoupon couponDetail = highCouponService.getCouponDetail(childOrder.getGoodsId()); - if (couponDetail.getCouponSource() != 4) { + if (couponDetail.getCouponSource() != 4 && couponDetail.getCouponSource() != 5) { // 查询待销售 List list = highCouponCodeService.getNoSaleCode(childOrder.getGoodsId()); if (list == null || list.size() == 0) { @@ -414,7 +414,7 @@ public class HighOrderServiceImpl implements HighOrderService { orderPre.setStatus(1); highOrderPreService.insertOrderPre(orderPre); } - // 贵州高速 + // 贵州中石化 if (coupon.getCouponSource() == 4) { Map push = new HashMap<>(); push.put("couTypeCode", coupon.getCouponKey()); @@ -456,6 +456,8 @@ public class HighOrderServiceImpl implements HighOrderService { // 卡卷关联用户 HighUserCoupon highUserCoupon = new HighUserCoupon(); + highUserCoupon.setOrderId(orderId); + highUserCoupon.setChildOrderId(highChildOrder.getId()); highUserCoupon.setMerchantId(coupon.getMerchantId()); highUserCoupon.setCouponId(coupon.getId()); highUserCoupon.setUserId(highOrder.getMemId()); @@ -466,6 +468,59 @@ public class HighOrderServiceImpl implements HighOrderService { highUserCouponMapper.insert(highUserCoupon); } } + + // 重庆中石油 + } else if (coupon.getCouponSource() == 5) { + + // 给用户发码 + JSONObject response = ChongQingCNPCService.sendCNPCTicket(coupon.getCouponKey(), highOrder.getOrderNo(), highChildOrder.getSaleCount(), highOrder.getMemPhone()); + + // 推送记录 + JSONObject request = new JSONObject(); + request.put("requestCode", coupon.getCouponKey()); + request.put("tradeId", highOrder.getOrderNo()); + request.put("ticketSum", highChildOrder.getSaleCount()); + request.put("phone", highOrder.getMemPhone()); + + HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); + highGasOrderPush.setType(OrderPushType.type10.getType()); + highGasOrderPush.setOrderNo(highOrder.getOrderNo()); + highGasOrderPush.setCreateTime(new Date()); + highGasOrderPush.setRequestContent(request.toJSONString()); + highGasOrderPush.setReturnContent(response.toJSONString()); + highGasOrderPushMapper.insert(highGasOrderPush); + + JSONObject couponDetail = response.getJSONObject("ticketDetail"); + JSONArray codeList = response.getJSONArray("codeList"); + + for (Object data : codeList) { + HighCouponCodeOther couponCodeOther = new HighCouponCodeOther(); + couponCodeOther.setType(2); + couponCodeOther.setOrderId(highOrder.getId()); + couponCodeOther.setChildOrderId(highChildOrder.getId()); + couponCodeOther.setCouTypeCode(couponDetail.getString("requestCode")); + couponCodeOther.setCouNo(ChongQingCNPCService.decryptCouponCode(String.valueOf(data))); + couponCodeOther.setActiveTime(DateUtil.format(couponDetail.getString("effectiveTime"), "yyyy-MM-dd")); + couponCodeOther.setValidStartDate(DateUtil.format(couponDetail.getString("effectiveTime"), "yyyy-MM-dd")); + couponCodeOther.setValidEndDate(DateUtil.format(couponDetail.getString("expiredDate"), "yyyy-MM-dd")); + couponCodeOther.setStatus(20); + couponCodeOther.setCreateTime(new Date()); + highCouponCodeOtherMapper.insert(couponCodeOther); + + // 卡卷关联用户 + HighUserCoupon highUserCoupon = new HighUserCoupon(); + highUserCoupon.setMerchantId(coupon.getMerchantId()); + highUserCoupon.setCouponId(coupon.getId()); + highUserCoupon.setOrderId(orderId); + highUserCoupon.setChildOrderId(highChildOrder.getId()); + highUserCoupon.setUserId(highOrder.getMemId()); + highUserCoupon.setCreateTime(new Date()); + highUserCoupon.setQrCodeImg(couponCodeOther.getCouNo()); + highUserCoupon.setUseEndTime(couponCodeOther.getValidEndDate()); + highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 + highUserCouponMapper.insert(highUserCoupon); + } + } else { HighCouponCode code = highCouponCodeService.getCouponCodeByOrderId(highChildOrder.getId()); code.setStatus(2); // 状态:1.待销售 2.未使用 3.已使用 99.预支付 @@ -474,6 +529,8 @@ public class HighOrderServiceImpl implements HighOrderService { // 卡卷关联用户 HighUserCoupon highUserCoupon = new HighUserCoupon(); + highUserCoupon.setOrderId(orderId); + highUserCoupon.setChildOrderId(highChildOrder.getId()); highUserCoupon.setMerchantId(code.getMerchantId()); highUserCoupon.setCouponId(code.getCouponId()); highUserCoupon.setUserId(highOrder.getMemId()); @@ -727,6 +784,8 @@ public class HighOrderServiceImpl implements HighOrderService { // 卡卷关联用户 HighUserCoupon highUserCoupon = new HighUserCoupon(); + highUserCoupon.setOrderId(order.getId()); + highUserCoupon.setChildOrderId(highChildOrder.getId()); highUserCoupon.setMerchantId(coupon.getMerchantId()); highUserCoupon.setCouponId(coupon.getId()); highUserCoupon.setUserId(order.getMemId()); @@ -748,6 +807,55 @@ public class HighOrderServiceImpl implements HighOrderService { highGasOrderPush.setReturnContent(returnParam.toJSONString()); highGasOrderPushMapper.insert(highGasOrderPush); + } else if (coupon.getCouponSource() == 5) { + // 给用户发码 + JSONObject response = ChongQingCNPCService.sendCNPCTicket(coupon.getCouponKey(), order.getOrderNo(), highChildOrder.getSaleCount(), order.getMemPhone()); + + // 推送记录 + JSONObject request = new JSONObject(); + request.put("requestCode", coupon.getCouponKey()); + request.put("tradeId", order.getOrderNo()); + request.put("ticketSum", highChildOrder.getSaleCount()); + request.put("phone", order.getMemPhone()); + + HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); + highGasOrderPush.setType(OrderPushType.type10.getType()); + highGasOrderPush.setOrderNo(order.getOrderNo()); + highGasOrderPush.setCreateTime(new Date()); + highGasOrderPush.setRequestContent(request.toJSONString()); + highGasOrderPush.setReturnContent(response.toJSONString()); + highGasOrderPushMapper.insert(highGasOrderPush); + + JSONObject couponDetail = response.getJSONObject("ticketDetail"); + JSONArray codeList = response.getJSONArray("codeList"); + + for (Object data : codeList) { + HighCouponCodeOther couponCodeOther = new HighCouponCodeOther(); + couponCodeOther.setType(2); + couponCodeOther.setOrderId(order.getId()); + couponCodeOther.setChildOrderId(highChildOrder.getId()); + couponCodeOther.setCouTypeCode(couponDetail.getString("requestCode")); + couponCodeOther.setCouNo(ChongQingCNPCService.decryptCouponCode(String.valueOf(data))); + couponCodeOther.setActiveTime(DateUtil.format(couponDetail.getString("effectiveTime"), "yyyy-MM-dd")); + couponCodeOther.setValidStartDate(DateUtil.format(couponDetail.getString("effectiveTime"), "yyyy-MM-dd")); + couponCodeOther.setValidEndDate(DateUtil.format(couponDetail.getString("expiredDate"), "yyyy-MM-dd")); + couponCodeOther.setStatus(20); + couponCodeOther.setCreateTime(new Date()); + highCouponCodeOtherMapper.insert(couponCodeOther); + + // 卡卷关联用户 + HighUserCoupon highUserCoupon = new HighUserCoupon(); + highUserCoupon.setOrderId(order.getId()); + highUserCoupon.setChildOrderId(highChildOrder.getId()); + highUserCoupon.setMerchantId(coupon.getMerchantId()); + highUserCoupon.setCouponId(coupon.getId()); + highUserCoupon.setUserId(order.getMemId()); + highUserCoupon.setCreateTime(new Date()); + highUserCoupon.setQrCodeImg(couponCodeOther.getCouNo()); + highUserCoupon.setUseEndTime(couponCodeOther.getValidEndDate()); + highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 + highUserCouponMapper.insert(highUserCoupon); + } } else { HighCouponCode code = highCouponCodeService.getCouponCodeByOrderId(highChildOrder.getId()); code.setStatus(2); // 状态:1.待销售 2.未使用 3.已使用 99.预支付 @@ -756,6 +864,8 @@ public class HighOrderServiceImpl implements HighOrderService { // 卡卷关联用户 HighUserCoupon highUserCoupon = new HighUserCoupon(); + highUserCoupon.setOrderId(order.getId()); + highUserCoupon.setChildOrderId(highChildOrder.getId()); highUserCoupon.setMerchantId(code.getMerchantId()); highUserCoupon.setCouponId(code.getCouponId()); highUserCoupon.setUserId(order.getMemId()); @@ -1039,6 +1149,8 @@ public class HighOrderServiceImpl implements HighOrderService { // 卡卷关联用户 HighUserCoupon highUserCoupon = new HighUserCoupon(); + highUserCoupon.setOrderId(order.getId()); + highUserCoupon.setChildOrderId(highChildOrder.getId()); highUserCoupon.setMerchantId(coupon.getMerchantId()); highUserCoupon.setCouponId(coupon.getId()); highUserCoupon.setUserId(order.getMemId()); @@ -1060,6 +1172,55 @@ public class HighOrderServiceImpl implements HighOrderService { highGasOrderPush.setReturnContent(returnParam.toJSONString()); highGasOrderPushMapper.insert(highGasOrderPush); + } else if (coupon.getCouponSource() == 5) { + // 给用户发码 + JSONObject response = ChongQingCNPCService.sendCNPCTicket(coupon.getCouponKey(), order.getOrderNo(), highChildOrder.getSaleCount(), order.getMemPhone()); + + // 推送记录 + JSONObject request = new JSONObject(); + request.put("requestCode", coupon.getCouponKey()); + request.put("tradeId", order.getOrderNo()); + request.put("ticketSum", highChildOrder.getSaleCount()); + request.put("phone", order.getMemPhone()); + + HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); + highGasOrderPush.setType(OrderPushType.type10.getType()); + highGasOrderPush.setOrderNo(order.getOrderNo()); + highGasOrderPush.setCreateTime(new Date()); + highGasOrderPush.setRequestContent(request.toJSONString()); + highGasOrderPush.setReturnContent(response.toJSONString()); + highGasOrderPushMapper.insert(highGasOrderPush); + + JSONObject couponDetail = response.getJSONObject("ticketDetail"); + JSONArray codeList = response.getJSONArray("codeList"); + + for (Object data : codeList) { + HighCouponCodeOther couponCodeOther = new HighCouponCodeOther(); + couponCodeOther.setType(2); + couponCodeOther.setOrderId(order.getId()); + couponCodeOther.setChildOrderId(highChildOrder.getId()); + couponCodeOther.setCouTypeCode(couponDetail.getString("requestCode")); + couponCodeOther.setCouNo(ChongQingCNPCService.decryptCouponCode(String.valueOf(data))); + couponCodeOther.setActiveTime(DateUtil.format(couponDetail.getString("effectiveTime"), "yyyy-MM-dd")); + couponCodeOther.setValidStartDate(DateUtil.format(couponDetail.getString("effectiveTime"), "yyyy-MM-dd")); + couponCodeOther.setValidEndDate(DateUtil.format(couponDetail.getString("expiredDate"), "yyyy-MM-dd")); + couponCodeOther.setStatus(20); + couponCodeOther.setCreateTime(new Date()); + highCouponCodeOtherMapper.insert(couponCodeOther); + + // 卡卷关联用户 + HighUserCoupon highUserCoupon = new HighUserCoupon(); + highUserCoupon.setOrderId(order.getId()); + highUserCoupon.setChildOrderId(highChildOrder.getId()); + highUserCoupon.setMerchantId(coupon.getMerchantId()); + highUserCoupon.setCouponId(coupon.getId()); + highUserCoupon.setUserId(order.getMemId()); + highUserCoupon.setCreateTime(new Date()); + highUserCoupon.setQrCodeImg(couponCodeOther.getCouNo()); + highUserCoupon.setUseEndTime(couponCodeOther.getValidEndDate()); + highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 + highUserCouponMapper.insert(highUserCoupon); + } } else { HighCouponCode code = highCouponCodeService.getCouponCodeByOrderId(highChildOrder.getId()); code.setStatus(2); // 状态:1.待销售 2.未使用 3.已使用 99.预支付 @@ -1068,6 +1229,8 @@ public class HighOrderServiceImpl implements HighOrderService { // 卡卷关联用户 HighUserCoupon highUserCoupon = new HighUserCoupon(); + highUserCoupon.setOrderId(order.getId()); + highUserCoupon.setChildOrderId(highChildOrder.getId()); highUserCoupon.setMerchantId(code.getMerchantId()); highUserCoupon.setCouponId(code.getCouponId()); highUserCoupon.setUserId(order.getMemId()); @@ -1302,6 +1465,8 @@ public class HighOrderServiceImpl implements HighOrderService { // 卡卷关联用户 HighUserCoupon highUserCoupon = new HighUserCoupon(); + highUserCoupon.setOrderId(order.getId()); + highUserCoupon.setChildOrderId(highChildOrder.getId()); highUserCoupon.setMerchantId(coupon.getMerchantId()); highUserCoupon.setCouponId(coupon.getId()); highUserCoupon.setUserId(order.getMemId()); @@ -1323,6 +1488,55 @@ public class HighOrderServiceImpl implements HighOrderService { highGasOrderPush.setReturnContent(returnParam.toJSONString()); highGasOrderPushMapper.insert(highGasOrderPush); + } else if (coupon.getCouponSource() == 5) { + // 给用户发码 + JSONObject response = ChongQingCNPCService.sendCNPCTicket(coupon.getCouponKey(), order.getOrderNo(), highChildOrder.getSaleCount(), order.getMemPhone()); + + // 推送记录 + JSONObject request = new JSONObject(); + request.put("requestCode", coupon.getCouponKey()); + request.put("tradeId", order.getOrderNo()); + request.put("ticketSum", highChildOrder.getSaleCount()); + request.put("phone", order.getMemPhone()); + + HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); + highGasOrderPush.setType(OrderPushType.type10.getType()); + highGasOrderPush.setOrderNo(order.getOrderNo()); + highGasOrderPush.setCreateTime(new Date()); + highGasOrderPush.setRequestContent(request.toJSONString()); + highGasOrderPush.setReturnContent(response.toJSONString()); + highGasOrderPushMapper.insert(highGasOrderPush); + + JSONObject couponDetail = response.getJSONObject("ticketDetail"); + JSONArray codeList = response.getJSONArray("codeList"); + + for (Object data : codeList) { + HighCouponCodeOther couponCodeOther = new HighCouponCodeOther(); + couponCodeOther.setType(2); + couponCodeOther.setOrderId(order.getId()); + couponCodeOther.setChildOrderId(highChildOrder.getId()); + couponCodeOther.setCouTypeCode(couponDetail.getString("requestCode")); + couponCodeOther.setCouNo(ChongQingCNPCService.decryptCouponCode(String.valueOf(data))); + couponCodeOther.setActiveTime(DateUtil.format(couponDetail.getString("effectiveTime"), "yyyy-MM-dd")); + couponCodeOther.setValidStartDate(DateUtil.format(couponDetail.getString("effectiveTime"), "yyyy-MM-dd")); + couponCodeOther.setValidEndDate(DateUtil.format(couponDetail.getString("expiredDate"), "yyyy-MM-dd")); + couponCodeOther.setStatus(20); + couponCodeOther.setCreateTime(new Date()); + highCouponCodeOtherMapper.insert(couponCodeOther); + + // 卡卷关联用户 + HighUserCoupon highUserCoupon = new HighUserCoupon(); + highUserCoupon.setOrderId(order.getId()); + highUserCoupon.setChildOrderId(highChildOrder.getId()); + highUserCoupon.setMerchantId(coupon.getMerchantId()); + highUserCoupon.setCouponId(coupon.getId()); + highUserCoupon.setUserId(order.getMemId()); + highUserCoupon.setCreateTime(new Date()); + highUserCoupon.setQrCodeImg(couponCodeOther.getCouNo()); + highUserCoupon.setUseEndTime(couponCodeOther.getValidEndDate()); + highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 + highUserCouponMapper.insert(highUserCoupon); + } } else { HighCouponCode code = highCouponCodeService.getCouponCodeByOrderId(highChildOrder.getId()); code.setStatus(2); // 状态:1.待销售 2.未使用 3.已使用 99.预支付 @@ -1331,6 +1545,8 @@ public class HighOrderServiceImpl implements HighOrderService { // 卡卷关联用户 HighUserCoupon highUserCoupon = new HighUserCoupon(); + highUserCoupon.setOrderId(order.getId()); + highUserCoupon.setChildOrderId(highChildOrder.getId()); highUserCoupon.setMerchantId(code.getMerchantId()); highUserCoupon.setCouponId(code.getCouponId()); highUserCoupon.setUserId(order.getMemId()); @@ -1493,6 +1709,11 @@ public class HighOrderServiceImpl implements HighOrderService { return count; } + @Override + public HighOrder getDetailById(Long orderId) { + return highOrderMapper.selectByPrimaryKey(orderId); + } + @Override public HighChildOrder getChildOrderById(Long childOrderId) { return highChildOrderMapper.selectByPrimaryKey(childOrderId); @@ -3080,52 +3301,7 @@ public class HighOrderServiceImpl implements HighOrderService { @Override public List orderListByAgentId(Map map) throws Exception { - -// HighOrderExample example = new HighOrderExample(); -// HighOrderExample.Criteria criteria = example.createCriteria(); -// -// criteria.andOrderStatusEqualTo(3); -// -// /* if (MapUtils.getLong(map , "agentId") != null) { -// criteria.andIdentificationCodeEqualTo(MapUtils.getLong(map , "agentId")); -// } else { -//<<<<<<< HEAD -// criteria.andIdentificationCodeIsNotNull(); -// }*/ -// -// List list = highOrderMapper.selectByExample(example); -// -// /* for (HighOrder order : list) { -// HighUser user = highUserService.findByUserId(order.getIdentificationCode()); -// order.setTime(DateUtil.date2String(order.getCreateTime() , "MM月dd日 HH:mm")); -// List childOrder = getChildOrderByOrder(order.getId()); -// order.setGoodsTypeName("购买:" + GoodsType.getNameByType(childOrder.get(0).getGoodsType())); -// order.setAgentName(user.getName()); -// }*/ -//======= -// criteria.andIdentificationCodeIsNotNull().andIdentificationCodeNotEqualTo(60L); -// } -// if (MapUtils.getLong(map , "code") != null) { -// criteria.andIdentificationCodeEqualTo(MapUtils.getLong(map , "code")); -// } -// -// List list = highOrderMapper.selectByExample(example); -// -// if (list.size() > 0) { -// for (HighOrder order : list) { -// HighUser user = highUserService.findByUserId(order.getIdentificationCode()); -// order.setTime(DateUtil.date2String(order.getCreateTime() , "MM月dd日 HH:mm")); -// List childOrder = getChildOrderByOrder(order.getId()); -// order.setGoodsTypeName("购买:" + GoodsType.getNameByType(childOrder.get(0).getGoodsType())); -// if (user != null) { -// order.setAgentName(user.getName()); -// } else { -// order.setAgentName("暂无推广人"); -// } -// } -// } -//>>>>>>> dev_yy -// return null; } + } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighUserCouponServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighUserCouponServiceImpl.java index 5648a6f3..826c265d 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighUserCouponServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighUserCouponServiceImpl.java @@ -88,6 +88,18 @@ public class HighUserCouponServiceImpl implements HighUserCouponService { return null; } + @Override + public HighUserCoupon getUserCouponByOrder(Long userId, Long orderId) { + HighUserCouponExample example = new HighUserCouponExample(); + example.createCriteria().andUserIdEqualTo(userId).andOrderIdEqualTo(orderId).andStatusEqualTo(1); + example.setOrderByClause("create_time desc"); + List couponList = highUserCouponMapper.selectByExample(example); + if (couponList != null && couponList.size() > 0) { + return couponList.get(0); + } + return null; + } + @Override public List getUserCouponList(Map map) { HighUserCouponExample example = new HighUserCouponExample(); @@ -174,6 +186,8 @@ public class HighUserCouponServiceImpl implements HighUserCouponService { // 卡卷关联用户 HighUserCoupon highUserCoupon = new HighUserCoupon(); + highUserCoupon.setOrderId(userCoupon.getOrderId()); + highUserCoupon.setChildOrderId(userCoupon.getChildOrderId()); highUserCoupon.setMerchantId(coupon.getMerchantId()); highUserCoupon.setCouponId(coupon.getId()); highUserCoupon.setUserId(userId); diff --git a/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java index a7c15633..2e76e273 100644 --- a/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java @@ -228,6 +228,8 @@ public class GoodsOrderServiceImpl implements PayService { // 卡卷关联用户 HighUserCoupon highUserCoupon = new HighUserCoupon(); + highUserCoupon.setOrderId(order.getId()); + highUserCoupon.setChildOrderId(highChildOrder.getId()); highUserCoupon.setMerchantId(coupon.getMerchantId()); highUserCoupon.setCouponId(coupon.getId()); highUserCoupon.setUserId(order.getMemId()); @@ -241,6 +243,55 @@ public class GoodsOrderServiceImpl implements PayService { + } else if (coupon.getCouponSource() == 5) { + // 给用户发码 + JSONObject response = ChongQingCNPCService.sendCNPCTicket(coupon.getCouponKey(), order.getOrderNo(), highChildOrder.getSaleCount(), order.getMemPhone()); + + // 推送记录 + JSONObject request = new JSONObject(); + request.put("requestCode", coupon.getCouponKey()); + request.put("tradeId", order.getOrderNo()); + request.put("ticketSum", highChildOrder.getSaleCount()); + request.put("phone", order.getMemPhone()); + + HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); + highGasOrderPush.setType(OrderPushType.type10.getType()); + highGasOrderPush.setOrderNo(order.getOrderNo()); + highGasOrderPush.setCreateTime(new Date()); + highGasOrderPush.setRequestContent(request.toJSONString()); + highGasOrderPush.setReturnContent(response.toJSONString()); + highGasOrderPushMapper.insert(highGasOrderPush); + + JSONObject couponDetail = response.getJSONObject("ticketDetail"); + JSONArray codeList = response.getJSONArray("codeList"); + + for (Object data : codeList) { + HighCouponCodeOther couponCodeOther = new HighCouponCodeOther(); + couponCodeOther.setType(2); + couponCodeOther.setOrderId(order.getId()); + couponCodeOther.setChildOrderId(highChildOrder.getId()); + couponCodeOther.setCouTypeCode(couponDetail.getString("requestCode")); + couponCodeOther.setCouNo(ChongQingCNPCService.decryptCouponCode(String.valueOf(data))); + couponCodeOther.setActiveTime(DateUtil.format(couponDetail.getString("effectiveTime"), "yyyy-MM-dd")); + couponCodeOther.setValidStartDate(DateUtil.format(couponDetail.getString("effectiveTime"), "yyyy-MM-dd")); + couponCodeOther.setValidEndDate(DateUtil.format(couponDetail.getString("expiredDate"), "yyyy-MM-dd")); + couponCodeOther.setStatus(20); + couponCodeOther.setCreateTime(new Date()); + highCouponCodeOtherMapper.insert(couponCodeOther); + + // 卡卷关联用户 + HighUserCoupon highUserCoupon = new HighUserCoupon(); + highUserCoupon.setOrderId(order.getId()); + highUserCoupon.setChildOrderId(highChildOrder.getId()); + highUserCoupon.setMerchantId(coupon.getMerchantId()); + highUserCoupon.setCouponId(coupon.getId()); + highUserCoupon.setUserId(order.getMemId()); + highUserCoupon.setCreateTime(new Date()); + highUserCoupon.setQrCodeImg(couponCodeOther.getCouNo()); + highUserCoupon.setUseEndTime(couponCodeOther.getValidEndDate()); + highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 + highUserCouponMapper.insert(highUserCoupon); + } } else { HighCouponCode code = highCouponCodeService.getCouponCodeByOrderId(highChildOrder.getId()); code.setStatus(2); // 状态:1.待销售 2.未使用 3.已使用 99.预支付 @@ -248,6 +299,8 @@ public class GoodsOrderServiceImpl implements PayService { highCouponCodeService.updateCouponCode(code); // 卡卷关联用户 HighUserCoupon highUserCoupon = new HighUserCoupon(); + highUserCoupon.setOrderId(order.getId()); + highUserCoupon.setChildOrderId(highChildOrder.getId()); highUserCoupon.setMerchantId(code.getMerchantId()); highUserCoupon.setCouponId(code.getCouponId()); highUserCoupon.setUserId(order.getMemId()); diff --git a/hai-service/src/main/resources/dev/commonConfig.properties b/hai-service/src/main/resources/dev/commonConfig.properties index e9cef055..a923cedb 100644 --- a/hai-service/src/main/resources/dev/commonConfig.properties +++ b/hai-service/src/main/resources/dev/commonConfig.properties @@ -1,6 +1,12 @@ hsgDomainName=https://hsgcs.dctpay.com gasDefaultOilStationImg=https://hsgcs.dctpay.com/filesystem/default/default_oil_station.jpg +# ChongQingCNPC configuration parameters +ChongQingCnpcUrl=http://121.40.235.135:9083/d/cross/api +ChongQingCnpcMerNo=toywqvi14wenrhb3d9 +ChongQingCnpcMerKey=n2j30jxhl3rhuoci +ChongQingCnpcCouponSignKey=5ojldakiz343a6yk + # TuanYou configuration parameters tuanYouUrl=https://test05-motorcade-hcs.czb365.com tuanYouAppKey=231599775566496 diff --git a/v1/hai-v1.iml b/v1/hai-v1.iml deleted file mode 100644 index 9ecb2698..00000000 --- a/v1/hai-v1.iml +++ /dev/null @@ -1,220 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file