bug修改

This commit is contained in:
Administrator 2023-06-02 13:59:52 +08:00
parent 05a0b927b4
commit 72af5999d5
6 changed files with 184 additions and 103 deletions

View File

@ -120,15 +120,16 @@
<select id="getProjectInspectRecordCount" resultType="java.util.Map">
select tp.*,
round(IFNULL(TRUNCATE(IFNULL(rectifyCompleteNum, 0) / IFNULL(inspectNum, 0), 4), 0) * 100,
2) completeRatio,
round(IFNULL(TRUNCATE(IFNULL(closeNum, 0) / IFNULL(totalNum, 0), 4), 0) * 100, 2) closeRatio
2) completeRatio, <!--及时整改率-->
round(IFNULL(TRUNCATE(IFNULL(closeNum, 0) / IFNULL(totalNum, 0), 4), 0) * 100, 2) closeRatio,
tp.totalNum-tp.weekInspectNum-tp.monthInspectNum AS otherInspectNum <!--其他数量,就是除了月、周的检查数量-->
from (
SELECT count(1) totalNum,
IFNULL(SUM((CASE WHEN a.record_type = 2 THEN 1 ELSE 0 END)), 0) investigateNum,
IFNULL(SUM((CASE WHEN a.record_type = 1 THEN 1 ELSE 0 END)), 0) inspectNum,
IFNULL(SUM((CASE WHEN a.status = 1 or a.status = 4 THEN 1 ELSE 0 END)), 0) closeNum,
IFNULL(SUM((CASE WHEN a.status = 4 THEN 1 ELSE 0 END)), 0) rectifyCompleteNum,
IFNULL(SUM((CASE WHEN a.status = 2 OR a.status = 3 THEN 1 ELSE 0 END)), 0) notCloseNum,
IFNULL(SUM((CASE WHEN a.status = 4 THEN 1 ELSE 0 END)), 0) rectifyCompleteNum, <!--合格,就是已整改-->
IFNULL(SUM((CASE WHEN a.status = 2 OR a.status = 3 THEN 1 ELSE 0 END)), 0) notCloseNum, <!--未整改-->
IFNULL(SUM((CASE
WHEN (a.status = 2 OR a.status = 3)
AND DATE_FORMAT(now(), "%Y-%m-%d") > a.change_limit_time THEN 1
@ -138,8 +139,11 @@
ELSE 0 END)),
0) overdueRectificationNum,
IFNULL(SUM((CASE WHEN a.status = 2 THEN 1 ELSE 0 END)), 0) rectificationNum,
IFNULL(SUM((CASE WHEN a.status = 3 THEN 1 ELSE 0 END)), 0) reviewNum
IFNULL(SUM((CASE WHEN a.status = 3 THEN 1 ELSE 0 END)), 0) reviewNum, <!--待复查,待审核-->
IFNULL(SUM((CASE WHEN tr.frequency_type = 3 THEN 1 ELSE 0 END)), 0) weekInspectNum, <!--周检查数量-->
IFNULL(SUM((CASE WHEN tr.frequency_type = 4 THEN 1 ELSE 0 END)), 0) monthInspectNum <!--月检查数量-->
from hidden_danger_inspection_record a
left join inspect_task_record tr on tr.id=a.task_id
WHERE a.project_sn = #{projectSn}
<if test="createUser != null and createUser != ''">
and a.create_user = #{createUser}

View File

@ -744,11 +744,11 @@ public class EnvironmentAlarmServiceImpl extends ServiceImpl<EnvironmentAlarmMap
Integer dateType=MapUtils.getInteger(param,"dateType");
List<String> dayList=new ArrayList<>();
if (dateType == 2) {
//查询月所有天数
dayList=DateUtil.getNowMonthAllDayList();
//查询近一月所有天数
dayList = DateUtil.getDaysBetweenLastMonth();
} else {
//查询周所有天数
dayList=DateUtil.getNowWeekAllDayList();
//查询近一周所有天数
dayList = DateUtil.getDaysBetweenLastWeek();
}
List<Map<String,Object>> list=companyService.selectComapnyOrProjectList(map);
if(list!=null&&list.size()>0){

View File

@ -36,7 +36,8 @@ public class GtMaterialDepartmentTeam implements Serializable {
*/
@Excel(name = "作业单位id", width = 15)
@ApiModelProperty(value = "作业单位id")
private String unitName;
private Long gtMaterialOperatingUnitId;
/**
* 班组
*/
@ -84,4 +85,13 @@ public class GtMaterialDepartmentTeam implements Serializable {
@ApiModelProperty(value = "更新时间")
private java.util.Date updateTime;
/**
* 单位名称
*/
@Excel(name = "单位名称", width = 15)
@ApiModelProperty(value = "单位名称")
@TableField(exist = false)
private String unitName;
}

View File

@ -2,8 +2,9 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhgd.xmgl.modules.gt.mapper.GtMaterialDepartmentTeamMapper">
<select id="queryPageList" resultType="com.zhgd.xmgl.modules.gt.entity.GtMaterialDepartmentTeam">
select dt.*
select dt.*,ou.unit_name,ou.id as gt_material_operating_unit_id
from gt_material_department_team dt
join gt_material_operating_unit ou on ou.id=dt.gt_material_operating_unit_id
${ew.customSqlSegment}
</select>
</mapper>

View File

@ -1,6 +1,7 @@
package com.zhgd.xmgl.modules.worker.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
@ -19,10 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
/**

View File

@ -1,12 +1,18 @@
package com.zhgd.xmgl.util;
import cn.hutool.core.date.DateTime;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
* @program: wisdomSite
@ -19,6 +25,7 @@ public class DateUtil {
/**
* 时间格式化
*
* @param oldDate
* @return
*/
@ -74,6 +81,7 @@ public class DateUtil {
/**
* 查询本周所有天数
*
* @return
*/
public static List<String> getNowWeekAllDayList() {
@ -94,8 +102,58 @@ public class DateUtil {
return findDates(cal.getTime(), new Date());
}
/**
* 查询本月所有天数Fix2023-06-01到2023-06-30
*
* @return
*/
public static List<String> getNowMonthAllDayListFix() {
ArrayList<String> rtList = new ArrayList<>();
Date now = new Date();
DateTime beginDate = cn.hutool.core.date.DateUtil.beginOfMonth(now);
DateTime endDate = cn.hutool.core.date.DateUtil.endOfMonth(now);
long offset = cn.hutool.core.date.DateUtil.betweenDay(beginDate, endDate, true);
for (int i = 0; i < offset + 1; i++) {
rtList.add(cn.hutool.core.date.DateUtil.formatDate(cn.hutool.core.date.DateUtil.offsetDay(beginDate, i)));
}
return rtList;
}
/**
* 查询一个月前内所有天数2023-06-10到2023-07-10
*
* @return
*/
public static List<String> getDaysBetweenLastMonth() {
ArrayList<String> rtList = new ArrayList<>();
DateTime beginDate = cn.hutool.core.date.DateUtil.lastMonth();
DateTime endDate = DateTime.now();
long offset = cn.hutool.core.date.DateUtil.betweenDay(beginDate, endDate, true);
for (int i = 0; i < offset + 1; i++) {
rtList.add(cn.hutool.core.date.DateUtil.formatDate(cn.hutool.core.date.DateUtil.offsetDay(beginDate, i)));
}
return rtList;
}
/**
* 查询一个周前内所有天数2023-06-10到2023-07-10
*
* @return
*/
public static List<String> getDaysBetweenLastWeek() {
ArrayList<String> rtList = new ArrayList<>();
DateTime beginDate = cn.hutool.core.date.DateUtil.lastWeek();
DateTime endDate = DateTime.now();
long offset = cn.hutool.core.date.DateUtil.betweenDay(beginDate, endDate, true);
for (int i = 0; i < offset + 1; i++) {
rtList.add(cn.hutool.core.date.DateUtil.formatDate(cn.hutool.core.date.DateUtil.offsetDay(beginDate, i)));
}
return rtList;
}
/**
* 查询现在时间几天前到现在之间的所有日期
*
* @param days
* @return
*/
@ -104,8 +162,10 @@ public class DateUtil {
cal.add(Calendar.DATE, -days);
return findDates(cal.getTime(), new Date());
}
/**
* 查询本月所有天数
*
* @return
*/
public static List<String> getNowMonthAllDayList() {
@ -116,6 +176,7 @@ public class DateUtil {
/**
* 获取两个时间段所有天数
*
* @param beginTime
* @param endTime
* @return
@ -153,6 +214,7 @@ public class DateUtil {
/**
* 获取指定年份所有天数
*
* @param yearMonth
* @return
*/
@ -170,7 +232,6 @@ public class DateUtil {
}
/**
*
* @param yearMonth 月份格式yyyy-MM
* @return
*/
@ -183,6 +244,7 @@ public class DateUtil {
return getDayListOfMonth(yearMonth);
}
}
public static List<String> getDayListOfMonth(String yearMonth) {
int year = Integer.parseInt(yearMonth.split("-")[0]); //
int month = Integer.parseInt(yearMonth.split("-")[1]); //
@ -210,6 +272,7 @@ public class DateUtil {
/**
* 获取当前周第一天日期
*
* @return
*/
public static String getNowWeekStartTime() {
@ -230,6 +293,7 @@ public class DateUtil {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
return sdf.format(cal.getTime());
}
public static List<String> getDiffTimeYearList(String beginTime, String endTime) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
@ -239,6 +303,7 @@ public class DateUtil {
}
return null;
}
public static List<String> findYear(Date dBegin, Date dEnd) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
List lDate = new ArrayList();
@ -259,6 +324,7 @@ public class DateUtil {
}
return lDate;
}
public static List<String> getDiffTimeMonthList(String beginTime, String endTime) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
@ -268,6 +334,7 @@ public class DateUtil {
}
return null;
}
public static List<String> findMonth(Date dBegin, Date dEnd) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
List lDate = new ArrayList();
@ -315,6 +382,7 @@ public class DateUtil {
/**
* 获取当前时间和当天时间几天前之间的所有天数
*
* @param dayNum 当天时间以前具体几天
* @return
*/
@ -331,9 +399,7 @@ public class DateUtil {
}
/**
*
* @param type 1 今日24 小时2本周所有天3本月所有天
* @return
*/
@ -345,7 +411,7 @@ public class DateUtil {
}
return list;
} else if (type == 2) {
return getNowWeekAllDayList();
return getDaysBetweenLastWeek();
} else if (type == 3) {
return getNowMonthAllDayList();
}
@ -354,6 +420,7 @@ public class DateUtil {
/**
* 比较两个日期大小
*
* @param time1
* @param time2
* @return
@ -378,14 +445,15 @@ public class DateUtil {
}
return false;
}
/**
* 查询当前时间指定天数之前的日期
* @Title: getBeginDayTime
* @Description: TODO(这里用一句话描述这个方法的作用)
*
* @param @param days
* @param @return 参数
* @return String 返回类型
* @throws
* @Title: getBeginDayTime
*/
public static String getBeginDayTime(int days) {
Calendar cal = Calendar.getInstance();