From 01bc5227f39f6b27b65a930cae9246aaaf8ee3d9 Mon Sep 17 00:00:00 2001 From: guoshengxiong <1923636941@qq.com> Date: Mon, 3 Mar 2025 18:47:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=85=E5=A4=B4bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ContractorMonthlyDetailController.java | 40 +- .../entity/PiecemealImplementation.java | 32 +- .../mapper/xml/SceneExposeSpecialMapper.xml | 6 +- .../IContractorMonthlyPeriodService.java | 6 + .../impl/AnticorrosionEntrustServiceImpl.java | 31 +- .../ConstructionPlanLedgerServiceImpl.java | 13 +- .../ContractorMonthlyDetailServiceImpl.java | 486 +++++++++--------- .../car/service/impl/CarInfoServiceImpl.java | 3 +- .../controller/SafetyHatDevController.java | 28 + .../zhgd/xmgl/security/WebSecurityConfig.java | 1 + 10 files changed, 319 insertions(+), 327 deletions(-) diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/controller/ContractorMonthlyDetailController.java b/src/main/java/com/zhgd/xmgl/modules/baotou/controller/ContractorMonthlyDetailController.java index 19180b5b3..929982c4c 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/controller/ContractorMonthlyDetailController.java +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/controller/ContractorMonthlyDetailController.java @@ -155,15 +155,17 @@ public class ContractorMonthlyDetailController { return Result.success(contractorMonthlyDetailService.queryDetail(param)); } - @OperLog(operModul = "承包商项自组月报周报详情(word和excel版)管理", operType = "", operDesc = "查询承包商项自组月报周报详情(word和excel版)信息") - @ApiOperation(value = "查询承包商项自组月报周报详情(word和excel版)信息", notes = "查询承包商项自组月报周报详情(word和excel版)信息", httpMethod = "GET") + @OperLog(operModul = "承包商项自组月报周报详情(word和excel版)管理", operType = "", operDesc = "查询待提交的详情(word和excel版)信息") + @ApiOperation(value = "查询待提交的详情(word和excel版)信息", notes = "查询待提交的详情(word和excel版)信息", httpMethod = "GET") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"), @ApiImplicitParam(name = "hasDefault", value = "1有默认值", paramType = "query", required = false, dataType = "Integer"), - @ApiImplicitParam(name = "levelType", value = "时间级别:1月2周", paramType = "query", required = true, dataType = "Integer"), @ApiImplicitParam(name = "groupId", value = "项目组id", paramType = "query", required = true, dataType = "Integer"), @ApiImplicitParam(name = "deviceId", value = "设备id", paramType = "query", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "levelType", value = "时间级别:1月2周", paramType = "query", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "type", value = "1承包商2项目组3项目部", paramType = "query", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "contentType", value = "1:三月人力滚动计划;2:三月机械滚动计划;3:人力汇总表;4:机械汇总表;5:工程量报表;6:计划工程量报表;7:月报;8:项目计划;9:三周(月)滚动计划", paramType = "query", required = true, dataType = "Integer"), }) @GetMapping(value = "/queryCommitDetail") public Result queryCommitDetail(@ApiIgnore @RequestParam HashMap param, HttpServletRequest request) { @@ -172,38 +174,6 @@ public class ContractorMonthlyDetailController { return Result.success(contractorMonthlyDetailService.queryCommitDetail(param)); } -// @OperLog(operModul = "承包商项自组月报周报详情(word和excel版)管理", operType = "", operDesc = "提交审批承包商项自组月报周报详情(word和excel版)信息") -// @ApiOperation(value = "提交审批承包商项自组月报周报详情(word和excel版)信息", notes = "提交审批承包商项自组月报周报详情(word和excel版)信息", httpMethod = "POST") -// @PostMapping(value = "/saveInfo") -// public Result saveInfo(@RequestBody ContractorMonthlyDetail contractorMonthlyDetail) { -// contractorMonthlyDetailService.saveInfo(contractorMonthlyDetail); -// return Result.ok(); -// } - -// @OperLog(operModul = "承包商项自组月报周报详情(word和excel版)管理", operType = "", operDesc = "提交审批所有承包商项自组月报周报详情(word和excel版)信息") -// @ApiOperation(value = "提交审批所有承包商项自组月报周报详情(word和excel版)信息", notes = "提交审批所有承包商项自组月报周报详情(word和excel版)信息", httpMethod = "POST") -// @PostMapping(value = "/saveAllInfo") -// public Result saveAllInfo(@RequestBody HashMap param) { -// contractorMonthlyDetailService.saveAllInfo(param); -// return Result.ok(); -// } - -// @OperLog(operModul = "承包商项自组月报周报详情(word和excel版)管理", operType = "", operDesc = "驳回") -// @ApiOperation(value = "驳回", notes = "驳回", httpMethod = "POST") -// @PostMapping(value = "/reject") -// public Result reject(@RequestBody HashMap param) { -// contractorMonthlyDetailService.reject(param); -// return Result.ok(); -// } -// -// @OperLog(operModul = "承包商项自组月报周报详情(word和excel版)管理", operType = "", operDesc = "同意") -// @ApiOperation(value = "同意", notes = "同意", httpMethod = "POST") -// @PostMapping(value = "/agree") -// public Result agree(@RequestBody HashMap param) { -// contractorMonthlyDetailService.agree(param); -// return Result.ok(); -// } - @OperLog(operModul = "承包商项自组月报周报详情(word和excel版)管理", operType = "", operDesc = "查询编辑的word") @ApiOperation(value = "查询编辑的word", notes = "查询编辑的word", httpMethod = "GET") @GetMapping(value = "/getEditWord") diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/entity/PiecemealImplementation.java b/src/main/java/com/zhgd/xmgl/modules/baotou/entity/PiecemealImplementation.java index 2deaab9e5..1b1b086a4 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/entity/PiecemealImplementation.java +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/entity/PiecemealImplementation.java @@ -43,22 +43,22 @@ public class PiecemealImplementation implements Serializable { @ApiModelProperty(value="预估金额") private java.math.BigDecimal estimatedAmount ; /** - * 实际金额 - */ - @ApiModelProperty(value = "实际金额") - private java.math.BigDecimal actualAmount; - /** - * 上传时间 - */ - @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") - @DateTimeFormat(pattern = "yyyy-MM-dd") - @ApiModelProperty(value = "上传时间") - private java.util.Date uploadTime; - /** - * 创建时间 - */ - @ApiModelProperty(value = "创建时间") - private java.util.Date createTime; + * 实际金额 + */ + @ApiModelProperty(value = "实际金额") + private java.math.BigDecimal actualAmount; + /** + * 上传时间 + */ + @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 uploadTime; + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private java.util.Date createTime; /**更新时间*/ @ApiModelProperty(value="更新时间") private java.util.Date updateTime ; diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/xml/SceneExposeSpecialMapper.xml b/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/xml/SceneExposeSpecialMapper.xml index 10bfde8c4..f9ec3de2c 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/xml/SceneExposeSpecialMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/mapper/xml/SceneExposeSpecialMapper.xml @@ -39,11 +39,11 @@ join enterprise_info ei3 on ei3.id=t.construction_unit where t.project_sn = #{projectSn} and t.construction_unit is not null and t.type = 2 and t.is_rectify = 0 - and t.create_time > CONCAT(DATE_FORMAT(DATE_SUB(now(), interval -7 day), '%Y-%m-%d'), ' 00:00:00') + and t.create_time > CONCAT(DATE_FORMAT(DATE_SUB(now(), interval 7 day), '%Y-%m-%d'), ' 00:00:00') - and t.create_time > CONCAT(DATE_FORMAT(DATE_SUB(now(), interval -30 day), '%Y-%m-%d'), ' 00:00:00') - + and t.create_time > CONCAT(DATE_FORMAT(DATE_SUB(now(), interval 30 day), '%Y-%m-%d'), ' 00:00:00') + group by t.construction_unit diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/service/IContractorMonthlyPeriodService.java b/src/main/java/com/zhgd/xmgl/modules/baotou/service/IContractorMonthlyPeriodService.java index 140c2a3d5..7e0162fd2 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/service/IContractorMonthlyPeriodService.java +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/service/IContractorMonthlyPeriodService.java @@ -68,5 +68,11 @@ public interface IContractorMonthlyPeriodService extends IService param); } diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/AnticorrosionEntrustServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/AnticorrosionEntrustServiceImpl.java index 7fbf891b0..c23e4a189 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/AnticorrosionEntrustServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/AnticorrosionEntrustServiceImpl.java @@ -1,5 +1,7 @@ package com.zhgd.xmgl.modules.baotou.service.impl; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.NumberUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -118,7 +120,7 @@ public class AnticorrosionEntrustServiceImpl extends ServiceImpl param) { + String reportingTime_begin = MapUtils.getString(param, "reportingTime_begin"); + String reportingTime_end = MapUtils.getString(param, "reportingTime_end"); String projectSn = MapUtils.getString(param, "projectSn"); param.put("pageNo", 1); param.put("pageSize", -1); IPage page = baseMapper.countInfo(PageUtil.getPage(param), param); List alls = baseMapper.selectList(new LambdaQueryWrapper() .eq(AnticorrosionEntrust::getProjectSn, projectSn)); - Date now = new Date(); + DateTime begin = DateUtil.parseDateTime(reportingTime_begin); + DateTime end = DateUtil.parseDateTime(reportingTime_end); + long between = DateUtil.between(begin, end, DateUnit.DAY); BigDecimal weekPine = new BigDecimal("0"); BigDecimal weekSteel = new BigDecimal("0"); BigDecimal monthPine = new BigDecimal("0"); @@ -194,15 +200,18 @@ public class AnticorrosionEntrustServiceImpl extends ServiceImpl ((JSONObject) o).getBigDecimal("field6631158649424")).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal decimal1 = ja.stream().filter(o -> Objects.equals(FlowUtil.getInteger(((JSONObject) o), "field8275512826364"), 2)) .map(o -> ((JSONObject) o).getBigDecimal("field6631158649424")).reduce(BigDecimal.ZERO, BigDecimal::add); - //周 - if (DateUtil.compare(DateUtil.beginOfWeek(now), entrust.getReportingTime()) <= 0 && DateUtil.compare(DateUtil.endOfWeek(now), entrust.getReportingTime()) >= 0) { - weekPine = NumberUtil.add(weekPine, decimal); - weekSteel = NumberUtil.add(weekSteel, decimal1); - } - //月 - if (DateUtil.compare(DateUtil.beginOfMonth(now), entrust.getReportingTime()) <= 0 && DateUtil.compare(DateUtil.endOfMonth(now), entrust.getReportingTime()) >= 0) { - monthPine = NumberUtil.add(monthPine, decimal); - monthSteel = NumberUtil.add(monthSteel, decimal1); + if (between > 14) { + //月 + if (DateUtil.compare(DateUtil.beginOfWeek(begin), entrust.getReportingTime()) <= 0 && DateUtil.compare(DateUtil.endOfWeek(end), entrust.getReportingTime()) >= 0) { + monthPine = NumberUtil.add(monthPine, decimal); + monthSteel = NumberUtil.add(monthSteel, decimal1); + } + } else { + //周 + if (DateUtil.compare(DateUtil.beginOfWeek(begin), entrust.getReportingTime()) <= 0 && DateUtil.compare(DateUtil.endOfWeek(end), entrust.getReportingTime()) >= 0) { + weekPine = NumberUtil.add(weekPine, decimal); + weekSteel = NumberUtil.add(weekSteel, decimal1); + } } totalPine = NumberUtil.add(totalPine, decimal); totalSteel = NumberUtil.add(totalSteel, decimal1); diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/ConstructionPlanLedgerServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/ConstructionPlanLedgerServiceImpl.java index 908c0ab3c..a83f9f8aa 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/ConstructionPlanLedgerServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/ConstructionPlanLedgerServiceImpl.java @@ -3,6 +3,7 @@ package com.zhgd.xmgl.modules.baotou.service.impl; import cn.hutool.core.io.FileUtil; import cn.hutool.extra.qrcode.QrCodeUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -112,12 +113,18 @@ public class ConstructionPlanLedgerServiceImpl extends ServiceImpl() + .set(ledger.getConstructionUnitId() == null, ConstructionPlanLedger::getConstructionUnitId, null) + .set(ledger.getEpcContractorId() == null, ConstructionPlanLedger::getEpcContractorId, null) + .eq(ConstructionPlanLedger::getId, ledger.getId())); + } } @Override diff --git a/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/ContractorMonthlyDetailServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/ContractorMonthlyDetailServiceImpl.java index 89ae78f93..1860979a7 100644 --- a/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/ContractorMonthlyDetailServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/baotou/service/impl/ContractorMonthlyDetailServiceImpl.java @@ -31,6 +31,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.tuple.ImmutableTriple; import org.apache.commons.lang3.tuple.Triple; +import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Lazy; @@ -688,263 +689,10 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl() - .eq(ContractorMonthlyDetail::getContentType, contentType) - .eq(ContractorMonthlyDetail::getPeriodId, beforeP.getId())); - if (detail1 != null) { - JSONObject toJo = JSON.parseObject(content); - JSONObject toCellDataJo = getCellData(toJo); - JSONObject fromCellDataJo = getCellData(JSON.parseObject(detail1.getContent())); - int fl = SheetUtils.getColDataLength(fromCellDataJo, 8, 5); - int tl = SheetUtils.getColDataLength(toCellDataJo, 8, 5); - SheetUtils.replaceAreaForQuantity(fromCellDataJo, toCellDataJo, 8, 5, fl + 7, 7, 8, 2, tl + 7, 4); - content = JSON.toJSONString(toJo); - } - } - } - } - - //设置工程量的本周月等的量 - if (Objects.equals(contentType, 5) || Objects.equals(contentType, 6)) { - content = this.getQuantityContent(contentType, periodId, levelType, type, groupId, deviceId, enterpriseId, content, menuType); - } - - //设置月报编辑权限,增加编辑链接 - /*if (contentType == 7 && type == 2) { - List titleIds = contractorMonthlyConfigService.list(new LambdaQueryWrapper() - .eq(ContractorMonthlyConfig::getUserId, SecurityUtils.getUser().getUserId())).stream().map(ContractorMonthlyConfig::getTitleId).collect(Collectors.toList()); - if (CollUtil.isNotEmpty(titleIds)) { - List titles = contractorMonthlyTitleService.list(new LambdaQueryWrapper() - .eq(ContractorMonthlyTitle::getType, levelType) - .in(ContractorMonthlyTitle::getId, titleIds) - ); - Map titleMap = titles.stream().map(o -> { - o.setWordName(o.getWordName().replace(" ", "").replaceAll("\\u00A0+", "")); - return o; - }).collect(Collectors.toMap(ContractorMonthlyTitle::getWordName, Function.identity(), (o, o2) -> o)); - JSONObject rootJo = JSON.parseObject(content); - JSONArray mainJa = rootJo.getJSONArray("main"); - for (int i = 0; i < mainJa.size(); i++) { - JSONObject jo = mainJa.getJSONObject(i); - if (Objects.equals(jo.get("type"), "title")) { - JSONArray valueList = jo.getJSONArray("valueList"); - StringBuilder readTitle = new StringBuilder(); - for (int i1 = 0; i1 < valueList.size(); i1++) { - JSONObject jo1 = valueList.getJSONObject(i1); - if (!Objects.equals(jo1.getString("type"), "hyperlink")) { - readTitle.append(jo1.getString("value")); - } - } - String key = readTitle.toString().replaceAll("\\u00A0+", ""); - if (titleMap.containsKey(key)) { - Map edit = new JoBuilder() - .put("value", "编辑") - .put("color", "#0000FF") - .put("underline", true) - .build(); - Map editLink = new JoBuilder() - .put("value", "") - .put("type", "hyperlink") - .put("url", wordExcelUrl + "?titleId=" + titleMap.get(key).getId() + "&periodId=" + period.getId() - + "&contentType=" + contentType + "&projectSn=" + period.getProjectSn() + "&token=" + MapUtils.getString(param, "authorization")) - .put("valueList", Collections.singletonList(edit)) - .build(); - valueList.add(editLink); - } - } - } - content = JSON.toJSONString(rootJo); - } - }*/ - - //xls设置默认样式 - JSONObject rootJo1 = JSONObject.parseObject(content); - if (rootJo1 != null && contentType != 7) { - SheetUtils.setDefaultStyle(rootJo1); - content = JSON.toJSONString(rootJo1); - } - return content; - } - - @Override - public String queryCommitDetail(HashMap param) { -// ContractorMonthlyDetail detail = contractorMonthlyDetailService.queryNeedCommit(param); - Integer hasDefault = MapUtils.getInteger(param, "hasDefault"); - Integer contentType = MapUtils.getInteger(param, "contentType"); - Integer levelType = MapUtils.getInteger(param, "levelType"); - Integer menuType = MapUtils.getInteger(param, "menuType"); - Integer type = MapUtils.getInteger(param, "type"); - ContractorMonthlyPeriod period = contractorMonthlyPeriodService.queryNeedCommit(param); - ProjectGroup group = null; - String content = ""; - Long periodId = null; - Long groupId = null; - if (period != null) { - param.put("periodId", period.getId()); - periodId = period.getId(); - groupId = period.getGroupId(); - group = projectGroupService.getById(groupId); - List queryList = contractorMonthlyDetailService.queryList(param); - if (CollUtil.isNotEmpty(queryList)) { - content = queryList.get(0).getContent(); - } - } - Long deviceId = MapUtils.getLong(param, "deviceId"); - Long enterpriseId = MapUtils.getLong(param, "enterpriseId"); - DeviceUnit unit = deviceUnitService.getById(deviceId); - EnterpriseInfo info = enterpriseInfoService.getById(enterpriseId); - //获取默认的模版 - if (Objects.equals(hasDefault, 1) && StrUtil.isBlank(content)) { - //contentType 1:三月人力滚动计划;2:三月机械滚动计划;3:人力汇总表;4:机械汇总表;5:工程量报表;6:计划工程量报表;7:月报;8:项目计划;9:三周(月)滚动计划 - Integer tempType = contentType; - if (Objects.equals(contentType, 7)) { - if (Objects.equals(levelType, 1) && Objects.equals(type, 1)) { - tempType = 10; - } else if (Objects.equals(levelType, 1) && Objects.equals(type, 2)) { - tempType = 12; - } else if (Objects.equals(levelType, 2) && Objects.equals(type, 1)) { - tempType = 11; - } else { - tempType = 13; - } - } else { - if (contentType == 5 && levelType == 2) { - tempType = 7; - } else if (contentType == 6 && levelType == 2) { - tempType = 8; - } else if (contentType == 8) { - //项目计划 - tempType = 14; - } else if (contentType == 9) { - //三周(月)滚动计划 - tempType = 15; - } - } - ContractorMonthlyTemplate template = contractorMonthlyTemplateService.getById(tempType); - content = template.getContent(); - if (Objects.equals(levelType, 2) && contentType <= 4) { - content = content.replace("月", "周"); - } else if (Objects.equals(levelType, 1) && contentType <= 4) { - content = content.replace("周", "月"); - } - String groupName = ""; - String en = info != null ? info.getEnterpriseName() : "xxx"; - if (Objects.equals(type, 1)) { - content = content.replace("项目组", "承包商"); - groupName = en; - } else { - groupName = group != null ? group.getProjectGroupName() : "xxx"; - } - String unitName = unit != null ? unit.getDeviceUnitName() : "xxx"; - content = content.replace("{{unitName}}", unitName); - content = content.replace("{{groupName}}", groupName); - Date date = new Date(); - DateTime s1; - DateTime s2; - if (levelType == 2) { - s1 = DateUtil.offsetWeek(date, -1); - s2 = DateUtil.offsetWeek(date, 1); - content = content.replace("{{lastWeek}}", DateUtil.formatDate(DateUtil.beginOfWeek(s1)) + "~" + DateUtil.formatDate(DateUtil.endOfWeek(s1))); - content = content.replace("{{thisWeek}}", DateUtil.formatDate(DateUtil.beginOfWeek(date)) + "~" + DateUtil.formatDate(DateUtil.endOfWeek(date))); - content = content.replace("{{nextWeek}}", DateUtil.formatDate(DateUtil.beginOfWeek(s2)) + "~" + DateUtil.formatDate(DateUtil.endOfWeek(s2))); - } else { - s1 = DateUtil.offsetMonth(date, -1); - s2 = DateUtil.offsetMonth(date, 1); - content = content.replace("{{lastWeek}}", DateUtil.formatDate(DateUtil.beginOfMonth(s1)) + "~" + DateUtil.formatDate(DateUtil.endOfMonth(s1))); - content = content.replace("{{thisWeek}}", DateUtil.formatDate(DateUtil.beginOfMonth(date)) + "~" + DateUtil.formatDate(DateUtil.endOfMonth(date))); - content = content.replace("{{nextWeek}}", DateUtil.formatDate(DateUtil.beginOfMonth(s2)) + "~" + DateUtil.formatDate(DateUtil.endOfMonth(s2))); - } - content = content.replace("{{enterpriseName}}", en); - - //取上周的 - if (contentType == 1 || contentType == 2) { - ContractorMonthlyPeriod p1 = contractorMonthlyPeriodService.getBeforePeriod(period); - ContractorMonthlyPeriod beforeP = contractorMonthlyPeriodService.queryByEntity(p1); - if (beforeP != null) { - ContractorMonthlyDetail detail1 = contractorMonthlyDetailMapper.selectOne(new LambdaQueryWrapper() - .eq(ContractorMonthlyDetail::getContentType, contentType) - .eq(ContractorMonthlyDetail::getPeriodId, beforeP.getId())); - if (detail1 != null) { - JSONObject toJo = JSON.parseObject(content); - JSONObject toCellDataJo = getCellData(toJo); - JSONObject fromCellDataJo = getCellData(JSON.parseObject(detail1.getContent())); - int fl = SheetUtils.getColDataLength(fromCellDataJo, 8, 5); - int tl = SheetUtils.getColDataLength(toCellDataJo, 8, 5); - SheetUtils.replaceAreaForQuantity(fromCellDataJo, toCellDataJo, 8, 5, fl + 7, 7, 8, 2, tl + 7, 4); - content = JSON.toJSONString(toJo); - } - } - } + //三月人力滚动计划/三月机械滚动计划 取上周的 + content = setLastWeekForOne(contentType, period, content); } //设置工程量的本周月等的量 @@ -1009,12 +757,236 @@ public class ContractorMonthlyDetailServiceImpl extends ServiceImpl param) { + Integer hasDefault = MapUtils.getInteger(param, "hasDefault"); + Integer contentType = MapUtils.getInteger(param, "contentType"); + Integer levelType = MapUtils.getInteger(param, "levelType"); + Integer menuType = MapUtils.getInteger(param, "menuType"); + Integer type = MapUtils.getInteger(param, "type"); + ContractorMonthlyPeriod period = contractorMonthlyPeriodService.queryNeedCommit(param); + ProjectGroup group = null; + String content = ""; + Long periodId = null; + Long groupId = null; + if (period != null) { + param.put("periodId", period.getId()); + periodId = period.getId(); + groupId = period.getGroupId(); + group = projectGroupService.getById(groupId); + List queryList = contractorMonthlyDetailService.queryList(param); + if (CollUtil.isNotEmpty(queryList)) { + content = queryList.get(0).getContent(); + } + } + Long deviceId = MapUtils.getLong(param, "deviceId"); + Long enterpriseId = MapUtils.getLong(param, "enterpriseId"); + DeviceUnit unit = deviceUnitService.getById(deviceId); + EnterpriseInfo info = enterpriseInfoService.getById(enterpriseId); + //获取默认的模版 + if (Objects.equals(hasDefault, 1) && StrUtil.isBlank(content)) { + //contentType 1:三月人力滚动计划;2:三月机械滚动计划;3:人力汇总表;4:机械汇总表;5:工程量报表;6:计划工程量报表;7:月报;8:项目计划;9:三周(月)滚动计划 + Integer tempType = getTemplateType(contentType, levelType, type); + ContractorMonthlyTemplate template = contractorMonthlyTemplateService.getById(tempType); + content = replacePlaceHolder(contentType, levelType, type, unit, group, info); + //取上周的 + content = setLastWeekForOne(contentType, period, content); + } + + //设置工程量的本周月等的量 + if (Objects.equals(contentType, 5) || Objects.equals(contentType, 6)) { + content = this.getQuantityContent(contentType, periodId, levelType, type, groupId, deviceId, enterpriseId, content, menuType); + } + + //设置月报编辑权限,增加编辑链接 + /*if (contentType == 7 && type == 2) { + List titleIds = contractorMonthlyConfigService.list(new LambdaQueryWrapper() + .eq(ContractorMonthlyConfig::getUserId, SecurityUtils.getUser().getUserId())).stream().map(ContractorMonthlyConfig::getTitleId).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(titleIds)) { + List titles = contractorMonthlyTitleService.list(new LambdaQueryWrapper() + .eq(ContractorMonthlyTitle::getType, levelType) + .in(ContractorMonthlyTitle::getId, titleIds) + ); + Map titleMap = titles.stream().map(o -> { + o.setWordName(o.getWordName().replace(" ", "").replaceAll("\\u00A0+", "")); + return o; + }).collect(Collectors.toMap(ContractorMonthlyTitle::getWordName, Function.identity(), (o, o2) -> o)); + JSONObject rootJo = JSON.parseObject(content); + JSONArray mainJa = rootJo.getJSONArray("main"); + for (int i = 0; i < mainJa.size(); i++) { + JSONObject jo = mainJa.getJSONObject(i); + if (Objects.equals(jo.get("type"), "title")) { + JSONArray valueList = jo.getJSONArray("valueList"); + StringBuilder readTitle = new StringBuilder(); + for (int i1 = 0; i1 < valueList.size(); i1++) { + JSONObject jo1 = valueList.getJSONObject(i1); + if (!Objects.equals(jo1.getString("type"), "hyperlink")) { + readTitle.append(jo1.getString("value")); + } + } + String key = readTitle.toString().replaceAll("\\u00A0+", ""); + if (titleMap.containsKey(key)) { + Map edit = new JoBuilder() + .put("value", "编辑") + .put("color", "#0000FF") + .put("underline", true) + .build(); + Map editLink = new JoBuilder() + .put("value", "") + .put("type", "hyperlink") + .put("url", wordExcelUrl + "?titleId=" + titleMap.get(key).getId() + "&periodId=" + period.getId() + + "&contentType=" + contentType + "&projectSn=" + period.getProjectSn() + "&token=" + MapUtils.getString(param, "authorization")) + .put("valueList", Collections.singletonList(edit)) + .build(); + valueList.add(editLink); + } + } + } + content = JSON.toJSONString(rootJo); + } + }*/ + + //xls设置默认样式 + JSONObject rootJo1 = JSONObject.parseObject(content); + if (rootJo1 != null && contentType != 7) { + SheetUtils.setDefaultStyle(rootJo1); + content = JSON.toJSONString(rootJo1); + } + return content; + } + + /** + * 三月人力滚动计划/三月机械滚动计划 取上周的 + * + * @param contentType + * @param period + * @param content + * @return + */ + private String setLastWeekForOne(Integer contentType, ContractorMonthlyPeriod period, String content) { + if (contentType == 1 || contentType == 2) { + ContractorMonthlyPeriod p1 = contractorMonthlyPeriodService.getBeforePeriod(period); + ContractorMonthlyPeriod beforeP = contractorMonthlyPeriodService.queryByEntity(p1); + if (beforeP != null) { + ContractorMonthlyDetail detail1 = contractorMonthlyDetailMapper.selectOne(new LambdaQueryWrapper() + .eq(ContractorMonthlyDetail::getContentType, contentType) + .eq(ContractorMonthlyDetail::getPeriodId, beforeP.getId())); + if (detail1 != null) { + JSONObject toJo = JSON.parseObject(content); + JSONObject toCellDataJo = getCellData(toJo); + JSONObject fromCellDataJo = getCellData(JSON.parseObject(detail1.getContent())); + int fl = SheetUtils.getColDataLength(fromCellDataJo, 8, 5); + int tl = SheetUtils.getColDataLength(toCellDataJo, 8, 5); + SheetUtils.replaceAreaForQuantity(fromCellDataJo, toCellDataJo, 8, 5, fl + 7, 7, 8, 2, tl + 7, 4); + content = JSON.toJSONString(toJo); + } + } + } + return content; + } + /** * 查询工程量 * * @param contentType * @param periodId - * @param levelType + * @param contentType 1:三月人力滚动计划;2:三月机械滚动计划;3:人力汇总表;4:机械汇总表;5:工程量报表;6:计划工程量报表;7:月报;8:项目计划;9:三周(月)滚动计划 + * @param levelType 时间级别:1月2周 + * @param type 1承包商2项目组3项目部 * @param type * @param groupId * @param deviceId diff --git a/src/main/java/com/zhgd/xmgl/modules/car/service/impl/CarInfoServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/car/service/impl/CarInfoServiceImpl.java index 7894ca3dd..1c6b67613 100644 --- a/src/main/java/com/zhgd/xmgl/modules/car/service/impl/CarInfoServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/car/service/impl/CarInfoServiceImpl.java @@ -1,7 +1,6 @@ package com.zhgd.xmgl.modules.car.service.impl; import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.StrUtil; @@ -154,7 +153,7 @@ public class CarInfoServiceImpl extends ServiceImpl impl c.setSendSuccessStatus(4); if (old != null) { if (Objects.equals(old.getCarModuleType(), CarInfoCarModuleTypeEnum.GD.getValue())) { - throw new OpenAlertException("该车辆已存在,请勿重复添加!"); + throw new OpenAlertException("该车辆" + old.getCarNumber() + "已存在,请勿重复添加!"); } if (!Objects.equals(c.getFromFlow(), true)) { this.validEnterpriseTime(c); diff --git a/src/main/java/com/zhgd/xmgl/modules/safetyhat/controller/SafetyHatDevController.java b/src/main/java/com/zhgd/xmgl/modules/safetyhat/controller/SafetyHatDevController.java index 8b9a124f2..71554a45d 100644 --- a/src/main/java/com/zhgd/xmgl/modules/safetyhat/controller/SafetyHatDevController.java +++ b/src/main/java/com/zhgd/xmgl/modules/safetyhat/controller/SafetyHatDevController.java @@ -1,5 +1,7 @@ package com.zhgd.xmgl.modules.safetyhat.controller; +import cn.hutool.core.collection.CollUtil; +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; @@ -177,4 +179,30 @@ public class SafetyHatDevController { safetyHatDevService.importExcelTemplate(file, projectSn); return Result.ok(); } + + @OperLog(operModul = "智能安全帽设备管理", operType = "", operDesc = "北京智盟同步智能安全帽-设备信息") + @ApiOperation(value = "北京智盟同步智能安全帽-设备信息", notes = "北京智盟同步智能安全帽-设备信息", httpMethod = "POST") + @PostMapping(value = "/zhiMengSyncDev") + public Result zhimengSyncDev(@RequestBody HashMap param) { + Integer operateType = MapUtils.getInteger(param, "operateType"); + String devSn = MapUtils.getString(param, "devSn"); + if (operateType == 1) { + //操作类型,1:新增或修改 2:删除 + List list = safetyHatDevService.list(new LambdaQueryWrapper() + .eq(SafetyHatDev::getDevSn, devSn)); + if (CollUtil.isEmpty(list)) { + SafetyHatDev dev = new SafetyHatDev(); + dev.setWorkerName(MapUtils.getString(param, "workerName")); + dev.setDevSn(devSn); + dev.setProjectSn(MapUtils.getString(param, "projectSn")); + safetyHatDevService.add(dev); + } + } else { + //操作类型,1:新增或修改 2:删除 + safetyHatDevService.remove(new LambdaQueryWrapper() + .eq(SafetyHatDev::getDevSn, devSn)); + } + return Result.ok(); + } + } diff --git a/src/main/java/com/zhgd/xmgl/security/WebSecurityConfig.java b/src/main/java/com/zhgd/xmgl/security/WebSecurityConfig.java index 84b5f152c..c82485bec 100644 --- a/src/main/java/com/zhgd/xmgl/security/WebSecurityConfig.java +++ b/src/main/java/com/zhgd/xmgl/security/WebSecurityConfig.java @@ -80,6 +80,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { http.authorizeRequests() //请求路径允许访问 + .antMatchers("/xmgl/safetyHatDev/**").permitAll() .antMatchers("/wflow/custom/**").permitAll() .antMatchers("/xmgl/testUnitDeclarationData/flow/add").permitAll() .antMatchers("/xmgl/unitApplyData/flow/add").permitAll()