Merge remote-tracking branch 'origin/0205cmt' into 0205cmt

0927cmt
songwenxuan 2024-05-07 15:31:37 +08:00
commit 5b09631573
9 changed files with 194 additions and 8 deletions

View File

@ -8,6 +8,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import com.zcloud.entity.Page;
import com.zcloud.entity.system.Department;
import com.zcloud.service.hiddenApi.HiddenApiService;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.util.Strings;
@ -59,6 +60,10 @@ public class HiddenExcelController extends BaseController {
@Autowired
private HiddenCheckService hiddenCheckService;
@Autowired
private DepartmentService departmentService; // 部门信息
@RequestMapping(value = "/exportExcelToSession")
// // @RequiresPermissions("toExcel")
@ResponseBody
@ -121,6 +126,30 @@ public class HiddenExcelController extends BaseController {
List<PageData> varList = new ArrayList<PageData>();
List<String> wertitles = this.setTitles();
// 增加隐患整改部门查询 开始
if(StringUtils.isNotBlank(pd.getString("RECTIFICATIONDEPT"))){
String url ="department_list.html?DEPARTMENT_ID=";
List<Department> departments = departmentService.listAllDepartment(pd.getString("RECTIFICATIONDEPT"), url);
List<String> departmentIds = new ArrayList<>();
departmentIds.add(pd.getString("RECTIFICATIONDEPT"));
for(Department department:departments){
departmentIds.add(department.getDEPARTMENT_ID());
}
pd.put("departmentIds",departmentIds);
}
// 增加发现整改部门查询 开始
if(StringUtils.isNotBlank(pd.getString("creatorUserDept"))){
String url ="department_list.html?DEPARTMENT_ID=";
List<Department> departments = departmentService.listAllDepartment(pd.getString("creatorUserDept"), url);
List<String> departmentIds = new ArrayList<>();
departmentIds.add(pd.getString("creatorUserDept"));
for(Department department:departments){
departmentIds.add(department.getDEPARTMENT_ID());
}
pd.put("creatorUserDepts",departmentIds);
}
// 增加隐患发现部门查询 结束
List<PageData> hiddenListAll = getHiddenList(pd);// 获取 隐患数据
/**

View File

@ -1046,13 +1046,36 @@ public class HiddenApiController extends BaseController {
titles.add("复查人"); //14
titles.add("检查人员"); //15
dataMap.put("titles", titles);
// 增加隐患整改部门查询 开始
if(StringUtils.isNotBlank(pd.getString("RECTIFICATIONDEPT"))){
String url ="department_list.html?DEPARTMENT_ID=";
List<Department> departments = departmentService.listAllDepartment(pd.getString("RECTIFICATIONDEPT"), url);
List<String> departmentIds = new ArrayList<>();
departmentIds.add(pd.getString("RECTIFICATIONDEPT"));
for(Department department:departments){
departmentIds.add(department.getDEPARTMENT_ID());
}
pd.put("departmentIds",departmentIds);
}
// 增加发现整改部门查询 开始
if(StringUtils.isNotBlank(pd.getString("creatorUserDept"))){
String url ="department_list.html?DEPARTMENT_ID=";
List<Department> departments = departmentService.listAllDepartment(pd.getString("creatorUserDept"), url);
List<String> departmentIds = new ArrayList<>();
departmentIds.add(pd.getString("creatorUserDept"));
for(Department department:departments){
departmentIds.add(department.getDEPARTMENT_ID());
}
pd.put("creatorUserDepts",departmentIds);
}
List<PageData> varOList = hiddenApiService.listForExcel(pd);
List<PageData> varList = new ArrayList<PageData>();
for(int i=0;i<varOList.size();i++){
PageData vpd = new PageData();
vpd.put("var1", i + 1); //1
vpd.put("var2", Tools.isEmpty(varOList.get(i).getString("type1Name")) ? "" : varOList.get(i).getString("type1Name")); //2
vpd.put("var3", Tools.isEmpty(varOList.get(i).getString("LEVEL")) ? "" : varOList.get(i).getString("LEVEL")); //3
vpd.put("var3", Tools.isEmpty(varOList.get(i).getString("levelName")) ? "" : varOList.get(i).getString("levelName")); //3
vpd.put("var4", Tools.isEmpty(varOList.get(i).getString("POSITIONDESC")) ? "" : varOList.get(i).getString("POSITIONDESC")); //4
vpd.put("var5", Tools.isEmpty(varOList.get(i).getString("HIDDENDESCR")) ? "" : varOList.get(i).getString("HIDDENDESCR")); //5
vpd.put("var6", Tools.isEmpty(varOList.get(i).getString("RECTIFYDESCR")) ? "" : varOList.get(i).getString("RECTIFYDESCR")); //6
@ -1062,7 +1085,7 @@ public class HiddenApiController extends BaseController {
vpd.put("var10", Tools.isEmpty(varOList.get(i).getString("zgUserName")) ? "" : varOList.get(i).getString("zgUserName")); //10
vpd.put("var11", Tools.isEmpty(varOList.get(i).getString("conUsername")) ? "" : varOList.get(i).getString("conUsername")); //11
vpd.put("var12", Tools.isEmpty(varOList.get(i).getString("INVESTMENT_FUNDS")) ? "" : varOList.get(i).getString("INVESTMENT_FUNDS")); //12
vpd.put("var13", Tools.isEmpty(varOList.get(i).getString("REVIEWTIME")) ? "" : varOList.get(i).getString("REVIEWTIME")); //13
vpd.put("var13", Tools.isEmpty(varOList.get(i).getString("CHECK_TIME")) ? "" : varOList.get(i).getString("CHECK_TIME")+" 已完成"); //13
vpd.put("var14", Tools.isEmpty(varOList.get(i).getString("revieworName")) ? "" : varOList.get(i).getString("revieworName")); //14
vpd.put("var15", Tools.isEmpty(varOList.get(i).getString("INSPECTION_USER")) ? varOList.get(i).getString("CREATER_NAME") : varOList.get(i).getString("INSPECTION_USER")); //15
varList.add(vpd);
@ -1748,10 +1771,23 @@ public class HiddenApiController extends BaseController {
PageData pd = new PageData();
pd = this.getPageData();
if (pd.get("YEAR").equals("")){
pd.put("YEAR","2024");
String year = DateUtil.getYear();
pd.put("YEAR",year);
}
List<PageData> dataList = hiddenApiService.goSummaryTable(pd);
List<PageData> dataTypeList = hiddenApiService.goSummaryTypeTable(pd);
List<PageData> varList = hiddenApiService.dealData(dataList);
List<PageData> varTypeList = hiddenApiService.dealData(dataTypeList);
for(PageData pdDate:varList){
for(PageData pdTypeDate:varTypeList){
if(pdDate.getString("MONTH").equals(pdTypeDate.getString("MONTH"))){
pdDate.put("wdbaqztCount",pdTypeDate.getString("wdbaqztCount"));
pdDate.put("gldqxCount",pdTypeDate.getString("gldqxCount"));
pdDate.put("hjdbaqysCount",pdTypeDate.getString("hjdbaqysCount"));
pdDate.put("rdbaqysCount",pdTypeDate.getString("rdbaqysCount"));
}
}
}
map.put("varList", varList);
map.put("result", errInfo);
return map;

View File

@ -87,5 +87,8 @@ public interface HiddenApiMapper {
List<PageData> goSummaryTable(PageData pd);
List<PageData> listForExcel(PageData pd);
List<PageData> goSummaryTypeTable(PageData pd);
}

View File

@ -111,5 +111,7 @@ public interface HiddenApiService {
public List<PageData> dealData (List<PageData> pd) throws Exception;
public List<PageData> listForExcel (PageData pd) throws Exception;
public List<PageData> goSummaryTypeTable (PageData pd) throws Exception;
}

View File

@ -281,6 +281,17 @@ public class HiddenApiServiceImpl implements HiddenApiService{
return hiddenApiMapper.listForExcel(pd);
}
/**
*
* @param pd
* @return
* @throws Exception
*/
@Override
public List<PageData> goSummaryTypeTable(PageData pd) throws Exception {
return hiddenApiMapper.goSummaryTypeTable(pd);
}
public List<PageData> dealData (List<PageData> pdList) throws Exception{
ArrayList<PageData> varList = new ArrayList<>();
PageData pd1 = new PageData();
@ -372,6 +383,11 @@ public class HiddenApiServiceImpl implements HiddenApiService{
pd.put("TOTAL_COUNT_OTHER",pageData.getString("TOTAL_COUNT"));
pd.put("REVISED_COUNT_OTHER",pageData.getString("REVISED_COUNT"));
pd.put("COMPLERATE_OTHER",pageData.getString("COMPLERATE"));
}else {
pd.put("wdbaqztCount",pageData.getString("wdbaqztCount"));
pd.put("gldqxCount",pageData.getString("gldqxCount"));
pd.put("hjdbaqysCount",pageData.getString("hjdbaqysCount"));
pd.put("rdbaqysCount",pageData.getString("rdbaqysCount"));
}
pd.put("CREATE_MONTH",pageData.getString("CREATE_MONTH"));
return pd;

View File

@ -115,7 +115,8 @@
IFNULL( t.DEVICE_COUNT, 0 ) DEVICE_COUNT,
d.`NAME` AS DEPARTMENT_NAME,
u.`NAME` AS USERNAME,
r.FIRE_REGION_NAME
r.FIRE_REGION_NAME,
fp.FIRE_POINT_ID as POINT
FROM
bus_fire_point AS p
LEFT JOIN bus_fire_qualified_photos fqp ON p.QUALIFIED_PHOTOS_ID = fqp.QUALIFIED_PHOTOS_ID
@ -123,6 +124,13 @@
LEFT JOIN ( SELECT count( FIRE_DEVICE_ID ) DEVICE_COUNT, FIRE_POINT_ID FROM bus_fire_device WHERE ISDELETE = 0 GROUP BY FIRE_POINT_ID ) t ON t.FIRE_POINT_ID = p.FIRE_POINT_ID
LEFT JOIN sys_user AS u ON p.USER_ID = u.USER_ID
LEFT JOIN oa_department AS d ON p.DEPARTMENT_ID = d.DEPARTMENT_ID
LEFT JOIN (SELECT DISTINCT
f.FIRE_POINT_ID
FROM
`bus_fire_device` f
LEFT JOIN bus_fire_device_prepared p ON f.FIRE_DEVICE_ID = p.FIRE_DEVICE_ID
WHERE
f.ISDELETE = '0') fp on fp.FIRE_POINT_ID = p.FIRE_POINT_ID
WHERE
r.CORPINFO_ID = #{pd.CORPINFO_ID}
AND r.ISDELETE = 0

View File

@ -897,7 +897,7 @@
GROUP BY
FIRE_CHECK_ID
order by fr. CREATTIME
order by temp.FINISHED,fr. CREATTIME
</select>
<select id="getCheckingByCid" resultType="com.zcloud.entity.PageData">
select * from bus_fire_record where FIRE_CHECK_ID = #{FIRE_CHECK_ID} and ISDELETE = 0 and PHONE_REPEAT = 1

View File

@ -583,7 +583,11 @@
<if test="creatorUserDept != null and creatorUserDept != ''"><!-- 隐患发现人 部门-->
and f.HIDDEN_ID in (select hfu.HIDDEN_ID from BUS_HIDDEN_USER
hfu LEFT JOIN sys_user user on user.USER_ID = hfu.USER_ID
where user.DEPARTMENT_ID = #{creatorUserDept} )
where user.DEPARTMENT_ID in
<foreach item="item" index="index" collection="creatorUserDepts" open="(" separator="," close=")">
#{item}
</foreach>
)
</if>
<if test="creatorName != null and creatorName != ''"><!-- 隐患发现人 -->
and f.HIDDEN_ID in (select hfu.HIDDEN_ID from BUS_HIDDEN_USER hfu LEFT JOIN sys_user user on user.USER_ID = hfu.USER_ID
@ -666,6 +670,13 @@
and f.STATE = '2'
and (select count(1) from BUS_HIDDENCHECK bh where bh.HIDDEN_ID=f.HIDDEN_ID and bh.USER_ID=#{checkUser} )>0
</if>
<if test='RECTIFICATIONDEPT != null and RECTIFICATIONDEPT != ""'><!-- 验收隐患 -->
AND
f.RECTIFICATIONDEPT IN
<foreach item="item" index="index" collection="departmentIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
GROUP BY f.HIDDEN_ID
order by FIELD ( f.STATE, '-2' ) desc,<!-- 因为这是隐患确认列表有确认按钮的排在前面 -->
f.DISCOVERYTIME desc <!-- 剩下的按隐患发现时间排序 -->
@ -863,6 +874,8 @@
GROUP_CONCAT( su.NAME ) AS INSPECTION_USER,
c.NAME AS CREATER_NAME,
revieworUser.NAME AS revieworName,
bhc.CHECK_TIME,
type2.NAME AS levelName,
f.*
FROM
bus_hidden f
@ -872,7 +885,8 @@
left join oa_department bhuUserDeptD on bhuUserDeptD.DEPARTMENT_ID = bhuUserDept.PARENT_ID
left join vi_user_all zgUser on zgUser.user_id = f.RECTIFICATIONOR
LEFT JOIN vi_user_all confirmUser on confirmUser.USER_ID = f.CONFIRM_USER <!-- 隐患确认人 -->
LEFT JOIN vi_user_all revieworUser on revieworUser.USER_ID = f.REVIEWOR <!-- 隐患确认人 -->
LEFT JOIN bus_hiddencheck bhc ON bhc.HIDDEN_ID = f.HIDDEN_ID
LEFT JOIN vi_user_all revieworUser ON revieworUser.USER_ID = bhc.USER_ID
LEFT JOIN bus_hiddencheck hch on hch.HIDDEN_ID = f.HIDDEN_ID
left join sys_dictionaries type1 on type1.bianma = f.HIDDENTYPE
left join oa_department zgUserDept on zgUserDept.DEPARTMENT_ID = f.RECTIFICATIONDEPT
@ -882,6 +896,7 @@
left join bus_inspection_safetyenvironmental_inspector bi ON bi.INSPECTION_ID = isa.INSPECTION_ID
LEFT JOIN vi_user_all su on su.USER_ID = bi.INSPECTION_USER_ID
LEFT JOIN vi_user_all c ON c.USER_ID = f.CREATOR
LEFT JOIN sys_dictionaries type2 ON type2.bianma = f.HIDDENLEVEL
WHERE f.ISDELETE = '0'
and f.STATE not in ('0','7','8','100','101','102')
<if test="roleLevel != null and roleLevel != ''"><!-- 权限显示 -->
@ -918,7 +933,11 @@
<if test="creatorUserDept != null and creatorUserDept != ''"><!-- 隐患发现人 部门-->
and f.HIDDEN_ID in (select hfu.HIDDEN_ID from BUS_HIDDEN_USER
hfu LEFT JOIN sys_user user on user.USER_ID = hfu.USER_ID
where user.DEPARTMENT_ID = #{creatorUserDept} )
where user.DEPARTMENT_ID in
<foreach item="item" index="index" collection="creatorUserDepts" open="(" separator="," close=")">
#{item}
</foreach>
)
</if>
<if test="creatorName != null and creatorName != ''"><!-- 隐患发现人 -->
and f.HIDDEN_ID in (select hfu.HIDDEN_ID from BUS_HIDDEN_USER hfu LEFT JOIN sys_user user on user.USER_ID = hfu.USER_ID
@ -988,10 +1007,80 @@
and f.STATE = '2'
and (select count(1) from BUS_HIDDENCHECK bh where bh.HIDDEN_ID=f.HIDDEN_ID and bh.USER_ID=#{checkUser} )>0
</if>
<if test='RECTIFICATIONDEPT != null and RECTIFICATIONDEPT != ""'><!-- 验收隐患 -->
AND
f.RECTIFICATIONDEPT IN
<foreach item="item" index="index" collection="departmentIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
GROUP BY f.HIDDEN_ID
order by FIELD ( f.STATE, '-2' ) desc,<!-- 因为这是隐患确认列表有确认按钮的排在前面 -->
f.DISCOVERYTIME desc <!-- 剩下的按隐患发现时间排序 -->
</select>
<!-- 根据类型按照月份统计隐患数量 -->
<select id="goSummaryTypeTable" parameterType="pd" resultType="pd">
SELECT
wd.CREATE_MONTH,
wd.wdbaqztCount,
gl.gldqxCount,
hj.hjdbaqysCount,
rd.rdbaqysCount
FROM
(
SELECT
date_format( `f`.`CREATTIME`, '%Y-%m' ) AS `CREATE_MONTH`,
COUNT( f.HIDDEN_ID ) wdbaqztCount
FROM
`bus_hidden` f
WHERE
f.ISDELETE = '0'
AND date_format( f.`CREATTIME`, '%Y' ) = #{YEAR}
AND f.HIDDENTYPE IN ( SELECT BIANMA FROM `qa-cmt-prevention`.`sys_dictionaries` WHERE `PARENT_ID` = '8731b7fca94248c1b07d3ba8327b8e97' )
GROUP BY
CREATE_MONTH
) wd
LEFT JOIN (
SELECT
date_format( `f`.`CREATTIME`, '%Y-%m' ) AS `CREATE_MONTH`,
COUNT( f.HIDDEN_ID ) gldqxCount
FROM
`bus_hidden` f
WHERE
f.ISDELETE = '0'
AND date_format( f.`CREATTIME`, '%Y' ) = #{YEAR}
AND f.HIDDENTYPE IN ( SELECT BIANMA FROM `qa-cmt-prevention`.`sys_dictionaries` WHERE `PARENT_ID` = '99d384302d0c488a95e0edf456b6fa15' )
GROUP BY
CREATE_MONTH
) gl ON wd.CREATE_MONTH = gl.CREATE_MONTH
LEFT JOIN (
SELECT
date_format( `f`.`CREATTIME`, '%Y-%m' ) AS `CREATE_MONTH`,
COUNT( f.HIDDEN_ID ) hjdbaqysCount
FROM
`bus_hidden` f
WHERE
f.ISDELETE = '0'
AND date_format( f.`CREATTIME`, '%Y' ) = #{YEAR}
AND f.HIDDENTYPE IN ( SELECT BIANMA FROM `qa-cmt-prevention`.`sys_dictionaries` WHERE `PARENT_ID` = 'b8aa6a4916664ed08bd322ab5bb6b5f2' )
GROUP BY
CREATE_MONTH
) hj ON wd.CREATE_MONTH = hj.CREATE_MONTH
LEFT JOIN (
SELECT
date_format( `f`.`CREATTIME`, '%Y-%m' ) AS `CREATE_MONTH`,
COUNT( f.HIDDEN_ID ) rdbaqysCount
FROM
`bus_hidden` f
WHERE
f.ISDELETE = '0'
AND date_format( f.`CREATTIME`, '%Y' ) = #{YEAR}
AND f.HIDDENTYPE IN ( SELECT BIANMA FROM `qa-cmt-prevention`.`sys_dictionaries` WHERE `PARENT_ID` = 'f531c7a102c44734b007f18d029ebaec' )
GROUP BY
CREATE_MONTH
) rd ON wd.CREATE_MONTH = rd.CREATE_MONTH
</select>
</mapper>

View File

@ -202,6 +202,9 @@
<if test="pd.PTYPE != null and pd.PTYPE !=''">
and f.PTYPE = #{pd.PTYPE}
</if>
<if test="pd.UNITS_ID != null and pd.UNITS_ID !=''">
and f.UNITS_ID = #{pd.UNITS_ID}
</if>
ORDER BY f.OPERATTIME DESC
</select>