首页
This commit is contained in:
parent
6bae31876c
commit
7c57a19800
@ -95,7 +95,7 @@ public class PsContractInfoController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 使用客户id 查询分页查询合同列表
|
* 使用客户id 查询分页查询合同列表
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("business:contractInfo:LIST")
|
@SaCheckPermission("business:contractInfo:listByCustomId")
|
||||||
@GetMapping("/queryPageListByCustomId")
|
@GetMapping("/queryPageListByCustomId")
|
||||||
public TableDataInfo<PsContractInfoVo> queryPageListByCustomId(@RequestParam Long customId, PageQuery pageQuery) {
|
public TableDataInfo<PsContractInfoVo> queryPageListByCustomId(@RequestParam Long customId, PageQuery pageQuery) {
|
||||||
return psContractInfoService.queryPageListByCustomId(customId, pageQuery);
|
return psContractInfoService.queryPageListByCustomId(customId, pageQuery);
|
||||||
|
@ -4,7 +4,9 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class UserAmountVo {
|
public class UserAmountVo {
|
||||||
@ -43,4 +45,48 @@ public class UserAmountVo {
|
|||||||
*/
|
*/
|
||||||
private Collection<UserContractAmountVo> zjsList;
|
private Collection<UserContractAmountVo> zjsList;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void cellPer(){
|
||||||
|
if (userAmountList != null && !userAmountList.isEmpty()){
|
||||||
|
UserAmountInfoVo sum = new UserAmountInfoVo();
|
||||||
|
sum.setTuoGuanAmount(new BigDecimal(0));
|
||||||
|
sum.setSumAmount(new BigDecimal(0));
|
||||||
|
sum.setXuFeiAmount(new BigDecimal(0));
|
||||||
|
sum.setSoftwareDevAmount(new BigDecimal(0));
|
||||||
|
sum.setOtherAmount(new BigDecimal(0));
|
||||||
|
for (UserAmountInfoVo userAmountInfoVo : userAmountList) {
|
||||||
|
sum.setNickName("总计");
|
||||||
|
sum.setDateStr(userAmountInfoVo.getDateStr());
|
||||||
|
sum.setTuoGuanAmount(sum.getTuoGuanAmount().add(userAmountInfoVo.getTuoGuanAmount()));
|
||||||
|
sum.setSumAmount(sum.getSumAmount().add(userAmountInfoVo.getSumAmount()));
|
||||||
|
sum.setXuFeiAmount(sum.getXuFeiAmount().add(userAmountInfoVo.getXuFeiAmount()));
|
||||||
|
sum.setSoftwareDevAmount(sum.getSoftwareDevAmount().add(userAmountInfoVo.getSoftwareDevAmount()));
|
||||||
|
sum.setOtherAmount(sum.getOtherAmount().add(userAmountInfoVo.getOtherAmount()));
|
||||||
|
sum.setAmountPer("100%");
|
||||||
|
}
|
||||||
|
userAmountList.add(sum);
|
||||||
|
}
|
||||||
|
if (zjsList != null && !zjsList.isEmpty()){
|
||||||
|
UserContractAmountVo sum = new UserContractAmountVo();
|
||||||
|
sum.setSumAmount(new BigDecimal(0));
|
||||||
|
sum.setJieShaoAmount(new BigDecimal(0));;
|
||||||
|
sum.setOtherAmount(new BigDecimal(0));;
|
||||||
|
sum.setJieShaoContractNum(0);
|
||||||
|
for (UserContractAmountVo userAmountInfoVo : zjsList) {
|
||||||
|
sum.setNickName("总计");
|
||||||
|
sum.setDateStr(userAmountInfoVo.getDateStr());
|
||||||
|
sum.setSumAmount(sum.getSumAmount().add(userAmountInfoVo.getSumAmount()));
|
||||||
|
sum.setJieShaoAmount(sum.getJieShaoAmount().add(userAmountInfoVo.getJieShaoAmount()));
|
||||||
|
sum.setOtherAmount(sum.getOtherAmount().add(userAmountInfoVo.getOtherAmount()));
|
||||||
|
sum.setJieShaoContractNum(sum.getJieShaoContractNum() + userAmountInfoVo.getJieShaoContractNum());
|
||||||
|
}
|
||||||
|
if (sum.getSumAmount().doubleValue() == 0d){
|
||||||
|
sum.setJieShaoPer("0%");
|
||||||
|
}else{
|
||||||
|
sum.setJieShaoPer(sum.getJieShaoAmount().multiply(new BigDecimal("100.0")).divide(sum.getSumAmount(), 2, RoundingMode.HALF_UP).toPlainString() + "%");
|
||||||
|
}
|
||||||
|
zjsList.add(sum);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,11 @@ public class UserContractAmountInfo {
|
|||||||
* 是否为续签合同 0:否 1:是
|
* 是否为续签合同 0:否 1:是
|
||||||
*/
|
*/
|
||||||
private String isDue;
|
private String isDue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务项id,用来去重
|
||||||
|
*/
|
||||||
|
private Long busId;
|
||||||
/**
|
/**
|
||||||
* 合同类型
|
* 合同类型
|
||||||
*/
|
*/
|
||||||
|
@ -129,6 +129,7 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
case 1://本月
|
case 1://本月
|
||||||
startDate = now.withDayOfMonth(1);
|
startDate = now.withDayOfMonth(1);
|
||||||
endDate = now.plusMonths(1).withDayOfMonth(1);
|
endDate = now.plusMonths(1).withDayOfMonth(1);
|
||||||
|
// endDate = now;
|
||||||
date = startDate.format(df);
|
date = startDate.format(df);
|
||||||
break;
|
break;
|
||||||
case 2: //上月
|
case 2: //上月
|
||||||
@ -139,11 +140,22 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
case 3: //本季度
|
case 3: //本季度
|
||||||
int month = (now.getMonthValue()-1) / 3 * 3 + 1;
|
int month = (now.getMonthValue()-1) / 3 * 3 + 1;
|
||||||
startDate = now.withMonth(month).withDayOfMonth(1);
|
startDate = now.withMonth(month).withDayOfMonth(1);
|
||||||
date =startDate.format(df) + "至今";
|
|
||||||
|
int endMonth = ((now.getMonthValue() - 1) / 3 + 1) * 3 + 1;
|
||||||
|
int addYear = 0;
|
||||||
|
if (endMonth > 12){
|
||||||
|
addYear = endMonth / 12;
|
||||||
|
endMonth = endMonth % 12;
|
||||||
|
}
|
||||||
|
endDate = now.plusYears(addYear).withMonth(endMonth).withDayOfMonth(1);
|
||||||
|
|
||||||
|
// endDate = now;
|
||||||
|
date = startDate.format(df) + "至今";
|
||||||
break;
|
break;
|
||||||
case 4: //本年
|
case 4: //本年
|
||||||
startDate = now.withMonth(1).withDayOfMonth(1);
|
startDate = now.withMonth(1).withDayOfMonth(1);
|
||||||
date =startDate.getYear()+"";
|
endDate = now.plusYears(1).withMonth(1);
|
||||||
|
date = startDate.getYear()+"";
|
||||||
break;
|
break;
|
||||||
case 5: //所有
|
case 5: //所有
|
||||||
date = "全部";
|
date = "全部";
|
||||||
@ -269,7 +281,8 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
.lt(endDate != null,"apply_date", endDate)
|
.lt(endDate != null,"apply_date", endDate)
|
||||||
.eq("con.is_due", 1)
|
.eq("con.is_due", 1)
|
||||||
.in("cc.company_id", companyIds)
|
.in("cc.company_id", companyIds)
|
||||||
.notIn("cc.contract_code", contractCodeList);
|
// .notIn("cc.contract_code", contractCodeList)
|
||||||
|
;
|
||||||
//已续费的合同
|
//已续费的合同
|
||||||
List<PsContractBusinessVo> renewalContact = psHomeMapper.selectRenewalContract(contractWrapper);
|
List<PsContractBusinessVo> renewalContact = psHomeMapper.selectRenewalContract(contractWrapper);
|
||||||
//总已续费金额
|
//总已续费金额
|
||||||
@ -299,7 +312,7 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
* @param isCaiwu
|
* @param isCaiwu
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Cacheable(cacheNames = CacheNames.HOME_E, key = "#type")
|
@Cacheable(cacheNames = CacheNames.HOME_E, key = "#type+'_' + #tabType")
|
||||||
public UserAmountVo getUserContractSourceAmountsByDeptId(Integer type, int tabType){
|
public UserAmountVo getUserContractSourceAmountsByDeptId(Integer type, int tabType){
|
||||||
Map<String, Object> mapParam = this.getDate(type);
|
Map<String, Object> mapParam = this.getDate(type);
|
||||||
LocalDate startDate = (LocalDate)mapParam.get("startDate");
|
LocalDate startDate = (LocalDate)mapParam.get("startDate");
|
||||||
@ -324,9 +337,9 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
Map<String,String> repeatContractCode = new HashMap<>();
|
Map<String,String> repeatContractCode = new HashMap<>();
|
||||||
|
|
||||||
UserContractAmountVo daPan = new UserContractAmountVo();
|
UserContractAmountVo daPan = new UserContractAmountVo();
|
||||||
|
BigDecimal all = new BigDecimal(0);
|
||||||
for(UserContractAmountInfo obj : list){
|
for(UserContractAmountInfo obj : list){
|
||||||
UserContractAmountVo vo=res.get(obj.getUserId());
|
UserContractAmountVo vo = res.get(obj.getUserId());
|
||||||
if(vo==null){
|
if(vo==null){
|
||||||
vo=new UserContractAmountVo();
|
vo=new UserContractAmountVo();
|
||||||
vo.setUserId(obj.getUserId());
|
vo.setUserId(obj.getUserId());
|
||||||
@ -334,7 +347,7 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
vo.setDateStr(date);
|
vo.setDateStr(date);
|
||||||
res.put(obj.getUserId(),vo);
|
res.put(obj.getUserId(),vo);
|
||||||
}
|
}
|
||||||
if(repeatContractCode.get(obj.getContractCode())==null){
|
if(repeatContractCode.get(obj.getContractCode()) == null){
|
||||||
repeatContractCode.put(obj.getContractCode(),obj.getContractCode());
|
repeatContractCode.put(obj.getContractCode(),obj.getContractCode());
|
||||||
vo.addSumAmount(obj.getContractAmount());
|
vo.addSumAmount(obj.getContractAmount());
|
||||||
daPan.addSumAmount(obj.getContractAmount());
|
daPan.addSumAmount(obj.getContractAmount());
|
||||||
@ -349,6 +362,7 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
daPan.addOtherAmount(obj.getContractAmount());
|
daPan.addOtherAmount(obj.getContractAmount());
|
||||||
daPan.addOtherContractNum();
|
daPan.addOtherContractNum();
|
||||||
}
|
}
|
||||||
|
all = all.add(obj.getContractAmount());
|
||||||
}
|
}
|
||||||
//判断是否为转介绍合同
|
//判断是否为转介绍合同
|
||||||
if(contractSource.equals(obj.getCustomSource())){
|
if(contractSource.equals(obj.getCustomSource())){
|
||||||
@ -386,14 +400,12 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BigDecimal sumAmount = list.stream().map(UserContractAmountInfo::getContractAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
||||||
|
|
||||||
|
|
||||||
UserAmountVo userAmountVo = new UserAmountVo();
|
UserAmountVo userAmountVo = new UserAmountVo();
|
||||||
userAmountVo.setZjsList(listData);
|
userAmountVo.setZjsList(listData);
|
||||||
userAmountVo.setDateStr(date);
|
userAmountVo.setDateStr(date);
|
||||||
userAmountVo.setAll(sumAmount);
|
userAmountVo.setAll(all);
|
||||||
userAmountVo.setDaPan(daPan);
|
userAmountVo.setDaPan(daPan);
|
||||||
|
userAmountVo.cellPer();
|
||||||
return userAmountVo;
|
return userAmountVo;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -487,7 +499,7 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
* @param type
|
* @param type
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Cacheable(cacheNames = CacheNames.HOME_F, key = "#type")
|
// @Cacheable(cacheNames = CacheNames.HOME_F, key = "#type + '_' + #tabType")
|
||||||
public UserAmountVo getUserContractAndPayInfo(Integer type, int tabType){
|
public UserAmountVo getUserContractAndPayInfo(Integer type, int tabType){
|
||||||
Map<String, Object> mapParam = this.getDate(type);
|
Map<String, Object> mapParam = this.getDate(type);
|
||||||
LocalDate startDate = (LocalDate)mapParam.get("startDate");
|
LocalDate startDate = (LocalDate)mapParam.get("startDate");
|
||||||
@ -502,19 +514,15 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
queryParam.put("payStatus", PayStatusEnum.SUCCESS.getCode());
|
queryParam.put("payStatus", PayStatusEnum.SUCCESS.getCode());
|
||||||
// LocalDateTime localDateTime2= LocalDateTime.parse("2024-11-07T14:04:00");
|
// LocalDateTime localDateTime2= LocalDateTime.parse("2024-11-07T14:04:00");
|
||||||
QueryWrapper<PsContractInfo> queryWrapper = new QueryWrapper<PsContractInfo>()
|
QueryWrapper<PsContractInfo> queryWrapper = new QueryWrapper<PsContractInfo>()
|
||||||
// .in(tabType == 1, "role.role_key", Arrays.asList(RoleEnum.caiwu.getCode(), RoleEnum.cwzg.getCode()))
|
.exists(tabType == 1,"select 1 from sys_user_role ur inner join sys_role role on role.role_id = ur.role_id where ur.user_id = u.user_id and role.role_key in ('" + RoleEnum.caiwu.getCode() + "','" + RoleEnum.cwzg.getCode() + "')")
|
||||||
// .in(tabType == 0, "role.role_key", Arrays.asList(RoleEnum.xiaoshou.getCode(), RoleEnum.xszg.getCode()) )
|
.exists(tabType == 0,"select 1 from sys_user_role ur inner join sys_role role on role.role_id = ur.role_id where ur.user_id = u.user_id and role.role_key in ('" + RoleEnum.xiaoshou.getCode() + "','" + RoleEnum.xszg.getCode() + "')")
|
||||||
.exists(tabType == 1,"select 1 from sys_user_role ur inner join sys_role role on role.role_id = ur.role_id where ur.user_id = u.user_id and role.role_key in (" + RoleEnum.caiwu.getCode() + "," + RoleEnum.cwzg.getCode() + ")")
|
|
||||||
.exists(tabType == 1,"select 1 from sys_user_role ur inner join sys_role role on role.role_id = ur.role_id where ur.user_id = u.user_id and role.role_key in (" + RoleEnum.xiaoshou.getCode() + "," + RoleEnum.xszg.getCode() + ")")
|
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
List<UserContractAmountInfo> list = psContractInfoMapper.getUserContractAndPayInfo(queryParam, queryWrapper);
|
List<UserContractAmountInfo> list = psContractInfoMapper.getUserContractAndPayInfo(queryParam, queryWrapper);
|
||||||
Map<Long, UserAmountInfoVo> resMap = new HashMap<>();
|
Map<Long, UserAmountInfoVo> resMap = new HashMap<>();
|
||||||
//记录合同编码,防止重复
|
//记录合同编码,防止重复
|
||||||
Map<String, String> repeatContractCode = new HashMap<>();
|
Map<String, String> repeatContractCode = new HashMap<>();
|
||||||
|
Set< String> repeatContractCodeBusiness = new HashSet<>();
|
||||||
for (UserContractAmountInfo obj : list) {
|
for (UserContractAmountInfo obj : list) {
|
||||||
Long userId = obj.getUserId();
|
Long userId = obj.getUserId();
|
||||||
UserAmountInfoVo vo = resMap.get(userId);
|
UserAmountInfoVo vo = resMap.get(userId);
|
||||||
@ -541,6 +549,9 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//托管合同金额累计
|
//托管合同金额累计
|
||||||
|
|
||||||
|
String contractBusiness = obj.getContractCode() + "_" + obj.getBusId();
|
||||||
|
if (!repeatContractCodeBusiness.contains(contractBusiness)){
|
||||||
if("2".equals(obj.getBusinessType())){
|
if("2".equals(obj.getBusinessType())){
|
||||||
vo.addTuoGuanAmount(obj.getBusinessAmount());
|
vo.addTuoGuanAmount(obj.getBusinessAmount());
|
||||||
} else {
|
} else {
|
||||||
@ -558,6 +569,9 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
repeatContractCodeBusiness.add(contractBusiness);
|
||||||
|
}
|
||||||
|
|
||||||
//续签合同金额累计
|
//续签合同金额累计
|
||||||
if(obj.getIsDue() != null && obj.getIsDue().equals("1")){
|
if(obj.getIsDue() != null && obj.getIsDue().equals("1")){
|
||||||
if (obj.getContractAmount() != null) {
|
if (obj.getContractAmount() != null) {
|
||||||
@ -589,6 +603,7 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
userAmountVo.setUserAmountList(new ArrayList<>(resMap.values()));
|
userAmountVo.setUserAmountList(new ArrayList<>(resMap.values()));
|
||||||
userAmountVo.setDateStr(date);
|
userAmountVo.setDateStr(date);
|
||||||
userAmountVo.setAll(sumAmount);
|
userAmountVo.setAll(sumAmount);
|
||||||
|
userAmountVo.cellPer();
|
||||||
return userAmountVo;
|
return userAmountVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -600,7 +615,7 @@ public class HomeServiceImpl implements HomeService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Cacheable(cacheNames = CacheNames.HOME_C, key = "#type+'_'+#dateType")
|
@Cacheable(cacheNames = CacheNames.HOME_C, key = "#type+'_'+#dateType")
|
||||||
public ChannelAmountVo byChannel(Integer type,Integer dateType){
|
public ChannelAmountVo byChannel(Integer type, Integer dateType){
|
||||||
Map<String, Object> mapParam = dateType == 1 ? this.getDate(type) : this.getDateByUser(type);
|
Map<String, Object> mapParam = dateType == 1 ? this.getDate(type) : this.getDateByUser(type);
|
||||||
LocalDate startDate = (LocalDate)mapParam.get("startDate");
|
LocalDate startDate = (LocalDate)mapParam.get("startDate");
|
||||||
LocalDate endDate = (LocalDate)mapParam.get("endDate");
|
LocalDate endDate = (LocalDate)mapParam.get("endDate");
|
||||||
|
@ -166,8 +166,9 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
|||||||
|
|
||||||
|
|
||||||
PsCustomInfo psCustomInfo = customInfoService.listById(bo.getCustomId());
|
PsCustomInfo psCustomInfo = customInfoService.listById(bo.getCustomId());
|
||||||
add.setCustomManager(psCustomInfo.getCustomManager());//所属销售经理id
|
// add.setCustomManager(psCustomInfo.getCustomManager());//所属销售经理id
|
||||||
|
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||||
|
add.setCustomManager(loginUser.getUserId());//谁创建的就是谁的
|
||||||
if (type == 2){
|
if (type == 2){
|
||||||
psCustomInfo.setCustomLevel("3");
|
psCustomInfo.setCustomLevel("3");
|
||||||
customInfoMapper.updateById(psCustomInfo);
|
customInfoMapper.updateById(psCustomInfo);
|
||||||
|
@ -130,6 +130,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
info.contract_code as contractCode,
|
info.contract_code as contractCode,
|
||||||
info.contract_amount as contractAmount,
|
info.contract_amount as contractAmount,
|
||||||
pay.money as payedMoney,
|
pay.money as payedMoney,
|
||||||
|
bus.id as busId,
|
||||||
bus.business_type as businessType,
|
bus.business_type as businessType,
|
||||||
bus.business_amount as businessAmount
|
bus.business_amount as businessAmount
|
||||||
FROM sys_user u
|
FROM sys_user u
|
||||||
|
Loading…
Reference in New Issue
Block a user