包头bug修改

This commit is contained in:
guoshengxiong 2025-03-03 18:47:03 +08:00
parent 01a4ef43af
commit 01bc5227f3
10 changed files with 319 additions and 327 deletions

View File

@ -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<String> queryCommitDetail(@ApiIgnore @RequestParam HashMap<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> param) {
// contractorMonthlyDetailService.agree(param);
// return Result.ok();
// }
@OperLog(operModul = "承包商项自组月报周报详情(word和excel版)管理", operType = "", operDesc = "查询编辑的word")
@ApiOperation(value = "查询编辑的word", notes = "查询编辑的word", httpMethod = "GET")
@GetMapping(value = "/getEditWord")

View File

@ -50,8 +50,8 @@ public class PiecemealImplementation implements Serializable {
/**
* 上传时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@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;
/**

View File

@ -39,10 +39,10 @@
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
<if test="timeType == '1'.toString() ">
and t.create_time &gt; CONCAT(DATE_FORMAT(DATE_SUB(now(), interval -7 day), '%Y-%m-%d'), ' 00:00:00')
and t.create_time &gt; CONCAT(DATE_FORMAT(DATE_SUB(now(), interval 7 day), '%Y-%m-%d'), ' 00:00:00')
</if>
<if test="timeType == '2'.toString() ">
and t.create_time &gt; CONCAT(DATE_FORMAT(DATE_SUB(now(), interval -30 day), '%Y-%m-%d'), ' 00:00:00')
and t.create_time &gt; CONCAT(DATE_FORMAT(DATE_SUB(now(), interval 30 day), '%Y-%m-%d'), ' 00:00:00')
</if>
group by t.construction_unit
</select>

View File

@ -68,5 +68,11 @@ public interface IContractorMonthlyPeriodService extends IService<ContractorMont
ContractorMonthlyPeriod getBeforePeriod(ContractorMonthlyPeriod p);
/**
* 查询最近的计划
*
* @param param
* @return
*/
ContractorMonthlyPeriod queryNeedCommit(HashMap<String, Object> param);
}

View File

@ -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<AnticorrosionEn
e.setAntiCorrosionContractorResponsiblePersonDate(FlowUtil.getDate(map, "antiCorrosionContractorResponsiblePersonDate"));
e.setInstruction(MapUtils.getString(map, "instruction"));
e.setLevelType(FlowUtil.getPullDownInteger(map, "levelType"));
e.setNum(FlowUtil.getString(map,"num"));
e.setNum(FlowUtil.getString(map, "num"));
baseMapper.insert(e);
}
@ -171,13 +173,17 @@ public class AnticorrosionEntrustServiceImpl extends ServiceImpl<AnticorrosionEn
@Override
public CountAnticorrosionEntrust countInfoNum(HashMap<String, Object> 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<CountAnticorrosionEntrust> page = baseMapper.countInfo(PageUtil.getPage(param), param);
List<AnticorrosionEntrust> alls = baseMapper.selectList(new LambdaQueryWrapper<AnticorrosionEntrust>()
.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<AnticorrosionEn
.map(o -> ((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 (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(now), entrust.getReportingTime()) <= 0 && DateUtil.compare(DateUtil.endOfWeek(now), entrust.getReportingTime()) >= 0) {
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);
}
//
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);
}
totalPine = NumberUtil.add(totalPine, decimal);
totalSteel = NumberUtil.add(totalSteel, decimal1);

View File

@ -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<ConstructionP
}
@Override
public void edit(ConstructionPlanLedger constructionPlanLedger) {
ConstructionPlanLedger oldConstructionPlanLedger = baseMapper.selectById(constructionPlanLedger.getId());
public void edit(ConstructionPlanLedger ledger) {
ConstructionPlanLedger oldConstructionPlanLedger = baseMapper.selectById(ledger.getId());
if (oldConstructionPlanLedger == null) {
throw new OpenAlertException("未找到对应实体");
}
baseMapper.updateById(constructionPlanLedger);
baseMapper.updateById(ledger);
if (ledger.getConstructionUnitId() == null || ledger.getEpcContractorId() == null) {
this.update(null, new LambdaUpdateWrapper<ConstructionPlanLedger>()
.set(ledger.getConstructionUnitId() == null, ConstructionPlanLedger::getConstructionUnitId, null)
.set(ledger.getEpcContractorId() == null, ConstructionPlanLedger::getEpcContractorId, null)
.eq(ConstructionPlanLedger::getId, ledger.getId()));
}
}
@Override

View File

@ -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<ContractorMo
//获取默认的模版
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 if (Objects.equals(levelType, 2) && Objects.equals(type, 2)) {
tempType = 13;
} else if (Objects.equals(levelType, 1) && Objects.equals(type, 3)) {
tempType = 16;
} else {
tempType = 17;
}
} 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);
content = replacePlaceHolder(contentType, levelType, type, unit, group, info);
//取上周的
if (contentType == 1 || contentType == 2) {
ContractorMonthlyPeriod p1 = contractorMonthlyPeriodService.getBeforePeriod(period);
ContractorMonthlyPeriod beforeP = contractorMonthlyPeriodService.queryByEntity(p1);
if (beforeP != null) {
ContractorMonthlyDetail detail1 = contractorMonthlyDetailMapper.selectOne(new LambdaQueryWrapper<ContractorMonthlyDetail>()
.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<Long> titleIds = contractorMonthlyConfigService.list(new LambdaQueryWrapper<ContractorMonthlyConfig>()
.eq(ContractorMonthlyConfig::getUserId, SecurityUtils.getUser().getUserId())).stream().map(ContractorMonthlyConfig::getTitleId).collect(Collectors.toList());
if (CollUtil.isNotEmpty(titleIds)) {
List<ContractorMonthlyTitle> titles = contractorMonthlyTitleService.list(new LambdaQueryWrapper<ContractorMonthlyTitle>()
.eq(ContractorMonthlyTitle::getType, levelType)
.in(ContractorMonthlyTitle::getId, titleIds)
);
Map<String, ContractorMonthlyTitle> 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<String, Object> edit = new JoBuilder()
.put("value", "编辑")
.put("color", "#0000FF")
.put("underline", true)
.build();
Map<String, Object> 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<String, Object> 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<ContractorMonthlyDetail> 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<ContractorMonthlyDetail>()
.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<ContractorMo
return content;
}
/**
* 替换占位符
*
* @param contentType 1:三月人力滚动计划;2:三月机械滚动计划;3:人力汇总表;4:机械汇总表;5:工程量报表;6:计划工程量报表;7:月报;8:项目计划;9:三周()滚动计划
* @param levelType 时间级别1月2周
* @param type 1承包商2项目组3项目部
* @param unit
* @param group
* @param info
* @return
*/
@NotNull
private String replacePlaceHolder(Integer contentType, Integer levelType, Integer type, DeviceUnit unit, ProjectGroup group, EnterpriseInfo info) {
String content;
Integer tempType = getTemplateType(contentType, levelType, type);
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);
content = content.replace("{{today}}", DateUtil.today());
return content;
}
/**
* 获取数据库的模板的类型和前端的类型不一样
*
* @param contentType 1:三月人力滚动计划;2:三月机械滚动计划;3:人力汇总表;4:机械汇总表;5:工程量报表;6:计划工程量报表;7:月报;8:项目计划;9:三周()滚动计划
* @param levelType 时间级别1月2周
* @param type 1承包商2项目组3项目部
* @return
*/
private Integer getTemplateType(Integer contentType, Integer levelType, Integer type) {
Integer tempType = contentType;
if (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 if (Objects.equals(levelType, 2) && Objects.equals(type, 2)) {
tempType = 13;
} else if (Objects.equals(levelType, 1) && Objects.equals(type, 3)) {
tempType = 16;
} else {
tempType = 17;
}
} 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;
}
}
return tempType;
}
@Override
public String queryCommitDetail(HashMap<String, Object> 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<ContractorMonthlyDetail> 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<Long> titleIds = contractorMonthlyConfigService.list(new LambdaQueryWrapper<ContractorMonthlyConfig>()
.eq(ContractorMonthlyConfig::getUserId, SecurityUtils.getUser().getUserId())).stream().map(ContractorMonthlyConfig::getTitleId).collect(Collectors.toList());
if (CollUtil.isNotEmpty(titleIds)) {
List<ContractorMonthlyTitle> titles = contractorMonthlyTitleService.list(new LambdaQueryWrapper<ContractorMonthlyTitle>()
.eq(ContractorMonthlyTitle::getType, levelType)
.in(ContractorMonthlyTitle::getId, titleIds)
);
Map<String, ContractorMonthlyTitle> 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<String, Object> edit = new JoBuilder()
.put("value", "编辑")
.put("color", "#0000FF")
.put("underline", true)
.build();
Map<String, Object> 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<ContractorMonthlyDetail>()
.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

View File

@ -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<CarInfoMapper, CarInfo> 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);

View File

@ -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<String, Object> param) {
Integer operateType = MapUtils.getInteger(param, "operateType");
String devSn = MapUtils.getString(param, "devSn");
if (operateType == 1) {
//操作类型1新增或修改 2删除
List<SafetyHatDev> list = safetyHatDevService.list(new LambdaQueryWrapper<SafetyHatDev>()
.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<SafetyHatDev>()
.eq(SafetyHatDev::getDevSn, devSn));
}
return Result.ok();
}
}

View File

@ -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()