From 54e0b04eb69fb779fd58ee5bd1b8e04911a7b2fe Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Tue, 26 Mar 2024 17:56:02 +0800 Subject: [PATCH] Merge branch 'new-dev' into 2.0-dev # Conflicts: # hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderCreateHandleServiceImpl.java # hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderServiceImpl.java --- .../controller/Etc/EtcCustomerController.java | 279 +++++++++++ .../bweb/controller/Etc/OcrController.java | 78 +++ .../bweb/controller/HighTestController.java | 2 +- .../src/main/resources/prod/application.yml | 4 +- .../cweb/controller/HighCouponController.java | 2 + .../cweb/controller/HighGasController.java | 38 +- .../main/resources/prod-9401/application.yml | 4 +- .../src/main/resources/prod/application.yml | 4 +- .../src/main/resources/pre/application.yml | 2 +- .../com/web/controller/OrderController.java | 4 +- .../web/controller/OrderPayController.java | 2 +- .../src/main/resources/prod/application.yml | 4 +- .../com/hai/schedule/HighGasSchedule.java | 12 +- .../src/main/resources/prod/application.yml | 4 +- hai-service/pom.xml | 6 + .../java/com/hai/common/utils/RSAUtil.java | 462 ++++++++++++++++++ .../java/com/hai/config/CommonSysConfig.java | 9 + .../main/java/com/hai/config/EtcService.java | 236 +++++++++ .../main/java/com/hai/config/PetroConfig.java | 71 ++- .../java/com/hai/config/WxOrderConfig.java | 13 - .../hai/enum_type/TripartiteReqLogType.java | 2 +- .../java/com/hai/etc/EtcCarMsgService.java | 72 +++ .../java/com/hai/etc/EtcCustMsgService.java | 68 +++ .../hai/etc/impl/EtcCarMsgServiceImpl.java | 81 +++ .../hai/etc/impl/EtcCustMsgServiceImpl.java | 72 +++ .../java/com/hai/ocr/AliYunOcrService.java | 97 ++++ .../service/ApiOrderCreateHandleService.java | 11 + .../impl/ApiOrderCreateHandleServiceImpl.java | 53 ++ .../service/impl/ApiOrderServiceImpl.java | 24 + .../service/OrderCreateHandleService.java | 2 + .../impl/OrderCreateHandleServiceImpl.java | 29 ++ .../impl/OrderPaySuccessServiceImpl.java | 67 ++- .../order/service/impl/OrderServiceImpl.java | 9 +- .../hai/order/type/OrderChildGoodsType.java | 1 + .../com/hai/order/type/OrderProductType.java | 1 + .../hai/order/type/RechargePlatformType.java | 1 + .../impl/HighCouponCodeServiceImpl.java | 4 +- .../HighGasDiscountOilPriceServiceImpl.java | 2 +- .../hai/service/impl/HighGasServiceImpl.java | 231 +++++---- .../resources/dev/commonConfig.properties | 49 +- .../prod-9401/commonConfig.properties | 2 +- .../resources/prod/commonConfig.properties | 11 +- .../src/main/resources/prod/application.yml | 4 +- .../business/ApiCouponController.java | 66 +++ .../business/GzSinopecController.java | 9 - .../com/v1/controller/orderController.java | 9 + v1/src/main/resources/pre/application.yml | 2 +- v1/src/main/resources/prod/application.yml | 4 +- 48 files changed, 2008 insertions(+), 211 deletions(-) create mode 100644 hai-bweb/src/main/java/com/bweb/controller/Etc/EtcCustomerController.java create mode 100644 hai-bweb/src/main/java/com/bweb/controller/Etc/OcrController.java create mode 100644 hai-service/src/main/java/com/hai/common/utils/RSAUtil.java create mode 100644 hai-service/src/main/java/com/hai/config/EtcService.java create mode 100644 hai-service/src/main/java/com/hai/etc/EtcCarMsgService.java create mode 100644 hai-service/src/main/java/com/hai/etc/EtcCustMsgService.java create mode 100644 hai-service/src/main/java/com/hai/etc/impl/EtcCarMsgServiceImpl.java create mode 100644 hai-service/src/main/java/com/hai/etc/impl/EtcCustMsgServiceImpl.java create mode 100644 hai-service/src/main/java/com/hai/ocr/AliYunOcrService.java diff --git a/hai-bweb/src/main/java/com/bweb/controller/Etc/EtcCustomerController.java b/hai-bweb/src/main/java/com/bweb/controller/Etc/EtcCustomerController.java new file mode 100644 index 00000000..8d1838b5 --- /dev/null +++ b/hai-bweb/src/main/java/com/bweb/controller/Etc/EtcCustomerController.java @@ -0,0 +1,279 @@ +package com.bweb.controller.Etc; + +import com.alibaba.fastjson.JSONObject; +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.SessionObject; +import com.hai.common.security.UserCenter; +import com.hai.common.utils.ResponseMsgUtil; +import com.hai.config.EtcService; +import com.hai.entity.*; +import com.hai.etc.EtcCarMsgService; +import com.hai.etc.EtcCustMsgService; +import com.hai.model.ResponseData; +import com.hai.model.UserInfoModel; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping(value="/etcCustomer") +@Api(value="etc客户信息") +public class EtcCustomerController { + + Logger log = LoggerFactory.getLogger(EtcCustomerController.class); + + @Resource + private UserCenter userCenter; + + @Resource + private EtcCustMsgService etcCustMsgService; + + @Resource + private EtcCarMsgService etcCarMsgService; + + @RequestMapping(value = "/getEtcCustList", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询用户列表") + public ResponseData getEtcCustList( + @RequestParam(value = "custName", required = false) String custName, + @RequestParam(value = "phone", required = false) String phone, HttpServletRequest request + ) { + try { + + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + + Map map = new HashMap<>(5); + + map.put("userId", userInfoModel.getSecUser().getId()); + map.put("custName", custName); + map.put("phone", phone); + + return ResponseMsgUtil.success(etcCustMsgService.getEtcCustList(map)); + + } catch (Exception e) { + log.error("BsMsgController --> getMsgByList() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + + @RequestMapping(value = "insertCustomer" , method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "新增客户基本信息") + public ResponseData insertCustomer(@RequestBody EtcCustMsg etcCustMsg , HttpServletRequest request) { + try { + + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + + if (etcCustMsg == null + || etcCustMsg.getPhone() == null + ) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + etcCustMsg.setUserId(userInfoModel.getSecUser().getId()); + etcCustMsg.setUserName(userInfoModel.getSecUser().getUserName()); + etcCustMsg.setCreateTime(new Date()); + etcCustMsg.setUpdateTime(new Date()); + etcCustMsg.setStatus(0); + + etcCustMsgService.insertEtcCust(etcCustMsg); + return ResponseMsgUtil.success("成功"); + + } catch (Exception e) { + log.error("BsMsgController --> insertMsg() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/findByCustomer", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据id查询详情") + public ResponseData findByCustomer(@RequestParam(value = "id", required = true) Long id) { + try { + return ResponseMsgUtil.success(etcCustMsgService.findEtcCustById(id)); + } catch (Exception e) { + log.error("HighUserController --> findByUserId() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + + @RequestMapping(value = "editCustomer" , method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "编辑客户基本信息") + public ResponseData editCustomer(@RequestBody EtcCustMsg etcCustMsg , HttpServletRequest request) { + try { + + if (etcCustMsg == null + || etcCustMsg.getBankPhone() == null + || etcCustMsg.getAccountNo() == null + || etcCustMsg.getAddress() == null + || etcCustMsg.getCustAgentIdBront() == null + || etcCustMsg.getCustAgentIdFront() == null + || etcCustMsg.getBankCard() == null + || etcCustMsg.getBankName() == null + || etcCustMsg.getCustIdNo() == null + || etcCustMsg.getCustName() == null + ) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + etcCustMsg.setUpdateTime(new Date()); + + etcCustMsgService.updateEtcCust(etcCustMsg); + return ResponseMsgUtil.success("成功"); + + } catch (Exception e) { + log.error("BsMsgController --> insertMsg() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "editCarMsg" , method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "编辑基本信息") + public ResponseData editCarMsg(@RequestBody EtcCarMsg etcCarMsg , HttpServletRequest request) { + try { + + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + + if (etcCarMsg == null + || etcCarMsg.getCustId() == null + || etcCarMsg.getProductId() == null + || etcCarMsg.getCardVarietyId() == null + || etcCarMsg.getVehPlateNo() == null + || etcCarMsg.getVehPlateColor() == null + || etcCarMsg.getVehType() == null + || etcCarMsg.getAxlesNum() == null + || etcCarMsg.getWheelsNum() == null + || etcCarMsg.getDrivlicMainFro() == null + || etcCarMsg.getDrivlicSubFro() == null + || etcCarMsg.getHeadStockPhoto() == null + ) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + etcCarMsg.setUserId(userInfoModel.getSecUser().getId()); + etcCarMsg.setUserName(userInfoModel.getSecUser().getUserName()); + + etcCarMsg.setUpdateTime(new Date()); + etcCarMsg.setVehStatus(11); + + etcCarMsgService.insertEtcCar(etcCarMsg); + return ResponseMsgUtil.success("成功"); + + } catch (Exception e) { + log.error("BsMsgController --> insertMsg() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/getEtcCarMsgList", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询车辆列表") + public ResponseData getEtcCarMsgList( + @RequestParam(value = "vehPlateNo", required = false) String vehPlateNo, HttpServletRequest request + ) { + try { + + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + + Map map = new HashMap<>(5); + + map.put("userId", userInfoModel.getSecUser().getId()); + map.put("vehPlateNo", vehPlateNo); + + return ResponseMsgUtil.success(etcCarMsgService.getEtcCarList(map)); + + } catch (Exception e) { + log.error("BsMsgController --> getMsgByList() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/sendRealNameCode", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "请求实名认证") + public ResponseData sendRealNameCode(@RequestParam(value = "id", required = true) Long id) { + try { + + EtcCustMsg etcCustMsg = etcCustMsgService.findEtcCustById(id); + + if (etcCustMsg == null || etcCustMsg.getCustId() == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "状态错误!"); + } + + JSONObject object = EtcService.sendRealNameCode(etcCustMsg.getCustId()); + + if (object.getString("errCode").equals("0")) { + return ResponseMsgUtil.success("请求成功!"); + } + + return ResponseMsgUtil.success(object.getString("errMsg")); + + } catch (Exception e) { + log.error("HighUserController --> findByUserId() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/checkRealNameCode", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "验证实名认证编码") + public ResponseData checkRealNameCode(@RequestParam(value = "id", required = true) Long id , + @RequestParam(value = "verifyCode", required = true) String verifyCode ) { + try { + + EtcCustMsg etcCustMsg = etcCustMsgService.findEtcCustById(id); + + if (etcCustMsg == null || etcCustMsg.getCustId() == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "状态错误!"); + } + + JSONObject object = EtcService.checkRealNameCode(etcCustMsg.getCustId() , verifyCode); + + if (object.getString("errCode").equals("0")) { + return ResponseMsgUtil.success("请求成功!"); + } + + return ResponseMsgUtil.success(object.getString("errMsg")); + + } catch (Exception e) { + log.error("HighUserController --> findByUserId() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/findByCarMsg", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据id查询详情") + public ResponseData findByCarMsg(@RequestParam(value = "id", required = true) Long id) { + try { + + return ResponseMsgUtil.success(etcCarMsgService.findEtcCarById(id)); + + } catch (Exception e) { + log.error("HighUserController --> findByUserId() error!", e); + return ResponseMsgUtil.exception(e); + } + } + +} diff --git a/hai-bweb/src/main/java/com/bweb/controller/Etc/OcrController.java b/hai-bweb/src/main/java/com/bweb/controller/Etc/OcrController.java new file mode 100644 index 00000000..942531b4 --- /dev/null +++ b/hai-bweb/src/main/java/com/bweb/controller/Etc/OcrController.java @@ -0,0 +1,78 @@ +package com.bweb.controller.Etc; + + +import com.hai.common.security.UserCenter; +import com.hai.common.utils.ResponseMsgUtil; +import com.hai.config.CommonSysConst; +import com.hai.model.ResponseData; +import com.hai.ocr.AliYunOcrService; +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; + +@Controller +@RequestMapping(value = "/ocr") +@Api(value = "ocr识别") +public class OcrController { + + private static Logger log = LoggerFactory.getLogger(OcrController.class); + + @Resource + private UserCenter userCenter; + + @RequestMapping(value="/recognizeIdCard",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "身份证识别") + public ResponseData recognizeIdCard(@RequestParam(name = "url", required = true) String url) { + try { + return ResponseMsgUtil.success(AliYunOcrService.recognizeIdCard(CommonSysConst.getSysConfig().getFilesystem()+ url)); + } catch (Exception e) { + log.error("recognizeIdCard error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/recognizeBankCard",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "银行卡识别") + public ResponseData recognizeBankCard(@RequestParam(name = "url", required = true) String url) { + try { + return ResponseMsgUtil.success(AliYunOcrService.recognizeBankCard(CommonSysConst.getSysConfig().getFilesystem()+ url)); + } catch (Exception e) { + log.error("recognizeBankCard error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/recognizeBankAccount",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "银行开户许可证识别") + public ResponseData recognizeBankAccount(@RequestParam(name = "url", required = true) String url) { + try { + return ResponseMsgUtil.success(AliYunOcrService.recognizeBankAccount(CommonSysConst.getSysConfig().getFilesystem()+ url)); + } catch (Exception e) { + log.error("recognizeBankCard error!",e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/recognizeBusinessLicense",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "营业执照识别") + public ResponseData recognizeBusinessLicense(@RequestParam(name = "url", required = true) String url) { + try { + return ResponseMsgUtil.success(AliYunOcrService.recognizeBusinessLicense(CommonSysConst.getSysConfig().getFilesystem()+ url)); + } catch (Exception e) { + log.error("recognizeBusinessLicense error!",e); + return ResponseMsgUtil.exception(e); + } + } +} diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java b/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java index 9020abe1..9261ee54 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java @@ -1 +1 @@ - package com.bweb.controller; import com.alibaba.fastjson.JSONArray; 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.pay.util.sdk.WXPayConstants; import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.WxUtils; import com.hai.config.*; import com.hai.dao.HighCouponCodeOtherMapper; import com.hai.entity.*; import com.hai.enum_type.GasOilPriceStatusEnum; import com.hai.model.HighMerchantModel; import com.hai.model.HighMerchantStoreModel; import com.hai.model.ResponseData; import com.hai.openApi.config.BlxConfig; import com.hai.openApi.service.ApiCouponService; import com.hai.order.service.OrderService; import com.hai.order.type.OrderProductType; import com.hai.order.type.OrderRefundOpUserType; import com.hai.order.utils.OrderUtil; import com.hai.pay.channel.huipay.config.HuiConfig; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.bouncycastle.LICENSE; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.io.FileOutputStream; import java.io.InputStream; import java.math.BigDecimal; import java.net.URL; import java.net.URLConnection; 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 BsOrderRebateService bsOrderRebateService; @Resource private PetroConfig petroConfig; @Resource private HighGoldRecService highGoldRecService; @Resource private OrderService orderService; @Resource private HighUserCardService highUserCardService; @Resource private HighOrderService highOrderService; @Resource private HighUserService highUserService; @Resource private HighGasService gasService; @Resource private HighMerchantService highMerchantService; @Resource private HighMerchantStoreService highMerchantStoreService; @Resource private HighGasOilPriceService highGasOilPriceService; @Resource private HighCouponCodeOtherMapper highCouponCodeOtherMapper; @Resource private OutRechargeOrderService outRechargeOrderService; @Resource private HuiConfig huiConfig; @Resource private CommonService commonService; @Resource private HighOilCardOrderService highOilCardOrderService; @Resource private HighGasOrderService gasOrderService; @Resource private ShellGroupService shellGroupService; @Resource private HighMerchantStoreService merchantStoreService; @RequestMapping(value = "/gasSyncPayment", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "重庆壳牌推送") public ResponseData gasSyncPayment(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighGasOrder order = gasOrderService.getDetailByOrderNo(orderNo); if (order != null) { // 查询油站 HighMerchantStore store = merchantStoreService.getDetailById(order.getStoreId()); if (store == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到门店"); } return ResponseMsgUtil.success( // 推送加好油 shellGroupService.gasSyncPayment(order.getOrderNo(), store.getStoreKey(), order.getPayTime(), order.getGasRefuelPrice(), order.getGasOilNo(), order.getGasGunNo(), order.getPayPrice(), order.getTotalDeductionPrice() ) ); } return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighOrderController --> gasSyncPayment() 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 = "/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"); return ResponseMsgUtil.success(array); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardConsume() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/createOrder", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "创建订单") public ResponseData createOrder(@RequestBody JSONObject object) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20231255604"); mapPost.put("timetable" , new Date().getTime()); mapPost.put("orderNo" , OrderUtil.generateOrderNo()); mapPost.put("productType" , object.getString("productType")); mapPost.put("content" , object.getJSONObject("content").toString()); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "7CCB9CB8B630CDB8E32A694426BED12B", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/order/createOrder" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/payOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "支付订单") public ResponseData payOrder(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("mchOrderNo" , mchOrderNo); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsgcs.dctpay.com/v1/order/orderPay" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryOrderDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询订单详情") public ResponseData queryOrderDetail(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("mchOrderNo" , mchOrderNo); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/queryOrderDetail" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/deposit", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡充值") public ResponseData deposit(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); HighChildOrder highChildOrder = order.getHighChildOrderList().get(0); if (order.getOrderStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } // 汇联通充值 String goodsDesc = "汇联通充值"+order.getPayPrice()+"元"; String tranDesc = ""; String businessType = "ghk_deposit"; String orderNoAgain = OrderUtil.generateOrderNo(); order.setOrderStatus(Integer.valueOf(3)); order.setRemarks("工会卡再次充值订单号" + orderNoAgain); highOrderService.updateOrder(order); // 汇联通卡充值 JSONObject deposit = HuiLianTongUnionCardConfig.deposit(orderNoAgain, highChildOrder.getGoodsSpecName(), order.getPayPrice(), businessType, order.getPaySerialNo(), goodsDesc); return ResponseMsgUtil.success( HuiLianTongUnionCardConfig.resolveResponse(deposit.getString("data"))); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getHuiLianTongCardByCardNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据卡号查询汇联通工会卡详情") public ResponseData getHuiLianTongCardByCardNo(@RequestParam(name = "cardNo", required = true) String cardNo) { try { // 查询工会卡 JSONObject cardInfo = HuiLianTongUnionCardConfig.queryBalance(cardNo); JSONObject resolveResponse = HuiLianTongUnionCardConfig.resolveResponse(cardInfo.getString("data")); return ResponseMsgUtil.success(resolveResponse); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardByCardNo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/consumption", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡支付") public ResponseData consumption(@RequestParam(name = "payRealPrice", required = true) BigDecimal payRealPrice, @RequestParam(name = "cardNo", required = true) String cardNo) { try { String goodsDesc = ""; String tranDesc = ""; String instCode = "11101652"; String businessType = "hisen_consume"; // 工会卡支付 JSONObject consumption = HuiLianTongUnionCardConfig.consumption(OrderUtil.generateOrderNo(), cardNo, payRealPrice, businessType, instCode, goodsDesc, tranDesc); if (!consumption.getString("respCode").equals("0000")) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumption.getString("respMessage")); } // 响应参数 JSONObject consumptionResult = HuiLianTongUnionCardConfig.resolveResponse(consumption.getString("data")); if (consumptionResult.getBoolean("success") != true) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumptionResult.getString("message")); } return ResponseMsgUtil.success(consumptionResult); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardByCardNo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/refundOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡退款") public ResponseData refundOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); if (order.getOrderStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } orderService.refundOrder(order, OrderProductType.getDataByType(order.getProductType()).getName() + "退款",OrderRefundOpUserType.TYPE1, null, "系统自动退款"); if (order.getProductType().equals(4)) { HighUser user = highUserService.findByUserId(order.getMemId()); // 获取应退款积分 int integralNum = order.getTotalPrice().multiply(new BigDecimal(100)).intValue(); if ( integralNum> user.getGold()) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "积分数量不足"); } String remark = "订单" + order.getOrderNo() + "退还积分:" + integralNum; // 积分退款 highUserService.goldHandle(user.getId(), integralNum,2, 3, order.getId() , remark , order.getOrderNo()); } return ResponseMsgUtil.success("退款成功"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/externalOrderRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "对外订单退款") public ResponseData externalOrderRefund(@RequestParam(name = "paySerialNo", required = true) String paySerialNo, @RequestParam(name = "WxMchId", required = true) String WxMchId, @RequestParam(name = "payRealPrice", required = true) String payRealPrice) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "B94B5E62807FA56A7260AB581D8A1B48"); mapPost.put("merchId" , "20230394901"); mapPost.put("paySerialNo" , paySerialNo); mapPost.put("wxMchId" , WxMchId); mapPost.put("payRealPrice" , payRealPrice); mapPost.put("refundPrice" , payRealPrice); Map map = new HashMap<>(); map.put("apiKey" , "B94B5E62807FA56A7260AB581D8A1B48"); map.put("merchId" , "20230394901"); map.put("paySerialNo" , paySerialNo); map.put("wxMchId" , WxMchId); map.put("payRealPrice" , payRealPrice); map.put("refundPrice" , payRealPrice); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/order/externalOrderRefund" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getBlxCouponBalance", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询停车券") public ResponseData getBlxCouponBalance(@RequestParam(name = "phone", required = true) String phone) { try { highUserCardService.getBlxCouponBalance(phone); return ResponseMsgUtil.success("object"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryJsParking", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询捷顺停车场") public ResponseData queryJsParking(@RequestParam(name = "gps", required = true) String gps) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("gps" , gps); mapPost.put("range" , "1000"); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/queryJsParking" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getUserCouponPage", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询捷顺停车场") public ResponseData getUserCouponPage(@RequestParam(name = "phone", required = true) String phone) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("phone" , phone); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/getUserCouponPage" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryJsOrderList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询车牌订单列表信息") public ResponseData queryJsOrderList(@RequestParam(name = "carNo", required = true) String carNo, @RequestParam(name = "orderStatus", required = true) String orderStatus) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("orderStatus" , orderStatus); mapPost.put("carNo" , carNo); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/queryJsOrderList" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/sendCoupon", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "发放券") public ResponseData sendCoupon(@RequestParam(name = "couponCode", required = true) String couponCode, @RequestParam(name = "receiverCount", required = true) String receiverCount, @RequestParam(name = "receiverPhone", required = true) String receiverPhone) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/getCouponList" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/preorder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "发起支付") public ResponseData preorder() { try { JSONObject object = new JSONObject(); object.put("outTradeNo" , "HUI" + OrderUtil.generateOrderNo()); object.put("transType" , "JSAPI"); object.put("payMode" , "WECHAT"); object.put("totalAmount" , "0.01"); object.put("profitSharing" , 0); object.put("subject" , "测试"); object.put("userId" , "oUGn_4unIjp90MY-oEXluY4laDrQ"); return ResponseMsgUtil.success(huiConfig.preorder(object)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryGasInfoListByPage", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询团油门店") public ResponseData queryGasInfoListByPage() { try { HighMerchantModel merchant = highMerchantService.getMerchantById(39L); 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.setSourceType(2); 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.setPrestoreType(0); 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.getString("oilNo")); if (highGasOilPrice == null) { highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getString("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")); highGasOilPrice.setStatus(GasOilPriceStatusEnum.status1.getStatus()); } else { highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getString("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.setSourceType(2); 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.setPrestoreType(0); 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.getString("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("完成"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/test", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "测试") public ResponseData test(@RequestParam(name = "no", required = true) String no) { try { JSONObject jsonObject = DianConfig.getGasInfoByGasId(no); return ResponseMsgUtil.success(jsonObject); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getGasInfoAll", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取全量油站") public ResponseData getGasInfoAll() { try { HighMerchantModel merchant = highMerchantService.getMerchantById(39L); JSONObject jsonObject = DianConfig.getGasInfoAll(); JSONArray resultObject = jsonObject.getObject("result", JSONArray.class); for (int i = 0; i < resultObject.size();i++) { Object objectData = resultObject.get(i); JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(objectData)); HighMerchantStore highMerchantStore; HighGasOilPrice highGasOilPrice; HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreByKey(object.getString("jyzid")); SecRegion region = commonService.getRegionsByName(object.getString("province")); if (store != null) { store.setType(1); store.setSourceType(6); store.setMerchantId(merchant.getId()); store.setCompanyId(merchant.getCompanyId()); store.setStoreKey(object.getString("jyzid")); store.setStoreName(object.getString("mingcheng")); store.setStoreLogo(object.getString("tupian")); store.setRegionId(region.getRegionId()); store.setRegionName(object.getString("province")); store.setAddress(object.getString("dizhi")); store.setLongitude(object.getString("lng")); store.setLatitude(object.getString("lat")); store.setStatus(object.getInteger("zhuangtai")); store.setPrestoreType(0); 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.getString("youhao")); if (highGasOilPrice == null) { highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getString("youhao")); highGasOilPrice.setOilNoName(oilPriceObject.getString("youhao") + "#"); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oiltype")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oiltype").equals("1") ? "汽油": "柴油"); highGasOilPrice.setStatus(GasOilPriceStatusEnum.status1.getStatus()); } else { highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getString("youhao")); highGasOilPrice.setOilNoName( oilPriceObject.getString("youhao") + "#"); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oiltype")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oiltype").equals("1") ? "汽油": "柴油"); } highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } else { highMerchantStore = new HighMerchantStore(); highMerchantStore.setType(1); highMerchantStore.setSourceType(6); highMerchantStore.setMerchantId(merchant.getId()); highMerchantStore.setCompanyId(merchant.getCompanyId()); highMerchantStore.setStoreKey(object.getString("jyzid")); highMerchantStore.setStoreName(object.getString("mingcheng")); highMerchantStore.setStoreLogo(object.getString("tupian")); highMerchantStore.setRegionId(region.getRegionId()); highMerchantStore.setRegionName(object.getString("province")); highMerchantStore.setAddress(object.getString("dizhi")); highMerchantStore.setLongitude(object.getString("lng")); highMerchantStore.setLatitude(object.getString("lat")); highMerchantStore.setStatus(1); highMerchantStore.setPrestoreType(0); 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.getString("youhao")); highGasOilPrice.setOilNoName(oilPriceObject.getString("youhao") + "#"); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oiltype")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oiltype").equals("1") ? "汽油": "柴油"); highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } } return ResponseMsgUtil.success(jsonObject); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getOrderPay", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "getOrderPay") public ResponseData getOrderPay(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOilCardOrder highOilCardOrder = highOilCardOrderService.findOrder(orderNo); highOilCardOrder.setStatus(2); JSONObject object = KytcService.getOrderPay(highOilCardOrder.getThirdOrderNo() , highOilCardOrder.getPrice() , highOilCardOrder.getCardNo()); highOilCardOrder.setExt1(object.toJSONString()); highOilCardOrderService.updateOilCardOrder(highOilCardOrder); return ResponseMsgUtil.success("成功"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getOrderInfo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "getOrderInfo") public ResponseData getOrderInfo(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOilCardOrder highOilCardOrder = highOilCardOrderService.findOrder(orderNo); JSONObject object = KytcService.getOrderInfo(highOilCardOrder.getThirdOrderNo()); highOilCardOrder.setExt2(object.toJSONString()); if (object.getBoolean("State") == true) { JSONObject jsonObject = object.getJSONObject("Data"); if (jsonObject.getInteger("OilOrderState") == 2) { highOilCardOrder.setStatus(3); HighOrder highOrder = highOrderService.getOrderByOrderNo(highOilCardOrder.getOrderNo()); highOrder.setOrderStatus(3); highOrder.getHighChildOrderList().get(0).setChildOrderStatus(3); highOrderService.updateOrder(highOrder); } } highOilCardOrderService.updateOilCardOrder(highOilCardOrder); return ResponseMsgUtil.success("成功"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getLogisticsMsg", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取物流") public ResponseData getLogisticsMsg(@RequestParam(name = "no", required = true) String no) { try { JSONObject jsonObjects = CommonConfig.getLogisticsMsg(no); return ResponseMsgUtil.success(jsonObjects); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } // @RequestMapping(value = "/synCouponRule", method = RequestMethod.GET) // @ResponseBody // @ApiOperation(value = "获取卡券") // public ResponseData synCouponRule() { // try { // return ResponseMsgUtil.success(PetroConfig.synCouponRule()); // } catch (Exception e) { // log.error("HighOrderController --> getBackendToken() error!", e); // return ResponseMsgUtil.exception(e); // } // } // @RequestMapping(value = "/getCoupon", method = RequestMethod.GET) // @ResponseBody // @ApiOperation(value = "卡券下单") // public ResponseData getCoupon() { // try { // // JSONObject jsonObject = PetroConfig.getCoupon("16000443991501" , "18090580471" , OrderUtil.generateOrderNo()); // String data = PetroConfig.decrypt(jsonObject.getString("biz_content")); // JSONObject object = JSONObject.parseObject(data); // // return ResponseMsgUtil.success(object); // } catch (Exception e) { // log.error("HighOrderController --> getBackendToken() error!", e); // return ResponseMsgUtil.exception(e); // } // } @RequestMapping(value = "/deleteOilNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "删除油品") public ResponseData deleteOilNo() { try { gasService.deleteOilNo(); return ResponseMsgUtil.success("1231243"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getJiaHaoYouAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "加好油油站刷新") public ResponseData getJiaHaoYouAllStation() { try { gasService.getJiaHaoYouAllStation(); return ResponseMsgUtil.success("1231243"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getDianAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "点点网络") public ResponseData getDianAllStation() { try { gasService.getDianAllStation(); return ResponseMsgUtil.success("1231243"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() err1or!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/integralRebateOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "积分返利") public ResponseData integralRebateOrder() { try { // 查询满足初步返利条件订单 List order = highOrderService.integralRebateOrder(); for (HighOrder highOrder : order) { // 查询是否存在积分记录 Map map = new HashMap<>(); map.put("goldType", 1); map.put("resType", 4); map.put("userId", highOrder.getMemId()); map.put("resId", highOrder.getId()); List goldRecs = highGoldRecService.getGoldRec(map); // 判断是否重复赠送积分 if (goldRecs.size() == 0) { bsOrderRebateService.insertOrderRebate(highOrder); } highOrder.setWhetherRebate(true); highOrderService.updateOrderDetail(highOrder); } return ResponseMsgUtil.success("1231243"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() err1or!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getApiCoupon", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取卡券") public ResponseData getApiCoupon() { try { // 查询满足初步返利条件订单 List order = highOrderService.integralRebateOrder(); for (HighOrder highOrder : order) { // 查询是否存在积分记录 Map map = new HashMap<>(); map.put("goldType", 1); map.put("resType", 4); map.put("userId", highOrder.getMemId()); map.put("resId", highOrder.getId()); List goldRecs = highGoldRecService.getGoldRec(map); // 判断是否重复赠送积分 if (goldRecs.size() == 0) { bsOrderRebateService.insertOrderRebate(highOrder); } highOrder.setWhetherRebate(true); highOrderService.updateOrderDetail(highOrder); } return ResponseMsgUtil.success("1231243"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() err1or!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/couponDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据订单号查询中石油卡券详情") public ResponseData couponDetail(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); mapPost.put("timetable" , new Date().getTime()); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/apiCoupon/getCheckCode" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/refundApi", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "支付退款") public ResponseData refundApi(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20231255604"); mapPost.put("mchOrderNo" , mchOrderNo); // mapPost.put("timetable" , new Date().getTime()); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "7CCB9CB8B630CDB8E32A694426BED12B", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/order/refund" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/checkAccountBalance", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询余额") public ResponseData checkAccountBalance() { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20240133101"); // mapPost.put("mchOrderNo" , mchOrderNo); mapPost.put("timetable" , new Date().getTime()); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "1F43EEC88D0F99FC201D81143F9EED85", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/apiMerchants/checkAccountBalance" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getStationStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询油站") public ResponseData getStationStore() { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20240133101"); // mapPost.put("mchOrderNo" , mchOrderNo); // mapPost.put("timetable" , new Date().getTime()); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "1F43EEC88D0F99FC201D81143F9EED85", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/refuelOnline/getStationStore" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/decryptPetroConfig", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "解码") public ResponseData decryptPetroConfig(@RequestParam(name = "content", required = true) String content) { try { PetroConfig.init(1); String data = PetroConfig.decrypt(content); JSONObject object = JSONObject.parseObject(data); return ResponseMsgUtil.success(object); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/synCouponRule", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "synCouponRule") public ResponseData synCouponRule() { try { PetroConfig.init(2); JSONObject jsonObject = petroConfig.synCouponRule(); String data = PetroConfig.decrypt(jsonObject.getString("jsonResult")); JSONArray jsonArray = JSONArray.parseArray(data); return ResponseMsgUtil.success(jsonArray); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getCoupon", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "getCoupon") public ResponseData getCoupon(@RequestParam(name = "code", required = true) String code) { try { PetroConfig.init(2); // 发放卡券 JSONObject jsonObject = petroConfig.getCoupon(code ,"18090580471"); String data = PetroConfig.decrypt(jsonObject.getString("jsonResult")); JSONObject object = JSONObject.parseObject(data); return ResponseMsgUtil.success(object); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/decrypt", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "decrypt") public ResponseData decrypt(@RequestParam(name = "jsonResult", required = true) String jsonResult) { try { PetroConfig.init(2); String data = PetroConfig.decrypt(jsonResult); JSONObject object = JSONObject.parseObject(data); return ResponseMsgUtil.success(object); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/jNiuGoodsList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "jNiuGoodsList") public ResponseData jNiuGoodsList() { try { JSONObject object = RechargeConfig.jNiuGoodsList(); JSONArray array = object.getJSONArray("data"); List list = new ArrayList<>(); for (int i = 0; i < array.size(); i++) { JSONObject jsonObject = array.getJSONObject(i); JSONArray jsonArray = jsonObject.getJSONArray("goodsOption"); for (int j = 0; j < jsonArray.size(); j++) { JSONObject goodsOption = jsonArray.getJSONObject(j); JSONArray childArray = goodsOption.getJSONArray("child"); for (int t = 0; t < childArray.size(); t++) { JSONObject child = childArray.getJSONObject(j); JSONObject data = new JSONObject(); data.put("title" , jsonObject.getString("sort_title") + goodsOption.getString("name")); data.put("goodsId" , child.getString("goods_id")); data.put("goodsOptionId" , child.getString("goods_option_id")); data.put("platPrice" , child.getString("plat_price")); data.put("officialPrice" , child.getString("official_price")); list.add(data); } } } return ResponseMsgUtil.success(list); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/rechargeOrderByJn", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "rechargeOrderByJn") public ResponseData rechargeOrderByJn() { try { JSONObject object = new JSONObject(); object.put("orderNo", OrderUtil.generateOrderNo()); object.put("option_id", "632"); object.put("phone", "18090580471"); JSONObject returnObject = RechargeConfig.rechargeOrderByJn(object); return ResponseMsgUtil.success(returnObject); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/checkOrderByJn", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "checkOrderByJn") public ResponseData checkOrderByJn(@RequestParam(name = "order_no", required = true) String order_no) { try { JSONObject object = new JSONObject(); object.put("orderNo" , order_no); int status = 0; JSONObject jsonObject = RechargeConfig.checkOrderByJn(object); if (jsonObject.getJSONObject("data") != null) { JSONObject objectData= jsonObject.getJSONObject("data"); // // 10充值中 20充值完成 -10 充值失败 // -1取消,0充值中 ,1充值成功,2充值失败,3部分成功 if (objectData.getInteger("status") == 10) { status = 0; } else if (objectData.getInteger("status") == 20) { status = 1; } else if (objectData.getInteger("status") == -10) { status = 2; } } return ResponseMsgUtil.success(status); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getListRechargeOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "getListRechargeOrder") public ResponseData getListRechargeOrder(@RequestParam(name = "order_no", required = true) String order_no) { try { log.info("处理话费订单定时任务开始"); Map map = new HashMap<>(); map.put("payStatus", String.valueOf(102)); map.put("rechargeStatus", String.valueOf(201)); List orderList = outRechargeOrderService.getListRechargeOrder(map); log.info("处理话费订单条数:" + orderList.size()); if (orderList.size() > 0) { for (OutRechargeOrder order : orderList) { try { outRechargeOrderService.prepaidRechargeHandle(order); } catch (Exception e) { log.info("话费定时任务订单业务出现异常", e); } } } return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file + package com.bweb.controller; import com.alibaba.fastjson.JSONArray; 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.pay.util.sdk.WXPayConstants; import com.hai.common.utils.*; import com.hai.config.*; import com.hai.entity.*; import com.hai.enum_type.GasOilPriceStatusEnum; import com.hai.model.HighMerchantModel; import com.hai.model.HighMerchantStoreModel; import com.hai.model.ResponseData; import com.hai.openApi.config.BlxConfig; import com.hai.openApi.service.ApiOrderService; import com.hai.order.service.OrderService; import com.hai.order.type.OrderProductType; import com.hai.order.type.OrderRefundOpUserType; import com.hai.order.utils.OrderUtil; import com.hai.pay.channel.huipay.config.HuiConfig; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; 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.nio.charset.StandardCharsets; 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 BsOrderRebateService bsOrderRebateService; @Resource private PetroConfig petroConfig; @Resource private HighGoldRecService highGoldRecService; @Resource private OrderService orderService; @Resource private HighUserCardService highUserCardService; @Resource private HighOrderService highOrderService; @Resource private HighUserService highUserService; @Resource private HighGasService gasService; @Resource private HighMerchantService highMerchantService; @Resource private HighMerchantStoreService highMerchantStoreService; @Resource private HighGasOilPriceService highGasOilPriceService; @Resource private OutRechargeOrderService outRechargeOrderService; @Resource private HuiConfig huiConfig; @Resource private CommonService commonService; @Resource private HighOilCardOrderService highOilCardOrderService; @Resource private HighGasOrderService gasOrderService; @Resource private ShellGroupService shellGroupService; @Resource private HighMerchantStoreService merchantStoreService; @Resource private ApiOrderService apiOrderService; @Resource private ApiMerchantsService apiMerchantsService; @Resource private BlxConfig blxConfig; @Resource private HighGasOilGunNoService gasOilGunNoService; @RequestMapping(value = "/gasSyncPayment", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "重庆壳牌推送") public ResponseData gasSyncPayment(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighGasOrder order = gasOrderService.getDetailByOrderNo(orderNo); if (order != null) { // 查询油站 HighMerchantStore store = merchantStoreService.getDetailById(order.getStoreId()); if (store == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到门店"); } return ResponseMsgUtil.success( // 推送加好油 shellGroupService.gasSyncPayment(order.getOrderNo(), store.getStoreKey(), order.getPayTime(), order.getGasRefuelPrice(), order.getGasOilNo(), order.getGasGunNo(), order.getPayPrice(), order.getTotalDeductionPrice() ) ); } return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighOrderController --> gasSyncPayment() 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 = "/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"); return ResponseMsgUtil.success(array); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardConsume() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/createOrder", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "创建订单") public ResponseData createOrder(@RequestBody JSONObject object) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230394901"); mapPost.put("timetable" , new Date().getTime()); mapPost.put("orderNo" , OrderUtil.generateOrderNo()); mapPost.put("productType" , object.getString("productType")); mapPost.put("content" , object.getJSONObject("content").toString()); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "B94B5E62807FA56A7260AB581D8A1B48", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://1.95.43.71:9902/v1/order/createOrder" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/payOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "支付订单") public ResponseData payOrder(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "B94B5E62807FA56A7260AB581D8A1B48"); mapPost.put("merchId" , "20230394901"); mapPost.put("mchOrderNo" , mchOrderNo); Map map = new HashMap<>(); map.put("apiKey" , "B94B5E62807FA56A7260AB581D8A1B48"); map.put("merchId" , "20230394901"); map.put("mchOrderNo" , mchOrderNo); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/order/orderPay" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryOrderDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询订单详情") public ResponseData queryOrderDetail(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("mchOrderNo" , mchOrderNo); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/queryOrderDetail" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/deposit", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡充值") public ResponseData deposit(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); HighChildOrder highChildOrder = order.getHighChildOrderList().get(0); if (order.getOrderStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } // 汇联通充值 String goodsDesc = "汇联通充值"+order.getPayPrice()+"元"; String tranDesc = ""; String businessType = "ghk_deposit"; String orderNoAgain = OrderUtil.generateOrderNo(); order.setOrderStatus(Integer.valueOf(3)); order.setRemarks("工会卡再次充值订单号" + orderNoAgain); highOrderService.updateOrder(order); // 汇联通卡充值 JSONObject deposit = HuiLianTongUnionCardConfig.deposit(orderNoAgain, highChildOrder.getGoodsSpecName(), order.getPayPrice(), businessType, order.getPaySerialNo(), goodsDesc); return ResponseMsgUtil.success( HuiLianTongUnionCardConfig.resolveResponse(deposit.getString("data"))); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getHuiLianTongCardByCardNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据卡号查询汇联通工会卡详情") public ResponseData getHuiLianTongCardByCardNo(@RequestParam(name = "cardNo", required = true) String cardNo) { try { // 查询工会卡 JSONObject cardInfo = HuiLianTongUnionCardConfig.queryBalance(cardNo); JSONObject resolveResponse = HuiLianTongUnionCardConfig.resolveResponse(cardInfo.getString("data")); return ResponseMsgUtil.success(resolveResponse); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardByCardNo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/consumption", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡支付") public ResponseData consumption(@RequestParam(name = "payRealPrice", required = true) BigDecimal payRealPrice, @RequestParam(name = "cardNo", required = true) String cardNo) { try { String goodsDesc = ""; String tranDesc = ""; String instCode = "11101652"; String businessType = "hisen_consume"; // 工会卡支付 JSONObject consumption = HuiLianTongUnionCardConfig.consumption(OrderUtil.generateOrderNo(), cardNo, payRealPrice, businessType, instCode, goodsDesc, tranDesc); if (!consumption.getString("respCode").equals("0000")) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumption.getString("respMessage")); } // 响应参数 JSONObject consumptionResult = HuiLianTongUnionCardConfig.resolveResponse(consumption.getString("data")); if (consumptionResult.getBoolean("success") != true) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumptionResult.getString("message")); } return ResponseMsgUtil.success(consumptionResult); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardByCardNo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/refundOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡退款") public ResponseData refundOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); if (order.getOrderStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } orderService.refundOrder(order, OrderProductType.getDataByType(order.getProductType()).getName() + "退款",OrderRefundOpUserType.TYPE1, null, "系统自动退款"); if (order.getProductType().equals(4)) { HighUser user = highUserService.findByUserId(order.getMemId()); // 获取应退款积分 int integralNum = order.getTotalPrice().multiply(new BigDecimal(100)).intValue(); if ( integralNum> user.getGold()) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "积分数量不足"); } String remark = "订单" + order.getOrderNo() + "退还积分:" + integralNum; // 积分退款 highUserService.goldHandle(user.getId(), integralNum,2, 3, order.getId() , remark , order.getOrderNo()); } return ResponseMsgUtil.success("退款成功"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/externalOrderRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "对外订单退款") public ResponseData externalOrderRefund(@RequestParam(name = "paySerialNo", required = true) String paySerialNo, @RequestParam(name = "WxMchId", required = true) String WxMchId, @RequestParam(name = "payRealPrice", required = true) String payRealPrice) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "B94B5E62807FA56A7260AB581D8A1B48"); mapPost.put("merchId" , "20230394901"); mapPost.put("paySerialNo" , paySerialNo); mapPost.put("wxMchId" , WxMchId); mapPost.put("payRealPrice" , payRealPrice); mapPost.put("refundPrice" , payRealPrice); Map map = new HashMap<>(); map.put("apiKey" , "B94B5E62807FA56A7260AB581D8A1B48"); map.put("merchId" , "20230394901"); map.put("paySerialNo" , paySerialNo); map.put("wxMchId" , WxMchId); map.put("payRealPrice" , payRealPrice); map.put("refundPrice" , payRealPrice); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/order/externalOrderRefund" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getBlxCouponBalance", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询停车券") public ResponseData getBlxCouponBalance(@RequestParam(name = "phone", required = true) String phone) { try { highUserCardService.getBlxCouponBalance(phone); return ResponseMsgUtil.success("object"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryJsParking", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询捷顺停车场") public ResponseData queryJsParking(@RequestParam(name = "gps", required = true) String gps) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("gps" , gps); mapPost.put("range" , "1000"); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/queryJsParking" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getUserCouponPage", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询捷顺停车场") public ResponseData getUserCouponPage(@RequestParam(name = "phone", required = true) String phone) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("phone" , phone); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/getUserCouponPage" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryJsOrderList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询车牌订单列表信息") public ResponseData queryJsOrderList(@RequestParam(name = "carNo", required = true) String carNo, @RequestParam(name = "orderStatus", required = true) String orderStatus) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("orderStatus" , orderStatus); mapPost.put("carNo" , carNo); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/queryJsOrderList" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/sendCoupon", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "发放券") public ResponseData sendCoupon(@RequestParam(name = "couponCode", required = true) String couponCode, @RequestParam(name = "receiverCount", required = true) String receiverCount, @RequestParam(name = "receiverPhone", required = true) String receiverPhone) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/getCouponList" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/preorder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "发起支付") public ResponseData preorder() { try { JSONObject object = new JSONObject(); object.put("outTradeNo" , "HUI" + OrderUtil.generateOrderNo()); object.put("transType" , "JSAPI"); object.put("payMode" , "WECHAT"); object.put("totalAmount" , "0.01"); object.put("profitSharing" , 0); object.put("subject" , "测试"); object.put("userId" , "oUGn_4unIjp90MY-oEXluY4laDrQ"); return ResponseMsgUtil.success(huiConfig.preorder(object)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryGasInfoListByPage", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询团油门店") public ResponseData queryGasInfoListByPage() { try { HighMerchantModel merchant = highMerchantService.getMerchantById(39L); 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")); JSONArray gasGunList = object.getJSONArray("gasGunList"); if (store != null) { store.setType(1); store.setSourceType(2); 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.setPrestoreType(0); 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.getString("oilNo")); if (highGasOilPrice == null) { highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getString("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceCost(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); highGasOilPrice.setStatus(GasOilPriceStatusEnum.status1.getStatus()); } else { highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getString("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceCost(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); highGasOilPrice.setStatus(GasOilPriceStatusEnum.status1.getStatus()); } highGasOilPriceService.editGasOilPrice(highGasOilPrice); for (Object o : gasGunList) { JSONObject gunNoObject = (JSONObject) o; HighGasOilGunNo gasOilGunNo = gasOilGunNoService.getDetailByStoreAndGunNo(highGasOilPrice.getMerchantStoreId(), gunNoObject.getString("gunNo")); if (gasOilGunNo == null) { gasOilGunNo = new HighGasOilGunNo(); gasOilGunNo.setGasOilPriceId(highGasOilPrice.getId()); gasOilGunNo.setStoreId(highGasOilPrice.getMerchantStoreId()); gasOilGunNo.setOilNo(highGasOilPrice.getOilNo()); gasOilGunNo.setOilNoName(highGasOilPrice.getOilNoName()); gasOilGunNo.setOilType(highGasOilPrice.getOilType()); gasOilGunNo.setOilTypeName(highGasOilPrice.getOilTypeName()); gasOilGunNo.setGunNo(gunNoObject.getString("gunNo")); gasOilGunNo.setStatus(1); gasOilGunNoService.editGunNo(gasOilGunNo); } } } } else { highMerchantStore = new HighMerchantStore(); highMerchantStore.setType(1); highMerchantStore.setSourceType(2); 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.setPrestoreType(0); 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.getString("oilNo")); highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); highGasOilPrice.setPriceCost(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); highGasOilPrice.setStatus(GasOilPriceStatusEnum.status1.getStatus()); highGasOilPriceService.editGasOilPrice(highGasOilPrice); for (Object o : gasGunList) { JSONObject gunNoObject = (JSONObject) o; HighGasOilGunNo gasOilGunNo = gasOilGunNoService.getDetailByStoreAndGunNo(highGasOilPrice.getMerchantStoreId(), gunNoObject.getString("gunNo")); if (gasOilGunNo == null) { gasOilGunNo = new HighGasOilGunNo(); gasOilGunNo.setGasOilPriceId(highGasOilPrice.getId()); gasOilGunNo.setStoreId(highGasOilPrice.getMerchantStoreId()); gasOilGunNo.setOilNo(highGasOilPrice.getOilNo()); gasOilGunNo.setOilNoName(highGasOilPrice.getOilNoName()); gasOilGunNo.setOilType(highGasOilPrice.getOilType()); gasOilGunNo.setOilTypeName(highGasOilPrice.getOilTypeName()); gasOilGunNo.setGunNo(gunNoObject.getString("gunNo")); gasOilGunNo.setStatus(1); gasOilGunNoService.editGunNo(gasOilGunNo); } } } } } } return ResponseMsgUtil.success("完成"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/test", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "测试") public ResponseData test(@RequestParam(name = "no", required = true) String no) { try { JSONObject jsonObject = DianConfig.getGasInfoByGasId(no); return ResponseMsgUtil.success(jsonObject); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getGasInfoAll", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取全量油站") public ResponseData getGasInfoAll() { try { HighMerchantModel merchant = highMerchantService.getMerchantById(39L); JSONObject jsonObject = DianConfig.getGasInfoAll(); JSONArray resultObject = jsonObject.getObject("result", JSONArray.class); for (int i = 0; i < resultObject.size();i++) { Object objectData = resultObject.get(i); JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(objectData)); HighMerchantStore highMerchantStore; HighGasOilPrice highGasOilPrice; HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreByKey(object.getString("jyzid")); SecRegion region = commonService.getRegionsByName(object.getString("province")); if (store != null) { store.setType(1); store.setSourceType(6); store.setMerchantId(merchant.getId()); store.setCompanyId(merchant.getCompanyId()); store.setStoreKey(object.getString("jyzid")); store.setStoreName(object.getString("mingcheng")); store.setStoreLogo(object.getString("tupian")); store.setRegionId(region.getRegionId()); store.setRegionName(object.getString("province")); store.setAddress(object.getString("dizhi")); store.setLongitude(object.getString("lng")); store.setLatitude(object.getString("lat")); store.setStatus(object.getInteger("zhuangtai")); store.setPrestoreType(0); 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.getString("youhao")); if (highGasOilPrice == null) { highGasOilPrice = new HighGasOilPrice(); highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getString("youhao")); highGasOilPrice.setOilNoName(oilPriceObject.getString("youhao") + "#"); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oiltype")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oiltype").equals("1") ? "汽油": "柴油"); highGasOilPrice.setStatus(GasOilPriceStatusEnum.status1.getStatus()); } else { highGasOilPrice.setMerchantStoreId(store.getId()); highGasOilPrice.setOilNo(oilPriceObject.getString("youhao")); highGasOilPrice.setOilNoName( oilPriceObject.getString("youhao") + "#"); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oiltype")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oiltype").equals("1") ? "汽油": "柴油"); } highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } else { highMerchantStore = new HighMerchantStore(); highMerchantStore.setType(1); highMerchantStore.setSourceType(6); highMerchantStore.setMerchantId(merchant.getId()); highMerchantStore.setCompanyId(merchant.getCompanyId()); highMerchantStore.setStoreKey(object.getString("jyzid")); highMerchantStore.setStoreName(object.getString("mingcheng")); highMerchantStore.setStoreLogo(object.getString("tupian")); highMerchantStore.setRegionId(region.getRegionId()); highMerchantStore.setRegionName(object.getString("province")); highMerchantStore.setAddress(object.getString("dizhi")); highMerchantStore.setLongitude(object.getString("lng")); highMerchantStore.setLatitude(object.getString("lat")); highMerchantStore.setStatus(1); highMerchantStore.setPrestoreType(0); 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.getString("youhao")); highGasOilPrice.setOilNoName(oilPriceObject.getString("youhao") + "#"); highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setOilType(oilPriceObject.getInteger("oiltype")); highGasOilPrice.setOilTypeName(oilPriceObject.getString("oiltype").equals("1") ? "汽油": "柴油"); highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } } return ResponseMsgUtil.success(jsonObject); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getOrderPay", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "getOrderPay") public ResponseData getOrderPay(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOilCardOrder highOilCardOrder = highOilCardOrderService.findOrder(orderNo); highOilCardOrder.setStatus(2); JSONObject object = KytcService.getOrderPay(highOilCardOrder.getThirdOrderNo() , highOilCardOrder.getPrice() , highOilCardOrder.getCardNo()); highOilCardOrder.setExt1(object.toJSONString()); highOilCardOrderService.updateOilCardOrder(highOilCardOrder); return ResponseMsgUtil.success("成功"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getOrderInfo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "getOrderInfo") public ResponseData getOrderInfo(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOilCardOrder highOilCardOrder = highOilCardOrderService.findOrder(orderNo); JSONObject object = KytcService.getOrderInfo(highOilCardOrder.getThirdOrderNo()); highOilCardOrder.setExt2(object.toJSONString()); if (object.getBoolean("State") == true) { JSONObject jsonObject = object.getJSONObject("Data"); if (jsonObject.getInteger("OilOrderState") == 2) { highOilCardOrder.setStatus(3); HighOrder highOrder = highOrderService.getOrderByOrderNo(highOilCardOrder.getOrderNo()); highOrder.setOrderStatus(3); highOrder.getHighChildOrderList().get(0).setChildOrderStatus(3); highOrderService.updateOrder(highOrder); } } highOilCardOrderService.updateOilCardOrder(highOilCardOrder); return ResponseMsgUtil.success("成功"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getLogisticsMsg", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取物流") public ResponseData getLogisticsMsg(@RequestParam(name = "no", required = true) String no) { try { JSONObject jsonObjects = CommonConfig.getLogisticsMsg(no); return ResponseMsgUtil.success(jsonObjects); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } // @RequestMapping(value = "/synCouponRule", method = RequestMethod.GET) // @ResponseBody // @ApiOperation(value = "获取卡券") // public ResponseData synCouponRule() { // try { // return ResponseMsgUtil.success(PetroConfig.synCouponRule()); // } catch (Exception e) { // log.error("HighOrderController --> getBackendToken() error!", e); // return ResponseMsgUtil.exception(e); // } // } // @RequestMapping(value = "/getCoupon", method = RequestMethod.GET) // @ResponseBody // @ApiOperation(value = "卡券下单") // public ResponseData getCoupon() { // try { // // JSONObject jsonObject = PetroConfig.getCoupon("16000443991501" , "18090580471" , OrderUtil.generateOrderNo()); // String data = PetroConfig.decrypt(jsonObject.getString("biz_content")); // JSONObject object = JSONObject.parseObject(data); // // return ResponseMsgUtil.success(object); // } catch (Exception e) { // log.error("HighOrderController --> getBackendToken() error!", e); // return ResponseMsgUtil.exception(e); // } // } @RequestMapping(value = "/deleteOilNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "删除油品") public ResponseData deleteOilNo() { try { gasService.deleteOilNo(); return ResponseMsgUtil.success("1231243"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getJiaHaoYouAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "加好油油站刷新") public ResponseData getJiaHaoYouAllStation() { try { gasService.getJiaHaoYouAllStation(); return ResponseMsgUtil.success("1231243"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getDianAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "点点网络") public ResponseData getDianAllStation() { try { gasService.getDianAllStation(); return ResponseMsgUtil.success("1231243"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() err1or!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/integralRebateOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "积分返利") public ResponseData integralRebateOrder() { try { // 查询满足初步返利条件订单 List order = highOrderService.integralRebateOrder(); for (HighOrder highOrder : order) { // 查询是否存在积分记录 Map map = new HashMap<>(); map.put("goldType", 1); map.put("resType", 4); map.put("userId", highOrder.getMemId()); map.put("resId", highOrder.getId()); List goldRecs = highGoldRecService.getGoldRec(map); // 判断是否重复赠送积分 if (goldRecs.size() == 0) { bsOrderRebateService.insertOrderRebate(highOrder); } highOrder.setWhetherRebate(true); highOrderService.updateOrderDetail(highOrder); } return ResponseMsgUtil.success("1231243"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() err1or!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getApiCoupon", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取卡券") public ResponseData getApiCoupon() { try { // 查询满足初步返利条件订单 List order = highOrderService.integralRebateOrder(); for (HighOrder highOrder : order) { // 查询是否存在积分记录 Map map = new HashMap<>(); map.put("goldType", 1); map.put("resType", 4); map.put("userId", highOrder.getMemId()); map.put("resId", highOrder.getId()); List goldRecs = highGoldRecService.getGoldRec(map); // 判断是否重复赠送积分 if (goldRecs.size() == 0) { bsOrderRebateService.insertOrderRebate(highOrder); } highOrder.setWhetherRebate(true); highOrderService.updateOrderDetail(highOrder); } return ResponseMsgUtil.success("1231243"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() err1or!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/couponDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据订单号查询中石油卡券详情") public ResponseData couponDetail(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); mapPost.put("timetable" , new Date().getTime()); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/apiCoupon/getCheckCode" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getCouponList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取卡券") public ResponseData getCouponList() { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230394901"); mapPost.put("timetable" , new Date().getTime()); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "B94B5E62807FA56A7260AB581D8A1B48", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/apiCoupon/getCouponList" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/refundApi", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "支付退款") public ResponseData refundApi(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { ApiOrder apiOrder = apiOrderService.findByOrderNo(mchOrderNo , null); // 查询APi ApiMerchants apiMerchants = apiMerchantsService.findByMchId(apiOrder.getMchId()); Map mapPost = new HashMap<>(); mapPost.put("merchId" , apiMerchants.getMchId()); mapPost.put("mchOrderNo" , mchOrderNo); // mapPost.put("timetable" , new Date().getTime()); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, apiMerchants.getApiKey(), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/order/refund" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/checkAccountBalance", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询余额") public ResponseData checkAccountBalance() { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20240133101"); // mapPost.put("mchOrderNo" , mchOrderNo); mapPost.put("timetable" , new Date().getTime()); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "1F43EEC88D0F99FC201D81143F9EED85", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/apiMerchants/checkAccountBalance" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getStationStore", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询油站") public ResponseData getStationStore() { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20240133101"); // mapPost.put("mchOrderNo" , mchOrderNo); // mapPost.put("timetable" , new Date().getTime()); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "1F43EEC88D0F99FC201D81143F9EED85", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/refuelOnline/getStationStore" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/decryptPetroConfig", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "解码") public ResponseData decryptPetroConfig(@RequestParam(name = "content", required = true) String content) { try { PetroConfig.init(1); String data = PetroConfig.decrypt(content); JSONObject object = JSONObject.parseObject(data); return ResponseMsgUtil.success(object); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/synCouponRule", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "synCouponRule") public ResponseData synCouponRule() { try { PetroConfig.init(2); JSONObject jsonObject = petroConfig.synCouponRule(); String data = PetroConfig.decrypt(jsonObject.getString("jsonResult")); JSONArray jsonArray = JSONArray.parseArray(data); return ResponseMsgUtil.success(jsonArray); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getCoupon", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "getCoupon") public ResponseData getCoupon(@RequestParam(name = "code", required = true) String code) { try { PetroConfig.init(2); // 发放卡券 JSONObject jsonObject = petroConfig.getCoupon(code ,"18090580471"); String data = PetroConfig.decrypt(jsonObject.getString("jsonResult")); JSONObject object = JSONObject.parseObject(data); return ResponseMsgUtil.success(object); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/decrypt", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "decrypt") public ResponseData decrypt(@RequestParam(name = "jsonResult", required = true) String jsonResult) { try { PetroConfig.init(2); String data = PetroConfig.decrypt(jsonResult); JSONObject object = JSONObject.parseObject(data); return ResponseMsgUtil.success(object); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/jNiuGoodsList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "jNiuGoodsList") public ResponseData jNiuGoodsList() { try { JSONObject object = RechargeConfig.jNiuGoodsList(); JSONArray array = object.getJSONArray("data"); List list = new ArrayList<>(); for (int i = 0; i < array.size(); i++) { JSONObject jsonObject = array.getJSONObject(i); JSONArray jsonArray = jsonObject.getJSONArray("goodsOption"); for (int j = 0; j < jsonArray.size(); j++) { JSONObject goodsOption = jsonArray.getJSONObject(j); JSONArray childArray = goodsOption.getJSONArray("child"); for (int t = 0; t < childArray.size(); t++) { JSONObject child = childArray.getJSONObject(j); JSONObject data = new JSONObject(); data.put("title" , jsonObject.getString("sort_title") + goodsOption.getString("name")); data.put("goodsId" , child.getString("goods_id")); data.put("goodsOptionId" , child.getString("goods_option_id")); data.put("platPrice" , child.getString("plat_price")); data.put("officialPrice" , child.getString("official_price")); list.add(data); } } } return ResponseMsgUtil.success(list); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/rechargeOrderByJn", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "rechargeOrderByJn") public ResponseData rechargeOrderByJn() { try { JSONObject object = new JSONObject(); object.put("orderNo", OrderUtil.generateOrderNo()); object.put("option_id", "632"); object.put("phone", "18090580471"); JSONObject returnObject = RechargeConfig.rechargeOrderByJn(object); return ResponseMsgUtil.success(returnObject); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/checkOrderByJn", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "checkOrderByJn") public ResponseData checkOrderByJn(@RequestParam(name = "order_no", required = true) String order_no) { try { JSONObject object = new JSONObject(); object.put("orderNo" , order_no); int status = 0; JSONObject jsonObject = RechargeConfig.checkOrderByJn(object); if (jsonObject.getJSONObject("data") != null) { JSONObject objectData= jsonObject.getJSONObject("data"); // // 10充值中 20充值完成 -10 充值失败 // -1取消,0充值中 ,1充值成功,2充值失败,3部分成功 if (objectData.getInteger("status") == 10) { status = 0; } else if (objectData.getInteger("status") == 20) { status = 1; } else if (objectData.getInteger("status") == -10) { status = 2; } } return ResponseMsgUtil.success(status); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getListRechargeOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "getListRechargeOrder") public ResponseData getListRechargeOrder(@RequestParam(name = "order_no", required = true) String order_no) { try { log.info("处理话费订单定时任务开始"); Map map = new HashMap<>(); map.put("payStatus", String.valueOf(102)); map.put("rechargeStatus", String.valueOf(201)); List orderList = outRechargeOrderService.getListRechargeOrder(map); log.info("处理话费订单条数:" + orderList.size()); if (orderList.size() > 0) { for (OutRechargeOrder order : orderList) { try { outRechargeOrderService.prepaidRechargeHandle(order); } catch (Exception e) { log.info("话费定时任务订单业务出现异常", e); } } } return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/etcOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "etcOrder") public ResponseData etcOrder() { try { String mobile = "18090580471"; Map map = new TreeMap<>(); map.put("requestId" , System.nanoTime()); map.put("channelCode" , CommonSysConst.getSysConfig().getEtcChannelCode()); map.put("timestamp" , new Date().getTime() / 1000); map.put("productNo" , "GZETCFXQD_GZETCCSCP"); map.put("mobile" , RSAUtil.encryptBASE64(RSAUtil.encryptByPublicKey(mobile.getBytes(StandardCharsets.UTF_8), CommonSysConst.getSysConfig().getEtcPublicKey()))); map.put("num" , 1); map.put("thirdOrderId" , OrderUtil.generateOrderNo()); String s = StringUtils.join(map.values(), ""); String sign = RSAUtil.sign(s.getBytes(), CommonSysConst.getSysConfig().getEtcPrivateKey()); map.put("sign", sign); return ResponseMsgUtil.success(petroConfig.etcOrder(map)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/couJointDist", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "商户派发电子券") public ResponseData couJointDist(@RequestParam(name = "order_no", required = true) String order_no) { try { // 购买卡券 JSONObject returnParam = HuiLianTongConfig.costRechargeOrder(order_no); // 解密 JSONObject jsonObject = HuiLianTongUnionCardConfig.resolveResponse(returnParam.getString("data")); JSONArray dataArray = JSONObject.parseObject(jsonObject.getString("data"), JSONArray.class); return ResponseMsgUtil.success(dataArray); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getCarNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询车牌订单号") public ResponseData getCarNo(@RequestParam(name = "carNo", required = true) String carNo) { try { JSONObject jsonObject = new JSONObject(); jsonObject.put("carNo" , carNo); jsonObject.put("orderStatus" , "03"); JSONObject data = blxConfig.queryJsOrderList(jsonObject); return ResponseMsgUtil.success(data); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value="/getGasDetailByStoreKey",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据门店key 查询") public ResponseData getGasDetailByStoreKey(@RequestParam(name = "storeKey", required = true) String storeKey) { try { JSONObject jsonObject = TuanYouConfig.queryGasInfoByGasId(storeKey); return ResponseMsgUtil.success(jsonObject.get("result")); } catch (Exception e) { log.error("HighGasController -> getGasDetailByStoreKey() error!",e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file diff --git a/hai-bweb/src/main/resources/prod/application.yml b/hai-bweb/src/main/resources/prod/application.yml index 5b1cf2b3..068bf35e 100644 --- a/hai-bweb/src/main/resources/prod/application.yml +++ b/hai-bweb/src/main/resources/prod/application.yml @@ -42,7 +42,7 @@ spring: #MQTT配置信息 mqtt: #MQTT服务地址 - url: ws://122.9.135.148:8083/mqtt + url: ws://1.95.43.71:8083/mqtt #用户名 username: printer_provider #密码 @@ -67,7 +67,7 @@ spring: write-dates-as-timestamps: true rocketmq: - name-server: 122.9.135.148:9876 + name-server: 1.95.43.71:9876 producer: #必须指定group group: default-group 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 5c2d67e8..5e781892 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java @@ -277,6 +277,7 @@ public class HighCouponController { // 类型: 1 贵州中石化 2 重庆中石油 if (couponCodeOther.getType() != null && couponCodeOther.getType().equals(2)) { + // 获取动态核销码 JSONObject code = ChongQingCNPCService.getCNPCCheckCode(couponCodeOther.getCouNo(), order.getOrderNo()); @@ -284,6 +285,7 @@ public class HighCouponController { 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, "生成失败"); diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java b/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java index 25c943a4..4b086dac 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java @@ -175,6 +175,7 @@ public class HighGasController { } } else if (MapUtils.getInteger(map, "source_type").equals(2)) { + // 查询是否配置了【油站的】优惠比例 HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, MapUtils.getLong(map, "id"), MapUtils.getString(map, "oil_no")); if (tyAgentPrice != null) { @@ -216,43 +217,6 @@ public class HighGasController { } } - @RequestMapping(value="/oilPriceCompute",method = RequestMethod.GET) - @ResponseBody - @ApiOperation(value = "油价计算") - public ResponseData oilPriceCompute(@RequestParam(name = "price", required = true) BigDecimal price, - @RequestParam(name = "goodsId", required = true) Long goodsId, - @RequestParam(name = "oilNo", required = true) String oilNo, - @RequestParam(name = "isTyAgent", required = false) Boolean isTyAgent) { - try { - BigDecimal discount = new BigDecimal("1"); - // 查询是否配置了【油站的】优惠比例 - HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, goodsId, oilNo); - if (tyAgentPrice != null) { - discount = tyAgentPrice.getPriceRate(); - } else { - // 查询是否配置了【油品】优惠比例 - HighGasDiscountOilPrice gasDiscountOilPrice = gasDiscountOilPriceService.getDetailByOilNo(oilNo); - if (gasDiscountOilPrice != null) { - discount = gasDiscountOilPrice.getPriceRate(); - } - } - - if (isTyAgent != null && isTyAgent.equals(true)) { - // 价格 - HighTyAgentPrice priceRate = tyAgentPriceService.getDetail(2, goodsId, oilNo); - if (priceRate == null) { - discount = gasDiscountOilPriceService.getDetailByOilNo(oilNo).getPriceRate(); - } else { - discount = priceRate.getPriceRate(); - } - } - return ResponseMsgUtil.success(price.multiply(discount.divide(new BigDecimal("100"))).setScale(2,BigDecimal.ROUND_HALF_UP)); - } catch (Exception e) { - log.error("HighGasController -> oilPriceCompute() error!",e); - return ResponseMsgUtil.exception(e); - } - } - @RequestMapping(value="/oilPriceDiscountCompute",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "油价优惠计算") diff --git a/hai-cweb/src/main/resources/prod-9401/application.yml b/hai-cweb/src/main/resources/prod-9401/application.yml index 57bd8920..8464ad98 100644 --- a/hai-cweb/src/main/resources/prod-9401/application.yml +++ b/hai-cweb/src/main/resources/prod-9401/application.yml @@ -43,7 +43,7 @@ spring: #MQTT配置信息 mqtt: #MQTT服务地址 - url: ws://122.9.135.148:8083/mqtt + url: ws://1.95.43.71:8083/mqtt #用户名 username: printer_provider #密码 @@ -68,7 +68,7 @@ spring: write-dates-as-timestamps: true rocketmq: - name-server: 122.9.135.148:9876 + name-server: 1.95.43.71:9876 producer: #必须指定group group: default-group diff --git a/hai-cweb/src/main/resources/prod/application.yml b/hai-cweb/src/main/resources/prod/application.yml index 1bca80cb..9717467a 100644 --- a/hai-cweb/src/main/resources/prod/application.yml +++ b/hai-cweb/src/main/resources/prod/application.yml @@ -43,7 +43,7 @@ spring: #MQTT配置信息 mqtt: #MQTT服务地址 - url: ws://122.9.135.148:8083/mqtt + url: ws://1.95.43.71:8083/mqtt #用户名 username: printer_provider #密码 @@ -68,7 +68,7 @@ spring: write-dates-as-timestamps: true rocketmq: - name-server: 122.9.135.148:9876 + name-server: 1.95.43.71:9876 producer: #必须指定group group: default-group diff --git a/hai-msg/src/main/resources/pre/application.yml b/hai-msg/src/main/resources/pre/application.yml index 04fdad86..6d701094 100644 --- a/hai-msg/src/main/resources/pre/application.yml +++ b/hai-msg/src/main/resources/pre/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://122.9.135.148:3306/hsg_prod?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://1.95.43.71:3306/hsg_prod?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource diff --git a/hai-order/src/main/java/com/web/controller/OrderController.java b/hai-order/src/main/java/com/web/controller/OrderController.java index 329fe205..bcc5b022 100644 --- a/hai-order/src/main/java/com/web/controller/OrderController.java +++ b/hai-order/src/main/java/com/web/controller/OrderController.java @@ -120,7 +120,9 @@ public class OrderController { // 校验子订单参数 if (childModel.getGoodsType() == null || OrderChildGoodsType.getDataByType(childModel.getGoodsType()) == null - || childModel.getGoodsId() == null + + + || childModel.getSaleCount() == null) { log.error("OrderController -> create() error!",""); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); diff --git a/hai-order/src/main/java/com/web/controller/OrderPayController.java b/hai-order/src/main/java/com/web/controller/OrderPayController.java index 912a434d..bc9824c5 100644 --- a/hai-order/src/main/java/com/web/controller/OrderPayController.java +++ b/hai-order/src/main/java/com/web/controller/OrderPayController.java @@ -387,7 +387,7 @@ public class OrderPayController { weChatPayReqInfo.setBody(orderTitle); // 商品描述 weChatPayReqInfo.setOut_trade_no(order.getOrderNo()); // 商户订单号 weChatPayReqInfo.setTotal_fee(total_fee); // 总金额 - weChatPayReqInfo.setSpbill_create_ip("122.9.135.148"); // 终端ip + weChatPayReqInfo.setSpbill_create_ip("1.95.43.71"); // 终端ip weChatPayReqInfo.setNotify_url(SysConst.getSysConfig().getWxPayNotifyUrl()); // 通知url weChatPayReqInfo.setTrade_type("JSAPI"); // 交易类型 weChatPayReqInfo.setAttach(null); // 附件参数 diff --git a/hai-order/src/main/resources/prod/application.yml b/hai-order/src/main/resources/prod/application.yml index db416a6f..d829b313 100644 --- a/hai-order/src/main/resources/prod/application.yml +++ b/hai-order/src/main/resources/prod/application.yml @@ -42,7 +42,7 @@ spring: #MQTT配置信息 mqtt: #MQTT服务地址 - url: ws://122.9.135.148:8083/mqtt + url: ws://1.95.43.71:8083/mqtt #用户名 username: printer_provider #密码 @@ -61,7 +61,7 @@ spring: write-dates-as-timestamps: true rocketmq: - name-server: 122.9.135.148:9876 + name-server: 1.95.43.71:9876 producer: access-key: huifu secret-key: huifukeji2013@! diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighGasSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighGasSchedule.java index d0a7b8bf..4e5466a2 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighGasSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighGasSchedule.java @@ -107,7 +107,7 @@ public class HighGasSchedule { // } // } else { // highMerchantStore = new HighMerchantStore(); -// highMerchantStore.setType(1); +// highMerchantStore.setType(1);DDD // highMerchantStore.setSourceType(2); // highMerchantStore.setMerchantId(merchant.getId()); // highMerchantStore.setCompanyId(merchant.getCompanyId()); @@ -158,12 +158,12 @@ public class HighGasSchedule { // gasService.getPayloAllStation(); // } -// @Scheduled(cron = "5 0 0 * * ?") // 每日凌晨00:00:5执行一次 -// public void getDianAllStation() throws Exception { -// gasService.getDianAllStation(); -// } + @Scheduled(cron = "5 0 0 * * ?") // 每日凌晨00:00:5执行一次 + public void getDianAllStation() throws Exception { + gasService.getDianAllStation(); + } - @Scheduled(cron = "0 5 0 * * ?") // 每日凌晨00:00:7执行一次 + @Scheduled(cron = "0 0 1 * * ?") // 每日凌晨00:00:7执行一次 public void deleteOilNo() { gasService.deleteOilNo(); } diff --git a/hai-schedule/src/main/resources/prod/application.yml b/hai-schedule/src/main/resources/prod/application.yml index 0d8036d4..9e331e1a 100644 --- a/hai-schedule/src/main/resources/prod/application.yml +++ b/hai-schedule/src/main/resources/prod/application.yml @@ -43,7 +43,7 @@ spring: #MQTT配置信息 mqtt: #MQTT服务地址 - url: ws://122.9.135.148:8083/mqtt + url: ws://1.95.43.71:8083/mqtt #用户名 username: printer_provider #密码 @@ -68,7 +68,7 @@ spring: write-dates-as-timestamps: true rocketmq: - name-server: 122.9.135.148:9876 + name-server: 1.95.43.71:9876 producer: #必须指定group group: default-group diff --git a/hai-service/pom.xml b/hai-service/pom.xml index 0b1e7d7f..d17a9112 100644 --- a/hai-service/pom.xml +++ b/hai-service/pom.xml @@ -314,6 +314,12 @@ easyexcel 2.2.6 + + + com.aliyun + ocr_api20210707 + 2.0.5 + org.gavaghan geodesy diff --git a/hai-service/src/main/java/com/hai/common/utils/RSAUtil.java b/hai-service/src/main/java/com/hai/common/utils/RSAUtil.java new file mode 100644 index 00000000..5d55550c --- /dev/null +++ b/hai-service/src/main/java/com/hai/common/utils/RSAUtil.java @@ -0,0 +1,462 @@ +package com.hai.common.utils; + +import org.apache.commons.lang3.ArrayUtils; +import sun.misc.BASE64Decoder; +import sun.misc.BASE64Encoder; + +import javax.crypto.Cipher; +import java.security.*; +import java.security.interfaces.RSAPrivateKey; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; + + +/** + * @Description RSAUtil + * @Author aili + **/ +public class RSAUtil { + + public static final String KEY_ALGORTHM = "RSA"; + public static final String SIGNATURE_ALGORITHM = "MD5withRSA"; + private static final int MAX_ENCRYPT_BLOCK = 117; + /** + * 用公钥加密 + * + * @param data 加密数据 + * @param key 密钥 + * @return + * @throws Exception + */ + public static byte[] encryptByPublicKey(byte[] data, String key) throws Exception { + //对公钥解密 + byte[] keyBytes = decryptBASE64(key); + //取公钥 + X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORTHM); + Key publicKey = keyFactory.generatePublic(x509EncodedKeySpec); + + //对数据解密 + Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); + cipher.init(Cipher.ENCRYPT_MODE, publicKey); + //return cipher.doFinal(data); + + byte[] enBytes = null; + for (int i = 0; i < data.length; i += MAX_ENCRYPT_BLOCK) { + // 注意要使用2的倍数,否则会出现加密后的内容再解密时为乱码 + byte[] doFinal = cipher.doFinal(ArrayUtils.subarray(data, i, i + MAX_ENCRYPT_BLOCK)); + enBytes = ArrayUtils.addAll(enBytes, doFinal); + } + return enBytes; + } + + /** + * 用私钥对信息生成数字签名 + * + * @param data //加密数据 + * @param privateKey //私钥 + * @return + * @throws Exception + */ + public static String sign(byte[] data, String privateKey) throws Exception { + //解密私钥 + byte[] keyBytes = decryptBASE64(privateKey); + //构造PKCS8EncodedKeySpec对象 + PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(keyBytes); + //指定加密算法 + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORTHM); + //取私钥匙对象 + PrivateKey privateKey2 = keyFactory.generatePrivate(pkcs8EncodedKeySpec); + //用私钥对信息生成数字签名 + Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); + signature.initSign(privateKey2); + signature.update(data); + + return encryptBASE64(signature.sign()); + } + + /** + * 私钥解密 + * @param str + * @param key + * @return + * @throws Exception + */ + public static String decryptByPrivate(String str, String key) throws Exception{ + //64位解码加密后的字符串 + byte[] inputByte = decryptBASE64(str); + //base64编码的私钥 + byte[] decoded = decryptBASE64(key); + RSAPrivateKey priKey = (RSAPrivateKey) KeyFactory.getInstance("RSA").generatePrivate(new PKCS8EncodedKeySpec(decoded)); + //RSA解密 + Cipher cipher = Cipher.getInstance("RSA"); + cipher.init(Cipher.DECRYPT_MODE, priKey); + String outStr = new String(cipher.doFinal(inputByte)); + return outStr; + } + + /** + * BASE64解密 + * + * @param key + * @return + * @throws Exception + */ + public static byte[] decryptBASE64(String key) throws Exception { + return (new BASE64Decoder()).decodeBuffer(key); + } + + /** + * BASE64加密 + * + * @param key + * @return + * @throws Exception + */ + public static String encryptBASE64(byte[] key) throws Exception { + return (new BASE64Encoder()).encodeBuffer(key); + } + + /** + * 解密动态核销码 dynamicCode + * @param data + * @param key + * @return + * @throws Exception + */ + public static String decryptByPrivateKey(String data, String key) throws Exception { + //对私钥解密 + byte[] keyBytes = decryptBASE64(key); + //64位解码加密后的字符串 + byte[] inputByte = decryptBASE64(data); + PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORTHM); + Key privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec); + //对数据解密 + Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); + cipher.init(Cipher.DECRYPT_MODE, privateKey); + int decryptBlock = 1024 / 8; + byte[] deBytes = null; + for (int i = 0; i < inputByte.length; i += decryptBlock) { + byte[] doFinal = cipher.doFinal(ArrayUtils.subarray(inputByte, i, i + decryptBlock)); + deBytes = ArrayUtils.addAll(deBytes, doFinal); + } + return new String(deBytes); + } + /** + * 校验数字签名 + * + * @param data 加密数据 + * @param publicKey 公钥 + * @param sign 数字签名 + * @return + * @throws Exception + */ + public static boolean verify(byte[] data, String publicKey, String sign) throws Exception { + //解密公钥 + byte[] keyBytes = decryptBASE64(publicKey); + //构造PKCS8EncodedKeySpec对象 + X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(keyBytes); + //指定加密算法 + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORTHM); + //取公钥匙对象 + PublicKey publicKey2 = keyFactory.generatePublic(x509EncodedKeySpec); + + Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); + signature.initVerify(publicKey2); + signature.update(data); + //验证签名是否正常 + return signature.verify(decryptBASE64(sign)); + + } + + /** + * Base64 编码和解码 + */ + static class Base64 { + + static private final int BASELENGTH = 128; + static private final int LOOKUPLENGTH = 64; + static private final int TWENTYFOURBITGROUP = 24; + static private final int EIGHTBIT = 8; + static private final int SIXTEENBIT = 16; + static private final int FOURBYTE = 4; + static private final int SIGN = -128; + static private final char PAD = '='; + static private final boolean fDebug = false; + static final private byte[] base64Alphabet = new byte[BASELENGTH]; + static final private char[] lookUpBase64Alphabet = new char[LOOKUPLENGTH]; + + static { + for (int i = 0; i < BASELENGTH; ++i) { + base64Alphabet[i] = -1; + } + for (int i = 'Z'; i >= 'A'; i--) { + base64Alphabet[i] = (byte) (i - 'A'); + } + for (int i = 'z'; i >= 'a'; i--) { + base64Alphabet[i] = (byte) (i - 'a' + 26); + } + + for (int i = '9'; i >= '0'; i--) { + base64Alphabet[i] = (byte) (i - '0' + 52); + } + + base64Alphabet['+'] = 62; + base64Alphabet['/'] = 63; + + for (int i = 0; i <= 25; i++) { + lookUpBase64Alphabet[i] = (char) ('A' + i); + } + + for (int i = 26, j = 0; i <= 51; i++, j++) { + lookUpBase64Alphabet[i] = (char) ('a' + j); + } + + for (int i = 52, j = 0; i <= 61; i++, j++) { + lookUpBase64Alphabet[i] = (char) ('0' + j); + } + lookUpBase64Alphabet[62] = (char) '+'; + lookUpBase64Alphabet[63] = (char) '/'; + + } + + private static boolean isWhiteSpace(char octect) { + return (octect == 0x20 || octect == 0xd || octect == 0xa || octect == 0x9); + } + + private static boolean isPad(char octect) { + return (octect == PAD); + } + + private static boolean isData(char octect) { + return (octect < BASELENGTH && base64Alphabet[octect] != -1); + } + + /** + * Encodes hex octects into Base64 + * + * @param binaryData Array containing binaryData + * @return Encoded Base64 array + */ + public static String encode(byte[] binaryData) { + + if (binaryData == null) { + return null; + } + + int lengthDataBits = binaryData.length * EIGHTBIT; + if (lengthDataBits == 0) { + return ""; + } + + int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP; + int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP; + int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 : numberTriplets; + char encodedData[] = null; + + encodedData = new char[numberQuartet * 4]; + + byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0; + + int encodedIndex = 0; + int dataIndex = 0; + if (fDebug) { + System.out.println("number of triplets = " + numberTriplets); + } + + for (int i = 0; i < numberTriplets; i++) { + b1 = binaryData[dataIndex++]; + b2 = binaryData[dataIndex++]; + b3 = binaryData[dataIndex++]; + + if (fDebug) { + System.out.println("b1= " + b1 + ", b2= " + b2 + ", b3= " + b3); + } + + l = (byte) (b2 & 0x0f); + k = (byte) (b1 & 0x03); + + byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); + byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0); + byte val3 = ((b3 & SIGN) == 0) ? (byte) (b3 >> 6) : (byte) ((b3) >> 6 ^ 0xfc); + + if (fDebug) { + System.out.println("val2 = " + val2); + System.out.println("k4 = " + (k << 4)); + System.out.println("vak = " + (val2 | (k << 4))); + } + + encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[(l << 2) | val3]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[b3 & 0x3f]; + } + + // form integral number of 6-bit groups + if (fewerThan24bits == EIGHTBIT) { + b1 = binaryData[dataIndex]; + k = (byte) (b1 & 0x03); + if (fDebug) { + System.out.println("b1=" + b1); + System.out.println("b1<<2 = " + (b1 >> 2)); + } + byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); + encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[k << 4]; + encodedData[encodedIndex++] = PAD; + encodedData[encodedIndex++] = PAD; + } else if (fewerThan24bits == SIXTEENBIT) { + b1 = binaryData[dataIndex]; + b2 = binaryData[dataIndex + 1]; + l = (byte) (b2 & 0x0f); + k = (byte) (b1 & 0x03); + + byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); + byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0); + + encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[l << 2]; + encodedData[encodedIndex++] = PAD; + } + + return new String(encodedData); + } + + /** + * Decodes Base64 data into octects + * + * @param encoded string containing Base64 data + * @return Array containind decoded data. + */ + public static byte[] decode(String encoded) { + + if (encoded == null) { + return null; + } + + char[] base64Data = encoded.toCharArray(); + // remove white spaces + int len = removeWhiteSpace(base64Data); + + if (len % FOURBYTE != 0) { + return null;//should be divisible by four + } + + int numberQuadruple = (len / FOURBYTE); + + if (numberQuadruple == 0) { + return new byte[0]; + } + + byte decodedData[] = null; + byte b1 = 0, b2 = 0, b3 = 0, b4 = 0; + char d1 = 0, d2 = 0, d3 = 0, d4 = 0; + + int i = 0; + int encodedIndex = 0; + int dataIndex = 0; + decodedData = new byte[(numberQuadruple) * 3]; + + for (; i < numberQuadruple - 1; i++) { + + if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++])) + || !isData((d3 = base64Data[dataIndex++])) + || !isData((d4 = base64Data[dataIndex++]))) { + return null; + }//if found "no data" just return null + + b1 = base64Alphabet[d1]; + b2 = base64Alphabet[d2]; + b3 = base64Alphabet[d3]; + b4 = base64Alphabet[d4]; + + decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); + decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); + decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); + } + + if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) { + return null;//if found "no data" just return null + } + + b1 = base64Alphabet[d1]; + b2 = base64Alphabet[d2]; + + d3 = base64Data[dataIndex++]; + d4 = base64Data[dataIndex++]; + if (!isData((d3)) || !isData((d4))) {//Check if they are PAD characters + if (isPad(d3) && isPad(d4)) { + if ((b2 & 0xf) != 0)//last 4 bits should be zero + { + return null; + } + byte[] tmp = new byte[i * 3 + 1]; + System.arraycopy(decodedData, 0, tmp, 0, i * 3); + tmp[encodedIndex] = (byte) (b1 << 2 | b2 >> 4); + return tmp; + } else if (!isPad(d3) && isPad(d4)) { + b3 = base64Alphabet[d3]; + if ((b3 & 0x3) != 0)//last 2 bits should be zero + { + return null; + } + byte[] tmp = new byte[i * 3 + 2]; + System.arraycopy(decodedData, 0, tmp, 0, i * 3); + tmp[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); + tmp[encodedIndex] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); + return tmp; + } else { + return null; + } + } else { //No PAD e.g 3cQl + b3 = base64Alphabet[d3]; + b4 = base64Alphabet[d4]; + decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); + decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); + decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); + + } + + return decodedData; + } + + /** + * remove WhiteSpace from MIME containing encoded Base64 data. + * + * @param data the byte array of base64 data (with WS) + * @return the new length + */ + private static int removeWhiteSpace(char[] data) { + if (data == null) { + return 0; + } + + // count characters that's not whitespace + int newSize = 0; + int len = data.length; + for (int i = 0; i < len; i++) { + if (!isWhiteSpace(data[i])) { + data[newSize++] = data[i]; + } + } + return newSize; + } + } + +} + + + + + + + + + + + + + + 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 feab4bd2..1c489248 100644 --- a/hai-service/src/main/java/com/hai/config/CommonSysConfig.java +++ b/hai-service/src/main/java/com/hai/config/CommonSysConfig.java @@ -159,4 +159,13 @@ public class CommonSysConfig { private String GzPetroAppKey; private String GzPetroAesKey; + private String EtcPostUrl; + private String EtcChannelCode; + private String EtcPublicKey; + private String EtcPrivateKey; + + private String NdPostUrl; + private String NdOrgCode; + private String NdKey; + } diff --git a/hai-service/src/main/java/com/hai/config/EtcService.java b/hai-service/src/main/java/com/hai/config/EtcService.java new file mode 100644 index 00000000..ae8253ce --- /dev/null +++ b/hai-service/src/main/java/com/hai/config/EtcService.java @@ -0,0 +1,236 @@ +package com.hai.config; + +import com.alibaba.fastjson.JSONObject; +import com.hai.common.utils.HttpsUtils; +import com.hai.common.utils.WxUtils; +import com.hai.entity.EtcCarMsg; +import com.hai.entity.EtcCustMsg; +import org.apache.commons.codec.digest.DigestUtils; +import org.springframework.context.annotation.Configuration; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.*; + +/** + * @serviceName QrCodeUtilsConfig.java + * @author Sum1Dream + * @version 1.0.0 + * @Description // Etc申请管理 + * @createTime 09:54 2022/4/13 + **/ +@Configuration +public class EtcService { + + /** + * @Author Sum1Dream + * @Name submitCustInfo + * @Description // 客户信息提交 + * @Date 16:31 2024/3/25 + * @Param etcCustMsg + * @return com.alibaba.fastjson.JSONObject + */ + public static JSONObject submitCustInfo(EtcCustMsg etcCustMsg) throws Exception { + // 组装数据 + Map map = new HashMap<>(); + map.put("orgCode" , CommonSysConst.getSysConfig().getNdOrgCode()); + map.put("timestamps", System.currentTimeMillis()); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("custName" , etcCustMsg.getCustName()); + jsonObject.put("custIdNo" , etcCustMsg.getCustIdNo()); + jsonObject.put("accountNo" , etcCustMsg.getAccountNo()); + jsonObject.put("bankName" , etcCustMsg.getBankName()); + jsonObject.put("address" , etcCustMsg.getAddress()); + jsonObject.put("phone" , etcCustMsg.getPhone()); + jsonObject.put("custAgentIdFront" , convertToBase64(etcCustMsg.getCustAgentIdFront())); + jsonObject.put("custAgentIdBack" , convertToBase64(etcCustMsg.getCustAgentIdBront())); + jsonObject.put("bankCard" , convertToBase64(etcCustMsg.getCustAgentIdBront())); + if (etcCustMsg.getCustId() != null) { + jsonObject.put("custId" , etcCustMsg.getCustId()); + } + String sign = WxUtils.generateSignKytc(jsonObject , CommonSysConst.getSysConfig().getNdKey()); + + map.put("body" , jsonObject); + map.put("sign" , DigestUtils.md5Hex((sign).getBytes())); + return HttpsUtils.doGet(CommonSysConst.getSysConfig().getDiandianwPostUrl()+"/api/v1/submitCustInfo" , map); + } + + /** + * @Author Sum1Dream + * @Name submitVehInfo + * @Description // 车辆信息提交接口 + * @Date 11:28 2024/3/26 + * @Param etcCustMsg + * @return com.alibaba.fastjson.JSONObject + */ + public static JSONObject submitVehInfo(EtcCarMsg etcCarMsg) throws Exception { + // 组装数据 + Map map = new HashMap<>(); + map.put("orgCode" , CommonSysConst.getSysConfig().getNdOrgCode()); + map.put("timestamps", System.currentTimeMillis()); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("productId" , etcCarMsg.getProductId()); + jsonObject.put("custId" , etcCarMsg.getCustId()); + jsonObject.put("cardVarietyId" , etcCarMsg.getCardVarietyId()); + + List vehInfoList = new ArrayList<>(); + JSONObject vehInfoListObject = new JSONObject(); + vehInfoListObject.put("vehPlateNo" , etcCarMsg.getVehPlateNo()); + vehInfoListObject.put("vehPlateColor" , etcCarMsg.getVehPlateColor()); + vehInfoListObject.put("vehType" , etcCarMsg.getVehType()); + vehInfoListObject.put("wheelsNum" , etcCarMsg.getWheelsNum()); + jsonObject.put("drivLicMainFro" , convertToBase64(etcCarMsg.getDrivlicMainFro())); + jsonObject.put("drivLicSubFro" , convertToBase64(etcCarMsg.getDrivlicSubFro())); + jsonObject.put("headStockPhoto" , convertToBase64(etcCarMsg.getHeadStockPhoto())); + + if (etcCarMsg.getVehId() != null) { + jsonObject.put("vehId" , etcCarMsg.getVehId()); + } + String sign = WxUtils.generateSignKytc(jsonObject , CommonSysConst.getSysConfig().getNdKey()); + + map.put("body" , jsonObject); + map.put("sign" , DigestUtils.md5Hex((sign).getBytes())); + return HttpsUtils.doGet(CommonSysConst.getSysConfig().getDiandianwPostUrl()+"/api/v1/submitVehInfo" , map); + } + + + /** + * @Author Sum1Dream + * @Name getVehStatus + * @Description // 查询车辆状态 + * @Date 13:54 2024/3/26 + * @Param etcCarMsg + * @return com.alibaba.fastjson.JSONObject + */ + public static JSONObject getVehStatus(EtcCarMsg etcCarMsg) throws Exception { + // 组装数据 + Map map = new HashMap<>(); + map.put("orgCode" , CommonSysConst.getSysConfig().getNdOrgCode()); + map.put("timestamps", System.currentTimeMillis()); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("custId" , etcCarMsg.getCustId()); + jsonObject.put("vehId" , etcCarMsg.getVehId()); + + String sign = WxUtils.generateSignKytc(jsonObject , CommonSysConst.getSysConfig().getNdKey()); + + map.put("body" , jsonObject); + map.put("sign" , DigestUtils.md5Hex((sign).getBytes())); + return HttpsUtils.doGet(CommonSysConst.getSysConfig().getDiandianwPostUrl()+"/api/v1/getVehStatus" , map); + } + + /** + * @Author Sum1Dream + * @Name sendRealNameCode + * @Description // 实名认证发送认证码接口 + * @Date 14:14 2024/3/26 + * @Param JSONObject + * @return com.alibaba.fastjson.JSONObject + */ + public static JSONObject sendRealNameCode(String custId) throws Exception { + // 组装数据 + Map map = new HashMap<>(); + map.put("orgCode" , CommonSysConst.getSysConfig().getNdOrgCode()); + map.put("timestamps", System.currentTimeMillis()); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("custId" , custId); + + String sign = WxUtils.generateSignKytc(jsonObject , CommonSysConst.getSysConfig().getNdKey()); + + map.put("body" , jsonObject); + map.put("sign" , DigestUtils.md5Hex((sign).getBytes())); + return HttpsUtils.doGet(CommonSysConst.getSysConfig().getDiandianwPostUrl()+"/api/v1/sendRealNameCode" , map); + } + + /** + * @Author Sum1Dream + * @Name checkRealNameCode + * @Description // 实名认证核验验证码接口 + * @Date 14:16 2024/3/26 + * @Param object + * @return com.alibaba.fastjson.JSONObject + */ + public static JSONObject checkRealNameCode(String custId , String verifyCode) throws Exception { + // 组装数据 + Map map = new HashMap<>(); + map.put("orgCode" , CommonSysConst.getSysConfig().getNdOrgCode()); + map.put("timestamps", System.currentTimeMillis()); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("custId" , custId); + jsonObject.put("verifyCode" , verifyCode); + + String sign = WxUtils.generateSignKytc(jsonObject , CommonSysConst.getSysConfig().getNdKey()); + + map.put("body" , jsonObject); + map.put("sign" , DigestUtils.md5Hex((sign).getBytes())); + return HttpsUtils.doGet(CommonSysConst.getSysConfig().getDiandianwPostUrl()+"/api/v1/checkRealNameCode" , map); + } + + /** + * @Author Sum1Dream + * @Name sendSignVerifyCode + * @Description // 签约验证码发送接口 + * @Date 14:37 2024/3/26 + * @Param custId + * @Param verifyCode + * @return com.alibaba.fastjson.JSONObject + */ + public static JSONObject sendSignVerifyCode(String custId) throws Exception { + // 组装数据 + Map map = new HashMap<>(); + map.put("orgCode" , CommonSysConst.getSysConfig().getNdOrgCode()); + map.put("timestamps", System.currentTimeMillis()); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("custId" , custId); + + String sign = WxUtils.generateSignKytc(jsonObject , CommonSysConst.getSysConfig().getNdKey()); + + map.put("body" , jsonObject); + map.put("sign" , DigestUtils.md5Hex((sign).getBytes())); + return HttpsUtils.doGet(CommonSysConst.getSysConfig().getDiandianwPostUrl()+"/api/v1/sendSignVerifyCode" , map); + } + + + public static JSONObject checkSignVerifyCode(String custId , String verifyCode) throws Exception { + // 组装数据 + Map map = new HashMap<>(); + map.put("orgCode" , CommonSysConst.getSysConfig().getNdOrgCode()); + map.put("timestamps", System.currentTimeMillis()); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("custId" , custId); + jsonObject.put("verifyCode" , verifyCode); + + String sign = WxUtils.generateSignKytc(jsonObject , CommonSysConst.getSysConfig().getNdKey()); + + map.put("body" , jsonObject); + map.put("sign" , DigestUtils.md5Hex((sign).getBytes())); + return HttpsUtils.doGet(CommonSysConst.getSysConfig().getDiandianwPostUrl()+"/api/v1/checkSignVerifyCode" , map); + } + + /** + * @Author Sum1Dream + * @Name convertToBase64 + * @Description // 转换base64 + * @Date 16:32 2024/3/25 + * @Param imagePath + * @return java.lang.String + */ + public static String convertToBase64(String imagePath) { + String base64Image = ""; + try { + Path path = Paths.get( CommonSysConst.getSysConfig().getFileUrl() + imagePath); + byte[] imageBytes = Files.readAllBytes(path); + base64Image = Base64.getEncoder().encodeToString(imageBytes); + } catch (Exception e) { + e.printStackTrace(); + } + return base64Image; + } + + + + + + + +} diff --git a/hai-service/src/main/java/com/hai/config/PetroConfig.java b/hai-service/src/main/java/com/hai/config/PetroConfig.java index 5abe4cb5..eba3fd12 100644 --- a/hai-service/src/main/java/com/hai/config/PetroConfig.java +++ b/hai-service/src/main/java/com/hai/config/PetroConfig.java @@ -284,7 +284,7 @@ public class PetroConfig { * @Param phone * @return com.alibaba.fastjson.JSONObject */ - public JSONObject cancelCouponsYt(String ticketNum , String phone) throws Exception{ + public JSONObject cancelCouponsYt(String ticketNum , String phone) throws Exception{ log.info("========================请求任务Start========================="); Map req = new HashMap<>(); req.put("appId", petroAppid); @@ -299,7 +299,6 @@ public class PetroConfig { jsonData.put("vouchers" , vouchers); jsonData.put("businessId" , phone); - //业务内容加密 String bizContent = JSONObject.toJSONString(jsonData); bizContent = encrypt(bizContent); @@ -333,6 +332,74 @@ public class PetroConfig { return object; } + + /** + * @Author Sum1Dream + * @Name memberCards + * @Description // ETC卡券下发接口 + * @Date 14:17 2024/2/28 + * @Param object + * @return com.alibaba.fastjson.JSONObject + */ + public JSONObject etcOrder(Map object) { + log.info("========================请求任务Start========================="); + log.info("卡券下发接口-请求参数: " + JSON.toJSONString(object)); + // 请求接口 + JSONObject jsonObject = HttpsUtils.doPost(CommonSysConst.getSysConfig().getEtcPostUrl() + "channel/order" , object); + log.info("卡券下发接口-回调参数: " + JSON.toJSONString(jsonObject)); + return jsonObject; + } + + /** + * @Author Sum1Dream + * @Name etcCardStatus + * @Description // etc卡券状态查询接口 + * @Date 14:22 2024/2/28 + * @Param object + * @return com.alibaba.fastjson.JSONObject + */ + public JSONObject etcCardStatus(Map object) { + log.info("========================请求任务Start========================="); + log.info("卡券状态查询接口-请求参数: " + JSON.toJSONString(object)); + // 请求接口 + JSONObject jsonObject = HttpsUtils.doPost(CommonSysConst.getSysConfig().getEtcPostUrl() + "/channel/cardStatus" , object); + log.info("卡券状态查询接口-回调参数: " + JSON.toJSONString(jsonObject)); + return jsonObject; + } + + /** + * @Author Sum1Dream + * @Name etcDestroy + * @Description // 卡券退款接口 + * @Date 14:23 2024/2/28 + * @Param object + * @return com.alibaba.fastjson.JSONObject + */ + public JSONObject etcDestroy(Map object) { + log.info("========================请求任务Start========================="); + log.info(" 卡券退款接口-请求参数: " + JSON.toJSONString(object)); + // 请求接口 + JSONObject jsonObject = HttpsUtils.doPost(CommonSysConst.getSysConfig().getEtcPostUrl() + "/channel/order/destroy" , object); + log.info(" 卡券退款接口-回调参数: " + JSON.toJSONString(jsonObject)); + return jsonObject; + } + + /** + * @Author Sum1Dream + * @Name etcQueryStock + * @Description // 查询卡券库存接口 + * @Date 14:23 2024/2/28 + * @Param object + * @return com.alibaba.fastjson.JSONObject + */ + public JSONObject etcQueryStock(Map object) { + log.info("========================请求任务Start========================="); + log.info(" 查询卡券库存接口-请求参数: " + JSON.toJSONString(object)); + // 请求接口 + JSONObject jsonObject = HttpsUtils.doPost(CommonSysConst.getSysConfig().getEtcPostUrl() + "/channel/queryStock" , object); + log.info(" 查询卡券库存接口-回调参数: " + JSON.toJSONString(jsonObject)); + return jsonObject; + } /** * @Author Sum1Dream diff --git a/hai-service/src/main/java/com/hai/config/WxOrderConfig.java b/hai-service/src/main/java/com/hai/config/WxOrderConfig.java index 806fda3b..a849d34f 100644 --- a/hai-service/src/main/java/com/hai/config/WxOrderConfig.java +++ b/hai-service/src/main/java/com/hai/config/WxOrderConfig.java @@ -43,61 +43,50 @@ import java.util.Map; public class WxOrderConfig { private static final Logger log = LoggerFactory.getLogger(WxOrderConfig.class); - /** * 微信支付商户号 * 个体户黎杨珍 */ public static final String MCH_ID_1609882817 = "1609882817"; - /** * 微信支付商户号 * 青岛简牛网络科技有限公司 */ public static final String MCH_ID_1667177808 = "1667177808"; - /** * 微信支付商户号 * 惠兑礼品 (重庆) 有限公司 */ public static final String MCH_ID_1614670195 = "1614670195"; - /** * 微信支付商户号 * 惠昕(贵州)能源有限公司 */ public static final String MCH_ID_1619676214 = "1619676214"; - /** * 微信支付商户号 * 惠昕(贵州)能源有限公司 */ public static final String MCH_ID_1634835264 = "1634835264"; - /** * 微信支付商户号 * 渝北区浩联物资经营部 */ public static final String MCH_ID_1624126902 = "1624126902"; - /** * 微信支付商户号 * 贵州紫凌电子商务有限公司 */ public static final String MCH_ID_1648729281 = "1648729281"; - - /** * 微信支付商户号 * 贵州(普惠GO)紫凌电子商务有限公司 */ public static final String MCH_ID_1665668540 = "1665668540"; - /** * 嗨森逛公众号APPID */ public static final String APPID_HSG_MP = "wxa075e8509802f826"; - /** * 嗨森逛小程序APPID */ @@ -106,13 +95,11 @@ public class WxOrderConfig { * 黔印象公众号APPID */ public static final String APPID_QYX_MP = "wxf846cf24e87420a2"; - /** * 黔印象小程序APPID */ public static final String APPID_QYX_MINI = "wx5e0cac96ea91c01f"; - public static OrderRefundModel orderToRefund(String paySerialNo,BigDecimal totalFee,BigDecimal refundFee) throws Exception { Map param = new HashMap<>(); param.put("appid", "wx637bd6f7314daa46"); diff --git a/hai-service/src/main/java/com/hai/enum_type/TripartiteReqLogType.java b/hai-service/src/main/java/com/hai/enum_type/TripartiteReqLogType.java index 8df20c85..ad792748 100644 --- a/hai-service/src/main/java/com/hai/enum_type/TripartiteReqLogType.java +++ b/hai-service/src/main/java/com/hai/enum_type/TripartiteReqLogType.java @@ -4,7 +4,7 @@ package com.hai.enum_type; * 三方日志 - 日志类型 */ public enum TripartiteReqLogType { - type1(1, "团油"), + type1(1, ""), type2(2, "壳牌"), type3(3, "汇联通工会卡"), type4(4, "贵州中石化"), diff --git a/hai-service/src/main/java/com/hai/etc/EtcCarMsgService.java b/hai-service/src/main/java/com/hai/etc/EtcCarMsgService.java new file mode 100644 index 00000000..1bf93a17 --- /dev/null +++ b/hai-service/src/main/java/com/hai/etc/EtcCarMsgService.java @@ -0,0 +1,72 @@ +package com.hai.etc; + +import com.hai.entity.BlxCarInfo; +import com.hai.entity.EtcCarMsg; +import com.hai.entity.EtcCustMsg; + +import java.util.List; +import java.util.Map; + +/** + * @serviceName .java + * @author Sum1Dream + * @version 1.0.0 + * @Description // etc业务 + * @createTime 15:15 2024/3/22 + **/ +public interface EtcCarMsgService { + + /** + * @Author Sum1Dream + * @Name insertCar + * @Description // 新增车辆信息 + * @Date 11:29 2023/9/5 + * @Param carInfo + * @return void + */ + void insertEtcCar(EtcCarMsg etcCarMsg) throws Exception; + + /** + * @Author Sum1Dream + * @Name updateCar + * @Description // 更新车辆信息 + * @Date 11:29 2023/9/5 + * @Param carInfo + * @return void + */ + void updateEtcCar(EtcCarMsg etcCarMsg); + + /** + * @Author Sum1Dream + * @Name getCarInfoList + * @Description // 查询车辆信息列表 + * @Date 11:30 2023/9/5 + * @Param map + * @return java.util.List + */ + List getEtcCarList(Map map); + + /** + * @Author Sum1Dream + * @Name findCarInfoByMap + * @Description //TODO + * @Date 14:14 2023/9/5 + * @Param map + * @return com.hai.entity.BlxCarInfo + */ + EtcCarMsg findEtcCarByMap(Map map); + + /** + * @Author Sum1Dream + * @Name findCarInfoById + * @Description // 根据ID查询详情 + * @Date 15:13 2023/9/5 + * @Param id + * @return com.hai.entity.BlxCarInfo + */ + EtcCarMsg findEtcCarById(Long id); + + + + +} diff --git a/hai-service/src/main/java/com/hai/etc/EtcCustMsgService.java b/hai-service/src/main/java/com/hai/etc/EtcCustMsgService.java new file mode 100644 index 00000000..fce4a975 --- /dev/null +++ b/hai-service/src/main/java/com/hai/etc/EtcCustMsgService.java @@ -0,0 +1,68 @@ +package com.hai.etc; + +import com.hai.entity.EtcCustMsg; + +import java.util.List; +import java.util.Map; + +/** + * @serviceName .java + * @author Sum1Dream + * @version 1.0.0 + * @Description // etc客户信息 + * @createTime 16:03 2024/3/22 + **/ +public interface EtcCustMsgService { + + /** + * @Author Sum1Dream + * @Name insertCust + * @Description // 新增客户信息 + * @Date 11:29 2023/9/5 + * @Param CustInfo + * @return void + */ + void insertEtcCust(EtcCustMsg etcCustMsg); + + /** + * @Author Sum1Dream + * @Name updateCust + * @Description // 更新客户信息 + * @Date 11:29 2023/9/5 + * @Param CustInfo + * @return void + */ + void updateEtcCust(EtcCustMsg etcCustMsg) throws Exception; + + /** + * @Author Sum1Dream + * @Name getCustInfoList + * @Description // 查询客户信息列表 + * @Date 11:30 2023/9/5 + * @Param map + * @return java.util.List + */ + List getEtcCustList(Map map); + + /** + * @Author Sum1Dream + * @Name findCustInfoByMap + * @Description //TODO + * @Date 14:14 2023/9/5 + * @Param map + * @return com.hai.entity.BlxCustInfo + */ + EtcCustMsg findEtcCustByMap(Map map); + + /** + * @Author Sum1Dream + * @Name findCustInfoById + * @Description // 根据ID查询详情 + * @Date 15:13 2023/9/5 + * @Param id + * @return com.hai.entity.BlxCustInfo + */ + EtcCustMsg findEtcCustById(Long id); + + +} diff --git a/hai-service/src/main/java/com/hai/etc/impl/EtcCarMsgServiceImpl.java b/hai-service/src/main/java/com/hai/etc/impl/EtcCarMsgServiceImpl.java new file mode 100644 index 00000000..c2607622 --- /dev/null +++ b/hai-service/src/main/java/com/hai/etc/impl/EtcCarMsgServiceImpl.java @@ -0,0 +1,81 @@ +package com.hai.etc.impl; + +import com.alibaba.fastjson.JSONObject; +import com.hai.config.EtcService; +import com.hai.dao.EtcCarMsgMapper; +import com.hai.entity.EtcCarMsg; +import com.hai.entity.EtcCarMsgExample; +import com.hai.entity.EtcCustMsg; +import com.hai.entity.EtcCustMsgExample; +import com.hai.etc.EtcCarMsgService; +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; + +@Service("etcCarMsgService") +public class EtcCarMsgServiceImpl implements EtcCarMsgService { + + @Resource + private EtcCarMsgMapper etcCarMsgMapper; + + @Override + public void insertEtcCar(EtcCarMsg etcCarMsg) throws Exception { + // 提交车辆审核 + JSONObject jsonObject = EtcService.submitVehInfo(etcCarMsg); + if (jsonObject.getString("errCode").equals("0")) { + JSONObject object = (JSONObject) jsonObject.getJSONArray("result").get(0); + etcCarMsg.setVehId(object.getString("custId")); + + JSONObject car = EtcService.getVehStatus(etcCarMsg); + if (car.getString("errCode").equals("0")) { + etcCarMsg.setVehStatus(car.getJSONObject("result").getInteger("vehStatus")); + etcCarMsg.setPayStatus(car.getJSONObject("result").getInteger("payStatus")); + etcCarMsg.setSignStatus(car.getJSONObject("result").getInteger("signStatus")); + etcCarMsg.setExt2(car.getJSONObject("result").getString("docException")); + } + etcCarMsg.setExt3(car.getString("errMsg")); + + } + etcCarMsg.setExt1(jsonObject.getString("errMsg")); + etcCarMsgMapper.insert(etcCarMsg); + } + + @Override + public void updateEtcCar(EtcCarMsg etcCarMsg) { + etcCarMsgMapper.updateByPrimaryKey(etcCarMsg); + + } + + @Override + public List getEtcCarList(Map map) { + EtcCarMsgExample example = new EtcCarMsgExample(); + EtcCarMsgExample.Criteria criteria = example.createCriteria(); + + if (MapUtils.getLong(map , "userId") != null) { + criteria.andUserIdEqualTo(MapUtils.getLong(map , "userId")); + } + if (MapUtils.getString(map , "vehPlateNo") != null) { + criteria.andVehPlateNoEqualTo(MapUtils.getString(map , "vehPlateNo")); + } + + return etcCarMsgMapper.selectByExample(example); + } + + @Override + public EtcCarMsg findEtcCarByMap(Map map) { + + EtcCustMsgExample example = new EtcCustMsgExample(); + EtcCustMsgExample.Criteria criteria = example.createCriteria(); + + return null; + } + + @Override + public EtcCarMsg findEtcCarById(Long id) { + return etcCarMsgMapper.selectByPrimaryKey(id); + } +} diff --git a/hai-service/src/main/java/com/hai/etc/impl/EtcCustMsgServiceImpl.java b/hai-service/src/main/java/com/hai/etc/impl/EtcCustMsgServiceImpl.java new file mode 100644 index 00000000..2a7a663c --- /dev/null +++ b/hai-service/src/main/java/com/hai/etc/impl/EtcCustMsgServiceImpl.java @@ -0,0 +1,72 @@ +package com.hai.etc.impl; + +import com.alibaba.fastjson.JSONObject; +import com.hai.config.EtcService; +import com.hai.dao.EtcCustMsgMapper; +import com.hai.entity.BsMsgExample; +import com.hai.entity.EtcCustMsg; +import com.hai.entity.EtcCustMsgExample; +import com.hai.etc.EtcCustMsgService; +import org.apache.commons.collections4.MapUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +@Service("etcCustMsgService") +public class EtcCustMsgServiceImpl implements EtcCustMsgService { + + @Resource + private EtcCustMsgMapper etcCustMsgMapper; + + @Override + public void insertEtcCust(EtcCustMsg etcCustMsg) { + etcCustMsgMapper.insert(etcCustMsg); + } + + @Override + public void updateEtcCust(EtcCustMsg etcCustMsg) throws Exception { + // 提交实名认证 + JSONObject jsonObject = EtcService.submitCustInfo(etcCustMsg); + if (jsonObject.getString("errCode").equals("0")) { + etcCustMsg.setCustId(jsonObject.getJSONObject("result").getString("custId")); + etcCustMsg.setCustIdNo(jsonObject.getJSONObject("result").getString("custIdNo")); + etcCustMsg.setStatus(jsonObject.getJSONObject("result").getInteger("realStatus")); + } + etcCustMsg.setExt1(jsonObject.getString("errMsg")); + + etcCustMsgMapper.updateByPrimaryKey(etcCustMsg); + + + } + + @Override + public List getEtcCustList(Map map) { + + EtcCustMsgExample example = new EtcCustMsgExample(); + EtcCustMsgExample.Criteria criteria = example.createCriteria(); + + if (MapUtils.getLong(map , "userId") != null) { + criteria.andUserIdEqualTo(MapUtils.getLong(map , "userId")); + } + if (MapUtils.getString(map , "custName") != null) { + criteria.andCustNameEqualTo(MapUtils.getString(map , "custName")); + } + if (MapUtils.getString(map , "phone") != null) { + criteria.andPhoneEqualTo(MapUtils.getString(map , "phone")); + } + + return etcCustMsgMapper.selectByExample(example); + } + + @Override + public EtcCustMsg findEtcCustByMap(Map map) { + return null; + } + + @Override + public EtcCustMsg findEtcCustById(Long id) { + return etcCustMsgMapper.selectByPrimaryKey(id); + } +} diff --git a/hai-service/src/main/java/com/hai/ocr/AliYunOcrService.java b/hai-service/src/main/java/com/hai/ocr/AliYunOcrService.java new file mode 100644 index 00000000..61850acc --- /dev/null +++ b/hai-service/src/main/java/com/hai/ocr/AliYunOcrService.java @@ -0,0 +1,97 @@ +package com.hai.ocr; + +import com.aliyun.ocr_api20210707.Client; +import com.aliyun.ocr_api20210707.models.*; +import com.aliyun.teaopenapi.models.Config; + +/** + * 阿里云识别 + * @author hurui + */ +public class AliYunOcrService { + + /** + * 创建请求 + * @return + * @throws Exception + */ + private static Client createClient() throws Exception { + Config config = new Config() + // 您的AccessKey ID + .setAccessKeyId("LTAI5tAu96cTs6b87vdfZivT") + // 您的AccessKey Secret + .setAccessKeySecret("67SmjGewt0zKGrhQeDKGbbk5lE3tAi"); + // 访问的域名 + config.endpoint = "ocr-api.cn-hangzhou.aliyuncs.com"; + return new Client(config); + } + + /** + * 身份证识别 + * @param url 访问地址 + * @return + */ + public static RecognizeIdcardResponseBody recognizeIdCard(String url) { + try { + Client client = createClient(); + RecognizeIdcardRequest recognizeIdcardRequest = new RecognizeIdcardRequest().setUrl(url); + RecognizeIdcardResponse response = client.recognizeIdcard(recognizeIdcardRequest); + return response.getBody(); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + /** + * 银行卡识别 + * @param url 访问地址 + * @return + */ + public static RecognizeBankCardResponseBody recognizeBankCard(String url) { + try { + Client client = createClient(); + RecognizeBankCardRequest recognizeBankCardRequest = new RecognizeBankCardRequest().setUrl(url); + RecognizeBankCardResponse response = client.recognizeBankCard(recognizeBankCardRequest); + return response.getBody(); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + /** + * 银行开户许可证识别 + * @param url 访问地址 + * @return + */ + public static RecognizeBankAccountLicenseResponseBody recognizeBankAccount(String url) { + try { + Client client = createClient(); + RecognizeBankAccountLicenseRequest recognizeBankAccountLicenseRequest = new RecognizeBankAccountLicenseRequest().setUrl(url); + RecognizeBankAccountLicenseResponse response = client.recognizeBankAccountLicense(recognizeBankAccountLicenseRequest); + return response.getBody(); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + + /** + * 营业执照识别 + * @param url 访问地址 + * @return + */ + public static RecognizeBusinessLicenseResponseBody recognizeBusinessLicense(String url) { + try { + Client client = createClient(); + RecognizeBusinessLicenseRequest request = new RecognizeBusinessLicenseRequest().setUrl(url); + RecognizeBusinessLicenseResponse response = client.recognizeBusinessLicense(request); + return response.getBody(); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/hai-service/src/main/java/com/hai/openApi/service/ApiOrderCreateHandleService.java b/hai-service/src/main/java/com/hai/openApi/service/ApiOrderCreateHandleService.java index 91e23710..be7f0f62 100644 --- a/hai-service/src/main/java/com/hai/openApi/service/ApiOrderCreateHandleService.java +++ b/hai-service/src/main/java/com/hai/openApi/service/ApiOrderCreateHandleService.java @@ -98,4 +98,15 @@ public interface ApiOrderCreateHandleService { */ ApiOrder petroCouponOrder(JSONObject object) throws Exception; + /** + * @Author Sum1Dream + * @Name cqPetroCouponOrder + * @Description // 中石油卡券下单业务 + * @Date 11:05 2024/3/4 + * @Param object + * @return com.hai.entity.ApiOrder + */ + ApiOrder cqPetroCouponOrder(JSONObject object) throws Exception; + + } diff --git a/hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderCreateHandleServiceImpl.java b/hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderCreateHandleServiceImpl.java index b4fa6218..46441ca9 100644 --- a/hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderCreateHandleServiceImpl.java +++ b/hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderCreateHandleServiceImpl.java @@ -535,4 +535,57 @@ public class ApiOrderCreateHandleServiceImpl implements ApiOrderCreateHandleServ return apiOrder; } + @Override + public ApiOrder cqPetroCouponOrder(JSONObject object) throws Exception { + + // 获取下单内容 + JSONObject dataObject = JSONObject.parseObject(object.getString("content")); + + // 查询api商户 + ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId")); + + ApiCoupon apiCoupon = apiCouponService.findCoupon(dataObject.getString("couponCode")); + + if (apiCoupon == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前卡券已停用!"); + } + + // 查询折扣比例 + Map mapProduct = new HashMap<>(); + mapProduct.put("mchId" , object.getString("merchId")); + mapProduct.put("productType" , OrderProductType.PRODUCT_TYPE19.getNumber()); + + ApiMchProduct mchProduct = apiMchProductService.findByMap(mapProduct); + + // 计算成本价格 + BigDecimal price = priceComputeConfig.computationPriceCost(mchProduct.getDiscount() , new BigDecimal(apiCoupon.getPrice())); + + // 判断金额是否充足 + if (apiMerchants.getAmounts().compareTo(price) < 0) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.INSUFFICIENT_BALANCE); + } + + // 组装内容 + JSONObject jsonObject = new JSONObject(); + jsonObject.put("name" ,apiCoupon.getName()); + jsonObject.put("couponCode" , apiCoupon.getCode()); + jsonObject.put("receiverPhone" , dataObject.getString("userMobile")); + + // 组装api订单 + ApiOrder apiOrder = new ApiOrder(); + apiOrder.setCreateTime(new Date()); + apiOrder.setTitle(apiMerchants.getMerchantName() + "|" + OrderProductType.PRODUCT_TYPE19.getName() + "|扣款" + price); + apiOrder.setFacePrice(new BigDecimal(apiCoupon.getPrice())); + apiOrder.setCostPrice(price); + apiOrder.setOrderPrice(price); + apiOrder.setMchId(object.getString("merchId")); + apiOrder.setMchName(apiMerchants.getMerchantName()); + apiOrder.setUpdateTime(new Date()); + apiOrder.setProductType(object.getInteger("productType")); + apiOrder.setMchOrderNo(object.getString("orderNo")); + apiOrder.setNotifyUrl(object.getString("notifyUrl")); + apiOrder.setContent(jsonObject.toJSONString()); + + return apiOrder; + } } diff --git a/hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderServiceImpl.java b/hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderServiceImpl.java index a823023d..0fd14dd5 100644 --- a/hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderServiceImpl.java @@ -286,6 +286,30 @@ public class ApiOrderServiceImpl implements ApiOrderService { orderService.createOrder(createOrderModel); } + // 处理重庆中石油卡券 + if (OrderProductType.PRODUCT_TYPE19.getNumber().equals(object.getInteger("productType"))) { + + apiOrder = orderCreateHandleService.cqPetroCouponOrder(object); + + // 组装子订单内容 + CreateOrderChildModel createOrderChildModel = new CreateOrderChildModel(); + createOrderChildModel.setMemName("接口用户"); + createOrderChildModel.setMemPhone(dataObject.getString("userMobile")); + createOrderChildModel.setCompanyId(2L); + createOrderChildModel.setCouponCode(dataObject.getString("couponCode")); + createOrderChildModel.setGoodsType(OrderChildGoodsType.TYPE19.getNumber()); + createOrderChildModel.setSaleCount(1); + createOrderChildModel.setIsTyAgent(false); + createOrderChildModel.setGoodsPrice(apiOrder.getOrderPrice()); + createOrderChildModel.setPrice(apiOrder.getCostPrice()); + createOrderModel.setMemName("接口用户"); + createOrderModel.setMemPhone(dataObject.getString("userMobile")); + + // 组装订单 + createOrderModel.getChildOrderList().add(createOrderChildModel); + orderService.createOrder(createOrderModel); + + } 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 2dbd494c..4a178d39 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 @@ -139,4 +139,6 @@ public interface OrderCreateHandleService { HighChildOrder petroCoupon(HighOrder order , CreateOrderChildModel createOrderChildModel) throws Exception; + HighChildOrder cpPetroCoupon(HighOrder order , CreateOrderChildModel createOrderChildModel) throws Exception; + } 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 10c259e0..394155b8 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 @@ -1297,4 +1297,33 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { return childOrder; } + + @Override + public HighChildOrder cpPetroCoupon(HighOrder order, CreateOrderChildModel createOrderChildModel) throws Exception { + ApiCoupon apiCoupon = apiCouponService.findCoupon(createOrderChildModel.getCouponCode()); + + // 生成交易子订单 + HighChildOrder childOrder = new HighChildOrder(); + childOrder.setOrderNo(order.getOrderNo()); + childOrder.setMemId(order.getMemId()); + childOrder.setMemName(order.getMemName()); + childOrder.setMemPhone(order.getMemPhone()); + childOrder.setChildOrderNo(OrderUtil.generateChildOrderNo()); + childOrder.setGoodsType(OrderChildGoodsType.TYPE19.getNumber()); + childOrder.setGoodsId(apiCoupon.getId()); + childOrder.setGoodsName(apiCoupon.getName()); + childOrder.setGoodsSpecName(apiCoupon.getCode()); + childOrder.setGoodsPrice(new BigDecimal(apiCoupon.getPrice())); + childOrder.setGoodsActualPrice(createOrderChildModel.getPrice()); + childOrder.setSaleCount(createOrderChildModel.getSaleCount()); + childOrder.setGiveawayType(false); + childOrder.setChildOrderStatus(OrderChildStatus.STATUS1.getNumber()); + childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount()))); + childOrder.setTotalActualPrice(childOrder.getGoodsActualPrice().multiply(new BigDecimal(childOrder.getSaleCount()))); + childOrder.setTotalDeductionPrice(childOrder.getTotalPrice().subtract(childOrder.getTotalActualPrice())); + childOrder.setPraiseStatus(0); + childOrder.setCreateTime(new Date()); + + return childOrder; + } } 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 8d75e64d..a84d5d21 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 @@ -1,10 +1,12 @@ package com.hai.order.service.impl; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; 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.DateUtil; import com.hai.config.*; import com.hai.dao.HighGasOrderPushMapper; import com.hai.entity.*; @@ -53,6 +55,10 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { @Resource private RocketMQTemplate rocketMQTemplate; + @Resource + private HighGasOilPriceService highGasOilPriceService; + + @Resource private OrderService orderService; @@ -138,6 +144,12 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { @Resource private PetroConfig petroConfig; + @Resource + private HighCouponCodeOtherService couponCodeOtherService; + + @Resource + private HighGasOrderPushMapper highGasOrderPushMapper; + @Override public HighOrder orderPaySuccessHandle(String orderNo, OrderPayType payType, String paySerialNo, BigDecimal payRealPrice, HighUserCard userCard, Map other) { @@ -268,6 +280,8 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { group(order); } else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE18.getNumber())) { petroCoupon(order , childOrder); + } else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE19.getNumber())) { + cpPetroCoupon(order , childOrder); } } } @@ -359,13 +373,16 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { highOrderService.printGasOrder(order.getHighChildOrderList().get(0).getGoodsId(), gasOrder, false); } else if (gasOrder.getChannelType().equals(MerchantStoreSourceType.type2.getNumber())) { + + HighGasOilPrice gasOilPrice = highGasOilPriceService.getGasOilPriceByStoreAndOilNo(store.getId() , gasOrder.getGasOilNo()); + // 推送团油订单 Map paramMap = new HashMap<>(); paramMap.put("gasId", store.getStoreKey()); paramMap.put("oilNo", gasOrder.getGasOilNo()); paramMap.put("gunNo", gasOrder.getGasGunNo()); paramMap.put("priceGun", gasOrder.getGasPriceGun()); // 枪单价 - paramMap.put("priceVip", gasOrder.getGasPriceVip()); // 优惠价 + paramMap.put("priceVip", gasOilPrice.getPriceCost()); // 成本价 paramMap.put("driverPhone", gasOrder.getMemPhone()); paramMap.put("thirdSerialNo", gasOrder.getOrderNo()); paramMap.put("refuelingAmount", gasOrder.getGasRefuelPrice()); @@ -377,6 +394,15 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouDieselAccount()); } JSONObject orderPushObject = TuanYouConfig.refuelingOrderPush(paramMap); + + HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); + highGasOrderPush.setType(OrderPushType.type10.getType()); + highGasOrderPush.setOrderNo(gasOrder.getOrderNo()); + highGasOrderPush.setCreateTime(new Date()); + highGasOrderPush.setRequestContent(paramMap.toString()); + highGasOrderPush.setReturnContent(orderPushObject.toJSONString()); + highGasOrderPushMapper.insert(highGasOrderPush); + if (orderPushObject != null && orderPushObject.getString("code").equals("200")) { gasOrder.setChannelOrderNo(orderPushObject.getJSONObject("result").getString("orderNo")); gasOrderService.updateGasOrder(gasOrder); @@ -720,4 +746,43 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { } + private void cpPetroCoupon(HighOrder order , HighChildOrder childOrder) throws Exception { + + ApiCoupon apiCoupon = apiCouponService.findCoupon(childOrder.getGoodsSpecName()); + + + if (apiCoupon == null || apiCoupon.getStatus() != 1) { + throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前卡券不可购买"); + } + + if (!apiCoupon.getType().equals(3)) { + throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前卡券不可购买"); + } + + // 预发码 + JSONObject preSendCoupon = ChongQingCNPCService.preSendCoupon(apiCoupon.getCode(), childOrder.getChildOrderNo(), childOrder.getSaleCount(), order.getMemPhone()); + if (preSendCoupon.getInteger("status").equals(1)) { + // 给用户发码 + JSONObject response = ChongQingCNPCService.sendCNPCTicket(apiCoupon.getCode(), childOrder.getChildOrderNo(), childOrder.getSaleCount(), order.getMemPhone()); + 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(childOrder.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()); + couponCodeOtherService.insertCouponCodeOther(couponCodeOther); + + } + } + + } + } 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 95740730..e208fc94 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 @@ -383,7 +383,14 @@ public class OrderServiceImpl implements OrderService { order.setProductType(OrderProductType.PRODUCT_TYPE18.getNumber()); order.setSecUserId(childOrder.getId()); order.setTitle("中石油卡券"); - } else { + } else if (child.getGoodsType().equals(OrderChildGoodsType.TYPE19.getNumber())) { + HighChildOrder childOrder = orderCreateHandleService.cpPetroCoupon(order , child); + childOrderList.add(childOrder); + order.setProductType(OrderProductType.PRODUCT_TYPE19.getNumber()); + order.setSecUserId(childOrder.getId()); + order.setTitle("重庆中石油卡券"); + } + else { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知业务类型"); } } diff --git a/hai-service/src/main/java/com/hai/order/type/OrderChildGoodsType.java b/hai-service/src/main/java/com/hai/order/type/OrderChildGoodsType.java index 3dd5be66..5d589d35 100644 --- a/hai-service/src/main/java/com/hai/order/type/OrderChildGoodsType.java +++ b/hai-service/src/main/java/com/hai/order/type/OrderChildGoodsType.java @@ -26,6 +26,7 @@ public enum OrderChildGoodsType { TYPE15(15, "个人油卡充值"), TYPE17(17, "团购套餐"), TYPE18(18, "中石油卡券"), + TYPE19(19, "重庆中石油卡券"), ; private Integer number; diff --git a/hai-service/src/main/java/com/hai/order/type/OrderProductType.java b/hai-service/src/main/java/com/hai/order/type/OrderProductType.java index a78e874d..ef984ed6 100644 --- a/hai-service/src/main/java/com/hai/order/type/OrderProductType.java +++ b/hai-service/src/main/java/com/hai/order/type/OrderProductType.java @@ -29,6 +29,7 @@ public enum OrderProductType { PRODUCT_TYPE16(16, "个人油卡充值" , "orderLogo/coupon.png", ""), PRODUCT_TYPE17(17, "团购套餐" , "orderLogo/coupon.png", ""), PRODUCT_TYPE18(18, "中石油卡券" , "orderLogo/coupon.png", "PETRO_COUPON"), + PRODUCT_TYPE19(19, "重庆中石油卡券" , "orderLogo/coupon.png", "CQ_PETRO_COUPON"), PRODUCT_TYPE101(101, "惠支付" , "orderLogo/pay.png", "PAY"), PRODUCT_TYPE102(102, "门店活动" , "orderLogo/store_activity.png", "STORE_ACTIVITY"), ; diff --git a/hai-service/src/main/java/com/hai/order/type/RechargePlatformType.java b/hai-service/src/main/java/com/hai/order/type/RechargePlatformType.java index 38912ac0..d78e12e7 100644 --- a/hai-service/src/main/java/com/hai/order/type/RechargePlatformType.java +++ b/hai-service/src/main/java/com/hai/order/type/RechargePlatformType.java @@ -14,6 +14,7 @@ public enum RechargePlatformType { STATUS2(2, "龙阅"), STATUS3(3, "城宇"), STATUS4(4, "畅停"), + STATUS5(5, "简牛"), STATUS100(100, "手动"), ; diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java index b2060118..7d8732be 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java @@ -570,7 +570,9 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService { highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 highUserCouponService.insertUserCoupon(highUserCoupon); - } else { + } else if (coupon.getCouponSource().equals(9)) { + + }else { // 查询子订单的兑换码 HighCouponCode code = getCodeByChildOrderNo(childOrder.getChildOrderNo()); if (code == null) { 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 ce87e530..c9fef0bb 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 @@ -224,7 +224,7 @@ public class HighGasDiscountOilPriceServiceImpl implements HighGasDiscountOilPri // 团油枪价 priceGun = priceDetail.getBigDecimal("priceGun"); // 团油优惠价 - priceVip = priceDetail.getBigDecimal("priceVip"); + priceVip = priceDetail.getBigDecimal("priceGun"); // 嗨森逛平台价 国标价 * 折扣 BigDecimal pricePlatform = priceGun.multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighGasServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighGasServiceImpl.java index 5d73edc4..d3329a68 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighGasServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighGasServiceImpl.java @@ -466,110 +466,151 @@ public class HighGasServiceImpl implements HighGasService { @Override public void getDianAllStation() throws Exception { HighMerchantModel merchant = highMerchantService.getMerchantById(39L); - JSONObject jsonObject = DianConfig.getGasInfoAll(); - - JSONArray resultObject = jsonObject.getObject("result", JSONArray.class); + 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 = 0; i < resultObject.size();i++) { - Object objectData = resultObject.get(i); - JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(objectData)); + 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; - HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreByKey(object.getString("jyzid")); - SecRegion region = commonService.getRegionsByName(object.getString("province")); - if (store != null) { - store.setType(1); - store.setSourceType(6); - store.setMerchantId(merchant.getId()); - store.setCompanyId(merchant.getCompanyId()); - store.setStoreKey(object.getString("jyzid")); - store.setStoreName(object.getString("mingcheng")); -// store.setStoreLogo(object.getString("tupian")); - store.setRegionId(region.getRegionId()); - store.setRegionName(object.getString("province")); - store.setAddress(object.getString("dizhi")); - store.setLongitude(object.getString("lng")); - store.setLatitude(object.getString("lat")); - store.setStatus(object.getInteger("zhuangtai")); - store.setPrestoreType(0); - 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.getString("youhao")); - if (highGasOilPrice == null) { + for (Object gasObject : jsonArray) { + JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(gasObject)); + HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreByKey(object.getString("gasId")); + JSONArray gasGunList = object.getJSONArray("gasGunList"); + if (store != null) { + store.setType(1); + store.setSourceType(2); + 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.setPrestoreType(0); + 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.getString("oilNo")); + if (highGasOilPrice == null) { + highGasOilPrice = new HighGasOilPrice(); + highGasOilPrice.setMerchantStoreId(store.getId()); + highGasOilPrice.setOilNo(oilPriceObject.getString("oilNo")); + highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); + highGasOilPrice.setPriceCost(oilPriceObject.getBigDecimal("priceVip")); + highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceGun")); + highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); + highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); + highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); + highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); + highGasOilPrice.setStatus(GasOilPriceStatusEnum.status1.getStatus()); + } else { + highGasOilPrice.setMerchantStoreId(store.getId()); + highGasOilPrice.setOilNo(oilPriceObject.getString("oilNo")); + highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); + highGasOilPrice.setPriceCost(oilPriceObject.getBigDecimal("priceVip")); + highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceGun")); + highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); + highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); + highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); + highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); + highGasOilPrice.setStatus(GasOilPriceStatusEnum.status1.getStatus()); + } + highGasOilPriceService.editGasOilPrice(highGasOilPrice); + + for (Object o : gasGunList) { + JSONObject gunNoObject = (JSONObject) o; + HighGasOilGunNo gasOilGunNo = gasOilGunNoService.getDetailByStoreAndGunNo(highGasOilPrice.getMerchantStoreId(), gunNoObject.getString("gunNo")); + if (gasOilGunNo == null) { + gasOilGunNo = new HighGasOilGunNo(); + gasOilGunNo.setGasOilPriceId(highGasOilPrice.getId()); + gasOilGunNo.setStoreId(highGasOilPrice.getMerchantStoreId()); + gasOilGunNo.setOilNo(highGasOilPrice.getOilNo()); + gasOilGunNo.setOilNoName(highGasOilPrice.getOilNoName()); + gasOilGunNo.setOilType(highGasOilPrice.getOilType()); + gasOilGunNo.setOilTypeName(highGasOilPrice.getOilTypeName()); + gasOilGunNo.setGunNo(gunNoObject.getString("gunNo")); + gasOilGunNo.setStatus(1); + gasOilGunNoService.editGunNo(gasOilGunNo); + } + } + } + } else { + highMerchantStore = new HighMerchantStore(); + highMerchantStore.setType(1); + highMerchantStore.setSourceType(2); + 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.setPrestoreType(0); + 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(store.getId()); - highGasOilPrice.setOilNo(oilPriceObject.getString("youhao")); - highGasOilPrice.setPreferentialMargin(new BigDecimal(0)); - highGasOilPrice.setOilNoName(oilPriceObject.getString("youhao") + "#"); - highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); + highGasOilPrice.setMerchantStoreId(merchantStoreModel.getId()); + highGasOilPrice.setOilNo(oilPriceObject.getString("oilNo")); + highGasOilPrice.setOilNoName(oilPriceObject.getString("oilNoName")); + highGasOilPrice.setPriceCost(oilPriceObject.getBigDecimal("priceVip")); + highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceGun")); highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); - highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceGun")); - highGasOilPrice.setOilType(oilPriceObject.getInteger("oiltype")); - highGasOilPrice.setOilTypeName(oilPriceObject.getString("oiltype").equals("1") ? "汽油": "柴油"); + highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); + highGasOilPrice.setOilType(oilPriceObject.getInteger("oilType")); + highGasOilPrice.setOilTypeName(oilPriceObject.getString("oilTypeName")); highGasOilPrice.setStatus(GasOilPriceStatusEnum.status1.getStatus()); - } else { - highGasOilPrice.setMerchantStoreId(store.getId()); - highGasOilPrice.setOilNo(oilPriceObject.getString("youhao")); - highGasOilPrice.setOilNoName( oilPriceObject.getString("youhao") + "#"); - highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); - highGasOilPrice.setPreferentialMargin(new BigDecimal(0)); - highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); - highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceGun")); - highGasOilPrice.setOilType(oilPriceObject.getInteger("oiltype")); - highGasOilPrice.setOilTypeName(oilPriceObject.getString("oiltype").equals("1") ? "汽油": "柴油"); + highGasOilPriceService.editGasOilPrice(highGasOilPrice); + + for (Object o : gasGunList) { + JSONObject gunNoObject = (JSONObject) o; + HighGasOilGunNo gasOilGunNo = gasOilGunNoService.getDetailByStoreAndGunNo(highGasOilPrice.getMerchantStoreId(), gunNoObject.getString("gunNo")); + if (gasOilGunNo == null) { + gasOilGunNo = new HighGasOilGunNo(); + gasOilGunNo.setGasOilPriceId(highGasOilPrice.getId()); + gasOilGunNo.setStoreId(highGasOilPrice.getMerchantStoreId()); + gasOilGunNo.setOilNo(highGasOilPrice.getOilNo()); + gasOilGunNo.setOilNoName(highGasOilPrice.getOilNoName()); + gasOilGunNo.setOilType(highGasOilPrice.getOilType()); + gasOilGunNo.setOilTypeName(highGasOilPrice.getOilTypeName()); + gasOilGunNo.setGunNo(gunNoObject.getString("gunNo")); + gasOilGunNo.setStatus(1); + gasOilGunNoService.editGunNo(gasOilGunNo); + } + } } - highGasOilPriceService.editGasOilPrice(highGasOilPrice); - } - } else { - highMerchantStore = new HighMerchantStore(); - highMerchantStore.setType(1); - highMerchantStore.setSourceType(6); - highMerchantStore.setMerchantId(merchant.getId()); - highMerchantStore.setCompanyId(merchant.getCompanyId()); - highMerchantStore.setStoreKey(object.getString("jyzid")); - highMerchantStore.setStoreName(object.getString("mingcheng")); -// highMerchantStore.setStoreLogo(object.getString("tupian")); - highMerchantStore.setRegionId(region.getRegionId()); - highMerchantStore.setRegionName(object.getString("province")); - highMerchantStore.setAddress(object.getString("dizhi")); - highMerchantStore.setLongitude(object.getString("lng")); - highMerchantStore.setLatitude(object.getString("lat")); - highMerchantStore.setStatus(1); - highMerchantStore.setPrestoreType(0); - 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.getString("youhao")); - highGasOilPrice.setOilNoName(oilPriceObject.getString("youhao") + "#"); - highGasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); - highGasOilPrice.setPreferentialMargin(new BigDecimal(0)); - highGasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); - highGasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceGun")); - highGasOilPrice.setOilType(oilPriceObject.getInteger("oiltype")); - highGasOilPrice.setOilTypeName(oilPriceObject.getString("oiltype").equals("1") ? "汽油": "柴油"); - highGasOilPriceService.editGasOilPrice(highGasOilPrice); } } - } } diff --git a/hai-service/src/main/resources/dev/commonConfig.properties b/hai-service/src/main/resources/dev/commonConfig.properties index 8228a13d..a686eb0b 100644 --- a/hai-service/src/main/resources/dev/commonConfig.properties +++ b/hai-service/src/main/resources/dev/commonConfig.properties @@ -9,16 +9,16 @@ ChongQingCnpcMerKey=n2j30jxhl3rhuoci ChongQingCnpcCouponSignKey=5ojldakiz343a6yk # TuanYou configuration parameters -tuanYouUrl=https://test02-motorcade-hcs.czb365.com -tuanYouAppKey=231599775566496 -tuanYouAppSecret=cbfab3c550d6142a779c5196c9416342 -tuanYouDieselAccount=c009bidg4400 -tuanYouGasolineAccount=c009bic04400 -#tuanYouUrl=https://hcs.czb365.com -#tuanYouAppKey=210091174083104 -#tuanYouAppSecret=f9811df6791d309bf48f4a8db9edaa45 -#tuanYouDieselAccount=9hp52qgg4400 -#tuanYouGasolineAccount=9hp52qf04400 +#tuanYouUrl=https://test01-motorcade-hcs.czb365.com +#tuanYouAppKey=297046381248288 +#tuanYouAppSecret=3ef5320dd36e178ce2502fae1a8acd2b +#tuanYouDieselAccount=je38a9944400 +#tuanYouGasolineAccount=je38a9104400 +tuanYouUrl=https://hcs.czb365.com +tuanYouAppKey=296780625346528 +tuanYouAppSecret=3b1bca319f7296ec4fabf21eef0ded7d +tuanYouDieselAccount=9hp52qgg4400 +tuanYouGasolineAccount=jd4b7lc44400 # JiaHaoYou configuration parameters shellGroupUrl=http://openapi.ngrok.xinyebang.cn/gateway.html @@ -49,14 +49,14 @@ thirdAppSecret=cyQpQKMaGUG186iEZRt1uQ== thirdPostUrl=http://mbsmemberwebapi.test.onfishes.com/ # ??????? -huiliantongUrl=https://gzapitest.deepermobile.com.cn:441 -huiliantongAppNo=guizhouhltcs -huiliantongAppkey=g%2BNnjR54YSUWM2iKg%2Fd82A9x9hg2kYV7 -huiliantongAppsecret=FA28E95ACABFA4B2B8E25857437B07F1 -huiliantongDistributorId=test -huiliantongSinopecUrl=fuelCouponsTest - -# ???????? +huiliantongUrl=https://gzapi.deepermobile.com.cn +huiliantongAppNo=guizhouhuilt +huiliantongAppkey=e0ja2Ex%2BmQ2hIPF6x%2BHA%3D +huiliantongAppsecret=52662415DDCE55C7BA34223BCF53877A +huiliantongSinopecDistributorId=aNId4A3X +huiliantongDistributorId=1JnL8YMV +huiliantongSinopecUrl=fuelCoupons + HuiLianTongUnionCardUrl=http://hltgz.com:4010/api/v2/execute.json HuiLianTongUnionCardAccessCode=6FCAE1470CEF465988351BB65ABAA8AE HuiLianTongUnionCardSignCode=F8E91A3C @@ -143,7 +143,7 @@ filesystem=https://hsgcs.dctpay.com/filesystem/ #payPostUrl=http://localhost:9601/crest/ # -blxPostUrl=https://vertical-formats-gateway.blx.bodata.cn:18443 +blxPostUrl=https://zhctapplet.gyzhtc.com/gateway #DianDian diandianwPostUrl=http://www.diandianw.cn/youdianyou/ @@ -161,3 +161,14 @@ GzPetroUrl = http://140.143.82.223:1588/gz GzPetroAppid = F0bdoJRwt GzPetroAppKey = pIyhCbA61wwyyU371QUSnBKqbWvO8Q98 GzPetroAesKey = pIyhCbA61wwyyU371QUSnBKqbWvO8Q98 + +#ETC +EtcPostUrl = https://test.djien-qr.com/ +EtcChannelCode = GZETCFXQD +EtcPublicKey = MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCMyQb5gR1rweB5oHKqRPJtJjLQKsn5PXOVfaNdGt/2kPkHvRdN3L9zOaAvFEXcEl2V0sg3D8a+2Sfy1YANAZvjscTQYOaoFl+LVyQZvgyyX8RQw+26Jmbqh8DwenUbNf7DFYVSDxIMBLOiWPkGsYGFONjsUVmfykSeVTcEgQB3VwIDAQAB +EtcPrivateKey = MIICeQIBADANBgkqhkiG9w0BAQEFAASCAmMwggJfAgEAAoGBAO8+KWh/OmBahFk7TWOEjPl13BT5NdlbGvQ/311Yua6CQqul9w1DIR2TwFUUh/Bko/eVoLROfF2XVjHbw2bImTdJ7y9C3511HI59YPNzqyql0DHjLxbH0VW92eUgk8mG09wtrUMu1ImN0b7aFE3uqAgz6pwh3TUiQWsDWz+l/MG7AgMBAAECgYEA7nYsOd8OpbmzT2m/omEdTwz9993KocKgZDJCBj4InftyTrrXO93cZSm/PE6BjMgTcxUuIGpWpcbRgFLHOmzZ4Qd+k/6Yb1ErMTfdGlgrxv2B+vztWYfjmFzEiXpecFH47ED6iYrrqm14X3InpnBv4rUkGdqqNbyPGgTO2ncs/3kCQQD+xqRAQSb/TROlqJdO91y6z9v0PO2GLmokqYg444rKYZKhDE0tdJeLU/sfK8SMg5+SlwdQm4nlo8EDJ/w2CEn3AkEA8GRqVkKgIuH413/a6+luYDjlf30WY7Mi1sm3QPSZ6+eH35UwsL6mdX6mjRpUN9Hez6FMfE7s3XOldoPVMzR1XQJBAOa2VTkGhtz8HEWQZOySXfuhjSogHmu7Dk2C5CO4Eg/wycpjDGSUR0NZWnfAt60S6GbjszEQmJBGeNt10xPO78MCQQCWXwnRaZ3IFDhXfQfRWFSN5ilQ5UszFGQvnUB/ZkI+ObdZmXY6qRdxGcdPLnAN9r78fDZe7/Pk1qljCDY98IuVAkEAnSeO/221gDhL1wnbUhGuX1yo8f5Eo/wDTW5cBxXFGZeexhB8I4jnEV4E/xmikkb3jDFvmrnFk+XUtDqkrvicRQ== + +#NUODE +NdPostUrl = http://nuode-test.yuetong18.cn/nuode-module-supplier/ +NdOrgCode = 19181483-91e9-4e13-9236-fb917ed9529d +NdKey= 5df3f620-e269-458d-9556-87e26d30256a \ No newline at end of file diff --git a/hai-service/src/main/resources/prod-9401/commonConfig.properties b/hai-service/src/main/resources/prod-9401/commonConfig.properties index 22e219d1..4dbf42b5 100644 --- a/hai-service/src/main/resources/prod-9401/commonConfig.properties +++ b/hai-service/src/main/resources/prod-9401/commonConfig.properties @@ -129,7 +129,7 @@ payPostUrl=https://pay.dctpay.com/crest/ filesystem=https://hsg.dctpay.com/filesystem/ -blxPostUrl=https://gateway.vf.bilinxing.com +blxPostUrl=https://zhctapplet.gyzhtc.com/gateway #DianDian diff --git a/hai-service/src/main/resources/prod/commonConfig.properties b/hai-service/src/main/resources/prod/commonConfig.properties index 622627c9..a405626a 100644 --- a/hai-service/src/main/resources/prod/commonConfig.properties +++ b/hai-service/src/main/resources/prod/commonConfig.properties @@ -4,16 +4,17 @@ gasDefaultOilStationImg=https://hsg.dctpay.com/filesystem/default/default_oil_st gasDefaultOilStationImg2=https://hsg.dctpay.com/filesystem/default/default_oil_station2.jpg # ChongQingCNPC configuration parameters + ChongQingCnpcUrl=http://cqpingan.wisdomyt.cn/d/cross/api ChongQingCnpcMerNo=7ygt1b2b8rpl7vttm6 ChongQingCnpcMerKey=5ojd0nkdqb1ff84t ChongQingCnpcCouponSignKey=pzj69n2r8l1l3kry - +* tuanYouUrl=https://hcs.czb365.com -tuanYouAppKey=210091174083104 -tuanYouAppSecret=f9811df6791d309bf48f4a8db9edaa45 +tuanYouAppKey=296780625346528 +tuanYouAppSecret=3b1bca319f7296ec4fabf21eef0ded7d tuanYouDieselAccount=9hp52qgg4400 -tuanYouGasolineAccount=9hp52qf04400 +tuanYouGasolineAccount=jd4b7lc44400 # tuanYouAppKey=232373843366592 # tuanYouAppSecret=b07cca748a3b83e27e4821d2a8423d91 # tuanYouDieselAccount=c2qitcag4400 @@ -133,7 +134,7 @@ payPostUrl=https://pay.dctpay.com/crest/ filesystem=https://hsg.dctpay.com/filesystem/ -blxPostUrl=https://gateway.vf.bilinxing.com +blxPostUrl=https://zhctapplet.gyzhtc.com/gateway #DianDian diff --git a/hai-user/src/main/resources/prod/application.yml b/hai-user/src/main/resources/prod/application.yml index 912c0ab5..11dae5d1 100644 --- a/hai-user/src/main/resources/prod/application.yml +++ b/hai-user/src/main/resources/prod/application.yml @@ -43,7 +43,7 @@ spring: #MQTT配置信息 mqtt: #MQTT服务地址 - url: ws://122.9.135.148:8083/mqtt + url: ws://1.95.43.71:8083/mqtt #用户名 username: printer_provider #密码 @@ -77,7 +77,7 @@ spring: mode: HTML5 rocketmq: - name-server: 122.9.135.148:9876 + name-server: 1.95.43.71:9876 producer: #必须指定group group: default-group diff --git a/v1/src/main/java/com/v1/controller/business/ApiCouponController.java b/v1/src/main/java/com/v1/controller/business/ApiCouponController.java index 16e19089..1f346132 100644 --- a/v1/src/main/java/com/v1/controller/business/ApiCouponController.java +++ b/v1/src/main/java/com/v1/controller/business/ApiCouponController.java @@ -217,6 +217,72 @@ public class ApiCouponController { } } + @RequestMapping(value = "/couponCqDetail", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "查询重庆中石油卡券详情") + public ResponseData couponCqDetail(@RequestBody JSONObject object , HttpServletRequest request) { + try { + + String ip; + // 有的user可能使用代理,为处理用户使用代理的情况,使用x-forwarded-for + if (request.getHeader("x-forwarded-for") == null) { + ip = request.getRemoteAddr(); + } else { + ip = request.getHeader("x-forwarded-for"); + } + + if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) { + log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); + } + + if ( + StringUtils.isBlank(object.getString("mchOrderNo")) || + StringUtils.isBlank(object.getString("sign")) || + StringUtils.isBlank(object.getString("timetable")) || + StringUtils.isBlank(object.getString("merchId")) + ) { + log.error("createOrder error!", "请求参数校验失败!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR); + } + + ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId")); + + if (apiMerchants == null) { + log.error("getRechargeProduct error!", "帐户错误!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_NOT_EXIST); + } + + if (!secConfigService.isConfig(OrderProductType.PRODUCT_TYPE18.getApiCode(), object.getString("merchId"))) { + log.error("getAllCities error!", "当前帐户无权限查询!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, ""); + } + + if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { + log.error("getRechargeProduct error!", "请求时间超过15分钟!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT); + } + + Map map = new HashMap<>(); + map.put("mchOrderNo" , object.getString("mchOrderNo")); + map.put("apiKey" , apiMerchants.getApiKey()); + map.put("timetable" , object.getString("timetable")); + map.put("merchId" , object.getString("merchId")); + + if (!secConfigService.isSignVerify(map, object.getString("sign"))) { + log.error("createOrder error!", "签名校验失败!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); + } + + + return ResponseMsgUtil.success(apiOrderService.findByOrderNo(object.getString("mchOrderNo") , null)); + + } catch (Exception e) { + log.error("HighOpenApiController --> createOrder() error!", e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value = "/getCheckCode", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "获取核销码") diff --git a/v1/src/main/java/com/v1/controller/business/GzSinopecController.java b/v1/src/main/java/com/v1/controller/business/GzSinopecController.java index f8fb79c8..ace2fdeb 100644 --- a/v1/src/main/java/com/v1/controller/business/GzSinopecController.java +++ b/v1/src/main/java/com/v1/controller/business/GzSinopecController.java @@ -137,10 +137,6 @@ public class GzSinopecController { ip = request.getHeader("x-forwarded-for"); } - if (!secConfigService.isConfig("IP_WHITE", ip)) { - log.error("couJointDist error!", "非法ip地址,请联系管理人员!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!"); - } if ( StringUtils.isBlank(object.getString("orderNo")) || @@ -176,11 +172,6 @@ public class GzSinopecController { throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); } - if (!secConfigService.isConfig(OrderProductType.PRODUCT_TYPE11.getApiCode(), object.getString("merchId"))) { - log.error("getAllCities error!", "当前帐户无权限查询!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, ""); - } - if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { log.error("getRechargeProduct error!", "请求时间超过15分钟!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT); diff --git a/v1/src/main/java/com/v1/controller/orderController.java b/v1/src/main/java/com/v1/controller/orderController.java index 91e77fa6..e0362b73 100644 --- a/v1/src/main/java/com/v1/controller/orderController.java +++ b/v1/src/main/java/com/v1/controller/orderController.java @@ -176,6 +176,14 @@ public class orderController { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未填写相关参数"); } } + if (object.getInteger("productType").equals(OrderProductType.PRODUCT_TYPE19.getNumber())) { + if ( StringUtils.isBlank(dataObject.getString("userMobile")) + || StringUtils.isBlank(dataObject.getString("couponCode")) + ) { + log.error("OrderController -> create() error!",""); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未填写相关参数"); + } + } return ResponseMsgUtil.success(apiOrderService.createOrder(object)); @@ -381,6 +389,7 @@ public class orderController { @ResponseBody @ApiOperation(value = "对外订单退款接口") public ResponseData externalOrderRefund(@RequestBody JSONObject object , HttpServletRequest request) { + try { String ip = ""; diff --git a/v1/src/main/resources/pre/application.yml b/v1/src/main/resources/pre/application.yml index 2dc5cc1a..80005285 100644 --- a/v1/src/main/resources/pre/application.yml +++ b/v1/src/main/resources/pre/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://122.9.135.148:3306/hsg?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://1.95.43.71:3306/hsg?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource diff --git a/v1/src/main/resources/prod/application.yml b/v1/src/main/resources/prod/application.yml index 345b8978..9ead130f 100644 --- a/v1/src/main/resources/prod/application.yml +++ b/v1/src/main/resources/prod/application.yml @@ -42,7 +42,7 @@ spring: #MQTT配置信息 mqtt: #MQTT服务地址 - url: ws://122.9.135.148:8083/mqtt + url: ws://1.95.43.71:8083/mqtt #用户名 username: printer_provider #密码 @@ -67,7 +67,7 @@ spring: write-dates-as-timestamps: true rocketmq: - name-server: 122.9.135.148:9876 + name-server: 1.95.43.71:9876 producer: #必须指定group group: default-group