From fd64d7998d41bc7bc1187f675bba942793bfd9cd Mon Sep 17 00:00:00 2001 From: pengjie <17373303529@163.com> Date: Mon, 10 Jul 2023 15:20:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=95=E8=B5=84=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GovInvestmentPaymentItemController.java | 2 +- .../InvestmentPaymentItemController.java | 2 +- .../modules/safety/entity/InspectRecord.java | 4 ++ .../modules/safety/entity/ProjectSubItem.java | 2 +- .../impl/InspectRecordServiceImpl.java | 23 +++++++-- .../InvestmentPaymentItemServiceImpl.java | 20 +------- .../impl/ProjectSubItemServiceImpl.java | 48 ++++++++++--------- .../java/com/zhgd/xmgl/task/SlippageTask.java | 44 +++++++++++++++++ .../magic/api/惠州项目管理政务版/投资管理.ms | 25 +++++----- .../magic/api/惠州项目管理项目版/支付管理.ms | 20 ++++---- 10 files changed, 119 insertions(+), 71 deletions(-) create mode 100644 src/main/java/com/zhgd/xmgl/task/SlippageTask.java diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/government/GovInvestmentPaymentItemController.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/government/GovInvestmentPaymentItemController.java index 82545b0..f4fff97 100644 --- a/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/government/GovInvestmentPaymentItemController.java +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/government/GovInvestmentPaymentItemController.java @@ -48,7 +48,7 @@ public class GovInvestmentPaymentItemController { @ApiOperation(value = " 分页列表查询投资支付子项信息", notes = "分页列表查询投资支付子项信息", httpMethod = "POST") @ApiImplicitParams({ @ApiImplicitParam(name = "reportContent", value = "汇报内容", paramType = "body", dataType = "String"), - @ApiImplicitParam(name = "investmentPaymentId", value = "投资支付ID", paramType = "body", required = true, dataType = "String"), +// @ApiImplicitParam(name = "investmentPaymentId", value = "投资支付ID", paramType = "body", required = true, dataType = "String"), @ApiImplicitParam(name = "investmentApplyId", value = "投资支付申报ID", paramType = "body", required = true, dataType = "String"), @ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer") diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/project/InvestmentPaymentItemController.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/project/InvestmentPaymentItemController.java index 15be6d8..2f82a9a 100644 --- a/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/project/InvestmentPaymentItemController.java +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/project/InvestmentPaymentItemController.java @@ -49,7 +49,7 @@ public class InvestmentPaymentItemController { @ApiOperation(value = " 分页列表查询投资支付子项信息", notes = "分页列表查询投资支付子项信息", httpMethod = "POST") @ApiImplicitParams({ @ApiImplicitParam(name = "reportContent", value = "汇报内容", paramType = "body", dataType = "String"), - @ApiImplicitParam(name = "investmentPaymentId", value = "投资支付记录ID", paramType = "body", required = true, dataType = "String"), +// @ApiImplicitParam(name = "investmentPaymentId", value = "投资支付记录ID", paramType = "body", required = true, dataType = "String"), @ApiImplicitParam(name = "investmentApplyId", value = "投资支付申报ID", paramType = "body", required = true, dataType = "String"), @ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer") diff --git a/src/main/java/com/zhgd/xmgl/modules/safety/entity/InspectRecord.java b/src/main/java/com/zhgd/xmgl/modules/safety/entity/InspectRecord.java index 0353680..417567b 100644 --- a/src/main/java/com/zhgd/xmgl/modules/safety/entity/InspectRecord.java +++ b/src/main/java/com/zhgd/xmgl/modules/safety/entity/InspectRecord.java @@ -131,4 +131,8 @@ public class InspectRecord implements Serializable { @TableField(exist = false) @ApiModelProperty(value = "工程名称") private String engineeringName; + + @TableField(exist = false) + @ApiModelProperty(value = "逾期天数") + private Long slippage; } diff --git a/src/main/java/com/zhgd/xmgl/modules/safety/entity/ProjectSubItem.java b/src/main/java/com/zhgd/xmgl/modules/safety/entity/ProjectSubItem.java index e1d5432..a277ed0 100644 --- a/src/main/java/com/zhgd/xmgl/modules/safety/entity/ProjectSubItem.java +++ b/src/main/java/com/zhgd/xmgl/modules/safety/entity/ProjectSubItem.java @@ -122,7 +122,7 @@ public class ProjectSubItem implements Serializable { */ @TableField(exist = false) @ApiModelProperty(value = "逾期天数") - private Integer slippage; + private Long slippage; /** * 附件地址 */ diff --git a/src/main/java/com/zhgd/xmgl/modules/safety/service/impl/InspectRecordServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/safety/service/impl/InspectRecordServiceImpl.java index abdf389..f072434 100644 --- a/src/main/java/com/zhgd/xmgl/modules/safety/service/impl/InspectRecordServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/safety/service/impl/InspectRecordServiceImpl.java @@ -1,23 +1,29 @@ package com.zhgd.xmgl.modules.safety.service.impl; +import cn.hutool.core.date.DateUnit; +import cn.hutool.core.date.DateUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zhgd.xmgl.handler.exception.CustomException; +import com.zhgd.xmgl.modules.basicdata.entity.Engineering; +import com.zhgd.xmgl.modules.basicdata.entity.EngineeringMain; +import com.zhgd.xmgl.modules.basicdata.entity.Project; +import com.zhgd.xmgl.modules.basicdata.service.IEngineeringMainService; +import com.zhgd.xmgl.modules.basicdata.service.IEngineeringService; +import com.zhgd.xmgl.modules.basicdata.service.IProjectService; import com.zhgd.xmgl.modules.safety.dto.InspectRecordDto; import com.zhgd.xmgl.modules.safety.dto.InspectRecordStatDto; -import com.zhgd.xmgl.modules.basicdata.entity.*; -import com.zhgd.xmgl.modules.safety.mapper.InspectRecordMapper; -import com.zhgd.xmgl.modules.basicdata.service.*; -import com.zhgd.xmgl.modules.safety.vo.InspectRecordVo; import com.zhgd.xmgl.modules.safety.entity.InspectQuestion; import com.zhgd.xmgl.modules.safety.entity.InspectQuestionExamine; import com.zhgd.xmgl.modules.safety.entity.InspectRecord; +import com.zhgd.xmgl.modules.safety.mapper.InspectRecordMapper; import com.zhgd.xmgl.modules.safety.service.IInspectQuestionExamineService; import com.zhgd.xmgl.modules.safety.service.IInspectQuestionService; import com.zhgd.xmgl.modules.safety.service.IInspectRecordService; +import com.zhgd.xmgl.modules.safety.vo.InspectRecordVo; import com.zhgd.xmgl.security.SecurityUser; import com.zhgd.xmgl.security.SecurityUtil; import com.zhgd.xmgl.util.ParamEnum; @@ -89,7 +95,14 @@ public class InspectRecordServiceImpl extends ServiceImpl 2) { wrapper.gt("i.state", 1); } - return baseMapper.pageList(page, wrapper); + Page inspectRecordDtoPage = baseMapper.pageList(page, wrapper); + inspectRecordDtoPage.getRecords().forEach(i -> { + if (i.getState() != 4 && i.getState() != 1) { + long betweenDay = DateUtil.between(i.getDeadline(), new Date(), DateUnit.DAY, false); + i.setSlippage(betweenDay <= 0 ? null : betweenDay); + } + }); + return inspectRecordDtoPage; } @Override diff --git a/src/main/java/com/zhgd/xmgl/modules/safety/service/impl/InvestmentPaymentItemServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/safety/service/impl/InvestmentPaymentItemServiceImpl.java index b093f5c..d89403c 100644 --- a/src/main/java/com/zhgd/xmgl/modules/safety/service/impl/InvestmentPaymentItemServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/safety/service/impl/InvestmentPaymentItemServiceImpl.java @@ -8,22 +8,16 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zhgd.jeecg.common.system.query.QueryGenerator; import com.zhgd.jeecg.common.util.PageUtil; -import com.zhgd.xmgl.handler.exception.CustomException; import com.zhgd.xmgl.modules.basicdata.entity.Engineering; import com.zhgd.xmgl.modules.basicdata.service.IEngineeringService; -import com.zhgd.xmgl.modules.safety.entity.InvestmentApply; import com.zhgd.xmgl.modules.safety.entity.InvestmentPaymentItem; import com.zhgd.xmgl.modules.safety.mapper.InvestmentPaymentItemMapper; -import com.zhgd.xmgl.modules.safety.service.IInvestmentApplyService; import com.zhgd.xmgl.modules.safety.service.IInvestmentPaymentItemService; import org.apache.commons.collections.MapUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.Arrays; -import java.util.List; import java.util.Map; -import java.util.stream.Collectors; /** * @Description: 投资支付子项 @@ -37,23 +31,11 @@ public class InvestmentPaymentItemServiceImpl extends ServiceImpl pageList(Map map) { QueryWrapper queryWrapper = QueryGenerator.initPageQueryWrapper(InvestmentPaymentItem.class, map); if (StringUtils.isBlank(MapUtils.getString(map, "investmentApplyId"))) { - String investmentPaymentId = MapUtils.getString(map, "investmentPaymentId"); - if(StringUtils.isBlank(investmentPaymentId)) { - throw new CustomException("缺少参数"); - } - List investmentApplyList = investmentApplyService.list(Wrappers.lambdaQuery().eq(InvestmentApply::getInvestmentPaymentId, investmentPaymentId)); - List applyIds = Arrays.asList(0L); - if (investmentApplyList.size() > 0) { - applyIds = investmentApplyList.stream().map(i -> i.getId()).collect(Collectors.toList()); - } - queryWrapper.lambda().in(InvestmentPaymentItem::getInvestmentApplyId, applyIds); + return new Page<>(); } Page page = PageUtil.getPage(map); return baseMapper.selectPage(page, queryWrapper); diff --git a/src/main/java/com/zhgd/xmgl/modules/safety/service/impl/ProjectSubItemServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/safety/service/impl/ProjectSubItemServiceImpl.java index 2364537..781d5cf 100644 --- a/src/main/java/com/zhgd/xmgl/modules/safety/service/impl/ProjectSubItemServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/safety/service/impl/ProjectSubItemServiceImpl.java @@ -1,6 +1,7 @@ package com.zhgd.xmgl.modules.safety.service.impl; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -154,22 +155,22 @@ public class ProjectSubItemServiceImpl extends ServiceImpl 0) { List children = baseMapper.selectList(Wrappers.lambdaQuery().in(ProjectSubItem::getParentId, ids)); for (ProjectSubItem child : children) { - int compare = 0; - if (child.getRealEndTime() != null) { - compare = DateUtil.compare(child.getRealEndTime(), child.getPlanEndTime()); - } else { - compare = DateUtil.compare(new Date(), child.getPlanEndTime()); + if (child.getState() != 3) { + if (child.getRealEndTime() != null) { + child.setSlippage(DateUtil.compare(child.getRealEndTime(), child.getPlanEndTime()) <= 0 ? null : DateUtil.between(child.getRealEndTime(), child.getPlanEndTime(), DateUnit.DAY)); + } else { + child.setSlippage(DateUtil.compare(new Date(), child.getPlanEndTime()) <= 0 ? null : DateUtil.between(new Date(), child.getPlanEndTime(), DateUnit.DAY)); + } } - child.setSlippage(compare < 0 ? 0 : compare); } for (ProjectSubItemDto subItem : records) { - int compare = 0; - if (subItem.getRealEndTime() != null) { - compare = DateUtil.compare(subItem.getRealEndTime(), subItem.getPlanEndTime()); - } else { - compare = DateUtil.compare(new Date(), subItem.getPlanEndTime()); + if (subItem.getState() != 3) { + if (subItem.getRealEndTime() != null) { + subItem.setSlippage(DateUtil.compare(subItem.getRealEndTime(), subItem.getPlanEndTime()) <= 0 ? null : DateUtil.between(subItem.getRealEndTime(), subItem.getPlanEndTime(), DateUnit.DAY)); + } else { + subItem.setSlippage(DateUtil.compare(new Date(), subItem.getPlanEndTime()) <= 0 ? null : DateUtil.between(new Date(), subItem.getPlanEndTime(), DateUnit.DAY)); + } } - subItem.setSlippage(compare < 0 ? 0 : compare); subItem.setChildren(children.stream().filter(c -> c.getParentId().equals(subItem.getId())).collect(Collectors.toList())); } } @@ -177,13 +178,13 @@ public class ProjectSubItemServiceImpl extends ServiceImpl records) { for (ProjectSubItem subItem : records) { - int compare = 0; - if (subItem.getRealEndTime() != null) { - compare = DateUtil.compare(subItem.getRealEndTime(), subItem.getPlanEndTime()); - } else { - compare = DateUtil.compare(new Date(), subItem.getPlanEndTime()); + if (subItem.getState() != 3) { + if (subItem.getRealEndTime() != null) { + subItem.setSlippage(DateUtil.compare(subItem.getRealEndTime(), subItem.getPlanEndTime()) <= 0 ? null : DateUtil.between(subItem.getRealEndTime(), subItem.getPlanEndTime(), DateUnit.DAY)); + } else { + subItem.setSlippage(DateUtil.compare(new Date(), subItem.getPlanEndTime()) <= 0 ? null : DateUtil.between(new Date(), subItem.getPlanEndTime(), DateUnit.DAY)); + } } - subItem.setSlippage(compare < 0 ? 0 : compare); } } @@ -277,15 +278,16 @@ public class ProjectSubItemServiceImpl extends ServiceImpl System.currentTimeMillis()) { - projectSubItem.setCompleteRatio(new BigDecimal(0)); - projectSubItem.setState(1); - } else if (task.getPercentageComplete().intValue() == 100 || (actualFinishDate != null && actualFinishDate.getTime() <= System.currentTimeMillis())) { - projectSubItem.setCompleteRatio(new BigDecimal(100)); + if (task.getPercentageComplete().intValue() == 100 || (actualFinishDate != null && actualFinishDate.getTime() <= System.currentTimeMillis())) { projectSubItem.setState(3); + } else if (DateUtil.between(projectSubItem.getPlanEndTime(), new Date(), DateUnit.DAY, false) > 0){ + projectSubItem.setState(4); + } else if (task.getPercentageComplete().intValue() == 0 || actualStartDate == null || actualStartDate.getTime() > System.currentTimeMillis()) { + projectSubItem.setState(1); } else { projectSubItem.setState(2); } + projectSubItem.setCompleteRatio(new BigDecimal(task.getPercentageComplete().intValue())); // 负责人名称 String dutyUserName = task.getText(1); projectSubItem.setCommander(dutyUserName); diff --git a/src/main/java/com/zhgd/xmgl/task/SlippageTask.java b/src/main/java/com/zhgd/xmgl/task/SlippageTask.java new file mode 100644 index 0000000..16210d9 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/task/SlippageTask.java @@ -0,0 +1,44 @@ +package com.zhgd.xmgl.task; + +import cn.hutool.core.date.DateUnit; +import cn.hutool.core.date.DateUtil; +import com.zhgd.xmgl.modules.safety.entity.ProjectSubItem; +import com.zhgd.xmgl.modules.safety.service.IProjectSubItemService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * @description: 视频监控定时任务 + **/ +@Slf4j +@Component +public class SlippageTask { + + @Autowired + private IProjectSubItemService projectSubItemService; + + /** + * 每天凌晨计算项目进度是否逾期 + */ + @Scheduled(cron = "0 0 2 * * ?") + private void projectSubItem() { + List change = new ArrayList<>(); + List list = projectSubItemService.list(); + list.stream().forEach(l -> { + if (l.getState() != 3 && DateUtil.between(l.getPlanEndTime(), new Date(), DateUnit.DAY, false) > 0) { + l.setState(4); + change.add(l); + } + }); + if (change.size() > 0) { + projectSubItemService.updateBatchById(change); + } + log.info("=========定时修改项目进度状态任务执行成功========"); + } +} diff --git a/src/main/resources/magic/api/惠州项目管理政务版/投资管理.ms b/src/main/resources/magic/api/惠州项目管理政务版/投资管理.ms index a9db889..f3fd151 100644 --- a/src/main/resources/magic/api/惠州项目管理政务版/投资管理.ms +++ b/src/main/resources/magic/api/惠州项目管理政务版/投资管理.ms @@ -5,7 +5,7 @@ "groupId" : "1f3d3e5b9fe340bab84de67b0de08f44", "name" : "投资管理", "createTime" : null, - "updateTime" : 1688866586913, + "updateTime" : 1688970096225, "lock" : null, "createBy" : "admin", "updateBy" : "admin", @@ -35,17 +35,18 @@ BigDecimal realPayAmountByYear = db.selectValue("SELECT IFNULL(SUM(pay_amount), BigDecimal applyAmountTotal = db.selectValue("SELECT IFNULL(SUM(apply_payment), 0) FROM investment_payment_stat WHERE #project") BigDecimal paymentTotal = db.selectValue("SELECT IFNULL(SUM(payment), 0) FROM investment_payment_stat WHERE #project") -result.put("paymentByMonth", paymentByMonth) -result.put("applyAmountByMonth", applyAmountByMonth) -result.put("realPayAmountByMonth", realPayAmountByMonth) -result.put("unPayAmountByMonth", applyAmountByMonth.subtract(realPayAmountByMonth)) +BigDecimal big = new BigDecimal(10000); +result.put("paymentByMonth", paymentByMonth.divide(big)) +result.put("applyAmountByMonth", applyAmountByMonth.divide(big)) +result.put("realPayAmountByMonth", realPayAmountByMonth.divide(big)) +result.put("unPayAmountByMonth", applyAmountByMonth.subtract(realPayAmountByMonth).divide(big)) -result.put("totalAmount", totalAmount) +result.put("totalAmount", totalAmount.divide(big)) result.put("payRatio", realPayAmountTotal == 0 ? 0 : realPayAmountTotal.divide(totalAmount, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")).doubleValue()) -result.put("paymentTotal", paymentTotal) -result.put("applyAmountTotal", applyAmountTotal) -result.put("settlementAmount", settlementAmount) -result.put("settlementAmountByYear", settlementAmountByYear) -result.put("realPayAmountTotal", realPayAmountTotal) -result.put("realPayAmountByYear", realPayAmountByYear) +result.put("paymentTotal", paymentTotal.divide(big)) +result.put("applyAmountTotal", applyAmountTotal.divide(big)) +result.put("settlementAmount", settlementAmount.divide(big)) +result.put("settlementAmountByYear", settlementAmountByYear.divide(big)) +result.put("realPayAmountTotal", realPayAmountTotal.divide(big)) +result.put("realPayAmountByYear", realPayAmountByYear.divide(big)) return result \ No newline at end of file diff --git a/src/main/resources/magic/api/惠州项目管理项目版/支付管理.ms b/src/main/resources/magic/api/惠州项目管理项目版/支付管理.ms index 51da794..f35eff1 100644 --- a/src/main/resources/magic/api/惠州项目管理项目版/支付管理.ms +++ b/src/main/resources/magic/api/惠州项目管理项目版/支付管理.ms @@ -5,7 +5,7 @@ "groupId" : "de890cb5bb01484ab1feeedd1eb1c1dd", "name" : "支付管理", "createTime" : null, - "updateTime" : 1688900331033, + "updateTime" : 1688970386266, "lock" : null, "createBy" : null, "updateBy" : "admin", @@ -31,13 +31,15 @@ BigDecimal applyAmountByYear = db.selectValue("SELECT IFNULL(SUM(s.apply_payment BigDecimal applyAmountByMonth = db.selectValue("SELECT IFNULL(SUM(s.apply_payment), 0) FROM investment_apply a INNER JOIN investment_payment_stat s ON a.id = s.investment_apply_id WHERE DATE_FORMAT(apply_time, '%Y-%m') = DATE_FORMAT(now(), '%Y-%m') AND #projectalias ") Map payAmountByYear = db.selectValue("SELECT IFNULL(SUM(pay_amount), 0) FROM investment_payment WHERE DATE_FORMAT(pay_time, '%Y') = DATE_FORMAT(now(), '%Y') AND #project") Map payAmountByMonth = db.selectValue("SELECT IFNULL(SUM(pay_amount), 0) FROM investment_payment WHERE DATE_FORMAT(pay_time, '%Y-%m') = DATE_FORMAT(now(), '%Y-%m') AND #project") -result.put("payAmount", payAmount) -result.put("totalAmount", totalAmount.subtract(payAmount)) + +BigDecimal big = new BigDecimal(10000); +result.put("payAmount", payAmount.divide(big)) +result.put("totalAmount", totalAmount.subtract(payAmount).divide(big)) result.put("payRatio", payAmount == 0 ? 0 : payAmount.divide(totalAmount, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")).doubleValue()) -result.put("applyAmountTotal", applyAmountTotal) -result.put("applyAmountByYear", applyAmountByYear) -result.put("applyAmountByMonth", applyAmountByMonth) -result.put("payAmountTotal", payAmount) -result.put("payAmountByYear", payAmountByYear) -result.put("payAmountByMonth", payAmountByMonth) +result.put("applyAmountTotal", applyAmountTotal.divide(big)) +result.put("applyAmountByYear", applyAmountByYear.divide(big)) +result.put("applyAmountByMonth", applyAmountByMonth.divide(big)) +result.put("payAmountTotal", payAmount.divide(big)) +result.put("payAmountByYear", payAmountByYear.divide(big)) +result.put("payAmountByMonth", payAmountByMonth.divide(big)) return result \ No newline at end of file