包头bug修改

This commit is contained in:
guoshengxiong 2025-04-09 19:11:32 +08:00
parent 62bc4fd109
commit ed46d50732
18 changed files with 383 additions and 164 deletions

View File

@ -1,5 +1,9 @@
package com.zhgd.xmgl.modules.baotou.controller;
import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
@ -15,6 +19,11 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.io.IOUtils;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.simpleframework.xml.core.Validate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
@ -25,10 +34,13 @@ import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
@ -219,18 +231,61 @@ public class ContractorMonthlyDetailController {
return Result.success(contractorMonthlyDetailService.countQuantityExcel(param));
}
@ApiOperation(value = "月报周报html转word", notes = "月报周报html转word", httpMethod = "POST")
@ApiOperation(value = "导出excel", notes = "导出excel", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "file", value = "file", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "content", value = "excel的json", paramType = "body", required = true, dataType = "String"),
})
@PostMapping(value = "/html2Word")
public void html2Word(HttpServletResponse response, MultipartFile file) {
@PostMapping(value = "/exportExcel")
public void exportExcel(HttpServletResponse response, @RequestBody HashMap<String, Object> map) {
XSSFWorkbook workbook = null;
try {
String html = IOUtils.toString(file.getInputStream(), StandardCharsets.UTF_8);
WordUtils.html2Word(response, html);
} catch (IOException e) {
// 1. 创建工作簿
workbook = new XSSFWorkbook();
// 2. 创建工作表
XSSFSheet sheet = workbook.createSheet("Sheet1");
//填充数据设置边框
JSONObject root = JSON.parseObject(MapUtils.getString(map, "content"));
JSONObject sheets = root.getJSONObject("sheets");
JSONObject readSheet = (JSONObject) (sheets.entrySet().iterator().next().getValue());
JSONObject cellData = readSheet.getJSONObject("cellData");
for (Map.Entry<String, Object> readRow : cellData.entrySet()) {
JSONObject cols = (JSONObject) readRow.getValue();
XSSFRow r = sheet.createRow(Convert.toInt(readRow.getKey()));
for (Map.Entry<String, Object> readCol : cols.entrySet()) {
JSONObject col = (JSONObject) readCol.getValue();
Integer columnIndex = Convert.toInt(readCol.getKey());
r.createCell(columnIndex).setCellValue(col.getString("v"));
XSSFCell cell = r.getCell(columnIndex);
//设置边框
// r.setRowStyle();
}
}
//合并单元格
JSONArray mergeDatas = readSheet.getJSONArray("mergeData");
for (int i = 0; i < mergeDatas.size(); i++) {
JSONObject mergeData = mergeDatas.getJSONObject(i);
sheet.addMergedRegion(new CellRangeAddress(mergeData.getInteger("startRow"), mergeData.getInteger("endRow"), mergeData.getInteger("startColumn"), mergeData.getInteger("endColumn")));
}
// 5. 设置响应头
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("导出", "UTF-8"));
// 6. 输出到客户端
workbook.write(response.getOutputStream());
} catch (Exception e) {
log.error("", e);
} finally {
try {
if (workbook != null) {
workbook.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

View File

@ -134,7 +134,7 @@ public class DeviceUnitController {
@OperLog(operModul = "装置管理管理", operType = "", operDesc = "根据施工或epc单位查询epc承包商列表")
@ApiOperation(value = "根据施工或epc单位查询epc承包商列表", notes = "根据施工或epc单位查询epc承包商列表", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "enterpriseId", value = "单位ID", paramType = "query", required = true, dataType = "String"),
@ApiImplicitParam(name = "enterpriseId", value = "单位ID", paramType = "query", required = false, dataType = "String"),
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "query", required = true, dataType = "String"),
})
@GetMapping(value = "/getEpcList")

View File

@ -6,6 +6,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IORuntimeException;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil;
@ -304,7 +305,6 @@ public class WorkerAdmissionController {
throw new OpenAlertException("" + StrUtil.join(",", existNums) + "】编号已存在");
}
}
Map<Long, DictionariesRecord> allCeNameMap = dictionariesRecordService.selectCertTypeList(new MapBuilder<String, Object>().build()).stream().collect(Collectors.toMap(DictionariesRecord::getId, Function.identity(), (o1, o2) -> o1));
if (CollUtil.isNotEmpty(tableList)) {
List<String> errs = new ArrayList<>();
Map<Long, PostWorkType> typeMap = postWorkTypeService.list(new LambdaQueryWrapper<PostWorkType>()
@ -316,17 +316,30 @@ public class WorkerAdmissionController {
Long workerType = jo.getJSONArray("field3008722075250").getLong(0);
PostWorkType type = typeMap.get(workerType);
if (type != null) {
//需要证书
if (JSON.parseArray(jo.getString("field5960144013031")).size() == 0) {
errs.add(jo.getString("field1767683295945") + "需要上传" + type.getPostWorkTypeName() + "资质证");
//需要上传证书
String workerName = jo.getString("field1767683295945");
if (jo.getString("field5960144013031") == null || JSON.parseArray(jo.getString("field5960144013031")).size() == 0) {
errs.add(workerName + "需要上传" + type.getPostWorkTypeName() + "资质证");
}
if (JSON.parseArray(jo.getString("field5342644024091")).size() == 0) {
errs.add(jo.getString("field1767683295945") + "需要上传" + type.getPostWorkTypeName() + "资质验证");
if (jo.getString("field5342644024091") == null || FlowUtil.isBlank(jo.getString("field5342644024091"))) {
errs.add(workerName + "需要上传" + type.getPostWorkTypeName() + "资质验证");
}
if (StrUtil.isBlank(jo.getString("field9354421203736"))) {
errs.add(workerName + "需要填写资格证号");
}
if (FlowUtil.isBlank(jo.getString("field1492921345638"))) {
errs.add(workerName + "需要选择发证机关");
}
if (StrUtil.isBlank(jo.getString("field2436120887995"))) {
errs.add(workerName + "需要填写取证日期");
}
if (StrUtil.isBlank(jo.getString("field7888920890828"))) {
errs.add(workerName + "需要填写截止日期");
}
}
}
if (CollUtil.isNotEmpty(errs)) {
throw new OpenAlertException(StrUtil.join("", errs));
if (CollUtil.isNotEmpty(errs)) {
throw new OpenAlertException(StrUtil.join("", errs));
}
}
}
return Result.ok();
@ -428,9 +441,11 @@ public class WorkerAdmissionController {
if (CollUtil.isNotEmpty(l)) {
WorkerAdmissionCertificateDetail d = l.get(0);
String certificateNumber = d.getCertificateNumber();
Integer issueCompany = d.getIssueCompany();
dm.put("certificateNumber", certificateNumber + "" + getIssueCompany(issueCompany));
//dm.put("issueCompany", getIssueCompany(issueCompany));
String issueCompany = getIssueCompany(d.getIssueCompany());
if (StrUtil.isNotBlank(certificateNumber) || StrUtil.isNotBlank(issueCompany)) {
List<String> list = Arrays.asList(certificateNumber, issueCompany).stream().filter(Objects::nonNull).collect(Collectors.toList());
dm.put("certificateNumber", StrUtil.join("", list));
}
}
listMap.add(dm);
}
@ -646,17 +661,25 @@ public class WorkerAdmissionController {
* @param con
*/
private void setUploadFileName(File unzip, Map<String, UploadZipWorkAdmissionVo> nameIdCardMap, String name, Consumer<Pair<UploadZipWorkAdmissionVo, String>> con) {
List<String> list = FileUtil.listFileNames(unzip.getAbsolutePath() + "/" + name);
for (String filename : list) {
UploadZipWorkAdmissionVo vo = nameIdCardMap.get(StringUtils.substringBeforeLast(new File(filename).getName(), "."));
if (vo != null) {
String path = minioUtils.uploadGetName(new File(new File(unzip.getAbsolutePath(), name), filename).getAbsolutePath(), true);
HashMap<String, Object> map = new MapBuilder<String, Object>()
.put("name", filename)
.put("url", path)
.build();
con.accept(new ImmutablePair<UploadZipWorkAdmissionVo, String>(vo, JSON.toJSONString(map)));
try {
String path1 = unzip.getAbsolutePath() + "/" + name;
if (!FileUtil.exist(path1)) {
return;
}
List<String> list = FileUtil.listFileNames(path1);
for (String filename : list) {
UploadZipWorkAdmissionVo vo = nameIdCardMap.get(StringUtils.substringBeforeLast(new File(filename).getName(), "."));
if (vo != null) {
String path = minioUtils.uploadGetName(new File(new File(unzip.getAbsolutePath(), name), filename).getAbsolutePath(), true);
HashMap<String, Object> map = new MapBuilder<String, Object>()
.put("name", filename)
.put("url", path)
.build();
con.accept(new ImmutablePair<UploadZipWorkAdmissionVo, String>(vo, JSON.toJSONString(map)));
}
}
} catch (IORuntimeException e) {
log.error("", e);
}
}

View File

@ -53,9 +53,6 @@ public class AnticorrosionEntrust implements Serializable {
/**
* 填报时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "填报时间")
private java.util.Date reportingTime;
/**
* 填报人

View File

@ -135,29 +135,29 @@ public class ConstructionEquipmentTool implements Serializable {
@TableField(exist = false)
@ApiModelProperty(value="施工设备机具分类名称")
private String classificationName ;
@TableField(exist = false)
@ApiModelProperty(value="设备管理员名称")
private java.lang.String equipmentManagerName ;
@TableField(exist = false)
@ApiModelProperty(value="进场经办人名称")
private java.lang.String onSiteHandlerName ;
@TableField(exist = false)
@ApiModelProperty(value="施工单位人员名称")
private java.lang.String constructionUnitPersonnelName ;
@TableField(exist = false)
@ApiModelProperty(value = "EPC安全人员名称")
private java.lang.String epcSafetyPersonnelName;
@TableField(exist = false)
@ApiModelProperty(value = "监理安全人员名称")
private java.lang.String supervisionSafetyPersonnelName;
@TableField(exist = false)
@ApiModelProperty(value = "项目安全经理名称")
private java.lang.String projectSafetySupervisionName;
@TableField(exist = false)
@ApiModelProperty(value = "安质环部设备工程师名称")
private java.lang.String safetyQualityDepartmentName;
@TableField(exist = false)
@ApiModelProperty(value = "所属单位")
private String classificationName;
@TableField(exist = false)
@ApiModelProperty(value = "设备管理员名称")
private java.lang.String equipmentManagerName;
@TableField(exist = false)
@ApiModelProperty(value = "进场经办人名称")
private java.lang.String onSiteHandlerName;
@TableField(exist = false)
@ApiModelProperty(value = "施工单位人员名称")
private java.lang.String constructionUnitPersonnelName;
@TableField(exist = false)
@ApiModelProperty(value = "EPC安全人员名称")
private java.lang.String epcSafetyPersonnelName;
@TableField(exist = false)
@ApiModelProperty(value = "监理安全人员名称")
private java.lang.String supervisionSafetyPersonnelName;
@TableField(exist = false)
@ApiModelProperty(value = "项目安全经理名称")
private java.lang.String projectSafetySupervisionName;
@TableField(exist = false)
@ApiModelProperty(value = "安质环部设备工程师名称")
private java.lang.String safetyQualityDepartmentName;
@TableField(exist = false)
@ApiModelProperty(value = "所属单位名称")
private java.lang.String equipmentSourceUnitName ;
}

View File

@ -44,29 +44,44 @@ public class ConstructionProjectQualityPrevention implements Serializable {
@ApiModelProperty(value="批 准")
private java.lang.Long approval ;
/**批准日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@ApiModelProperty(value="批准日期")
private java.util.Date approvalDate ;
/**施工承包商*/
@ApiModelProperty(value="施工承包商")
private java.lang.Long constructionContractor ;
/**单位工程*/
@ApiModelProperty(value="单位工程")
private java.lang.String unitProject ;
/**涉及技术专业:1:土建;2:管道;3:设备;4:电气;5:仪表;6:其他;*/
@ApiModelProperty(value="涉及技术专业:1:土建;2:管道;3:设备;4:电气;5:仪表;6:其他;")
private java.lang.Integer technicalSpecialtiesInvolved ;
/**技术负责人*/
@ApiModelProperty(value="技术负责人")
private java.lang.Long technicalPersonInCharge ;
/**涉及操作班组*/
@ApiModelProperty(value="涉及操作班组")
private java.lang.String operationTeamInvolved ;
/**明细表*/
@ApiModelProperty(value="明细表")
private java.lang.String detailedList ;
/**选择明细表*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "批准日期")
private java.util.Date approvalDate;
/**
* 施工承包商
*/
@ApiModelProperty(value = "施工承包商")
private java.lang.Long constructionContractor;
/**
* 单位工程
*/
@ApiModelProperty(value = "单位工程")
private java.lang.String unitProject;
/**
* 涉及技术专业:1:土建;2:管道;3:动设备;4:静设备;5:电气;6:仪表;
*/
@Excel(name = "涉及技术专业", width = 15, replace = {"土建_1", "管道_2", "动设备_3", "静设备_4", "电气_5", "仪表_6"})
@ApiModelProperty(value = "涉及技术专业:1:土建;2:管道;3:动设备;4:静设备;5:电气;6:仪表;")
private java.lang.Integer technicalSpecialtiesInvolved;
/**
* 技术负责人
*/
@ApiModelProperty(value = "技术负责人")
private java.lang.Long technicalPersonInCharge;
/**
* 涉及操作班组
*/
@ApiModelProperty(value = "涉及操作班组")
private java.lang.String operationTeamInvolved;
/**
* 明细表
*/
@ApiModelProperty(value = "明细表")
private java.lang.String detailedList;
/**
* 选择明细表
*/
@ApiModelProperty(value="选择明细表")
private java.lang.String selectDetailedList ;

View File

@ -41,29 +41,40 @@ public class EngineerControllerCheck implements Serializable {
@ApiModelProperty(value="装置/单元工程")
private java.lang.Long deviceUnitProject ;
@ApiModelProperty(value="项目组")
private java.lang.Long projectGroup ;
/**单元号*/
@ApiModelProperty(value="单元号")
private java.lang.String unitNumber ;
/**EPC承包商*/
@ApiModelProperty(value="EPC承包商")
private java.lang.Long epcContractor ;
/**施工单位*/
@ApiModelProperty(value="施工单位")
private java.lang.Long constructionUnit ;
/**涉及技术专业:1:土建;2:管道;3:设备;4:电气;5:仪表;6:其他;*/
@ApiModelProperty(value="涉及技术专业:1:土建;2:管道;3:设备;4:电气;5:仪表;6:其他;")
private java.lang.Integer technicalExpertiseInvolved ;
/**联系人*/
@ApiModelProperty(value="联系人")
private java.lang.Long contactPerson ;
/**联系人电话*/
@ApiModelProperty(value="联系人电话")
private java.lang.String contactPhoneNumber ;
/**检查、检测时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value="检查、检测时间")
private java.lang.Long projectGroup;
/**
* 单元号
*/
@ApiModelProperty(value = "单元号")
private java.lang.String unitNumber;
/**
* EPC承包商
*/
@ApiModelProperty(value = "EPC承包商")
private java.lang.Long epcContractor;
/**
* 施工单位
*/
@ApiModelProperty(value = "施工单位")
private java.lang.Long constructionUnit;
@ApiModelProperty(value = "涉及技术专业:1:土建;2:管道;3:动设备;4:静设备;5:电气;6:仪表;")
private java.lang.Integer technicalExpertiseInvolved;
/**
* 联系人
*/
@ApiModelProperty(value = "联系人")
private java.lang.Long contactPerson;
/**
* 联系人电话
*/
@ApiModelProperty(value = "联系人电话")
private java.lang.String contactPhoneNumber;
/**
* 检查检测时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "检查、检测时间")
private java.util.Date inspectionAndTestingTime ;
/**检查、检测地点*/
@ApiModelProperty(value="检查、检测地点")

View File

@ -127,7 +127,7 @@ public class EngineerControllerLevel implements Serializable {
private java.lang.Long projectManager;
@ApiModelProperty(value = "施工部专业负责人")
private java.lang.Long constructionDepartmentProfessionalDirector;
@ApiModelProperty(value = "专业:1:土建工程;2:土建特种;3:静设备工程;4:动设备工程;5:管道工程;6:电气工程;7:仪表工程;8:其他;")
@ApiModelProperty(value = "专业:2:土建;3:静设备工程;4:动设备工程;5:管道工程;6:电气工程;7:仪表工程;8:其他;")
private java.lang.String major;
@TableField(exist = false)
@ApiModelProperty(value = "编制名称")

View File

@ -87,10 +87,10 @@ public class FirstExampleManage implements Serializable {
@ApiModelProperty(value = "首件样板视频")
private java.lang.String firstExampleVideo;
/**
* 涉及技术作业1:土建;2:动设备;3:静设备;4:管道;5:电气;6:仪表;7:其他;
* 涉及技术作业1:土建;2:动设备;3:静设备;4:管道;5:电气;6:仪表;
*/
@Excel(name = "涉及技术作业1:土建;2:动设备;3:静设备;4:管道;5:电气;6:仪表;7:其他;", width = 15)
@ApiModelProperty(value = "涉及技术作业1:土建;2:动设备;3:静设备;4:管道;5:电气;6:仪表;7:其他;")
@Excel(name = "涉及技术作业1:土建;2:动设备;3:静设备;4:管道;5:电气;6:仪表;", width = 15)
@ApiModelProperty(value = "涉及技术作业1:土建;2:动设备;3:静设备;4:管道;5:电气;6:仪表;")
private java.lang.Integer technicalOperation;
/**
* 所属项目SN

View File

@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.List;
@ -79,6 +81,13 @@ public class QualityAcceptance implements Serializable {
*/
@ApiModelProperty(value = "更新时间")
private java.util.Date updateTime;
/**
* 验收时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "验收时间")
private java.util.Date receptionTime;
@TableField(exist = false)
private java.lang.String deviceName;

View File

@ -83,7 +83,7 @@ public class UnitEngineerOpen implements Serializable {
/**
* 涉及技术专业
*/
@ApiModelProperty(value="涉及技术专业:1:土建;2:管道;3:设备;4:电气;5:仪表;6:其他;")
@ApiModelProperty(value = "涉及技术专业:1:土建;2:管道;3:设备;4:电气;5:仪表;")
private java.lang.Integer technicalExpertiseInvolved ;
/**
* 开工内容

View File

@ -178,7 +178,7 @@ public class DeviceUnitServiceImpl extends ServiceImpl<DeviceUnitMapper, DeviceU
if (StrUtil.isBlank(enterpriseId)) {
//查询分配的epc列表
List<DeviceUnit> deviceUnits = this.queryList(new MapBuilder<String, Object>()
.put("seeI", 1)
// .put("seeI", 1)
.put("projectSn", projectSn)
.build());
List<String> enterpriseIds = deviceUnits.stream().filter(o -> StrUtil.isNotBlank(o.getEpcContractorIds())).flatMap(o -> {
@ -188,7 +188,7 @@ public class DeviceUnitServiceImpl extends ServiceImpl<DeviceUnitMapper, DeviceU
return new ArrayList<>();
} else {
return enterpriseInfoService.list(new LambdaQueryWrapper<EnterpriseInfo>()
.in(EnterpriseInfo::getId, enterpriseIds));
.in(EnterpriseInfo::getId, enterpriseIds).last(Cts.IGNORE_DATA_SCOPE_CONDITION));
}
} else {
//根据施工或epc单位查询epc承包商列表

View File

@ -59,7 +59,7 @@ public class EngineerControllerCheckServiceImpl extends ServiceImpl<EngineerCont
if (CollUtil.isNotEmpty(list)) {
for (EngineerControllerCheck check : list) {
if (check.getTechnicalExpertiseInvolved() != null) {
String[] ts = {"土建", "管道", "设备", "电气", "仪表", "其他"};
String[] ts = {"土建", "管道", "动设备", "设备", "电气", "仪表"};
check.setTechnicalExpertiseInvolvedName(ts[check.getTechnicalExpertiseInvolved() - 1]);
}
}
@ -98,7 +98,7 @@ public class EngineerControllerCheckServiceImpl extends ServiceImpl<EngineerCont
throw new OpenAlertException("未找到对应实体");
}
if (entity.getTechnicalExpertiseInvolved() != null) {
String[] ts = {"土建", "管道", "设备", "电气", "仪表", "其他"};
String[] ts = {"土建", "管道", "动设备", "设备", "电气", "仪表"};
entity.setTechnicalExpertiseInvolvedName(ts[entity.getTechnicalExpertiseInvolved() - 1]);
}
return entity;

View File

@ -1,41 +1,51 @@
package com.zhgd.xmgl.modules.baotou.service.impl;
import java.util.Date;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.xmgl.modules.baotou.entity.UnitProjectDivisionApplication;
import com.zhgd.xmgl.modules.baotou.mapper.UnitProjectDivisionApplicationMapper;
import com.zhgd.xmgl.modules.baotou.service.IUnitProjectDivisionApplicationService;
import com.zhgd.xmgl.util.FlowUtil;
import org.springframework.stereotype.Service;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.util.PageUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.modules.baotou.entity.QualityAcceptance;
import com.zhgd.xmgl.modules.baotou.entity.UnitProjectDivisionApplication;
import com.zhgd.xmgl.modules.baotou.mapper.UnitProjectDivisionApplicationMapper;
import com.zhgd.xmgl.modules.baotou.service.IQualityAcceptanceService;
import com.zhgd.xmgl.modules.baotou.service.IUnitProjectDivisionApplicationService;
import com.zhgd.xmgl.util.FlowUtil;
import com.zhgd.xmgl.util.PageUtil;
import com.zhgd.xmgl.util.RefUtil;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
/**
* @Description: 单位工程划分报审表
* @author pds
* @date 2FlowUtil.getInteger(map,")24-12-11
* @version V1.FlowUtil.getInteger(map,")
* @date 2FlowUtil.getInteger(map, ")24-12-11
* @version V1.FlowUtil.getInteger(map, ")
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class UnitProjectDivisionApplicationServiceImpl extends ServiceImpl<UnitProjectDivisionApplicationMapper, UnitProjectDivisionApplication> implements IUnitProjectDivisionApplicationService {
@Autowired
private UnitProjectDivisionApplicationMapper unitProjectDivisionApplicationMapper;
@Lazy
@Autowired
private IQualityAcceptanceService qualityAcceptanceService;
@Override
public IPage<UnitProjectDivisionApplication> queryPageList(HashMap<String, Object> param) {
QueryWrapper<UnitProjectDivisionApplication> queryWrapper = this.getQueryWrapper(param);
Page<UnitProjectDivisionApplication> page = PageUtil.getPage(param);
IPage<UnitProjectDivisionApplication> pageList = baseMapper.queryList(page, queryWrapper,param);
IPage<UnitProjectDivisionApplication> pageList = baseMapper.queryList(page, queryWrapper, param);
pageList.setRecords(this.dealList(pageList.getRecords()));
return pageList;
}
@ -43,7 +53,7 @@ public class UnitProjectDivisionApplicationServiceImpl extends ServiceImpl<UnitP
@Override
public List<UnitProjectDivisionApplication> queryList(HashMap<String, Object> param) {
QueryWrapper<UnitProjectDivisionApplication> queryWrapper = getQueryWrapper(param);
return dealList(baseMapper.queryList(queryWrapper,param));
return dealList(baseMapper.queryList(queryWrapper, param));
}
private QueryWrapper<UnitProjectDivisionApplication> getQueryWrapper(HashMap<String, Object> param) {
@ -65,7 +75,7 @@ public class UnitProjectDivisionApplicationServiceImpl extends ServiceImpl<UnitP
@Override
public void edit(UnitProjectDivisionApplication unitProjectDivisionApplication) {
UnitProjectDivisionApplication oldUnitProjectDivisionApplication = baseMapper.selectById(unitProjectDivisionApplication.getId());
if(oldUnitProjectDivisionApplication==null) {
if (oldUnitProjectDivisionApplication == null) {
throw new OpenAlertException("未找到对应实体");
}
baseMapper.updateById(unitProjectDivisionApplication);
@ -74,7 +84,7 @@ public class UnitProjectDivisionApplicationServiceImpl extends ServiceImpl<UnitP
@Override
public void delete(String id) {
UnitProjectDivisionApplication unitProjectDivisionApplication = baseMapper.selectById(id);
if(unitProjectDivisionApplication==null) {
if (unitProjectDivisionApplication == null) {
throw new OpenAlertException("未找到对应实体");
}
baseMapper.deleteById(id);
@ -92,31 +102,106 @@ public class UnitProjectDivisionApplicationServiceImpl extends ServiceImpl<UnitP
@Override
public void addFromFlow(Map<String, Object> map) {
UnitProjectDivisionApplication e = new UnitProjectDivisionApplication();
e.setProjectSn(FlowUtil.getString(map,"projectSn"));
e.setNo(FlowUtil.getString(map,"no"));
e.setDeviceUnitProject(FlowUtil.getPullDownLong(map,"deviceUnitProject"));
e.setDeviceUnitNumber(FlowUtil.getString(map,"deviceUnitNumber"));
e.setContractingMethod(FlowUtil.getPullDownInteger(map,"contractingMethod"));
e.setContractor(FlowUtil.getPullDownLong(map,"contractor"));
e.setEngineeringSupervisionUnit(FlowUtil.getPullDownLong(map,"engineeringSupervisionUnit"));
e.setEngineeringSubcontractor(FlowUtil.getPullDownLong(map,"engineeringSubcontractor"));
e.setRegionalProjectTeam(FlowUtil.getPullDownLong(map,"regionalProjectTeam"));
e.setDetailedList(FlowUtil.getJSONString(map,"detailedList"));
e.setContractorManager(FlowUtil.getPullDownLong(map,"contractorManager"));
e.setContractorManagerDate(FlowUtil.getDate(map,"contractorManagerDate"));
e.setRelatedProfessionalEngineer(FlowUtil.getString(map,"relatedProfessionalEngineer"));
e.setRelatedProfessionalEngineerSignature(FlowUtil.getPullDownLong(map,"relatedProfessionalEngineerSignature"));
e.setRelatedProfessionalEngineerSignatureDate(FlowUtil.getDate(map,"relatedProfessionalEngineerSignatureDate"));
e.setConstructionManager(FlowUtil.getString(map,"constructionManager"));
e.setConstructionManagerSignature(FlowUtil.getPullDownLong(map,"constructionManagerSignature"));
e.setConstructionManagerSignatureDate(FlowUtil.getDate(map,"constructionManagerSignatureDate"));
e.setProjectManager(FlowUtil.getString(map,"projectManager"));
e.setProjectManagerSignature(FlowUtil.getPullDownLong(map,"projectManagerSignature"));
e.setProjectManagerSignatureDate(FlowUtil.getDate(map,"projectManagerSignatureDate"));
e.setConstructionManagementDepartment(FlowUtil.getString(map,"constructionManagementDepartment"));
e.setConstructionManagementDepartmentSignature(FlowUtil.getPullDownLong(map,"constructionManagementDepartmentSignature"));
e.setConstructionManagementDepartmentSignatureDate(FlowUtil.getDate(map,"constructionManagementDepartmentSignatureDate"));
String projectSn = FlowUtil.getString(map, "projectSn");
e.setProjectSn(projectSn);
e.setNo(FlowUtil.getString(map, "no"));
e.setDeviceUnitProject(FlowUtil.getPullDownLong(map, "deviceUnitProject"));
e.setDeviceUnitNumber(FlowUtil.getString(map, "deviceUnitNumber"));
e.setContractingMethod(FlowUtil.getPullDownInteger(map, "contractingMethod"));
e.setContractor(FlowUtil.getPullDownLong(map, "contractor"));
e.setEngineeringSupervisionUnit(FlowUtil.getPullDownLong(map, "engineeringSupervisionUnit"));
e.setEngineeringSubcontractor(FlowUtil.getPullDownLong(map, "engineeringSubcontractor"));
e.setRegionalProjectTeam(FlowUtil.getPullDownLong(map, "regionalProjectTeam"));
e.setDetailedList(FlowUtil.getJSONString(map, "detailedList"));
e.setContractorManager(FlowUtil.getPullDownLong(map, "contractorManager"));
e.setContractorManagerDate(FlowUtil.getDate(map, "contractorManagerDate"));
e.setRelatedProfessionalEngineer(FlowUtil.getString(map, "relatedProfessionalEngineer"));
e.setRelatedProfessionalEngineerSignature(FlowUtil.getPullDownLong(map, "relatedProfessionalEngineerSignature"));
e.setRelatedProfessionalEngineerSignatureDate(FlowUtil.getDate(map, "relatedProfessionalEngineerSignatureDate"));
e.setConstructionManager(FlowUtil.getString(map, "constructionManager"));
e.setConstructionManagerSignature(FlowUtil.getPullDownLong(map, "constructionManagerSignature"));
e.setConstructionManagerSignatureDate(FlowUtil.getDate(map, "constructionManagerSignatureDate"));
e.setProjectManager(FlowUtil.getString(map, "projectManager"));
e.setProjectManagerSignature(FlowUtil.getPullDownLong(map, "projectManagerSignature"));
e.setProjectManagerSignatureDate(FlowUtil.getDate(map, "projectManagerSignatureDate"));
e.setConstructionManagementDepartment(FlowUtil.getString(map, "constructionManagementDepartment"));
e.setConstructionManagementDepartmentSignature(FlowUtil.getPullDownLong(map, "constructionManagementDepartmentSignature"));
e.setConstructionManagementDepartmentSignatureDate(FlowUtil.getDate(map, "constructionManagementDepartmentSignatureDate"));
baseMapper.insert(e);
//添加到质量验收里面
if (StrUtil.isNotBlank(e.getDetailedList())) {
Long deviceId = e.getDeviceUnitProject();
List<QualityAcceptance> haveList = qualityAcceptanceService.list(
new LambdaQueryWrapper<QualityAcceptance>()
.eq(QualityAcceptance::getDeviceId, deviceId)
);
JSONArray detailList = JSON.parseArray(e.getDetailedList());
for (int i = 0; i < detailList.size(); i++) {
JSONObject jsonObject = detailList.getJSONObject(i);
Long currentId = null;
// 处理各级节点
currentId = processLevel(projectSn, haveList, jsonObject, "field9876885180342", 0L, 1, deviceId);
currentId = processLevel(projectSn, haveList, jsonObject, "field7965485184055", currentId, 2, deviceId);
currentId = processLevel(projectSn, haveList, jsonObject, "field3241485188089", currentId, 3, deviceId);
currentId = processLevel(projectSn, haveList, jsonObject, "field8142185195371", currentId, 4, deviceId);
currentId = processLevel(projectSn, haveList, jsonObject, "field4526985201904", currentId, 5, deviceId);
}
}
}
/**
* 处理单个层级的方法
*
* @param projectSn
* @param haveList
* @param jsonObject
* @param fieldName
* @param parentId
* @param levelType
* @param deviceId
* @return
*/
private Long processLevel(String projectSn, List<QualityAcceptance> haveList, JSONObject jsonObject, String fieldName, Long parentId, int levelType, Long deviceId) {
String name = jsonObject.getString(fieldName);
// 查找现有记录
Optional<QualityAcceptance> existing = haveList.stream()
.filter(o -> Objects.equals(o.getName(), name)
&& o.getLevelType() == levelType
&& Objects.equals(o.getParentId(), parentId))
.findFirst();
if (existing.isPresent()) {
return existing.get().getId();
} else {
// 不存在则新增
return addQualityAcceptance(projectSn, name, parentId, levelType, deviceId, haveList);
}
}
/**
* 添加质量验收
*
* @param projectSn
* @param name
* @param parentId
* @param levelType
* @param deviceId
* @param haveList
* @return
*/
private Long addQualityAcceptance(String projectSn, String name, long parentId, int levelType, Long deviceId, List<QualityAcceptance> haveList) {
QualityAcceptance accept = new QualityAcceptance();
accept.setDeviceId(deviceId);
accept.setName(name);
accept.setNum(name);
accept.setProjectSn(projectSn);
accept.setParentId(parentId);
accept.setLevelType(levelType);
qualityAcceptanceService.add(accept);
haveList.add(accept);
return accept.getId();
}
}

View File

@ -249,7 +249,14 @@ public class SystemUserController {
})
@PostMapping(value = "/getProjectChilderSystemUserList")
public Result<List<SystemUser>> getProjectChilderSystemUserList(@RequestBody Map<String, Object> map) {
return Result.success(systemUserService.getProjectChildernSystemUserList(map));
map.put(Cts.IGNORE_DATA_SCOPE, Cts.IGNORE_DATA_SCOPE);
List<SystemUser> userList = systemUserService.getProjectChildernSystemUserList(map);
for (SystemUser systemUser : userList) {
systemUser.setPassword(null);
systemUser.setOldPassword(null);
systemUser.setShowPassword(null);
}
return Result.success(userList);
}
@OperLog(operModul = "账号管理", operType = "分页查找项目子账号列表", operDesc = "分页查找项目子账号列表")

View File

@ -241,4 +241,18 @@ public class FlowUtil {
return CollUtil.isNotEmpty(classs) ? Long.valueOf(classs.get(classs.size() - 1)) : null;
}
/**
* 判断是否为空
*
* @param obj
* @return
*/
public static boolean isBlank(String obj) {
Object parse = JSON.parse(obj);
if (parse instanceof List) {
return Optional.ofNullable((List) parse).map(m -> m.size() == 0 || m.get(0) == null || StrUtil.isBlank(m.get(0) + "")).orElse(null);
} else {
return false;
}
}
}

View File

@ -67,16 +67,19 @@ public class ZwLoginServiceImpl implements IZwLoginService {
authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(MapUtils.getString(map,"account"), password));
String token=jwtTokenProvider.createToken(MapUtils.getString(map,"account"),60*60*24);
result.put("token",token);
result.put("userId",systemUser.getUserId());
result.put("account",systemUser.getAccount());
result.put("userTel",systemUser.getUserTel());
result.put("realName",systemUser.getRealName());
result.put("accountType",systemUser.getAccountType());
result.put("token", token);
result.put("userId", systemUser.getUserId());
result.put("account", systemUser.getAccount());
result.put("userTel", systemUser.getUserTel());
result.put("realName", systemUser.getRealName());
result.put("accountType", systemUser.getAccountType());
return result;
} catch (AuthenticationException e) {
log.error("error", e);
throw new CustomException("Invalid username/password supplied", HttpStatus.UNPROCESSABLE_ENTITY);
} catch (Exception e) {
log.error("error", e);
throw new OpenAlertException(e.getMessage());
}
}
}