diff --git a/hai-bweb/src/main/java/com/bweb/controller/CommonController.java b/hai-bweb/src/main/java/com/bweb/controller/CommonController.java index 7a9f8059..99f7aa39 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/CommonController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/CommonController.java @@ -1,6 +1,9 @@ package com.bweb.controller; 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.common.utils.ResponseMsgUtil; import com.hai.config.TuanYouConfig; @@ -11,6 +14,7 @@ import com.hai.service.CommonService; import com.hai.service.SecConfigService; 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.web.bind.annotation.*; @@ -144,6 +148,39 @@ public class CommonController { } } + + @RequestMapping(value="/editConfig",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "添加配置") + public ResponseData editConfig(@RequestBody JSONObject body) { + try { + if (body == null + || StringUtils.isBlank(body.getString("codeType")) + || StringUtils.isBlank(body.getString("codeValue")) + ) { + log.error("OrderController --> orderToPay() ERROR", ""); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + SecConfig config = secConfigService.findByCodeType(body.getString("codeType")); + if (config == null) { + config = new SecConfig(); + config.setCodeType(body.getString("codeType")); + config.setCodeValue(body.getString("codeValue")); + secConfigService.insertSecConfig(config); + + } else { + config.setCodeValue(body.getString("codeValue")); + secConfigService.updateSecConfig(config); + } + + return ResponseMsgUtil.success("修改成功"); + } catch (Exception e) { + log.error("CommonController --> editConfig() error!", e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value="/updateDictionary",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据 码值类型 查询数据字典") diff --git a/hai-bweb/src/main/resources/dev/application.yml b/hai-bweb/src/main/resources/dev/application.yml index b3326583..59fb1869 100644 --- a/hai-bweb/src/main/resources/dev/application.yml +++ b/hai-bweb/src/main/resources/dev/application.yml @@ -39,6 +39,20 @@ spring: max-wait: -1 max-idle: 10 min-idle: 0 + #MQTT配置信息 + mqtt: + #MQTT服务地址 + url: ws://139.159.177.244:8083/mqtt + #用户名 + username: printer_provider + #密码 + password: 123654 + #客户端id(不能重复) + # client: + # id: provider-id + #MQTT默认的消息推送主题,实际可在调用接口是指定 + # default: + # topic: topic #配置日期返回至前台为时间戳 jackson: serialization: diff --git a/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java b/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java index 09d907d9..e16903d0 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java @@ -108,6 +108,9 @@ public class OrderController { @Resource private UnionStagingPayConfig unionStagingPayConfig; + @Resource + private SecConfigService configService; + /** * * @Title: orderToPay @@ -214,7 +217,12 @@ public class OrderController { weChatPayReqInfo.setSub_mch_id(SysConst.getSysConfig().getWxGzSubMchId());//商户号 } else if (order.getHighChildOrderList().get(0).getGoodsType() == 3) { - weChatPayReqInfo.setSub_mch_id("1609882817"); // 浩联商户号 + SecConfig wxMerNumber = configService.findByCodeType("OIL_WX_MER"); + if (wxMerNumber == null) { + weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1624126902); // 浩联商户号 + } else { + weChatPayReqInfo.setSub_mch_id(wxMerNumber.getCodeValue()); + } profitSharing = "Y"; // 查询油站 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 bbd0a1b5..5b9dc837 100644 --- a/hai-service/src/main/java/com/hai/config/WxOrderConfig.java +++ b/hai-service/src/main/java/com/hai/config/WxOrderConfig.java @@ -62,6 +62,12 @@ public class WxOrderConfig { */ public static final String MCH_ID_1619676214 = "1619676214"; + /** + * 微信支付商户号 + * 渝北区浩联物资经营部 + */ + public static final String MCH_ID_1624126902 = "1624126902"; + public static OrderRefundModel orderToRefund(String paySerialNo,BigDecimal totalFee,BigDecimal refundFee) throws Exception { Map param = new HashMap<>(); diff --git a/hai-service/src/main/java/com/hai/service/SecConfigService.java b/hai-service/src/main/java/com/hai/service/SecConfigService.java index 55cfb33b..bcadb911 100644 --- a/hai-service/src/main/java/com/hai/service/SecConfigService.java +++ b/hai-service/src/main/java/com/hai/service/SecConfigService.java @@ -20,6 +20,15 @@ public interface SecConfigService { **/ SecConfig findById(Integer id); + /** + * @ClassName SecConfigService.java + * @author Sum1Dream + * @version 1.0.0 + * @Description //TODO + * @createTime 17:31 2021/6/23 + **/ + void insertSecConfig(SecConfig secConfig); + /** * @ClassName SecConfigService.java * @author Sum1Dream diff --git a/hai-service/src/main/java/com/hai/service/impl/SecConfigServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/SecConfigServiceImpl.java index 8531688e..0e326c2c 100644 --- a/hai-service/src/main/java/com/hai/service/impl/SecConfigServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/SecConfigServiceImpl.java @@ -22,6 +22,11 @@ public class SecConfigServiceImpl implements SecConfigService { return secConfigMapper.selectByPrimaryKey(id); } + @Override + public void insertSecConfig(SecConfig secConfig) { + secConfigMapper.insert(secConfig); + } + @Override public void updateSecConfig(SecConfig secConfig) { secConfigMapper.updateByPrimaryKeySelective(secConfig);