Browse Source

缺陷月报表bug修复

zhongwei
ty 10 months ago
parent
commit
b4fc35d5ac
  1. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectStatisticsController.java
  2. 32
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/mapper/OperDefectMapper.xml

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectStatisticsController.java

@ -107,12 +107,12 @@ public class OperDefectStatisticsController extends BladeController {
public void exportDefectList(HttpServletResponse response,@RequestBody OperDefectStatisticsVO entity) { public void exportDefectList(HttpServletResponse response,@RequestBody OperDefectStatisticsVO entity) {
try { try {
long timeMillis = System.currentTimeMillis(); long timeMillis = System.currentTimeMillis();
if(ObjectUtil.isEmpty(entity.getCreateTime())&&ObjectUtil.isEmpty(entity.getCreateEndTime())){ // if(ObjectUtil.isEmpty(entity.getCreateTime())&&ObjectUtil.isEmpty(entity.getCreateEndTime())){
LocalDateTime date = LocalDateTime.now(); // LocalDateTime date = LocalDateTime.now();
LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0); // LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0);
entity.setCreateTime(Date.from(firstDay.atZone(ZoneId.systemDefault()).toInstant())); // entity.setCreateTime(Date.from(firstDay.atZone(ZoneId.systemDefault()).toInstant()));
entity.setCreateEndTime(new Date()); // entity.setCreateEndTime(new Date());
} // }
response.setContentType("application/vnd.ms-excel"); response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系

32
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/mapper/OperDefectMapper.xml

@ -4,7 +4,7 @@
<select id="getStatisticByMonth" <select id="getStatisticByMonth"
resultType="com.hnac.hzims.operational.defect.dto.OperDefectStatisticsStatusDTO"> resultType="com.hnac.hzims.operational.defect.dto.OperDefectStatisticsStatusDTO">
SELECT P.DEFECT_GRADING as defectLevel,P.HANDLE_STATUS,COUNT(P.ID) AS DEFECT_NUM from SELECT P.DEFECT_LEVEL as defectLevel,P.HANDLE_STATUS,COUNT(P.ID) AS DEFECT_NUM from
hzims_oper_phenomenon P hzims_oper_phenomenon P
WHERE DATE_FORMAT(P.CREATE_TIME,'%Y-%m') = #{month} WHERE DATE_FORMAT(P.CREATE_TIME,'%Y-%m') = #{month}
<if test="createDept != null and createDept.size > 0"> <if test="createDept != null and createDept.size > 0">
@ -13,16 +13,16 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
and P.DEFECT_GRADING IS NOT NULL and P.DEFECT_LEVEL IS NOT NULL
AND P.IS_DEFECT='1' AND P.IS_DEFECT='1'
AND P.IS_DELETED = '0' AND P.IS_DELETED = '0'
GROUP BY P.DEFECT_GRADING,P.HANDLE_STATUS GROUP BY P.DEFECT_LEVEL,P.HANDLE_STATUS
ORDER BY P.DEFECT_GRADING ORDER BY P.DEFECT_LEVEL
</select> </select>
<select id="getStatisticBySeveralMonth" <select id="getStatisticBySeveralMonth"
resultType="com.hnac.hzims.operational.defect.dto.OperDefectStatisticsStatusDTO"> resultType="com.hnac.hzims.operational.defect.dto.OperDefectStatisticsStatusDTO">
SELECT P.DEFECT_GRADING as defectLevel,P.HANDLE_STATUS,COUNT(P.ID) AS DEFECT_NUM SELECT P.DEFECT_LEVEL as defectLevel,P.HANDLE_STATUS,COUNT(P.ID) AS DEFECT_NUM
from hzims_oper_phenomenon P from hzims_oper_phenomenon P
WHERE P.CREATE_TIME BETWEEN #{firstMonth} AND #{endMonth} WHERE P.CREATE_TIME BETWEEN #{firstMonth} AND #{endMonth}
<if test="createDept != null and createDept.size > 0"> <if test="createDept != null and createDept.size > 0">
@ -33,13 +33,13 @@
</if> </if>
AND P.IS_DEFECT='1' AND P.IS_DEFECT='1'
AND P.IS_DELETED = 0 AND P.IS_DELETED = 0
and P.DEFECT_GRADING IS NOT NULL and P.DEFECT_LEVEL IS NOT NULL
GROUP BY P.DEFECT_GRADING,P.HANDLE_STATUS GROUP BY P.DEFECT_LEVEL,P.HANDLE_STATUS
ORDER BY P.DEFECT_GRADING ORDER BY P.DEFECT_LEVEL
</select> </select>
<select id="getRepetStatistics" <select id="getRepetStatistics"
resultType="com.hnac.hzims.operational.defect.dto.OperDefectStatisticsCodeDTO"> resultType="com.hnac.hzims.operational.defect.dto.OperDefectStatisticsCodeDTO">
SELECT P.DEFECT_GRADING as defectLevel,P.FAULT_CODE,COUNT(P.ID) AS DEFECT_NUM from SELECT P.DEFECT_LEVEL as defectLevel,P.FAULT_CODE,COUNT(P.ID) AS DEFECT_NUM from
hzims_oper_phenomenon P hzims_oper_phenomenon P
WHERE 1=1 WHERE 1=1
<if test="createDept != null and createDept.size > 0"> <if test="createDept != null and createDept.size > 0">
@ -48,10 +48,10 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
and P.DEFECT_GRADING IS NOT NULL and P.DEFECT_LEVEL IS NOT NULL
AND P.IS_DEFECT='1' AND P.IS_DEFECT='1'
AND P.IS_DELETED = 0 AND P.IS_DELETED = 0
GROUP BY P.DEFECT_GRADING,P.FAULT_CODE GROUP BY P.DEFECT_LEVEL,P.FAULT_CODE
</select> </select>
<select id="getManageIndex" resultType="java.lang.Integer"> <select id="getManageIndex" resultType="java.lang.Integer">
@ -61,7 +61,7 @@
AND P.HANDLE_STATUS = 1 AND P.HANDLE_STATUS = 1
AND P.IS_DEFECT='1' AND P.IS_DEFECT='1'
AND P.IS_DELETED = 0 AND P.IS_DELETED = 0
and P.DEFECT_GRADING IS NOT NULL and P.DEFECT_LEVEL IS NOT NULL
AND P.ACT_END_TIME &lt;= P.PLAN_END_TIME AND P.ACT_END_TIME &lt;= P.PLAN_END_TIME
<if test="createDept != null and createDept.size > 0"> <if test="createDept != null and createDept.size > 0">
AND P.CREATE_DEPT in AND P.CREATE_DEPT in
@ -78,7 +78,7 @@
AND D.HANDLE_STATUS = 1 AND D.HANDLE_STATUS = 1
AND D.IS_DEFECT='1' AND D.IS_DEFECT='1'
AND D.IS_DELETED = 0 AND D.IS_DELETED = 0
and D.DEFECT_GRADING IS NOT NULL and D.DEFECT_LEVEL IS NOT NULL
<if test="createDept != null and createDept.size > 0"> <if test="createDept != null and createDept.size > 0">
AND D.CREATE_DEPT in AND D.CREATE_DEPT in
<foreach collection="createDept" item="item" index="index" open="(" close=")" separator=","> <foreach collection="createDept" item="item" index="index" open="(" close=")" separator=",">
@ -94,7 +94,7 @@
AND D.HANDLE_STATUS = 0 AND D.HANDLE_STATUS = 0
AND D.IS_DELETED = 0 AND D.IS_DELETED = 0
AND D.IS_DEFECT='1' AND D.IS_DEFECT='1'
and D.DEFECT_GRADING IS NOT NULL and D.DEFECT_LEVEL IS NOT NULL
<if test="createDept != null and createDept.size > 0"> <if test="createDept != null and createDept.size > 0">
AND D.CREATE_DEPT in AND D.CREATE_DEPT in
<foreach collection="createDept" item="item" index="index" open="(" close=")" separator=","> <foreach collection="createDept" item="item" index="index" open="(" close=")" separator=",">
@ -110,7 +110,7 @@
AND D.HANDLE_STATUS = 0 AND D.HANDLE_STATUS = 0
AND D.IS_DELETED = 0 AND D.IS_DELETED = 0
AND D.IS_DEFECT='1' AND D.IS_DEFECT='1'
and D.DEFECT_GRADING IS NOT NULL and D.DEFECT_LEVEL IS NOT NULL
<if test="createDept != null and createDept.size > 0"> <if test="createDept != null and createDept.size > 0">
AND D.CREATE_DEPT in AND D.CREATE_DEPT in
<foreach collection="createDept" item="item" index="index" open="(" close=")" separator=","> <foreach collection="createDept" item="item" index="index" open="(" close=")" separator=",">
@ -125,7 +125,7 @@
WHERE DATE_FORMAT(D.CREATE_TIME,'%Y-%m') = #{month} WHERE DATE_FORMAT(D.CREATE_TIME,'%Y-%m') = #{month}
AND D.IS_DELETED = 0 AND D.IS_DELETED = 0
AND D.IS_DEFECT='1' AND D.IS_DEFECT='1'
and D.DEFECT_GRADING IS NOT NULL and D.DEFECT_LEVEL IS NOT NULL
<if test="createDept != null and createDept.size > 0"> <if test="createDept != null and createDept.size > 0">
AND D.CREATE_DEPT in AND D.CREATE_DEPT in
<foreach collection="createDept" item="item" index="index" open="(" close=")" separator=","> <foreach collection="createDept" item="item" index="index" open="(" close=")" separator=",">

Loading…
Cancel
Save