Просмотр исходного кода

Merge remote-tracking branch 'origin/develop' into develop

‘linchangsheng’ 7 месяцев назад
Родитель
Сommit
48017fec7d

+ 2 - 2
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/logic/material/parts/WorkerPartsStockLogic.java

@@ -117,8 +117,8 @@ public class WorkerPartsStockLogic {
             return initWorkStockCensusBean;
         }
         WorkerStockCensusBean workerStockStatistics = materialMapper.workerStockStatistics(wechat.getCompanyWechatId(), identity, websitId);
-        workerStockStatistics.setWorkerName(wechat.getUser().getNickName());
-        if(!Objects.isNull(workerStockStatistics)) {
+        if(Objects.nonNull(workerStockStatistics)) {
+            workerStockStatistics.setWorkerName(wechat.getUser().getNickName());
             WorkerStockCensusBean workerNewStockStatistics =  materialMapper.workerNewStockStatistics(wechat.getCompanyWechatId(), identity, websitId);
             workerStockStatistics.setNewRefundQty(Objects.isNull(workerNewStockStatistics) ? new BigDecimal(0) : workerNewStockStatistics.getNewRefundQty());
             workerStockStatistics.setNewRefundAmount(Objects.isNull(workerNewStockStatistics) ? new BigDecimal(0) : workerNewStockStatistics.getNewRefundAmount());

+ 15 - 22
mall-server-api/src/main/java/com/gree/mall/manager/config/BuyServiceInterceptor.java

@@ -1,42 +1,35 @@
 package com.gree.mall.manager.config;
 
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import com.gree.mall.manager.bean.admin.AdminUserCom;
 import com.gree.mall.manager.helper.ResponseHelper;
-import com.gree.mall.manager.logic.common.CommonLogic;
-import com.gree.mall.manager.utils.ApplicationContextUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.servlet.HandlerInterceptor;
 import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.util.Date;
-import java.util.Objects;
 
 @Slf4j
 public class BuyServiceInterceptor implements HandlerInterceptor {
 
     @Override
     public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
-        CommonLogic commonLogic = ApplicationContextUtils.getBean(CommonLogic.class);
-        AdminUserCom adminUser = commonLogic.getAdminUser(request);
-        if (adminUser != null && adminUser.getType() != null && adminUser.getType() != 2) {
-            Date expireTime = adminUser.getAdminCompanyWechat().getExpireTime();
-            DateTime curTime = DateUtil.parseDate(DateUtil.formatDate(DateUtil.date()));
-
-            if (Objects.isNull(expireTime)) {
-                expireTime = DateUtil.offsetDay(DateUtil.date(), -1);
-            }
-
-            if (curTime.getTime() > expireTime.getTime()) {
-                this.handleFalseRequest(response);
+//        CommonLogic commonLogic = ApplicationContextUtils.getBean(CommonLogic.class);
+//        AdminUserCom adminUser = commonLogic.getAdminUser(request);
+//        if (adminUser != null && adminUser.getType() != null && adminUser.getType() != 2) {
+//            Date expireTime = adminUser.getAdminCompanyWechat().getExpireTime();
+//            DateTime curTime = DateUtil.parseDate(DateUtil.formatDate(DateUtil.date()));
+//
+//            if (Objects.isNull(expireTime)) {
+//                expireTime = DateUtil.offsetDay(DateUtil.date(), -1);
+//            }
+//
+//            if (curTime.getTime() > expireTime.getTime()) {
+//                this.handleFalseRequest(response);
 //                throw new RemoteServiceException(ResponseHelper.ResponseCode_STOP_SERVICE, "商户购买产品服务过期");
-                return false;
-            }
-        }
+//                return false;
+//            }
+//        }
         return HandlerInterceptor.super.preHandle(request, response, handler);
 
     }

+ 54 - 47
mall-server-api/src/main/java/com/gree/mall/manager/logic/admin/AdminWebsitLogic.java

@@ -543,6 +543,7 @@ public class AdminWebsitLogic {
         List<Object> objects = ExcelUtils.importExcel(file);
 
         List<AdminWebsit> adminWebsitList = new ArrayList<>();
+        List<AdminWebsitPayConfig> allPayConfigList = new ArrayList<>();
         for (int i = 0; i < objects.size(); i++) {
             int rowIndex = i + 2;
             List<Object> row = (List<Object>) objects.get(i);
@@ -594,7 +595,7 @@ public class AdminWebsitLogic {
             final boolean isUseAllinpay = allinpayName.equals("开启");
 
             AdminWebsit addWebsit = new AdminWebsit();
-            addWebsit.setWebsitId(IdWorker.getIdStr());
+            addWebsit.setWebsitId(row.get(0).toString());
             addWebsit.setName(websitName);
             addWebsit.setType(AdminWebsitTypeEnum.C.getKey());
             addWebsit.setParentId(parentWebsit.getWebsitId());
@@ -626,7 +627,8 @@ public class AdminWebsitLogic {
 
                     try {
                         if (Objects.isNull(row.get(detailStartIndex + 1)) || org.apache.commons.lang3.StringUtils.isBlank(row.get(detailStartIndex + 1).toString())) {
-                            throw new RemoteServiceException("第" + rowIndex + "行, 通联商户名称" + detailIndex + "不能为空");
+//                            throw new RemoteServiceException("第" + rowIndex + "行, 通联商户名称" + detailIndex + "不能为空");
+                            isOn = false;
                         }
 
 //                      if (Objects.isNull(row.get(detailStartIndex + 2)) || org.apache.commons.lang3.StringUtils.isBlank(row.get(detailStartIndex + 2).toString())) {
@@ -664,61 +666,66 @@ public class AdminWebsitLogic {
                 }
             }
 
-            if (CollectionUtil.isNotEmpty(adminWebsitList)) {
-                // 检查本次导入是否有重复编号和名称
-                Map<String, List<AdminWebsit>> websitGroup = adminWebsitList.stream().collect(Collectors.groupingBy(AdminWebsit::getName));
-                for (Map.Entry<String, List<AdminWebsit>> entry : websitGroup.entrySet()) {
-                    if (entry.getValue().size() > 1) {
-                        throw new RemoteServiceException("导入文档有重复的网点名称" + entry.getKey());
-                    }
+            if (CollectionUtil.isNotEmpty(payConfigList)) {
+                allPayConfigList.addAll(payConfigList);
+            }
+        }
+
+        if (CollectionUtil.isNotEmpty(adminWebsitList)) {
+            // 检查本次导入是否有重复编号和名称
+            Map<String, List<AdminWebsit>> websitGroup = adminWebsitList.stream().collect(Collectors.groupingBy(AdminWebsit::getName));
+            for (Map.Entry<String, List<AdminWebsit>> entry : websitGroup.entrySet()) {
+                if (entry.getValue().size() > 1) {
+                    throw new RemoteServiceException("导入文档有重复的网点名称" + entry.getKey());
                 }
+            }
 
-                websitGroup = adminWebsitList.stream().collect(Collectors.groupingBy(AdminWebsit::getWebsitId));
-                for (Map.Entry<String, List<AdminWebsit>> entry : websitGroup.entrySet()) {
-                    if (entry.getValue().size() > 1) {
-                        throw new RemoteServiceException("导入文档有重复的网点编号" + entry.getKey());
-                    }
-                    final Integer count = adminWebsitService.lambdaQuery()
-                            .eq(AdminWebsit::getCompanyWechatId, companyWechatId)
-                            .eq(AdminWebsit::getType, AdminWebsitTypeEnum.C.getKey())
-                            .eq(AdminWebsit::getWebsitId, entry.getKey())
-                            .count();
-                    if (count > 0) {
-                        throw new RemoteServiceException("网点编号" + entry.getKey() + " 在系统里已存在");
-                    }
+            websitGroup = adminWebsitList.stream().collect(Collectors.groupingBy(AdminWebsit::getWebsitId));
+            for (Map.Entry<String, List<AdminWebsit>> entry : websitGroup.entrySet()) {
+                if (entry.getValue().size() > 1) {
+                    throw new RemoteServiceException("导入文档有重复的网点编号" + entry.getKey());
+                }
+                final Integer count = adminWebsitService.lambdaQuery()
+                        .eq(AdminWebsit::getCompanyWechatId, companyWechatId)
+                        .eq(AdminWebsit::getType, AdminWebsitTypeEnum.C.getKey())
+                        .eq(AdminWebsit::getWebsitId, entry.getKey())
+                        .count();
+                if (count > 0) {
+                    throw new RemoteServiceException("网点编号" + entry.getKey() + " 在系统里已存在");
+                }
 
-                    final Integer nameCount = adminWebsitService.lambdaQuery()
-                            .eq(AdminWebsit::getCompanyWechatId, companyWechatId)
-                            .eq(AdminWebsit::getType, AdminWebsitTypeEnum.C.getKey())
-                            .eq(AdminWebsit::getName, entry.getValue().get(0).getName())
-                            .count();
-                    if (nameCount > 0) {
-                        throw new RemoteServiceException("网点名称" + entry.getKey() + " 在系统里已存在");
-                    }
+                final Integer nameCount = adminWebsitService.lambdaQuery()
+                        .eq(AdminWebsit::getCompanyWechatId, companyWechatId)
+                        .eq(AdminWebsit::getType, AdminWebsitTypeEnum.C.getKey())
+                        .eq(AdminWebsit::getName, entry.getValue().get(0).getName())
+                        .count();
+                if (nameCount > 0) {
+                    throw new RemoteServiceException("网点名称" + entry.getKey() + " 在系统里已存在");
                 }
+            }
 
-                adminWebsitService.saveBatch(adminWebsitList);
-                for (AdminWebsit websit : adminWebsitList) {
-                    reloadJoinCode(websit.getCompanyWechatId(), websit.getJoinCode());
 
-                    // 初始化辅材配件默认仓
-                    initMaterialStorage(adminUser, websit);
+            for (AdminWebsit websit : adminWebsitList) {
+                reloadJoinCode(websit.getCompanyWechatId(), websit.getJoinCode());
 
+                // 初始化辅材配件默认仓
+                initMaterialStorage(adminUser, websit);
 
-                    AdminDept adminDept = adminDeptService.lambdaQuery().eq(AdminDept::getCompanyWechatId, websit.getCompanyWechatId())
-                            .eq(AdminDept::getPId, "1").last("limit 1").one();
-                    AdminDeptWebsit adminDeptWebsit = new AdminDeptWebsit();
-                    adminDeptWebsit.setAdminDeptId(adminDept.getAdminDeptId());
-                    adminDeptWebsit.setWebsitId(websit.getWebsitId());
-                    adminDeptWebsit.setWebsitName(websit.getName());
-                    adminDeptWebsit.setDeptName(adminDept.getDeptName());
-                    adminDeptWebsit.insert();
-                }
 
-                if (CollectionUtil.isNotEmpty(payConfigList)) {
-                    adminWebsitPayConfigService.saveBatch(payConfigList);
-                }
+                AdminDept adminDept = adminDeptService.lambdaQuery().eq(AdminDept::getCompanyWechatId, websit.getCompanyWechatId())
+                        .eq(AdminDept::getPId, "1").last("limit 1").one();
+                AdminDeptWebsit adminDeptWebsit = new AdminDeptWebsit();
+                adminDeptWebsit.setAdminDeptId(adminDept.getAdminDeptId());
+                adminDeptWebsit.setWebsitId(websit.getWebsitId());
+                adminDeptWebsit.setWebsitName(websit.getName());
+                adminDeptWebsit.setDeptName(adminDept.getDeptName());
+                adminDeptWebsit.insert();
+            }
+
+            if (CollectionUtil.isNotEmpty(allPayConfigList)) {
+                adminWebsitPayConfigService.saveBatch(allPayConfigList);
             }
+            adminWebsitService.saveBatch(adminWebsitList);
         }
     }
 

+ 1 - 1
mall-server-api/src/main/java/com/gree/mall/manager/logic/common/CommonLogic.java

@@ -117,7 +117,7 @@ public class CommonLogic {
             AdminUser admin = adminUserService.lambdaQuery().eq(AdminUser::getUserName, "admin").one();
             AdminUserCom adminUserCom = new AdminUserCom();
             BeanUtils.copyProperties(admin,adminUserCom);
-            AdminCompanyWechat adminCompanyWechat = adminCompanyWechatService.getById("1");
+            AdminCompanyWechat adminCompanyWechat = adminCompanyWechatService.getById("1831608878894858241");
             adminUserCom.setAdminCompanyWechat(adminCompanyWechat);
             adminUserCom.setJoinCode(adminCompanyWechat.getJoinCode());
 

+ 9 - 5
mall-server-api/src/main/java/com/gree/mall/manager/logic/notice/NoticeLogic.java

@@ -1,18 +1,15 @@
 package com.gree.mall.manager.logic.notice;
 
 import cn.hutool.core.bean.BeanUtil;
-
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-
 import com.gree.mall.manager.bean.admin.AdminUserCom;
 import com.gree.mall.manager.bean.notice.*;
 import com.gree.mall.manager.commonmapper.NoticeRecordBeanMapper;
-import com.gree.mall.manager.constant.Constant;
-import com.gree.mall.manager.enums.IsEnum;
 import com.gree.mall.manager.enums.IsYesNoEnum;
 import com.gree.mall.manager.logic.admin.AdminUserLogic;
 import com.gree.mall.manager.logic.common.CommonLogic;
@@ -29,7 +26,10 @@ import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.servlet.http.HttpServletRequest;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 @Component
@@ -332,6 +332,10 @@ public class NoticeLogic {
 
         //获取当前登录企业微信id
         AdminUserCom adminUser = commonLogic.getAdminUser();
+        if (Objects.isNull(adminUser) || CollectionUtil.isEmpty(adminUser.getAdminWebsitIds())) {
+            return new ArrayList<>();
+        }
+
         List<String> adminCompanyIds = adminUser.getAdminWebsitIds();
 
         Date date = new Date();