审批拒绝原因

This commit is contained in:
1073413548 2024-08-29 15:52:15 +08:00
parent 7cc838a335
commit 46a39df0e6
39 changed files with 457 additions and 88 deletions

View File

@ -127,7 +127,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24)));
}
/**
* 计算相差天数(只计算工作日周一到周五)
* 计算相差天数(只计算工作日周一到周五,包括两边)
*/
public static int calWorkDate(Date date1, Date date2) {
LocalDate startDate = date1.toInstant()
@ -138,7 +138,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
.toLocalDate();
int i = 0;
while (startDate.isBefore(endDate)) {
while (!startDate.isAfter(endDate)) {
if (!startDate.getDayOfWeek().equals(DayOfWeek.SATURDAY)
&& !startDate.getDayOfWeek().equals(DayOfWeek.SUNDAY)) {
i++;

View File

@ -4,6 +4,7 @@ import java.util.List;
import com.pusong.business.domain.bo.PsContractInfoQueryBo;
import com.pusong.business.domain.vo.PsContractBusinessVo;
import com.pusong.business.domain.vo.ServiceScheduleVo;
import com.pusong.business.service.IPsContractBusinessService;
import com.pusong.common.core.validate.QueryGroup;
import lombok.RequiredArgsConstructor;
@ -185,9 +186,8 @@ public class PsContractInfoController extends BaseController {
@Log(title = "免费派单")
@SaCheckPermission("business:task:list")
@GetMapping("/queryScheduleByCode")
public R<Void> queryScheduleByCode(@NotNull String contractCode) {
psContractInfoService.queryScheduleByCode(contractCode);
return R.ok();
public R<ServiceScheduleVo> queryScheduleByCode(@NotNull String contractCode) {
return R.ok(psContractInfoService.queryScheduleByCode(contractCode));
}
//
// /**

View File

@ -60,17 +60,20 @@ public class PsContractPayController extends BaseController {
}
/**
* 退款列表查询
* @param customManageName 客户经理
* @param companyName 公司名
* @param mobile 电话
* @param name 客户名
* @param payStatus 支付状态
* @param pageQuery
* @return
*/
@SaCheckPermission("business:contractPay:query")
@GetMapping("/queryRefundList")
public TableDataInfo<PsRefundVo> queryRefundList( String payStatus,PageQuery pageQuery) {
return psContractPayService.queryRefundList(pageQuery,payStatus);
public TableDataInfo<PsRefundVo> queryRefundList(String customManageName,String companyName,String mobile,String name, String payStatus,PageQuery pageQuery) {
return psContractPayService.queryRefundList(customManageName,companyName,mobile,name,pageQuery,payStatus);
}
/**
* 完成退款

View File

@ -4,6 +4,7 @@ import java.util.List;
import com.pusong.business.domain.bo.PsCustomCallbackBo;
import com.pusong.business.domain.bo.PsCustomPriceBo;
import com.pusong.business.domain.bo.PsCustomRecordQueryBo;
import com.pusong.business.domain.vo.PsCustomerRecordVo;
import lombok.RequiredArgsConstructor;
import jakarta.servlet.http.HttpServletResponse;
@ -116,18 +117,15 @@ public class PsCustomController extends BaseController {
/**
* 客户档案
* @param type 类型 1客户档案 2已完成客户
* @param name 客户名
* @param mobile 客户电话
* @param companyName 公司名
* @param queryBo 查询
* @return
*/
@RepeatSubmit()
@SaCheckPermission("business:customInfo:record")
@Log(title = "客户档案" )
@GetMapping("/record")
public TableDataInfo<PsCustomerRecordVo> record(@RequestParam(required = false) Long id,Integer type, String name, String mobile, String companyName, PageQuery pageQuery) {
return psCustomInfoService.getCustomerRecordList(id,type,name,mobile,companyName,pageQuery);
public TableDataInfo<PsCustomerRecordVo> record(PsCustomRecordQueryBo queryBo, PageQuery pageQuery) {
return psCustomInfoService.getCustomerRecordList(queryBo,pageQuery);
}

View File

@ -27,7 +27,7 @@ public class PsApproverRecord extends TenantEntity {
/**
* 主键id
*/
@TableId(value = "id")
@TableId(value = "id",type = IdType.AUTO)
private Long id;
/**

View File

@ -26,7 +26,7 @@ public class PsCompanyInfo extends TenantEntity {
/**
* 公司ID
*/
@TableId(value = "id")
@TableId(value = "id",type = IdType.AUTO)
private Long id;
/**
* 客户id

View File

@ -26,7 +26,7 @@ public class PsContractBusiness extends TenantEntity {
/**
* 主键id
*/
@TableId(value = "id")
@TableId(value = "id",type = IdType.AUTO)
private Long id;
/**

View File

@ -25,7 +25,7 @@ public class PsContractBusinessDetail extends TenantEntity {
/**
* 主键id
*/
@TableId(value = "id")
@TableId(value = "id",type = IdType.AUTO)
private Long id;
/**

View File

@ -28,7 +28,7 @@ public class PsContractInfo extends TenantEntity {
/**
* 合同id
*/
@TableId(value = "id")
@TableId(value = "id",type = IdType.AUTO)
private Long id;
/**

View File

@ -27,7 +27,7 @@ public class PsContractPay extends TenantEntity {
/**
* 主键id
*/
@TableId(value = "id")
@TableId(value = "id",type = IdType.AUTO)
private Long id;
/**

View File

@ -26,7 +26,7 @@ public class PsSalary extends TenantEntity {
/**
* 主键id
*/
@TableId(value = "id")
@TableId(value = "id",type = IdType.AUTO)
private Long id;
/**

View File

@ -25,7 +25,7 @@ public class PsSalaryConfig extends TenantEntity {
/**
* 主键id
*/
@TableId(value = "id")
@TableId(value = "id",type = IdType.AUTO)
private Long id;
/**

View File

@ -24,7 +24,7 @@ public class PsTaskAppoint extends TenantEntity {
/**
* 主键id
*/
@TableId(value = "id")
@TableId(value = "id",type = IdType.AUTO)
private Long id;
/**

View File

@ -26,7 +26,7 @@ public class PsTaskMain extends TenantEntity {
/**
* 主键id
*/
@TableId(value = "id")
@TableId(value = "id",type = IdType.AUTO)
private Long id;
/**
* 公司id

View File

@ -24,7 +24,7 @@ public class PsTaskMedia extends TenantEntity {
/**
* 主键id
*/
@TableId(value = "id")
@TableId(value = "id",type = IdType.AUTO)
private Long id;
/**

View File

@ -26,7 +26,7 @@ public class PsTaskWorkRecord extends TenantEntity {
/**
* 主键id
*/
@TableId(value = "id")
@TableId(value = "id",type = IdType.AUTO)
private Long id;
/**

View File

@ -79,4 +79,17 @@ public class PsApproverRecordBo {
@NotBlank(message = "修改前数据")
private String updateData;
/**
* 客户姓名
*/
private String customerName;
/**
* 公司姓名
*/
private String companyName;
/**
* 销售经理姓名
*/
private String customerManageName;
}

View File

@ -11,6 +11,7 @@ import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@ -64,8 +65,23 @@ public class PsContractInfoQueryBo {
* 合同状态(not in)
*/
private List<String> notInContractStatus;
/**
* 合同金额最小值
*/
private BigDecimal moneyStart;
/**
* 合同金额最大值
*/
private BigDecimal moneyEnd;
/**
* 服务类型1托管 2非托管
*/
private Integer serviceType;
/**
* 服务项目
*/
private List<String> serviceProjects;
}

View File

@ -71,6 +71,10 @@ public class PsCustomInfoBo {
*/
@NotNull(message = "公司名称")
private String companyName;
/**
* 介绍人-仅支持本司内客户
*/
private Long customIntroducer;
/**
* 介绍人-仅支持本司内客户
*/
@ -81,6 +85,10 @@ public class PsCustomInfoBo {
* 颜色
*/
private String color;
/**
* 是否已生成合同1是0否
*/
private Integer haveContract;
/**
* 客户状态包含
*/

View File

@ -0,0 +1,65 @@
package com.pusong.business.domain.bo;
import com.pusong.business.domain.PsCustomInfo;
import com.pusong.common.core.validate.AddGroup;
import com.pusong.common.core.validate.EditGroup;
import com.pusong.common.core.validate.QueryGroup;
import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import java.util.List;
/**
* 客户基本信息业务对象 ps_custom_info
*
* @author Lion Li
* @date 2024-07-25
*/
@Data
@EqualsAndHashCode
@AutoMapper(target = PsCustomInfo.class)
public class PsCustomRecordQueryBo {
private Long id;
/**
* 类型 1客户档案 2已完成客户
*/
@NotNull(message = "类型不能为空", groups = { QueryGroup.class })
private Integer type;
/**
* 客户名称
*/
private String name;
/**
* 客户电话客户电话(多个用英文逗号分割)
*/
private String mobile;
/**
* 公司名称
*/
private String companyName;
/**
* 法人名称
*/
private String legalPersonName;
/**
* 账套号
*/
private String financeAccountNo;
/**
* 1 托管 2 非托管
*/
private Integer serviceType;
/**
* 服务项目(可多选)
*/
private List<String> serviceProjects;
}

View File

@ -74,6 +74,10 @@ public class PsContractInfoVo implements Serializable {
* 合同状态
*/
private String contractStatus;
/**
* 合同状态审批失败描述
*/
private String contractStatusDesc;
/**
* 合同状态名
*/
@ -151,6 +155,10 @@ public class PsContractInfoVo implements Serializable {
*/
@Translation(type = TransConstant.DICT_TYPE_TO_LABEL,other = "contract_type")
private String businessTypeName;
/**
* 合同回传状态失败原因
*/
private String rollBackFailDesc;
/**
* 合同回传状态0未回传1已回传
*/
@ -164,6 +172,10 @@ public class PsContractInfoVo implements Serializable {
* 合同签章状态CommonStatusEnum
*/
private String signStatus;
/**
* 合同签章失败原因
*/
private String signFailDesc;
/**
* 是否老账新接
*/
@ -213,5 +225,8 @@ public class PsContractInfoVo implements Serializable {
* 确认单
*/
private Long confirmOssid;
/**
* 原合同编码续费合同使用
*/
private String srcContractCode;
}

View File

@ -94,10 +94,18 @@ public class PsContractPayVo implements Serializable {
* 支付状态 PayStatusEnum
*/
private String payStatus;
/**
* 支付状态 审批失败描述
*/
private String payStatusDesc;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date createTime;
/**
* 创建者
*/
private Long createBy;
}

View File

@ -165,6 +165,10 @@ public class PsCustomInfoVo implements Serializable {
*/
private int numOfDat;
/**
* 公海认领审批失败描述
*/
private String publicDesc;
/**
* 报价金额DTO
*/

View File

@ -151,4 +151,8 @@ public class PsCustomerRecordVo implements Serializable {
* 介绍人
*/
private String customIntroducer;
/**
* 免费工单审批失败描述
*/
private String freeFailDesc;
}

View File

@ -71,6 +71,10 @@ public class PsTaskMainVo implements Serializable {
* 主任务状态
*/
private String taskStatus;
/**
* 主任务状态
*/
private String taskStatusDesc;
/**
* 子任务状态
*/

View File

@ -0,0 +1,76 @@
package com.pusong.business.domain.vo;
import com.pusong.common.translation.annotation.Translation;
import com.pusong.common.translation.constant.TransConstant;
import lombok.Data;
@Data
public class ServiceScheduleVo {
/**
* 被分配者
*/
@Translation(type = TransConstant.USER_ID_TO_NICKNAME)
private Long allot;
/**
* 生成合同
*/
@Translation(type = TransConstant.USER_ID_TO_NICKNAME)
private Long createContract;
/**
* 第一笔回款
*/
@Translation(type = TransConstant.USER_ID_TO_NICKNAME)
private Long firstPay;
/**
* 派单者
*/
@Translation(type = TransConstant.USER_ID_TO_NICKNAME)
private Long appoint;
/**
* 内勤
*/
@Translation(type = TransConstant.USER_ID_TO_NICKNAME)
private Long in;
/**
* 内勤是否已完成1是0否
*/
private Integer inStatus;
/**
* 外勤
*/
@Translation(type = TransConstant.USER_ID_TO_NICKNAME)
private Long out;
/**
* 外勤是否已完成1是0否
*/
private Integer outStatus;
/**
* 特勤
*/
@Translation(type = TransConstant.USER_ID_TO_NICKNAME)
private Long secret;
/**
* 特勤是否已完成1是0否
*/
private Integer secretStatus;
/**
* 回传
*/
@Translation(type = TransConstant.USER_ID_TO_NICKNAME)
private Long rollBack;
/**
* 最后一笔回款收款者
*/
@Translation(type = TransConstant.USER_ID_TO_NICKNAME)
private Long payee;
/**
* 最后一笔回款审批者
*/
@Translation(type = TransConstant.USER_ID_TO_NICKNAME)
private Long approve;
/**
* 是否已完成1是 0否
*/
private Integer isFinish;
}

View File

@ -49,6 +49,12 @@ public interface IPsApproverRecordService {
* @return
*/
String approver(String operate, Long id,String desc);
/**
* 根据条件查询最后一条审批失败的原因
* @return
*/
String getLastFail(String businessId,String contractCode,List<String> businessTypes);
//
// /**
// * 新增审批记录

View File

@ -4,6 +4,7 @@ import com.pusong.business.domain.PsContractInfo;
import com.pusong.business.domain.bo.PsContractInfoQueryBo;
import com.pusong.business.domain.vo.PsContractInfoVo;
import com.pusong.business.domain.bo.PsContractInfoBo;
import com.pusong.business.domain.vo.ServiceScheduleVo;
import com.pusong.business.enums.ContractStatusEnum;
import com.pusong.common.mybatis.core.page.TableDataInfo;
import com.pusong.common.mybatis.core.page.PageQuery;
@ -43,7 +44,7 @@ public interface IPsContractInfoService {
*/
PsContractInfoVo queryInfoByCustomId(Long customerId);
List<PsContractInfo> queryByCode(Long customId, String code, ContractStatusEnum enu);
List<PsContractInfo> queryByCode(Long customId, String code, String status);
/**
* 分页查询合同基本信息列表
*
@ -122,7 +123,7 @@ public interface IPsContractInfoService {
* 根据合同编码查询服务进度
* @param contractCode 合同编码
*/
void queryScheduleByCode(String contractCode);
ServiceScheduleVo queryScheduleByCode(String contractCode);
/**
* 查询符合条件的合同基本信息列表
*

View File

@ -75,7 +75,7 @@ public interface IPsContractPayService {
*
* @return 合同回款记录列表
*/
TableDataInfo<PsRefundVo> queryRefundList(PageQuery pageQuery,String payStatus);
TableDataInfo<PsRefundVo> queryRefundList(String customManageName,String companyName,String mobile,String name, PageQuery pageQuery,String payStatus);
/**
* 完成退款

View File

@ -4,6 +4,7 @@ import com.pusong.business.domain.PsCustomCallback;
import com.pusong.business.domain.PsCustomInfo;
import com.pusong.business.domain.bo.PsCustomCallbackBo;
import com.pusong.business.domain.bo.PsCustomPriceBo;
import com.pusong.business.domain.bo.PsCustomRecordQueryBo;
import com.pusong.business.domain.vo.PsCustomInfoVo;
import com.pusong.business.domain.bo.PsCustomInfoBo;
import com.pusong.business.domain.vo.PsCustomerRecordVo;
@ -92,12 +93,10 @@ public interface IPsCustomInfoService {
/**
* 客户档案查询列表
* @param name
* @param mobile
* @param companyName
* @param queryBo
* @return
*/
TableDataInfo<PsCustomerRecordVo> getCustomerRecordList(Long id,Integer type,String name, String mobile, String companyName, PageQuery pageQuery);
TableDataInfo<PsCustomerRecordVo> getCustomerRecordList(PsCustomRecordQueryBo queryBo, PageQuery pageQuery);
/**
* 移除黑名单

View File

@ -58,7 +58,7 @@ public interface IPsTaskService {
*/
PsTaskMainVo queryInfo(String id);
/**
* 根据合同编码查询任务
* 根据合同编码查询合同主任务
*
* @param contractCode 合同编码
* @return

View File

@ -51,9 +51,11 @@ public abstract class ApproverAbstractServiceImpl implements ApproverService {
* @param updateData
*/
public void apply(String bussinessId,String contractCode, String desc, String updateData){
//退款审批时用 合同编号进行查询校验
//退款,回款审批时用 合同编号进行查询校验
List<PsApproverRecord> list = approverRecordMapper.selectList(Wrappers.<PsApproverRecord>lambdaQuery().eq(PsApproverRecord::getDelFlag, "0")
.eq(PsApproverRecord::getBusinessId, StringUtils.equals(approverType(),ApproverTypeEnum.RETURN.getCode())?contractCode:bussinessId)
.eq(PsApproverRecord::getBusinessId,
StringUtils.equals(approverType(),ApproverTypeEnum.RETURN.getCode()) || StringUtils.equals(approverType(),ApproverTypeEnum.PAY.getCode())
?contractCode:bussinessId)
.eq(PsApproverRecord::getBusinessType,approverType())
.eq(PsApproverRecord::getApproverStatus, ApproverStatusEnum.INIT.getCode()));
if(CollectionUtils.isNotEmpty(list)){
@ -86,6 +88,11 @@ public abstract class ApproverAbstractServiceImpl implements ApproverService {
QueryWrapper<PsApproverRecord> lqw = Wrappers.<PsApproverRecord>query().eq("app.business_type",approverType())
.eq(bo.getId()!=null,"app.id",bo.getId())
.eq("app.del_flag","0")
.eq(StringUtils.isNotBlank(bo.getApproverStatus()),"app.approver_status",bo.getApproverStatus())
.eq(StringUtils.isNotBlank(bo.getCustomerName()),"cus.custom_name",bo.getCustomerName())
.eq(StringUtils.isNotBlank(bo.getCompanyName()),"com.company_name",bo.getCompanyName())
//销售经理姓名
.exists(StringUtils.isNotBlank(bo.getCustomerManageName()),"select 1 from sys_user su where su.user_id = cus.custom_manager and su.nick_name like %"+bo.getCustomerManageName()+"%")
.orderByAsc("app.approver_status").orderByAsc("app.approver_date");
Page<PsApproverRecordVo> res = recordMapper.selectPageApproverList(pageQuery.build(), lqw);
if(CollectionUtils.isNotEmpty(res.getRecords())){
@ -94,7 +101,7 @@ public abstract class ApproverAbstractServiceImpl implements ApproverService {
//装填回款周期
List<PsContractPayVo> payList = queryListByContractCode(item.getBusinessId(),"1", PayStatusEnum.SUCCESS);
if(CollectionUtils.isNotEmpty(payList)){
item.setPeriod(DateUtils.calWorkDate(payList.get(0).getPayDate(),payList.get(payList.size()-1).getPayDate()) + 1);
item.setPeriod(DateUtils.calWorkDate(payList.get(0).getPayDate(),payList.get(payList.size()-1).getPayDate()));
}
});
}

View File

@ -1,5 +1,6 @@
package com.pusong.business.service.impl;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.pusong.business.enums.ApproverStatusEnum;
import com.pusong.business.enums.ApproverTypeEnum;
import com.pusong.business.enums.TaskStatusEnum;
@ -22,10 +23,7 @@ import com.pusong.business.mapper.PsApproverRecordMapper;
import com.pusong.business.service.IPsApproverRecordService;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.util.*;
/**
* 审批记录Service业务层处理
@ -121,6 +119,20 @@ public class PsApproverRecordServiceImpl implements IPsApproverRecordService {
}
return null;
}
/**
* 根据条件查询最后一条审批失败的原因
* @return
*/
public String getLastFail(String businessId,String contractCode,List<String> businessTypes){
PsApproverRecord record = baseMapper.selectOne(Wrappers.<PsApproverRecord>lambdaQuery()
.eq(StringUtils.isNotBlank(businessId), PsApproverRecord::getBusinessId, businessId)
.eq(StringUtils.isNotBlank(contractCode), PsApproverRecord::getContractCode, contractCode)
.in(CollectionUtils.isNotEmpty(businessTypes), PsApproverRecord::getBusinessType, businessTypes)
.orderByDesc(PsApproverRecord::getApplyDate));
return record!=null&&StringUtils.equals(ApproverStatusEnum.FAIL.getCode(),record.getApproverStatus())
?record.getApproverDesc():null;
}
// /**
// * 新增审批记录
// *

View File

@ -7,7 +7,9 @@ import com.pusong.business.domain.*;
import com.pusong.business.domain.bo.*;
import com.pusong.business.domain.vo.*;
import com.pusong.business.enums.*;
import com.pusong.business.enums.TaskStatusEnum.*;
import com.pusong.business.mapper.PsContractBusinessMapper;
import com.pusong.business.mapper.PsTaskAppointMapper;
import com.pusong.business.mapper.PsTaskMainMapper;
import com.pusong.business.service.*;
import com.pusong.business.service.approver.ApproverContainer;
@ -73,8 +75,11 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
private final IPsTaskService taskMainService;
private final PsTaskMainMapper taskMainMapper;
private final PsTaskAppointMapper taskAppointMapper;
private final ISysDictDataService dictDataService;
private final IPsApproverRecordService approverRecordService;
public static String getContractCode(){
Random random = new Random();
int randomNumber = random.nextInt(8999) + 1000;
@ -191,14 +196,14 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
* @param code 合同编码
* @return 合同基本信息
*/
public List<PsContractInfo> queryByCode(Long customId,String code,ContractStatusEnum enu){
public List<PsContractInfo> queryByCode(Long customId,String code,String status){
if(customId == null && StringUtils.isBlank(code)){
return null;
}
return baseMapper.selectList(Wrappers.<PsContractInfo>lambdaQuery().eq(PsContractInfo::getDelFlag,"0")
.eq(StringUtils.isNotBlank(code),PsContractInfo::getContractCode,code)
.eq(customId != null,PsContractInfo::getCustomId,customId)
.eq(enu != null ,PsContractInfo::getContractStatus,enu.getCode()));
.eq(StringUtils.isNotBlank(status) ,PsContractInfo::getContractStatus,status));
}
@ -481,8 +486,70 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
* 根据合同编码查询服务进度
* @param contractCode 合同编码
*/
public void queryScheduleByCode(String contractCode){
public ServiceScheduleVo queryScheduleByCode(String contractCode){
PsContractInfo contractInfo = this.queryByCode(null, contractCode, null).get(0);
PsCustomInfo customer = customInfoService.listById(contractInfo.getCustomId());
ServiceScheduleVo serviceScheduleVo = new ServiceScheduleVo();
//分配
serviceScheduleVo.setAllot(customer.getCustomManager());
//生成合同
serviceScheduleVo.setCreateContract(customer.getCustomManager());
//支付金额
PsContractInfoVo vo = new PsContractInfoVo();
vo.setContractCode(contractCode);
this.fillMoney(vo);
List<PsContractPayVo> payVoList = vo.getContractPayVoList().stream()
.filter(item -> StringUtils.equals("1", item.getBusinessType())).toList();
//第一笔回款
serviceScheduleVo.setFirstPay(CollectionUtils.isNotEmpty(payVoList)?payVoList.get(0).getCreateBy():null);
PsTaskMain task = taskMainService.queryByContractCode(contractCode);
List<PsTaskAppoint> appointList = new ArrayList<>();
if(task!=null){
appointList = taskAppointMapper.selectList(Wrappers.<PsTaskAppoint>lambdaQuery()
.eq(PsTaskAppoint::getContractCode, contractCode)
.eq(PsTaskAppoint::getTaskId, task.getId()));
}
//派单者
serviceScheduleVo.setAppoint(task == null?null:task.getOperateUser());
if(CollectionUtils.isNotEmpty(appointList)){
appointList.forEach(item->{
if(StringUtils.equals("1",item.getAppointType())){
//内勤
serviceScheduleVo.setIn(item.getExecutor());
//内勤
serviceScheduleVo.setInStatus(StringUtils.equals(AppointStatusEnum.FINISH.getCode(),item.getAppointStatus())?1:0);
}else if(StringUtils.equals("2",item.getAppointType())){
//外勤
serviceScheduleVo.setOut(item.getExecutor());
//外勤
serviceScheduleVo.setOutStatus(StringUtils.equals(AppointStatusEnum.FINISH.getCode(),item.getAppointStatus())?1:0);
}else{
//特勤
serviceScheduleVo.setSecret(item.getExecutor());
//特勤
serviceScheduleVo.setSecretStatus(StringUtils.equals(AppointStatusEnum.FINISH.getCode(),item.getAppointStatus())?1:0);
}
});
}
//回传
serviceScheduleVo.setRollBack(StringUtils.equals(CommonStatusEnum.Y.getCode(),contractInfo.getRollBackStatus())?customer.getCustomManager():null);
if(vo.getResidualMoney().compareTo(BigDecimal.ZERO) <=0 && CollectionUtils.isNotEmpty(payVoList)){
PsContractPayVo pay = payVoList.get(payVoList.size() - 1);
//最后一笔回款收款者
serviceScheduleVo.setPayee(pay.getCreateBy());
PsApproverRecordBo bo = new PsApproverRecordBo();
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);
}
//是否已完成1是 0否
serviceScheduleVo.setIsFinish(StringUtils.equals(ContractStatusEnum.SUCCESS.getCode(),contractInfo.getContractStatus())?1:0);
return serviceScheduleVo;
}
private QueryWrapper<PsContractInfo> buildQueryWrapper(PsContractInfoQueryBo bo) {
QueryWrapper<PsContractInfo> qw = Wrappers.query();
@ -511,8 +578,18 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
//托管续费合同(写死托管服务的id是2)
if(bo.getType() != null && bo.getType() == 4){
qw.exists("select 1 from ps_contract_business bus where info.contract_code = bus.contract_code and bus.business_type = 2");
}else{
//托管类服务类型编码集合
qw.exists(bo.getServiceType() !=null && bo.getServiceType() == 1, "select 1 from ps_contract_business bus " +
"where bus.contract_code = info.contract_code and bus.business_type = 2");
//非托管服务类型编码集合
qw.exists(bo.getServiceType() !=null && bo.getServiceType() == 2, "select 1 from ps_contract_business bus " +
"where bus.contract_code = info.contract_code and bus.business_type != 2");
}
//服务项目编码集合
qw.exists(CollectionUtils.isNotEmpty(bo.getServiceProjects()), "select 1 from ps_contract_business_detail detail " +
"where detail.contract_code = info.contract_code and detail.business_project in ("+StringUtils.join(bo.getServiceProjects(),",")+")");//服务项目编码集合
qw.between(bo.getMoneyEnd() != null && bo.getMoneyStart() !=null,"info.contract_amount",bo.getMoneyStart(),bo.getMoneyEnd());
qw.orderByDesc("info.create_time");
return qw;
@ -522,6 +599,34 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
List<PsContractBusinessVo> list = businessService.selectBusinessList(List.of(vo.getContractCode()));
vo.setBusinessTypeName(StringUtils.join(list.stream().map(PsContractBusinessVo::getBusinessType).collect(Collectors.toList()), ","));
vo.setBusinessVoList(list);
fillMoney(vo);
if(vo.getFirstApplyDate() != null){
Date date = new Date();
Date startDate = vo.getFirstApplyDate();
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(StringUtils.equals(CommonStatusEnum.FAIL.getCode(),vo.getSignStatus())){
vo.setSignFailDesc(approverRecordService.getLastFail(vo.getContractCode(),vo.getContractCode(),List.of(ApproverTypeEnum.SIGN.getCode())));
}
//回传合同审批
if(StringUtils.equals(CommonStatusEnum.FAIL.getCode(),vo.getRollBackStatus())){
vo.setRollBackFailDesc(approverRecordService.getLastFail(vo.getContractCode(),vo.getContractCode(),List.of(ApproverTypeEnum.SIGN.getCode())));
}
//合同作废审批
if(StringUtils.equals(CommonStatusEnum.FAIL.getCode(),vo.getIsCancel())){
vo.setContractStatusDesc(approverRecordService.getLastFail(vo.getContractCode(),vo.getContractCode(),List.of(ApproverTypeEnum.CANCELLA.getCode())));
}
//合同作废审批
if(StringUtils.equals(CommonStatusEnum.FAIL.getCode(),vo.getIsCancel())){
vo.setContractStatusDesc(approverRecordService.getLastFail(vo.getContractCode(),vo.getContractCode(),List.of(ApproverTypeEnum.CANCELLA.getCode())));
}
return vo;
}
private void fillMoney(PsContractInfoVo vo){
//装填回款记录
List<PsContractPayVo> payList = contractPayService.queryListByContractCode(vo.getContractCode(),null,PayStatusEnum.SUCCESS);
vo.setContractPayVoList(payList);
@ -543,19 +648,8 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
vo.setPeriod(1);
}else{
//包含最后一天
vo.setPeriod(DateUtils.calWorkDate(payList.get(0).getPayDate(),payList.get(payList.size()-1).getPayDate()) + 1);
vo.setPeriod(DateUtils.calWorkDate(payList.get(0).getPayDate(),payList.get(payList.size()-1).getPayDate()));
}
if(vo.getFirstApplyDate() != null){
Date date = new Date();
Date startDate = vo.getFirstApplyDate();
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+"":"") );
}
//todo 签章未通过时查询未通过的原因
return vo;
}
/**
* 数据校验并返回
@ -566,7 +660,7 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
PsContractInfo add =null;
//插入或修改合同
log.info("校验合同查询入参:{}",bo.getCustomId());
List<PsContractInfo> infos = this.queryByCode(bo.getCustomId(),null,ContractStatusEnum.INIT);//todo 状态查询
List<PsContractInfo> infos = this.queryByCode(bo.getCustomId(),null,ContractStatusEnum.INIT.getCode());//todo 状态查询
log.info("校验合同查询结果:{}",infos == null?null: infos.size() );
//校验暂存的合同不止一个暂存的合同并且不是传入的合同-报错暂存的合同只能有一个
if (CollectionUtils.isNotEmpty(infos) ) {

View File

@ -6,6 +6,7 @@ import com.pusong.business.domain.vo.PsRefundVo;
import com.pusong.business.enums.ApproverTypeEnum;
import com.pusong.business.enums.PayBuinessStatusEnum;
import com.pusong.business.enums.PayStatusEnum;
import com.pusong.business.service.IPsApproverRecordService;
import com.pusong.business.service.approver.ApproverContainer;
import com.pusong.business.service.approver.ApproverService;
import com.pusong.common.core.exception.ServiceException;
@ -46,6 +47,7 @@ public class PsContractPayServiceImpl implements IPsContractPayService {
private final ISysOssService ossService;
@Resource
private final ApproverContainer container;
private final IPsApproverRecordService approverRecordService;
/**
* 查询合同回款记录列表
*
@ -75,7 +77,15 @@ public class PsContractPayServiceImpl implements IPsContractPayService {
List<PsContractPayVo> list = baseMapper.selectVoList(Wrappers.<PsContractPay>lambdaQuery().
eq(PsContractPay::getContractCode, contractCode).eq(PsContractPay::getDelFlag,0)
.orderByAsc(PsContractPay::getPayDate));
return list == null?new ArrayList<>():list;
list = list == null?new ArrayList<>():list;
list.forEach(item->{
if(StringUtils.equals("2",item.getBusinessType()) && StringUtils.equals(PayStatusEnum.PAYAPPO.getCode(),item.getPayStatus())){
item.setPayStatusDesc(approverRecordService.getLastFail(item.getId()+"",null,List.of(ApproverTypeEnum.RETURN.getCode())));
}else if(StringUtils.equals("1",item.getBusinessType()) && StringUtils.equals(PayStatusEnum.PAYING.getCode(),item.getPayStatus())){
item.setPayStatusDesc(approverRecordService.getLastFail(item.getId()+"",null,List.of(ApproverTypeEnum.PAY.getCode())));
}
});
return list;
}
/**
@ -158,9 +168,13 @@ public class PsContractPayServiceImpl implements IPsContractPayService {
* @return 合同回款记录列表
*/
@Override
public TableDataInfo<PsRefundVo> queryRefundList(PageQuery pageQuery,String payStatus){
public TableDataInfo<PsRefundVo> queryRefundList(String customManageName,String companyName,String mobile,String name,PageQuery pageQuery,String payStatus){
QueryWrapper<PsContractPay> qw = new QueryWrapper<PsContractPay>().in("pay.pay_status", List.of(PayStatusEnum.PAYING.getCode(),PayStatusEnum.SUCCESS.getCode()))
.eq(StringUtils.isNotBlank(payStatus), "pay.pay_status", payStatus);
.eq(StringUtils.isNotBlank(payStatus), "pay.pay_status", payStatus)
.exists(StringUtils.isNotBlank(customManageName),"select 1 from sys_user su where su.user_id = cus.custom_manager and su.nick_name like %"+customManageName+"%")
.like(StringUtils.isNotBlank(companyName),"com.company_name",companyName)
.like(StringUtils.isNotBlank(mobile),"cus.custom_mobile",mobile)
.eq(StringUtils.isNotBlank(name),"cus.custom_name",name);
Page<PsRefundVo> list = baseMapper.queryRefundList(pageQuery.build(), qw);
list.getRecords().forEach(info->{
List<PsContractPayVo> payList = queryListByContractCode(info.getContractCode(),null,PayStatusEnum.SUCCESS);

View File

@ -16,6 +16,7 @@ import com.pusong.business.enums.CommonStatusEnum;
import com.pusong.business.enums.ContractStatusEnum;
import com.pusong.business.enums.CustomerStatusEnum;
import com.pusong.business.mapper.*;
import com.pusong.business.service.IPsApproverRecordService;
import com.pusong.business.service.IPsCompanyInfoService;
import com.pusong.business.service.approver.ApproverContainer;
import com.pusong.business.service.approver.ApproverService;
@ -59,6 +60,7 @@ public class PsCustomInfoServiceImpl implements IPsCustomInfoService {
private final IPsCompanyInfoService companyInfoService;
private final ApproverContainer approverContainer;
private final IPsApproverRecordService approverRecordService;
/**
* 根据id查询客户
@ -179,6 +181,10 @@ public class PsCustomInfoServiceImpl implements IPsCustomInfoService {
}
//任务进行天数
info.setNumOfDat(info.getStartDate() == null?0:DateUtils.calWorkDate(info.getStartDate(),new Date()));
//公海审批失败
if(bo.getType() == 3 && StringUtils.equals(CommonStatusEnum.FAIL.getCode(),info.getCustomStatus())){
info.setPublicDesc(approverRecordService.getLastFail(info.getId()+"",null,List.of(ApproverTypeEnum.PUBLIC.getCode())));
}
}
return TableDataInfo.build(result);
}
@ -213,6 +219,7 @@ public class PsCustomInfoServiceImpl implements IPsCustomInfoService {
qw.eq(StringUtils.isNotBlank(bo.getCustomIntroducerName()), "psinfo.custom_introducer", bo.getCustomIntroducerName());//介绍人姓名
//公司名称
qw.exists(StringUtils.isNotBlank(bo.getCompanyName()), "select 1 from ps_company_info com where info.id = com.custom_id and com.company_name like '%"+bo.getCompanyName()+"%'");
qw.exists(bo.getHaveContract() != null && bo.getHaveContract() == 1,"SELECT 1 FROM ps_contract_info psci WHERE psci.custom_id = info.id and psci.contract_status != '10' and psci.is_cancel != '03')");
qw.orderByDesc("info.create_time");//创建时间排序
return qw;
}
@ -348,24 +355,37 @@ public class PsCustomInfoServiceImpl implements IPsCustomInfoService {
/**
* 客户档案查询列表
* @param type 类型 1客户档案 2已完成客户
* @param name
* @param mobile
* @param companyName
* @param queryBo
* @return
*/
public TableDataInfo<PsCustomerRecordVo> getCustomerRecordList(Long id,Integer type,String name, String mobile,
String companyName, PageQuery pageQuery){
public TableDataInfo<PsCustomerRecordVo> getCustomerRecordList(PsCustomRecordQueryBo queryBo, PageQuery pageQuery){
QueryWrapper<PsCustomInfo> qw = Wrappers.query();
qw.like(StringUtils.isNotBlank(companyName), "com.company_name", companyName);
qw.eq(id != null,"custom.id",id);
qw.like(StringUtils.isNotBlank(name), "custom.custom_name", name);
qw.like(StringUtils.isNotBlank(mobile), "custom.custom_mobile", mobile);
qw.like(StringUtils.isNotBlank(queryBo.getCompanyName()), "com.company_name", queryBo.getCompanyName());
qw.eq(queryBo.getId() != null,"custom.id",queryBo.getId());
qw.like(StringUtils.isNotBlank(queryBo.getName()), "custom.custom_name", queryBo.getName());
qw.like(StringUtils.isNotBlank(queryBo.getMobile()), "custom.custom_mobile", queryBo.getMobile());
qw.notIn("con.contract_status", ContractStatusEnum.isValid());
if(type !=null && type == 2){
if(queryBo.getType() !=null && queryBo.getType() == 2){
qw.eq("con.contract_status", ContractStatusEnum.SUCCESS.getCode());
}else if (queryBo.getType() !=null && queryBo.getType() == 1) {
//托管类服务类型编码集合
qw.exists(queryBo.getServiceType() !=null && queryBo.getServiceType() == 1, "select 1 from ps_contract_business bus " +
"where bus.contract_code = con.contract_code and bus.business_type = 2");
//非托管服务类型编码集合
qw.exists(queryBo.getServiceType() !=null && queryBo.getServiceType() == 2, "select 1 from ps_contract_business bus " +
"where bus.contract_code = con.contract_code and bus.business_type != 2");
//服务项目编码集合
qw.exists(CollectionUtils.isNotEmpty(queryBo.getServiceProjects()), "select 1 from ps_contract_business_detail detail " +
"where detail.contract_code = con.contract_code and detail.business_project in ("+StringUtils.join(queryBo.getServiceProjects(),",")+")");//服务项目编码集合
}
Page<PsCustomerRecordVo> list = baseMapper.selectPageCustomerRecordList(pageQuery.build(), qw);
if(CollectionUtils.isEmpty(list.getRecords())){
return TableDataInfo.build(list);
}
//免费工单审批
list.getRecords().forEach(item->{
item.setFreeFailDesc(approverRecordService.getLastFail(item.getId()+"",null,List.of(ApproverTypeEnum.PAY.getCode())));
});
return TableDataInfo.build(list);
}

View File

@ -21,9 +21,7 @@ import com.pusong.business.enums.TaskTypeEnum;
import com.pusong.business.mapper.PsContractBusinessMapper;
import com.pusong.business.mapper.PsContractInfoMapper;
import com.pusong.business.mapper.PsTaskAppointMapper;
import com.pusong.business.service.IPsCompanyInfoService;
import com.pusong.business.service.IPsContractInfoService;
import com.pusong.business.service.IPsTaskMediaService;
import com.pusong.business.service.*;
import com.pusong.business.service.approver.ApproverContainer;
import com.pusong.business.service.approver.ApproverService;
import com.pusong.common.core.exception.ServiceException;
@ -46,7 +44,6 @@ import org.springframework.boot.actuate.info.InfoEndpoint;
import org.springframework.stereotype.Service;
import com.pusong.business.domain.PsTaskMain;
import com.pusong.business.mapper.PsTaskMainMapper;
import com.pusong.business.service.IPsTaskService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
@ -74,7 +71,7 @@ public class PsTaskServiceImpl implements IPsTaskService {
private ApproverContainer approverContainer;
@Resource
private PsContractInfoMapper contractInfoMapper;
private final IPsApproverRecordService approverRecordService;
/**
* 新增主任务
*
@ -100,8 +97,10 @@ public class PsTaskServiceImpl implements IPsTaskService {
Page<PsTaskMainVo> page = baseMapper.queryTaskPageList(pageQuery.build(), lqw);
for (PsTaskMainVo vo : page.getRecords()) {
if(vo.getStartDate() != null){
vo.setNumOfDat(DateUtils.calWorkDate(vo.getStartDate(),new Date())+1);
vo.setNumOfDat(DateUtils.calWorkDate(vo.getStartDate(),new Date()));
}
//任务作废审批
vo.setTaskStatusDesc(approverRecordService.getLastFail(vo.getId()+"",null,List.of(ApproverTypeEnum.TASKCANCE.getCode(),ApproverTypeEnum.TASKFINISH.getCode())));
}
return TableDataInfo.build(page);
}
@ -122,7 +121,7 @@ public class PsTaskServiceImpl implements IPsTaskService {
Page<PsTaskMainVo> page = baseMapper.queryChildTaskPageList(pageQuery.build(), lqw);
for (PsTaskMainVo vo : page.getRecords()) {
if(vo.getStartDate() != null){
vo.setNumOfDat(DateUtils.calWorkDate(vo.getStartDate(),new Date())+1);
vo.setNumOfDat(DateUtils.calWorkDate(vo.getStartDate(),new Date()));
}
}
return TableDataInfo.build(page);
@ -186,7 +185,8 @@ public class PsTaskServiceImpl implements IPsTaskService {
* @return
*/
public PsTaskMain queryByContractCode(String contractCode){
return baseMapper.selectOne(Wrappers.<PsTaskMain>lambdaQuery().eq(PsTaskMain::getContractCode, contractCode));
return baseMapper.selectOne(Wrappers.<PsTaskMain>lambdaQuery().eq(PsTaskMain::getContractCode, contractCode)
.eq(PsTaskMain::getTaskType,TaskTypeEnum.CONTRACT.getCode()).ne(PsTaskMain::getTaskStatus,TaskStatusEnum.CANCEL.getCode()));
}
/**
* 上传资料和公司信息
@ -399,7 +399,7 @@ public class PsTaskServiceImpl implements IPsTaskService {
lqw.eq(StringUtils.isNotBlank(bo.getType()),"main.task_type",bo.getType());
}
lqw.eq(bo.getId() != null,"main.id",bo.getId());
lqw.like(StringUtils.isNotBlank(bo.getCompanyName()), "com.company_name", bo.getCompanyName());//公司地址
lqw.like(StringUtils.isNotBlank(bo.getCompanyName()), "com.company_name", bo.getCompanyName());//公司名称
lqw.like(StringUtils.isNotBlank(bo.getCustomerNum()), "com.customer_num", bo.getCustomerNum());//纳税人识别号
lqw.eq(StringUtils.isNotBlank(bo.getCustomerCert()), "com.customer_cert", bo.getCustomerCert());//纳税人资格
lqw.like(StringUtils.isNotBlank(bo.getCustomManagerName()), "usr.nick_name", bo.getCustomManagerName());//销售经理姓名

View File

@ -10,7 +10,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
, info.custom_manager
, com.id com_id
, com.company_name
, com.company_name
, cus.id cus_id
, cus.custom_name
, cus.custom_mobile

View File

@ -5,16 +5,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.pusong.business.mapper.PsCustomInfoMapper">
<sql id="queryContract">
coninfo.custom_id = info.id and coninfo.contract_status != '10' and coninfo.is_cancel != '03'
</sql>
<sql id="queryCustomerList" >
SELECT info.*
, usr.nick_name as custom_manager_name
,psinfo.custom_name as custom_introducer_name
,(select contract_code from ps_contract_info where custom_id = info.id and create_time = (select max(create_time) from ps_contract_info psi where psi.custom_id = info.id ) limit 0,1)
,(select contract_code from ps_contract_info where custom_id = info.id and create_time = (select max(create_time) from ps_contract_info coninfo where <include refid="queryContract"/>) limit 0,1)
contract_code
,(select min(start_date) from ps_task_main where contract_code =
(select contract_code from ps_contract_info where custom_id = info.id and create_time = (select max(create_time) from ps_contract_info psi where psi.custom_id = info.id ) limit 0,1))
(select contract_code from ps_contract_info where custom_id = info.id and create_time = (select max(create_time) from ps_contract_info coninfo where <include refid="queryContract"/>) limit 0,1))
start_date
,EXISTS(SELECT * FROM ps_contract_info coninfo WHERE coninfo.custom_id = info.id and coninfo.contract_status != '10') have_contract
,EXISTS(SELECT 1 FROM ps_contract_info coninfo WHERE <include refid="queryContract"/>) have_contract
FROM ps_custom_info info
left join sys_user usr on info.custom_manager = usr.user_id
left join ps_custom_info psinfo on info.custom_introducer = psinfo.id