提成bug
This commit is contained in:
parent
06f8dda540
commit
93c4bb4321
@ -189,7 +189,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
return Date.from(zdt.toInstant());
|
||||
}
|
||||
|
||||
public static String toString(LocalDate date,String from){
|
||||
public static String toString(LocalDate date, String from){
|
||||
// 创建一个DateTimeFormatter实例来定义日期格式
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(from);
|
||||
|
||||
@ -240,6 +240,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
public static Date getFirstDayZeroTimeByMonth() {
|
||||
// 获取当前日期的Calendar对象
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
@ -256,6 +257,27 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
// 获取本月第一天的0点日期
|
||||
Date firstDayOfMonth = calendar.getTime();
|
||||
|
||||
// System.out.println("本月第一天的0点日期: " + firstDayOfMonth);
|
||||
return firstDayOfMonth;
|
||||
}
|
||||
public static Date getLastMonthFirstDayZeroTime() {
|
||||
// 获取当前日期的Calendar对象
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
||||
// 将日期设置为当前月的第一天
|
||||
calendar.set(Calendar.DAY_OF_MONTH, 1);
|
||||
|
||||
// 将时间设置为0点0分0秒
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
|
||||
calendar.add(Calendar.MONTH, -1);
|
||||
|
||||
// 获取本月第一天的0点日期
|
||||
Date firstDayOfMonth = calendar.getTime();
|
||||
|
||||
// System.out.println("本月第一天的0点日期: " + firstDayOfMonth);
|
||||
return firstDayOfMonth;
|
||||
}
|
||||
|
@ -51,8 +51,10 @@ public class TranslationHandler extends JsonSerializer<Object> implements Contex
|
||||
Object result = TranslationThreadLocal.getThreadInstance().get(value.toString(), translation.other());
|
||||
if (result == null){
|
||||
result = trans.translation(value, translation.other());
|
||||
if (result != null){
|
||||
TranslationThreadLocal.getThreadInstance().set(value.toString(), translation.other(), result.toString());
|
||||
}
|
||||
}
|
||||
gen.writeObject(result);
|
||||
} else {
|
||||
gen.writeObject(value);
|
||||
|
@ -32,6 +32,7 @@ import java.time.LocalDate;
|
||||
import java.time.temporal.Temporal;
|
||||
import java.time.temporal.TemporalAdjusters;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@ -59,6 +60,7 @@ public class CalSalaryBatch {
|
||||
private PsSalaryContractMapper salaryContractMapper;
|
||||
LocalDate now = null;
|
||||
|
||||
|
||||
public void setNow(LocalDate now) {
|
||||
this.now = now;
|
||||
}
|
||||
@ -82,6 +84,9 @@ public class CalSalaryBatch {
|
||||
|
||||
public List<PsSalaryVo> calcData(Temporal deadline, LocalDate thisMonth, boolean save){
|
||||
|
||||
QueryWrapper<PsSalary> lastWrapper = new QueryWrapper<PsSalary>();
|
||||
lastWrapper.eq("salary_date", DateUtils.getLastMonthFirstDayZeroTime());
|
||||
|
||||
List<PsSalaryVo> psSalaryList = new ArrayList<>();
|
||||
//删除该月历史数据
|
||||
psSalaryMapper.delete(Wrappers.<PsSalary>lambdaQuery().eq(PsSalary::getSalaryMonth, DateUtils.toString(thisMonth,"yyyy-MM")));
|
||||
@ -93,7 +98,15 @@ public class CalSalaryBatch {
|
||||
//当月新签+当月之前未完成合同数 = 全部合同 - 完成时间在当月之前的
|
||||
List<PsSalaryContractVo> contractInfos = psContractInfoMapper.querySalaryListByCodes(Wrappers.<PsContractInfo>lambdaQuery()
|
||||
.ne(PsContractInfo::getIsCancel, CommonStatusEnum.SUCCESS.getCode())
|
||||
.and(wq -> wq.le(PsContractInfo::getFinishDate, deadline).or().isNull(PsContractInfo::getFinishDate)));
|
||||
.and(wq -> wq
|
||||
.and(w -> w
|
||||
.le(PsContractInfo::getFinishDate, deadline)
|
||||
.ge(PsContractInfo::getFinishDate, thisMonth)
|
||||
)
|
||||
.or()
|
||||
.ne(PsContractInfo::getContractStatus, ContractStatusEnum.SUCCESS.getCode())
|
||||
)
|
||||
);
|
||||
|
||||
// List<PsContractInfo> contractInfos = psContractInfoMapper.selectList(Wrappers.<PsContractInfo>lambdaQuery()
|
||||
// .ne(PsContractInfo::getIsCancel, CommonStatusEnum.SUCCESS.getCode())
|
||||
@ -142,6 +155,7 @@ public class CalSalaryBatch {
|
||||
salary = salary.subtract(this.calReturnSalary(payList, configMap.get(post.getPostId())));
|
||||
log.info("进行计算提成计算{}", salary);
|
||||
log.info("进行存表");
|
||||
|
||||
PsSalary psSalary = new PsSalary();
|
||||
psSalary.setSalaryMoney(salary);
|
||||
psSalary.setSalaryMonth(DateUtils.toString(thisMonth,"yyyy-MM"));
|
||||
@ -198,6 +212,10 @@ public class CalSalaryBatch {
|
||||
psSalaryContract.setUserId(user.getUserId());
|
||||
psSalaryContract.setSalaryRatioDate(DateUtils.toDate(thisMonth));
|
||||
|
||||
if (psContractInfo.getComId() == null){
|
||||
psSalaryContract.setCompanyName(psContractInfo.getContactPersonName());
|
||||
}
|
||||
|
||||
lis.add(psSalaryContract);
|
||||
}
|
||||
|
||||
@ -221,6 +239,10 @@ public class CalSalaryBatch {
|
||||
psSalaryContract.setUserId(user.getUserId());
|
||||
psSalaryContract.setSalaryRatioDate(DateUtils.toDate(thisMonth));
|
||||
|
||||
if (psContractInfo.getComId() == null){
|
||||
psSalaryContract.setCompanyName(psContractInfo.getContactPersonName());
|
||||
}
|
||||
|
||||
lis.add(psSalaryContract);
|
||||
}
|
||||
}
|
||||
@ -242,35 +264,43 @@ public class CalSalaryBatch {
|
||||
*/
|
||||
private BigDecimal calSalary(List<PsContractBusinessVo> businessVo, Map<String, BigDecimal> configMap, Map<String, BigDecimal> costMap){
|
||||
String cbStr = "0.0";
|
||||
String rateStr = "0.1";
|
||||
BigDecimal rateStr = new BigDecimal(configMap ==null || configMap.isEmpty() ? "0" : "100");
|
||||
|
||||
configMap = CollectionUtils.isEmpty(configMap) ? new HashMap<>() : configMap;
|
||||
costMap = CollectionUtils.isEmpty(costMap) ? new HashMap<>() : costMap;
|
||||
BigDecimal salary = BigDecimal.ZERO;
|
||||
|
||||
|
||||
for (BigDecimal value : configMap.values()) {
|
||||
if (value.doubleValue() < rateStr.doubleValue()){
|
||||
rateStr = value;
|
||||
}
|
||||
}
|
||||
|
||||
for(PsContractBusinessVo item : businessVo){
|
||||
|
||||
//如果详情没有填写金额的话按照详情中最低的提成比例进行计算(按照详情算)
|
||||
if(item.getDetailVoList().get(0).getAmount() == null
|
||||
|| BigDecimal.ZERO.compareTo(item.getDetailVoList().get(0).getAmount()) == 0){
|
||||
BigDecimal rate = new BigDecimal(cbStr);
|
||||
BigDecimal cost = new BigDecimal(rateStr);
|
||||
BigDecimal rate = rateStr;
|
||||
BigDecimal cost = new BigDecimal(cbStr);
|
||||
for (PsContractBusinessDetailVo detail : item.getDetailVoList()){
|
||||
BigDecimal rateConfig = configMap.get(detail.getBusinessProject()) == null ? new BigDecimal("0.1") : configMap.get(detail.getBusinessProject());
|
||||
rate = rate.compareTo(rateConfig) < 0 ? rate : rateConfig;
|
||||
cost = cost.add(costMap.get(detail.getBusinessProject()) == null ? new BigDecimal(cbStr) : costMap.get(detail.getBusinessProject()));
|
||||
}
|
||||
//服务类型金额 - 成本
|
||||
BigDecimal amount = item.getBusinessAmount().subtract(cost);
|
||||
BigDecimal amount = item.getBusinessAmount() == null ? new BigDecimal(0) : item.getBusinessAmount().subtract(cost);
|
||||
// ×比例
|
||||
rate = rate.multiply(new BigDecimal("0.01"));
|
||||
salary = salary.add(amount.multiply(rate));
|
||||
}else{//(按照类型算)
|
||||
for (PsContractBusinessDetailVo detail : item.getDetailVoList()){
|
||||
//比例
|
||||
BigDecimal rateConfig = configMap.get(detail.getBusinessProject()) == null ? new BigDecimal("0.1") : configMap.get(detail.getBusinessProject());
|
||||
BigDecimal rateConfig = configMap.get(detail.getBusinessProject()) == null ? rateStr : configMap.get(detail.getBusinessProject());
|
||||
rateConfig = rateConfig.multiply(new BigDecimal("0.01"));
|
||||
//成本
|
||||
BigDecimal rateCost = costMap.get(detail.getBusinessProject()) == null ? new BigDecimal(cbStr):costMap.get(detail.getBusinessProject());
|
||||
BigDecimal rateCost = costMap.get(detail.getBusinessProject()) == null ? new BigDecimal(cbStr) : costMap.get(detail.getBusinessProject());
|
||||
|
||||
BigDecimal amount = detail.getAmount();
|
||||
if (detail.getAmount() == null){
|
||||
|
@ -95,5 +95,9 @@ public class PsSalaryContractVo implements Serializable {
|
||||
|
||||
private String contractStatus;
|
||||
|
||||
private Long comId;
|
||||
|
||||
private String contactPersonName;
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
package com.pusong.business.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.pusong.common.translation.annotation.Translation;
|
||||
import com.pusong.common.translation.constant.TransConstant;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ -12,27 +14,21 @@ public class ServiceScheduleVo {
|
||||
/**
|
||||
* 被分配者
|
||||
*/
|
||||
@Translation(type = TransConstant.USER_ID_TO_NICKNAME)
|
||||
private Long allot;
|
||||
private UserAndStatus allot;
|
||||
|
||||
/**
|
||||
* 生成合同
|
||||
*/
|
||||
@Translation(type = TransConstant.USER_ID_TO_NICKNAME)
|
||||
private Long createContract;
|
||||
private UserAndStatus createContract;
|
||||
/**
|
||||
* 第一笔回款
|
||||
*/
|
||||
@Translation(type = TransConstant.USER_ID_TO_NICKNAME)
|
||||
private Long firstPay;
|
||||
private UserAndStatus firstPay;
|
||||
/**
|
||||
* 派单者
|
||||
*/
|
||||
@Translation(type = TransConstant.USER_ID_TO_NICKNAME)
|
||||
private Long appoint;
|
||||
/**
|
||||
* 内勤
|
||||
*/
|
||||
private UserAndStatus appoint;
|
||||
|
||||
|
||||
/**
|
||||
* 内勤
|
||||
@ -52,24 +48,22 @@ public class ServiceScheduleVo {
|
||||
/**
|
||||
* 回传
|
||||
*/
|
||||
@Translation(type = TransConstant.USER_ID_TO_NICKNAME)
|
||||
private Long rollBack;
|
||||
private UserAndStatus rollBack;
|
||||
/**
|
||||
* 最后一笔回款收款者
|
||||
*/
|
||||
@Translation(type = TransConstant.USER_ID_TO_NICKNAME)
|
||||
private Long payee;
|
||||
private UserAndStatus payee;
|
||||
/**
|
||||
* 最后一笔回款审批者
|
||||
*/
|
||||
@Translation(type = TransConstant.USER_ID_TO_NICKNAME)
|
||||
private Long approve;
|
||||
private UserAndStatus approve;
|
||||
/**
|
||||
* 是否已完成(1是 0否)
|
||||
*/
|
||||
private Integer isFinish;
|
||||
private UserAndStatus isFinish;
|
||||
|
||||
|
||||
@Data
|
||||
public static class UserAndStatus{
|
||||
/**
|
||||
* 内勤
|
||||
@ -80,25 +74,23 @@ public class ServiceScheduleVo {
|
||||
* 内勤是否已完成(1是0否)
|
||||
*/
|
||||
private Integer status;
|
||||
public UserAndStatus(Long uid, Integer status){
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private Date finishDate;
|
||||
public UserAndStatus(Long uid, Integer status, Date finishDate){
|
||||
this.uid = uid;
|
||||
this.status = status;
|
||||
this.finishDate = finishDate;
|
||||
}
|
||||
|
||||
public Long getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(Long uid) {
|
||||
public UserAndStatus(Long uid, Date finishDate){
|
||||
this.uid = uid;
|
||||
this.finishDate = finishDate;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
public UserAndStatus(Integer status, Date finishDate){
|
||||
this.status = status;
|
||||
this.finishDate = finishDate;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,33 @@
|
||||
package com.pusong.business.domain.vo.home;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class BigDecimalSerializer extends JsonSerializer<BigDecimal> {
|
||||
public BigDecimalSerializer() {
|
||||
}
|
||||
|
||||
public void serialize(BigDecimal value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
|
||||
if (value != null) {
|
||||
BigDecimal number = value.setScale(0, BigDecimal.ROUND_HALF_UP);
|
||||
gen.writeNumber(number);
|
||||
} else {
|
||||
gen.writeNumber(value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeWithType(BigDecimal value, JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
|
||||
if (value != null) {
|
||||
BigDecimal number = value.setScale(0, BigDecimal.ROUND_HALF_UP);
|
||||
gen.writeNumber(number);
|
||||
} else {
|
||||
gen.writeNumber(value);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,14 @@
|
||||
package com.pusong.business.domain.vo.home;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.pusong.business.domain.vo.PsCustomPriceVo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -26,11 +29,13 @@ public class ChannelAmountVo {
|
||||
/**
|
||||
* 成交总金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal all;
|
||||
|
||||
/**
|
||||
* 总roi
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal roi;
|
||||
|
||||
/**
|
||||
@ -62,11 +67,23 @@ public class ChannelAmountVo {
|
||||
DataAmountVo dataAmountVo = new DataAmountVo();
|
||||
dataAmountVo.setType("总计");
|
||||
dataAmountVo.setPer("100%");
|
||||
dataAmountVo.setNum(num+"单");
|
||||
dataAmountVo.setNum(num + "单");
|
||||
dataAmountVo.setPayMoney(payMoney);
|
||||
dataAmountVo.setUnPayMoney(unpayMoney);
|
||||
dataAmountVo.setMoney(all);
|
||||
channelList = channelList.stream().sorted(Comparator.comparing(DataAmountVo::getMoney).reversed()).collect(Collectors.toList());
|
||||
|
||||
// Collections.sort(channelList, new Comparator<DataAmountVo>() {
|
||||
// @Override
|
||||
// public int compare(DataAmountVo o1, DataAmountVo o2) {
|
||||
// return Integer.valueOf(o2.getNum()) - Integer.valueOf(o1.getNum());
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// for (DataAmountVo dataAmountVo1 : channelList) {
|
||||
// dataAmountVo1.setNum(dataAmountVo1.getNum() + "单");
|
||||
// }
|
||||
|
||||
channelList.add(dataAmountVo);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.pusong.business.domain.vo.home;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -23,6 +24,7 @@ public class ChannelPayInfo {
|
||||
/**
|
||||
* 合同金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal contractAmount;
|
||||
/**
|
||||
* 支付类型1回款2退款
|
||||
@ -31,10 +33,12 @@ public class ChannelPayInfo {
|
||||
/**
|
||||
* 回款/退款金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal money;
|
||||
|
||||
/**
|
||||
* 成本
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal cost;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.pusong.business.domain.vo.home;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -21,29 +22,35 @@ public class DataAmountVo {
|
||||
/**
|
||||
* 合同金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal money;
|
||||
/**
|
||||
* 已回款金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal payMoney;
|
||||
/**
|
||||
* 未回款金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal unPayMoney;
|
||||
|
||||
|
||||
/**
|
||||
* 项目成本
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal cost;
|
||||
|
||||
/**
|
||||
* 投入
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal investCapital;
|
||||
|
||||
/**
|
||||
* roi
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal roi;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.pusong.business.domain.vo.home;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -22,6 +23,7 @@ public class MakeAmountVo {
|
||||
/**
|
||||
* 成交总金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal all;
|
||||
/**
|
||||
* 新签合同信息
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.pusong.business.domain.vo.home;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -25,6 +26,7 @@ public class RenewalInfoVo {
|
||||
/**
|
||||
* 到期合同总额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal contractAmount;
|
||||
|
||||
/**
|
||||
@ -40,10 +42,12 @@ public class RenewalInfoVo {
|
||||
/**
|
||||
* 已续费金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal payMoney;
|
||||
/**
|
||||
* 当月未续费金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal unPayMoney;
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.pusong.business.domain.vo.home;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -22,6 +23,7 @@ public class ReturnAmountVo {
|
||||
/**
|
||||
* 成交总金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal all;
|
||||
/**
|
||||
* 新签合同信息
|
||||
@ -54,14 +56,17 @@ public class ReturnAmountVo {
|
||||
/**
|
||||
* 合同金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal money;
|
||||
/**
|
||||
* 已回款金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal payMoney;
|
||||
/**
|
||||
* 未回款金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal unPayMoney;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.pusong.business.domain.vo.home;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -34,14 +35,17 @@ public class ReturnMoneyInfoVo {
|
||||
/**
|
||||
* 当月合同回款金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal sumMoney;
|
||||
/**
|
||||
* 当月已回款金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal payMoney;
|
||||
/**
|
||||
* 当月未回款金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal unPayMoney;
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.pusong.business.domain.vo.home;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -46,16 +47,19 @@ public class SalasVo {
|
||||
/**
|
||||
* 已成交总额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal sumContractAmount;
|
||||
|
||||
/**
|
||||
* 已回款金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal payContractAmount;
|
||||
|
||||
/**
|
||||
* 未回款金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal unPayContractAmount;
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.pusong.business.domain.vo.home;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -23,35 +24,43 @@ public class UserAmountInfoVo {
|
||||
/**
|
||||
* 合同总金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal sumAmount = new BigDecimal(0);
|
||||
/**
|
||||
* 已支付总金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal payedSumAmount = new BigDecimal(0);
|
||||
/**
|
||||
* 未支付金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal unPaySumAmount = new BigDecimal(0);
|
||||
|
||||
/**
|
||||
* 托管类型合同总金额 类型号:4
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal tuoGuanAmount = new BigDecimal(0);
|
||||
/**
|
||||
* 续费类型合同总金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal xuFeiAmount = new BigDecimal(0);
|
||||
/**
|
||||
* 软件定制类型合同总金额 类型号:9
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal softwareDevAmount = new BigDecimal(0);
|
||||
/**
|
||||
* 其他类型合同总金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal otherAmount = new BigDecimal(0);
|
||||
/**
|
||||
* 转介绍的合同金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal jieShaoAmount = new BigDecimal(0);
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.pusong.business.domain.vo.home;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -23,6 +24,7 @@ public class UserAmountVo {
|
||||
/**
|
||||
* 成交总金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal all;
|
||||
|
||||
|
||||
@ -49,6 +51,10 @@ public class UserAmountVo {
|
||||
|
||||
public void cellPer(){
|
||||
if (userAmountList != null && !userAmountList.isEmpty()){
|
||||
|
||||
userAmountList = userAmountList.stream().sorted(Comparator.comparing(UserAmountInfoVo::getSumAmount).reversed()).collect(Collectors.toList());
|
||||
|
||||
|
||||
UserAmountInfoVo sum = new UserAmountInfoVo();
|
||||
sum.setTuoGuanAmount(new BigDecimal(0));
|
||||
sum.setSumAmount(new BigDecimal(0));
|
||||
@ -66,8 +72,12 @@ public class UserAmountVo {
|
||||
sum.setAmountPer("100%");
|
||||
}
|
||||
userAmountList.add(sum);
|
||||
|
||||
|
||||
}
|
||||
if (zjsList != null && !zjsList.isEmpty()){
|
||||
zjsList = zjsList.stream().sorted(Comparator.comparing(UserContractAmountVo::getSumAmount).reversed()).collect(Collectors.toList());
|
||||
|
||||
UserContractAmountVo sum = new UserContractAmountVo();
|
||||
sum.setSumAmount(new BigDecimal(0));
|
||||
sum.setJieShaoAmount(new BigDecimal(0));;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.pusong.business.domain.vo.home;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -34,14 +35,17 @@ public class UserContractAmountInfo {
|
||||
/**
|
||||
* 服务类型金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal businessAmount;
|
||||
/**
|
||||
* 客户来源
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private String customSource;
|
||||
/**
|
||||
* 合同价格
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal contractAmount;
|
||||
/**
|
||||
* payId
|
||||
@ -50,6 +54,7 @@ public class UserContractAmountInfo {
|
||||
/**
|
||||
* 已付款金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal payedMoney;
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.pusong.business.domain.vo.home;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -28,16 +29,19 @@ public class UserContractAmountVo {
|
||||
/**
|
||||
* 用户所有合同总金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal sumAmount = new BigDecimal(0);
|
||||
|
||||
/**
|
||||
* 转介绍的合同金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal jieShaoAmount = new BigDecimal(0);
|
||||
|
||||
/**
|
||||
* 其他类型合同总金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal otherAmount = new BigDecimal(0);
|
||||
/**
|
||||
* 转介绍合同数量
|
||||
@ -51,12 +55,16 @@ public class UserContractAmountVo {
|
||||
/**
|
||||
* 已支付总金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal jsPayedSumAmount=new BigDecimal(0);
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal otherPayedSumAmount=new BigDecimal(0);
|
||||
/**
|
||||
* 未支付金额
|
||||
*/
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal jsUnPaySumAmount=new BigDecimal(0);
|
||||
@JsonSerialize(using = BigDecimalSerializer.class)
|
||||
private BigDecimal otherUnPaySumAmount=new BigDecimal(0);
|
||||
|
||||
/**
|
||||
|
@ -40,7 +40,7 @@ public interface IPsApproverRecordService {
|
||||
* @return 审批记录列表
|
||||
*/
|
||||
List<PsApproverRecordVo> queryList(PsApproverRecordBo bo);
|
||||
|
||||
PsApproverRecordVo queryLast(String businessId, String businessType);
|
||||
/**
|
||||
* 审批
|
||||
*
|
||||
|
@ -19,6 +19,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -66,6 +67,7 @@ public class PayContractApproverServiceImpl extends ApproverAbstractServiceImpl
|
||||
if(StringUtils.equals(ContractStatusEnum.CREATE.getCode(), info.getContractStatus())){
|
||||
if (info.getResidualMoney().doubleValue() <= 0){
|
||||
updateInfo.setContractStatus(ContractStatusEnum.SUCCESS.getCode());
|
||||
updateInfo.setFinishDate(new Date());
|
||||
psContractInfoService.updateByCode(updateInfo);
|
||||
}
|
||||
}
|
||||
|
@ -270,6 +270,9 @@ public class HomeServiceImpl implements HomeService {
|
||||
renewalInfoVo.setDateStr(date);
|
||||
renewalInfoVo.setPayMoneyPer("100");
|
||||
renewalInfoVo.setUnPayMoneyPer("0");
|
||||
renewalInfoVo.setCustomPer("0");
|
||||
renewalInfoVo.setUnPaycustomPer("0");
|
||||
|
||||
return renewalInfoVo;
|
||||
}
|
||||
List<Long> companyIds = expireContact.stream().map(PsContractBusiness::getCompanyId).toList();
|
||||
@ -344,7 +347,7 @@ public class HomeServiceImpl implements HomeService {
|
||||
for(UserContractAmountInfo obj : list){
|
||||
UserContractAmountVo vo = res.get(obj.getUserId());
|
||||
if(vo == null){
|
||||
vo=new UserContractAmountVo();
|
||||
vo = new UserContractAmountVo();
|
||||
vo.setUserId(obj.getUserId());
|
||||
vo.setNickName(obj.getNickName());
|
||||
vo.setDateStr(date);
|
||||
@ -697,6 +700,7 @@ public class HomeServiceImpl implements HomeService {
|
||||
data.setCost(payList.stream().map(ChannelPayInfo::getCost).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
channelList.add(data);
|
||||
}
|
||||
|
||||
res.setChannelList(channelList);
|
||||
//计算总金额和占比
|
||||
res.cellPer();
|
||||
|
@ -73,7 +73,14 @@ public class PsApproverRecordServiceImpl implements IPsApproverRecordService {
|
||||
LambdaQueryWrapper<PsApproverRecord> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsApproverRecordVo queryLast(String businessId, String businessType) {
|
||||
LambdaQueryWrapper<PsApproverRecord> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(PsApproverRecord::getBusinessType, businessType);
|
||||
lqw.eq(PsApproverRecord::getBusinessId, businessId);
|
||||
lqw.orderByDesc(PsApproverRecord::getApproverDate);
|
||||
return baseMapper.selectVoOne(lqw);
|
||||
}
|
||||
private LambdaQueryWrapper<PsApproverRecord> buildQueryWrapper(PsApproverRecordBo bo) {
|
||||
LambdaQueryWrapper<PsApproverRecord> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getBusinessId() != null, PsApproverRecord::getBusinessId, bo.getBusinessId());
|
||||
|
@ -186,6 +186,7 @@ public class PsCompanyInfoServiceImpl implements IPsCompanyInfoService {
|
||||
sql.append("and business_type = '2' and is_proxy = '2'");
|
||||
}
|
||||
lqw.exists(bo.getType() != 1, sql.toString());
|
||||
lqw.orderByAsc("bus.min_end_date");
|
||||
lqw.orderByDesc("finish_date");
|
||||
// lqw.groupBy("com.id");
|
||||
Page<PsCompanyInfoVo> result = baseMapper.selectPageList2(pageQuery.build(), lqw);
|
||||
|
@ -879,9 +879,9 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
|
||||
ServiceScheduleVo serviceScheduleVo = new ServiceScheduleVo();
|
||||
//分配
|
||||
serviceScheduleVo.setAllot(customer.getCustomManager());
|
||||
serviceScheduleVo.setAllot(new ServiceScheduleVo.UserAndStatus(customer.getCustomManager(), contractInfo.getCreateTime()));
|
||||
//生成合同
|
||||
serviceScheduleVo.setCreateContract(customer.getCustomManager());
|
||||
serviceScheduleVo.setCreateContract(new ServiceScheduleVo.UserAndStatus(customer.getCustomManager(), contractInfo.getCreateTime()));
|
||||
//支付金额
|
||||
PsContractInfoVo vo = new PsContractInfoVo();
|
||||
vo.setContractCode(contractCode);
|
||||
@ -890,7 +890,10 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
List<PsContractPayVo> payVoList = vo.getContractPayVoList().stream()
|
||||
.filter(item -> StringUtils.equals("1", item.getBusinessType())).toList();
|
||||
//第一笔回款
|
||||
serviceScheduleVo.setFirstPay(CollectionUtils.isNotEmpty(payVoList)?payVoList.get(0).getCreateBy():null);
|
||||
if (CollectionUtils.isNotEmpty(payVoList) ){
|
||||
PsContractPayVo pay1 = payVoList.get(0);
|
||||
serviceScheduleVo.setFirstPay(new ServiceScheduleVo.UserAndStatus(pay1.getCreateBy(), pay1.getCreateTime()));
|
||||
}
|
||||
|
||||
PsTaskMain task = taskMainService.queryByContractCodeAndServiceCompanyId(contractCode, serviceCompanyId);
|
||||
List<PsTaskAppoint> appointList = new ArrayList<>();
|
||||
@ -903,33 +906,41 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
}
|
||||
|
||||
//派单者
|
||||
serviceScheduleVo.setAppoint(task == null ? null : task.getOperateUser());
|
||||
if (task != null){
|
||||
serviceScheduleVo.setAppoint(new ServiceScheduleVo.UserAndStatus(task.getOperateUser(), task.getCreateTime()));
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(appointList)){
|
||||
appointList.forEach(item->{
|
||||
if(StringUtils.equals("1",item.getAppointType())){
|
||||
serviceScheduleVo.addIn(new ServiceScheduleVo.UserAndStatus(item.getExecutor(), StringUtils.equals(AppointStatusEnum.FINISH.getCode(), item.getAppointStatus()) ? 1 : 0));
|
||||
serviceScheduleVo.addIn(new ServiceScheduleVo.UserAndStatus(item.getExecutor(), StringUtils.equals(AppointStatusEnum.FINISH.getCode(), item.getAppointStatus()) ? 1 : 0, item.getFinishDate()));
|
||||
}else if(StringUtils.equals("2",item.getAppointType())){
|
||||
serviceScheduleVo.addOut(new ServiceScheduleVo.UserAndStatus(item.getExecutor(), StringUtils.equals(AppointStatusEnum.FINISH.getCode(), item.getAppointStatus()) ? 1 : 0));
|
||||
serviceScheduleVo.addOut(new ServiceScheduleVo.UserAndStatus(item.getExecutor(), StringUtils.equals(AppointStatusEnum.FINISH.getCode(), item.getAppointStatus()) ? 1 : 0, item.getFinishDate()));
|
||||
}else{
|
||||
serviceScheduleVo.addSecret(new ServiceScheduleVo.UserAndStatus(item.getExecutor(), StringUtils.equals(AppointStatusEnum.FINISH.getCode(), item.getAppointStatus()) ? 1 : 0));
|
||||
serviceScheduleVo.addSecret(new ServiceScheduleVo.UserAndStatus(item.getExecutor(), StringUtils.equals(AppointStatusEnum.FINISH.getCode(), item.getAppointStatus()) ? 1 : 0, item.getFinishDate()));
|
||||
}
|
||||
});
|
||||
}
|
||||
//回传
|
||||
serviceScheduleVo.setRollBack(StringUtils.equals(CommonStatusEnum.SUCCESS.getCode(),contractInfo.getRollBackStatus())?customer.getCustomManager():null);
|
||||
if(vo.getResidualMoney().compareTo(BigDecimal.ZERO) <=0 && CollectionUtils.isNotEmpty(payVoList)){
|
||||
Long rollPdfUid = StringUtils.equals(CommonStatusEnum.SUCCESS.getCode(), contractInfo.getRollBackStatus()) ? customer.getCustomManager() : null;
|
||||
if (rollPdfUid != null){
|
||||
PsApproverRecordVo psApproverRecordVo = approverRecordService.queryLast(contractInfo.getContractCode(), ApproverTypeEnum.ROLBACK.getCode());
|
||||
serviceScheduleVo.setRollBack(new ServiceScheduleVo.UserAndStatus(rollPdfUid, psApproverRecordVo != null ? psApproverRecordVo.getApplyDate() : null));
|
||||
}
|
||||
|
||||
if(vo.getResidualMoney().compareTo(BigDecimal.ZERO) <= 0 && CollectionUtils.isNotEmpty(payVoList)){
|
||||
PsContractPayVo pay = payVoList.get(payVoList.size() - 1);
|
||||
//最后一笔回款收款者
|
||||
serviceScheduleVo.setPayee(pay.getCreateBy());
|
||||
serviceScheduleVo.setPayee(new ServiceScheduleVo.UserAndStatus(pay.getCreateBy(), pay.getCreateTime()));
|
||||
PsApproverRecordBo bo = new PsApproverRecordBo();
|
||||
bo.setBusinessId(pay.getId()+"");
|
||||
bo.setBusinessId(pay.getId() + "");
|
||||
bo.setBusinessType(ApproverTypeEnum.PAY.getCode());
|
||||
List<PsApproverRecordVo> appro = approverRecordService.queryList(bo);
|
||||
//最后一笔回款审批者
|
||||
serviceScheduleVo.setApprove(CollectionUtils.isNotEmpty(appro)?appro.get(0).getUpdateBy():null);
|
||||
ServiceScheduleVo.UserAndStatus userAndStatus = new ServiceScheduleVo.UserAndStatus(CollectionUtils.isNotEmpty(appro) ? appro.get(0).getUpdateBy() : null, CollectionUtils.isNotEmpty(appro) ? appro.get(0).getApproverDate() : null);
|
||||
serviceScheduleVo.setApprove(userAndStatus);
|
||||
}
|
||||
//是否已完成(1是 0否)
|
||||
serviceScheduleVo.setIsFinish(StringUtils.equals(ContractStatusEnum.SUCCESS.getCode(), contractInfo.getContractStatus()) ? 1 : 0);
|
||||
serviceScheduleVo.setIsFinish(new ServiceScheduleVo.UserAndStatus(StringUtils.equals(ContractStatusEnum.SUCCESS.getCode(), contractInfo.getContractStatus()) ? 1 : 0, contractInfo.getFinishDate()));
|
||||
return serviceScheduleVo;
|
||||
}
|
||||
|
||||
|
@ -123,8 +123,17 @@ public class PsSalaryConfigServiceImpl implements IPsSalaryConfigService {
|
||||
baseMapper.delete(Wrappers.<PsSalaryConfig>lambdaQuery().eq(PsSalaryConfig::getTemplateCode, code));
|
||||
log.info("修改配置成功");
|
||||
}
|
||||
List<PsSalaryConfig> psSalaryConfigs = baseMapper.selectList(Wrappers.<PsSalaryConfig>lambdaQuery()
|
||||
.eq(PsSalaryConfig::getDelFlag, 0)
|
||||
.ne(addVo.getTemplateCode() != null, PsSalaryConfig::getTemplateCode, addVo.getTemplateCode())
|
||||
.in(PsSalaryConfig::getTemplateName, addVo.getTemplateName()));
|
||||
if(!psSalaryConfigs.isEmpty()){
|
||||
throw new ServiceException("模板名称重复");
|
||||
}
|
||||
|
||||
for (String post : addVo.getPostId().split(",")) {
|
||||
List<String> spList = new ArrayList<>();
|
||||
|
||||
list.forEach(item->{
|
||||
item.setId(null);
|
||||
item.setTemplateCode(code);
|
||||
@ -132,14 +141,18 @@ public class PsSalaryConfigServiceImpl implements IPsSalaryConfigService {
|
||||
item.setPostId(Long.valueOf(post));
|
||||
spList.add(item.getServiceProject());
|
||||
});
|
||||
LambdaQueryWrapper<PsSalaryConfig> wq = Wrappers.<PsSalaryConfig>lambdaQuery().eq(PsSalaryConfig::getDelFlag, 0)
|
||||
.eq(PsSalaryConfig::getPostId,post).in(PsSalaryConfig::getServiceProject,spList);
|
||||
|
||||
Long num = baseMapper.selectCount(Wrappers.<PsSalaryConfig>lambdaQuery().eq(PsSalaryConfig::getDelFlag, 0)
|
||||
.eq(PsSalaryConfig::getPostId, post).in(PsSalaryConfig::getServiceProject, spList));
|
||||
if(num>0){
|
||||
LambdaQueryWrapper<PsSalaryConfig> wq = Wrappers.<PsSalaryConfig>lambdaQuery()
|
||||
.eq(PsSalaryConfig::getDelFlag, 0)
|
||||
.eq(PsSalaryConfig::getPostId, post)
|
||||
.in(PsSalaryConfig::getServiceProject, spList);
|
||||
Long num = baseMapper.selectCount(wq);
|
||||
if(num > 0){
|
||||
throw new ServiceException("岗位的服务项目重复");
|
||||
}
|
||||
|
||||
|
||||
|
||||
baseMapper.insertBatch(list);
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import com.pusong.business.domain.PsCustomPrice;
|
||||
import com.pusong.business.domain.PsSalaryContract;
|
||||
import com.pusong.business.domain.vo.PsSalaryContractVo;
|
||||
import com.pusong.business.enums.CommonStatusEnum;
|
||||
import com.pusong.business.enums.ContractStatusEnum;
|
||||
import com.pusong.business.mapper.PsContractInfoMapper;
|
||||
import com.pusong.business.mapper.PsSalaryContractMapper;
|
||||
import com.pusong.common.core.utils.DateUtils;
|
||||
@ -61,22 +62,13 @@ public class PsSalaryServiceImpl implements IPsSalaryService {
|
||||
lqw.eq("salary.del_flag", 0);
|
||||
Page<PsSalaryVo> result = baseMapper.querySalaryList(pageQuery.build(), lqw);
|
||||
|
||||
|
||||
if (bo.getStartDate().getTime() <= DateUtils.getFirstDayZeroTimeByMonth().getTime() && bo.getEndDate().getTime() >= DateUtils.getFirstDayZeroTimeByMonth().getTime()){
|
||||
LocalDateTime deadline = bo.getEndDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
LocalDate thisMonth = LocalDate.now();
|
||||
LocalDate thisMonth = DateUtils.getFirstDayZeroTimeByMonth().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
List<PsSalaryVo> adds = calSalaryBatch.calcData(deadline, thisMonth, false);
|
||||
List<PsSalaryVo> records = new ArrayList<>();
|
||||
records.addAll(result.getRecords());
|
||||
|
||||
// long diffNum = result.getSize() - result.getRecords().size();
|
||||
// diffNum = diffNum > adds.size() ? adds.size() : diffNum;
|
||||
//
|
||||
// long remainder = result.getTotal() % result.getPages();
|
||||
// long replenishment = result.getPages() - remainder;
|
||||
// long maxPage = result.getTotal() / result.getPages() + 1;
|
||||
|
||||
|
||||
if (result.getTotal() < pageQuery.getPageNum() * result.getSize()){
|
||||
//需要补本月的
|
||||
long diffNum = pageQuery.getPageNum() * result.getSize() - result.getTotal();//到该页结尾总共需要补多少
|
||||
@ -96,7 +88,6 @@ public class PsSalaryServiceImpl implements IPsSalaryService {
|
||||
result.setRecords(records);
|
||||
}
|
||||
result.setTotal(result.getTotal() + adds.size());
|
||||
|
||||
}
|
||||
|
||||
return TableDataInfo.build(result);
|
||||
@ -119,13 +110,29 @@ public class PsSalaryServiceImpl implements IPsSalaryService {
|
||||
Page<PsSalaryContractVo> result;
|
||||
if (id == null){
|
||||
LocalDateTime deadline = DateUtils.getEndTimeByMonth(new Date()).toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
|
||||
LocalDate thisMonth = DateUtils.getFirstDayZeroTimeByMonth().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
QueryWrapper<PsContractInfo> wrapper = new QueryWrapper<PsContractInfo>()
|
||||
.ne("is_cancel", CommonStatusEnum.SUCCESS.getCode())
|
||||
.and(wq -> wq.le("finish_date", deadline).or().isNull("finish_date"))
|
||||
.eq("info.custom_manager", customManagerId);
|
||||
.and(wq -> wq
|
||||
.and(w -> w
|
||||
.le("finish_date", deadline)
|
||||
.ge("finish_date", thisMonth)
|
||||
)
|
||||
.or()
|
||||
.ne("contract_status", ContractStatusEnum.SUCCESS.getCode())
|
||||
)
|
||||
.eq("info.custom_manager", customManagerId)
|
||||
.eq("1".equals(status), "contract_status", ContractStatusEnum.SUCCESS.getCode())
|
||||
.ne("2".equals(status), "contract_status", ContractStatusEnum.SUCCESS.getCode())
|
||||
;
|
||||
|
||||
result = psContractInfoMapper.querySalaryListByCodes(pageQuery.build(), wrapper);
|
||||
for (PsSalaryContractVo record : result.getRecords()) {
|
||||
if (record.getComId() == null){
|
||||
record.setCompanyName(record.getContactPersonName());
|
||||
}
|
||||
record.setStatus( ContractStatusEnum.SUCCESS.getCode().equals(record.getContractStatus()) ? "1" : "0");
|
||||
}
|
||||
} else{
|
||||
result = salaryContractMapper.selectVoPage(pageQuery.build(), Wrappers.<PsSalaryContract>lambdaQuery()
|
||||
.eq(PsSalaryContract::getSalaryId, id)
|
||||
|
@ -83,6 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
app1.apply_desc app_apply_desc,
|
||||
app1.approver_status app_approver_status,
|
||||
(select max(finish_date) FROM ps_task_main task where task.service_company_id = com.id and task.del_flag = 0 ) finish_date
|
||||
,bus.min_end_date
|
||||
from ps_company_info com
|
||||
left join ps_custom_info cus on com.custom_id = cus.id
|
||||
left join ps_custom_info cusi on cus.custom_introducer = cusi.id
|
||||
@ -94,6 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
-- order by apply_date limit 1
|
||||
) app on app.business_id = CAST(com.id AS CHAR)
|
||||
left join ps_approver_record app1 on app1.apply_date = app.max_apply_date and app1.business_id = app.business_id
|
||||
left join (select company_id, min(end_date) min_end_date from ps_contract_business bus GROUP BY company_id ) bus on com.id = bus.company_id
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
|
@ -64,12 +64,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
,cus.custom_name
|
||||
,cus.custom_mobile
|
||||
,com.company_name
|
||||
,com.id com_id
|
||||
,info.contact_person_name
|
||||
,info.contract_amount
|
||||
,info.start_service_date service_start_date
|
||||
,info.contract_status
|
||||
,(select start_date from ps_contract_business where ps_contract_business.contract_code = info.contract_code and start_date is not null limit 1) service_start_date
|
||||
from ps_contract_info info
|
||||
left join ps_custom_info cus on info.custom_id = cus.id
|
||||
left join ps_company_info com on info.company_id = com.id
|
||||
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user