汇总台账和导出
parent
b6688abcf3
commit
46a8b6fef4
|
@ -19,6 +19,7 @@ import com.zcloud.util.*;
|
|||
import com.zcloud.util.event.DeviceHiddenEvent;
|
||||
import com.zcloud.util.message.MessageService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.fop.fo.FObj;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
|
@ -946,6 +947,121 @@ public class HiddenApiController extends BaseController {
|
|||
return map;
|
||||
}
|
||||
|
||||
/**导出某一个选中项到excel
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value="/excelSummary")
|
||||
// @RequiresPermissions("toExcel")
|
||||
public ModelAndView excelSummary() throws Exception{
|
||||
ModelAndView mv = new ModelAndView();
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
List<String> titles = new ArrayList<String>();
|
||||
titles.add("月份"); //1
|
||||
titles.add("数量(公司)"); //2
|
||||
titles.add("已完成(公司)"); //3
|
||||
titles.add("完成率(公司)"); //4
|
||||
titles.add("数量(装船部)"); //5
|
||||
titles.add("已完成(装船部)"); //6
|
||||
titles.add("完成率(装船部)"); //7
|
||||
titles.add("数量(卸车部)"); //8
|
||||
titles.add("已完成(卸车部)"); //9
|
||||
titles.add("完成率(卸车部)"); //10
|
||||
titles.add("数量(生产保障部)"); //11
|
||||
titles.add("已完成(生产保障部)"); //12
|
||||
titles.add("完成率(生产保障部)"); //13
|
||||
titles.add("数量(其他部)"); //14
|
||||
titles.add("已完成(其他部)"); //15
|
||||
titles.add("完成率(其他部)"); //16
|
||||
dataMap.put("titles", titles);
|
||||
List<PageData> dataList = hiddenApiService.goSummaryTable(pd);
|
||||
List<PageData> varOList = hiddenApiService.dealData(dataList);
|
||||
ArrayList<PageData> varList = new ArrayList<>();
|
||||
for(int i=0;i<varOList.size();i++){
|
||||
PageData vpd = new PageData();
|
||||
vpd.put("var1", varOList.get(i).getString("MONTH")); //1
|
||||
vpd.put("var2", Tools.isEmpty(varOList.get(i).getString("TOTAL_COUNT_ALL")) ? "0" : varOList.get(i).getString("TOTAL_COUNT_ALL")); //2
|
||||
vpd.put("var3", Tools.isEmpty(varOList.get(i).getString("REVISED_COUNT_ALL")) ? "0" : varOList.get(i).getString("REVISED_COUNT_ALL")); //3
|
||||
vpd.put("var4", Tools.isEmpty(varOList.get(i).getString("COMPLERATE_ALL")) ? "0.00%" : varOList.get(i).getString("COMPLERATE_ALL")); //4
|
||||
vpd.put("var5", Tools.isEmpty(varOList.get(i).getString("TOTAL_COUNT_ONE")) ? "0" : varOList.get(i).getString("TOTAL_COUNT_ONE")); //5
|
||||
vpd.put("var6", Tools.isEmpty(varOList.get(i).getString("REVISED_COUNT_ONE")) ? "0" : varOList.get(i).getString("REVISED_COUNT_ONE")); //6
|
||||
vpd.put("var7", Tools.isEmpty(varOList.get(i).getString("COMPLERATE_ONE")) ? "0.00%" : varOList.get(i).getString("COMPLERATE_ONE")); //7
|
||||
vpd.put("var8", Tools.isEmpty(varOList.get(i).getString("TOTAL_COUNT_TWO")) ? "0" : varOList.get(i).getString("TOTAL_COUNT_TWO")); //8
|
||||
vpd.put("var9", Tools.isEmpty(varOList.get(i).getString("REVISED_COUNT_TWO")) ? "0" : varOList.get(i).getString("REVISED_COUNT_TWO")); //9
|
||||
vpd.put("var10", Tools.isEmpty(varOList.get(i).getString("COMPLERATE_TWO")) ? "0.00%" : varOList.get(i).getString("COMPLERATE_TWO")); //10
|
||||
vpd.put("var11", Tools.isEmpty(varOList.get(i).getString("TOTAL_COUNT_THREE")) ? "0" : varOList.get(i).getString("TOTAL_COUNT_THREE")); //11
|
||||
vpd.put("var12", Tools.isEmpty(varOList.get(i).getString("REVISED_COUNT_THREE")) ? "0" : varOList.get(i).getString("REVISED_COUNT_THREE")); //12
|
||||
vpd.put("var13", Tools.isEmpty(varOList.get(i).getString("COMPLERATE_THREE")) ? "0.00%" : varOList.get(i).getString("COMPLERATE_THREE")); //13
|
||||
vpd.put("var14", Tools.isEmpty(varOList.get(i).getString("TOTAL_COUNT_OTHER")) ? "0" : varOList.get(i).getString("TOTAL_COUNT_OTHER")); //14
|
||||
vpd.put("var15", Tools.isEmpty(varOList.get(i).getString("REVISED_COUNT_OTHER")) ? "0" : varOList.get(i).getString("REVISED_COUNT_OTHER")); //15
|
||||
vpd.put("var16", Tools.isEmpty(varOList.get(i).getString("COMPLERATE_OTHER")) ? "0.00%" : varOList.get(i).getString("COMPLERATE_OTHER")); //16
|
||||
varList.add(vpd);
|
||||
}
|
||||
dataMap.put("varList", varList);
|
||||
dataMap.put("filename","安全隐患汇总表");
|
||||
ObjectExcelView erv = new ObjectExcelView();
|
||||
mv = new ModelAndView(erv,dataMap);
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**导出某一个选中项到excel
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value="/excelDetailedList")
|
||||
// @RequiresPermissions("toExcel")
|
||||
public ModelAndView excelDetailedList() throws Exception{
|
||||
ModelAndView mv = new ModelAndView();
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
|
||||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||||
List<String> titles = new ArrayList<String>();
|
||||
titles.add("序号"); //1
|
||||
titles.add("隐患类型"); //2
|
||||
titles.add("等级"); //3
|
||||
titles.add("隐患位置"); //4
|
||||
titles.add("隐患简要情况"); //5
|
||||
titles.add("整改治理措施"); //6
|
||||
titles.add("发现隐患日期"); //7
|
||||
titles.add("整改完成时限"); //8
|
||||
titles.add("整改责任部门"); //9
|
||||
titles.add("整改责任人"); //10
|
||||
titles.add("整改督办人"); //11
|
||||
titles.add("投入资金(元)"); //12
|
||||
titles.add("复查时间及结果"); //13
|
||||
titles.add("复查人"); //14
|
||||
titles.add("检查人员"); //15
|
||||
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", varOList.get(i).getString("HIDDENTYPE")); //2
|
||||
vpd.put("var3", varOList.get(i).getString("LEVEL")); //3
|
||||
vpd.put("var4", varOList.get(i).getString("POSITIONDESC")); //4
|
||||
vpd.put("var5", varOList.get(i).getString("HIDDENDESCR")); //5
|
||||
vpd.put("var6", varOList.get(i).getString("")); //6
|
||||
vpd.put("var7", varOList.get(i).getString("")); //7
|
||||
vpd.put("var8", varOList.get(i).getString("")); //8
|
||||
vpd.put("var9", varOList.get(i).getString("")); //9
|
||||
vpd.put("var10", varOList.get(i).getString("")); //10
|
||||
vpd.put("var11", varOList.get(i).getString("")); //11
|
||||
vpd.put("var12", varOList.get(i).getString("")); //12
|
||||
vpd.put("var13", varOList.get(i).getString("")); //13
|
||||
vpd.put("var14", varOList.get(i).getString("")); //14
|
||||
vpd.put("var15", varOList.get(i).getString("")); //15
|
||||
varList.add(vpd);
|
||||
}
|
||||
dataMap.put("varList", varList);
|
||||
dataMap.put("filename","隐患治理清单");
|
||||
ObjectExcelView erv = new ObjectExcelView();
|
||||
mv = new ModelAndView(erv,dataMap);
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出到excel
|
||||
*
|
||||
|
@ -1479,4 +1595,29 @@ public class HiddenApiController extends BaseController {
|
|||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* 过去隐患列表
|
||||
*
|
||||
* @param page
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/goSummaryTable")
|
||||
@RequiresPermissions("hidden:list")
|
||||
@ResponseBody
|
||||
public Object goSummaryTable(Page page) throws Exception {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
String errInfo = "success";
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
if (pd.get("YEAR").equals("")){
|
||||
pd.put("YEAR","2024");
|
||||
}
|
||||
List<PageData> dataList = hiddenApiService.goSummaryTable(pd);
|
||||
List<PageData> varList = hiddenApiService.dealData(dataList);
|
||||
map.put("varList", varList);
|
||||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,5 +83,9 @@ public interface HiddenApiMapper {
|
|||
|
||||
List<PageData> getListdatalistPage(Page page);
|
||||
List<PageData> getListAll(PageData pd);
|
||||
|
||||
List<PageData> goSummaryTable(PageData pd);
|
||||
|
||||
List<PageData> listForExcel(PageData pd);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -18,7 +19,7 @@ import java.util.Set;
|
|||
public class PositioningServiceImpl implements PositioningService {
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate redisTemplate;
|
||||
private StringRedisTemplate redisTemplate;
|
||||
|
||||
@Autowired
|
||||
private UsersService usersService;
|
||||
|
|
|
@ -106,5 +106,10 @@ public interface HiddenApiService {
|
|||
*/
|
||||
public List<PageData> getListAll (PageData pd) throws Exception;
|
||||
|
||||
public List<PageData> goSummaryTable (PageData pd) throws Exception;
|
||||
|
||||
public List<PageData> dealData (List<PageData> pd) throws Exception;
|
||||
|
||||
public List<PageData> listForExcel (PageData pd) throws Exception;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -271,5 +272,109 @@ public class HiddenApiServiceImpl implements HiddenApiService{
|
|||
public List<PageData> getListAll (PageData pd) throws Exception{
|
||||
return hiddenApiMapper.getListAll(pd);
|
||||
}
|
||||
|
||||
public List<PageData> goSummaryTable (PageData pd) throws Exception{
|
||||
return hiddenApiMapper.goSummaryTable(pd);
|
||||
}
|
||||
|
||||
public List<PageData> listForExcel (PageData pd) throws Exception{
|
||||
return hiddenApiMapper.listForExcel(pd);
|
||||
}
|
||||
|
||||
public List<PageData> dealData (List<PageData> pdList) throws Exception{
|
||||
ArrayList<PageData> varList = new ArrayList<>();
|
||||
PageData pd1 = new PageData();
|
||||
pd1.put("MONTH","1月");
|
||||
PageData pd2 = new PageData();
|
||||
pd2.put("MONTH","2月");
|
||||
PageData pd3 = new PageData();
|
||||
pd3.put("MONTH","3月");
|
||||
PageData pd4 = new PageData();
|
||||
pd4.put("MONTH","4月");
|
||||
PageData pd5 = new PageData();
|
||||
pd5.put("MONTH","5月");
|
||||
PageData pd6 = new PageData();
|
||||
pd6.put("MONTH","6月");
|
||||
PageData pd7 = new PageData();
|
||||
pd7.put("MONTH","7月");
|
||||
PageData pd8 = new PageData();
|
||||
pd8.put("MONTH","8月");
|
||||
PageData pd9 = new PageData();
|
||||
pd9.put("MONTH","9月");
|
||||
PageData pd10 = new PageData();
|
||||
pd10.put("MONTH","10月");
|
||||
PageData pd11 = new PageData();
|
||||
pd11.put("MONTH","11月");
|
||||
PageData pd12 = new PageData();
|
||||
pd12.put("MONTH","12月");
|
||||
for (int i = 0;i<pdList.size();i++) {
|
||||
PageData pageData = setData(pdList.get(i));
|
||||
if (pageData.getString("CREATE_MONTH").substring(5).equals("01")) {
|
||||
pd1.putAll(pageData);
|
||||
} else if (pageData.getString("CREATE_MONTH").substring(5).equals("02")) {
|
||||
pd2.putAll(pageData);
|
||||
} else if (pageData.getString("CREATE_MONTH").substring(5).equals("03")) {
|
||||
pd3.putAll(pageData);
|
||||
} else if (pageData.getString("CREATE_MONTH").substring(5).equals("04")) {
|
||||
pd4.putAll(pageData);
|
||||
} else if (pageData.getString("CREATE_MONTH").substring(5).equals("05")) {
|
||||
pd5.putAll(pageData);
|
||||
} else if (pageData.getString("CREATE_MONTH").substring(5).equals("06")) {
|
||||
pd6.putAll(pageData);
|
||||
} else if (pageData.getString("CREATE_MONTH").substring(5).equals("07")) {
|
||||
pd7.putAll(pageData);
|
||||
} else if (pageData.getString("CREATE_MONTH").substring(5).equals("08")) {
|
||||
pd8.putAll(pageData);
|
||||
} else if (pageData.getString("CREATE_MONTH").substring(5).equals("09")) {
|
||||
pd9.putAll(pageData);
|
||||
} else if (pageData.getString("CREATE_MONTH").substring(5).equals("10")) {
|
||||
pd10.putAll(pageData);
|
||||
} else if (pageData.getString("CREATE_MONTH").substring(5).equals("11")) {
|
||||
pd11.putAll(pageData);
|
||||
} else if (pageData.getString("CREATE_MONTH").substring(5).equals("12")) {
|
||||
pd12.putAll(pageData);
|
||||
}
|
||||
}
|
||||
varList.add(pd1);
|
||||
varList.add(pd2);
|
||||
varList.add(pd3);
|
||||
varList.add(pd4);
|
||||
varList.add(pd5);
|
||||
varList.add(pd6);
|
||||
varList.add(pd7);
|
||||
varList.add(pd8);
|
||||
varList.add(pd9);
|
||||
varList.add(pd10);
|
||||
varList.add(pd11);
|
||||
varList.add(pd12);
|
||||
return varList;
|
||||
}
|
||||
|
||||
public PageData setData(PageData pageData) {
|
||||
PageData pd = new PageData();
|
||||
if (pageData.getString("DEPT_NAME").equals("公司")) {
|
||||
pd.put("TOTAL_COUNT_ALL",pageData.getString("TOTAL_COUNT"));
|
||||
pd.put("REVISED_COUNT_ALL",pageData.getString("REVISED_COUNT"));
|
||||
pd.put("COMPLERATE_ALL",pageData.getString("COMPLERATE"));
|
||||
} else if (pageData.getString("DEPT_NAME").equals("装船部")) {
|
||||
pd.put("TOTAL_COUNT_ONE",pageData.getString("TOTAL_COUNT"));
|
||||
pd.put("REVISED_COUNT_ONE",pageData.getString("REVISED_COUNT"));
|
||||
pd.put("COMPLERATE_ONE",pageData.getString("COMPLERATE"));
|
||||
} else if (pageData.getString("DEPT_NAME").equals("卸车部")) {
|
||||
pd.put("TOTAL_COUNT_TWO",pageData.getString("TOTAL_COUNT"));
|
||||
pd.put("REVISED_COUNT_TWO",pageData.getString("REVISED_COUNT"));
|
||||
pd.put("COMPLERATE_TWO",pageData.getString("COMPLERATE"));
|
||||
} else if (pageData.getString("DEPT_NAME").equals("生产保障部")) {
|
||||
pd.put("TOTAL_COUNT_THREE",pageData.getString("TOTAL_COUNT"));
|
||||
pd.put("REVISED_COUNT_THREE",pageData.getString("REVISED_COUNT"));
|
||||
pd.put("COMPLERATE_THREE",pageData.getString("COMPLERATE"));
|
||||
} else if (pageData.getString("DEPT_NAME").equals("其他部")) {
|
||||
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"));
|
||||
}
|
||||
pd.put("CREATE_MONTH",pageData.getString("CREATE_MONTH"));
|
||||
return pd;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -643,6 +643,342 @@
|
|||
</if>
|
||||
|
||||
|
||||
<if test="hiddenpart != null and hiddenpart != ''"><!-- 隐患部位 -->
|
||||
and hreg.HIDDENREGION_ID LIKE CONCAT(CONCAT('%', #{hiddenpart}),'%')
|
||||
</if>
|
||||
<if test='CONFIRM_USER != null and CONFIRM_USER != ""'><!-- 隐患确认人 -->
|
||||
and f.CONFIRM_USER = #{CONFIRM_USER}
|
||||
</if>
|
||||
<if test='hiddenVueType != null and hiddenVueType == "rectify"'><!--整改隐患信息 -->
|
||||
and f.STATE in('1','-1','10')
|
||||
</if>
|
||||
<if test='SELFUSERID != null and SELFUSERID != ""'><!-- 整改隐患信息 -->
|
||||
and f.RECTIFICATIONOR = #{SELFUSERID}
|
||||
</if>
|
||||
<if test='hiddenVueType != null and hiddenVueType == "check"'><!--验收隐患 -->
|
||||
and f.STATE ='2'
|
||||
</if>
|
||||
<if test='checkUser != null and checkUser != ""'><!-- 验收隐患 -->
|
||||
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>
|
||||
GROUP BY f.HIDDEN_ID
|
||||
order by FIELD ( f.STATE, '-2' ) desc,<!-- 因为这是隐患确认列表有确认按钮的排在前面 -->
|
||||
f.DISCOVERYTIME desc <!-- 剩下的按隐患发现时间排序 -->
|
||||
</select>
|
||||
|
||||
<!-- 列表 发现人没有在这里 -->
|
||||
<select id="goSummaryTable" parameterType="pd" resultType="pd">
|
||||
SELECT
|
||||
date_format( `f`.`CREATTIME`, '%Y-%m' ) AS `CREATE_MONTH`,
|
||||
count( `f`.`HIDDEN_ID` ) AS `TOTAL_COUNT`,
|
||||
count( ( CASE WHEN ( `f`.`STATE` = '4' ) THEN 1 END ) ) AS `REVISED_COUNT`,
|
||||
concat(
|
||||
cast(
|
||||
(
|
||||
( count( ( CASE WHEN ( `f`.`STATE` = '4' ) THEN 1 END ) ) / count( `f`.`HIDDEN_ID` ) ) * 100.0
|
||||
) AS DECIMAL ( 10, 2 )
|
||||
),
|
||||
'%'
|
||||
) AS `COMPLERATE`,
|
||||
'公司' AS `DEPT_NAME`
|
||||
FROM
|
||||
`qa-cmt-prevention`.`bus_hidden` `f`
|
||||
WHERE
|
||||
( `f`.`ISDELETE` = '0' AND date_format( `f`.`CREATTIME`, '%Y' ) = #{YEAR} AND f.RECTIFICATIONDEPT != '' )
|
||||
GROUP BY
|
||||
`CREATE_MONTH` UNION ALL
|
||||
SELECT
|
||||
date_format( `f`.`CREATTIME`, '%Y-%m' ) AS `CREATE_MONTH`,
|
||||
count( `f`.`HIDDEN_ID` ) AS `TOTAL_COUNT`,
|
||||
count( ( CASE WHEN ( `f`.`STATE` = '4' ) THEN 1 END ) ) AS `REVISED_COUNT`,
|
||||
concat(
|
||||
cast(
|
||||
(
|
||||
( count( ( CASE WHEN ( `f`.`STATE` = '4' ) THEN 1 END ) ) / count( `f`.`HIDDEN_ID` ) ) * 100.0
|
||||
) AS DECIMAL ( 10, 2 )
|
||||
),
|
||||
'%'
|
||||
) AS `COMPLERATE`,
|
||||
'装船部' AS `DEPT_NAME`
|
||||
FROM
|
||||
(
|
||||
(
|
||||
(
|
||||
SELECT
|
||||
`d`.`DEPARTMENT_ID` AS `DEPARTMENT_ID`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
`qa-cmt-prevention`.`oa_department`.`DEPARTMENT_ID` AS `DEPARTMENT_ID`
|
||||
FROM
|
||||
`qa-cmt-prevention`.`oa_department`
|
||||
WHERE
|
||||
( `qa-cmt-prevention`.`oa_department`.`DEPARTMENT_ID` = '89f3d30c4031432da53b75bed442ced8' ) UNION ALL
|
||||
SELECT
|
||||
`cd`.`DEPARTMENT_ID` AS `DEPARTMENT_ID`
|
||||
FROM
|
||||
( `qa-cmt-prevention`.`oa_department` `cd` JOIN `qa-cmt-prevention`.`oa_department` `dt` ON ( ( `cd`.`PARENT_ID` = '89f3d30c4031432da53b75bed442ced8' ) ) )
|
||||
GROUP BY
|
||||
`cd`.`DEPARTMENT_ID`
|
||||
) `d`
|
||||
)
|
||||
) `dep`
|
||||
LEFT JOIN `qa-cmt-prevention`.`bus_hidden` `f` ON ( ( `dep`.`DEPARTMENT_ID` = `f`.`RECTIFICATIONDEPT` ) )
|
||||
)
|
||||
WHERE
|
||||
( `f`.`ISDELETE` = '0' AND date_format( `f`.`CREATTIME`, '%Y' ) = #{YEAR} AND f.RECTIFICATIONDEPT != '' )
|
||||
GROUP BY
|
||||
`CREATE_MONTH` UNION ALL
|
||||
SELECT
|
||||
date_format( `f`.`CREATTIME`, '%Y-%m' ) AS `CREATE_MONTH`,
|
||||
count( `f`.`HIDDEN_ID` ) AS `TOTAL_COUNT`,
|
||||
count( ( CASE WHEN ( `f`.`STATE` = '4' ) THEN 1 END ) ) AS `REVISED_COUNT`,
|
||||
concat(
|
||||
cast(
|
||||
(
|
||||
( count( ( CASE WHEN ( `f`.`STATE` = '4' ) THEN 1 END ) ) / count( `f`.`HIDDEN_ID` ) ) * 100.0
|
||||
) AS DECIMAL ( 10, 2 )
|
||||
),
|
||||
'%'
|
||||
) AS `COMPLERATE`,
|
||||
'卸车部' AS `DEPT_NAME`
|
||||
FROM
|
||||
(
|
||||
(
|
||||
(
|
||||
SELECT
|
||||
`d`.`DEPARTMENT_ID` AS `DEPARTMENT_ID`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
`qa-cmt-prevention`.`oa_department`.`DEPARTMENT_ID` AS `DEPARTMENT_ID`
|
||||
FROM
|
||||
`qa-cmt-prevention`.`oa_department`
|
||||
WHERE
|
||||
( `qa-cmt-prevention`.`oa_department`.`DEPARTMENT_ID` = 'aad337cf728b4cc2b63e210caf4e185f' ) UNION ALL
|
||||
SELECT
|
||||
`cd`.`DEPARTMENT_ID` AS `DEPARTMENT_ID`
|
||||
FROM
|
||||
( `qa-cmt-prevention`.`oa_department` `cd` JOIN `qa-cmt-prevention`.`oa_department` `dt` ON ( ( `cd`.`PARENT_ID` = 'aad337cf728b4cc2b63e210caf4e185f' ) ) )
|
||||
GROUP BY
|
||||
`cd`.`DEPARTMENT_ID`
|
||||
) `d`
|
||||
)
|
||||
) `dep`
|
||||
LEFT JOIN `qa-cmt-prevention`.`bus_hidden` `f` ON ( ( `dep`.`DEPARTMENT_ID` = `f`.`RECTIFICATIONDEPT` ) )
|
||||
)
|
||||
WHERE
|
||||
( `f`.`ISDELETE` = '0' AND date_format( `f`.`CREATTIME`, '%Y' ) = #{YEAR} AND f.RECTIFICATIONDEPT != '' )
|
||||
GROUP BY
|
||||
`CREATE_MONTH` UNION ALL
|
||||
SELECT
|
||||
date_format( `f`.`CREATTIME`, '%Y-%m' ) AS `CREATE_MONTH`,
|
||||
count( `f`.`HIDDEN_ID` ) AS `TOTAL_COUNT`,
|
||||
count( ( CASE WHEN ( `f`.`STATE` = '4' ) THEN 1 END ) ) AS `REVISED_COUNT`,
|
||||
concat(
|
||||
cast(
|
||||
(
|
||||
( count( ( CASE WHEN ( `f`.`STATE` = '4' ) THEN 1 END ) ) / count( `f`.`HIDDEN_ID` ) ) * 100.0
|
||||
) AS DECIMAL ( 10, 2 )
|
||||
),
|
||||
'%'
|
||||
) AS `COMPLERATE`,
|
||||
'生产保障部' AS `DEPT_NAME`
|
||||
FROM
|
||||
(
|
||||
(
|
||||
(
|
||||
SELECT
|
||||
`d`.`DEPARTMENT_ID` AS `DEPARTMENT_ID`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
`qa-cmt-prevention`.`oa_department`.`DEPARTMENT_ID` AS `DEPARTMENT_ID`
|
||||
FROM
|
||||
`qa-cmt-prevention`.`oa_department`
|
||||
WHERE
|
||||
( `qa-cmt-prevention`.`oa_department`.`DEPARTMENT_ID` = 'fcae9cc13a354be699d85d6aea3b3450' ) UNION ALL
|
||||
SELECT
|
||||
`cd`.`DEPARTMENT_ID` AS `DEPARTMENT_ID`
|
||||
FROM
|
||||
( `qa-cmt-prevention`.`oa_department` `cd` JOIN `qa-cmt-prevention`.`oa_department` `dt` ON ( ( `cd`.`PARENT_ID` = 'fcae9cc13a354be699d85d6aea3b3450' ) ) )
|
||||
GROUP BY
|
||||
`cd`.`DEPARTMENT_ID`
|
||||
) `d`
|
||||
)
|
||||
) `dep`
|
||||
LEFT JOIN `qa-cmt-prevention`.`bus_hidden` `f` ON ( ( `dep`.`DEPARTMENT_ID` = `f`.`RECTIFICATIONDEPT` ) )
|
||||
)
|
||||
WHERE
|
||||
( `f`.`ISDELETE` = '0' AND date_format( `f`.`CREATTIME`, '%Y' ) = #{YEAR} AND f.RECTIFICATIONDEPT != '' )
|
||||
GROUP BY
|
||||
`CREATE_MONTH` UNION ALL
|
||||
SELECT
|
||||
date_format( `f`.`CREATTIME`, '%Y-%m' ) AS `CREATE_MONTH`,
|
||||
count( `f`.`HIDDEN_ID` ) AS `TOTAL_COUNT`,
|
||||
count( ( CASE WHEN ( `f`.`STATE` = '4' ) THEN 1 END ) ) AS `REVISED_COUNT`,
|
||||
concat(
|
||||
cast(
|
||||
(
|
||||
( count( ( CASE WHEN ( `f`.`STATE` = '4' ) THEN 1 END ) ) / count( `f`.`HIDDEN_ID` ) ) * 100.0
|
||||
) AS DECIMAL ( 10, 2 )
|
||||
),
|
||||
'%'
|
||||
) AS `COMPLERATE`,
|
||||
'其他部' AS `DEPT_NAME`
|
||||
FROM
|
||||
`qa-cmt-prevention`.`bus_hidden` f
|
||||
LEFT JOIN oa_department od ON od.DEPARTMENT_ID = f.RECTIFICATIONDEPT
|
||||
WHERE
|
||||
(
|
||||
`f`.`ISDELETE` = '0'
|
||||
AND date_format( `f`.`CREATTIME`, '%Y' ) = #{YEAR}
|
||||
AND f.RECTIFICATIONDEPT != ''
|
||||
AND NOT FIND_IN_SET( od.DEPARTMENT_ID, '89f3d30c4031432da53b75bed442ced8,aad337cf728b4cc2b63e210caf4e185f,fcae9cc13a354be699d85d6aea3b3450' )
|
||||
AND NOT FIND_IN_SET( od.PARENT_ID, '89f3d30c4031432da53b75bed442ced8,aad337cf728b4cc2b63e210caf4e185f,fcae9cc13a354be699d85d6aea3b3450' )
|
||||
)
|
||||
GROUP BY
|
||||
`CREATE_MONTH`;
|
||||
</select>
|
||||
|
||||
<!-- 列表 发现人没有在这里 -->
|
||||
<select id="listForExcel" parameterType="pd" resultType="pd">
|
||||
SELECT
|
||||
bhuUser.name as fxUserName,
|
||||
bhuUserDeptD.DEPARTMENT_ID as fxUserDeptNameId,
|
||||
bhuUserDept.name as fxUserDeptName,
|
||||
bhuUserDeptD.name as fxUserDeptDName,
|
||||
type1.name as type1Name,
|
||||
confirmUser.name as conUsername,
|
||||
|
||||
zgUserDeptD.DEPARTMENT_ID as zgUserDeptId,
|
||||
zgUserDept.name as zgUserDeptName,
|
||||
zgUserDeptD.name as zgUserDeptDName,
|
||||
zgUser.name as zgUserName,
|
||||
hreg.HIDDENREGION as HIDDENPARTNAME,
|
||||
f.*
|
||||
FROM
|
||||
bus_hidden f
|
||||
left join bus_hidden_user bhu on bhu.HIDDEN_ID = f.HIDDEN_ID
|
||||
left join vi_user_all bhuUser on bhuUser.user_id = bhu.user_id
|
||||
left join oa_department bhuUserDept on bhuUser.DEPARTMENT_ID = bhuUserDept.DEPARTMENT_ID
|
||||
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 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
|
||||
left join oa_department zgUserDeptD on zgUserDeptD.DEPARTMENT_ID = zgUserDept.PARENT_ID
|
||||
left join bus_hiddenregion hreg on hreg.HIDDENREGION_ID = f.HIDDENPART
|
||||
|
||||
|
||||
WHERE f.ISDELETE = '0'
|
||||
and f.STATE not in ('0','7','8','100','101','102')
|
||||
AND f.HIDDENLEVEL != 'hiddenLevel2002'
|
||||
AND f.HIDDENLEVEL != 'hiddenLevel1001'
|
||||
AND f.HIDDENLEVEL != 'jdyh001'
|
||||
<if test="roleLevel != null and roleLevel != ''"><!-- 权限显示 -->
|
||||
<choose>
|
||||
<when test='roleLevel == "0"'>
|
||||
</when>
|
||||
<when test='roleLevel == "1"'>
|
||||
and (confirmUser.DEPARTMENT_ID in (${supDeparIds}) or bhuUser.DEPARTMENT_ID in (${supDeparIds}) or
|
||||
f.RECTIFICATIONDEPT in (${supDeparIds}) or hch.DEPARTMENT_ID in (${supDeparIds}))
|
||||
</when>
|
||||
<when test='roleLevel == "2"'>
|
||||
and (f.CREATOR = #{loginUserId} or f.RECTIFICATIONOR = #{loginUserId} or
|
||||
f.CONFIRM_USER= #{loginUserId} or bhu.USER_ID =#{loginUserId} or hch.USER_ID = #{loginUserId} )
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
<if test='hiddenVueType != null and hiddenVueType != "confirm"'><!-- -->
|
||||
AND f.HIDDENLEVEL NOT IN ( 'hiddenLevel2002','hiddenLevel1001','jdyh001' )
|
||||
</if>
|
||||
<if test="CORPINFO_ID != null and CORPINFO_ID != ''"><!-- 企业ID -->
|
||||
and f.CORPINFO_ID = #{CORPINFO_ID}
|
||||
</if>
|
||||
<if test="hiddendescr != null and hiddendescr != ''"><!-- 隐患描述 -->
|
||||
and (f.HIDDENDESCR LIKE CONCAT(CONCAT('%', #{hiddendescr}),'%'))
|
||||
</if>
|
||||
<if test="source != null and source != '' "><!-- 隐患来源 -->
|
||||
<if test='source == "2"'>
|
||||
and f.SOURCE in ('2','3')
|
||||
</if>
|
||||
<if test='source != "2"'>
|
||||
and f.SOURCE = #{source}
|
||||
</if>
|
||||
</if>
|
||||
<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} )
|
||||
</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
|
||||
where
|
||||
<!-- user.USERNAME LIKE CONCAT(CONCAT('%', #{creatorName}),'%') or
|
||||
user.NUMBER LIKE CONCAT(CONCAT('%', #{creatorName}),'%') or
|
||||
user.PHONE LIKE CONCAT(CONCAT('%', #{creatorName}),'%')-->
|
||||
|
||||
user.NAME LIKE CONCAT(CONCAT('%', #{creatorName}),'%')
|
||||
)
|
||||
</if>
|
||||
<if test='STARTTIME != null and STARTTIME != "" and STARTTIME != "undefined"'><!-- 隐患发现时间 开始时间 -->
|
||||
and f.DISCOVERYTIME <![CDATA[ >= ]]> CONCAT_WS(' ', #{STARTTIME}, '00:00')
|
||||
</if>
|
||||
<if test='ENDTIME != null and ENDTIME != "" and ENDTIME != "undefined" '><!-- 隐患发现时间 结束时间 -->
|
||||
and f.DISCOVERYTIME <![CDATA[ <= ]]> CONCAT_WS(' ', #{ENDTIME}, '23:59')
|
||||
</if>
|
||||
<if test="hiddenlevel != null and hiddenlevel != ''"> <!-- 隐患级别-->
|
||||
and f.HIDDENLEVEL = #{hiddenlevel}
|
||||
</if>
|
||||
<if test="state != null and state != ''"> <!-- 隐患状态-->
|
||||
and f.STATE = #{state}
|
||||
</if>
|
||||
<if test="hiddenType != null and hiddenType != ''"><!-- 隐患类型 -->
|
||||
and f.HIDDENTYPE = #{hiddenType}
|
||||
</if>
|
||||
<if test="confirmUserName != null and confirmUserName != ''"><!-- 确认人 -->
|
||||
and (
|
||||
|
||||
<!-- confirmUser.USERNAME LIKE CONCAT(CONCAT('%', #{confirmUserName}),'%') or}),'%') -->
|
||||
<!-- confirmUser.NUMBER LIKE CONCAT(CONCAT('%', #{confirmUserName}),'%') or}),'%') -->
|
||||
confirmUser.NAME LIKE CONCAT(CONCAT('%', #{confirmUserName}),'%')
|
||||
<!-- confirmUser.PHONE LIKE CONCAT(CONCAT('%', #{confirmUserName}),'%'因为搜索框搜1或者2也能出来数据,但是不应该有数据,暂时注释) -->
|
||||
)
|
||||
</if>
|
||||
<if test="rectificationorName != null and rectificationorName != ''"><!-- 整改人 -->
|
||||
and (
|
||||
rect.NAME LIKE CONCAT(CONCAT('%', #{rectificationorName}),'%')
|
||||
<!-- rect.PHONE LIKE CONCAT(CONCAT('%', #{rectificationorName}),'%'
|
||||
rect.USERNAME LIKE CONCAT(CONCAT('%', #{rectificationorName}),'%') or
|
||||
rect.NUMBER LIKE CONCAT(CONCAT('%', #{rectificationorName}),'%') or因为搜索框搜1或者2也能出来数据,但是不应该有数据,暂时注释) -->
|
||||
)
|
||||
</if>
|
||||
<if test="checkrecordName != null and checkrecordName != ''"><!-- 验收人 -->
|
||||
and f.HIDDEN_ID in (
|
||||
SELECT
|
||||
yhc.HIDDEN_ID
|
||||
FROM
|
||||
bus_hiddencheck yhc
|
||||
LEFT JOIN sys_user yuser ON yuser.USER_ID = yhc.USER_ID AND yuser.CORPINFO_ID = #{CORPINFO_ID}
|
||||
where (
|
||||
<!-- yuser.USERNAME LIKE CONCAT(CONCAT('%',#{checkrecordName}),'%')
|
||||
or) or yuser.PHONE LIKE CONCAT(CONCAT('%', #{checkrecordName}),'%') 因为搜索框搜1或者2也能出来数据,但是不应该有数据,暂时注释-->
|
||||
yuser.NAME LIKE CONCAT(CONCAT('%', #{checkrecordName}),'%')
|
||||
)
|
||||
)
|
||||
</if>
|
||||
<if test="checkrecordId != null and checkrecordId != ''"><!-- 验收人 -->
|
||||
and f.STATE = '2'
|
||||
and (select count(1) from BUS_HIDDENCHECK bh where bh.HIDDEN_ID=f.HIDDEN_ID and bh.USER_ID=#{SELFUSERID} )>0
|
||||
</if>
|
||||
|
||||
|
||||
<if test="hiddenpart != null and hiddenpart != ''"><!-- 隐患部位 -->
|
||||
and hreg.HIDDENREGION_ID LIKE CONCAT(CONCAT('%', #{hiddenpart}),'%')
|
||||
</if>
|
||||
|
|
Loading…
Reference in New Issue