luowei 1 년 전
부모
커밋
aaa70a5c46

+ 2 - 2
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/access/service/impl/TMonitoringRetrievalPlanServiceImpl.java

@@ -519,7 +519,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
                         }
                         break;
                     default:
-                        startAndEnd = DateUtils.getStartAndEnd(new Date(), Integer.valueOf(plan.getPlanCycle()) + 1);
+                       // startAndEnd = DateUtils.getStartAndEnd(new Date(), Integer.valueOf(plan.getPlanCycle()) + 1);
                         if (isComplete){
                             iCoreMonitoringRetrievalTaskService.deleteDayTaskByTime(plan.getId(), plan.getPlanCycle(),null,null);
                         }
@@ -541,7 +541,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
         status.add("3");
         List<CoreMonitoringRetrievalTask> coreMonitoringRetrievalTasks1 = iCoreMonitoringRetrievalTaskService.selectAllTaskByPlanId(ids, status);
         if (!plan.getPlanCycle().equals("0")) {
-            startAndEnd = DateUtils.getStartAndEnd(new Date(), Integer.valueOf(plan.getPlanCycle()) + 1);
+           // startAndEnd = DateUtils.getStartAndEnd(new Date(), Integer.valueOf(plan.getPlanCycle()) + 1);
             if (coreMonitoringRetrievalTasks.size()==coreMonitoringRetrievalTasks1.size()){
                 iCoreMonitoringRetrievalTaskService.deleteDayTaskByTimeAndPlanId(id, plan.getPlanCycle(),null,null);
             }

+ 2 - 2
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/evaluate/mapper/CoreEvaluateTaskMapper.java

@@ -76,7 +76,7 @@ public interface CoreEvaluateTaskMapper extends BaseMapper<CoreEvaluateTask> {
 
     Page<Map> statistics(@Param("page") Page<Map> page, @Param("request") EvaluateTaskStatisticsDTO request);
 
-    List<LinkedHashMap> statisticsAll(@Param("request") EvaluateTaskStatisticsDTO request);
-
+    //List<LinkedHashMap> statisticsAll(@Param("request") EvaluateTaskStatisticsDTO request);
+    LinkedHashMap statisticsAll(@Param("request") EvaluateTaskStatisticsDTO request);
     List<Map> getContentByTaskId(@Param("id") Long id);
 }

+ 65 - 24
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/evaluate/service/impl/CoreEvaluateTaskServiceImpl.java

@@ -106,31 +106,71 @@ public class CoreEvaluateTaskServiceImpl extends ServiceImpl<CoreEvaluateTaskMap
         return TableDataInfo.build(page);
     }
 
+    private Map beiyong(EvaluateTaskStatisticsDTO evaluateTaskStatisticsDTO) {
+/*    Map map = new HashMap();
+    Page<Map> page;
+    //分页
+    if (evaluateTaskStatisticsDTO.getPageNum() != null && evaluateTaskStatisticsDTO.getPageSize() != null) {
+        page = new Page<>(evaluateTaskStatisticsDTO.getPageNum(), evaluateTaskStatisticsDTO.getPageSize());
+    } else {
+        page = new Page<>();
+    }
+    SysOrg sysOrg = remoteOrgService.selectSysOrgById(evaluateTaskStatisticsDTO.getOrgId(), SecurityConstants.INNER);
+    evaluateTaskStatisticsDTO.setOrgPath(sysOrg.getPath());
+    if (sysOrg.getType().equals(1)) {
+        evaluateTaskStatisticsDTO.setType(3);
+    } else {
+        evaluateTaskStatisticsDTO.setType(4);
+    }
+    evaluateTaskStatisticsDTO.setOrgId(null);
+    evaluateTaskStatisticsDTO.setOrgPath(null);
+  //  List<LinkedHashMap> rows = baseMapper.statisticsAll(evaluateTaskStatisticsDTO);
+    Integer average = 0;
+    Integer all = 0;
+    for (int i = 0; i < rows.size(); i++) {
+        Object id = rows.get(i).get("id");
+        rows.get(i).remove("id");
+        List<Map> contentByTaskId = baseMapper.getContentByTaskId((Long) id);
+        if (CollectionUtils.isNotEmpty(contentByTaskId)) {
+            int total = 0;
+            for (int l = 0; l < contentByTaskId.size(); l++) {
+                Double score = Double.valueOf(contentByTaskId.get(l).get("score").toString());
+                total += score;
+            }
+            rows.get(i).put("评价得分", total);
+            all += total;
+        }
+    }
+    map.put("list", rows);
+    if (rows.size() > 0) {
+        average = all / rows.size();
+    }
+    map.put("average", average);
+    return map;*/
+        return null;
+    }
+
     @Override
     public Map statistics(EvaluateTaskStatisticsDTO evaluateTaskStatisticsDTO) {
         Map map = new HashMap();
-        Page<Map> page;
-        //分页
-        if (evaluateTaskStatisticsDTO.getPageNum() != null && evaluateTaskStatisticsDTO.getPageSize() != null) {
-            page = new Page<>(evaluateTaskStatisticsDTO.getPageNum(), evaluateTaskStatisticsDTO.getPageSize());
-        } else {
-            page = new Page<>();
-        }
-        SysOrg sysOrg = remoteOrgService.selectSysOrgById(evaluateTaskStatisticsDTO.getOrgId(), SecurityConstants.INNER);
-        evaluateTaskStatisticsDTO.setOrgPath(sysOrg.getPath());
-        if (sysOrg.getType().equals(1)) {
-            evaluateTaskStatisticsDTO.setType(3);
-        } else {
-            evaluateTaskStatisticsDTO.setType(4);
-        }
-        evaluateTaskStatisticsDTO.setOrgId(null);
-        evaluateTaskStatisticsDTO.setOrgPath(null);
-        List<LinkedHashMap> rows = baseMapper.statisticsAll(evaluateTaskStatisticsDTO);
-        Integer average = 0;
+        List<SysOrg> sysOrgs = remoteOrgService.selectSysOrgByParentId(evaluateTaskStatisticsDTO.getOrgId(), SecurityConstants.INNER);
+        List<LinkedHashMap> rows = new ArrayList<>();
+        Double average = null;
         Integer all = 0;
-        for (int i = 0; i < rows.size(); i++) {
-            Object id = rows.get(i).get("id");
-            rows.get(i).remove("id");
+        for (int i = 0; i < sysOrgs.size(); i++) {
+            evaluateTaskStatisticsDTO.setOrgId(sysOrgs.get(i).getId());
+            LinkedHashMap linkedHashMap = new LinkedHashMap();
+            linkedHashMap.put("评价机构", sysOrgs.get(i).getShortName());
+            LinkedHashMap linkedHashMap1 = baseMapper.statisticsAll(evaluateTaskStatisticsDTO);
+            if (null == linkedHashMap1) {
+                linkedHashMap.put("被评价机构名称", "");
+                linkedHashMap.put("评价得分", 0);
+            } else {
+                linkedHashMap.put("被评价机构名称", linkedHashMap1.get("被评价机构名称"));
+                linkedHashMap.put("id", linkedHashMap1.get("id"));
+            }
+            Object id = linkedHashMap.get("id");
+            linkedHashMap.remove("id");
             List<Map> contentByTaskId = baseMapper.getContentByTaskId((Long) id);
             if (CollectionUtils.isNotEmpty(contentByTaskId)) {
                 int total = 0;
@@ -138,15 +178,16 @@ public class CoreEvaluateTaskServiceImpl extends ServiceImpl<CoreEvaluateTaskMap
                     Double score = Double.valueOf(contentByTaskId.get(l).get("score").toString());
                     total += score;
                 }
-                rows.get(i).put("评价得分", total);
+                linkedHashMap.put("评价得分", total);
                 all += total;
             }
+            rows.add(linkedHashMap);
         }
         map.put("list", rows);
         if (rows.size() > 0) {
-            average = all / rows.size();
+            average = (double) all / rows.size();
         }
-        map.put("average", average);
+        map.put("average", String.format("%.2f", average));
         return map;
     }
 

+ 5 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/reportForms/monitor/service/impl/MonitorAccessReportServiceImpl.java

@@ -13,6 +13,8 @@ import com.xunmei.core.reportForms.monitor.dto.MonitoringAccessDTO;
 import com.xunmei.core.reportForms.monitor.mapper.MonitorAccessReportMapper;
 import com.xunmei.core.reportForms.monitor.service.MonitorAccessReportService;
 import com.xunmei.core.reportForms.monitor.vo.MonitoringAccessVO;
+import com.xunmei.core.reportForms.resumption.dto.ResumptionDTO;
+import com.xunmei.core.reportForms.resumption.service.ResumptionReportService;
 import com.xunmei.system.api.RemoteOrgService;
 import com.xunmei.system.api.RemoteRoleService;
 import com.xunmei.system.api.domain.SysDictData;
@@ -41,7 +43,8 @@ public class MonitorAccessReportServiceImpl implements MonitorAccessReportServic
     private MonitorAccessReportMapper monitorAccessReportMapper;
     @Resource
     private RemoteOrgService remoteOrgService;
-
+    @Autowired
+    private ResumptionReportService resumptionReportService;
     @Override
     public TableDataInfo<MonitoringAccessVO> report(MonitoringAccessDTO monitoringAccessDTO) {
         Page<MonitoringAccessVO> page;
@@ -79,6 +82,7 @@ public class MonitorAccessReportServiceImpl implements MonitorAccessReportServic
 
     @Override
     public List<MonitoringAccessVO> selectAll(MonitoringAccessDTO monitoringAccessDTO) {
+        resumptionReportService.report(new ResumptionDTO());
         if (null == monitoringAccessDTO.getOrgId()) {
             monitoringAccessDTO.setOrgId(SecurityUtils.getLoginUser().getOrgId());
         }

+ 16 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/reportForms/resumption/controller/ResumptionReportController.java

@@ -5,6 +5,7 @@ import com.xunmei.common.security.annotation.RequiresPermissions;
 import com.xunmei.core.reportForms.monitor.dto.MonitoringAccessDTO;
 import com.xunmei.core.reportForms.resumption.dto.ResumptionDTO;
 import com.xunmei.core.reportForms.resumption.service.ResumptionReportService;
+import com.xunmei.core.reportForms.resumption.vo.ResumptionDayVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -12,6 +13,12 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.sql.Date;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.util.List;
+
 /**
  * @author :LuoWei
  * @date : 2023/11/8
@@ -27,6 +34,14 @@ public class ResumptionReportController {
     @RequiresPermissions("core:resumptionReport:list")
     @GetMapping("/list")
     public AjaxResult list(ResumptionDTO resumptionDTO) {
-        return AjaxResult.success(resumptionReportService.report(resumptionDTO));
+        if (null == resumptionDTO.getSearchTime()) {
+            LocalDate currentDate = LocalDate.now();
+            resumptionDTO.setSearchTime(currentDate.toString());
+        }
+        AjaxResult ajaxResult = AjaxResult.success();
+        List<ResumptionDayVO> report = resumptionReportService.report(resumptionDTO);
+        ajaxResult.put(AjaxResult.DATA_TAG, report);
+        ajaxResult.put("title", "日报表-营业网点每日安全保卫履职(" + resumptionDTO.getSearchTime() + ")");
+        return ajaxResult;
     }
 }

+ 5 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/reportForms/resumption/dto/ResumptionDTO.java

@@ -1,7 +1,11 @@
 package com.xunmei.core.reportForms.resumption.dto;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.util.Date;
+
 /**
  * @author :LuoWei
  * @date : 2023/11/7
@@ -9,6 +13,6 @@ import lombok.Data;
 @Data
 public class ResumptionDTO {
     private Long orgId;
-    private String date;
+    private String searchTime;
     private Integer planType;
 }

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/reportForms/resumption/mapper/ResumptionReportMapper.java

@@ -14,5 +14,5 @@ import java.util.List;
 @Mapper
 public interface ResumptionReportMapper {
 
-    ResumptionDayVO selectReport(@Param("planType") Integer planType, @Param("orgId") Long orgId, @Param("date") String date);
+    ResumptionDayVO selectReport(@Param("planType") Integer planType, @Param("orgId") Long orgId, @Param("date") String date,@Param("orgPath")String orgPath);
 }

+ 10 - 5
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/reportForms/resumption/service/impl/ResumptionReportServiceImpl.java

@@ -12,6 +12,7 @@ import com.xunmei.system.api.domain.SysOrg;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -30,7 +31,8 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
 
     @Override
     public List<ResumptionDayVO> report(ResumptionDTO resumptionDTO) {
-        if (null==resumptionDTO.getOrgId()){
+
+        if (null == resumptionDTO.getOrgId()) {
             resumptionDTO.setOrgId(SecurityUtils.getLoginUser().getOrgId());
         }
         List<SysOrg> sysOrgs = orgService.selectSysOrgByParentId(resumptionDTO.getOrgId(), SecurityConstants.INNER);
@@ -41,19 +43,19 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
             Integer integer = monitorAccessReportMapper.selectNetworkNumberByPath(o.getPath());
             resumptionDayVO.setNetworkNumber(integer);
             //营业前
-            ResumptionDayVO resumptionDayVO1 = resumptionReportMapper.selectReport(1, o.getId(), resumptionDTO.getDate());
+            ResumptionDayVO resumptionDayVO1 = resumptionReportMapper.selectReport(1, null, resumptionDTO.getSearchTime(), o.getPath());
             resumptionDayVO.setFrontRate(resumptionDayVO1.getFrontRate());
             resumptionDayVO.setFrontAbnormalNumber(resumptionDayVO1.getFrontAbnormalNumber());
             resumptionDayVO.setFrontPlanNumber(resumptionDayVO1.getFrontPlanNumber());
             resumptionDayVO.setFrontRealityNumber(resumptionDayVO1.getFrontRealityNumber());
             //营业中
-            ResumptionDayVO resumptionDayVO2 = resumptionReportMapper.selectReport(2, o.getId(), resumptionDTO.getDate());
+            ResumptionDayVO resumptionDayVO2 = resumptionReportMapper.selectReport(2, null, resumptionDTO.getSearchTime(), o.getPath());
             resumptionDayVO.setCentreRate(resumptionDayVO2.getFrontRate());
             resumptionDayVO.setCentreAbnormalNumber(resumptionDayVO2.getFrontAbnormalNumber());
             resumptionDayVO.setCentrePlanNumber(resumptionDayVO2.getFrontPlanNumber());
             resumptionDayVO.setCentreRealityNumber(resumptionDayVO2.getFrontRealityNumber());
             //后
-            ResumptionDayVO resumptionDayVO3 = resumptionReportMapper.selectReport(3, o.getId(), resumptionDTO.getDate());
+            ResumptionDayVO resumptionDayVO3 = resumptionReportMapper.selectReport(3, null, resumptionDTO.getSearchTime(), o.getPath());
             resumptionDayVO.setAfterRate(resumptionDayVO3.getFrontRate());
             resumptionDayVO.setAfterAbnormalNumber(resumptionDayVO3.getFrontAbnormalNumber());
             resumptionDayVO.setAfterPlanNumber(resumptionDayVO3.getFrontPlanNumber());
@@ -63,7 +65,10 @@ public class ResumptionReportServiceImpl implements ResumptionReportService {
             Integer totalAbnormal = resumptionDayVO3.getFrontAbnormalNumber() + resumptionDayVO2.getFrontAbnormalNumber() + resumptionDayVO1.getFrontAbnormalNumber();
             resumptionDayVO.setTotalPlanNumber(totalPlan);
             resumptionDayVO.setTotalRealityNumber(totalReality);
-            int i = totalReality / totalPlan * 100;
+            int i = 0;
+            if (totalReality != 0 && totalPlan != 0) {
+                i = totalReality / totalPlan * 100;
+            }
             resumptionDayVO.setTotalRate(i + "%");
             resumptionDayVO.setTotalAbnormalNumber(totalAbnormal);
             resumptionDayVOS.add(resumptionDayVO);

+ 3 - 0
soc-modules/soc-modules-core/src/main/resources/mapper/evaluate/CoreEvaluateTaskMapper.xml

@@ -200,6 +200,9 @@
         <if test="request.type != null">
             AND   e.type= #{request.type}
         </if>
+          <if test="request.orgId !=null">
+              AND   e.id=#{request.orgId}
+          </if>
             <if test="request.orgPath != null  and request.orgPath != ''">
                 AND a.org_path like concat(#{request.orgPath}, '%')
             </if>

+ 13 - 6
soc-modules/soc-modules-core/src/main/resources/mapper/reportForms/ResumptionReportMapper.xml

@@ -8,10 +8,10 @@
         SELECT
             COUNT( a.id ) AS frontPlanNumber,
             IFNULL( SUM( IF ( a.`status` = 3, 1, 0 )), 0 ) AS frontRealityNumber,
-            IFNULL(
-                    CONCAT( SUM( IF ( a.`status` = 3, 1, 0 ))/ COUNT( a.id )* 100, '%' ),
-                    '0%'
-                ) AS frontRate,
+        IF( SUM( IF ( a.`status` = 3, 1, 0 ))=0 OR COUNT( a.id )=0,'0%',IFNULL(
+        CONCAT( SUM( IF ( a.`status` = 3, 1, 0 ))/ COUNT( a.id )* 100, '%' ),
+        '0%'
+        )) AS frontRate,
             IFNULL( SUM( a.exception_count ), 0 ) AS frontAbnormalNumber
         FROM
             core_resumption a
@@ -19,7 +19,14 @@
         WHERE
             b.plan_type = #{planType}
           AND a.type = 2
-          AND a.org_id = #{orgId}
-          AND a.ymd_date = #{date}
+          <if test="orgId !=null">
+              AND a.org_id = #{orgId}
+          </if>
+          <if test="date !=null">
+              AND a.ymd_date = #{date}
+          </if>
+        <if test="orgPath !=null">
+            and a.org_path  like concat(#{orgPath},'%')
+        </if>
     </select>
 </mapper>