Commit 162bb820 by HlQ

[add]

1.收款记录和发票记录创建时间排序
2.计算合同金额添加数据权限控制
1 parent f1f3590c
......@@ -25,7 +25,7 @@ public class ContractPaymentController {
@GetMapping("/contractPayment/{id}")
@SaCheckPermission(value = "contractPayment:query", orRole = "admin")
public List<ContractPaymentVO> getPaymentById(@PathVariable Long id) {
return converter.convert(contractPaymentService.lambdaQuery().eq(ContractPayment::getContractId, id).list(), ContractPaymentVO.class);
return converter.convert(contractPaymentService.lambdaQuery().eq(ContractPayment::getContractId, id).orderByAsc(ContractPayment::getPaymentType).list(), ContractPaymentVO.class);
}
@PostMapping("/contractPayment")
......
......@@ -4,6 +4,8 @@ import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.http.HttpUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
......@@ -11,19 +13,22 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import vion.Global;
import vion.dto.FileInfoDTO;
import vion.model.FileInfo;
import vion.service.IFileService;
import vion.model.*;
import vion.service.*;
import vion.utils.ResultUtil;
import vion.vo.ResultVO;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
@RestController
@RequestMapping(Global.BASE_URL)
@RequestMapping("/api")
@RequiredArgsConstructor
@Slf4j
public class FileController {
......@@ -31,8 +36,13 @@ public class FileController {
private final IFileService fileService;
private final Converter converter;
private final IDeliveryRecordService deliveryRecordService;
private final ITbDeliverGoodsService deliverGoodsService;
private final ITbAppendixService appendixService;
private final IContractService contractService;
@Value("${fileUrl:}")
private String fileurl;
private String fileUrl;
@GetMapping("/files")
public Page<FileInfo> getFiles(FileInfoDTO data) {
......@@ -51,7 +61,6 @@ public class FileController {
}
}
/*
* todo
* 手机端工单预处理提交
......@@ -64,7 +73,7 @@ public class FileController {
//上传url地址
String filename = infile.getOriginalFilename() + "_" + DateUtil.format(new Date(), DatePattern.PURE_DATETIME_PATTERN);
// String path = fileurl + FileUtil.FILE_SEPARATOR + storeId + FileUtil.FILE_SEPARATOR + sourceId + FileUtil.FILE_SEPARATOR + filename;
String path = fileurl + FileUtil.FILE_SEPARATOR + filename;
String path = fileUrl + FileUtil.FILE_SEPARATOR + filename;
File file = FileUtil.touch(path);
infile.transferTo(file);
String sha256 = SecureUtil.sha256(file).toUpperCase();
......@@ -101,7 +110,7 @@ public class FileController {
String fileName = orgName.substring(0, orgName.lastIndexOf("."));
String fileExt = orgName.substring(orgName.lastIndexOf("."));
String filename = fileName + "_" + DateUtil.format(new Date(), "yyyyMMdd_HHmmss") + fileExt;
String path = fileurl + FileUtil.FILE_SEPARATOR + fileInfo.getStoreId() + FileUtil.FILE_SEPARATOR + fileInfo.getSourceId() + FileUtil.FILE_SEPARATOR + filename;
String path = fileUrl + FileUtil.FILE_SEPARATOR + fileInfo.getStoreId() + FileUtil.FILE_SEPARATOR + fileInfo.getSourceId() + FileUtil.FILE_SEPARATOR + filename;
File file = FileUtil.touch(path);
infile.transferTo(file);
......@@ -119,4 +128,64 @@ public class FileController {
}
return "文件保存成功";
}
@GetMapping("/tmpfile")
public String sync() {
// bDeliverGoodsId => tbAppendix
Map<String, List<TbAppendix>> id2UrlMap = appendixService.list(Wrappers.<TbAppendix>lambdaQuery().eq(TbAppendix::getBusinessTable, "tb_deliver_goods"))
.stream().collect(Collectors.groupingBy(TbAppendix::getBusinessUnid));
// bDeliverGoodsId => tbDeliverGoods
Map<Long, TbDeliverGoods> id2DeliverGoodsMap = deliverGoodsService.list().stream().collect(Collectors.toMap(TbDeliverGoods::getDeliverUnid, Function.identity()));
// contractNo => contract
Map<String, Long> no2ContractIdMap = contractService.list().stream().collect(Collectors.toMap(Contract::getContractNo, Contract::getId));
// contractNo => List<DeliveryRecord>
Map<String, List<DeliveryRecord>> no2IdMap = deliveryRecordService.list().stream().collect(Collectors.groupingBy(DeliveryRecord::getContractNo));
id2UrlMap.forEach((id, appendixList) -> appendixList.forEach(appendix -> {
TbDeliverGoods deliverGoods = id2DeliverGoodsMap.get(Long.valueOf(id));
String contractNo = deliverGoods.getContractUnid();
Long contractId = no2ContractIdMap.get(contractNo);
if (contractId == null) {
log.error("合同不存在:{}", contractNo);
return;
}
List<DeliveryRecord> deliveryIdList = no2IdMap.get(contractNo);
if (deliveryIdList.size() == 1) {
String path = fileUrl + FileUtil.FILE_SEPARATOR + "/delivery" + FileUtil.FILE_SEPARATOR + contractId + FileUtil.FILE_SEPARATOR + deliveryIdList.get(0).getId() + FileUtil.FILE_SEPARATOR + appendix.getAppendixName();
File file = HttpUtil.downloadFileFromUrl(appendix.getAppendixUrl().replace("192.168.9.110", "117.133.143.114"), FileUtil.file(path));
FileInfo fileInfo = new FileInfo();
fileInfo.setStoreId(-1L);
fileInfo.setSourceId(deliveryIdList.get(0).getId());
fileInfo.setSourceType(6);
fileInfo.setContractId(contractId);
fileInfo.setName(appendix.getAppendixName());
fileInfo.setUrl(path);
fileInfo.setType(FileUtil.extName(file));
fileInfo.setSha256(SecureUtil.sha256(file).toUpperCase());
fileInfo.setUploader("原合同平台");
fileService.save(fileInfo);
} else {
for (DeliveryRecord deliveryRecord : deliveryIdList) {
if (deliveryRecord.getSignDate().equals(id2DeliverGoodsMap.get(Long.valueOf(id)).getGoodsAcceptancDate()) && deliveryRecord.getShipDate().equals(id2DeliverGoodsMap.get(Long.valueOf(id)).getDeliverGoodsDate())) {
String path = fileUrl + FileUtil.FILE_SEPARATOR + "/delivery" + FileUtil.FILE_SEPARATOR + contractId + FileUtil.FILE_SEPARATOR + deliveryRecord.getId() + FileUtil.FILE_SEPARATOR + appendix.getAppendixName();
File file = HttpUtil.downloadFileFromUrl(appendix.getAppendixUrl().replace("192.168.9.110", "117.133.143.114"), FileUtil.file(path));
FileInfo fileInfo = new FileInfo();
fileInfo.setStoreId(-1L);
fileInfo.setSourceId(deliveryRecord.getId());
fileInfo.setSourceType(6);
fileInfo.setContractId(contractId);
fileInfo.setName(appendix.getAppendixName());
fileInfo.setUrl(path);
fileInfo.setType(FileUtil.extName(file));
fileInfo.setSha256(SecureUtil.sha256(file).toUpperCase());
fileInfo.setUploader("原合同平台");
fileService.save(fileInfo);
}
}
}
}));
return "success";
}
}
\ No newline at end of file
package vion.cron;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Opt;
import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import vion.model.Contract;
......@@ -16,7 +19,11 @@ import vion.service.IStoreService;
import java.math.BigDecimal;
import java.sql.*;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
......@@ -31,26 +38,29 @@ public class ContractRunner {
private final IDictionaryService dictionaryService;
private final IContractPaymentService contractPaymentService;
private final IStoreService storeService;
private final RedisTemplate redisTemplate;
@Scheduled(cron = "0 0 * * * *")
public Boolean contractSync() {
log.info("【开始】从crm系统同步合同信息");
Set<String> existContractNoSet = contractService.list().stream().map(Contract::getContractNo).collect(Collectors.toSet());
Map<String, Contract> no2ContactMap = contractService.list().stream().collect(Collectors.toMap(Contract::getContractNo, Function.identity()));
Map<String, Integer> contractTypeMap = dictionaryService.lambdaQuery().eq(Dictionary::getType, "contract_type").list()
.stream().collect(Collectors.toMap(Dictionary::getValue, Dictionary::getKey));
List<Contract> insertContractList = new ArrayList<>();
List<Contract> insOrUpdContractList = new ArrayList<>();
String modifyTime = Opt.ofNullable((String) redisTemplate.opsForValue().get("contract:sync:time"))
.orElse("1970-01-01 00:00:00");
String url = "jdbc:sqlserver://47.92.144.255:1433;databaseName=UFDATA_001_2020;encrypt=false";
String username = "vion-reader";
String password = "vion-reader";
try (Connection connection = DriverManager.getConnection(url, username, password)) {
String sql = "select t5.hetongpingshen_name as name,t1.hetongluru_name as contract_no,t1.hetongluru_char12 as type,t1.hetongluru_date01 as sign_date,t1.hetongluru_char01 as warranty_period,t1.hetongluru_start_date as maintain_sdate,t1.hetongluru_end_date as maintain_edate,t1.hetongluru_dec01 as total_amount,t5.hetongpingshen_dec02 as sign_ratio,t5.hetongpingshen_dec03 as arrive_ratio,t5.hetongpingshen_dec04 as system_check_ratio,t5.hetongpingshen_dec05 as project_check_ratio,t5.hetongpingshen_dec06 as warranty_ratio,t5.hetongpingshen_dec07 as maintain1_ratio,t5.hetongpingshen_dec09 as maintain2_ratio,t5.hetongpingshen_dec10 as maintain3_ratio,t2.cCusAbbName as customer_name,t4.cUser_Name as sale_name,t1.create_time as entry_time,t5.hetongpingshen_date01 as sign_date1,t5.hetongpingshen_date04 as arrive_date,t5.hetongpingshen_date05 as system_check_date,t5.hetongpingshen_date06 as project_check_date,t5.hetongpingshen_date07 as warranty_date,t5.hetongpingshen_date08 as maintain_date1, t6.hetongpingshen_date09 as maintain_date2,t6.hetongpingshen_date10 as maintain_date3" +
" from tcu_hetongluru t1 left join Customer t2 on t1.account_id = t2.cCusCode left join tc_opportunity t3 on t1.hetongluru_char04 = t3.ufcode left join UA_User_Ex t4 on t1.owner_user_id = t4.cUser_Id left join tcu_hetongpingshen t5 on t1.hetongluru_name = t5.hetongpingshen_char05 left join tcu_hetongpingshen_attr t6 on t5.hetongpingshen_id = t6.hetongpingshen_id";
String sql = StrUtil.format(
"select t5.hetongpingshen_name as name,t1.hetongluru_name as contract_no,t1.hetongluru_char12 as type,t1.hetongluru_date01 as sign_date,t1.hetongluru_char01 as warranty_period,t1.hetongluru_start_date as maintain_sdate,t1.hetongluru_end_date as maintain_edate,t1.hetongluru_dec01 as total_amount,t5.hetongpingshen_dec02 as sign_ratio,t5.hetongpingshen_dec03 as arrive_ratio,t5.hetongpingshen_dec04 as system_check_ratio,t5.hetongpingshen_dec05 as project_check_ratio,t5.hetongpingshen_dec06 as warranty_ratio,t5.hetongpingshen_dec07 as maintain1_ratio,t5.hetongpingshen_dec09 as maintain2_ratio,t5.hetongpingshen_dec10 as maintain3_ratio,t2.cCusAbbName as customer_name,t4.cUser_Name as sale_name,t1.create_time as entry_time,t5.hetongpingshen_date01 as sign_date1,t5.hetongpingshen_date04 as arrive_date,t5.hetongpingshen_date05 as system_check_date,t5.hetongpingshen_date06 as project_check_date,t5.hetongpingshen_date07 as warranty_date,t5.hetongpingshen_date08 as maintain_date1, t6.hetongpingshen_date09 as maintain_date2,t6.hetongpingshen_date10 as maintain_date3,t1.modify_time as original_mod_time" +
" from tcu_hetongluru t1 left join Customer t2 on t1.account_id = t2.cCusCode left join tc_opportunity t3 on t1.hetongluru_char04 = t3.ufcode left join UA_User_Ex t4 on t1.owner_user_id = t4.cUser_Id left join tcu_hetongpingshen t5 on t1.hetongluru_name = t5.hetongpingshen_char05 left join tcu_hetongpingshen_attr t6 on t5.hetongpingshen_id = t6.hetongpingshen_id where t1.modify_time > '{}' order by t1.modify_time desc", modifyTime);
try (Statement statement = connection.createStatement()) {
ResultSet resultSet = statement.executeQuery(sql);
while (resultSet.next()) {
String contractNo = resultSet.getString("contract_no");
if (!existContractNoSet.contains(contractNo)) {
Contract contract = new Contract();
Opt.ofBlankAble(resultSet.getString("name"))
.ifPresentOrElse(contract::setName, () -> contract.setName(contractNo));
......@@ -92,29 +102,47 @@ public class ContractRunner {
contract.setCreateUser(-1L);
contract.setModifyUser(-1L);
contract.setEntryTime(resultSet.getTimestamp("entry_time"));
insertContractList.add(contract);
}
contract.setOriginalModTime(resultSet.getTimestamp("original_mod_time"));
insOrUpdContractList.add(contract);
}
}
} catch (SQLException e) {
log.error("合同信息同步失败:", e);
return false;
}
contractService.saveBatch(insertContractList, 500);
if (CollUtil.isEmpty(insOrUpdContractList)) {
log.info("没有需要插入或更新的合同");
return true;
}
insOrUpdContractList.forEach(v -> {
if (no2ContactMap.containsKey(v.getContractNo())) {
v.setId(no2ContactMap.get(v.getContractNo()).getId());
}
});
contractService.saveOrUpdateBatch(insOrUpdContractList, 500);
List<ContractPayment> paymentList = contractPaymentService.list();
Map<Long, Map<Integer, Long>> contractId2PaymentMap = paymentList.stream().collect(Collectors.groupingBy(ContractPayment::getContractId, Collectors.toMap(ContractPayment::getPaymentType, ContractPayment::getId)));
// 合同付款比例
List<ContractPayment> contractPaymentList = new ArrayList<>();
for (Contract contract : insertContractList) {
for (Contract contract : insOrUpdContractList) {
// 签订
ContractPayment contractSignPayment = new ContractPayment();
contractSignPayment.setId(contractId2PaymentMap.getOrDefault(contract.getId(), new HashMap<>()).get(1));
contractSignPayment.setContractId(contract.getId());
contractSignPayment.setPaymentType(1);
contractSignPayment.setPaymentRatio(Opt.ofNullable(contract.getSignRatio()).orElse(BigDecimal.ZERO));
contractSignPayment.setPaymentDate(contract.getSignDate1());
contractSignPayment.setNodeDate(contract.getSignDate());
contractPaymentList.add(contractSignPayment);
// 到货
ContractPayment contractArrivePayment = new ContractPayment();
contractArrivePayment.setId(contractId2PaymentMap.getOrDefault(contract.getId(), new HashMap<>()).get(2));
contractArrivePayment.setContractId(contract.getId());
contractArrivePayment.setPaymentType(2);
contractArrivePayment.setPaymentRatio(Opt.ofNullable(contract.getArriveRatio()).orElse(BigDecimal.ZERO));
......@@ -123,6 +151,7 @@ public class ContractRunner {
// 系统验收
ContractPayment contractSystemCheckPayment = new ContractPayment();
contractSystemCheckPayment.setId(contractId2PaymentMap.getOrDefault(contract.getId(), new HashMap<>()).get(3));
contractSystemCheckPayment.setContractId(contract.getId());
contractSystemCheckPayment.setPaymentType(3);
contractSystemCheckPayment.setPaymentRatio(Opt.ofNullable(contract.getSystemCheckRatio()).orElse(BigDecimal.ZERO));
......@@ -131,6 +160,7 @@ public class ContractRunner {
// 项目验收
ContractPayment contractProjectCheckPayment = new ContractPayment();
contractProjectCheckPayment.setId(contractId2PaymentMap.getOrDefault(contract.getId(), new HashMap<>()).get(4));
contractProjectCheckPayment.setContractId(contract.getId());
contractProjectCheckPayment.setPaymentType(4);
contractProjectCheckPayment.setPaymentRatio(Opt.ofNullable(contract.getProjectCheckRatio()).orElse(BigDecimal.ZERO));
......@@ -139,6 +169,7 @@ public class ContractRunner {
// 质保
ContractPayment contractWarrantyPayment = new ContractPayment();
contractWarrantyPayment.setId(contractId2PaymentMap.getOrDefault(contract.getId(), new HashMap<>()).get(5));
contractWarrantyPayment.setContractId(contract.getId());
contractWarrantyPayment.setPaymentType(5);
contractWarrantyPayment.setPaymentRatio(Opt.ofNullable(contract.getWarrantyRatio()).orElse(BigDecimal.ZERO));
......@@ -147,6 +178,7 @@ public class ContractRunner {
// 第一笔维保款
ContractPayment contractMaintainPayment1 = new ContractPayment();
contractMaintainPayment1.setId(contractId2PaymentMap.getOrDefault(contract.getId(), new HashMap<>()).get(6));
contractMaintainPayment1.setContractId(contract.getId());
contractMaintainPayment1.setPaymentType(6);
contractMaintainPayment1.setPaymentRatio(Opt.ofNullable(contract.getMaintainRatio1()).orElse(BigDecimal.ZERO));
......@@ -155,6 +187,7 @@ public class ContractRunner {
// 第二笔维保款
ContractPayment contractMaintainPayment2 = new ContractPayment();
contractMaintainPayment2.setId(contractId2PaymentMap.getOrDefault(contract.getId(), new HashMap<>()).get(7));
contractMaintainPayment2.setContractId(contract.getId());
contractMaintainPayment2.setPaymentType(7);
contractMaintainPayment2.setPaymentRatio(Opt.ofNullable(contract.getMaintainRatio2()).orElse(BigDecimal.ZERO));
......@@ -163,6 +196,7 @@ public class ContractRunner {
// 第三笔维保款
ContractPayment contractMaintainPayment3 = new ContractPayment();
contractMaintainPayment3.setId(contractId2PaymentMap.getOrDefault(contract.getId(), new HashMap<>()).get(8));
contractMaintainPayment3.setContractId(contract.getId());
contractMaintainPayment3.setPaymentType(8);
contractMaintainPayment3.setPaymentRatio(Opt.ofNullable(contract.getMaintainRatio3()).orElse(BigDecimal.ZERO));
......@@ -170,11 +204,10 @@ public class ContractRunner {
contractPaymentList.add(contractMaintainPayment3);
}
contractPaymentService.saveBatch(contractPaymentList);
insertContractList.forEach(c -> {
contractPaymentService.saveOrUpdateBatch(contractPaymentList);
insOrUpdContractList.forEach(c -> {
String contractNo = c.getContractNo();
// 多份合同取最新录入的合同
Contract exist = contractService.lambdaQuery().eq(Contract::getContractNo, contractNo).orderByDesc(Contract::getEntryTime).last("limit 1").list().get(0);
Contract exist = contractService.lambdaQuery().eq(Contract::getContractNo, contractNo).one();
Contract updDto = new Contract();
updDto.setId(exist.getId());
updDto.setPaidAmount(exist.getPaidAmount());
......@@ -183,6 +216,7 @@ public class ContractRunner {
});
log.info("【结束】从crm系统同步合同信息");
redisTemplate.opsForValue().set("contract:sync:time", DateUtil.formatDateTime(insOrUpdContractList.get(0).getOriginalModTime()));
return true;
}
......
package vion.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import java.math.BigDecimal;
import java.util.Date;
@Getter
@Setter
......@@ -25,4 +27,10 @@ public class ContractPaymentDTO {
*/
private BigDecimal paymentRatio;
/**
* 节点日期,指合同到这一阶段时的时间
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date nodeDate;
}
\ No newline at end of file
......@@ -167,7 +167,10 @@ public class Contract {
* 财务状态
*/
@TableField(value = "financial_status")
private Date financialStatus;
private Integer financialStatus;
@TableField(exist = false)
private Date originalModTime;
/**
* 合同签订付款比例
......
......@@ -157,7 +157,6 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
@Override
@Transactional(rollbackFor = Exception.class)
public String updateById(Long id, String contractNo, ContractDTO dto) {
// todo 合同状态变更时,添加 nodeDate,未上线待联调
Contract existContract = new Contract();
if (ObjUtil.isNotNull(id)) {
existContract = this.getById(id);
......@@ -242,7 +241,19 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
@Override
public JSONObject calAmount(ContractDTO dto) {
UserVO userVO = (UserVO) StpUtil.getTokenSession().get("curLoginUser");
String saleName = Opt.ofEmptyAble(userVO.getRoleVOList())
.map(l -> l.stream().map(RoleVO::getCode).collect(Collectors.toList()))
.map(roleCodeList -> {
if (!roleCodeList.contains("admin") && !roleCodeList.contains("shangwu") && !roleCodeList.contains("caiwu")) {
return userVO.getUsername();
} else {
return "";
}
}).orElse("未知");
List<Contract> contracts = this.list(Wrappers.lambdaQuery(converter.convert(dto, Contract.class))
.eq(StrUtil.isNotBlank(saleName), Contract::getSaleName, saleName)
.between(ArrayUtil.isAllNotNull(dto.getSignDateStart(), dto.getSignDateEnd()), Contract::getSignDate, dto.getSignDateStart(), dto.getSignDateEnd())
);
......@@ -301,9 +312,9 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
return;
}
BigDecimal paidAmount = c.getPaidAmount();
Map<Integer, Date> type2DateMap = contractPaymentList.stream().collect(HashMap::new, (m, v) -> m.put(v.getPaymentType(), v.getPaymentDate()), HashMap::putAll);
Map<Integer, Date> type2DateMap = contractPaymentList.stream().filter(cp -> cp.getPaymentType() < c.getStatus()).collect(HashMap::new, (m, v) -> m.put(v.getPaymentType(), v.getNodeDate()), HashMap::putAll);
Map<Integer, BigDecimal> type2AmountMap = contractPaymentList.stream().collect(Collectors.toMap(ContractPayment::getPaymentType, v -> NumberUtil.mul(v.getPaymentRatio(), totalAmount)));
Map<Integer, BigDecimal> type2AmountMap = contractPaymentList.stream().filter(cp -> cp.getPaymentType() < c.getStatus()).collect(Collectors.toMap(ContractPayment::getPaymentType, v -> NumberUtil.mul(v.getPaymentRatio(), totalAmount)));
TreeMap<Integer, BigDecimal> sortMap = MapUtil.sort(type2AmountMap, Comparator.comparingInt(Integer::intValue));
for (Map.Entry<Integer, BigDecimal> entry : sortMap.entrySet()) {
......@@ -321,11 +332,10 @@ public class ContractServiceImpl extends MPJBaseServiceImpl<ContractMapper, Cont
financialAgeVO.setContractName(c.getName());
financialAgeVO.setStatus(type);
financialAgeVO.setAmount(NumberUtil.equals(paidAmount, BigDecimal.ZERO) ? curAmount : BigDecimal.valueOf(Math.abs(paidAmount.doubleValue())));
Date payableDate = type2DateMap.get(type);
Opt.ofNullable(type2DateMap.get(type)).ifPresent(
date -> {
financialAgeVO.setPayableDate(date);
long age = DateUtil.between(new Date(), payableDate, DateUnit.DAY, false);
long age = DateUtil.between(new Date(), date, DateUnit.DAY, false);
financialAgeVO.setAge(((int) age));
}
);
......
......@@ -53,7 +53,8 @@ public class InvoiceServiceImpl extends MPJBaseServiceImpl<InvoiceMapper, Invoic
MPJLambdaWrapper<Invoice> wrapper = new MPJLambdaWrapper<>(converter.convert(dto, Invoice.class))
.selectAll(Invoice.class)
.leftJoin(Contract.class, Contract::getContractNo, Invoice::getContractNo)
.eq(StrUtil.isNotBlank(saleName), Contract::getSaleName, saleName);
.eq(StrUtil.isNotBlank(saleName), Contract::getSaleName, saleName)
.orderByDesc(Invoice::getCreateTime);
return this.selectJoinListPage(Page.of(dto.getPageNum(), dto.getPageSize()), InvoiceVO.class, wrapper);
}
......
......@@ -55,7 +55,8 @@ public class PaymentServiceImpl extends MPJBaseServiceImpl<PaymentMapper, Paymen
MPJLambdaWrapper<Payment> wrapper = new MPJLambdaWrapper<>(converter.convert(dto, Payment.class))
.selectAll(Payment.class)
.leftJoin(Contract.class, Contract::getContractNo, Payment::getContractNo)
.eq(StrUtil.isNotBlank(saleName), Contract::getSaleName, saleName);
.eq(StrUtil.isNotBlank(saleName), Contract::getSaleName, saleName)
.orderByDesc(Payment::getCreateTime);
return this.selectJoinListPage(Page.of(dto.getPageNum(), dto.getPageSize()), PaymentVO.class, wrapper);
}
......
......@@ -31,6 +31,18 @@ public class ContractPaymentVO {
private BigDecimal paymentRatio;
/**
* 收款日期
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date paymentDate;
/**
* 节点日期,指合同到这一阶段时的时间
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date nodeDate;
/**
* 创建者
*/
private Integer createUser;
......
......@@ -127,6 +127,11 @@ public class ContractVO {
private Date finalDate;
/**
* 财务状态
*/
private Integer financialStatus;
/**
* 开票金额
*/
private BigDecimal invoiceAmount;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!