From 0c47196664b7bac572d3324cdf33af45960cc0e7 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 23 May 2023 10:49:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/v1/BsTradeController.java | 59 +++++++++++++++++++ .../src/main/resources/dev/application.yml | 45 ++++++++++++-- .../src/main/resources/dev/config.properties | 13 +++- open-api/src/main/resources/dev/logback.xml | 43 ++++++++++++++ .../src/main/resources/pre/application.yml | 4 +- .../src/main/resources/pre/config.properties | 7 ++- .../src/main/resources/prod/application.yml | 48 +++++++++++++-- .../src/main/resources/prod/config.properties | 13 +++- open-api/src/main/resources/prod/logback.xml | 42 +++++++++++++ .../channel/lakala/LaKaLaLedgerService.java | 16 ++--- .../openapi/v1/model/TradePreorderModel.java | 15 +++++ .../com/hfkj/openapi/v1/utils/MD5Util.java | 31 ++++++++++ .../hfkj/service/impl/BsMerServiceImpl.java | 9 --- 13 files changed, 311 insertions(+), 34 deletions(-) create mode 100644 open-api/src/main/java/com/api/controller/v1/BsTradeController.java create mode 100644 service/src/main/java/com/hfkj/openapi/v1/model/TradePreorderModel.java create mode 100644 service/src/main/java/com/hfkj/openapi/v1/utils/MD5Util.java diff --git a/open-api/src/main/java/com/api/controller/v1/BsTradeController.java b/open-api/src/main/java/com/api/controller/v1/BsTradeController.java new file mode 100644 index 0000000..6aa4878 --- /dev/null +++ b/open-api/src/main/java/com/api/controller/v1/BsTradeController.java @@ -0,0 +1,59 @@ +package com.api.controller.v1; + +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hfkj.common.exception.ErrorCode; +import com.hfkj.common.exception.ErrorHelp; +import com.hfkj.common.exception.SysCode; +import com.hfkj.common.security.UserCenter; +import com.hfkj.common.utils.ResponseMsgUtil; +import com.hfkj.config.hsg.UserDiscountService; +import com.hfkj.entity.*; +import com.hfkj.model.ResponseData; +import com.hfkj.model.UserDiscount; +import com.hfkj.model.UserInfoModel; +import com.hfkj.openapi.v1.model.TradePreorderModel; +import com.hfkj.service.*; +import com.hfkj.sysenum.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; + +@Controller +@Api(value = "交易订单") +@RequestMapping(value = "/v1/trade") +public class BsTradeController { + + private static Logger log = LoggerFactory.getLogger(BsTradeController.class); + + @RequestMapping(value="/preorder",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "聚合主扫") + public ResponseData preorder(@RequestBody TradePreorderModel body, HttpServletRequest request) { + try { + if (body == null) { + log.error("configStore error!", "参数错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + // 创建交易订单 + return ResponseMsgUtil.success(null); + + } catch (Exception e) { + log.error(e.getMessage(), e); + return ResponseMsgUtil.exception(e); + } + } + +} diff --git a/open-api/src/main/resources/dev/application.yml b/open-api/src/main/resources/dev/application.yml index dc901ed..ed2f5e7 100644 --- a/open-api/src/main/resources/dev/application.yml +++ b/open-api/src/main/resources/dev/application.yml @@ -1,5 +1,5 @@ server: - port: 9504 + port: 9605 servlet: context-path: /openApi @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.9.154.68:3306/xuan_pay?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://139.9.154.68:3306/gratia_pay?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource @@ -28,7 +28,7 @@ spring: poolPreparedStatements: true maxOpenPreparedStatements: 20 redis: - database: 4 + database: 6 host: 139.9.154.68 port: 36379 password: HF123456.Redis @@ -43,9 +43,46 @@ spring: jackson: serialization: write-dates-as-timestamps: true + #MQTT配置信息 + mqtt: + #MQTT服务地址 + url: ws://139.9.154.68:8083/mqtt + #用户名 + username: printer_provider + #密码 + password: 123654 + #客户端id(不能重复) + # client: + # id: provider-id + #MQTT默认的消息推送主题,实际可在调用接口是指定 + # default: + # topic: topic +jetcache: + statIntervalMinutes: 15 + areaInCacheName: false + local: + default: + type: linkedhashmap + keyConvertor: fastjson + remote: + default: + type: redis + host: 139.9.154.68 + port: 36379 + password: HF123456.Redis + database: 6 + keyConvertor: fastjson + broadcastChannel: projectA + valueEncoder: java + valueDecoder: java + poolConfig: + minIdle: 5 + maxIdle: 20 + maxTotal: 50 + mybatis: mapperLocations: - - classpath*:sqlmap*/*.xml + - classpath*:sqlmap*/*.xml type-aliases-package: org.springboot.sample.entity diff --git a/open-api/src/main/resources/dev/config.properties b/open-api/src/main/resources/dev/config.properties index 44ea8fc..185a8ae 100644 --- a/open-api/src/main/resources/dev/config.properties +++ b/open-api/src/main/resources/dev/config.properties @@ -1,2 +1,11 @@ -fileUrl=/home/project/hsg/filesystem -cmsPath=/home/project/hsg/filesystem/cmsPath +fileUrl=/home/project/gratia-pay/filesystem +cmsPath=/home/project/gratia-pay/filesystem/cmsPath + +wxAppId=wxa075e8509802f826 +wxAppSecret=0e606fc1378d35e359fcf3f15570b2c5 + +// WeChat service provider +wxUnifiedOrderUrl=https://api.mch.weixin.qq.com/pay/unifiedorder +wxMchAppId=wx637bd6f7314daa46 +wxApiKey=Skufk5oi85wDFGl888i6wsRSTkdd5df5 +wxMchId=1289663601 diff --git a/open-api/src/main/resources/dev/logback.xml b/open-api/src/main/resources/dev/logback.xml index 9382585..6011524 100644 --- a/open-api/src/main/resources/dev/logback.xml +++ b/open-api/src/main/resources/dev/logback.xml @@ -69,4 +69,47 @@ + + + + log/alipay/alipaylog.log + + log/alipay.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + + + + + + log/hsg.log + + log/hsg/hsg.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + + + diff --git a/open-api/src/main/resources/pre/application.yml b/open-api/src/main/resources/pre/application.yml index 63a318a..3ced589 100644 --- a/open-api/src/main/resources/pre/application.yml +++ b/open-api/src/main/resources/pre/application.yml @@ -1,5 +1,5 @@ server: - port: 9554 + port: 9605 servlet: context-path: /openApi @@ -45,7 +45,7 @@ spring: write-dates-as-timestamps: true mybatis: mapperLocations: - - classpath*:sqlmap*/*.xml + - classpath*:sqlmap*/*.xml type-aliases-package: org.springboot.sample.entity diff --git a/open-api/src/main/resources/pre/config.properties b/open-api/src/main/resources/pre/config.properties index 44ea8fc..bc58e52 100644 --- a/open-api/src/main/resources/pre/config.properties +++ b/open-api/src/main/resources/pre/config.properties @@ -1,2 +1,5 @@ -fileUrl=/home/project/hsg/filesystem -cmsPath=/home/project/hsg/filesystem/cmsPath +fileUrl=/home/project/xuan-pay/filesystem +cmsPath=/home/project/xuan-pay/filesystem/cmsPath + +wxAppId=wxa075e8509802f826 +wxAppSecret=0e606fc1378d35e359fcf3f15570b2c5 diff --git a/open-api/src/main/resources/prod/application.yml b/open-api/src/main/resources/prod/application.yml index c2962a2..2aa3c58 100644 --- a/open-api/src/main/resources/prod/application.yml +++ b/open-api/src/main/resources/prod/application.yml @@ -1,5 +1,5 @@ server: - port: 9504 + port: 9605 servlet: context-path: /openApi @@ -9,9 +9,9 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://127.0.0.1:3306/xuan_pay?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8 - username: root - password: HF123456. + url: jdbc:mysql://192.168.0.63:21100/gratia_pay?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + username: gratia_pay + password: HUfukeji123456!@# type: com.alibaba.druid.pool.DruidDataSource driver-class-name: com.mysql.jdbc.Driver filters: stat @@ -27,6 +27,7 @@ spring: testOnReturn: false poolPreparedStatements: true maxOpenPreparedStatements: 20 + redis: database: 2 host: 127.0.0.1 @@ -43,10 +44,47 @@ spring: jackson: serialization: write-dates-as-timestamps: true + #MQTT配置信息 + mqtt: + #MQTT服务地址 + url: ws://140.210.192.36:8083/mqtt + #用户名 + username: printer_provider + #密码 + password: abcd123! + #客户端id(不能重复) + # client: + # id: provider-id + #MQTT默认的消息推送主题,实际可在调用接口是指定 + # default: + # topic: topic + +jetcache: + statIntervalMinutes: 15 + areaInCacheName: false + local: + default: + type: linkedhashmap + keyConvertor: fastjson + remote: + default: + type: redis + host: 127.0.0.1 + port: 36379 + password: HF123456.Redis + database: 2 + keyConvertor: fastjson + broadcastChannel: projectA + valueEncoder: java + valueDecoder: java + poolConfig: + minIdle: 5 + maxIdle: 20 + maxTotal: 50 mybatis: mapperLocations: - - classpath*:sqlmap*/*.xml + - classpath*:sqlmap*/*.xml type-aliases-package: org.springboot.sample.entity diff --git a/open-api/src/main/resources/prod/config.properties b/open-api/src/main/resources/prod/config.properties index 44ea8fc..185a8ae 100644 --- a/open-api/src/main/resources/prod/config.properties +++ b/open-api/src/main/resources/prod/config.properties @@ -1,2 +1,11 @@ -fileUrl=/home/project/hsg/filesystem -cmsPath=/home/project/hsg/filesystem/cmsPath +fileUrl=/home/project/gratia-pay/filesystem +cmsPath=/home/project/gratia-pay/filesystem/cmsPath + +wxAppId=wxa075e8509802f826 +wxAppSecret=0e606fc1378d35e359fcf3f15570b2c5 + +// WeChat service provider +wxUnifiedOrderUrl=https://api.mch.weixin.qq.com/pay/unifiedorder +wxMchAppId=wx637bd6f7314daa46 +wxApiKey=Skufk5oi85wDFGl888i6wsRSTkdd5df5 +wxMchId=1289663601 diff --git a/open-api/src/main/resources/prod/logback.xml b/open-api/src/main/resources/prod/logback.xml index e509de0..60947fa 100644 --- a/open-api/src/main/resources/prod/logback.xml +++ b/open-api/src/main/resources/prod/logback.xml @@ -69,4 +69,46 @@ + + + + log/alipay/alipaylog.log + + log/alipay.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + + + + + log/hsg.log + + log/hsg/hsg.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + + + diff --git a/service/src/main/java/com/hfkj/channel/lakala/LaKaLaLedgerService.java b/service/src/main/java/com/hfkj/channel/lakala/LaKaLaLedgerService.java index dbb3fdd..8a02578 100644 --- a/service/src/main/java/com/hfkj/channel/lakala/LaKaLaLedgerService.java +++ b/service/src/main/java/com/hfkj/channel/lakala/LaKaLaLedgerService.java @@ -71,7 +71,7 @@ public class LaKaLaLedgerService { Map map = new HashMap<>(); map.put("version", "1.0"); map.put("orderNo", orderNo); - map.put("orgCode", "1"); + map.put("orgCode", CommonSysConst.getSysConfig().getLkl_org_code()); map.put("merCupNo", merLedger.getCupNo()); map.put("contactMobile", merDetail.getRegPhone()); map.put("splitLowestRatio", merLedger.getSplitLowestRatio()); @@ -132,7 +132,7 @@ public class LaKaLaLedgerService { Map map = new HashMap<>(); map.put("version", "1.0"); map.put("orderNo", orderNo); - map.put("orgCode", "1"); + map.put("orgCode", CommonSysConst.getSysConfig().getLkl_org_code()); map.put("receiverNo", merLedger.getReceiverNo()); map.put("merCupNo", merLedger.getCupNo()); map.put("contactMobile", merDetail.getRegPhone()); @@ -197,7 +197,7 @@ public class LaKaLaLedgerService { Map map = new HashMap<>(); map.put("version", "1.0"); map.put("orderNo", orderNo); - map.put("orgCode", "1"); + map.put("orgCode", CommonSysConst.getSysConfig().getLkl_org_code()); map.put("merCupNo", merLedger.getCupNo()); map.put("contactMobile", merDetail.getRegPhone()); map.put("splitLowestRatio", merLedger.getSplitLowestRatio()); @@ -253,7 +253,7 @@ public class LaKaLaLedgerService { Map map = new HashMap<>(); map.put("version", "1.0"); map.put("orderNo", orderNo); - map.put("orgCode", "1"); + map.put("orgCode", CommonSysConst.getSysConfig().getLkl_org_code()); map.put("merCupNo", merCupNo); commonParam.put("reqData", map); @@ -290,7 +290,7 @@ public class LaKaLaLedgerService { Map map = new HashMap<>(); map.put("version", "1.0"); map.put("orderNo", System.currentTimeMillis()+""); - map.put("orgCode", "1"); + map.put("orgCode", CommonSysConst.getSysConfig().getLkl_org_code()); map.put("receiverName", merDetail.getMerName()); map.put("contactMobile", merDetail.getRegPhone()); map.put("acctTypeCode", merDetail.getMerSettleAcct().getSettleType().equals(MerSettleType.status1.getNumber())?57:58);// 57:对公 58:对私 @@ -370,7 +370,7 @@ public class LaKaLaLedgerService { Map map = new HashMap<>(); map.put("version", "1.0"); map.put("orderNo", System.currentTimeMillis()+""); - map.put("orgCode", "1"); + map.put("orgCode", CommonSysConst.getSysConfig().getLkl_org_code()); map.put("receiverNo", "1"); map.put("receiverName", merDetail.getMerName()); map.put("contactMobile", merDetail.getRegPhone()); @@ -439,7 +439,7 @@ public class LaKaLaLedgerService { Map map = new HashMap<>(); map.put("version", "1.0"); map.put("orderNo", System.currentTimeMillis()+""); - map.put("orgCode", "1"); + map.put("orgCode", CommonSysConst.getSysConfig().getLkl_org_code()); map.put("merCupNo", merLedgerReceiver.getCupNo()); map.put("receiverNo", merLedgerReceiver.getReceiverNo()); @@ -495,7 +495,7 @@ public class LaKaLaLedgerService { Map map = new HashMap<>(); map.put("version", "1.0"); map.put("orderNo", System.currentTimeMillis()+""); - map.put("orgCode", "1"); + map.put("orgCode", CommonSysConst.getSysConfig().getLkl_org_code()); map.put("merCupNo", merLedgerReceiver.getCupNo()); map.put("receiverNo", merLedgerReceiver.getReceiverNo()); String base64ImgUrl = ImageUtils.getBase64ByImgUrl(CommonSysConst.getSysConfig().getObs_url() + merLedgerReceiver.getRelieveEntrustFilePath()); diff --git a/service/src/main/java/com/hfkj/openapi/v1/model/TradePreorderModel.java b/service/src/main/java/com/hfkj/openapi/v1/model/TradePreorderModel.java new file mode 100644 index 0000000..9768798 --- /dev/null +++ b/service/src/main/java/com/hfkj/openapi/v1/model/TradePreorderModel.java @@ -0,0 +1,15 @@ +package com.hfkj.openapi.v1.model; + +import lombok.Data; + +/** + * 交易聚合主扫模型 + * @className: TradePreorderModel + * @author: HuRui + * @date: 2023/5/23 + **/ +@Data +public class TradePreorderModel { + + +} diff --git a/service/src/main/java/com/hfkj/openapi/v1/utils/MD5Util.java b/service/src/main/java/com/hfkj/openapi/v1/utils/MD5Util.java new file mode 100644 index 0000000..d28e89d --- /dev/null +++ b/service/src/main/java/com/hfkj/openapi/v1/utils/MD5Util.java @@ -0,0 +1,31 @@ +package com.hfkj.openapi.v1.utils; + +import javax.xml.bind.annotation.adapters.HexBinaryAdapter; +import java.security.MessageDigest; + +/** + * MD5 加密 + */ +public class MD5Util { + + /** + * 加密 + * @param data + * @return + * @throws Exception + */ + public static String encode(byte[] data) throws Exception { + // 初始化MessageDigest + MessageDigest md = MessageDigest.getInstance("MD5"); + // 执行摘要信息 + byte[] digest = md.digest(data); + // 将摘要信息转换为32位的十六进制字符串 + return new String(new HexBinaryAdapter().marshal(digest)); + } + + public static void main(String[] args) throws Exception { + String str = "123456"; + System.out.println(MD5Util.encode(str.getBytes("UTF-8"))); + //String ee = "29AD0E3FD3DB681FB9F8091C756313F7"; + } +} diff --git a/service/src/main/java/com/hfkj/service/impl/BsMerServiceImpl.java b/service/src/main/java/com/hfkj/service/impl/BsMerServiceImpl.java index ada4c5b..65f5359 100644 --- a/service/src/main/java/com/hfkj/service/impl/BsMerServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/impl/BsMerServiceImpl.java @@ -2,28 +2,19 @@ package com.hfkj.service.impl; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import com.hfkj.channel.lakala.config.LaKaLaConfig; -import com.hfkj.channel.saas.SaasMerService; -import com.hfkj.channel.saas.utils.SaasCommon; -import com.hfkj.channel.weixin.WeiXinMerService; -import com.hfkj.channel.weixin.utils.WeiXinUploadUtil; import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.SysCode; import com.hfkj.channel.weixin.utils.MD5Util; import com.hfkj.common.utils.DateUtil; import com.hfkj.common.utils.IDGenerator; -import com.hfkj.common.utils.ImageUtils; -import com.hfkj.config.CommonSysConst; import com.hfkj.dao.BsMerMapper; import com.hfkj.entity.*; import com.hfkj.model.MerAccountModel; import com.hfkj.model.MerBasisModel; import com.hfkj.model.StoreModel; -import com.hfkj.obs.HuaWeiYunObs; import com.hfkj.service.*; import com.hfkj.sysenum.*; -import com.hfkj.sysenum.lakala.UploadFileTypeEnum; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils;