diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java b/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java index 3b7a787d..82745409 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighTestController.java @@ -1 +1 @@ -package com.cweb.controller; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.cweb.config.SysConst; import com.hai.common.Base64Util; import com.hai.common.QRCodeGenerator; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.XmlUtil; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; import com.hai.common.utils.*; import com.hai.config.*; import com.hai.dao.HighGasOrderPushMapper; import com.hai.entity.*; import com.hai.enum_type.LoginPlatform; import com.hai.enum_type.MerchantStoreSourceType; import com.hai.model.*; import com.hai.pay.channel.huift.TradeService; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; import org.bouncycastle.util.encoders.UrlBase64; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.util.IdGenerator; import org.springframework.web.bind.annotation.*; import sun.nio.cs.StreamEncoder; import javax.annotation.Resource; import javax.net.ssl.SSLContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; import java.math.BigDecimal; import java.nio.charset.StandardCharsets; import java.security.KeyStore; import java.util.*; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private PayloService payloService; @Resource private HighGasService gasService; @Resource private HighUserService userService; @Resource private HighOrderService orderService; @Resource private HighMerchantStoreService merchantStoreService; @RequestMapping(value = "/invalidCoupon", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "重庆CNPC电子券作废") public ResponseData invalidCoupon(@RequestParam(name = "couponNo", required = true) String couponNo, @RequestParam(name = "random", required = false) String random) { try { return ResponseMsgUtil.success(ChongQingCNPCService.invalidCoupon(couponNo, null)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/ycShellPageQueryAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "订单退款") public ResponseData ycShellPageQueryAllStation() { try { return ResponseMsgUtil.success(payloService.ycShellPageQueryAllStation(1, 50)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/HuiLianTongConfigPayOrderByCouNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "") public ResponseData HuiLianTongConfigPayOrderByCouNo(@RequestParam(name = "couNo", required = true) String couNo) { try { JSONObject jsonObject = HuiLianTongConfig.getPayOrderByCouNo(couNo); if (jsonObject.getString("respCode").equals("0000")) { JSONObject data = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data")); return ResponseMsgUtil.success(data); } else { log.error("getRechargeProduct error!", "查询失败!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , "查询失败"); } } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getPayloAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "paylo油站") public ResponseData getPayloAllStation(HttpServletRequest request) { try { gasService.getPayloAllStation(); return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @Resource private TradeService tradeService; @RequestMapping(value = "/huiftTrade", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "huiftTrade") public ResponseData huiftTrade(HttpServletRequest request) { try { // return ResponseMsgUtil.success(tradeService.thirdPreOrder(orderService.getOrderByOrderNo("2024040215535447310"))); return ResponseMsgUtil.success(tradeService.thirdPayResult("P17124793186600955280")); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/loginBySilence", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "【H5】根据手机号登录") public ResponseData loginBySilence(@RequestParam(value = "phone", required = true) String phone , HttpServletRequest request, HttpServletResponse response) { try { // 客户端 LoginPlatform platform = LoginPlatform.getDataByType("H5"); if (platform == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知客户端"); } return ResponseMsgUtil.success(userService.loginAndRegister(platform, phone, null, new HashMap<>(), request, response)); } catch (Exception e) { return ResponseMsgUtil.exception(e); } } @Resource private HighQzOrderService highQzOrderService; @RequestMapping(value = "/getCinemaOrderByOrderNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "getCinemaOrderByOrderNo") public ResponseData getCinemaOrderByOrderNo(HttpServletRequest request, HttpServletResponse response) { try { return ResponseMsgUtil.success(QianZhuConfig.getCinemaOrderByOrderNo("20240429164821205766001")); // return ResponseMsgUtil.success(highQzOrderService.assemblyQzOrder("20240429164821205766001", "CINEMA")); } catch (Exception e) { return ResponseMsgUtil.exception(e); } } public static void main(String[] args) throws Exception { // 读取json文件内容 BufferedReader reader = new BufferedReader(new FileReader("C:/Users/hurui/Desktop/无标题.json")); StringBuilder jsonContent = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { jsonContent.append(line); } reader.close(); // 解析json字符串 JSONArray dataList = JSONObject.parseObject(jsonContent.toString()).getJSONArray("RECORDS"); for (Object obj : dataList) { JSONObject data = (JSONObject) obj; // 生成二维码 String qrCodeImg = data.getString("store_key")+".png"; String qrCodeUrl = "D:/qrCode/" + qrCodeImg; //参数 String param = "https://hsg.dctpay.com/hsgH5?accountId=000000&gasKey="+data.getString("store_key")+"&code="; QRCodeGenerator.generateQRCodeImage(param, 350, 350, qrCodeUrl); } } } \ No newline at end of file +package com.cweb.controller; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.cweb.config.SysConst; import com.hai.common.Base64Util; import com.hai.common.QRCodeGenerator; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.XmlUtil; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; import com.hai.common.utils.*; import com.hai.config.*; import com.hai.dao.HighGasOrderPushMapper; import com.hai.entity.*; import com.hai.enum_type.LoginPlatform; import com.hai.enum_type.MerchantStoreSourceType; import com.hai.model.*; import com.hai.pay.channel.huift.TradeService; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; import org.bouncycastle.util.encoders.UrlBase64; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.util.IdGenerator; import org.springframework.web.bind.annotation.*; import sun.nio.cs.StreamEncoder; import javax.annotation.Resource; import javax.net.ssl.SSLContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; import java.math.BigDecimal; import java.nio.charset.StandardCharsets; import java.security.KeyStore; import java.util.*; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private PayloService payloService; @Resource private HighGasService gasService; @Resource private HighUserService userService; @Resource private HighOrderService orderService; @Resource private HighMerchantStoreService merchantStoreService; @RequestMapping(value = "/invalidCoupon", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "重庆CNPC电子券作废") public ResponseData invalidCoupon(@RequestParam(name = "couponNo", required = true) String couponNo, @RequestParam(name = "random", required = false) String random) { try { return ResponseMsgUtil.success(ChongQingCNPCService.invalidCoupon(couponNo, null)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/costRechargeOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "costRechargeOrder") public ResponseData costRechargeOrder() { try { JSONObject returnParam = JSONObject.parseObject("{\"respMessage\":\"ok\",\"data\":\"Gbkl57c3fEBg+E3HfPuQ55SDLVyAf2Ys3VN1cifAfXIoT1gnbFR0Nfupa+4sowIdXJ67nC57v4Oi\\nVTimfZ1NiLLnhV9Ip3O3LewpnKqdhJh56X7oeY/ZnCEc/I7SWsTgv1Mol+ZVYxNjFD41RM4NWcxR\\nNYjA4iAIgJaFnLhaaj0aBqz5R4dM5c+bCTnqwAd4a6s5umDZJLtSPJAdpfsV4l/WtnhMYTjCrYO8\\nGgKuHwQ17gCOzLwy8K9ZnZAuMtHHMFGNavjAAdmIsNMnkbRfbMkdMFw9nti/uKciSvpRIfsmFzNf\\nEXtpbqCbcbzneGzb7Nfwf6/0cItdxCzwM/rJs/QuCwJbGTVCxwoR8hf3M/pjYANIB7WhjHvt+vIT\\nh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WO2YCYkZSD9myPsTY5xKd8BU4+diUcRs\\nRkwH7UoTcgtQic3UZwBL8wfjlBKwXNYI/lvdu7iG1R67oS0/EeEb050jpIYa2mpGBRxe8YxLg/od\\ncxBXCrX5k/J+/CgMPEpM6+AX/CKwOZ3J+RaWtrExJLMwOEGf14T0KdxgX2FzxFUyUkWuNmWLjJs/\\nBjpCjwMVusY819raZWLfgDJO6bf56G2nk0A4rxCrtGCQy5ziEu04k635sIJ2tzBgrwtIgvkvGsTB\\n7ryBk5pt1R635zkDpLP0H0aai0KepzEXnclFGooP6BhOh82BA5K2iXvcOQ4hfnqIF9RYAzs/8jg9\\nC/366udb8X6aCN9xu4oiyHgvFSoL4kIetE1sj0fRPldWcZVAL84Z2kM1Ho40pvkaQO+eFjET/7fa\\ndEtTq7DJYFXL2ZNVO5NXtN0PEQWfiv6NjnT0mA==\",\"sign\":\"092D1C30297952E42D02C44681BE0FA4\",\"respCode\":\"0000\",\"responseId\":\"1722851470478\"}"); // 解密 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 = "/hltCardRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "汇联通卡退款") public ResponseData hltCardRefund() { try { String refundOrderNo = "R240807134052188"; String paySerialNo = "240801075734765689"; JSONObject refund = HuiLianTongUnionCardConfig.refund(refundOrderNo, paySerialNo); if(!refund.getString("respCode").equals("0000")) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR,refund.getString("respMessage")); } JSONObject consumptionResult = HuiLianTongUnionCardConfig.resolveResponse(refund.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("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @Resource private MqttProviderConfig mqttProviderConfig; @Resource private HighGasOrderService gasOrderService; @RequestMapping(value = "/mqttpublish", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "mqttpublish") public ResponseData mqttpublish() { try { HighGasOrder gasOrder = gasOrderService.getDetailByOrderNo("HF2022080713272355608"); JSONObject param = new JSONObject(); param.put("id", System.currentTimeMillis()); param.put("type", 5); //param.put("vType", 0); //param.put("vMessage", "嗨加油新订单,加油金额"+gasOrder.getGasRefuelPrice()+"元,请注意查收"); JSONArray contents = new JSONArray(); // 标题 JSONObject title = new JSONObject(); title.put("cont", "嗨加油"); title.put("type", "title"); contents.add(title); // 油站名称 JSONObject merName = new JSONObject(); merName.put("cont", gasOrder.getStoreName() + "(补打)"); merName.put("type", "text"); merName.put("align", "center"); merName.put("bold", true); contents.add(merName); // 存根 JSONObject stub = new JSONObject(); stub.put("cont", "(收银员存根)"); stub.put("type", "text"); stub.put("align", "center"); contents.add(stub); // 分割线 JSONObject divLine1 = new JSONObject(); divLine1.put("cont", ""); divLine1.put("type", "div_star"); contents.add(divLine1); // 订单号 JSONObject orderNo = new JSONObject(); orderNo.put("cont", "流水:" + gasOrder.getOrderNo()); orderNo.put("type", "text"); contents.add(orderNo); // 分割线 JSONObject divLine2 = new JSONObject(); divLine2.put("cont", ""); divLine2.put("type", "div_star"); contents.add(divLine2); // 打印时间 JSONObject printTime = new JSONObject(); printTime.put("cont", "打印时间:" + DateUtil.date2String(new Date(), DateUtil.Y_M_D_HMS)); printTime.put("type", "text"); contents.add(printTime); // 支付时间 JSONObject payTime = new JSONObject(); payTime.put("cont", "支付时间:" + DateUtil.date2String(gasOrder.getPayTime(), DateUtil.Y_M_D_HMS)); payTime.put("type", "text"); contents.add(payTime); // 电话 JSONObject userPhone = new JSONObject(); userPhone.put("cont", "电话:" + (StringUtils.isNotBlank(gasOrder.getMemPhone())?gasOrder.getMemPhone().substring(0, 3) + "****" + gasOrder.getMemPhone().substring(7):"")); userPhone.put("type", "text"); contents.add(userPhone); // 来源 JSONObject source = new JSONObject(); source.put("cont", "来源:" + "嗨加油"); source.put("type", "text"); contents.add(source); // 枪号 JSONObject gunNo = new JSONObject(); gunNo.put("cont", "油枪:" + gasOrder.getGasGunNo()+"号"); gunNo.put("type", "text"); contents.add(gunNo); // 油品 JSONObject oilNo = new JSONObject(); oilNo.put("cont", "油品:" + gasOrder.getGasOilNo()+"#"); oilNo.put("type", "text"); contents.add(oilNo); // 升数 JSONObject oilLiters = new JSONObject(); oilLiters.put("cont", "升数:" + gasOrder.getGasOilLiters()+"升"); oilLiters.put("type", "text"); contents.add(oilLiters); // 升数描述 JSONObject oilLitersDesc = new JSONObject(); oilLitersDesc.put("cont", "实际加油升数以油站加油机为准!"); oilLitersDesc.put("type", "text"); contents.add(oilLitersDesc); // 分割线 JSONObject divLine3 = new JSONObject(); divLine3.put("cont", ""); divLine3.put("type", "div_star"); contents.add(divLine3); // 加油金额标题 JSONObject refuelPriceTitle = new JSONObject(); refuelPriceTitle.put("cont", "加油金额"); refuelPriceTitle.put("type", "text"); refuelPriceTitle.put("size", "11"); contents.add(refuelPriceTitle); // 加油金额 JSONObject refuelPrice = new JSONObject(); refuelPrice.put("cont", "¥" + gasOrder.getGasRefuelPrice() + "元"); refuelPrice.put("type", "text"); refuelPrice.put("size", "11"); contents.add(refuelPrice); // 分割线 JSONObject divLine4 = new JSONObject(); divLine4.put("cont", ""); divLine4.put("type", "div_star"); contents.add(divLine4); // 小票底部 JSONObject receiptBottom = new JSONObject(); receiptBottom.put("cont", "开心又省钱;来“ 嗨森逛 ”"); receiptBottom.put("type", "text"); receiptBottom.put("align", "center"); contents.add(receiptBottom); JSONObject cut = new JSONObject(); cut.put("cont", "1"); cut.put("type", "cut"); contents.add(cut); param.put("contents", contents); mqttProviderConfig.publish(1, false, "SW242300044/submsg", param.toJSONString()); return ResponseMsgUtil.success(null); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/ycShellPageQueryAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "订单退款") public ResponseData ycShellPageQueryAllStation() { try { return ResponseMsgUtil.success(payloService.ycShellPageQueryAllStation(1, 50)); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/HuiLianTongConfigPayOrderByCouNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "") public ResponseData HuiLianTongConfigPayOrderByCouNo(@RequestParam(name = "couNo", required = true) String couNo) { try { JSONObject jsonObject = HuiLianTongConfig.getPayOrderByCouNo(couNo); if (jsonObject.getString("respCode").equals("0000")) { JSONObject data = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data")); return ResponseMsgUtil.success(data); } else { log.error("getRechargeProduct error!", "查询失败!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , "查询失败"); } } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getPayloAllStation", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "paylo油站") public ResponseData getPayloAllStation(HttpServletRequest request) { try { gasService.getPayloAllStation(); return ResponseMsgUtil.success(""); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @Resource private TradeService tradeService; @RequestMapping(value = "/huiftTrade", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "huiftTrade") public ResponseData huiftTrade(HttpServletRequest request) { try { // return ResponseMsgUtil.success(tradeService.thirdPreOrder(orderService.getOrderByOrderNo("2024040215535447310"))); return ResponseMsgUtil.success(tradeService.thirdPayResult("P17124793186600955280")); } catch (Exception e) { log.error("HighOrderController --> unionStagingPay() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/loginBySilence", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "【H5】根据手机号登录") public ResponseData loginBySilence(@RequestParam(value = "phone", required = true) String phone , HttpServletRequest request, HttpServletResponse response) { try { // 客户端 LoginPlatform platform = LoginPlatform.getDataByType("H5"); if (platform == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知客户端"); } return ResponseMsgUtil.success(userService.loginAndRegister(platform, phone, null, new HashMap<>(), request, response)); } catch (Exception e) { return ResponseMsgUtil.exception(e); } } @Resource private HighQzOrderService highQzOrderService; @RequestMapping(value = "/getCinemaOrderByOrderNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "getCinemaOrderByOrderNo") public ResponseData getCinemaOrderByOrderNo(HttpServletRequest request, HttpServletResponse response) { try { return ResponseMsgUtil.success(QianZhuConfig.getCinemaOrderByOrderNo("20240429164821205766001")); // return ResponseMsgUtil.success(highQzOrderService.assemblyQzOrder("20240429164821205766001", "CINEMA")); } catch (Exception e) { return ResponseMsgUtil.exception(e); } } public static void main(String[] args) throws Exception { // 读取json文件内容 BufferedReader reader = new BufferedReader(new FileReader("C:/Users/hurui/Desktop/无标题.json")); StringBuilder jsonContent = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { jsonContent.append(line); } reader.close(); // 解析json字符串 JSONArray dataList = JSONObject.parseObject(jsonContent.toString()).getJSONArray("RECORDS"); for (Object obj : dataList) { JSONObject data = (JSONObject) obj; // 生成二维码 String qrCodeImg = data.getString("store_key")+".png"; String qrCodeUrl = "D:/qrCode/" + qrCodeImg; //参数 String param = "https://hsg.dctpay.com/hsgH5?accountId=000000&gasKey="+data.getString("store_key")+"&code="; QRCodeGenerator.generateQRCodeImage(param, 350, 350, qrCodeUrl); } } } \ No newline at end of file diff --git a/hai-schedule/src/main/java/com/hai/schedule/ApiBlxCouponSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/ApiBlxCouponSchedule.java index 14cc8bf9..c60a9bfa 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/ApiBlxCouponSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/ApiBlxCouponSchedule.java @@ -26,7 +26,7 @@ public class ApiBlxCouponSchedule { @Resource private BlxConfig blxConfig; - +/* @Scheduled(cron="0 0/60 * * * ?") //每60分钟执行一次 public void getBlxCoupon() { JSONObject object = blxConfig.queryCouponPage(); @@ -72,6 +72,6 @@ public class ApiBlxCouponSchedule { } - } + }*/ } diff --git a/hai-schedule/src/main/java/com/hai/schedule/ApiThirdProductSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/ApiThirdProductSchedule.java index 0eaea54c..b8616ebf 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/ApiThirdProductSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/ApiThirdProductSchedule.java @@ -25,6 +25,7 @@ public class ApiThirdProductSchedule { @Resource private ApiProductService apiProductService; +/* @Scheduled(cron="0 0/30 * * * ?") //每30分钟执行一次 public void getStarbucksProducts() throws Exception { @@ -116,5 +117,6 @@ public class ApiThirdProductSchedule { } } } +*/ } diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java index 4a397172..f723c06b 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighCouponSchedule.java @@ -74,11 +74,11 @@ public class HighCouponSchedule { } } - /** +/* *//** * @Author 胡锐 * @Description 处理汇联卡券状态 * @Date 2021/4/4 22:44 - **/ + **//* @Scheduled(cron="0 0/10 * * * ?") //每10分钟执行一次 public void handleCouponStatus() throws Exception { HighCouponCodeOtherExample example = new HighCouponCodeOtherExample(); @@ -129,7 +129,7 @@ public class HighCouponSchedule { } } } - } + }*/ @Scheduled(cron="0 0/15 * * * ?") //每30分钟执行一次 diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighDiscountSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighDiscountSchedule.java index 92908b3e..6c4f39a6 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighDiscountSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighDiscountSchedule.java @@ -43,7 +43,7 @@ public class HighDiscountSchedule { * @Date 2021/4/4 22:44 **/ //@Scheduled(cron = "5 0 0 * * ?") //每日凌晨12点5秒执行一次 - @Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 +/* @Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次 public void expiredDiscount() { List expiredDiscount = highDiscountUserRelService.getExpiredDiscount(); for (HighDiscountUserRel rel : expiredDiscount) { @@ -61,10 +61,10 @@ public class HighDiscountSchedule { log.error("HighCouponSchedule --> expiredCoupon() error!", e); } } - } + }*/ - @Scheduled(cron = "0 5 0 * * ?") // 每日凌晨00:00:5执行一次 +/* @Scheduled(cron = "0 5 0 * * ?") // 每日凌晨00:00:5执行一次 public void deleteOilNo() { List list = bsTemporaryServices.getList(new HashMap<>()); @@ -80,6 +80,6 @@ public class HighDiscountSchedule { } - } + }*/ } 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 91bfa457..e148c840 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighGasSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighGasSchedule.java @@ -147,22 +147,24 @@ public class HighGasSchedule { // } // } // } +/* @Scheduled(cron = "5 0 0 * * ?") // 每日凌晨00:00:5执行一次 public void getJiaHaoYouAllStation() throws Exception { // gasService.getJiaHaoYouAllStation(); } +*/ // @Scheduled(cron = "5 0 0 * * ?") // 每日凌晨00:00:5执行一次 // public void getPayloAllStation() throws Exception { // gasService.getPayloAllStation(); // } - @Scheduled(cron = "5 0 0 * * ?") // 每日凌晨00:00:5执行一次 + @Scheduled(cron = "0 0 2 * * ?") // 每日凌晨00:00:5执行一次 public void getDianAllStation() throws Exception { gasService.getDianAllStation(); } - @Scheduled(cron = "0 0 3 * * ?") // 每日凌晨00:00:7执行一次 + @Scheduled(cron = "0 0 4 * * ?") // 每日凌晨00:00:7执行一次 public void deleteOilNo() { gasService.deleteOilNo(); } diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighIntegralSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighIntegralSchedule.java index 56d78933..30ed4cd3 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighIntegralSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighIntegralSchedule.java @@ -30,7 +30,7 @@ public class HighIntegralSchedule { @Resource private HighUserService highUserService; - @Scheduled(cron="0 0/5 * * * ?") //每5分钟执行一次 +/* @Scheduled(cron="0 0/5 * * * ?") //每5分钟执行一次 public void integralRebateOrder() { List list = highGoldRecService.selectByExpiringSoonByAll(365); @@ -44,6 +44,6 @@ public class HighIntegralSchedule { } - } + }*/ } diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java index 79611110..c0226294 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java @@ -74,7 +74,7 @@ public class HighOrderSchedule { * @Param [] * @return void */ - @Scheduled(cron="0 0/10 * * * ?") //每 10分钟执行一次 +/* @Scheduled(cron="0 0/10 * * * ?") //每 10分钟执行一次 public void integralRebateOrder() { // 查询满足初步返利条件订单 @@ -99,7 +99,7 @@ public class HighOrderSchedule { highOrderService.updateOrderDetail(highOrder); } - } + }*/ } diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighRechargeOrderSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighRechargeOrderSchedule.java index 82a8f998..f2c8c80b 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighRechargeOrderSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighRechargeOrderSchedule.java @@ -50,7 +50,7 @@ public class HighRechargeOrderSchedule { * @Date 14:18 2022/5/31 * @Param [] */ - @Scheduled(cron = "0 0/60 * * * ?") //每60分钟执行一次 +/* @Scheduled(cron = "0 0/60 * * * ?") //每60分钟执行一次 public void initRechargeOrder() { log.info("处理话费订单定时任务开始"); Map map = new HashMap<>(); @@ -67,7 +67,7 @@ public class HighRechargeOrderSchedule { } } } - } + }*/ } diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighTestController.java b/hai-schedule/src/main/java/com/hai/schedule/HighTestController.java deleted file mode 100644 index 8cb6e933..00000000 --- a/hai-schedule/src/main/java/com/hai/schedule/HighTestController.java +++ /dev/null @@ -1 +0,0 @@ -package com.hai.schedule; 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.pay.util.XmlUtil; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.utils.DateUtil; 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.HighGasOrderPushMapper; import com.hai.entity.*; import com.hai.model.HighMerchantModel; import com.hai.model.HighMerchantStoreModel; import com.hai.model.ResponseData; import com.hai.model.ResultProfitSharing; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import javax.net.ssl.SSLContext; import javax.servlet.http.HttpServletRequest; import java.io.FileInputStream; import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.security.KeyStore; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.*; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private HighMerchantService highMerchantService; @Resource private HighMerchantStoreService highMerchantStoreService; @Resource private HighGasOilPriceService highGasOilPriceService; @Resource private HighOrderService highOrderService; @Resource private HighProfitSharingRecordService highProfitSharingRecordService; @Resource private HighGasOrderPushMapper highGasOrderPushMapper; @Resource private HuiLianTongConfig huiLianTongConfig; @Resource private UnionPayConfig unionPayConfig; @Resource private SecSinopecConfigService secSinopecConfigService; @Resource private HighCouponCodeService highCouponCodeService; @RequestMapping(value = "/synchronizeCNPC", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "同步重庆中石化") public ResponseData synchronizeCNPC(HttpServletRequest request) { List sinopecConfigList = secSinopecConfigService.getListSinopecConfig(new HashMap<>()); for (SecSinopecConfig config : sinopecConfigList) { try { String token = getCnpcToken(config.getAppId(), config.getAppSecret()); if (token != null) { Calendar instance = Calendar.getInstance(); instance.set(Calendar.YEAR, 2021); instance.set(Calendar.MONTH, 9); instance.set(Calendar.DATE, 1); instance.set(Calendar.MINUTE, 00); instance.set(Calendar.SECOND, 00); instance.set(Calendar.MILLISECOND, 00); Map bodyMap = new HashMap<>(); bodyMap.put("appId", config.getAppId()); bodyMap.put("pageNo", 1); bodyMap.put("pageSize", 1000); bodyMap.put("startTime", instance.getTime()); bodyMap.put("endTime", new Date()); bodyMap.put("customerCode", config.getCode()); Long date = new Date().getTime(); String sha256 = encodeBySHA256(config.getSignkey() + JSON.toJSONString(bodyMap) + date); JSONObject object = HttpsUtils.doPost("https://app.zshcqsy.com/api-provider/sapapi/open/coupon/customerRedeemcodeList", JSON.toJSONString(bodyMap), token, sha256, date); if(Objects.equals(object.get("success"), true)) { Object dataJson = JSONObject.parse(JSONObject.toJSONString(object.get("data"))); JSONObject dataObject = JSON.parseObject(JSONObject.toJSONString(dataJson)); // 总页数 int rowPageCount = new BigDecimal(dataObject.getString("rowCount")).divide(new BigDecimal("100"), 0, BigDecimal.ROUND_UP).intValue(); for (int i = 1; i < rowPageCount;i++) { token = getCnpcToken(config.getAppId(), config.getAppSecret()); bodyMap.clear(); bodyMap.put("appId", config.getAppId()); bodyMap.put("pageNo", i); bodyMap.put("pageSize", 1000); bodyMap.put("startTime", instance.getTime()); bodyMap.put("endTime", new Date()); bodyMap.put("customerCode", config.getCode()); Long date2 = new Date().getTime(); sha256 = encodeBySHA256(config.getSignkey() + JSON.toJSONString(bodyMap) + date); object = HttpsUtils.doPost("https://app.zshcqsy.com/api-provider/sapapi/open/coupon/customerRedeemcodeList", JSON.toJSONString(bodyMap), token, sha256, date); if (Objects.equals(object.get("success"), true)) { dataJson = JSONObject.parse(JSONObject.toJSONString(object.get("data"))); dataObject = JSON.parseObject(JSONObject.toJSONString(dataJson)); JSONArray list = dataObject.getJSONArray("list"); for (Object dataJsonObject : list) { try { JSONObject parseObject = JSON.parseObject(JSON.toJSONString(dataJsonObject)); String codeId = parseObject.getString("codeId"); String nodeName = parseObject.getString("nodeName"); Date useTime = DateUtil.format(parseObject.getString("useTime"), "yyyy-MM-dd HH:mm:ss"); highCouponCodeService.cnpcCallbackCouponCode(codeId, useTime, nodeName); } catch (Exception e) { log.error("HighCouponSchedule --> expiredCoupon() error!", e); } } } } } } } catch (Exception e) { log.error("HighUserCardController --> oilCardRefund() error!", e); return ResponseMsgUtil.exception(e); } } return ResponseMsgUtil.success(null); } private String getCnpcToken(String appId,String appSecret) { Map tokenMap = new HashMap<>(); tokenMap.put("appId", appId); tokenMap.put("appSecret", appSecret); JSONObject jsonObject = HttpsUtils.doPost("https://app.zshcqsy.com/api-provider/api/open/merchant/token", JSON.toJSONString(tokenMap)); log.error(jsonObject.toJSONString()); if (jsonObject != null && jsonObject.getBoolean("success") == true) { JSONObject data = jsonObject.getJSONObject("data"); String token = data.getString("token"); return token; } return null; } public String encodeBySHA256(String str) { try{ MessageDigest messageDigest = MessageDigest.getInstance("SHA-256"); messageDigest.reset(); messageDigest.update(str.getBytes("UTF-8")); return getFormattedText(messageDigest.digest()); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (Exception e) { throw new RuntimeException(e); } return ""; } private static final String[] HEX_DIGITS = {"0" ,"1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"}; private String getFormattedText(byte[] bytes) { int len = bytes.length; StringBuilder buf = new StringBuilder(len * 2); // 把密文转换成十六进制的字符串形式 for (int j=0;j> 4) & 0x0f]); buf.append(HEX_DIGITS[bytes[j] & 0x0f]); } return buf.toString(); } } \ No newline at end of file diff --git a/hai-schedule/src/main/java/com/hai/schedule/SynchronizeCNPC.java b/hai-schedule/src/main/java/com/hai/schedule/SynchronizeCNPC.java index 2ddbcfa3..3bbad525 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/SynchronizeCNPC.java +++ b/hai-schedule/src/main/java/com/hai/schedule/SynchronizeCNPC.java @@ -38,7 +38,7 @@ public class SynchronizeCNPC { @Resource private SecSinopecConfigService secSinopecConfigService; - +/* @Scheduled(cron="0 0/5 * * * ?") //每5分钟执行一次 public void certification() { @@ -145,7 +145,7 @@ public class SynchronizeCNPC { } } } - } + }*/ /*@Scheduled(cron="0 0/1 * * * ?") //每5分钟执行一次 public void certification3(){