Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
66bba04673
|
|
@ -64,7 +64,7 @@ public class IwsCostPushTask {
|
|||
|
||||
|
||||
/**
|
||||
* 定时任务 -- 保存未结算报表记录 -- 每月最后一天的23点00分执行
|
||||
* 定时任务 -- 保存未结算报表记录(工器具) -- 每月最后一天的23点00分执行
|
||||
*/
|
||||
@Scheduled(cron = "0 00 23 L * ?", zone = "Asia/Shanghai")
|
||||
public void saveUnSltHistoryReport() {
|
||||
|
|
@ -234,10 +234,8 @@ public class IwsCostPushTask {
|
|||
} catch (Exception e) {
|
||||
log.error("保存未结算报表记录到数据库失败,记录数量:{}", validRecords.size(), e);
|
||||
// 打印所有记录的关键信息用于排查
|
||||
validRecords.forEach(vo -> {
|
||||
log.error("失败记录:agreementId={}, agreementCode={}, unitName={}, projectName={}",
|
||||
vo.getAgreementId(), vo.getAgreementCode(), vo.getUnitName(), vo.getProjectName());
|
||||
});
|
||||
validRecords.forEach(vo -> log.error("失败记录:agreementId={}, agreementCode={}, unitName={}, projectName={}",
|
||||
vo.getAgreementId(), vo.getAgreementCode(), vo.getUnitName(), vo.getProjectName()));
|
||||
throw e;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -247,7 +245,6 @@ public class IwsCostPushTask {
|
|||
log.error("保存未结算报表记录失败", e);
|
||||
throw e;
|
||||
} finally {
|
||||
// 在整个批量处理完成后清理缓存,而不是在每次循环中清理
|
||||
sltAgreementInfoService.clearCache();
|
||||
log.info("缓存已清理");
|
||||
}
|
||||
|
|
@ -257,7 +254,7 @@ public class IwsCostPushTask {
|
|||
|
||||
|
||||
/**
|
||||
* 定时任务 -- 保存未结算报表记录 -- 每月最后一天的23点10分执行
|
||||
* 定时任务 -- 保存未结算报表记录(安全工器具) -- 每月最后一天的23点10分执行
|
||||
*/
|
||||
@Scheduled(cron = "0 10 23 L * ?", zone = "Asia/Shanghai")
|
||||
public void saveUnSltSafetyHistoryReport() {
|
||||
|
|
|
|||
|
|
@ -2018,6 +2018,17 @@ public class SltAgreementInfoController extends BaseController {
|
|||
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();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -80,13 +80,19 @@ public class SltAgreementReduceController extends BaseController {
|
|||
Date currentDate = new Date();
|
||||
PeriodCostQueryDto periodCostQueryDto = new PeriodCostQueryDto();
|
||||
periodCostQueryDto.setAgreementId(sltAgreement.getAgreementId());
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
if (null == sltAgreement.getStartTime()) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||
|
||||
periodCostQueryDto.setStartDate(sdf.parse("2018-01-01 01:00:00"));
|
||||
}else{
|
||||
String formattedStartTime = sdf.format(sltAgreement.getStartTime());
|
||||
periodCostQueryDto.setStartDate(sdf.parse(formattedStartTime));
|
||||
}
|
||||
if (null == sltAgreement.getEndTime()) {
|
||||
periodCostQueryDto.setEndDate(currentDate);
|
||||
}else{
|
||||
String formattedEndTime = sdf.format(sltAgreement.getEndTime());
|
||||
periodCostQueryDto.setEndDate(sdf.parse(formattedEndTime));
|
||||
}
|
||||
|
||||
List<PeriodCostResultVo> resultVos = sltAgreementInfoService.selectPeriodCostList(periodCostQueryDto);
|
||||
|
|
|
|||
|
|
@ -322,4 +322,7 @@ public class SltAgreementInfo extends BaseEntity {
|
|||
|
||||
@ApiModelProperty(value = "任务状态列表")
|
||||
private List<Integer> statusList;
|
||||
|
||||
@ApiModelProperty(value = "结算协议书编号")
|
||||
private String bookCode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
package com.bonus.material.settlement.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 结算历史报表对象 slt_history_report
|
||||
|
|
@ -30,4 +33,15 @@ public class SltHistoryReport {
|
|||
private LocalDateTime createTime;
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ import java.util.Date;
|
|||
@ApiModel("区间费用计算结果VO")
|
||||
public class PeriodCostResultVo {
|
||||
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "协议ID")
|
||||
private Long agreementId;
|
||||
|
||||
|
|
|
|||
|
|
@ -192,4 +192,9 @@ public class SltInfoVo {
|
|||
private List<SltInfoVo> signUrlList;
|
||||
|
||||
private Long companyId;
|
||||
|
||||
/**
|
||||
* 协议书编号
|
||||
*/
|
||||
private String bookCode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,6 +84,11 @@ public interface SltAgreementInfoMapper {
|
|||
*/
|
||||
public int insertSltAgreementInfo(SltAgreementInfo sltAgreementInfo);
|
||||
|
||||
/**
|
||||
* 修改结算协议书编号
|
||||
*/
|
||||
int updateSltBookCodeById(SltAgreementInfo sltAgreementInfo);
|
||||
|
||||
/**
|
||||
* 修改结算信息
|
||||
*
|
||||
|
|
|
|||
|
|
@ -184,6 +184,11 @@ public interface ISltAgreementInfoService {
|
|||
*/
|
||||
List<PeriodCostSummaryVo> selectPeriodCostSummary(PeriodCostQueryDto queryDto);
|
||||
|
||||
/**
|
||||
* 修改结算协议书编号
|
||||
*/
|
||||
int updateSltBookCodeById(SltAgreementInfo sltAgreementInfo);
|
||||
|
||||
|
||||
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
|
||||
public List<SltAgreementInfo> getRepairCodeList(SltAgreementInfo bean) {
|
||||
return sltAgreementInfoMapper.getRepairCodeList(bean);
|
||||
|
|
@ -1928,6 +1938,9 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
|||
summary.setQueryStartDate(queryStartDate);
|
||||
summary.setQueryEndDate(queryEndDate);
|
||||
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(); // 设备种类数量
|
||||
|
|
|
|||
|
|
@ -4,10 +4,13 @@ import com.bonus.material.settlement.domain.SltHistoryReport;
|
|||
import com.bonus.material.settlement.domain.SltHistoryReportDetail;
|
||||
import com.bonus.material.settlement.mapper.SltAgreementInfoMapper;
|
||||
import com.bonus.material.settlement.service.SltHistoryReportService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
public class SltHistoryReportServiceImpl implements SltHistoryReportService {
|
||||
|
|
@ -19,7 +22,19 @@ public class SltHistoryReportServiceImpl implements SltHistoryReportService {
|
|||
|
||||
@Override
|
||||
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
|
||||
|
|
|
|||
|
|
@ -235,9 +235,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN ma_type mt ON sai.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||
left join sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||
where mm.next_check_time is not null and mt.`level` = '4'
|
||||
and sai.`status`='0' and sai.end_time is null
|
||||
|
||||
where mm.next_check_time is not null
|
||||
AND mm.this_check_time is not null
|
||||
AND bp.pro_name is not null
|
||||
and sai.`status`='0'
|
||||
and sai.is_slt = 0
|
||||
and mm.ma_status = 2
|
||||
and mt2.type_id not in (6032,6008,6270)
|
||||
and mt.jiju_type =2
|
||||
|
|
@ -275,9 +277,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN sys_dept sd on bp.imp_unit = sd.dept_id
|
||||
LEFT JOIN ma_type mt ON sai.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||
WHERE mm.next_check_time is not null AND mt.`level`=4
|
||||
|
||||
and sai.`status`='0' and sai.end_time is null
|
||||
WHERE mm.next_check_time is not null
|
||||
AND mm.this_check_time is not null
|
||||
AND bp.pro_name is not null
|
||||
and sai.`status`='0'
|
||||
and sai.is_slt = 0
|
||||
and mm.ma_status = 2
|
||||
and mt2.type_id not in (6032,6008,6270)
|
||||
and mt.jiju_type =2
|
||||
|
|
|
|||
|
|
@ -1667,6 +1667,7 @@
|
|||
|
||||
<select id="selectLeasePeriodCostList" parameterType="com.bonus.material.settlement.domain.dto.PeriodCostQueryDto" resultMap="PeriodCostResultMap">
|
||||
SELECT
|
||||
sai.id,
|
||||
bai.agreement_id, bai.agreement_code, bai.unit_id,
|
||||
bu.unit_name,
|
||||
bai.project_id,
|
||||
|
|
@ -2172,6 +2173,12 @@
|
|||
|
||||
<select id="selectSltHistoryReportList" resultType="com.bonus.material.settlement.domain.SltHistoryReport">
|
||||
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.agreement_id as agreementId,
|
||||
shr.agreement_code as agreementCode,
|
||||
|
|
@ -2187,13 +2194,18 @@
|
|||
shr.reduction_cost as reductionCost,
|
||||
shr.`year_month` as yearMonth,
|
||||
shr.create_time as createTime
|
||||
FROM slt_history_report shr
|
||||
left join bm_agreement_info bai on shr.agreement_id =bai.agreement_id
|
||||
FROM
|
||||
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
|
||||
shr.`year_month` = #{yearMonth}
|
||||
and shr.settlement_type = #{settlementType}
|
||||
<if test="companyId !=null"> and bai.company_id =#{companyId}</if>
|
||||
ORDER BY shr.create_time DESC
|
||||
and shr.settlement_type = #{settlementType}
|
||||
AND saa.id IS NULL
|
||||
<if test="companyId !=null"> and bai.company_id =#{companyId}</if>
|
||||
ORDER BY
|
||||
shr.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="getAgreementInfo" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
||||
|
|
@ -2347,7 +2359,7 @@
|
|||
|
||||
<select id="getSltAgreementBook" resultType="com.bonus.material.settlement.domain.vo.SltInfoVo">
|
||||
SELECT
|
||||
agreementId,
|
||||
agreementId, res.bookCode,
|
||||
bai.agreement_code as agreementCode,
|
||||
LEFT(createTime,10) as applyTime,
|
||||
bui.unit_name AS unitName,
|
||||
|
|
@ -2363,20 +2375,21 @@
|
|||
FROM
|
||||
(
|
||||
SELECT
|
||||
saa.agreement_id AS agreementId,
|
||||
saa.create_time AS createTime,
|
||||
IF
|
||||
( sad.slt_type = 1, sad.money, 0 ) AS leaseCost,
|
||||
IF
|
||||
( sad.slt_type = 2, sad.money, 0 ) AS loseCost,
|
||||
IF(sad.slt_type = 3 AND (sad.is_charge = 1 ), sad.money, 0) AS repairCost,
|
||||
IF(sad.slt_type = 4 AND (sad.is_charge = 1 ), sad.money, 0) AS scrapCost,
|
||||
0 AS aqLeaseCost,
|
||||
0 AS aqLoseCost,
|
||||
0 AS aqRepairCost,
|
||||
0 AS aqScrapCost
|
||||
saa.book_code as bookCode,
|
||||
saa.agreement_id AS agreementId,
|
||||
saa.create_time AS createTime,
|
||||
IF
|
||||
( sad.slt_type = 1, sad.money, 0 ) AS leaseCost,
|
||||
IF
|
||||
( sad.slt_type = 2, sad.money, 0 ) AS loseCost,
|
||||
IF(sad.slt_type = 3 AND (sad.is_charge = 1 ), sad.money, 0) AS repairCost,
|
||||
IF(sad.slt_type = 4 AND (sad.is_charge = 1 ), sad.money, 0) AS scrapCost,
|
||||
0 AS aqLeaseCost,
|
||||
0 AS aqLoseCost,
|
||||
0 AS aqRepairCost,
|
||||
0 AS aqScrapCost
|
||||
FROM
|
||||
slt_agreement_apply saa
|
||||
slt_agreement_apply saa
|
||||
LEFT JOIN slt_agreement_details sad ON saa.id = sad.apply_id
|
||||
WHERE
|
||||
saa.agreement_id = #{agreementId}
|
||||
|
|
@ -2384,21 +2397,22 @@
|
|||
GROUP BY
|
||||
sad.id UNION ALL
|
||||
SELECT
|
||||
saa.agreement_id AS agreementId,
|
||||
saa.create_time AS createTime,
|
||||
0 AS leaseCost,
|
||||
0 AS loseCost,
|
||||
0 AS repairCost,
|
||||
0 AS scrapCost,
|
||||
IF
|
||||
( sad.slt_type = 1, sad.money, 0 ) AS aqLeaseCost,
|
||||
IF
|
||||
( sad.slt_type = 2, sad.money, 0 ) AS aqLoseCost,
|
||||
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
|
||||
saa.book_code as bookCode,
|
||||
saa.agreement_id AS agreementId,
|
||||
saa.create_time AS createTime,
|
||||
0 AS leaseCost,
|
||||
0 AS loseCost,
|
||||
0 AS repairCost,
|
||||
0 AS scrapCost,
|
||||
IF
|
||||
( sad.slt_type = 1, sad.money, 0 ) AS aqLeaseCost,
|
||||
IF
|
||||
( sad.slt_type = 2, sad.money, 0 ) AS aqLoseCost,
|
||||
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
|
||||
slt_agreement_apply saa
|
||||
LEFT JOIN slt_agreement_details sad ON saa.id = sad.apply_id
|
||||
slt_agreement_apply saa
|
||||
LEFT JOIN slt_agreement_details sad ON saa.id = sad.apply_id
|
||||
WHERE
|
||||
saa.agreement_id = #{agreementId}
|
||||
AND saa.settlement_type = 2
|
||||
|
|
@ -2589,4 +2603,14 @@
|
|||
|
||||
|
||||
</insert>
|
||||
|
||||
<update id="updateSltBookCodeById">
|
||||
update
|
||||
slt_agreement_apply
|
||||
set
|
||||
book_code = #{bookCode}
|
||||
where
|
||||
id = #{id}
|
||||
and book_code is null
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -248,17 +248,27 @@
|
|||
AND mm.this_check_time is not null
|
||||
AND mm.next_check_time is not null
|
||||
AND mt.jiju_type = 2
|
||||
and sai.`status`='0'
|
||||
AND mt2.type_id not in (6032,6008,6270)
|
||||
<if test="companyId != null">
|
||||
AND sd.dept_id=#{companyId}
|
||||
</if>
|
||||
/*AND DATEDIFF(mm.next_check_time, CURDATE()) <= 30*/
|
||||
<if test="status != null and status == 0">
|
||||
AND mm.next_check_time >= NOW()
|
||||
AND mm.next_check_time >= NOW()
|
||||
</if>
|
||||
<if test="status != null and status == 1">
|
||||
AND mm.next_check_time < NOW()
|
||||
</if>
|
||||
<if test="status != null and status == 2">
|
||||
AND mm.next_check_time < NOW() AND DATEDIFF(NOW(), mm.next_check_time) <= 7
|
||||
</if>
|
||||
<if test="status != null and status == 3">
|
||||
AND mm.next_check_time < NOW() AND DATEDIFF(NOW(), mm.next_check_time) <=15
|
||||
</if>
|
||||
<if test="status != null and status == 4">
|
||||
AND mm.next_check_time < NOW() AND DATEDIFF(NOW(), mm.next_check_time) <= 30
|
||||
</if>
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and (
|
||||
mt4.type_name like concat('%', #{keyWord}, '%') or
|
||||
|
|
|
|||
Loading…
Reference in New Issue