隐患统计导出
parent
97cb960cf8
commit
5e21a66e95
|
@ -5,6 +5,7 @@ import com.zcloud.aspect.DockAnnotation;
|
|||
import com.zcloud.controller.base.BaseController;
|
||||
import com.zcloud.entity.Page;
|
||||
import com.zcloud.entity.PageData;
|
||||
import com.zcloud.entity.system.Department;
|
||||
import com.zcloud.entity.system.Dictionaries;
|
||||
import com.zcloud.service.announcement.TemplateAnnounService;
|
||||
import com.zcloud.service.bus.*;
|
||||
|
@ -17,7 +18,14 @@ import com.zcloud.service.system.UsersService;
|
|||
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.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.xmlbeans.impl.xb.xsdschema.Public;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
@ -30,7 +38,20 @@ import org.springframework.web.servlet.ModelAndView;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 说明:隐患 作者:guoyuepeng
|
||||
|
@ -1294,4 +1315,151 @@ public class HiddenApiController extends BaseController {
|
|||
mv = new ModelAndView(erv2, dataMap);
|
||||
return mv;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/getCountExcel")
|
||||
public void exportExcels(HttpServletResponse response) throws Exception {
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
//这里进入开始获取数据阶段 首先拿到所有部门数据
|
||||
String url ="department_list.html?DEPARTMENT_ID=";
|
||||
List<Department> departments = departmentService.listAllDepartment(Jurisdiction.getCORPINFO_ID(), url);
|
||||
//装船部 zcb id集合 89f3d30c4031432da53b75bed442ced8
|
||||
List<String> zcbdepartmentIds = new ArrayList<>();
|
||||
//保障部 bzb id集合 fcae9cc13a354be699d85d6aea3b3450
|
||||
List<String> bzbdepartmentIds = new ArrayList<>();
|
||||
//卸车部 xcb id集合 aad337cf728b4cc2b63e210caf4e185f
|
||||
List<String> xcbdepartmentIds = new ArrayList<>();
|
||||
//安监部 ajb id集合 4c4b7bc93e3347978f5a3e1f0c4a0b56
|
||||
List<String> ajbdepartmentIds = new ArrayList<>();
|
||||
//开始处理数据 扔进对应结合中
|
||||
for(Department department:departments){
|
||||
if(StringUtils.equals("89f3d30c4031432da53b75bed442ced8",department.getDEPARTMENT_ID())){
|
||||
zcbdepartmentIds = getIdsList(department,zcbdepartmentIds);
|
||||
}
|
||||
if(StringUtils.equals("fcae9cc13a354be699d85d6aea3b3450",department.getDEPARTMENT_ID())){
|
||||
bzbdepartmentIds = getIdsList(department,bzbdepartmentIds);
|
||||
}
|
||||
if(StringUtils.equals("aad337cf728b4cc2b63e210caf4e185f",department.getDEPARTMENT_ID())){
|
||||
xcbdepartmentIds = getIdsList(department,xcbdepartmentIds);
|
||||
}
|
||||
if(StringUtils.equals("4c4b7bc93e3347978f5a3e1f0c4a0b56",department.getDEPARTMENT_ID())){
|
||||
ajbdepartmentIds = getIdsList(department,ajbdepartmentIds);
|
||||
}
|
||||
}
|
||||
//处理日期 类型 年 季度 月
|
||||
String type = pd.getString("type");
|
||||
String year = pd.getString("year");
|
||||
String num = pd.getString("num");
|
||||
String startTime = "";
|
||||
String endTime = "";
|
||||
//年
|
||||
if(StringUtils.equals("1",type)){
|
||||
startTime = year+"-01-01 00:00:00";
|
||||
endTime = year+"-12-31 23:59:59";
|
||||
}
|
||||
//季度
|
||||
if(StringUtils.equals("2",type)){
|
||||
switch (num){
|
||||
case "1" :
|
||||
startTime = year+"-01-01 00:00:00";
|
||||
endTime = year+"-03-31 23:59:59";
|
||||
break;
|
||||
case "2" :
|
||||
startTime = year+"-04-01 00:00:00";
|
||||
endTime = year+"-06-30 23:59:59";
|
||||
break;
|
||||
case "3" :
|
||||
startTime = year+"-07-01 00:00:00";
|
||||
endTime = year+"-09-30 23:59:59";
|
||||
break;
|
||||
case "4" :
|
||||
startTime = year+"-10-01 00:00:00";
|
||||
endTime = year+"-12-31 23:59:59";
|
||||
break;
|
||||
}
|
||||
}
|
||||
//月
|
||||
if(StringUtils.equals("3",type)){
|
||||
startTime = year+"-01 00:00:00";
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
// 解析字符串为LocalDateTime
|
||||
LocalDateTime dateTime = LocalDateTime.parse(startTime, formatter);
|
||||
LocalDate localDate = dateTime.toLocalDate();
|
||||
LocalDate lastDayOfMonth = localDate.with(java.time.temporal.TemporalAdjusters.lastDayOfMonth());
|
||||
// 将LocalDateTime转换为ZonedDateTime(如果需要的话)
|
||||
ZonedDateTime zonedDateTime = lastDayOfMonth.atStartOfDay(ZoneId.of("Asia/Shanghai"));
|
||||
// 定义日期格式化器(仅日期部分)
|
||||
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
// 格式化ZonedDateTime对象为仅包含日期的字符串
|
||||
String formattedDate = dateFormatter.format(zonedDateTime);
|
||||
endTime = formattedDate+" 23:59:59";
|
||||
}
|
||||
//前置搜索条件处理完毕
|
||||
pd.put("zcbdepartmentIds",zcbdepartmentIds);
|
||||
pd.put("bzbdepartmentIds",bzbdepartmentIds);
|
||||
pd.put("xcbdepartmentIds",xcbdepartmentIds);
|
||||
pd.put("ajbdepartmentIds",ajbdepartmentIds);
|
||||
pd.put("startTime",startTime);
|
||||
pd.put("endTime",endTime);
|
||||
//这里获取数据 获取指定日期范围内和指定部门集合创建的隐患总数
|
||||
Map<String,Object> map = hiddenService.getExcelMap(pd);
|
||||
//年
|
||||
if(StringUtils.equals("1",type)){
|
||||
map.put("type","统计年度:");
|
||||
map.put("num",year+"年");
|
||||
}
|
||||
//季度
|
||||
if(StringUtils.equals("2",type)){
|
||||
map.put("type","统计季度:");
|
||||
map.put("num",year+"年第"+num+"季度");
|
||||
}
|
||||
//月
|
||||
if(StringUtils.equals("3",type)){
|
||||
map.put("type","统计月度:");
|
||||
map.put("num",year+"年第"+num+"月");
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
|
||||
String date =sdf.format(new Date());
|
||||
map.put("date","填表日期:"+date);
|
||||
//开始执行模板填充数据
|
||||
String excelFilePath = "C:\\Users\\Administrator\\Desktop\\隐患统计.xlsx"; // 替换为你的Excel文件路径
|
||||
//正则
|
||||
String regex = "\\{\\{.*?\\}\\}";
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
try (FileInputStream inputStream = new FileInputStream(new File(excelFilePath));
|
||||
Workbook workbook = new XSSFWorkbook(inputStream)) {
|
||||
Sheet sheet = workbook.getSheetAt(0); // 获取第一个工作表
|
||||
for (Row row : sheet) {
|
||||
for (Cell cell : row) {
|
||||
String fileurl = cell.getStringCellValue();
|
||||
Matcher matcher = pattern.matcher(fileurl);
|
||||
if (matcher.matches()) {
|
||||
String key = fileurl.substring(2, fileurl.length() - 2);
|
||||
String value = map.get(key).toString();
|
||||
cell.setCellValue(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
try (OutputStream outputStream = response.getOutputStream()) {
|
||||
workbook.write(outputStream);
|
||||
workbook.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("Excel文件导出成功!");
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getIdsList(Department department,List<String> ids){
|
||||
ids.add(department.getDEPARTMENT_ID());
|
||||
for(Department dept :department.getSubDepartment() ){
|
||||
if(dept.getSubDepartment().size()>0){
|
||||
getIdsList(dept,ids);
|
||||
}else {
|
||||
ids.add(dept.getDEPARTMENT_ID());
|
||||
}
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -354,5 +354,12 @@ public interface HiddenMapper{
|
|||
void updateGoConfirm (PageData pd);
|
||||
|
||||
List<PageData> findBySource(Integer sourceNumber);
|
||||
|
||||
//各部门自查统计数据
|
||||
List<PageData> getExcelZc(PageData pd);
|
||||
|
||||
//公司检查统计数据
|
||||
List<PageData> getExcelGsc(PageData pd);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -447,5 +447,7 @@ public interface HiddenService{
|
|||
|
||||
//根据Source查询Hidden
|
||||
public List<PageData> findBySource(Integer sourceNumber);
|
||||
|
||||
Map<String,Object> getExcelMap(PageData pageData);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,13 +9,19 @@ import com.zcloud.service.bus.HiddenService;
|
|||
import com.zcloud.service.bus.ImgFilesService;
|
||||
import com.zcloud.service.system.UsersService;
|
||||
import com.zcloud.util.*;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 说明:隐患
|
||||
|
@ -590,7 +596,7 @@ public class HiddenServiceImpl implements HiddenService{
|
|||
hiddenMapper.saveForEmis(pd);
|
||||
}
|
||||
/**删除
|
||||
* @param pd
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteForEmis(String hiddenId)throws Exception{
|
||||
|
@ -708,5 +714,220 @@ public class HiddenServiceImpl implements HiddenService{
|
|||
public List<PageData> findBySource(Integer sourceNumber) {
|
||||
return hiddenMapper.findBySource(sourceNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getExcelMap(PageData pageData) {
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
//部门自查数据
|
||||
List<PageData> zcPageDataList = hiddenMapper.getExcelZc(pageData);
|
||||
//stream分组
|
||||
Map<String,List<PageData>> groupByTypeList = zcPageDataList.stream().collect(Collectors.groupingBy(item->item.getString("type")));
|
||||
//装船部自查数据
|
||||
List<PageData> zcbZc = groupByTypeList.get("zcbzc");
|
||||
if(!Tools.isEmpty(zcbZc)){
|
||||
map.put("zcbZcZs",zcbZc.size()); //总数
|
||||
List<PageData> zcbZcWc = zcbZc.stream().filter(item-> StringUtils.equals("4",item.getString("STATE"))).collect(Collectors.toList());
|
||||
int zijin = zcbZc.stream().mapToInt(item-> Integer.parseInt(item.getString("INVESTMENT_FUNDS"))).sum();
|
||||
if(!Tools.isEmpty(zcbZcWc)){
|
||||
map.put("zcbZcZg",zcbZcWc.size());
|
||||
map.put("zcbZcWwcZg",zcbZc.size()-zcbZcWc.size());
|
||||
BigDecimal result = new BigDecimal(zcbZcWc.size()).divide(new BigDecimal(zcbZc.size()), 0, RoundingMode.HALF_UP);
|
||||
map.put("zcbZcZgl",result+"%"); //整改率
|
||||
}else {
|
||||
map.put("zcbZcZg","0");
|
||||
map.put("zcbZcWwcZg",zcbZcWc.size());
|
||||
map.put("zcbZcZgl","0%"); //整改率
|
||||
}
|
||||
map.put("zcbZcZgZj",zijin); //资金
|
||||
}else {
|
||||
map.put("zcbZcZs","0"); //总数
|
||||
map.put("zcbZcZg","0"); //整改数
|
||||
map.put("zcbZcWwcZg","0"); //整改未完成数
|
||||
map.put("zcbZcZgl","100%"); //整改率
|
||||
map.put("zcbZcZgZj","0"); //资金
|
||||
}
|
||||
//卸车部自查数据
|
||||
List<PageData> xcbZc = groupByTypeList.get("xcbzc");
|
||||
if(!Tools.isEmpty(xcbZc)){
|
||||
map.put("xcbZcZs",xcbZc.size()); //总数
|
||||
List<PageData> xcbZcWc = xcbZc.stream().filter(item-> StringUtils.equals("4",item.getString("STATE"))).collect(Collectors.toList());
|
||||
int zijin = xcbZc.stream().mapToInt(item-> Integer.parseInt(item.getString("INVESTMENT_FUNDS"))).sum();
|
||||
if(!Tools.isEmpty(xcbZcWc)){
|
||||
map.put("xcbZcZg",xcbZcWc.size());
|
||||
map.put("xcbZcWwcZg",xcbZc.size()-xcbZcWc.size());
|
||||
BigDecimal result = new BigDecimal(xcbZcWc.size()).divide(new BigDecimal(xcbZc.size()), 0, RoundingMode.HALF_UP);
|
||||
map.put("xcbZcZgl",result+"%"); //整改率
|
||||
}else {
|
||||
map.put("xcbZcZg","0");
|
||||
map.put("xcbZcWwcZg",xcbZcWc.size());
|
||||
map.put("xcbZcZgl","0%"); //整改率
|
||||
}
|
||||
map.put("xcbZcZgZj",zijin); //资金
|
||||
}else {
|
||||
map.put("xcbZcZs","0"); //总数
|
||||
map.put("xcbZcZg","0"); //整改数
|
||||
map.put("xcbZcWwcZg","0"); //整改未完成数
|
||||
map.put("xcbZcZgl","100%"); //整改率
|
||||
map.put("xcbZcZgZj","0"); //资金
|
||||
}
|
||||
//保障部自查数据
|
||||
List<PageData> bzbZc = groupByTypeList.get("bzbzc");
|
||||
if(!Tools.isEmpty(bzbZc)){
|
||||
map.put("bzbZcZs",bzbZc.size()); //总数
|
||||
List<PageData> bzbZcWc = bzbZc.stream().filter(item-> StringUtils.equals("4",item.getString("STATE"))).collect(Collectors.toList());
|
||||
int zijin = bzbZc.stream().mapToInt(item-> Integer.parseInt(item.getString("INVESTMENT_FUNDS"))).sum();
|
||||
if(!Tools.isEmpty(bzbZcWc)){
|
||||
map.put("bzbZcZg",bzbZcWc.size());
|
||||
map.put("bzbZcWwcZg",bzbZc.size()-bzbZcWc.size());
|
||||
BigDecimal result = new BigDecimal(bzbZcWc.size()).divide(new BigDecimal(bzbZc.size()), 0, RoundingMode.HALF_UP);
|
||||
map.put("bzbZcZgl",result+"%"); //整改率
|
||||
}else {
|
||||
map.put("bzbZcZg","0");
|
||||
map.put("bzbZcWwcZg",bzbZcWc.size());
|
||||
map.put("bzbZcZgl","0%"); //整改率
|
||||
}
|
||||
map.put("bzbZcZgZj",zijin); //资金
|
||||
}else {
|
||||
map.put("bzbZcZs","0"); //总数
|
||||
map.put("bzbZcZg","0"); //整改数
|
||||
map.put("bzbZcWwcZg","0"); //整改未完成数
|
||||
map.put("bzbZcZgl","100%"); //整改率
|
||||
map.put("bzbZcZgZj","0"); //资金
|
||||
}
|
||||
//公司查数据
|
||||
List<PageData> gscPageDataList = hiddenMapper.getExcelGsc(pageData);
|
||||
//stream分组
|
||||
Map<String,List<PageData>> groupByTypeGscList = gscPageDataList.stream().collect(Collectors.groupingBy(item->item.getString("type")));
|
||||
//装船部公司查数据
|
||||
List<PageData> zcbGsc = groupByTypeGscList.get("zcbgsc");
|
||||
if(!Tools.isEmpty(zcbGsc)){
|
||||
map.put("zcbGscZs",zcbGsc.size()); //总数
|
||||
List<PageData> zcbGscWc = zcbGsc.stream().filter(item-> StringUtils.equals("4",item.getString("STATE"))).collect(Collectors.toList());
|
||||
int zijin = zcbGsc.stream().mapToInt(item-> Integer.parseInt(item.getString("INVESTMENT_FUNDS"))).sum();
|
||||
if(!Tools.isEmpty(zcbGscWc)){
|
||||
map.put("zcbGscZg",zcbGscWc.size());
|
||||
map.put("zcbGscWwcZg",zcbGsc.size()-zcbGscWc.size());
|
||||
BigDecimal result = new BigDecimal(zcbGscWc.size()).divide(new BigDecimal(zcbGsc.size()), 0, RoundingMode.HALF_UP);
|
||||
map.put("zcbGscZgl",result+"%"); //整改率
|
||||
}else {
|
||||
map.put("zcbGscZg","0");
|
||||
map.put("zcbGscWwcZg",zcbGscWc.size());
|
||||
map.put("zcbGscZgl","0%"); //整改率
|
||||
}
|
||||
map.put("zcbGscZgZj",zijin); //资金
|
||||
}else {
|
||||
map.put("zcbGscZs","0"); //总数
|
||||
map.put("zcbGscZg","0"); //整改数
|
||||
map.put("zcbGscWwcZg","0"); //整改未完成数
|
||||
map.put("zcbGscZgl","100%"); //整改率
|
||||
map.put("zcbGscZgZj","0"); //资金
|
||||
}
|
||||
//卸车部自查数据
|
||||
List<PageData> xcbGsc = groupByTypeGscList.get("xcbgsc");
|
||||
if(!Tools.isEmpty(xcbGsc)){
|
||||
map.put("xcbGscZcZs",xcbGsc.size()); //总数
|
||||
List<PageData> xcbGscWc = xcbGsc.stream().filter(item-> StringUtils.equals("4",item.getString("STATE"))).collect(Collectors.toList());
|
||||
int zijin = xcbGsc.stream().mapToInt(item-> Integer.parseInt(item.getString("INVESTMENT_FUNDS"))).sum();
|
||||
if(!Tools.isEmpty(xcbGscWc)){
|
||||
map.put("xcbGscZg",xcbGscWc.size());
|
||||
map.put("xcbGscWwcZg",xcbGsc.size()-xcbGscWc.size());
|
||||
BigDecimal result = new BigDecimal(xcbGscWc.size()).divide(new BigDecimal(xcbGsc.size()), 0, RoundingMode.HALF_UP);
|
||||
map.put("xcbGscZgl",result+"%"); //整改率
|
||||
}else {
|
||||
map.put("xcbGscZg","0");
|
||||
map.put("xcbGscWwcZg",xcbGscWc.size());
|
||||
map.put("xcbGscZgl","0%"); //整改率
|
||||
}
|
||||
map.put("xcbGscZgZj",zijin); //资金
|
||||
}else {
|
||||
map.put("xcbGscZs","0"); //总数
|
||||
map.put("xcbGscZg","0"); //整改数
|
||||
map.put("xcbGscWwcZg","0"); //整改未完成数
|
||||
map.put("xcbGscZgl","100%"); //整改率
|
||||
map.put("xcbGscZgZj","0"); //资金
|
||||
}
|
||||
//保障部自查数据
|
||||
List<PageData> bzbGsc = groupByTypeGscList.get("bzbgsc");
|
||||
if(!Tools.isEmpty(bzbGsc)){
|
||||
map.put("bzbGscZs",bzbGsc.size()); //总数
|
||||
List<PageData> bzbGscWc = bzbGsc.stream().filter(item-> StringUtils.equals("4",item.getString("STATE"))).collect(Collectors.toList());
|
||||
int zijin = bzbGsc.stream().mapToInt(item-> Integer.parseInt(item.getString("INVESTMENT_FUNDS"))).sum();
|
||||
if(!Tools.isEmpty(bzbGscWc)){
|
||||
map.put("bzbGscZg",bzbGscWc.size());
|
||||
map.put("bzbGscWwcZg",bzbGsc.size()-bzbGscWc.size());
|
||||
BigDecimal result = new BigDecimal(bzbGscWc.size()).divide(new BigDecimal(bzbGsc.size()), 0, RoundingMode.HALF_UP);
|
||||
map.put("bzbGscZgl",result+"%"); //整改率
|
||||
}else {
|
||||
map.put("bzbGscZg","0");
|
||||
map.put("bzbGscWwcZg",bzbGscWc.size());
|
||||
map.put("bzbGscZgl","0%"); //整改率
|
||||
}
|
||||
map.put("bzbGscZgZj",zijin); //资金
|
||||
}else {
|
||||
map.put("bzbGscZs","0"); //总数
|
||||
map.put("bzbGscZg","0"); //整改数
|
||||
map.put("bzbGscWwcZg","0"); //整改未完成数
|
||||
map.put("bzbGscZgl","100%"); //整改率
|
||||
map.put("bzbGscZgZj","0"); //资金
|
||||
}
|
||||
// 处理汇总数据
|
||||
//装船部合计
|
||||
int zcbHjZs = Integer.parseInt(map.get("zcbZcZs").toString())+Integer.parseInt(map.get("zcbGscZs").toString());
|
||||
map.put("zcbHjZs",zcbHjZs); //总数
|
||||
int zcbHjZg = Integer.parseInt(map.get("zcbZcZg").toString())+Integer.parseInt(map.get("zcbGscZg").toString());
|
||||
map.put("zcbHjZg",zcbHjZg); //整改数
|
||||
map.put("zcbHjWwcZg",zcbHjZs-zcbHjZg); //整改未完成数
|
||||
if(BigDecimal.ZERO.compareTo(new BigDecimal(zcbHjZs))<0 && BigDecimal.ZERO.compareTo(new BigDecimal(zcbHjZg))<0){
|
||||
BigDecimal zcbResult = new BigDecimal(zcbHjZg).divide(new BigDecimal(zcbHjZs), 0, RoundingMode.HALF_UP);
|
||||
map.put("zcbHjZgl",zcbResult); //整改率
|
||||
}else {
|
||||
map.put("zcbHjZgl","100%"); //整改率
|
||||
}
|
||||
int zcbHjZgZj = Integer.parseInt(map.get("zcbZcZgZj").toString())+Integer.parseInt(map.get("zcbGscZgZj").toString());
|
||||
map.put("zcbHjZgZj",zcbHjZgZj); //资金
|
||||
//卸车部合计
|
||||
int xcbHjZs = Integer.parseInt(map.get("xcbZcZs").toString())+Integer.parseInt(map.get("xcbGscZs").toString());
|
||||
map.put("xcbHjZs",xcbHjZs); //总数
|
||||
int xcbHjZg = Integer.parseInt(map.get("xcbZcZg").toString())+Integer.parseInt(map.get("xcbGscZg").toString());
|
||||
map.put("xcbHjZg",xcbHjZg); //整改数
|
||||
map.put("xcbHjWwcZg",xcbHjZs-xcbHjZg); //整改未完成数
|
||||
if(BigDecimal.ZERO.compareTo(new BigDecimal(xcbHjZg))<0 && BigDecimal.ZERO.compareTo(new BigDecimal(xcbHjZs))<0){
|
||||
BigDecimal xcbResult = new BigDecimal(xcbHjZg).divide(new BigDecimal(xcbHjZs), 0, RoundingMode.HALF_UP);
|
||||
map.put("xcbHjZgl",xcbResult); //整改率
|
||||
}else {
|
||||
map.put("xcbHjZgl","100%"); //整改率
|
||||
}
|
||||
int xcbHjZgZj = Integer.parseInt(map.get("xcbZcZgZj").toString())+Integer.parseInt(map.get("xcbGscZgZj").toString());
|
||||
map.put("xcbHjZgZj",xcbHjZgZj); //资金
|
||||
//保障部合计
|
||||
int bzbHjZs = Integer.parseInt(map.get("bzbZcZs").toString())+Integer.parseInt(map.get("bzbGscZs").toString());
|
||||
map.put("bzbHjZs",bzbHjZs); //总数
|
||||
int bzbHjZg = Integer.parseInt(map.get("bzbZcZg").toString())+Integer.parseInt(map.get("bzbGscZg").toString());
|
||||
map.put("bzbHjZg",bzbHjZg); //整改数
|
||||
map.put("bzbHjWwcZg",bzbHjZs-bzbHjZg); //整改未完成数
|
||||
if(BigDecimal.ZERO.compareTo(new BigDecimal(bzbHjZg))<0 && BigDecimal.ZERO.compareTo(new BigDecimal(bzbHjZs))<0){
|
||||
BigDecimal bzbResult = new BigDecimal(bzbHjZg).divide(new BigDecimal(bzbHjZs), 0, RoundingMode.HALF_UP);
|
||||
map.put("bzbHjZgl",bzbResult); //整改率
|
||||
}else {
|
||||
map.put("bzbHjZgl","100%"); //整改率
|
||||
}
|
||||
int bzbHjZgZj = Integer.parseInt(map.get("bzbZcZgZj").toString())+Integer.parseInt(map.get("bzbGscZgZj").toString());
|
||||
map.put("bzbHjZgZj",bzbHjZgZj); //资金
|
||||
|
||||
//安监部合计
|
||||
int ajbHjZs = Integer.parseInt(map.get("zcbGscZs").toString())+Integer.parseInt(map.get("xcbGscZs").toString())+Integer.parseInt(map.get("bzbGscZs").toString());
|
||||
int ajbHjZg = Integer.parseInt(map.get("zcbGscZg").toString())+Integer.parseInt(map.get("xcbGscZg").toString())+Integer.parseInt(map.get("bzbGscZg").toString());
|
||||
map.put("ajbHjZs","本月共检查出安全隐患"+ajbHjZs+"项,已完成整改"+ajbHjZg+"项");
|
||||
//装船
|
||||
map.put("ajbZcbGsc","装船部公司检查"+map.get("zcbGscZs").toString()+"项");
|
||||
map.put("ajbZcbZc","自查"+map.get("zcbZcZs").toString()+"项");
|
||||
//卸车
|
||||
map.put("ajbXcbGsc","卸车部公司检查"+map.get("xcbGscZs").toString()+"项");
|
||||
map.put("ajbXcbZc","自查"+map.get("xcbZcZs").toString()+"项");
|
||||
//保障
|
||||
map.put("ajbBzbGsc","保障部公司检查"+map.get("bzbGscZs").toString()+"项");
|
||||
map.put("ajbBzbZc","自查"+map.get("bzbZcZs").toString()+"项");
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2987,6 +2987,154 @@
|
|||
</foreach>
|
||||
and STATE = '0'
|
||||
</delete>
|
||||
|
||||
<!--
|
||||
AND u.DEPARTMENT_ID IN (#{xcbdepartmentIds} )
|
||||
and h.CREATTIME <![CDATA[ >= ]]> #{startTime}
|
||||
and h.CREATTIME <![CDATA[ <= ]]> #{endTime}
|
||||
-->
|
||||
<select id="getExcelZc" resultType="com.zcloud.entity.PageData">
|
||||
SELECT
|
||||
h.HIDDEN_ID,
|
||||
h.STATE,
|
||||
IFNULL(h.INVESTMENT_FUNDS,0) INVESTMENT_FUNDS,
|
||||
'zcbzc' type
|
||||
FROM
|
||||
bus_hidden h
|
||||
LEFT JOIN sys_user u ON h.CREATOR = u.USER_ID
|
||||
LEFT JOIN sys_user uu ON h.RECTIFICATIONOR = uu.USER_ID
|
||||
WHERE
|
||||
h.SOURCE != '4'
|
||||
AND h.ISDELETE = '0'
|
||||
AND uu.DEPARTMENT_ID IN
|
||||
<foreach item="item" index="index" collection="zcbdepartmentIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND u.DEPARTMENT_ID IN
|
||||
<foreach item="item" index="index" collection="zcbdepartmentIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and h.CREATTIME <![CDATA[ >= ]]> #{startTime}
|
||||
and h.CREATTIME <![CDATA[ <= ]]> #{endTime}
|
||||
UNION ALL
|
||||
SELECT
|
||||
h.HIDDEN_ID,
|
||||
h.STATE,
|
||||
IFNULL(h.INVESTMENT_FUNDS,0) INVESTMENT_FUNDS,
|
||||
'xcbzc' type
|
||||
FROM
|
||||
bus_hidden h
|
||||
LEFT JOIN sys_user u ON h.CREATOR = u.USER_ID
|
||||
LEFT JOIN sys_user uu ON h.RECTIFICATIONOR = uu.USER_ID
|
||||
WHERE
|
||||
h.SOURCE != '4'
|
||||
AND h.ISDELETE = '0'
|
||||
AND uu.DEPARTMENT_ID IN
|
||||
<foreach item="item" index="index" collection="xcbdepartmentIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND u.DEPARTMENT_ID IN
|
||||
<foreach item="item" index="index" collection="xcbdepartmentIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and h.CREATTIME <![CDATA[ >= ]]> #{startTime}
|
||||
and h.CREATTIME <![CDATA[ <= ]]> #{endTime}
|
||||
UNION ALL
|
||||
SELECT
|
||||
h.HIDDEN_ID,
|
||||
h.STATE,
|
||||
IFNULL(h.INVESTMENT_FUNDS,0) INVESTMENT_FUNDS,
|
||||
'bzbzc' type
|
||||
FROM
|
||||
bus_hidden h
|
||||
LEFT JOIN sys_user u ON h.CREATOR = u.USER_ID
|
||||
LEFT JOIN sys_user uu ON h.RECTIFICATIONOR = uu.USER_ID
|
||||
WHERE
|
||||
h.SOURCE != '4'
|
||||
AND h.ISDELETE = '0'
|
||||
AND uu.DEPARTMENT_ID IN
|
||||
<foreach item="item" index="index" collection="bzbdepartmentIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND u.DEPARTMENT_ID IN
|
||||
<foreach item="item" index="index" collection="bzbdepartmentIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and h.CREATTIME <![CDATA[ >= ]]> #{startTime}
|
||||
and h.CREATTIME <![CDATA[ <= ]]> #{endTime}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getExcelGsc" resultType="com.zcloud.entity.PageData">
|
||||
SELECT
|
||||
h.HIDDEN_ID,
|
||||
h.STATE,
|
||||
IFNULL(h.INVESTMENT_FUNDS,0) INVESTMENT_FUNDS,
|
||||
'zcbgsc' type
|
||||
FROM
|
||||
bus_hidden h
|
||||
LEFT JOIN sys_user u ON h.CREATOR = u.USER_ID
|
||||
LEFT JOIN sys_user uu ON h.RECTIFICATIONOR = uu.USER_ID
|
||||
WHERE
|
||||
h.SOURCE != '4'
|
||||
AND h.ISDELETE = '0'
|
||||
AND uu.DEPARTMENT_ID IN
|
||||
<foreach item="item" index="index" collection="zcbdepartmentIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND u.DEPARTMENT_ID IN
|
||||
<foreach item="item" index="index" collection="ajbdepartmentIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and h.CREATTIME <![CDATA[ >= ]]> #{startTime}
|
||||
and h.CREATTIME <![CDATA[ <= ]]> #{endTime}
|
||||
UNION ALL
|
||||
SELECT
|
||||
h.HIDDEN_ID,
|
||||
h.STATE,
|
||||
IFNULL(h.INVESTMENT_FUNDS,0) INVESTMENT_FUNDS,
|
||||
'xcbgsc' type
|
||||
FROM
|
||||
bus_hidden h
|
||||
LEFT JOIN sys_user u ON h.CREATOR = u.USER_ID
|
||||
LEFT JOIN sys_user uu ON h.RECTIFICATIONOR = uu.USER_ID
|
||||
WHERE
|
||||
h.SOURCE != '4'
|
||||
AND h.ISDELETE = '0'
|
||||
AND uu.DEPARTMENT_ID IN
|
||||
<foreach item="item" index="index" collection="xcbdepartmentIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND u.DEPARTMENT_ID IN
|
||||
<foreach item="item" index="index" collection="ajbdepartmentIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and h.CREATTIME <![CDATA[ >= ]]> #{startTime}
|
||||
and h.CREATTIME <![CDATA[ <= ]]> #{endTime}
|
||||
UNION ALL
|
||||
SELECT
|
||||
h.HIDDEN_ID,
|
||||
h.STATE,
|
||||
IFNULL(h.INVESTMENT_FUNDS,0) INVESTMENT_FUNDS,
|
||||
'bzbgsc' type
|
||||
FROM
|
||||
bus_hidden h
|
||||
LEFT JOIN sys_user u ON h.CREATOR = u.USER_ID
|
||||
LEFT JOIN sys_user uu ON h.RECTIFICATIONOR = uu.USER_ID
|
||||
WHERE
|
||||
h.SOURCE != '4'
|
||||
AND h.ISDELETE = '0'
|
||||
AND uu.DEPARTMENT_ID IN
|
||||
<foreach item="item" index="index" collection="bzbdepartmentIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND u.DEPARTMENT_ID IN
|
||||
<foreach item="item" index="index" collection="ajbdepartmentIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and h.CREATTIME <![CDATA[ >= ]]> #{startTime}
|
||||
and h.CREATTIME <![CDATA[ <= ]]> #{endTime}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue