Przeglądaj źródła

fixed 店铺支付参数

fushengqian 1 rok temu
rodzic
commit
9c12498719

+ 3 - 0
fuint-application/src/main/java/com/fuint/common/dto/StoreDto.java

@@ -67,6 +67,9 @@ public class StoreDto implements Serializable {
     @ApiModelProperty("微信支付秘钥")
     private String wxApiV2;
 
+    @ApiModelProperty("微信支付证书")
+    private String wxCertPath;
+
     @ApiModelProperty("支付宝appId")
     private String alipayAppId;
 

+ 1 - 1
fuint-application/src/main/java/com/fuint/common/http/HttpRESTDataClient.java

@@ -35,7 +35,7 @@ public class HttpRESTDataClient {
 
     public static byte[] requestPost(String url, String postData) throws IOException {
         String postBody = postData;
-        MediaType MEDIA_TYPE_MARKDOWN = MediaType.parse("text/x-markdown;charset=utf-8");
+        MediaType MEDIA_TYPE_MARKDOWN = MediaType.parse("application/json");
         Request request = new Request.Builder()
                 .url(url)
                 .post(RequestBody.create(MEDIA_TYPE_MARKDOWN, postBody))

+ 2 - 2
fuint-application/src/main/java/com/fuint/common/service/impl/GoodsServiceImpl.java

@@ -538,8 +538,8 @@ public class GoodsServiceImpl extends ServiceImpl<MtGoodsMapper, MtGoods> implem
     public PaginationResponse<GoodsDto> selectGoodsList(Map<String, Object> params) throws BusinessCheckException {
         Integer page = params.get("page") == null ? Constants.PAGE_NUMBER : Integer.parseInt(params.get("page").toString());
         Integer pageSize = params.get("pageSize") == null ? Constants.PAGE_SIZE : Integer.parseInt(params.get("pageSize").toString());
-        Integer storeId = params.get("storeId") == null ? 0 : Integer.parseInt(params.get("storeId").toString());
-        Integer cateId = params.get("cateId") == null ? 0 : Integer.parseInt(params.get("cateId").toString());
+        Integer storeId = (params.get("storeId") == null || StringUtil.isEmpty(params.get("storeId").toString()))? 0 : Integer.parseInt(params.get("storeId").toString());
+        Integer cateId = (params.get("cateId") == null || StringUtil.isEmpty(params.get("cateId").toString())) ? 0 : Integer.parseInt(params.get("cateId").toString());
         String keyword = params.get("keyword") == null ? "" : params.get("keyword").toString();
 
         Integer merchantId = 0;

+ 1 - 1
fuint-application/src/main/java/com/fuint/common/service/impl/OrderServiceImpl.java

@@ -1278,7 +1278,7 @@ public class OrderServiceImpl extends ServiceImpl<MtOrderMapper, MtOrder> implem
                 MtUser userInfo = memberService.queryMemberById(orderInfo.getUserId());
                 MtUserGrade userGrade = userGradeService.queryUserGradeById(orderInfo.getMerchantId(), Integer.parseInt(userInfo.getGradeId()), orderInfo.getUserId());
                 // 是否会员积分加倍
-                if (userGrade.getSpeedPoint() > 1) {
+                if (userGrade != null && userGrade.getSpeedPoint() > 1) {
                     pointNum = pointNum * userGrade.getSpeedPoint();
                 }
                 MtPoint reqPointDto = new MtPoint();

+ 3 - 0
fuint-application/src/main/java/com/fuint/common/service/impl/StoreServiceImpl.java

@@ -142,6 +142,9 @@ public class StoreServiceImpl extends ServiceImpl<MtStoreMapper, MtStore> implem
         if (storeDto.getWxApiV2() != null) {
             mtStore.setWxApiV2(storeDto.getWxApiV2());
         }
+        if (storeDto.getWxCertPath() != null) {
+            mtStore.setWxCertPath(storeDto.getWxCertPath());
+        }
         if (storeDto.getAlipayAppId() != null) {
             mtStore.setAlipayAppId(storeDto.getAlipayAppId());
         }

+ 4 - 2
fuint-application/src/main/java/com/fuint/common/service/impl/WeixinServiceImpl.java

@@ -759,7 +759,7 @@ public class WeixinServiceImpl implements WeixinService {
 
             String pathRoot = env.getProperty("images.root");
             String baseImage = env.getProperty("images.path");
-            String filePath = "/storeQr" + storeId + ".png";
+            String filePath = "storeQr" + storeId + ".png";
             String path = pathRoot + baseImage + filePath;
             QRCodeUtil.saveQrCodeToLocal(bytes, path);
 
@@ -795,15 +795,17 @@ public class WeixinServiceImpl implements WeixinService {
         MtStore mtStore = storeService.queryStoreById(storeId);
         String mchId = wxPayBean.getMchId();
         String apiV2 = wxPayBean.getApiV2();
+        String certPath = wxPayBean.getCertPath();
         if (mtStore != null && StringUtil.isNotEmpty(mtStore.getWxApiV2()) && StringUtil.isNotEmpty(mtStore.getWxMchId())) {
             mchId = mtStore.getWxMchId();
             apiV2 = mtStore.getWxApiV2();
+            certPath = mtStore.getWxCertPath();
         }
         apiConfig = WxPayApiConfig.builder()
                    .appId(wxPayBean.getAppId())
                    .mchId(mchId)
                    .partnerKey(apiV2)
-                   .certPath(wxPayBean.getCertPath())
+                   .certPath(certPath)
                    .domain(wxPayBean.getDomain())
                    .build();
         // 微信内h5公众号支付

+ 2 - 10
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendFileController.java

@@ -105,18 +105,10 @@ public class BackendFileController extends BaseController {
             logger.error("图片允许的大小设置不正确", e);
         }
         if (file.getSize() > (maxSize * 1024 * 1024)) {
-            return getFailureResult(201, "上传的图片不能大于" + maxSize + "MB");
+            return getFailureResult(201, "上传的文件不能大于" + maxSize + "MB");
         }
 
         String fileType = file.getContentType();
-        if (fileType.indexOf("image") == -1) {
-            return getFailureResult(201, "上传的图片格式有误");
-        }
-
-        String original = file.getOriginalFilename().toLowerCase();
-        if (original.indexOf("jpg") == -1 && original.indexOf("jpeg") == -1 && original.indexOf("png") == -1 && original.indexOf("gif") == -1 && original.indexOf("bmp") == -1) {
-            return getFailureResult(201, "上传的图片格式有误");
-        }
 
         // 保存文件
         try {
@@ -127,7 +119,7 @@ public class BackendFileController extends BaseController {
 
             // 上传阿里云oss
             String mode = env.getProperty("aliyun.oss.mode");
-            if (mode.equals("1")) { // 检查是否开启上传
+            if (mode.equals("1") && fileType.indexOf("image") >= 0) { // 检查是否开启上传
                 String endpoint = env.getProperty("aliyun.oss.endpoint");
                 String accessKeyId = env.getProperty("aliyun.oss.accessKeyId");
                 String accessKeySecret = env.getProperty("aliyun.oss.accessKeySecret");

+ 2 - 0
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendStoreController.java

@@ -215,6 +215,7 @@ public class BackendStoreController extends BaseController {
         String longitude = params.get("longitude") == null ? "" : CommonUtil.replaceXSS(params.get("longitude").toString());
         String wxMchId = params.get("wxMchId") == null ? null : CommonUtil.replaceXSS(params.get("wxMchId").toString());
         String wxApiV2 = params.get("wxApiV2") == null ? null : CommonUtil.replaceXSS(params.get("wxApiV2").toString());
+        String wxCertPath = params.get("wxCertPath") == null ? null : CommonUtil.replaceXSS(params.get("wxCertPath").toString());
         String alipayAppId = params.get("alipayAppId") == null ? null : CommonUtil.replaceXSS(params.get("alipayAppId").toString());
         String alipayPrivateKey = params.get("alipayPrivateKey") == null ? null : CommonUtil.replaceXSS(params.get("alipayPrivateKey").toString());
         String alipayPublicKey = params.get("alipayPublicKey") == null ? null : CommonUtil.replaceXSS(params.get("alipayPublicKey").toString());
@@ -250,6 +251,7 @@ public class BackendStoreController extends BaseController {
         storeInfo.setStatus(status);
         storeInfo.setWxMchId(wxMchId);
         storeInfo.setWxApiV2(wxApiV2);
+        storeInfo.setWxCertPath(wxCertPath);
         storeInfo.setLicense(license);
         storeInfo.setCreditCode(creditCode);
         storeInfo.setBankName(bankName);

+ 3 - 1
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendUserGradeController.java

@@ -219,7 +219,9 @@ public class BackendUserGradeController extends BaseController {
 
         mtUserGrade.setGrade(Integer.parseInt(grade));
         mtUserGrade.setName(name);
-        mtUserGrade.setMerchantId(accountInfo.getMerchantId());
+        if (mtUserGrade.getMerchantId() == null) {
+            mtUserGrade.setMerchantId(accountInfo.getMerchantId());
+        }
         if (StringUtil.isNotEmpty(catchType)) {
             mtUserGrade.setCatchType(catchType);
         }

+ 3 - 0
fuint-repository/src/main/java/com/fuint/repository/model/MtStore.java

@@ -53,6 +53,9 @@ public class MtStore implements Serializable {
     @ApiModelProperty("微信支付APIv2密钥")
     private String wxApiV2;
 
+    @ApiModelProperty("微信支付证书")
+    private String wxCertPath;
+
     @ApiModelProperty("支付宝appId")
     private String alipayAppId;