bug修改

This commit is contained in:
guoshengxiong 2025-08-15 18:45:55 +08:00
parent f3320a0587
commit 4ea32fd92d
21 changed files with 268 additions and 22 deletions

View File

@ -128,7 +128,9 @@ public class QueryGenerator {
Map<String, String[]> parameterMap = new HashMap<>(16); Map<String, String[]> parameterMap = new HashMap<>(16);
for (String key : map.keySet()) { for (String key : map.keySet()) {
if (key.contains(BEGIN) || key.contains(END)) { if (key.contains(BEGIN) || key.contains(END)) {
parameterMap.put(key, new String[]{map.get(key).toString()}); if (map.get(key) != null) {
parameterMap.put(key, new String[]{map.get(key).toString()});
}
} }
} }
return parameterMap; return parameterMap;

View File

@ -229,8 +229,9 @@ public class DataScopeHandler implements DataPermissionHandler {
enterpriseIds.add("0"); enterpriseIds.add("0");
List<Long> rids = xzSecurityQualityInspectionEnterpriseService.list(new LambdaQueryWrapper<XzSecurityQualityInspectionEnterprise>() List<Long> rids = xzSecurityQualityInspectionEnterpriseService.list(new LambdaQueryWrapper<XzSecurityQualityInspectionEnterprise>()
.in(XzSecurityQualityInspectionEnterprise::getEnterpriseId, enterpriseIds)).stream().map(XzSecurityQualityInspectionEnterprise::getInspectionId).collect(Collectors.toList()); .in(XzSecurityQualityInspectionEnterprise::getEnterpriseId, enterpriseIds)).stream().map(XzSecurityQualityInspectionEnterprise::getInspectionId).collect(Collectors.toList());
for (Long rid : rids) { rids.add(0L);
inExpression(rid.toString(), enterpriseIds, plainSelect); for (String item : filterXzSecurityEnterprises) {
inExpression(item, rids.stream().map(Convert::toStr).collect(Collectors.toList()), plainSelect);
} }
} }

View File

@ -183,7 +183,13 @@ public class IccCarCall implements CarManufacturer {
} }
getAndSetSubjectIfNotExist(subject); getAndSetSubjectIfNotExist(subject);
try { try {
IccHttpUtil.VehicleInfo vehicleInfo = IccHttpUtil.getCar(carInfo.getCarNumber(), config); IccHttpUtil.VehicleInfo vehicleInfo = null;
if (carInfo.getIccId() != null) {
vehicleInfo = IccHttpUtil.getCarById(carInfo.getIccId(), config);
}
if (vehicleInfo == null) {
vehicleInfo = IccHttpUtil.getCar(carInfo.getCarNumber(), config);
}
IccHttpUtil.CarInfoExt extCar = buildCarInfoExt(carInfo); IccHttpUtil.CarInfoExt extCar = buildCarInfoExt(carInfo);
//下发车辆包含拉黑 //下发车辆包含拉黑
if (vehicleInfo == null) { if (vehicleInfo == null) {

View File

@ -959,6 +959,28 @@ public class IccHttpUtil {
} }
} }
/**
* 通过ID查询车辆
*
* @param config
* @return
*/
public static VehicleInfo getCarById(Long iccId, ProjectCarCameraConfig config) {
try {
JSONObject params = new JSONObject();
params.put("iccId", iccId);
printReq(params, "通过ID查询车辆");
GeneralResponse response = HttpUtils.executeJson("/evo-apigw/ipms/car/find/" + iccId, null, null, Method.GET, getOauthConfig(config), GeneralResponse.class);
printResp(response, "通过ID查询车辆");
throwErrIf(response);
JSONObject jsonObject = Optional.ofNullable(JSON.parseObject(response.getResult())).map(m -> m.getJSONObject("data")).orElse(null);
return BeanUtil.toBean(jsonObject, VehicleInfo.class);
} catch (Exception e) {
throw new OpenAlertException("查询项目的车场(车场名称=项目名称)请求异常,请联系管理员", e);
}
}
/** /**
* 查询项目的车场车场名称=项目名称 * 查询项目的车场车场名称=项目名称
* *

View File

@ -41,6 +41,9 @@ import com.zhgd.xmgl.modules.risk.entity.RiskListRuleItem;
import com.zhgd.xmgl.modules.risk.service.IRiskListRuleItemService; import com.zhgd.xmgl.modules.risk.service.IRiskListRuleItemService;
import com.zhgd.xmgl.modules.risk.service.IRiskListRuleService; import com.zhgd.xmgl.modules.risk.service.IRiskListRuleService;
import com.zhgd.xmgl.modules.standard.mapper.StandardDevMapper; import com.zhgd.xmgl.modules.standard.mapper.StandardDevMapper;
import com.zhgd.xmgl.modules.xz.security.entity.XzSecurityDangerField;
import com.zhgd.xmgl.modules.xz.security.entity.vo.XzSecurityDangerFieldVo;
import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityDangerFieldService;
import com.zhgd.xmgl.util.ListUtils; import com.zhgd.xmgl.util.ListUtils;
import com.zhgd.xmgl.util.MapBuilder; import com.zhgd.xmgl.util.MapBuilder;
import com.zhgd.xmgl.util.MessageUtil; import com.zhgd.xmgl.util.MessageUtil;
@ -98,6 +101,9 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
@Lazy @Lazy
@Autowired @Autowired
private IRiskListRuleService riskListRuleService; private IRiskListRuleService riskListRuleService;
@Lazy
@Autowired
private IXzSecurityDangerFieldService xzSecurityDangerFieldService;
@Override @Override
public Map<String, Object> getCompanyType(Map<String, Object> map) { public Map<String, Object> getCompanyType(Map<String, Object> map) {
@ -752,6 +758,14 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
}); });
listRuleItems.forEach(riskListRuleItem -> riskListRuleItem.setSn(company.getHeadquartersSn())); listRuleItems.forEach(riskListRuleItem -> riskListRuleItem.setSn(company.getHeadquartersSn()));
riskListRuleItemService.saveBatch(listRuleItems); riskListRuleItemService.saveBatch(listRuleItems);
List<XzSecurityDangerFieldVo> fieldVos = JSON.parseArray(ResourceUtil.readUtf8Str("init/data/xzSecurityDangerField.json"), XzSecurityDangerFieldVo.class);
xzSecurityDangerFieldService.saveBatch(fieldVos.stream().map(o -> {
XzSecurityDangerField bean = BeanUtil.toBean(o, XzSecurityDangerField.class);
bean.setSn(company.getHeadquartersSn());
bean.setCompanyProjectType(1);
return bean;
}).collect(Collectors.toList()));
} }
private void checkParams(Company company) { private void checkParams(Company company) {

View File

@ -32,6 +32,8 @@
ei.enterprise_name, ei.enterprise_name,
p.project_name, p.project_name,
t.car_qr_code t.car_qr_code
,
t.icc_id
FROM car_info t FROM car_info t
join project p on p.project_sn = t.project_sn join project p on p.project_sn = t.project_sn
LEFT JOIN car_type b ON (t.car_type = b.id and t.project_sn = b.project_sn) LEFT JOIN car_type b ON (t.car_type = b.id and t.project_sn = b.project_sn)

View File

@ -90,7 +90,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -260,7 +259,13 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
if (StringUtils.isBlank(projectSn)) { if (StringUtils.isBlank(projectSn)) {
return null; return null;
} }
ProjectInfoExtVo info = redisRepository.getOrSetEx(PROJECT_PREFIX_KEY + projectSn, (() -> projectMapper.getProjectInfoBySn(map))); ProjectInfoExtVo info = redisRepository.getOrSetEx(PROJECT_PREFIX_KEY + projectSn, (() -> {
ProjectInfoExtVo projectInfoExtVo = projectMapper.getProjectInfoBySn(map);
if (projectInfoExtVo == null) {
throw new OpenAlertException("该项目不存在,请清除缓存再重试");
}
return projectInfoExtVo;
}));
if (info == null) { if (info == null) {
throw new NullPointerException(" 当前查询条件结果不存在!"); throw new NullPointerException(" 当前查询条件结果不存在!");
} }

View File

@ -68,6 +68,9 @@
left join project_enterprise pe on pe.enterprise_id = ei.id and pe.project_sn = qr.project_sn left join project_enterprise pe on pe.enterprise_id = ei.id and pe.project_sn = qr.project_sn
left join enterprise_type et on et.id = pe.enterprise_type_id left join enterprise_type et on et.id = pe.enterprise_type_id
WHERE 1=1 WHERE 1=1
<if test="regionName != null and regionName != ''">
and qr.region_name like CONCAT(CONCAT('%', #{regionName}), '%')
</if>
<if test="id != null and id != ''"> <if test="id != null and id != ''">
and qr.id = #{id} and qr.id = #{id}
</if> </if>

View File

@ -592,6 +592,7 @@ public class RiskListLibraryController {
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", required = false, dataType = "String"), @ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", required = false, dataType = "String"),
@ApiImplicitParam(name = "generateDefault", value = "1生成默认数据", paramType = "query", required = false, dataType = "String"), @ApiImplicitParam(name = "generateDefault", value = "1生成默认数据", paramType = "query", required = false, dataType = "String"),
@ApiImplicitParam(name = "projectType", value = "工程类别(字典值)", paramType = "query", required = false, dataType = "String"), @ApiImplicitParam(name = "projectType", value = "工程类别(字典值)", paramType = "query", required = false, dataType = "String"),
@ApiImplicitParam(name = "dynamicType", value = "1动态风险2静态风险", paramType = "query", required = false, dataType = "String"),
}) })
@GetMapping(value = "/tree/page") @GetMapping(value = "/tree/page")
public Result<IPage<RiskListLibraryVo>> queryTreePage(@ApiIgnore @RequestParam HashMap<String, Object> param) { public Result<IPage<RiskListLibraryVo>> queryTreePage(@ApiIgnore @RequestParam HashMap<String, Object> param) {

View File

@ -1,9 +1,12 @@
package com.zhgd.xmgl.modules.risk.controller; package com.zhgd.xmgl.modules.risk.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhgd.annotation.OperLog; import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.xmgl.modules.risk.entity.RiskListPotentialAccidentType; import com.zhgd.xmgl.modules.risk.entity.RiskListPotentialAccidentType;
import com.zhgd.xmgl.modules.risk.entity.bo.RiskListPotentialAccidentTypeBo;
import com.zhgd.xmgl.modules.risk.service.IRiskListPotentialAccidentTypeService; import com.zhgd.xmgl.modules.risk.service.IRiskListPotentialAccidentTypeService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
@ -11,14 +14,28 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.simpleframework.xml.core.Validate; import org.simpleframework.xml.core.Validate;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/** /**
@ -135,4 +152,77 @@ public class RiskListPotentialAccidentTypeController {
return result; return result;
} }
/**
* 导出excel
*/
@ApiOperation(value = "导出excel风险清单的潜在事故类型", notes = "导出excel风险清单的潜在事故类型", httpMethod = "POST")
@PostMapping(value = "/exportXls")
public ModelAndView exportXls(@RequestBody HashMap<String, Object> param) {
param.put("pageSize", -1);
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
List<RiskListPotentialAccidentType> pageList = riskListPotentialAccidentTypeService.queryList(param);
AtomicInteger i = new AtomicInteger();
List<RiskListPotentialAccidentTypeBo> typeBos = pageList.stream().map(o -> {
RiskListPotentialAccidentTypeBo bo = new RiskListPotentialAccidentTypeBo();
BeanUtil.copyProperties(o, bo);
bo.setNo(i.incrementAndGet());
return bo;
}).collect(Collectors.toList());
//导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "潜在事故类型");
mv.addObject(NormalExcelConstants.CLASS, RiskListPotentialAccidentTypeBo.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("潜在事故类型数据", "导出"));
mv.addObject(NormalExcelConstants.DATA_LIST, typeBos);
return mv;
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@ApiOperation(value = "通过excel导入风险清单的潜在事故类型", notes = "通过excel导入风险清单的潜在事故类型", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "file", value = "文件", paramType = "form", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "sn", value = "总企业sn", paramType = "form", required = true, dataType = "Integer"),
})
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response, @RequestParam HashMap<String, Object> param) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
String sn = MapUtils.getString(param, "sn");
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams();
params.setTitleRows(1);
params.setHeadRows(1);
params.setNeedSave(true);
try {
List<RiskListPotentialAccidentTypeBo> listStuffTypes = ExcelImportUtil.importExcel(file.getInputStream(), RiskListPotentialAccidentTypeBo.class, params);
listStuffTypes = CollUtil.reverse(listStuffTypes);
for (RiskListPotentialAccidentTypeBo bo : listStuffTypes) {
RiskListPotentialAccidentType stuffTypeExcel = new RiskListPotentialAccidentType();
BeanUtil.copyProperties(bo, stuffTypeExcel);
stuffTypeExcel.setSn(sn);
riskListPotentialAccidentTypeService.save(stuffTypeExcel);
}
return Result.ok("文件导入成功!数据行数:" + listStuffTypes.size());
} catch (Exception e) {
log.error(e.getMessage());
return Result.error("文件导入失败!");
} finally {
try {
file.getInputStream().close();
} catch (IOException e) {
log.error("error", e);
}
}
}
return Result.ok("文件导入失败!");
}
} }

View File

@ -415,8 +415,8 @@ public class RiskListSourceController {
@ApiImplicitParam(name = "detailIds", value = "风险清单详情ids多个,分割)", paramType = "body", required = false, dataType = "Integer"), @ApiImplicitParam(name = "detailIds", value = "风险清单详情ids多个,分割)", paramType = "body", required = false, dataType = "Integer"),
}) })
@PostMapping(value = "/identifySource") @PostMapping(value = "/identifySource")
@Transactional(rollbackFor = Exception.class)
public Result identifySource(@RequestBody @Validate HashMap<String, Object> param) { public Result identifySource(@RequestBody @Validate HashMap<String, Object> param) {
List<RiskListSource> addList = new ArrayList<>();
List<RiskListDetailVo> details = riskListDetailService.queryList(new MapBuilder<String, Object>() List<RiskListDetailVo> details = riskListDetailService.queryList(new MapBuilder<String, Object>()
.put("detailIds", MapUtils.getString(param, "detailIds")) .put("detailIds", MapUtils.getString(param, "detailIds"))
.build()); .build());
@ -433,8 +433,8 @@ public class RiskListSourceController {
source.setPointId(pointId); source.setPointId(pointId);
source.setCreateTime(new Date()); source.setCreateTime(new Date());
source.setUpdateTime(new Date()); source.setUpdateTime(new Date());
source.setEffectiveTimeBegin(source.getEffectiveTimeBegin()); source.setEffectiveTimeBegin(point.getEffectiveTimeBegin());
source.setEffectiveTimeEnd(source.getEffectiveTimeEnd()); source.setEffectiveTimeEnd(point.getEffectiveTimeEnd());
source.setIdentificationTime(new Date()); source.setIdentificationTime(new Date());
source.setProjectSn(point.getProjectSn()); source.setProjectSn(point.getProjectSn());
String[] pathSplit = detail.getFullPath().split("/"); String[] pathSplit = detail.getFullPath().split("/");
@ -442,10 +442,11 @@ public class RiskListSourceController {
source.setSubProjectWorkTask(pathSplit[3]); source.setSubProjectWorkTask(pathSplit[3]);
} }
source.setWorkNameContent(StrUtils.getLastSegments(detail.getFullPath(), 4)); source.setWorkNameContent(StrUtils.getLastSegments(detail.getFullPath(), 4));
addList.add(source); RiskListSourceDto sourceDto = new RiskListSourceDto();
} BeanUtils.copyProperties(source, sourceDto);
if (CollUtil.isNotEmpty(addList)) { sourceDto.setSpecificResponsibilityAreaIds(point.getSpecificResponsibilityAreaIds());
riskListSourceService.saveBatch(addList); sourceDto.setSpecificResponsibilityAreaNames(point.getSpecificResponsibilityAreaNames());
riskListSourceService.add(sourceDto);
} }
return Result.ok(); return Result.ok();
} }
@ -521,7 +522,13 @@ public class RiskListSourceController {
map.put("delete" + (i + 1), true); map.put("delete" + (i + 1), true);
} }
map.put("listMap", listMap); map.put("listMap", listMap);
templateUrl = Fileutils.getExportTemplateFile("excel/辨识清单导出模板.xlsx").getAbsolutePath(); String tempFileName;
if (Objects.equals(CollUtil.getFirst(sourceVos).getDynamicType(), 1)) {
tempFileName = "动态危险源辨识清单导出模板.xlsx";
} else {
tempFileName = "静态危险源辨识清单导出模板.xlsx";
}
templateUrl = Fileutils.getExportTemplateFile("excel/" + tempFileName).getAbsolutePath();
TemplateExportParams params = new TemplateExportParams(templateUrl); TemplateExportParams params = new TemplateExportParams(templateUrl);
Workbook workbook = ExcelExportUtil.exportExcel(params, map); Workbook workbook = ExcelExportUtil.exportExcel(params, map);
//合并列 //合并列
@ -530,7 +537,7 @@ public class RiskListSourceController {
for (int i = 0; i < maxCol; i++) { for (int i = 0; i < maxCol; i++) {
SheetUtils.mergeSameContentCol(sheet, i + 2, 1); SheetUtils.mergeSameContentCol(sheet, i + 2, 1);
} }
ExcelUtils.downLoadExcel("辨识清单导出模板.xlsx", response, workbook); ExcelUtils.downLoadExcel(tempFileName, response, workbook);
} catch (IOException e) { } catch (IOException e) {
log.error("", e); log.error("", e);
throw new OpenAlertException("系统错误"); throw new OpenAlertException("系统错误");

View File

@ -0,0 +1,21 @@
package com.zhgd.xmgl.modules.risk.entity.bo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
@Data
public class RiskListPotentialAccidentTypeBo {
/**
* 序号
*/
@ApiModelProperty(value = "序号")
@Excel(name = "序号", width = 15)
private java.lang.Integer no;
/**
* 类型
*/
@ApiModelProperty(value = "类型")
@Excel(name = "潜在事故类型", width = 15)
private java.lang.String type;
}

View File

@ -1,5 +1,6 @@
package com.zhgd.xmgl.modules.risk.entity.vo; package com.zhgd.xmgl.modules.risk.entity.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.zhgd.xmgl.modules.risk.entity.RiskListLibrary; import com.zhgd.xmgl.modules.risk.entity.RiskListLibrary;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -8,6 +9,7 @@ import java.util.List;
@Data @Data
public class RiskListLibraryVo extends RiskListLibrary { public class RiskListLibraryVo extends RiskListLibrary {
@TableField(exist = false)
@ApiModelProperty(value = "1动态风险2静态风险") @ApiModelProperty(value = "1动态风险2静态风险")
private java.lang.Integer dynamicType; private java.lang.Integer dynamicType;
@ApiModelProperty(value = "全路径名(/划分)") @ApiModelProperty(value = "全路径名(/划分)")

View File

@ -70,7 +70,7 @@ public class RiskListLibraryServiceImpl extends ServiceImpl<RiskListLibraryMappe
} }
private QueryWrapper<RiskListLibraryVo> getQueryWrapper(HashMap<String, Object> param) { private QueryWrapper<RiskListLibraryVo> getQueryWrapper(HashMap<String, Object> param) {
QueryWrapper<RiskListLibraryVo> queryWrapper = QueryGenerator.initPageQueryWrapper(RiskListLibraryVo.class, param, true); QueryWrapper<RiskListLibraryVo> queryWrapper = QueryGenerator.initPageQueryWrapper(RiskListLibraryVo.class, param, false);
queryWrapper.orderByAsc(RefUtil.fieldNameUlc(RiskListLibraryVo::getId)); queryWrapper.orderByAsc(RefUtil.fieldNameUlc(RiskListLibraryVo::getId));
return queryWrapper; return queryWrapper;
} }
@ -215,6 +215,16 @@ public class RiskListLibraryServiceImpl extends ServiceImpl<RiskListLibraryMappe
pageSize = Integer.MAX_VALUE; pageSize = Integer.MAX_VALUE;
} }
List<RiskListLibraryVo> vos = BeanUtil.copyToList(ListUtils.listToTree(JSONArray.parseArray(JSON.toJSONString(list)), "id", "parentId", "children"), RiskListLibraryVo.class); List<RiskListLibraryVo> vos = BeanUtil.copyToList(ListUtils.listToTree(JSONArray.parseArray(JSON.toJSONString(list)), "id", "parentId", "children"), RiskListLibraryVo.class);
//1动态风险2静态风险
Integer dynamicType = MapUtils.getInteger(param, "dynamicType");
if (Objects.nonNull(dynamicType)) {
for (RiskListLibraryVo vo : vos) {
List<RiskListLibraryVo> children = vo.getChildren();
if (CollUtil.isNotEmpty(children)) {
vo.setChildren(children.stream().filter(o -> Objects.equals(o.getNodeName(), Objects.equals(dynamicType, 1) ? "动态风险" : "静态风险")).collect(Collectors.toList()));
}
}
}
int i = cn.hutool.core.util.PageUtil.getStart(pageNo - 1, pageSize); int i = cn.hutool.core.util.PageUtil.getStart(pageNo - 1, pageSize);
List<RiskListLibraryVo> records = CollUtil.sub(vos, i, i + pageSize); List<RiskListLibraryVo> records = CollUtil.sub(vos, i, i + pageSize);
IPage<RiskListLibraryVo> p = new Page<>(); IPage<RiskListLibraryVo> p = new Page<>();

View File

@ -302,7 +302,7 @@ public class RiskListSourceServiceImpl extends ServiceImpl<RiskListSourceMapper,
* 保存绑定的数据 * 保存绑定的数据
* *
* @param sourceId * @param sourceId
* @param specificResponsibilityAreaIds * @param specificResponsibilityAreaIds 责任区域ids
*/ */
@Override @Override
public void saveBindData(Long sourceId, String specificResponsibilityAreaIds) { public void saveBindData(Long sourceId, String specificResponsibilityAreaIds) {

View File

@ -15,6 +15,7 @@ import com.zhgd.xmgl.modules.worker.entity.DepartmentInfo;
import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo; import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo;
import com.zhgd.xmgl.modules.worker.entity.SjEnterpriseInfo; import com.zhgd.xmgl.modules.worker.entity.SjEnterpriseInfo;
import com.zhgd.xmgl.modules.worker.entity.TeamInfo; import com.zhgd.xmgl.modules.worker.entity.TeamInfo;
import com.zhgd.xmgl.modules.worker.entity.vo.EnterpriseDepartmentTeamStaticsVo;
import com.zhgd.xmgl.modules.worker.entity.vo.EnterpriseDepartmentTeamTreeVo; import com.zhgd.xmgl.modules.worker.entity.vo.EnterpriseDepartmentTeamTreeVo;
import com.zhgd.xmgl.modules.worker.entity.vo.StatsEnterpriseWeekVo; import com.zhgd.xmgl.modules.worker.entity.vo.StatsEnterpriseWeekVo;
import com.zhgd.xmgl.modules.worker.service.IDepartmentInfoService; import com.zhgd.xmgl.modules.worker.service.IDepartmentInfoService;
@ -273,6 +274,18 @@ public class EnterpriseInfoController {
}) })
@PostMapping(value = "/getEnterpriseDepartmentTeamTree") @PostMapping(value = "/getEnterpriseDepartmentTeamTree")
public Result<List<EnterpriseDepartmentTeamTreeVo>> getEnterpriseDepartmentTeamTree(@ApiIgnore @RequestBody Map<String, Object> param) { public Result<List<EnterpriseDepartmentTeamTreeVo>> getEnterpriseDepartmentTeamTree(@ApiIgnore @RequestBody Map<String, Object> param) {
List<EnterpriseDepartmentTeamTreeVo> all = doGetEnterpriseDepartmentTeamVos(param);
List<EnterpriseDepartmentTeamTreeVo> vos = BeanUtil.copyToList(ListUtils.listToTree(JSONArray.parseArray(JSON.toJSONString(all)), "uniqueId", "parentId", "children"), EnterpriseDepartmentTeamTreeVo.class);
return Result.success(vos);
}
/**
* 查询单位部门班组列表
*
* @param param
* @return
*/
private List<EnterpriseDepartmentTeamTreeVo> doGetEnterpriseDepartmentTeamVos(Map<String, Object> param) {
String projectSn = MapUtils.getString(param, "projectSn"); String projectSn = MapUtils.getString(param, "projectSn");
String name = MapUtils.getString(param, "name"); String name = MapUtils.getString(param, "name");
List<EnterpriseDepartmentTeamTreeVo> all = new ArrayList<>(); List<EnterpriseDepartmentTeamTreeVo> all = new ArrayList<>();
@ -318,8 +331,22 @@ public class EnterpriseInfoController {
if (StrUtil.isNotBlank(name)) { if (StrUtil.isNotBlank(name)) {
all = all.stream().filter(vo -> vo.getName().contains(name)).collect(Collectors.toList()); all = all.stream().filter(vo -> vo.getName().contains(name)).collect(Collectors.toList());
} }
List<EnterpriseDepartmentTeamTreeVo> vos = BeanUtil.copyToList(ListUtils.listToTree(JSONArray.parseArray(JSON.toJSONString(all)), "uniqueId", "parentId", "children"), EnterpriseDepartmentTeamTreeVo.class); return all;
return Result.success(vos);
} }
@ApiOperation(value = "统计单位部门班组数量", notes = "统计单位部门班组数量", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "enterpriseTypeId", value = "企业类型", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "name", value = "名称", paramType = "body", required = false, dataType = "String"),
})
@PostMapping(value = "/getEnterpriseDepartmentTeamStatics")
public Result<EnterpriseDepartmentTeamStaticsVo> getEnterpriseDepartmentTeamStatics(@ApiIgnore @RequestBody Map<String, Object> param) {
List<EnterpriseDepartmentTeamTreeVo> list = doGetEnterpriseDepartmentTeamVos(param);
EnterpriseDepartmentTeamStaticsVo vo = new EnterpriseDepartmentTeamStaticsVo();
vo.setEnterpriseNum((int) list.stream().filter(v -> Objects.equals(v.getCategory(), 1)).count());
vo.setDepartmentNum((int) list.stream().filter(v -> Objects.equals(v.getCategory(), 2)).count());
vo.setTeamNum((int) list.stream().filter(v -> Objects.equals(v.getCategory(), 3)).count());
return Result.success(vo);
}
} }

View File

@ -498,6 +498,12 @@ public class WorkerDailyAttendanceStatisticsV2Controller {
@ApiImplicitParam(name = "attendanceDate", value = "考勤日期yyyy-MM-dd", paramType = "body", required = true, dataType = "String"), @ApiImplicitParam(name = "attendanceDate", value = "考勤日期yyyy-MM-dd", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "body", required = true, dataType = "Integer"), @ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "body", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "body", required = true, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "body", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "enterpriseTypeId", value = "企业类型id", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "enterpriseId", value = "所属企业id", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "teamId", value = "班组ID", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "departmentId", value = "部门ID", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "inserviceType", value = "在职状态 1在职 2离职", paramType = "body", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "containEnterpriseId", value = "包含下级的单位的人员的单位id", paramType = "body", required = false, dataType = "String"),
}) })
@PostMapping(value = "/getWorkerDailyAttendancePageByDate") @PostMapping(value = "/getWorkerDailyAttendancePageByDate")
public Result<IPage<WorkerDailyAttendancesByDateVo>> getWorkerDailyAttendancePageByDate(@RequestBody HashMap<String, Object> param) { public Result<IPage<WorkerDailyAttendancesByDateVo>> getWorkerDailyAttendancePageByDate(@RequestBody HashMap<String, Object> param) {
@ -506,6 +512,8 @@ public class WorkerDailyAttendanceStatisticsV2Controller {
} }
/** /**
* 分页查询考勤日报列表
*
* @param param * @param param
* @return * @return
*/ */
@ -513,7 +521,9 @@ public class WorkerDailyAttendanceStatisticsV2Controller {
String projectSn = MapUtils.getString(param, "projectSn"); String projectSn = MapUtils.getString(param, "projectSn");
String attendanceDate = MapUtils.getString(param, "attendanceDate"); String attendanceDate = MapUtils.getString(param, "attendanceDate");
param.put("addTime_end", attendanceDate); param.put("addTime_end", attendanceDate);
IPage<WorkerInfo> workerInfoList = workerInfoService.selectWorkerInfoList(param); Map queryWorkerParam = BeanUtil.toBean(param, Map.class);
queryWorkerParam.put("inserviceType", null);
IPage<WorkerInfo> workerInfoList = workerInfoService.selectWorkerInfoList(queryWorkerParam);
Map<String, WorkerDailyAttendanceStatisticsV2Vo> personSnMap = workerDailyAttendanceStatisticsV2Service.queryList(param).stream() Map<String, WorkerDailyAttendanceStatisticsV2Vo> personSnMap = workerDailyAttendanceStatisticsV2Service.queryList(param).stream()
.collect(Collectors.toMap(WorkerDailyAttendanceStatisticsV2::getPersonSn, Function.identity())); .collect(Collectors.toMap(WorkerDailyAttendanceStatisticsV2::getPersonSn, Function.identity()));
Map<String, List<WorkerAttendance>> personSn2AttendancesMap = workerAttendanceService.list(new LambdaQueryWrapper<WorkerAttendance>() Map<String, List<WorkerAttendance>> personSn2AttendancesMap = workerAttendanceService.list(new LambdaQueryWrapper<WorkerAttendance>()
@ -584,7 +594,7 @@ public class WorkerDailyAttendanceStatisticsV2Controller {
vo.setInServiceCount((int) vos.stream().filter(v -> Objects.equals(v.getInserviceType(), 1)).count()); vo.setInServiceCount((int) vos.stream().filter(v -> Objects.equals(v.getInserviceType(), 1)).count());
vo.setAttendanceCount((int) vos.stream().filter(v -> Objects.equals(v.getIsAttendance(), 1)).count()); vo.setAttendanceCount((int) vos.stream().filter(v -> Objects.equals(v.getIsAttendance(), 1)).count());
vo.setAbsentCount((int) vos.stream().filter(v -> Objects.equals(v.getIsAttendance(), 0)).count()); vo.setAbsentCount((int) vos.stream().filter(v -> Objects.equals(v.getIsAttendance(), 0)).count());
vo.setAttendanceRate(Objects.nonNull(vo.getInServiceCount()) ? NumberUtil.mul(NumberUtil.div(vo.getAttendanceCount(), vo.getInServiceCount(), 4), new BigDecimal("100")) : null); vo.setAttendanceRate((Objects.nonNull(vo.getInServiceCount()) && !vo.getInServiceCount().equals(0)) ? NumberUtil.mul(NumberUtil.div(vo.getAttendanceCount(), vo.getInServiceCount(), 4), new BigDecimal("100")) : null);
param.put("addTime_end", null); param.put("addTime_end", null);
param.put("exitDate_begin", attendanceDate); param.put("exitDate_begin", attendanceDate);
param.put("exitDate_end", attendanceDate); param.put("exitDate_end", attendanceDate);

View File

@ -0,0 +1,24 @@
package com.zhgd.xmgl.modules.worker.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class EnterpriseDepartmentTeamStaticsVo {
/**
* 单位数量
*/
@ApiModelProperty("单位数量")
private Integer enterpriseNum;
/**
* 部门数量
*/
@ApiModelProperty("部门数量")
private Integer departmentNum;
/**
* 班组数量
*/
@ApiModelProperty("班组数量")
private Integer teamNum;
}

View File

@ -6,7 +6,6 @@ import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baidubce.services.iotshc.model.token.GetTokenRequest;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zhgd.xmgl.modules.electrical.entity.ElectricalData; import com.zhgd.xmgl.modules.electrical.entity.ElectricalData;
import com.zhgd.xmgl.modules.electrical.entity.ElectricalDev; import com.zhgd.xmgl.modules.electrical.entity.ElectricalDev;