Преглед изворни кода

Merge remote-tracking branch 'origin/master'

FengChaoYu пре 4 месеци
родитељ
комит
064b0f5cdc

+ 11 - 8
mall-server-api/src/main/java/com/gree/mall/manager/logic/big/BigLogic.java

@@ -289,6 +289,7 @@ public class BigLogic {
         List<String> websitIds = adminUser.getAdminWebsitIds();
 
 
+        //后台登录用户
         Integer loginComapnyNum = userLogService.lambdaQuery().eq(UserLog::getLoginType, IsYesNoEnum.YES.getKey())
                 .eq(UserLog::getType, "LOGIN")
                 .in(!CollectionUtils.isEmpty(companyIds), UserLog::getCompanyWechatId, companyIds)
@@ -302,6 +303,7 @@ public class BigLogic {
                 .between(UserLog::getCreateTime, DateUtil.offsetDay(DateUtil.beginOfDay(new Date()), -1), DateUtil.offsetDay(DateUtil.endOfDay(new Date()), -1))
                 .count();
 
+        //总工程师数量
         Integer allWorker = websitUserService.lambdaQuery()
                 .in(!CollectionUtils.isEmpty(websitIds) && !adminUser.getIsMaster(),WebsitUser::getWebsitId, websitIds)
                 .groupBy(WebsitUser::getUserId)
@@ -313,19 +315,22 @@ public class BigLogic {
                 .eq(UserLog::getType, "LOGIN")
                 .in(!CollectionUtils.isEmpty(companyIds), UserLog::getCompanyWechatId, companyIds)
                 .between(UserLog::getCreateTime, DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()))
+                .groupBy(UserLog::getUserId)
                 .select(UserLog::getUserId)
                 .list().stream().map(UserLog::getUserId).collect(Collectors.toList());
 
 
         Integer allWorkerLogin = CollectionUtils.isEmpty(userIds)?0:websitUserService.lambdaQuery()
-                .in(CollectionUtils.isEmpty(websitIds) && !adminUser.getIsMaster(),WebsitUser::getWebsitId, websitIds).in(WebsitUser::getUserId,userIds).count();
+                .in(!CollectionUtils.isEmpty(websitIds) ,WebsitUser::getWebsitId, websitIds).in(WebsitUser::getUserId,userIds)
+                .count();
 
 
-        List<String> userIdBefores = userLogService.lambdaQuery().eq(UserLog::getLoginType, IsYesNoEnum.YES.getKey())
+        List<String> userIdBefores = userLogService.lambdaQuery().eq(UserLog::getLoginType, IsYesNoEnum.NO.getKey())
                 .eq(UserLog::getMiniType, UserTypeEnum.WORKER.getKey())
                 .eq(UserLog::getType, "LOGIN")
                 .in(!CollectionUtils.isEmpty(companyIds), UserLog::getCompanyWechatId, companyIds)
                 .between(UserLog::getCreateTime, DateUtil.offsetDay(DateUtil.beginOfDay(new Date()), -1), DateUtil.offsetDay(DateUtil.endOfDay(new Date()), -1))
+                .groupBy(UserLog::getUserId)
                 .select(UserLog::getUserId)
                 .list().stream().map(UserLog::getUserId).collect(Collectors.toList());
 
@@ -342,25 +347,23 @@ public class BigLogic {
                 .in(!CollectionUtils.isEmpty(companyIds), UserLog::getCompanyWechatId, companyIds)
                 .between(UserLog::getCreateTime, DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date())).count();
 
-        Integer allServiceBefore = userLogService.lambdaQuery().eq(UserLog::getLoginType, IsYesNoEnum.YES.getKey())
+        Integer allServiceBefore = userLogService.lambdaQuery().eq(UserLog::getLoginType, IsYesNoEnum.NO.getKey())
                 .eq(UserLog::getMiniType, UserTypeEnum.SERVICE.getKey())
                 .eq(UserLog::getType, "LOGIN")
                 .in(!CollectionUtils.isEmpty(companyIds), UserLog::getCompanyWechatId, companyIds)
                 .between(UserLog::getCreateTime, DateUtil.offsetDay(DateUtil.beginOfDay(new Date()), -1), DateUtil.offsetDay(DateUtil.endOfDay(new Date()), -1)).count();
 
 
-        Integer allUser = userService.lambdaQuery().eq(User::getType, UserTypeEnum.GENERAL.getKey())
-                .in(!CollectionUtils.isEmpty(companyIds), User::getCompanyWechatId, companyIds).count();
+        Integer allUser = adminUserService.lambdaQuery().eq(AdminUser::getStatus, true)
+                .in(!CollectionUtils.isEmpty(companyIds), AdminUser::getCompanyWechatId, companyIds).count();
 
 
-        Integer allUserLogin = userLogService.lambdaQuery().eq(UserLog::getLoginType, IsYesNoEnum.NO.getKey())
-                .eq(UserLog::getMiniType, UserTypeEnum.GENERAL.getKey())
+        Integer allUserLogin = userLogService.lambdaQuery().eq(UserLog::getLoginType, IsYesNoEnum.YES.getKey())
                 .eq(UserLog::getType, "LOGIN")
                 .in(!CollectionUtils.isEmpty(companyIds), UserLog::getCompanyWechatId, companyIds)
                 .between(UserLog::getCreateTime, DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date())).count();
 
         Integer allUserBefore = userLogService.lambdaQuery().eq(UserLog::getLoginType, IsYesNoEnum.YES.getKey())
-                .eq(UserLog::getMiniType, UserTypeEnum.GENERAL.getKey())
                 .eq(UserLog::getType, "LOGIN")
                 .in(!CollectionUtils.isEmpty(companyIds), UserLog::getCompanyWechatId, companyIds)
                 .between(UserLog::getCreateTime, DateUtil.offsetDay(DateUtil.beginOfDay(new Date()), -1), DateUtil.offsetDay(DateUtil.endOfDay(new Date()), -1)).count();

+ 1 - 1
mall-server-api/src/main/java/com/gree/mall/manager/logic/comlist/ComListAllLogic.java

@@ -71,7 +71,7 @@ public class ComListAllLogic {
 
     public IPage<ComList> list(String title, String remark, Boolean isNotice, Integer pageNo, Integer pageSize, HttpServletRequest request) {
         AdminUserCom adminUser = commonLogic.getAdminUser(request);
-
+        adminUser.getAdminWebsitIds().add(adminUser.getUserName());
         List<ComDetail> comDetails = comDetailService.lambdaQuery()
                 .select(ComDetail::getComListId)
                 .in(CollectionUtil.isNotEmpty(adminUser.getAdminWebsitIds()), ComDetail::getWebsitId, adminUser.getAdminWebsitIds())

+ 52 - 3
mall-server-api/src/main/java/com/gree/mall/manager/logic/comlist/ComListLogic.java

@@ -38,6 +38,7 @@ import org.apache.poi.xssf.streaming.SXSSFWorkbook;
 import org.apache.poi.xssf.usermodel.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
 import javax.servlet.http.HttpServletRequest;
@@ -72,7 +73,7 @@ public class ComListLogic {
 
     public IPage<ComList> list(String title, String remark, Boolean isNotice, Integer pageNo, Integer pageSize, HttpServletRequest request) {
         AdminUserCom adminUser = commonLogic.getAdminUser(request);
-
+        adminUser.getAdminWebsitIds().add(adminUser.getUserName());
         List<ComDetail> comDetails = comDetailService.lambdaQuery()
                 .select(ComDetail::getComListId)
                 .in(CollectionUtil.isNotEmpty(adminUser.getAdminWebsitIds()), ComDetail::getWebsitId, adminUser.getAdminWebsitIds())
@@ -143,7 +144,7 @@ public class ComListLogic {
 
         //上传主文件到oss,并记录
         //CommonFile commonFile = commonLogic.uploadFile(file);
-
+/*
         InputStream inputStream = commonLogic.getFileInputStreamByUrl(file);
         List<Object> objects = ExcelUtils.importExcel(inputStream);
         //拆分excel并上传oss
@@ -172,7 +173,7 @@ public class ComListLogic {
             comDetails.add(comDetail);
             //}
         }
-        comDetailService.saveBatch(comDetails);
+        comDetailService.saveBatch(comDetails);*/
     }
 
     public void download(String id, String downloadPwd, HttpServletRequest request, HttpServletResponse response) throws IOException {
@@ -588,4 +589,52 @@ public class ComListLogic {
         }
     }
 
+    @Transactional(rollbackFor = Exception.class)
+    public synchronized void upFile() {
+        List<ComList> comListList = comListService.lambdaQuery()
+                .eq(ComList::getType, "CENTER")
+                .eq(ComList::getCenterUp, 0).list();
+
+        if (!CollectionUtil.isEmpty(comListList)){
+            for (ComList comList : comListList) {
+                List<ComDetail> list = comDetailService.lambdaQuery()
+                        .eq(ComDetail::getComListId, comList.getId()).list();
+                ComDetail comDetail1 = list.get(0);
+
+                InputStream inputStream = commonLogic.getFileInputStreamByUrl(comDetail1.getFileUrl());
+                List<Object> objects = ExcelUtils.importExcel(inputStream);
+                //拆分excel并上传oss
+                List<Map<String, Object>> fileUrls = this.createExcel(objects);
+                if (fileUrls == null) {
+                    throw new RemoteServiceException("拆分失败");
+                }
+                List<ComDetail> comDetails = new ArrayList<>();
+                for (Map<String, Object> fileUrl : fileUrls) {
+                    String websitNumber = (String) fileUrl.get("websitNumber");
+                    String filePath = (String) fileUrl.get("filePath");
+                    //新增拆分的附件明细表
+                    //for(Belongcompany belongcompany : list) {
+                    ComDetail comDetail = new ComDetail();
+                    comDetail.setCompanyWechatId(comDetail1.getCompanyWechatId());
+                    comDetail.setCompanyName(comDetail1.getCompanyName());
+                    comDetail.setTitle(comDetail1.getTitle());
+                    comDetail.setComListId(comDetail1.getComListId());
+                    comDetail.setFileName(comDetail1.getTitle());
+                    comDetail.setWebsitId(websitNumber);
+                    comDetail.setFileUrl(filePath);
+                    comDetail.setIsDownload(false);
+                    comDetail.setCreateTime(new Date());
+                    comDetail.setIsNotice(comList.getIsNotice());
+                    //comDetail.insert();
+                    comDetails.add(comDetail);
+                    //}
+                }
+                comDetailService.saveBatch(comDetails);
+
+                comList.setCenterUp(true);
+                comList.updateById();
+            }
+
+        }
+    }
 }

+ 7 - 0
mall-server-api/src/main/java/com/gree/mall/manager/logic/workorder/ChangeOrderLogic.java

@@ -200,6 +200,13 @@ public class ChangeOrderLogic {
             return;
 */
 
+        for (PgOrderBase pgOrderBase : pgOrderBaseService.lambdaQuery()
+                .in(PgOrderBase::getId, ids).list()) {
+            if (StringUtil.isEmpty(pgOrderBase.getWebsitId()) || !pgOrderBase.getWebsitId().equals(websitId)){
+                orderLogLogic.addLog(pgOrderBase.getId(), "指派网点", "派工给网点【" + (websitId) + adminWebsit.getName() + "】", adminWebsit.getName());
+
+            }
+        }
 
         pgOrderBaseService.lambdaUpdate()
                 .in(PgOrderBase::getId, ids)

+ 4 - 1
mall-server-api/src/main/java/com/gree/mall/manager/logic/workorder/OrderBaseLogic.java

@@ -2298,7 +2298,10 @@ public class OrderBaseLogic {
         for (PgOrderBase pgOrderBase : pgOrderBases) {
             PgOrderBaseDetail pgOrderBaseDetail = BeanUtil.toBean(pgOrderBase, PgOrderBaseDetail.class);
 
-            List<PgOrderOperatorLog> pgOrderOperatorLogs = pgOrderOperatorLogService.lambdaQuery().eq(PgOrderOperatorLog::getOrderBaseId, pgOrderBase.getId()).list();
+            List<PgOrderOperatorLog> pgOrderOperatorLogs = pgOrderOperatorLogService.lambdaQuery()
+                    .eq(PgOrderOperatorLog::getOrderBaseId, pgOrderBase.getId())
+                    .orderByDesc(PgOrderOperatorLog::getId)
+                    .list();
 
             List<SettlementOrder> settlementOrderList = settlementOrderService.lambdaQuery().eq(SettlementOrder::getWorkerOrderId, pgOrderBase.getId()).list();
 

+ 51 - 0
mall-server-api/src/main/java/com/gree/mall/manager/schedule/ComListSchedule.java

@@ -0,0 +1,51 @@
+package com.gree.mall.manager.schedule;
+
+import cn.hutool.core.date.DateUtil;
+import com.github.binarywang.wxpay.exception.WxPayException;
+import com.gree.mall.manager.enums.workorder.OrderBaseStatusEnum;
+import com.gree.mall.manager.logic.comlist.ComListLogic;
+import com.gree.mall.manager.logic.common.WechatLogic;
+import com.gree.mall.manager.logic.websit.SettlementOrderLogic;
+import com.gree.mall.manager.logic.workorder.OrderBaseLogic;
+import com.gree.mall.manager.plus.entity.PgOrderBase;
+import com.gree.mall.manager.plus.entity.SettlementOrder;
+import com.gree.mall.manager.plus.service.PgOrderBaseService;
+import com.gree.mall.manager.plus.service.SettlementOrderService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
+import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 中心文件上传
+ * @author :lijh
+ * @description:TODO
+ * @date :2024/4/26 14:12
+ */
+@ConditionalOnProperty(name = "schedule.enable", havingValue = "true", matchIfMissing = true)
+@Component
+@Slf4j
+public class ComListSchedule {
+
+    @Autowired
+    ComListLogic comListLogic;
+
+
+    /**
+     * 生成抢单通知
+     */
+    @Transactional
+    @Scheduled(fixedDelay = 1*60 * 1000)
+    public void task() {
+        comListLogic.upFile();
+    }
+
+
+}