Переглянути джерело

Merge remote-tracking branch 'origin/康年堂' into 康年堂

yh 3 днів тому
батько
коміт
7d9deaa86d

+ 1 - 0
fs-service/src/main/java/com/fs/erp/service/impl/DfOrderServiceImpl.java

@@ -618,6 +618,7 @@ public class DfOrderServiceImpl implements IErpOrderService {
         } else {
             response.setErrorDesc("未获取到原始订单号");
         }
+        response.setSuccess(true);
         return response;
     }
 

+ 13 - 0
fs-service/src/main/java/com/fs/hisStore/param/FsUserEditParam.java

@@ -19,6 +19,10 @@ public class FsUserEditParam implements Serializable
 
     private Long userId;
 
+
+
+    private Integer isWeixinAuth;
+
     // 添加兼容方法
     public String getNickName() {
         return this.nickName != null ? this.nickName : this.nickname;
@@ -38,4 +42,13 @@ public class FsUserEditParam implements Serializable
         this.nickname = nickname;
         this.nickName = nickname;
     }
+
+
+    public Integer getIsWeixinAuth() {
+        return isWeixinAuth;
+    }
+
+    public void setIsWeixinAuth(Integer isWeixinAuth) {
+        this.isWeixinAuth = isWeixinAuth;
+    }
 }

+ 9 - 9
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreOrderScrmServiceImpl.java

@@ -1626,15 +1626,15 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
                 return R.error("此套餐已下架");
             }
             //只允许销售分享下单
-            if (CloudHostUtils.hasCloudHostName("康年堂")){
-                FsUserCompanyPackageScrm fsUserCompanyPackageScrm = new FsUserCompanyPackageScrm();
-                fsUserCompanyPackageScrm.setUserId(uid);
-                fsUserCompanyPackageScrm.setPackageId(param.getPackageId());
-                List<FsUserCompanyPackageScrm> fsUserCompanyPackageList = fsUserCompanyPackageScrmMapper.selectFsUserCompanyPackageScrmList(fsUserCompanyPackageScrm);
-                if (fsUserCompanyPackageList == null || fsUserCompanyPackageList.isEmpty()) {
-                    return R.error("商品链接无效");
-                }
-            }
+//            if (CloudHostUtils.hasCloudHostName("康年堂")){
+//                FsUserCompanyPackageScrm fsUserCompanyPackageScrm = new FsUserCompanyPackageScrm();
+//                fsUserCompanyPackageScrm.setUserId(uid);
+//                fsUserCompanyPackageScrm.setPackageId(param.getPackageId());
+//                List<FsUserCompanyPackageScrm> fsUserCompanyPackageList = fsUserCompanyPackageScrmMapper.selectFsUserCompanyPackageScrmList(fsUserCompanyPackageScrm);
+//                if (fsUserCompanyPackageList == null || fsUserCompanyPackageList.isEmpty()) {
+//                    return R.error("商品链接无效");
+//                }
+//            }
             //限购处理
             if (storeProductPackage.getLimitCount() != null && storeProductPackage.getLimitCount() > 0) {
                 //查看是否已购买

+ 43 - 4
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStorePaymentScrmServiceImpl.java

@@ -41,9 +41,10 @@ import com.fs.course.domain.FsCourseRedPacketLog;
 import com.fs.course.mapper.FsCourseRedPacketLogMapper;
 import com.fs.course.service.IFsCourseRedPacketLogService;
 import com.fs.his.config.FsSysConfig;
-import com.fs.his.domain.FsUser;
-import com.fs.his.domain.FsUserWx;
+import com.fs.his.domain.*;
+import com.fs.his.mapper.FsStorePaymentErrorMapper;
 import com.fs.his.mapper.FsUserWxMapper;
+import com.fs.his.param.FsPackageOrderCancelParam;
 import com.fs.his.service.IFsUserService;
 import com.fs.his.service.IFsUserWxService;
 import com.fs.his.utils.ConfigUtil;
@@ -147,6 +148,8 @@ public class FsStorePaymentScrmServiceImpl implements IFsStorePaymentScrmService
 
     @Autowired
     private IFsStoreOrderScrmService storeOrderService;
+    @Autowired
+    private FsStorePaymentErrorMapper fsStorePaymentErrorMapper;
 
     /**
      * 查询支付明细
@@ -1101,18 +1104,54 @@ public class FsStorePaymentScrmServiceImpl implements IFsStorePaymentScrmService
         return "同步完成";
     }
 
+    long TWENTY_DAYS_IN_MILLIS = 1728000000L;
     @Override
     public void synchronizePayStatus() {
         FsStorePaymentScrm queryParam = new FsStorePaymentScrm();
         queryParam.setStatus(0);//未支付
-        queryParam.setBeginTime(DateUtils.addDateDays(-1));
+//        queryParam.setBeginTime(DateUtils.addDateDays(-1));
         queryParam.setEndTime(DateUtils.getDate());
         List<FsStorePaymentScrm> list = selectFsStorePaymentList(queryParam);
         if (list != null && !list.isEmpty()) {
             List<CompletableFuture<Void>> futures = new ArrayList<>();
             for (FsStorePaymentScrm fsStorePayment : list) {
                 CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
-                    updateFsStorePaymentByDecryptForm(fsStorePayment.getPaymentId());
+                    try {
+                        updateFsStorePaymentByDecryptForm(fsStorePayment.getPaymentId());
+                        //查询是否改为已支付
+                        FsStorePaymentScrm finalPayment = fsStorePaymentMapper.selectFsStorePaymentById(fsStorePayment.getPaymentId());
+                        try {
+                            Date createTime = finalPayment.getCreateTime();
+                            Date now = new Date();
+                            long value = now.getTime() - createTime.getTime();
+                            if(finalPayment.getStatus() == 0
+                                    && finalPayment.getBusinessType() == 2
+                                    && (value > TWENTY_DAYS_IN_MILLIS)
+                                    && finalPayment.getBusinessId() != null){
+                                //套餐包超过20天取消订单
+                                storeOrderService.cancelOrder(Long.valueOf(finalPayment.getBusinessId()));
+                            }
+                        } catch (NumberFormatException e) {
+                            logger.info("定时任务:同步支付状态超时取消订单失败,payment_id:{}",fsStorePayment.getPaymentId());
+                        }
+                    } catch (Exception e) {
+                        //添加失败记录
+                        FsStorePaymentError fsStorePaymentError = new FsStorePaymentError();
+                        fsStorePaymentError.setOrderFlowNo(fsStorePayment.getTradeNo());
+                        String businessId = fsStorePayment.getBusinessId();
+                        fsStorePaymentError.setBusinessType(fsStorePayment.getBusinessType());
+                        fsStorePaymentError.setMsg(e.getMessage());
+                        fsStorePaymentError.setStatus(0);
+                        fsStorePaymentError.setCreateTime(new Date());
+                        if (businessId != null && fsStorePayment.getBusinessType() == 2) {
+                            fsStorePaymentError.setOrderId(Long.valueOf(businessId));
+                            FsStoreOrderScrm fsStoreOrder = storeOrderService.selectFsStoreOrderById(Long.valueOf(businessId));
+                            if (fsStoreOrder != null) {
+                                fsStorePaymentError.setOrderNo(fsStoreOrder.getOrderCode());
+                            }
+                        }
+                        fsStorePaymentErrorMapper.insertFsStorePaymentError(fsStorePaymentError);
+                    }
                     logger.info("定时任务:同步支付状态,payment_id:{}",fsStorePayment.getPaymentId());
                 });
                 futures.add(future);

+ 44 - 0
fs-user-app/src/main/java/com/fs/app/controller/store/StoreProductPackageScrmController.java

@@ -3,9 +3,16 @@ package com.fs.app.controller.store;
 
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONUtil;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fs.app.annotation.Login;
 import com.fs.app.controller.AppBaseController;
 import com.fs.common.core.domain.R;
+import com.fs.common.core.domain.entity.SysDictData;
+import com.fs.company.domain.Company;
+import com.fs.company.domain.CompanyUser;
+import com.fs.company.service.ICompanyService;
+import com.fs.company.service.ICompanyUserService;
 import com.fs.hisStore.domain.FsStoreProductAttrValueScrm;
 import com.fs.hisStore.domain.FsStoreProductPackageScrm;
 import com.fs.hisStore.domain.FsStoreProductScrm;
@@ -17,6 +24,7 @@ import com.fs.hisStore.service.IFsStoreProductAttrValueScrmService;
 import com.fs.hisStore.service.IFsStoreProductPackageScrmService;
 import com.fs.hisStore.service.IFsStoreProductScrmService;
 import com.fs.hisStore.vo.FsStoreProductPacketVO;
+import com.fs.system.service.ISysDictTypeService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
@@ -40,6 +48,42 @@ public class StoreProductPackageScrmController extends AppBaseController {
     private IFsStoreProductAttrValueScrmService attrValueService;
     @Autowired
     private IFsStoreProductScrmService storeProductService;
+    @Autowired
+    private ICompanyUserService companyUserService;
+    @Autowired
+    private ICompanyService companyService;
+    @Autowired
+    private ISysDictTypeService dictTypeService;
+    @ApiOperation("获取套餐分类")
+    @GetMapping("/getPackagCateList")
+    public R getPackagCateList() {
+        List<SysDictData> result = new ArrayList<>();
+        try {
+            ObjectMapper objectMapper = new ObjectMapper();
+            Long companyUserId = getCompanyUserId();
+            CompanyUser companyUser=companyUserService.selectCompanyUserById(companyUserId);
+            Company company = companyService.selectCompanyById(companyUser.getCompanyId());
+            String packageCateIds = company.getPackageCateIds();
+            List<String> cateIdList = objectMapper.readValue(packageCateIds, new TypeReference<List<String>>() {});
+            if(!cateIdList.isEmpty()){
+                List<SysDictData> data = dictTypeService.selectDictDataByType("store_product_package_cate");
+                if(data != null && !data.isEmpty()){
+
+                    data.stream().forEach(item->{
+                       if (cateIdList.contains(item.getDictValue())) {
+                           result.add(item);
+                       }
+                   });
+                }
+            }
+
+        } catch (Exception e) {
+        } finally {
+            return R.ok().put("data", result);
+        }
+
+    }
+
     @Login
     @ApiOperation("获取套餐列表")
     @GetMapping("/getStoreProductPackage")

+ 4 - 0
fs-user-app/src/main/java/com/fs/app/controller/store/UserScrmController.java

@@ -612,6 +612,10 @@ public class UserScrmController extends AppBaseController {
         user.setUserId(Long.parseLong(getUserId()));
         user.setAvatar(param.getAvatar());
         user.setNickname(StringUtils.isNotBlank(param.getNickname())?param.getNickName():param.getNickname());
+        Integer isWeixinAuth = param.getIsWeixinAuth();
+        if (isWeixinAuth!=null){
+            user.setIsWeixinAuth(isWeixinAuth);
+        }
         if(userService.updateFsUser(user)>0){
             return R.ok("修改成功");
         }