diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/controller/PouringOrderLedgerController.java b/src/main/java/com/zhgd/xmgl/modules/baotou/controller/PouringOrderLedgerController.java index 3eb2d79cf..871bb74c4 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/controller/PouringOrderLedgerController.java +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/controller/PouringOrderLedgerController.java @@ -1,12 +1,20 @@ package com.zhgd.xmgl.modules.baotou.controller; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.IdUtil; import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.zhgd.annotation.OperLog; import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.jeecg.common.mybatis.EntityMap; +import com.zhgd.xmgl.constant.Cts; import com.zhgd.xmgl.modules.baotou.entity.PouringOrderLedger; import com.zhgd.xmgl.modules.baotou.service.IPouringOrderLedgerService; +import com.zhgd.xmgl.modules.basicdata.entity.SystemUser; +import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService; +import com.zhgd.xmgl.util.EasyPoiUtil; +import com.zhgd.xmgl.util.Fileutils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -15,12 +23,18 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.MapUtils; import org.simpleframework.xml.core.Validate; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; /** @@ -37,6 +51,9 @@ import java.util.Map; public class PouringOrderLedgerController { @Autowired private IPouringOrderLedgerService pouringOrderLedgerService; + @Lazy + @Autowired + private ISystemUserService systemUserService; /** * 分页列表查询 @@ -80,7 +97,6 @@ public class PouringOrderLedgerController { return Result.ok(); } - /** * 编辑 * @@ -158,4 +174,76 @@ public class PouringOrderLedgerController { return Result.success(pouringOrderLedgerService.getCountDetails(param)); } + @OperLog(operModul = "混凝土浇筑申请记录管理", operType = "", operDesc = "导出pdf文件") + @ApiOperation(value = "导出pdf文件", notes = "导出pdf文件", httpMethod = "GET") + @ApiImplicitParam(name = "id", value = "id", paramType = "query", required = true, dataType = "String") + @GetMapping("exportPdf") + public void exportPdf(HttpServletResponse response, @RequestParam(name = "id", required = true) String id) throws IOException { + Map map = new HashMap<>(); + PouringOrderLedger fire = pouringOrderLedgerService.queryById(id); + map.put("castingNumber", fire.getCastingNumber()); + map.put("device", fire.getDevice()); + map.put("projectGroupId", fire.getProjectGroupId()); + map.put("supervisor", fire.getSupervisor()); + map.put("epcPcContractor", fire.getEpcPcContractor()); + map.put("castingLocation", fire.getCastingLocation()); + map.put("pouringBeginTime", DateUtil.format(fire.getPouringBeginTime(), "MM月dd日HH时")); + map.put("pouringEndTime", DateUtil.format(fire.getPouringEndTime(), "MM月dd日HH时")); + map.put("detail", fire.getDetail()); + map.put("constructionWorker", fire.getConstructionWorker()); + map.put("constructionDate", DateUtil.format(fire.getConstructionDate(), "yyyy年MM月dd日")); + map.put("projectSn", fire.getProjectSn()); + map.put("createTime", fire.getCreateTime()); + map.put("updateTime", fire.getUpdateTime()); + map.put("status", fire.getStatus()); + map.put("mixProportion", fire.getMixProportion()); + map.put("designSlump", fire.getDesignSlump()); + map.put("estimatedPouringVolume", fire.getEstimatedPouringVolume()); + map.put("constructionShiftSupervisor", fire.getConstructionShiftSupervisor()); + map.put("designStrength", fire.getDesignStrength()); + map.put("constructionJointReservePosition", fire.getConstructionJointReservePosition()); + map.put("manpowerMachineReadiness", fire.getManpowerMachineReadiness()); + map.put("supplyStation", fire.getSupplyStation()); + map.put("professionalSupervisionEngineer", fire.getProfessionalSupervisionEngineer()); + map.put("professionalSupervisionEngineerDate", DateUtil.format(fire.getProfessionalSupervisionEngineerDate(), "yyyy年MM月dd日")); + map.put("contractModel", fire.getContractModel()); + map.put("epcProfessionalEngineer", fire.getEpcProfessionalEngineer()); + map.put("supervisionProfessionalEngineer", fire.getSupervisionProfessionalEngineer()); + map.put("projectTeamProfessionalEngineer", fire.getProjectTeamProfessionalEngineer()); + map.put("epcContractor", fire.getEpcContractor()); + map.put("constructionContractor", fire.getConstructionContractor()); + map.put("actualPouringVolume", fire.getActualPouringVolume()); + map.put("remark", fire.getRemark()); + map.put("projectGroupName", fire.getProjectGroupName()); + map.put("concreteSupplierName", fire.getConcreteSupplierName()); + map.put("epcPcContractorName", fire.getEpcPcContractorName()); + map.put("deviceName", fire.getDeviceName()); + map.put("supervisorName", fire.getSupervisorName()); +// map.put("constructionWorkerName", fire.getConstructionWorkerName()); + map.put("constructionShiftSupervisorName", fire.getConstructionShiftSupervisorName()); + map.put("professionalSupervisionEngineerName", fire.getProfessionalSupervisionEngineerName()); +// map.put("epcProfessionalEngineerName", fire.getEpcProfessionalEngineerName()); +// map.put("supervisionProfessionalEngineerName", fire.getSupervisionProfessionalEngineerName()); +// map.put("projectTeamProfessionalEngineerName", fire.getProjectTeamProfessionalEngineerName()); + map.put("epcContractorName", fire.getEpcContractorName()); + map.put("constructionContractorName", fire.getConstructionContractorName()); + map.put("epcProfessionalEngineerDate", DateUtil.format(fire.getEpcProfessionalEngineerDate(), "yyyy年MM月dd日")); + map.put("supervisionProfessionalEngineerDate", DateUtil.format(fire.getSupervisionProfessionalEngineerDate(), "yyyy年MM月dd日")); + map.put("projectTeamProfessionalEngineerDate", DateUtil.format(fire.getProjectTeamProfessionalEngineerDate(), "yyyy年MM月dd日")); + Map userMap = systemUserService.list(new LambdaQueryWrapper() + .eq(SystemUser::getSn, fire.getProjectSn()).last(Cts.IGNORE_DATA_SCOPE_CONDITION)).stream().collect(Collectors.toMap(SystemUser::getUserId, Function.identity())); + map.put("constructionWorkerName", EasyPoiUtil.getImgFromUser(userMap.get(fire.getConstructionWorker()), 50, 25)); + map.put("epcProfessionalEngineerName", EasyPoiUtil.getImgFromUser(userMap.get(fire.getEpcProfessionalEngineer()), 50, 25)); + map.put("supervisionProfessionalEngineerName", EasyPoiUtil.getImgFromUser(userMap.get(fire.getSupervisionProfessionalEngineer()), 50, 25)); + map.put("projectTeamProfessionalEngineerName", EasyPoiUtil.getImgFromUser(userMap.get(fire.getProjectTeamProfessionalEngineer()), 50, 25)); + String url; +// url = "C:\\Users\\Administrator\\Desktop\\混凝土浇筑申请记录模板.docx"; + url = Fileutils.getExportTemplateFile("excel/work/混凝土浇筑申请记录模板.docx").getAbsolutePath(); + + File tempFile = File.createTempFile(IdUtil.simpleUUID(), ".docx"); + EasyPoiUtil.exportNewLineWord(map, url, tempFile); + + EasyPoiUtil.wordToPdfExport(response, tempFile); + } + } diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/entity/PouringOrderLedger.java b/src/main/java/com/zhgd/xmgl/modules/baotou/entity/PouringOrderLedger.java index 8e470e0bb..054350ec6 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/entity/PouringOrderLedger.java +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/entity/PouringOrderLedger.java @@ -116,16 +116,28 @@ public class PouringOrderLedger implements Serializable { @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") @DateTimeFormat(pattern="yyyy-MM-dd") @ApiModelProperty(value="专业监理工程师日期") - private java.util.Date professionalSupervisionEngineerDate ; + private java.util.Date professionalSupervisionEngineerDate; @Excel(name = "合同模式", width = 15, replace = {"EPC_1", "E+P+C_2"}) @ApiModelProperty("合同模式:1EPC;2E+P+C") private Integer contractModel; - @ApiModelProperty(value="EPC专业工程师") + @ApiModelProperty(value = "EPC专业工程师") private java.lang.Long epcProfessionalEngineer; @ApiModelProperty(value = "监理专业工程师") private java.lang.Long supervisionProfessionalEngineer; @ApiModelProperty(value = "项目组专业工程师") private java.lang.Long projectTeamProfessionalEngineer; + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "EPC专业工程师日期") + private Date epcProfessionalEngineerDate; + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "监理专业工程师日期") + private Date supervisionProfessionalEngineerDate; + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty(value = "项目组专业工程师日期") + private Date projectTeamProfessionalEngineerDate; @ApiModelProperty(value = "EPC承包商") private java.lang.Long epcContractor; diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/xml/PouringOrderLedgerMapper.xml b/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/xml/PouringOrderLedgerMapper.xml index b34920781..4e3a04c05 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/xml/PouringOrderLedgerMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/xml/PouringOrderLedgerMapper.xml @@ -100,9 +100,28 @@ left join enterprise_info ei4 on ei4.id = t.epc_contractor left join enterprise_info ei5 on ei5.id = t.construction_contractor left join device_unit du on du.id=t.device - where t.project_sn = #{projectSn} and t.contract_model = 1 + where t.project_sn = #{projectSn} + + and t.device = #{device} + + + and t.project_group_id = #{projectGroupId} + + + and t.epc_contractor = #{epcContractor} + + + and t.construction_contractor = #{constructionContractor} + + + and t.supply_station = #{supplyStation} + ${groupby} + + + + diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/plan/service/impl/PlanRecordServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/baotou/plan/service/impl/PlanRecordServiceImpl.java index e8317ca29..4b8bb65c4 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/plan/service/impl/PlanRecordServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/plan/service/impl/PlanRecordServiceImpl.java @@ -102,7 +102,7 @@ public class PlanRecordServiceImpl extends ServiceImpl split = StrUtil.split(recordIds, ","); queryWrapper.in(RefUtil.fieldNameUlc(PlanRecord::getId), split); } - queryWrapper.orderByAsc(RefUtil.fieldNameUlc(PlanRecord::getPlannedStart)); + queryWrapper.orderByAsc(RefUtil.fieldNameUlc(PlanRecord::getSort)); return queryWrapper; } @@ -142,6 +142,12 @@ public class PlanRecordServiceImpl extends ServiceImpl() .eq(PlanFeedback::getRecordId, planRecord.getId())); diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/PouringOrderLedgerServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/PouringOrderLedgerServiceImpl.java index a47c46291..fe231f42a 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/PouringOrderLedgerServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/PouringOrderLedgerServiceImpl.java @@ -154,6 +154,9 @@ public class PouringOrderLedgerServiceImpl extends ServiceImpl periodMilestones = baseMapper.getCountSupplyStationDetail(param); int pageNo = Integer.parseInt(param.getOrDefault("pageNo", 1).toString()); @@ -270,12 +273,12 @@ public class PouringOrderLedgerServiceImpl extends ServiceImpl