This commit is contained in:
mx 2024-09-29 18:44:05 +08:00
parent df044471ee
commit dcb4c9188e
24 changed files with 154 additions and 61 deletions

View File

@ -156,8 +156,8 @@ public class PsContractInfoController extends BaseController {
@SaCheckPermission("business:contractInfo:list") @SaCheckPermission("business:contractInfo:list")
@Log(title = "根据合同编码查询合同信息", businessType = BusinessType.INSERT) @Log(title = "根据合同编码查询合同信息", businessType = BusinessType.INSERT)
@GetMapping("/queryServiceByCode") @GetMapping("/queryServiceByCode")
public R<List<PsContractBusinessVo>> queryServiceByCode(@NotBlank String contractCode) { public R<List<PsContractBusinessVo>> queryServiceByCode(@NotBlank String contractCode, @RequestParam(required = false) Long serviceCompanyId) {
return R.ok(businessService.selectBusinessList(List.of(contractCode))); return R.ok(businessService.selectBusinessList(List.of(contractCode), serviceCompanyId));
} }
@ -210,7 +210,7 @@ public class PsContractInfoController extends BaseController {
@Log(title = "根据合同编码查询服务进度") @Log(title = "根据合同编码查询服务进度")
@SaCheckPermission("business:task:list") @SaCheckPermission("business:task:list")
@GetMapping("/queryScheduleByCode") @GetMapping("/queryScheduleByCode")
public R<ServiceScheduleVo> queryScheduleByCode(@NotBlank String contractCode, @NotBlank Long serviceCompanyId) { public R<ServiceScheduleVo> queryScheduleByCode(@NotNull String contractCode, @NotNull Long serviceCompanyId) {
return R.ok(psContractInfoService.queryScheduleByCode(contractCode, serviceCompanyId)); return R.ok(psContractInfoService.queryScheduleByCode(contractCode, serviceCompanyId));
} }

View File

@ -157,7 +157,7 @@ public class PsCompanyInfo extends TenantEntity {
/** /**
* 是否进出口0否1是 * 是否进出口0否1是
*/ */
private String inout; private String inoutType;
/** /**
* 是否申请发票0否1是 * 是否申请发票0否1是
*/ */

View File

@ -33,10 +33,7 @@ public class PsApproverRecordBo {
*/ */
@NotNull(message = "关联业务id不能为空") @NotNull(message = "关联业务id不能为空")
private String businessId; private String businessId;
/**
* 合同编码
*/
private String contractCode;
/** /**
* 审批业务类型 * 审批业务类型
*/ */
@ -87,13 +84,32 @@ public class PsApproverRecordBo {
* 客户电话 * 客户电话
*/ */
private String customMobile; private String customMobile;
/** /**
* 公司姓名 * 合同编码
*/
private String contractCode;
/**
* 退款方式
*/
private String pay;
/**
* 申请人
*/
private String applicant;
/**
* 服务签约公司名称
* 服务公司和签约公司统一使用
*/ */
private String companyName; private String companyName;
/** /**
* 销售经理姓名 * 销售经理姓名
* 认领人和销售经理为统一字段
*/ */
private String customManagerName; private String customManagerName;
} }

View File

@ -187,7 +187,7 @@ public class PsCompanyInfoBo {
/** /**
* 是否进出口 0否1是 * 是否进出口 0否1是
*/ */
private String inout; private String inoutType;
/** /**
* 是否申请发票 0否1是 * 是否申请发票 0否1是
*/ */

View File

@ -56,7 +56,7 @@ public class PsCompanyQueryBo {
/** /**
* 跟进人员 * 跟进人员
*/ */
private String followUser; private String userName;
/** /**
* 1全部 2非托管服务 3 托管代账 4托管不代账 * 1全部 2非托管服务 3 托管代账 4托管不代账

View File

@ -101,6 +101,7 @@ public class PsContractInfoBo {
/** /**
* 是否续费 * 是否续费
* o新签 1续费
*/ */
private String isDue; private String isDue;

View File

@ -87,5 +87,10 @@ public class PsContractInfoQueryBo {
*/ */
private List<String> serviceProjects; private List<String> serviceProjects;
/**
* o新签 1续费
*/
private String isDue;
} }

View File

@ -97,4 +97,20 @@ public class PsTaskQueryBo {
*/ */
private String isProxy; private String isProxy;
/**
* 合同编码
*/
private String contractCode;
/**
* 主任务状态
*/
private String taskStatus;
/**
* 子任务状态
*/
private String appointStatus;
} }

View File

@ -216,7 +216,7 @@ public class PsCompanyInfoVo implements Serializable {
/** /**
* 是否进出口 0否1是 * 是否进出口 0否1是
*/ */
private String inout; private String inoutType;
/** /**
* 是否申请发票 0否1是 * 是否申请发票 0否1是
*/ */

View File

@ -85,6 +85,21 @@ public class ServiceScheduleVo {
this.status = status; this.status = status;
} }
public Long getUid() {
return uid;
}
public void setUid(Long uid) {
this.uid = uid;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
} }
public void addIn(UserAndStatus userAndStatus){ public void addIn(UserAndStatus userAndStatus){
@ -96,4 +111,29 @@ public class ServiceScheduleVo {
public void addSecret(UserAndStatus userAndStatus){ public void addSecret(UserAndStatus userAndStatus){
this.secret.add(userAndStatus); this.secret.add(userAndStatus);
} }
public Integer getInStatus(){
for (UserAndStatus userAndStatus : in) {
if (userAndStatus.status == 0){
return 0;
}
}
return 1;
}
public Integer getOutStatus(){
for (UserAndStatus userAndStatus : out) {
if (userAndStatus.status == 0){
return 0;
}
}
return 1;
}
public Integer getSecretStatus(){
for (UserAndStatus userAndStatus : secret) {
if (userAndStatus.status == 0){
return 0;
}
}
return 1;
}
} }

View File

@ -19,7 +19,7 @@ public enum ApproverTypeEnum {
TASKCANCE("taskcance","任务作废审批"), TASKCANCE("taskcance","任务作废审批"),
RETURN("RETURN","退款审批"), RETURN("RETURN","退款审批"),
FREE("free","免费工单审批"), FREE("free","免费工单审批"),
TERMINATIONSERVICE("terminationService","终止合作"); STOPACCOUNT("stopAccount","停止代账");
private String code; private String code;
private String text; private String text;
} }

View File

@ -18,7 +18,7 @@ import org.apache.ibatis.annotations.Param;
*/ */
public interface PsApproverRecordMapper extends BaseMapperPlus<PsApproverRecord, PsApproverRecordVo> { public interface PsApproverRecordMapper extends BaseMapperPlus<PsApproverRecord, PsApproverRecordVo> {
Page<PsApproverRecordVo> selectPageApproverList(@Param("page") Page<PsApproverRecord> page, @Param(Constants.WRAPPER) Wrapper<PsApproverRecord> queryWrapper); Page<PsApproverRecordVo> selectPageApproverList(@Param("page") Page<PsApproverRecord> page, @Param(Constants.WRAPPER) Wrapper<PsApproverRecord> queryWrapper, @Param("pay") String payModel);
Page<PsApproverRecordVo> selectPageFreeApproverList(@Param("page") Page<PsApproverRecord> page, @Param(Constants.WRAPPER) Wrapper<PsApproverRecord> queryWrapper); Page<PsApproverRecordVo> selectPageFreeApproverList(@Param("page") Page<PsApproverRecord> page, @Param(Constants.WRAPPER) Wrapper<PsApproverRecord> queryWrapper);
Page<PsApproverRecordVo> selectPagePublicList(@Param("page") Page<PsApproverRecord> page, @Param(Constants.WRAPPER) Wrapper<PsApproverRecord> queryWrapper); Page<PsApproverRecordVo> selectPagePublicList(@Param("page") Page<PsApproverRecord> page, @Param(Constants.WRAPPER) Wrapper<PsApproverRecord> queryWrapper);

View File

@ -17,5 +17,5 @@ import java.util.List;
public interface PsContractBusinessMapper extends BaseMapperPlus<PsContractBusiness, PsContractBusinessVo> { public interface PsContractBusinessMapper extends BaseMapperPlus<PsContractBusiness, PsContractBusinessVo> {
List<PsContractBusinessVo> selectBusinessList(@Param("contractCode") List<String> contractCode); List<PsContractBusinessVo> selectBusinessList(@Param("contractCode") List<String> contractCode, @Param("serviceCompanyId")Long serviceCompanyId);
} }

View File

@ -39,6 +39,12 @@ public interface IPsContractBusinessService {
* @return * @return
*/ */
List<PsContractBusinessVo> selectBusinessList(List<String> contractCode); List<PsContractBusinessVo> selectBusinessList(List<String> contractCode);
/**
* 根据合同编码查询服务信息
* @param contractCode
* @return
*/
List<PsContractBusinessVo> selectBusinessList(List<String> contractCode, Long serviceCompanyId);
/** /**
* 查询合同服务类别 * 查询合同服务类别
* *

View File

@ -29,7 +29,7 @@ public interface IPsContractInfoService {
* @param type 操作类型 1保存2暂存 * @param type 操作类型 1保存2暂存
* @return 是否新增成功 * @return 是否新增成功
*/ */
Long createContract(PsContractInfoBo bo,Integer type); String createContract(PsContractInfoBo bo,Integer type);
/** /**
* 预览合同 * 预览合同
* *

View File

@ -99,10 +99,11 @@ public abstract class ApproverAbstractServiceImpl implements ApproverService {
.eq(StringUtils.isNotBlank(bo.getApproverStatus()),"app.approver_status",bo.getApproverStatus()) .eq(StringUtils.isNotBlank(bo.getApproverStatus()),"app.approver_status",bo.getApproverStatus())
.like(StringUtils.isNotBlank(bo.getCustomerName()),"cus.custom_name",bo.getCustomerName()) .like(StringUtils.isNotBlank(bo.getCustomerName()),"cus.custom_name",bo.getCustomerName())
.like(StringUtils.isNotBlank(bo.getCompanyName()),"com.company_name",bo.getCompanyName()) .like(StringUtils.isNotBlank(bo.getCompanyName()),"com.company_name",bo.getCompanyName())
.like(StringUtils.isNotBlank(bo.getContractCode()),"app.contract_code",bo.getContractCode())
//销售经理姓名 //销售经理姓名
.exists(StringUtils.isNotBlank(bo.getCustomManagerName()),"select 1 from sys_user su where su.user_id = info.custom_manager and su.nick_name like '%"+bo.getCustomManagerName()+"%'") .exists(StringUtils.isNotBlank(bo.getCustomManagerName()),"select 1 from sys_user su where su.user_id = info.custom_manager and su.nick_name like '%"+bo.getCustomManagerName()+"%'")
.orderByAsc("app.approver_status").orderByDesc("app.apply_date"); .orderByAsc("app.approver_status").orderByDesc("app.apply_date");
Page<PsApproverRecordVo> res = recordMapper.selectPageApproverList(pageQuery.build(), lqw); Page<PsApproverRecordVo> res = recordMapper.selectPageApproverList(pageQuery.build(), lqw, bo.getPay());
if(CollectionUtils.isNotEmpty(res.getRecords())){ if(CollectionUtils.isNotEmpty(res.getRecords())){
res.getRecords().forEach(item->{ res.getRecords().forEach(item->{

View File

@ -92,9 +92,9 @@ public class FreeApproverServiceImpl extends ApproverAbstractServiceImpl {
QueryWrapper<PsApproverRecord> lqw = Wrappers.<PsApproverRecord>query().eq("app.business_type", approverType()) QueryWrapper<PsApproverRecord> lqw = Wrappers.<PsApproverRecord>query().eq("app.business_type", approverType())
.eq(bo.getId()!=null,"app.id",bo.getId()) .eq(bo.getId()!=null,"app.id",bo.getId())
.eq("app.del_flag","0") .eq("app.del_flag","0")
.eq(com.pusong.common.core.utils.StringUtils.isNotBlank(bo.getApproverStatus()),"app.approver_status",bo.getApproverStatus()) .eq(StringUtils.isNotBlank(bo.getApproverStatus()),"app.approver_status", bo.getApproverStatus())
.like(com.pusong.common.core.utils.StringUtils.isNotBlank(bo.getCustomerName()),"cus.custom_name",bo.getCustomerName()) .like(StringUtils.isNotBlank(bo.getCustomerName()),"cus.custom_name", bo.getCustomerName())
.like(com.pusong.common.core.utils.StringUtils.isNotBlank(bo.getCompanyName()),"com.company_name",bo.getCompanyName()) .like(StringUtils.isNotBlank(bo.getCompanyName()),"com.company_name", bo.getCompanyName())
//销售经理姓名 //销售经理姓名
.exists(StringUtils.isNotBlank(bo.getCustomManagerName()),"select 1 from sys_user su where su.user_id = info.custom_manager and su.nick_name like '%"+bo.getCustomManagerName()+"%'") .exists(StringUtils.isNotBlank(bo.getCustomManagerName()),"select 1 from sys_user su where su.user_id = info.custom_manager and su.nick_name like '%"+bo.getCustomManagerName()+"%'")
.orderByAsc("app.approver_status").orderByDesc("app.apply_date"); .orderByAsc("app.approver_status").orderByDesc("app.apply_date");

View File

@ -1,44 +1,27 @@
package com.pusong.business.service.approver.impl; package com.pusong.business.service.approver.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pusong.business.domain.PsApproverRecord; import com.pusong.business.domain.PsApproverRecord;
import com.pusong.business.domain.PsTaskMain;
import com.pusong.business.domain.bo.PsApproverRecordBo;
import com.pusong.business.domain.vo.PsApproverRecordVo;
import com.pusong.business.domain.vo.PsCompanyInfoVo;
import com.pusong.business.domain.vo.PsContractPayVo;
import com.pusong.business.enums.ApproverTypeEnum; import com.pusong.business.enums.ApproverTypeEnum;
import com.pusong.business.enums.PayStatusEnum;
import com.pusong.business.enums.TaskStatusEnum;
import com.pusong.business.enums.TaskTypeEnum;
import com.pusong.business.mapper.PsApproverRecordMapper; import com.pusong.business.mapper.PsApproverRecordMapper;
import com.pusong.business.mapper.PsTaskAppointMapper; import com.pusong.business.mapper.PsTaskAppointMapper;
import com.pusong.business.mapper.PsTaskMainMapper; import com.pusong.business.mapper.PsTaskMainMapper;
import com.pusong.business.service.IPsCompanyInfoService; import com.pusong.business.service.IPsCompanyInfoService;
import com.pusong.business.service.IPsContractInfoService; import com.pusong.business.service.IPsContractInfoService;
import com.pusong.common.core.utils.DateUtils;
import com.pusong.common.core.utils.StringUtils;
import com.pusong.common.mybatis.core.page.PageQuery;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* 免费工单审批 * 免费工单审批
*/ */
@RequiredArgsConstructor @RequiredArgsConstructor
@Service @Service
@Slf4j @Slf4j
public class TerminationServiceImpl extends ApproverAbstractServiceImpl { public class StopAccountServiceImpl extends ApproverAbstractServiceImpl {
@Override @Override
public String approverType() { public String approverType() {
return ApproverTypeEnum.TERMINATIONSERVICE.getCode(); return ApproverTypeEnum.STOPACCOUNT.getCode();
} }
private final PsTaskMainMapper taskMainMapper; private final PsTaskMainMapper taskMainMapper;
private final PsTaskAppointMapper taskAppointMapper; private final PsTaskAppointMapper taskAppointMapper;

View File

@ -129,7 +129,7 @@ public class PsCompanyInfoServiceImpl implements IPsCompanyInfoService {
lqw.like(bo.getCustomMobile() != null,"cus.custom_mobile",bo.getCustomMobile()); lqw.like(bo.getCustomMobile() != null,"cus.custom_mobile",bo.getCustomMobile());
lqw.like(bo.getCompanyName() != null,"com.company_name",bo.getCompanyName()); lqw.like(bo.getCompanyName() != null,"com.company_name",bo.getCompanyName());
lqw.eq(bo.getServiceStatus() != null,"com.service_status",bo.getServiceStatus()); lqw.eq(bo.getServiceStatus() != null,"com.service_status",bo.getServiceStatus());
lqw.exists(StringUtils.isNotBlank(bo.getFollowUser()),"select 1 from sys_user fsu where fsu.user_id = cf.user_id and fsu.nick_name like '%"+bo.getFollowUser()+"%'"); lqw.exists(StringUtils.isNotBlank(bo.getUserName()),"select 1 from sys_user fsu where fsu.user_id = cf.user_id and fsu.nick_name like '%"+bo.getUserName()+"%'");
StringBuilder sql = new StringBuilder("select 1 from ps_contract_business cb where cb.company_id = com.id "); StringBuilder sql = new StringBuilder("select 1 from ps_contract_business cb where cb.company_id = com.id ");
if (bo.getType() == 2){ //非托管 if (bo.getType() == 2){ //非托管
@ -279,7 +279,7 @@ public class PsCompanyInfoServiceImpl implements IPsCompanyInfoService {
*/ */
public void terminationService(Long serviceCompanyId) { public void terminationService(Long serviceCompanyId) {
//发起审批 //发起审批
ApproverService service = container.getService(ApproverTypeEnum.TERMINATIONSERVICE.getCode()); ApproverService service = container.getService(ApproverTypeEnum.STOPACCOUNT.getCode());
service.apply(serviceCompanyId + "", "",null, null); service.apply(serviceCompanyId + "", "",null, null);
} }
} }

View File

@ -86,19 +86,20 @@ public class PsContractBusinessServiceImpl implements IPsContractBusinessService
return lqw; return lqw;
} }
public List<PsContractBusinessVo> selectBusinessList(List<String> contractCode){
return this.selectBusinessList(contractCode, null);
}
/** /**
* 根据合同编码查询服务信息 * 根据合同编码查询服务信息
* @param contractCode * @param contractCode
* @return * @return
*/ */
public List<PsContractBusinessVo> selectBusinessList(List<String> contractCode) { public List<PsContractBusinessVo> selectBusinessList(List<String> contractCode, Long serviceCompanyId) {
if(CollectionUtils.isEmpty(contractCode)){return new ArrayList<>();} if(CollectionUtils.isEmpty(contractCode)){return new ArrayList<>();}
return baseMapper.selectBusinessList(contractCode); return baseMapper.selectBusinessList(contractCode, serviceCompanyId);
} }
/* *//** /* *//**
* 查询合同服务类别 * 查询合同服务类别
* *

View File

@ -98,7 +98,7 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
*/ */
@Override @Override
@Transactional//开启事务 @Transactional//开启事务
public Long createContract(PsContractInfoBo bo, Integer type) { public String createContract(PsContractInfoBo bo, Integer type) {
if (bo.getFirstPartyType() == PsContractInfoBo.FIRSTPARTYTYPE.INDIVIDUALS.getType()){ if (bo.getFirstPartyType() == PsContractInfoBo.FIRSTPARTYTYPE.INDIVIDUALS.getType()){
bo.setContactPersonName(bo.getCompanyInfoBo().getLegalPersonName()); bo.setContactPersonName(bo.getCompanyInfoBo().getLegalPersonName());
bo.setContactPersonPhone(bo.getCompanyInfoBo().getLegalPersonPhone()); bo.setContactPersonPhone(bo.getCompanyInfoBo().getLegalPersonPhone());
@ -179,7 +179,8 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
//4.删除所有服务类型和服务项目,.插入服务类型 //4.删除所有服务类型和服务项目,.插入服务类型
businessService.saveList(list, add.getContractCode()); businessService.saveList(list, add.getContractCode());
//7.生成合同 //7.生成合同
return makePdf(add, bo,true); makePdf(add, bo,true);
return add.getContractCode();
} }
/** /**
* 预览合同 * 预览合同
@ -523,9 +524,10 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
if(StringUtils.equals(CustomerStatusEnum.STOP.getCode(),infoVo.getPsCustomInfoVo().getCustomStatus())){ if(StringUtils.equals(CustomerStatusEnum.STOP.getCode(),infoVo.getPsCustomInfoVo().getCustomStatus())){
throw new ServiceException("操作失败,客户已终止合作"); throw new ServiceException("操作失败,客户已终止合作");
} }
fillMoney(infoVo);
//没有任何一笔收款点击作废直接作废合同 //没有任何一笔收款点击作废直接作废合同
if(CollectionUtils.isEmpty(infoVo.getContractPayVoList())){ // if(CollectionUtils.isEmpty(infoVo.getContractPayVoList())){
if (infoVo.getPayMoney().compareTo(BigDecimal.ZERO) == 0){
info.setIsCancel(CommonStatusEnum.SUCCESS.getCode()); info.setIsCancel(CommonStatusEnum.SUCCESS.getCode());
}else{ }else{
if(StringUtils.isBlank(desc)){throw new ServiceException("请填写作废原因");} if(StringUtils.isBlank(desc)){throw new ServiceException("请填写作废原因");}
@ -810,11 +812,11 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
if(CollectionUtils.isNotEmpty(appointList)){ if(CollectionUtils.isNotEmpty(appointList)){
appointList.forEach(item->{ appointList.forEach(item->{
if(StringUtils.equals("1",item.getAppointType())){ 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));
}else if(StringUtils.equals("2",item.getAppointType())){ }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));
}else{ }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));
} }
}); });
} }
@ -848,6 +850,7 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
qw.in( CollectionUtils.isNotEmpty(bo.getInContractStatus()),"info.contract_status", bo.getInContractStatus()); qw.in( CollectionUtils.isNotEmpty(bo.getInContractStatus()),"info.contract_status", bo.getInContractStatus());
qw.notIn( CollectionUtils.isNotEmpty(bo.getNotInContractStatus()),"info.contract_status", bo.getNotInContractStatus()); qw.notIn( CollectionUtils.isNotEmpty(bo.getNotInContractStatus()),"info.contract_status", bo.getNotInContractStatus());
qw.eq( StringUtils.isNotBlank(bo.getContractCode()),"info.contract_code", bo.getContractCode()); qw.eq( StringUtils.isNotBlank(bo.getContractCode()),"info.contract_code", bo.getContractCode());
qw.eq( StringUtils.isNotBlank(bo.getIsDue()),"info.is_due", bo.getIsDue());
//客户表条件 //客户表条件
qw.like( StringUtils.isNotBlank(bo.getCustomName()),"cus.custom_name", bo.getCustomName()); qw.like( StringUtils.isNotBlank(bo.getCustomName()),"cus.custom_name", bo.getCustomName());
qw.like( StringUtils.isNotBlank(bo.getCustomMobile()),"cus.custom_mobile", bo.getCustomMobile()); qw.like( StringUtils.isNotBlank(bo.getCustomMobile()),"cus.custom_mobile", bo.getCustomMobile());
@ -944,7 +947,7 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
BigDecimal netPay = returnList.stream().map(PsContractPayVo::getMoney).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal netPay = returnList.stream().map(PsContractPayVo::getMoney).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal pay = netPay.subtract(vo.getReturnMoney()); BigDecimal pay = netPay.subtract(vo.getReturnMoney());
//已付金额(收款-退款) //已付金额(收款-退款)
vo.setPayMoney(pay.compareTo(BigDecimal.ZERO)>=0?pay:BigDecimal.ZERO); vo.setPayMoney(pay.compareTo(BigDecimal.ZERO) >= 0 ? pay : BigDecimal.ZERO);
//未付金额(合同金额-已付金额) //未付金额(合同金额-已付金额)
vo.setResidualMoney((vo.getContractAmount() == null ? BigDecimal.ZERO:vo.getContractAmount()).subtract(vo.getPayMoney())); vo.setResidualMoney((vo.getContractAmount() == null ? BigDecimal.ZERO:vo.getContractAmount()).subtract(vo.getPayMoney()));

View File

@ -160,6 +160,7 @@ public class PsTaskServiceImpl implements IPsTaskService {
lqw.exists(StringUtils.isNotBlank(ex), "select 1 from sys_user su where appo.executor = su.user_id and su.nick_name like '%" + ex + "%'"); lqw.exists(StringUtils.isNotBlank(ex), "select 1 from sys_user su where appo.executor = su.user_id and su.nick_name like '%" + ex + "%'");
lqw.eq("appo.appoint_type",bo.getAppointType()); lqw.eq("appo.appoint_type",bo.getAppointType());
lqw.eq(id != null,"appo.id",id); lqw.eq(id != null,"appo.id",id);
lqw.eq(StringUtils.isNotBlank(bo.getAppointStatus()),"appo.appoint_status", bo.getAppointStatus());
log.info(lqw.getCustomSqlSegment()); log.info(lqw.getCustomSqlSegment());
Page<PsTaskMainVo> page = baseMapper.queryChildTaskPageList(pageQuery.build(), lqw); Page<PsTaskMainVo> page = baseMapper.queryChildTaskPageList(pageQuery.build(), lqw);
fillInfo(page); fillInfo(page);
@ -260,7 +261,7 @@ public class PsTaskServiceImpl implements IPsTaskService {
// throw new ServiceException("任务已完成,无法修改"); // throw new ServiceException("任务已完成,无法修改");
// } // }
customerId = taskMain.getCustomId(); customerId = taskMain.getCustomId();
companyId = taskMain.getCompanyId(); companyId = taskMain.getServiceCompanyId();
}else if(StringUtils.isNotBlank(save.getContractCode())){ }else if(StringUtils.isNotBlank(save.getContractCode())){
PsContractInfo con = contractInfoMapper.selectOne(Wrappers.<PsContractInfo>lambdaQuery().eq(PsContractInfo::getContractCode, save.getContractCode())); PsContractInfo con = contractInfoMapper.selectOne(Wrappers.<PsContractInfo>lambdaQuery().eq(PsContractInfo::getContractCode, save.getContractCode()));
customerId = con.getCustomId(); customerId = con.getCustomId();
@ -456,12 +457,19 @@ public class PsTaskServiceImpl implements IPsTaskService {
private QueryWrapper<PsTaskMain> buildQueryWrapper(PsTaskQueryBo bo) { private QueryWrapper<PsTaskMain> buildQueryWrapper(PsTaskQueryBo bo) {
QueryWrapper<PsTaskMain> lqw = new QueryWrapper<PsTaskMain>(); QueryWrapper<PsTaskMain> lqw = new QueryWrapper<PsTaskMain>();
lqw.eq("main.del_flag","0"); lqw.eq("main.del_flag","0");
lqw.ne("main.task_status",TaskStatusEnum.CANCEL.getCode());
if(StringUtils.equals(bo.getType(),"1")){
lqw.in(StringUtils.isNotBlank(bo.getType()),"main.task_type",List.of("1","2")); lqw.ne(StringUtils.isBlank(bo.getTaskStatus()), "main.task_status", TaskStatusEnum.CANCEL.getCode());
lqw.eq(StringUtils.isNotBlank(bo.getTaskStatus()),"main.task_status", bo.getTaskStatus());
if(bo.getType() == null){
lqw.in("main.task_type", List.of("1", "2"));
}else{ }else{
lqw.eq(StringUtils.isNotBlank(bo.getType()),"main.task_type",bo.getType()); lqw.eq("main.task_type", bo.getType());
} }
lqw.eq(bo.getId() != null,"main.id",bo.getId()); 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.like(StringUtils.isNotBlank(bo.getCustomerNum()), "com.customer_num", bo.getCustomerNum());//纳税人识别号

View File

@ -6,7 +6,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap id="resultMap" type="com.pusong.business.domain.vo.PsApproverRecordVo"> <resultMap id="resultMap" type="com.pusong.business.domain.vo.PsApproverRecordVo">
<collection columnPrefix="com_" property="psCompanyInfoVo" ofType="com.pusong.business.domain.vo.PsCompanyInfoVo" > <association columnPrefix="pay_" property="psContractPayVo" javaType="com.pusong.business.domain.vo.PsContractPayVo" >
</association>
<collection property="psCompanyInfoVo" ofType="com.pusong.business.domain.vo.PsCompanyInfoVo" >
</collection> </collection>
</resultMap> </resultMap>
@ -35,10 +37,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
, (select IFNULL(sum(pa.money),0) from ps_contract_pay pa where pa.pay_status = 1 and pa.business_type = 1 and pa.contract_code = info.contract_code , (select IFNULL(sum(pa.money),0) from ps_contract_pay pa where pa.pay_status = 1 and pa.business_type = 1 and pa.contract_code = info.contract_code
)-(select IFNULL(sum(pay.money),0) from ps_contract_pay pay where pay.pay_status = 1 and pay.business_type = 2 and pay.contract_code = info.contract_code) )-(select IFNULL(sum(pay.money),0) from ps_contract_pay pay where pay.pay_status = 1 and pay.business_type = 2 and pay.contract_code = info.contract_code)
as pay_money as pay_money
<if test="pay != null">
,pay.*
</if>
from ps_approver_record app from ps_approver_record app
left join ps_contract_info info on app.contract_code = info.contract_code and app.del_flag = 0 left join ps_contract_info info on app.contract_code = info.contract_code and app.del_flag = 0
left join ps_company_info com on info.company_id = com.id left join ps_company_info com on info.company_id = com.id
left join ps_custom_info cus on cus.id = info.custom_id left join ps_custom_info cus on cus.id = info.custom_id
<if test="pay != null">
inner join ps_contract_pay pay on pay.id = app.business_id and pay.pay_mode = ${pay}
</if>
${ew.getCustomSqlSegment} ${ew.getCustomSqlSegment}
</select> </select>
@ -55,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
, cus.custom_mobile , cus.custom_mobile
, cus.custom_manager , cus.custom_manager
from ps_approver_record app from ps_approver_record app
left join ps_company_info com on app.business_id = com.id inner join ps_company_info com on app.business_id = com.id
left join ps_custom_info cus on cus.id = com.custom_id left join ps_custom_info cus on cus.id = com.custom_id
${ew.getCustomSqlSegment} ${ew.getCustomSqlSegment}
</select> </select>

View File

@ -29,5 +29,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<foreach item="code" collection="contractCode" open="(" separator="," close=")"> <foreach item="code" collection="contractCode" open="(" separator="," close=")">
#{code} #{code}
</foreach> </foreach>
<if test="serviceCompanyId != null">
and company_id = ${serviceCompanyId}
</if>
</select> </select>
</mapper> </mapper>