优化合同列表查询
This commit is contained in:
parent
81ff6c9510
commit
43ba3088dc
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@
|
||||
*/target/*
|
||||
*/*/target/*
|
||||
*.log
|
||||
.flattened-*
|
@ -6,6 +6,8 @@ import com.pusong.common.translation.annotation.TranslationType;
|
||||
import com.pusong.common.translation.constant.TransConstant;
|
||||
import com.pusong.common.translation.core.TranslationInterface;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* 字典翻译实现
|
||||
@ -16,10 +18,12 @@ import lombok.AllArgsConstructor;
|
||||
@TranslationType(type = TransConstant.DICT_TYPE_TO_LABEL)
|
||||
public class DictTypeTranslationImpl implements TranslationInterface<String> {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(DictTypeTranslationImpl.class);
|
||||
private final DictService dictService;
|
||||
|
||||
@Override
|
||||
public String translation(Object key, String other) {
|
||||
logger.info("key = {}, other = {}", key, other);
|
||||
if (key instanceof String dictValue && StringUtils.isNotBlank(other)) {
|
||||
String ret = dictService.getDictLabel(other, dictValue);
|
||||
return StringUtils.isBlank(ret)? dictValue:ret;
|
||||
|
@ -78,4 +78,7 @@ public class PsApproverRecord extends TenantEntity {
|
||||
private Long delFlag;
|
||||
|
||||
|
||||
public String getBusinessIdAndBusinessType(){
|
||||
return this.businessId + "_" + this.businessType;
|
||||
}
|
||||
}
|
||||
|
@ -232,5 +232,7 @@ public class PsApproverRecordVo implements Serializable {
|
||||
* 退款详细信息
|
||||
*/
|
||||
private PsContractPayVo psContractPayVo;
|
||||
|
||||
public String getBusinessIdAndBusinessType(){
|
||||
return this.businessId + "_" + this.businessType;
|
||||
}
|
||||
}
|
||||
|
@ -248,4 +248,13 @@ public class PsCompanyInfoVo implements Serializable {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 合同公司中间表主键
|
||||
*/
|
||||
private Long pccId;
|
||||
/**
|
||||
* 合同编号
|
||||
*/
|
||||
private String contractCode;
|
||||
|
||||
}
|
||||
|
@ -273,6 +273,9 @@ public class PsContractInfoVo implements Serializable {
|
||||
* @return
|
||||
*/
|
||||
public boolean isTuoguanService(){
|
||||
if (this.getPsCompanySerivceVo() == null){
|
||||
return false;
|
||||
}
|
||||
for (PsCompanyInfoVo psCompanyInfoVo : this.getPsCompanySerivceVo()) {
|
||||
for (PsContractBusinessVo psContractBusinessVo : psCompanyInfoVo.getBusinessVoList()) {
|
||||
if (psContractBusinessVo.getBusinessType().equals("2")){//2托管服务,没找到枚举,暂时写死2
|
||||
|
@ -12,7 +12,8 @@ public enum CustomerStatusEnum {
|
||||
INIT("1","初始化"),
|
||||
PUBLIC("2","进入公海"),
|
||||
CLAIMAPPROVER("20","认领审批中"),
|
||||
STOP("3","终止合作");
|
||||
STOP("3","终止合作"),
|
||||
HAVE_CONTRACT("6","已成交");;
|
||||
private String code;
|
||||
private String text;
|
||||
|
||||
|
@ -10,6 +10,8 @@ import com.pusong.business.domain.vo.PsContractInfoVo;
|
||||
import com.pusong.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 审批记录Mapper接口
|
||||
*
|
||||
@ -22,4 +24,7 @@ public interface PsApproverRecordMapper extends BaseMapperPlus<PsApproverRecord,
|
||||
Page<PsApproverRecordVo> selectPageFreeApproverList(@Param("page") Page<PsApproverRecord> page, @Param(Constants.WRAPPER) Wrapper<PsApproverRecord> queryWrapper);
|
||||
|
||||
Page<PsApproverRecordVo> selectPagePublicList(@Param("page") Page<PsApproverRecord> page, @Param(Constants.WRAPPER) Wrapper<PsApproverRecord> queryWrapper);
|
||||
|
||||
|
||||
List<PsApproverRecordVo> getLastFail(@Param(Constants.WRAPPER) Wrapper<PsApproverRecord> queryWrapper);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import com.pusong.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 审批记录Service接口
|
||||
@ -55,6 +56,8 @@ public interface IPsApproverRecordService {
|
||||
* @return
|
||||
*/
|
||||
String getLastFail(String businessId,String contractCode,List<String> businessTypes);
|
||||
|
||||
Map<String, String> getLastFail(List<String> businessIds, List<String> businessTypes);
|
||||
//
|
||||
// /**
|
||||
// * 新增审批记录
|
||||
|
@ -89,5 +89,6 @@ public interface IPsCompanyInfoService {
|
||||
*/
|
||||
List<PsCompanyInfoVo> getServiceCompany(String controctCode);
|
||||
|
||||
List<PsCompanyInfoVo> getServiceCompany(List<String> controctCodes);
|
||||
void terminationService(Long serviceCompanyId);
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ public interface IPsContractPayService {
|
||||
* @return 合同回款记录分页列表
|
||||
*/
|
||||
List<PsContractPayVo> queryListByContractCode(String contractCode, String business, PayStatusEnum enu);
|
||||
List<PsContractPayVo> queryListByContractCode(List<String> contractCode, String business, PayStatusEnum enu);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.pusong.business.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.pusong.business.domain.PsContractInfo;
|
||||
import com.pusong.business.enums.ApproverStatusEnum;
|
||||
import com.pusong.business.enums.ApproverTypeEnum;
|
||||
import com.pusong.business.enums.TaskStatusEnum;
|
||||
@ -24,6 +26,7 @@ import com.pusong.business.service.IPsApproverRecordService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 审批记录Service业务层处理
|
||||
@ -124,7 +127,7 @@ public class PsApproverRecordServiceImpl implements IPsApproverRecordService {
|
||||
* 根据条件查询最后一条审批失败的原因
|
||||
* @return
|
||||
*/
|
||||
public String getLastFail(String businessId,String contractCode,List<String> businessTypes){
|
||||
public String getLastFail(String businessId, String contractCode, List<String> businessTypes){
|
||||
PsApproverRecord record = baseMapper.selectOne(Wrappers.<PsApproverRecord>lambdaQuery()
|
||||
.select(PsApproverRecord::getApproverStatus,PsApproverRecord::getApproverDesc)
|
||||
.eq(StringUtils.isNotBlank(businessId), PsApproverRecord::getBusinessId, businessId)
|
||||
@ -134,6 +137,29 @@ public class PsApproverRecordServiceImpl implements IPsApproverRecordService {
|
||||
return record!=null&&StringUtils.equals(ApproverStatusEnum.FAIL.getCode(),record.getApproverStatus())
|
||||
?record.getApproverDesc():null;
|
||||
}
|
||||
|
||||
public Map<String, String> getLastFail(List<String> businessIds, List<String> businessTypes){
|
||||
if (businessIds.isEmpty()){
|
||||
return new HashMap<>();
|
||||
}
|
||||
QueryWrapper<PsApproverRecord> qw = Wrappers.query();
|
||||
qw.in("r.business_id", businessIds)
|
||||
.in("r.business_type", businessTypes);
|
||||
List<PsApproverRecordVo> record = baseMapper.getLastFail(qw);
|
||||
|
||||
Map<String, String> map = new HashMap<>();
|
||||
for (PsApproverRecordVo v : record) {
|
||||
if (StringUtils.equals(ApproverStatusEnum.FAIL.getCode(), v.getApproverStatus())){
|
||||
map.put(v.getBusinessIdAndBusinessType(), v.getApproverDesc());
|
||||
}
|
||||
}
|
||||
// Map<String, String> map
|
||||
// = record.stream()
|
||||
// .filter(v -> StringUtils.equals(ApproverStatusEnum.FAIL.getCode(), v.getApproverStatus()))
|
||||
// .collect(Collectors.toMap(PsApproverRecordVo::getBusinessIdAndBusinessType, v -> v.getApproverDesc()));
|
||||
return map;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 新增审批记录
|
||||
// *
|
||||
|
@ -261,7 +261,28 @@ public class PsCompanyInfoServiceImpl implements IPsCompanyInfoService {
|
||||
*/
|
||||
public List<PsCompanyInfoVo> getServiceCompany(String controctCode){
|
||||
QueryWrapper<PsCompanyInfoVo> wq = Wrappers.<PsCompanyInfoVo>query().eq("pcc.del_flag", "0").eq("bus.del_flag","0")
|
||||
.eq("det.del_flag","0").eq("pcc.contract_code", controctCode);
|
||||
.eq("det.del_flag","0")
|
||||
.eq("pcc.contract_code", controctCode);
|
||||
List<PsCompanyInfoVo> list = baseMapper.selectServiceCompanyList(wq);
|
||||
for (PsCompanyInfoVo psCompanyInfoVo : list) {
|
||||
psCompanyInfoVo.setStartServiceDate(psCompanyInfoVo.getBusinessVoList().get(0).getStartDate());
|
||||
psCompanyInfoVo.setEndServiceDate(psCompanyInfoVo.getBusinessVoList().get(0).getEndDate());
|
||||
psCompanyInfoVo.setIsOld(psCompanyInfoVo.getBusinessVoList().get(0).getIsOld());
|
||||
psCompanyInfoVo.setIsProxy(psCompanyInfoVo.getBusinessVoList().get(0).getIsProxy());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 根据合同编码查询服务公司信息
|
||||
* @param controctCode
|
||||
* @return
|
||||
*/
|
||||
public List<PsCompanyInfoVo> getServiceCompany(List<String> controctCodes){
|
||||
QueryWrapper<PsCompanyInfoVo> wq = Wrappers.<PsCompanyInfoVo>query()
|
||||
.eq("pcc.del_flag", "0")
|
||||
.eq("bus.del_flag","0")
|
||||
.eq("det.del_flag","0")
|
||||
.in("pcc.contract_code", controctCodes);
|
||||
List<PsCompanyInfoVo> list = baseMapper.selectServiceCompanyList(wq);
|
||||
for (PsCompanyInfoVo psCompanyInfoVo : list) {
|
||||
psCompanyInfoVo.setStartServiceDate(psCompanyInfoVo.getBusinessVoList().get(0).getStartDate());
|
||||
|
@ -170,7 +170,7 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
}
|
||||
});
|
||||
//保存公司合同关联表
|
||||
companyInfoService.saveContractCompany(bo.getServiceCompanyInfoList(),add.getContractCode());
|
||||
companyInfoService.saveContractCompany(bo.getServiceCompanyInfoList(), add.getContractCode());
|
||||
BigDecimal sum = list.stream().map(PsContractBusinessBo::getBusinessAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
add.setContractAmount(sum);//合同总金额
|
||||
add.setContractStatus(type == 1 ? ContractStatusEnum.INIT.getCode():ContractStatusEnum.CREATE.getCode());//合同状态
|
||||
@ -281,7 +281,8 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
//装填信息
|
||||
result.getRecords().forEach(this::fillContractInfo);
|
||||
fillContractInfo(result.getRecords());
|
||||
// result.getRecords().forEach(this::fillContractInfo);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@ -291,7 +292,8 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
//装填信息
|
||||
result.getRecords().forEach(this::fillContractInfo);
|
||||
fillContractInfo(result.getRecords());
|
||||
// result.getRecords().forEach(this::fillContractInfo);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@ -409,7 +411,9 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
|
||||
//服务公司删,则删任务,重新校验合同状态,可能已完成
|
||||
List<Long> taskIds = psTaskMainList.stream().map(stTask1 -> stTask1.getId()).collect(Collectors.toList());
|
||||
taskAppointMapper.deleteByIds(taskIds);
|
||||
if (!taskIds.isEmpty()){
|
||||
taskAppointMapper.deleteByIds(taskIds);
|
||||
}
|
||||
}
|
||||
|
||||
List<PsTaskMain> psTaskMainList = new ArrayList<>();
|
||||
@ -420,7 +424,7 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
if (companyInfoBo.getId() == null){
|
||||
companyInfoService.saveBo(companyInfoBo);
|
||||
}else{
|
||||
PsCompanyInfo update = MapstructUtils.convert(updateBo, PsCompanyInfo.class);
|
||||
PsCompanyInfo update = MapstructUtils.convert(companyInfoBo, PsCompanyInfo.class);
|
||||
companyInfoMapper.updateById(update);
|
||||
for (PsContractBusinessBo psContractBusinessBo : companyInfoBo.getBusinessList()) {
|
||||
psContractBusinessBo.setCompanyId(companyInfoBo.getId());
|
||||
@ -884,6 +888,72 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
|
||||
return qw;
|
||||
}
|
||||
private List<PsContractInfoVo> fillContractInfo(List<PsContractInfoVo> vos){
|
||||
|
||||
fillMoney(vos);
|
||||
|
||||
List<String> businessIds = new ArrayList<>();
|
||||
for (PsContractInfoVo vo : vos) {
|
||||
//电子签章审批
|
||||
if(StringUtils.equals(CommonStatusEnum.FAIL.getCode(), vo.getSignStatus())){
|
||||
// signFail.add(vo.getContractCode());
|
||||
businessIds.add(vo.getContractCode());
|
||||
}
|
||||
//回传合同审批
|
||||
if(StringUtils.equals(CommonStatusEnum.FAIL.getCode(), vo.getRollBackStatus())){
|
||||
businessIds.add(vo.getContractCode());
|
||||
}
|
||||
//合同作废审批
|
||||
if(StringUtils.equals(CommonStatusEnum.FAIL.getCode(), vo.getIsCancel())){
|
||||
businessIds.add(vo.getContractCode());
|
||||
}
|
||||
}
|
||||
Map<String, String> lastFailMap = approverRecordService.getLastFail(businessIds
|
||||
, List.of(ApproverTypeEnum.SIGN.getCode(), ApproverTypeEnum.ROLBACK.getCode(), ApproverTypeEnum.CANCELLA.getCode()));
|
||||
for (PsContractInfoVo vo : vos) {
|
||||
vo.setSignFailDesc(lastFailMap.get(vo.getContractCode() + "_" + ApproverTypeEnum.SIGN.getCode()));
|
||||
vo.setRollBackFailDesc(lastFailMap.get(vo.getContractCode() + "_" + ApproverTypeEnum.ROLBACK.getCode()));
|
||||
vo.setContractStatusDesc(lastFailMap.get(vo.getContractCode() + "_" + ApproverTypeEnum.CANCELLA.getCode()));
|
||||
}
|
||||
|
||||
//装填服务公司信息
|
||||
List<String> contractCodeList = vos.stream().map(PsContractInfoVo::getContractCode).toList();
|
||||
List<PsCompanyInfoVo> list = companyInfoService.getServiceCompany(contractCodeList);
|
||||
Map<String, List<PsCompanyInfoVo>> psCompanyInfoVoMap = new HashMap<>();
|
||||
for (PsCompanyInfoVo psCompanyInfoVo : list) {
|
||||
List<PsCompanyInfoVo> companyInfoVos = psCompanyInfoVoMap.computeIfAbsent(psCompanyInfoVo.getContractCode(), v -> new ArrayList<>());
|
||||
companyInfoVos.add(psCompanyInfoVo);
|
||||
}
|
||||
for (PsContractInfoVo vo : vos) {
|
||||
vo.setPsCompanySerivceVo(psCompanyInfoVoMap.get(vo.getContractCode()));
|
||||
}
|
||||
|
||||
for (PsContractInfoVo vo : vos) {
|
||||
if (vo.getFirstApplyDate() != null) {
|
||||
Date date = new Date();
|
||||
Date startDate = vo.getFirstApplyDate();
|
||||
long num = DateUtils.differentMonth(startDate, date);
|
||||
if (num <= 0) {
|
||||
vo.setConTime("0");
|
||||
} else if (num < 12) {
|
||||
vo.setConTime(num + "个月");
|
||||
} else {
|
||||
vo.setConTime(((int) (num / 12)) + "年" + num % 12 + "个月");
|
||||
}
|
||||
// int year = (date.getYear() - startDate.getYear());
|
||||
// int month = (date.getMonth() - startDate.getMonth());
|
||||
//// int day = (date.getDate() - startDate.getDate());
|
||||
// vo.setConTime((year>0?year+"年":"")+(month>0?month+"月":"")/*+(day>0?day+"天":"") */);
|
||||
}
|
||||
if(vo.getEndServiceDate() != null){
|
||||
int num = DateUtils.differentDaysByMillisecond(new Date(), vo.getEndServiceDate());
|
||||
vo.setEndNum(Math.max(num, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return vos;
|
||||
}
|
||||
private PsContractInfoVo fillContractInfo(PsContractInfoVo vo){
|
||||
|
||||
//装填服务类型和服务项目信息
|
||||
@ -935,6 +1005,66 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
|
||||
return vo;
|
||||
}
|
||||
public void fillMoney(List<PsContractInfoVo> vos){
|
||||
List<String> contractCodeList = vos.stream().map(PsContractInfoVo::getContractCode).toList();
|
||||
//装填回款记录
|
||||
List<PsContractPayVo> payListAll = contractPayService.queryListByContractCode(contractCodeList,null,PayStatusEnum.SUCCESS);
|
||||
Map<String, List<PsContractPayVo>> psContractPayVoMap = new HashMap<>();
|
||||
for (PsContractPayVo psContractPayVo : payListAll) {
|
||||
List<PsContractPayVo> psContractPayVos = psContractPayVoMap.computeIfAbsent(psContractPayVo.getContractCode(), v -> new ArrayList<>());
|
||||
psContractPayVos.add(psContractPayVo);
|
||||
}
|
||||
|
||||
for (PsContractInfoVo vo : vos) {
|
||||
List<PsContractPayVo> payList = psContractPayVoMap.get(vo.getContractCode());
|
||||
if (payList == null){
|
||||
payList = new ArrayList<>();
|
||||
}
|
||||
vo.setContractPayVoList(payList);
|
||||
//退款金额
|
||||
vo.setReturnMoney(payList.stream().filter(item->StringUtils.equals(item.getBusinessType(), PayBuinessStatusEnum.RETURN.getCode()))
|
||||
.map(PsContractPayVo::getMoney).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
//收款金额
|
||||
List<PsContractPayVo> returnList = payList.stream().filter(item -> StringUtils.equals(item.getBusinessType(), PayBuinessStatusEnum.PAY.getCode())).toList();
|
||||
BigDecimal netPay = returnList.stream().map(PsContractPayVo::getMoney).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
BigDecimal pay = netPay.subtract(vo.getReturnMoney());
|
||||
//已付金额(收款-退款)
|
||||
vo.setPayMoney(pay.compareTo(BigDecimal.ZERO) >= 0 ? pay : BigDecimal.ZERO);
|
||||
//未付金额(合同金额-已付金额)
|
||||
vo.setResidualMoney((vo.getContractAmount() == null ? BigDecimal.ZERO:vo.getContractAmount()).subtract(vo.getPayMoney()));
|
||||
|
||||
//回款日期 = 第一次回款(若有全部退款过,则需要从全部退款开始算)到最后一次回款的时间
|
||||
BigDecimal big = BigDecimal.ZERO;
|
||||
Date startDate = null;
|
||||
Date endDate = null;
|
||||
for (PsContractPayVo pcp : payList){
|
||||
big = StringUtils.equals(pcp.getBusinessType(),"1")?big.add(pcp.getMoney()):big.subtract(pcp.getMoney());
|
||||
if(big.compareTo(BigDecimal.ZERO)>0){
|
||||
if( startDate == null){
|
||||
startDate = pcp.getPayDate();
|
||||
}else{
|
||||
endDate = pcp.getPayDate();
|
||||
}
|
||||
}else{
|
||||
startDate = null;
|
||||
endDate = null;
|
||||
}
|
||||
}
|
||||
|
||||
//付款周期
|
||||
if(startDate == null){
|
||||
vo.setPeriod(0);
|
||||
}else if(endDate == null){
|
||||
vo.setPeriod(1);
|
||||
}else{
|
||||
//包含最后一天
|
||||
vo.setPeriod(DateUtils.calWorkDate(startDate,endDate));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public void fillMoney(PsContractInfoVo vo){
|
||||
//装填回款记录
|
||||
List<PsContractPayVo> payList = contractPayService.queryListByContractCode(vo.getContractCode(),null,PayStatusEnum.SUCCESS);
|
||||
|
@ -54,7 +54,7 @@ public class PsContractPayServiceImpl implements IPsContractPayService {
|
||||
* @param contractCode 合同编码
|
||||
* @return
|
||||
*/
|
||||
public List<PsContractPayVo> queryListByContractCode(String contractCode,String business,PayStatusEnum enu){
|
||||
public List<PsContractPayVo> queryListByContractCode(String contractCode, String business, PayStatusEnum enu){
|
||||
if(StringUtils.isBlank(contractCode)){return new ArrayList<>();}
|
||||
String code = enu == null ? null :enu.getCode();
|
||||
List<PsContractPayVo> list = baseMapper.selectVoList(Wrappers.<PsContractPay>lambdaQuery().
|
||||
@ -66,6 +66,17 @@ public class PsContractPayServiceImpl implements IPsContractPayService {
|
||||
return list == null?new ArrayList<>():list;
|
||||
}
|
||||
|
||||
public List<PsContractPayVo> queryListByContractCode(List<String> contractCode, String business, PayStatusEnum enu){
|
||||
if(contractCode.isEmpty()){return new ArrayList<>();}
|
||||
String code = enu == null ? null :enu.getCode();
|
||||
List<PsContractPayVo> list = baseMapper.selectVoList(Wrappers.<PsContractPay>lambdaQuery().
|
||||
in(PsContractPay::getContractCode, contractCode).eq(PsContractPay::getDelFlag,0)
|
||||
.eq(StringUtils.isNotBlank(business),PsContractPay::getBusinessType,business)
|
||||
.eq(code != null ,PsContractPay::getPayStatus, code)
|
||||
.notIn(PsContractPay::getPayStatus, PayStatusEnum.getStatus())//去掉无用的状态
|
||||
.orderByAsc(PsContractPay::getPayDate));
|
||||
return list == null?new ArrayList<>():list;
|
||||
}
|
||||
/**
|
||||
* 查询合同所有支付记录列表
|
||||
*
|
||||
|
@ -92,4 +92,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
left join ps_custom_info cus on app.business_id = cus.id
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
<select id="getLastFail" resultType="com.pusong.business.domain.vo.PsApproverRecordVo">
|
||||
SELECT r.business_id, r.business_type, r.approver_status, r.approver_desc
|
||||
FROM ps_approver_record r
|
||||
join(
|
||||
SELECT business_id, business_type, MAX(apply_date) AS max_apply_date
|
||||
FROM ps_approver_record
|
||||
GROUP BY business_id, business_type
|
||||
) AS max_records ON r.business_type = max_records.business_type AND r.apply_date = max_records.max_apply_date AND r.business_id = max_records.business_id
|
||||
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@ -10,15 +10,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<collection columnPrefix="det_" column="det" property="detailVoList" ofType="com.pusong.business.domain.vo.PsContractBusinessDetailVo" >
|
||||
</collection>
|
||||
</collection>
|
||||
|
||||
<collection columnPrefix="fu_" property="followUsers" ofType="com.pusong.system.domain.vo.SysUserVo" >
|
||||
|
||||
|
||||
</collection>
|
||||
|
||||
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="serviceCompanyServiceResult2" type="com.pusong.business.domain.vo.PsCompanyInfoVo">
|
||||
<id column="pcc_id" property="pccId"></id>
|
||||
<collection columnPrefix="bus_" property="businessVoList" ofType="com.pusong.business.domain.vo.PsContractBusinessVo" >
|
||||
<id column="id" property="id"></id>
|
||||
<collection columnPrefix="det_" column="det" property="detailVoList" ofType="com.pusong.business.domain.vo.PsContractBusinessDetailVo" >
|
||||
</collection>
|
||||
</collection>
|
||||
<collection columnPrefix="fu_" property="followUsers" ofType="com.pusong.system.domain.vo.SysUserVo" >
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectVoCustomManager" resultType="com.pusong.business.domain.vo.PsCompanyInfoVo">
|
||||
select
|
||||
com.*
|
||||
@ -71,8 +78,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
<select id="selectServiceCompanyList" resultMap="serviceCompanyServiceResult">
|
||||
select com.*,
|
||||
<select id="selectServiceCompanyList" resultMap="serviceCompanyServiceResult2">
|
||||
select
|
||||
--pcc.contract_code contract_code, 必须在 com.*, 上边,否则company里的 contract_code值会被com表的字段覆盖
|
||||
pcc.contract_code,
|
||||
pcc.id pcc_id,
|
||||
com.*,
|
||||
bus.business_amount bus_business_amount,
|
||||
bus.business_desc bus_business_desc,
|
||||
bus.business_type bus_business_type,
|
||||
@ -91,8 +102,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
det.amount bus_det_amount,
|
||||
det.amount_desc bus_det_amount_desc,
|
||||
det.extent_info bus_det_extent_info
|
||||
from ps_contract_company pcc
|
||||
left join ps_company_info com on pcc.company_id = com.id
|
||||
from ps_company_info com
|
||||
inner join ps_contract_company pcc on pcc.company_id = com.id
|
||||
left join ps_contract_business bus on bus.company_id = com.id and bus.contract_code = pcc.contract_code
|
||||
left join ps_contract_business_detail det on det.business_id = bus.id
|
||||
${ew.getCustomSqlSegment}
|
||||
|
Loading…
Reference in New Issue
Block a user