From 948deb769e66a1b02d26e46572027d6fbfc2f145 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 22 八月 2023 18:19:59 +0800
Subject: [PATCH] da

---
 server/src/main/java/doumeemes/service/ext/impl/StatisticsServiceImpl.java |    9 ++++++---
 server/src/main/resources/mappers/RouteProcedureExtMapper.xml              |    2 +-
 server/src/main/resources/mappers/WorkorderRecordExtMapper.xml             |    2 +-
 server/src/main/resources/mappers/PlansExtMapper.xml                       |    2 +-
 server/src/main/resources/mappers/WorkPlansExtMapper.xml                   |    2 +-
 5 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/server/src/main/java/doumeemes/service/ext/impl/StatisticsServiceImpl.java b/server/src/main/java/doumeemes/service/ext/impl/StatisticsServiceImpl.java
index 126abd9..9826144 100644
--- a/server/src/main/java/doumeemes/service/ext/impl/StatisticsServiceImpl.java
+++ b/server/src/main/java/doumeemes/service/ext/impl/StatisticsServiceImpl.java
@@ -179,7 +179,7 @@
         List<Unqualified7DayModel> result = new ArrayList<>();
         Date date = DateUtil.getCurrentDate();
         for (int i = 0; i < 7; i++) {
-            Date td = DateUtil.addDaysToDate(date, 7-i);
+            Date td = DateUtil.addDaysToDate(date, i-6);
             Unqualified7DayModel m = getReusltModelByDate(td,model);
             if(m == null){
                 m = new Unqualified7DayModel();
@@ -288,6 +288,7 @@
                 QueryRouteProcedureExtDTO r = new QueryRouteProcedureExtDTO();
                 r.setRouteId(model.getRouteId());
                 r.setDeleted(Constants.ZERO);
+                r.setWorkPlanId(model.getId());
                 List<RouteProcedureExtListVO> list = routeProcedureExtMapper.selectStatisticsList(r);
                 List<WorkPlansProcedureModel> rList = new ArrayList<>();
                 if(list != null){
@@ -298,7 +299,7 @@
                         tt.setRate(new BigDecimal(0));
                         if(  Constants.formatBigdecimal(t.getPlanNum()).compareTo(new BigDecimal(0)) >0){
                             //瀹屾垚鐜�
-                            tt.setRate(Constants.formatBigdecimal(t.getDoneNum()).divide(t.getPlanNum(),4).subtract(new BigDecimal(100)));
+                            tt.setRate(Constants.formatBigdecimal(t.getDoneNum()).divide(t.getPlanNum(),4).multiply(new BigDecimal(100)));
                         }
                         tt.setPlanNum(Constants.formatBigdecimal(t.getPlanNum()));
                         tt.setDoneNum(Constants.formatBigdecimal(t.getDoneNum()));
@@ -317,7 +318,9 @@
     private Unqualified7DayModel getReusltModelByDate(Date td, List<Unqualified7DayModel> model ) {
         if(model !=null){
             for(Unqualified7DayModel m : model){
-                if(StringUtils.equals(DateUtil.getShortTime(td),DateUtil.getShortTime(m.getCreateTime()))){
+                String d1 = DateUtil.getShortTime(td);
+                String d2 = DateUtil.getShortTime(m.getCreateTime());
+                if(StringUtils.equals(d1,d2)){
                     return m;
                 }
             }
diff --git a/server/src/main/resources/mappers/PlansExtMapper.xml b/server/src/main/resources/mappers/PlansExtMapper.xml
index 7b3b4d6..e48e1b2 100644
--- a/server/src/main/resources/mappers/PlansExtMapper.xml
+++ b/server/src/main/resources/mappers/PlansExtMapper.xml
@@ -310,7 +310,7 @@
     LEFT JOIN `material_distribute` c ON a.MATERIAL_ID=c.ID
     LEFT JOIN `material` m ON c.MATERIAL_ID=m.ID
     where (a.status in (1,4) or (a.status=6 and EXISTS(select b.id from workorder_record b where b.type=1 and b.DELETED=0 and b.PLAN_ID=a.id) ))
-    and a.deleted=0 and a.ROOT_DEPART_ID=#{rootDepartId} and a.DEPART_ID=#{departId}
+    and a.deleted=0 and a.ROOT_DEPART_ID=#{rootDepartId} and a.DEPART_ID=#{departId} and a.PROCEDURE_ID=#{procedureId}
     order by a.CREATE_TIME
   </select>
   <select id="selectList" parameterType="doumeemes.dao.ext.dto.QueryPlansExtDTO" resultMap="PlansExtListVO">
diff --git a/server/src/main/resources/mappers/RouteProcedureExtMapper.xml b/server/src/main/resources/mappers/RouteProcedureExtMapper.xml
index 550a884..caba8ea 100644
--- a/server/src/main/resources/mappers/RouteProcedureExtMapper.xml
+++ b/server/src/main/resources/mappers/RouteProcedureExtMapper.xml
@@ -457,7 +457,7 @@
     SELECT a.*,p.`NAME` AS procedureName
     ,(select sum(b.num) from workorder_record b left join workorder d on b.workorder_id=d.id left join plans c on b.plan_id=c.id where d.status=4 and b.type=1 and b.deleted=0 and c.deleted=0  and b.procedure_id=p.id and c.work_plans_id=#{workPlanId}) as doneNum
     ,(select sum(b.qualified_num) from workorder_record b  left join workorder d on b.workorder_id=d.id  left join plans c on b.plan_id=c.id where d.status=4 and b.type=1 and b.deleted=0 and c.deleted=0  and b.procedure_id=p.id and c.work_plans_id=#{workPlanId}) as qualifiedNum
-    ,(select sum(b.num) from plans b where b.deleted=0 and b.work_plans_id=#{workPlanId} and b.procedure_id=p.id) as plansNum
+    ,(select sum(b.num) from plans b where b.deleted=0 and b.work_plans_id=#{workPlanId} and b.procedure_id=p.id) as planNum
     FROM `route_procedure` `a`
     LEFT JOIN `procedures` `p` ON a.PROCEDURE_ID=p.ID
     where a.ROUTE_ID = #{routeId}
diff --git a/server/src/main/resources/mappers/WorkPlansExtMapper.xml b/server/src/main/resources/mappers/WorkPlansExtMapper.xml
index 724617d..bd5eae7 100644
--- a/server/src/main/resources/mappers/WorkPlansExtMapper.xml
+++ b/server/src/main/resources/mappers/WorkPlansExtMapper.xml
@@ -173,7 +173,7 @@
   <select id="getPlansStaticticsData" parameterType="doumeemes.dao.ext.dto.QueryWorkPlansDTO" resultType="doumeemes.dao.business.dto.statistics.StatisticsPlanDataModel">
     SELECT count(a.id) as ingNum,
     (select count(b.id)  FROM `work_plans` b where b.DELETED = 0 AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId}  AND  (b.`STATUS` = 1 and  now() > b.plan_Date  )) as delayNum,
-    (select count(distinct(b.CREATE_USER))  FROM `workorder_record` b left join workorder c on b.workorder_id =c.id where b.DELETED = 0 AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId}  AND c.status in (0,1,2,3,4,7)) as prouserNum,
+    (select count(distinct(b.CREATE_USER))  FROM `workorder_record` b left join workorder c on b.workorder_id =c.id where to_days(b.create_time)=to_days(now()) and b.DELETED = 0 AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId}  AND c.status in (0,1,2,3,4,7)) as prouserNum,
     (select count(distinct(b.PRO_DEVICE_ID))  FROM `workorder_record` b left join workorder c on b.workorder_id =c.id where b.DELETED = 0 AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId}  AND c.status in (0,1,2,3,4,7)) as deviceNum,
     (select sum(ifnull(b.UNQUALIFIED_NUM,0))  FROM `workorder_record` b left join workorder c on b.workorder_id =c.id where b.DELETED = 0 AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId}  AND c.status=4) as unqualifiedNum,
     (select sum(ifnull(b.NUM,0))  FROM `workorder_record` b left join workorder c on b.workorder_id =c.id where b.DELETED = 0 AND b.ROOT_DEPART_ID = #{rootDepartId} AND b.DEPART_ID = #{departId}  AND c.status=4) as doneNum
diff --git a/server/src/main/resources/mappers/WorkorderRecordExtMapper.xml b/server/src/main/resources/mappers/WorkorderRecordExtMapper.xml
index ba1ad1b..0b73dbf 100644
--- a/server/src/main/resources/mappers/WorkorderRecordExtMapper.xml
+++ b/server/src/main/resources/mappers/WorkorderRecordExtMapper.xml
@@ -494,7 +494,7 @@
     from workorder_record a
     left join company_user b on b.DELETED=0 and b.user_id=a.CREATE_USER
     left join workorder c on a.WORKORDER_ID=c.id
-    where a.deleted=0 and a.ROOT_DEPART_ID=#{rootDepartId} and a.DEPART_ID=#{departId} and c.status=4
+    where  to_days(a.create_time)=to_days(now()) and a.deleted=0 and a.ROOT_DEPART_ID=#{rootDepartId} and a.DEPART_ID=#{departId} and c.status=4
     <if test="procedureId != null">
       AND  a.`PROCEDURE_ID` = #{procedureId}
     </if>

--
Gitblit v1.9.3