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) {
try {
long timeMillis = System.currentTimeMillis();
if(ObjectUtil.isEmpty(entity.getCreateTime())&&ObjectUtil.isEmpty(entity.getCreateEndTime())){
LocalDateTime date = LocalDateTime.now();
LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0);
entity.setCreateTime(Date.from(firstDay.atZone(ZoneId.systemDefault()).toInstant()));
entity.setCreateEndTime(new Date());
}
// if(ObjectUtil.isEmpty(entity.getCreateTime())&&ObjectUtil.isEmpty(entity.getCreateEndTime())){
// LocalDateTime date = LocalDateTime.now();
// LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0);
// entity.setCreateTime(Date.from(firstDay.atZone(ZoneId.systemDefault()).toInstant()));
// entity.setCreateEndTime(new Date());
// }
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("UTF-8");
// 这里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"
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
WHERE DATE_FORMAT(P.CREATE_TIME,'%Y-%m') = #{month}
<if test="createDept != null and createDept.size > 0">
@ -13,16 +13,16 @@
#{item}
</foreach>
</if>
and P.DEFECT_GRADING IS NOT NULL
and P.DEFECT_LEVEL IS NOT NULL
AND P.IS_DEFECT='1'
AND P.IS_DELETED = '0'
GROUP BY P.DEFECT_GRADING,P.HANDLE_STATUS
ORDER BY P.DEFECT_GRADING
GROUP BY P.DEFECT_LEVEL,P.HANDLE_STATUS
ORDER BY P.DEFECT_LEVEL
</select>
<select id="getStatisticBySeveralMonth"
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
WHERE P.CREATE_TIME BETWEEN #{firstMonth} AND #{endMonth}
<if test="createDept != null and createDept.size > 0">
@ -33,13 +33,13 @@
</if>
AND P.IS_DEFECT='1'
AND P.IS_DELETED = 0
and P.DEFECT_GRADING IS NOT NULL
GROUP BY P.DEFECT_GRADING,P.HANDLE_STATUS
ORDER BY P.DEFECT_GRADING
and P.DEFECT_LEVEL IS NOT NULL
GROUP BY P.DEFECT_LEVEL,P.HANDLE_STATUS
ORDER BY P.DEFECT_LEVEL
</select>
<select id="getRepetStatistics"
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
WHERE 1=1
<if test="createDept != null and createDept.size > 0">
@ -48,10 +48,10 @@
#{item}
</foreach>
</if>
and P.DEFECT_GRADING IS NOT NULL
and P.DEFECT_LEVEL IS NOT NULL
AND P.IS_DEFECT='1'
AND P.IS_DELETED = 0
GROUP BY P.DEFECT_GRADING,P.FAULT_CODE
GROUP BY P.DEFECT_LEVEL,P.FAULT_CODE
</select>
<select id="getManageIndex" resultType="java.lang.Integer">
@ -61,7 +61,7 @@
AND P.HANDLE_STATUS = 1
AND P.IS_DEFECT='1'
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
<if test="createDept != null and createDept.size > 0">
AND P.CREATE_DEPT in
@ -78,7 +78,7 @@
AND D.HANDLE_STATUS = 1
AND D.IS_DEFECT='1'
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">
AND D.CREATE_DEPT in
<foreach collection="createDept" item="item" index="index" open="(" close=")" separator=",">
@ -94,7 +94,7 @@
AND D.HANDLE_STATUS = 0
AND D.IS_DELETED = 0
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">
AND D.CREATE_DEPT in
<foreach collection="createDept" item="item" index="index" open="(" close=")" separator=",">
@ -110,7 +110,7 @@
AND D.HANDLE_STATUS = 0
AND D.IS_DELETED = 0
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">
AND D.CREATE_DEPT in
<foreach collection="createDept" item="item" index="index" open="(" close=")" separator=",">
@ -125,7 +125,7 @@
WHERE DATE_FORMAT(D.CREATE_TIME,'%Y-%m') = #{month}
AND D.IS_DELETED = 0
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">
AND D.CREATE_DEPT in
<foreach collection="createDept" item="item" index="index" open="(" close=")" separator=",">

Loading…
Cancel
Save