协议书编号
This commit is contained in:
parent
b3f45b178b
commit
9042c13c4c
|
|
@ -64,7 +64,7 @@ public class IwsCostPushTask {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定时任务 -- 保存未结算报表记录 -- 每月最后一天的23点00分执行
|
* 定时任务 -- 保存未结算报表记录(工器具) -- 每月最后一天的23点00分执行
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 00 23 L * ?", zone = "Asia/Shanghai")
|
@Scheduled(cron = "0 00 23 L * ?", zone = "Asia/Shanghai")
|
||||||
public void saveUnSltHistoryReport() {
|
public void saveUnSltHistoryReport() {
|
||||||
|
|
@ -234,10 +234,8 @@ public class IwsCostPushTask {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("保存未结算报表记录到数据库失败,记录数量:{}", validRecords.size(), e);
|
log.error("保存未结算报表记录到数据库失败,记录数量:{}", validRecords.size(), e);
|
||||||
// 打印所有记录的关键信息用于排查
|
// 打印所有记录的关键信息用于排查
|
||||||
validRecords.forEach(vo -> {
|
validRecords.forEach(vo -> log.error("失败记录:agreementId={}, agreementCode={}, unitName={}, projectName={}",
|
||||||
log.error("失败记录:agreementId={}, agreementCode={}, unitName={}, projectName={}",
|
vo.getAgreementId(), vo.getAgreementCode(), vo.getUnitName(), vo.getProjectName()));
|
||||||
vo.getAgreementId(), vo.getAgreementCode(), vo.getUnitName(), vo.getProjectName());
|
|
||||||
});
|
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -247,7 +245,6 @@ public class IwsCostPushTask {
|
||||||
log.error("保存未结算报表记录失败", e);
|
log.error("保存未结算报表记录失败", e);
|
||||||
throw e;
|
throw e;
|
||||||
} finally {
|
} finally {
|
||||||
// 在整个批量处理完成后清理缓存,而不是在每次循环中清理
|
|
||||||
sltAgreementInfoService.clearCache();
|
sltAgreementInfoService.clearCache();
|
||||||
log.info("缓存已清理");
|
log.info("缓存已清理");
|
||||||
}
|
}
|
||||||
|
|
@ -257,7 +254,7 @@ public class IwsCostPushTask {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定时任务 -- 保存未结算报表记录 -- 每月最后一天的23点10分执行
|
* 定时任务 -- 保存未结算报表记录(安全工器具) -- 每月最后一天的23点10分执行
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 10 23 L * ?", zone = "Asia/Shanghai")
|
@Scheduled(cron = "0 10 23 L * ?", zone = "Asia/Shanghai")
|
||||||
public void saveUnSltSafetyHistoryReport() {
|
public void saveUnSltSafetyHistoryReport() {
|
||||||
|
|
|
||||||
|
|
@ -2018,6 +2018,17 @@ public class SltAgreementInfoController extends BaseController {
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改结算协议书编号
|
||||||
|
* @param sltAgreementInfo 编号
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "修改结算协议书编号")
|
||||||
|
@PostMapping("/updateSltBookCodeById")
|
||||||
|
public AjaxResult updateSltBookCodeById(@RequestBody SltAgreementInfo sltAgreementInfo) {
|
||||||
|
int result = sltAgreementInfoService.updateSltBookCodeById(sltAgreementInfo);
|
||||||
|
return result > 0 ? success("修改成功") : error();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -322,4 +322,7 @@ public class SltAgreementInfo extends BaseEntity {
|
||||||
|
|
||||||
@ApiModelProperty(value = "任务状态列表")
|
@ApiModelProperty(value = "任务状态列表")
|
||||||
private List<Integer> statusList;
|
private List<Integer> statusList;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "结算协议书编号")
|
||||||
|
private String bookCode;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
package com.bonus.material.settlement.domain;
|
package com.bonus.material.settlement.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结算历史报表对象 slt_history_report
|
* 结算历史报表对象 slt_history_report
|
||||||
|
|
@ -30,4 +33,15 @@ public class SltHistoryReport {
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
private Long companyId;
|
private Long companyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0未竣工 1竣工 2未竣工并且未绑定i8工程
|
||||||
|
*/
|
||||||
|
private Integer isFinish;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 竣工日期
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
|
private Date actualEndDate;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -192,4 +192,9 @@ public class SltInfoVo {
|
||||||
private List<SltInfoVo> signUrlList;
|
private List<SltInfoVo> signUrlList;
|
||||||
|
|
||||||
private Long companyId;
|
private Long companyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 协议书编号
|
||||||
|
*/
|
||||||
|
private String bookCode;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,11 @@ public interface SltAgreementInfoMapper {
|
||||||
*/
|
*/
|
||||||
public int insertSltAgreementInfo(SltAgreementInfo sltAgreementInfo);
|
public int insertSltAgreementInfo(SltAgreementInfo sltAgreementInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改结算协议书编号
|
||||||
|
*/
|
||||||
|
int updateSltBookCodeById(SltAgreementInfo sltAgreementInfo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改结算信息
|
* 修改结算信息
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -184,6 +184,11 @@ public interface ISltAgreementInfoService {
|
||||||
*/
|
*/
|
||||||
List<PeriodCostSummaryVo> selectPeriodCostSummary(PeriodCostQueryDto queryDto);
|
List<PeriodCostSummaryVo> selectPeriodCostSummary(PeriodCostQueryDto queryDto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改结算协议书编号
|
||||||
|
*/
|
||||||
|
int updateSltBookCodeById(SltAgreementInfo sltAgreementInfo);
|
||||||
|
|
||||||
|
|
||||||
List<SltAgreementInfo> getRepairCodeList(SltAgreementInfo bean);
|
List<SltAgreementInfo> getRepairCodeList(SltAgreementInfo bean);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1884,6 +1884,16 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改结算协议书编号
|
||||||
|
*
|
||||||
|
* @param sltAgreementInfo ID及协议书编号
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateSltBookCodeById(SltAgreementInfo sltAgreementInfo) {
|
||||||
|
return sltAgreementInfoMapper.updateSltBookCodeById(sltAgreementInfo);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SltAgreementInfo> getRepairCodeList(SltAgreementInfo bean) {
|
public List<SltAgreementInfo> getRepairCodeList(SltAgreementInfo bean) {
|
||||||
return sltAgreementInfoMapper.getRepairCodeList(bean);
|
return sltAgreementInfoMapper.getRepairCodeList(bean);
|
||||||
|
|
@ -1928,6 +1938,9 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
||||||
summary.setQueryStartDate(queryStartDate);
|
summary.setQueryStartDate(queryStartDate);
|
||||||
summary.setQueryEndDate(queryEndDate);
|
summary.setQueryEndDate(queryEndDate);
|
||||||
summary.setRemark(firstDetail.getRemark());
|
summary.setRemark(firstDetail.getRemark());
|
||||||
|
summary.setActualEndDate(firstDetail.getActualEndDate());
|
||||||
|
summary.setIsFinish(firstDetail.getIsFinish());
|
||||||
|
summary.setProStatus((firstDetail.getIsFinish() != null && firstDetail.getIsFinish().equals("1")) ? "已竣工" : "未竣工");
|
||||||
|
|
||||||
// 计算汇总数据
|
// 计算汇总数据
|
||||||
int equipmentTypeCount = agreementDetails.size(); // 设备种类数量
|
int equipmentTypeCount = agreementDetails.size(); // 设备种类数量
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,13 @@ import com.bonus.material.settlement.domain.SltHistoryReport;
|
||||||
import com.bonus.material.settlement.domain.SltHistoryReportDetail;
|
import com.bonus.material.settlement.domain.SltHistoryReportDetail;
|
||||||
import com.bonus.material.settlement.mapper.SltAgreementInfoMapper;
|
import com.bonus.material.settlement.mapper.SltAgreementInfoMapper;
|
||||||
import com.bonus.material.settlement.service.SltHistoryReportService;
|
import com.bonus.material.settlement.service.SltHistoryReportService;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class SltHistoryReportServiceImpl implements SltHistoryReportService {
|
public class SltHistoryReportServiceImpl implements SltHistoryReportService {
|
||||||
|
|
@ -19,7 +22,19 @@ public class SltHistoryReportServiceImpl implements SltHistoryReportService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SltHistoryReport> selectHistoryReportList(SltHistoryReport report) {
|
public List<SltHistoryReport> selectHistoryReportList(SltHistoryReport report) {
|
||||||
return sltAgreementInfoMapper.selectSltHistoryReportList(report);
|
List<SltHistoryReport> sltHistoryReports = sltAgreementInfoMapper.selectSltHistoryReportList(report);
|
||||||
|
|
||||||
|
sltHistoryReports.removeIf(Objects::isNull);
|
||||||
|
|
||||||
|
if (CollectionUtils.isEmpty(sltHistoryReports)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return sltHistoryReports;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -2173,6 +2173,12 @@
|
||||||
|
|
||||||
<select id="selectSltHistoryReportList" resultType="com.bonus.material.settlement.domain.SltHistoryReport">
|
<select id="selectSltHistoryReportList" resultType="com.bonus.material.settlement.domain.SltHistoryReport">
|
||||||
SELECT
|
SELECT
|
||||||
|
case
|
||||||
|
WHEN bp.actual_end_date is not null THEN '1'
|
||||||
|
WHEN bp.actual_end_date is null and bp.external_id is null THEN '2'
|
||||||
|
ELSE '0'
|
||||||
|
END as isFinish,
|
||||||
|
bp.actual_end_date as actualEndDate,
|
||||||
shr.id,
|
shr.id,
|
||||||
shr.agreement_id as agreementId,
|
shr.agreement_id as agreementId,
|
||||||
shr.agreement_code as agreementCode,
|
shr.agreement_code as agreementCode,
|
||||||
|
|
@ -2188,13 +2194,18 @@
|
||||||
shr.reduction_cost as reductionCost,
|
shr.reduction_cost as reductionCost,
|
||||||
shr.`year_month` as yearMonth,
|
shr.`year_month` as yearMonth,
|
||||||
shr.create_time as createTime
|
shr.create_time as createTime
|
||||||
FROM slt_history_report shr
|
FROM
|
||||||
left join bm_agreement_info bai on shr.agreement_id =bai.agreement_id
|
slt_history_report shr
|
||||||
|
left join bm_agreement_info bai on shr.agreement_id = bai.agreement_id
|
||||||
|
LEFT JOIN slt_agreement_apply saa ON saa.agreement_id = shr.agreement_id AND saa.settlement_type = #{settlementType}
|
||||||
|
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||||
WHERE
|
WHERE
|
||||||
shr.`year_month` = #{yearMonth}
|
shr.`year_month` = #{yearMonth}
|
||||||
and shr.settlement_type = #{settlementType}
|
and shr.settlement_type = #{settlementType}
|
||||||
<if test="companyId !=null"> and bai.company_id =#{companyId}</if>
|
AND saa.id IS NULL
|
||||||
ORDER BY shr.create_time DESC
|
<if test="companyId !=null"> and bai.company_id =#{companyId}</if>
|
||||||
|
ORDER BY
|
||||||
|
shr.create_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getAgreementInfo" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
<select id="getAgreementInfo" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
||||||
|
|
@ -2348,7 +2359,7 @@
|
||||||
|
|
||||||
<select id="getSltAgreementBook" resultType="com.bonus.material.settlement.domain.vo.SltInfoVo">
|
<select id="getSltAgreementBook" resultType="com.bonus.material.settlement.domain.vo.SltInfoVo">
|
||||||
SELECT
|
SELECT
|
||||||
agreementId,
|
agreementId, res.bookCode,
|
||||||
bai.agreement_code as agreementCode,
|
bai.agreement_code as agreementCode,
|
||||||
LEFT(createTime,10) as applyTime,
|
LEFT(createTime,10) as applyTime,
|
||||||
bui.unit_name AS unitName,
|
bui.unit_name AS unitName,
|
||||||
|
|
@ -2364,20 +2375,21 @@
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
saa.agreement_id AS agreementId,
|
saa.book_code as bookCode,
|
||||||
saa.create_time AS createTime,
|
saa.agreement_id AS agreementId,
|
||||||
IF
|
saa.create_time AS createTime,
|
||||||
( sad.slt_type = 1, sad.money, 0 ) AS leaseCost,
|
IF
|
||||||
IF
|
( sad.slt_type = 1, sad.money, 0 ) AS leaseCost,
|
||||||
( sad.slt_type = 2, sad.money, 0 ) AS loseCost,
|
IF
|
||||||
IF(sad.slt_type = 3 AND (sad.is_charge = 1 ), sad.money, 0) AS repairCost,
|
( sad.slt_type = 2, sad.money, 0 ) AS loseCost,
|
||||||
IF(sad.slt_type = 4 AND (sad.is_charge = 1 ), sad.money, 0) AS scrapCost,
|
IF(sad.slt_type = 3 AND (sad.is_charge = 1 ), sad.money, 0) AS repairCost,
|
||||||
0 AS aqLeaseCost,
|
IF(sad.slt_type = 4 AND (sad.is_charge = 1 ), sad.money, 0) AS scrapCost,
|
||||||
0 AS aqLoseCost,
|
0 AS aqLeaseCost,
|
||||||
0 AS aqRepairCost,
|
0 AS aqLoseCost,
|
||||||
0 AS aqScrapCost
|
0 AS aqRepairCost,
|
||||||
|
0 AS aqScrapCost
|
||||||
FROM
|
FROM
|
||||||
slt_agreement_apply saa
|
slt_agreement_apply saa
|
||||||
LEFT JOIN slt_agreement_details sad ON saa.id = sad.apply_id
|
LEFT JOIN slt_agreement_details sad ON saa.id = sad.apply_id
|
||||||
WHERE
|
WHERE
|
||||||
saa.agreement_id = #{agreementId}
|
saa.agreement_id = #{agreementId}
|
||||||
|
|
@ -2385,21 +2397,22 @@
|
||||||
GROUP BY
|
GROUP BY
|
||||||
sad.id UNION ALL
|
sad.id UNION ALL
|
||||||
SELECT
|
SELECT
|
||||||
saa.agreement_id AS agreementId,
|
saa.book_code as bookCode,
|
||||||
saa.create_time AS createTime,
|
saa.agreement_id AS agreementId,
|
||||||
0 AS leaseCost,
|
saa.create_time AS createTime,
|
||||||
0 AS loseCost,
|
0 AS leaseCost,
|
||||||
0 AS repairCost,
|
0 AS loseCost,
|
||||||
0 AS scrapCost,
|
0 AS repairCost,
|
||||||
IF
|
0 AS scrapCost,
|
||||||
( sad.slt_type = 1, sad.money, 0 ) AS aqLeaseCost,
|
IF
|
||||||
IF
|
( sad.slt_type = 1, sad.money, 0 ) AS aqLeaseCost,
|
||||||
( sad.slt_type = 2, sad.money, 0 ) AS aqLoseCost,
|
IF
|
||||||
IF(sad.slt_type = 3 AND (sad.is_charge = 1 ), sad.money, 0) AS aqRepairCost,
|
( sad.slt_type = 2, sad.money, 0 ) AS aqLoseCost,
|
||||||
IF(sad.slt_type = 4 AND (sad.is_charge = 1 ), sad.money, 0) AS aqScrapCost
|
IF(sad.slt_type = 3 AND (sad.is_charge = 1 ), sad.money, 0) AS aqRepairCost,
|
||||||
|
IF(sad.slt_type = 4 AND (sad.is_charge = 1 ), sad.money, 0) AS aqScrapCost
|
||||||
FROM
|
FROM
|
||||||
slt_agreement_apply saa
|
slt_agreement_apply saa
|
||||||
LEFT JOIN slt_agreement_details sad ON saa.id = sad.apply_id
|
LEFT JOIN slt_agreement_details sad ON saa.id = sad.apply_id
|
||||||
WHERE
|
WHERE
|
||||||
saa.agreement_id = #{agreementId}
|
saa.agreement_id = #{agreementId}
|
||||||
AND saa.settlement_type = 2
|
AND saa.settlement_type = 2
|
||||||
|
|
@ -2590,4 +2603,14 @@
|
||||||
|
|
||||||
|
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateSltBookCodeById">
|
||||||
|
update
|
||||||
|
slt_agreement_apply
|
||||||
|
set
|
||||||
|
book_code = #{bookCode}
|
||||||
|
where
|
||||||
|
id = #{id}
|
||||||
|
and book_code is null
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue