生成合同
This commit is contained in:
parent
016b2e392a
commit
3068493329
@ -176,6 +176,19 @@ public class PsContractInfoController extends BaseController {
|
||||
psContractInfoService.freeWork(contractCode,businessType,businessProject);
|
||||
return R.ok();
|
||||
}
|
||||
/**
|
||||
* 根据合同编码查询服务进度
|
||||
* @param contractCode 合同编码
|
||||
* @return
|
||||
*/
|
||||
@RepeatSubmit()
|
||||
@Log(title = "免费派单")
|
||||
@SaCheckPermission("business:task:list")
|
||||
@GetMapping("/queryScheduleByCode")
|
||||
public R<Void> queryScheduleByCode(@NotNull String contractCode) {
|
||||
psContractInfoService.queryScheduleByCode(contractCode);
|
||||
return R.ok();
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * 获取合同基本信息详细信息
|
||||
|
@ -85,6 +85,7 @@ public class PsContractPayController extends BaseController {
|
||||
psContractPayService.refundFinish(files,id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出合同回款记录列表
|
||||
*//*
|
||||
|
@ -150,10 +150,9 @@ public class PsContractInfo extends TenantEntity {
|
||||
* 确认单
|
||||
*/
|
||||
private Long confirmOssid;
|
||||
|
||||
/**
|
||||
* 任务派单日期
|
||||
* 原合同编码(续费合同使用)
|
||||
*/
|
||||
private Date startDate;
|
||||
|
||||
|
||||
private String srcContractCode;
|
||||
}
|
||||
|
@ -74,4 +74,9 @@ public class PsTaskMain extends TenantEntity {
|
||||
* 发票
|
||||
*/
|
||||
private String invoice;
|
||||
|
||||
/**
|
||||
* 派单操作人
|
||||
*/
|
||||
private Long operateUser;
|
||||
}
|
||||
|
@ -32,6 +32,10 @@ public class PsContractInfoBo {
|
||||
*/
|
||||
@NotBlank(message = "合同编码不能为空", groups = { EditGroup.class })
|
||||
private String contractCode;
|
||||
/**
|
||||
* 原合同编码(续费合同使用)
|
||||
*/
|
||||
private String srcContractCode;
|
||||
/**
|
||||
* 合同主体
|
||||
*/
|
||||
|
@ -151,6 +151,20 @@ public class PsCustomInfoVo implements Serializable {
|
||||
* 是否已生成合同(1是0否)
|
||||
*/
|
||||
private Integer haveContract;
|
||||
/**
|
||||
* 合同编码(最新的)
|
||||
*/
|
||||
private Integer contractCode;
|
||||
/**
|
||||
* 派单日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private Date startDate;
|
||||
/**
|
||||
* 任务进行天数
|
||||
*/
|
||||
private int numOfDat;
|
||||
|
||||
/**
|
||||
* 报价金额DTO
|
||||
*/
|
||||
|
@ -116,6 +116,13 @@ public interface IPsContractInfoService {
|
||||
* @param contractCode 合同编码
|
||||
*/
|
||||
void finish(String contractCode);
|
||||
|
||||
|
||||
/**
|
||||
* 根据合同编码查询服务进度
|
||||
* @param contractCode 合同编码
|
||||
*/
|
||||
void queryScheduleByCode(String contractCode);
|
||||
/**
|
||||
* 查询符合条件的合同基本信息列表
|
||||
*
|
||||
|
@ -217,6 +217,7 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
}else if (bo.getType() == 3){//已回款(要特定的作废数据)
|
||||
bo.setInContractStatus(ContractStatusEnum.getReturn());
|
||||
}else if (bo.getType() == 4){//托管续费合同
|
||||
log.info("托管服务");
|
||||
}
|
||||
|
||||
QueryWrapper<PsContractInfo> lqw = buildQueryWrapper(bo);
|
||||
@ -476,7 +477,13 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据合同编码查询服务进度
|
||||
* @param contractCode 合同编码
|
||||
*/
|
||||
public void queryScheduleByCode(String contractCode){
|
||||
|
||||
}
|
||||
private QueryWrapper<PsContractInfo> buildQueryWrapper(PsContractInfoQueryBo bo) {
|
||||
QueryWrapper<PsContractInfo> qw = Wrappers.query();
|
||||
//删除标志
|
||||
@ -501,9 +508,10 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
wq.or().gt( bo.getType() == 2,"((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\n" +
|
||||
")-(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))",0);
|
||||
});
|
||||
//托管续费合同
|
||||
qw.exists(bo.getType() != null && bo.getType() == 4
|
||||
,"select 1 from ps_contract_business bus where info.contract_code = bus.contract_code and bus.business_type = 4");
|
||||
//托管续费合同(写死托管服务的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");
|
||||
}
|
||||
|
||||
qw.orderByDesc("info.create_time");
|
||||
|
||||
|
@ -193,7 +193,7 @@ public class PsContractPayServiceImpl implements IPsContractPayService {
|
||||
info.setPayDate(new Date());
|
||||
info.setPayCertification(StringUtils.join(payCertifications,","));
|
||||
info.setPayStatus(PayStatusEnum.SUCCESS.getCode());
|
||||
baseMapper.insert(info);
|
||||
baseMapper.updateById(info);
|
||||
}
|
||||
|
||||
/* *//**
|
||||
|
@ -15,13 +15,12 @@ import com.pusong.business.enums.ApproverTypeEnum;
|
||||
import com.pusong.business.enums.CommonStatusEnum;
|
||||
import com.pusong.business.enums.ContractStatusEnum;
|
||||
import com.pusong.business.enums.CustomerStatusEnum;
|
||||
import com.pusong.business.mapper.PsCompanyInfoMapper;
|
||||
import com.pusong.business.mapper.PsCustomCallbackMapper;
|
||||
import com.pusong.business.mapper.PsCustomPriceMapper;
|
||||
import com.pusong.business.mapper.*;
|
||||
import com.pusong.business.service.IPsCompanyInfoService;
|
||||
import com.pusong.business.service.approver.ApproverContainer;
|
||||
import com.pusong.business.service.approver.ApproverService;
|
||||
import com.pusong.common.core.exception.ServiceException;
|
||||
import com.pusong.common.core.utils.DateUtils;
|
||||
import com.pusong.common.core.utils.MapstructUtils;
|
||||
import com.pusong.common.core.utils.StringUtils;
|
||||
import com.pusong.common.mybatis.core.page.TableDataInfo;
|
||||
@ -34,7 +33,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.pusong.business.domain.PsCustomInfo;
|
||||
import com.pusong.business.mapper.PsCustomInfoMapper;
|
||||
import com.pusong.business.service.IPsCustomInfoService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -55,6 +53,7 @@ public class PsCustomInfoServiceImpl implements IPsCustomInfoService {
|
||||
private final PsCustomInfoMapper baseMapper;
|
||||
private final PsCustomPriceMapper priceMapper;
|
||||
private final PsCustomCallbackMapper callbackMapper;
|
||||
private final PsContractInfoMapper contractInfoMapper;
|
||||
private final PsCompanyInfoMapper companyInfoMapper;
|
||||
@Resource
|
||||
private final IPsCompanyInfoService companyInfoService;
|
||||
@ -178,6 +177,8 @@ public class PsCustomInfoServiceImpl implements IPsCustomInfoService {
|
||||
}else{
|
||||
info.setCompanyNum(0);
|
||||
}
|
||||
//任务进行天数
|
||||
info.setNumOfDat(info.getStartDate() == null?0:DateUtils.calWorkDate(info.getStartDate(),new Date()));
|
||||
}
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ import com.pusong.common.core.utils.MapstructUtils;
|
||||
import com.pusong.common.core.utils.StringUtils;
|
||||
import com.pusong.common.mybatis.core.page.PageQuery;
|
||||
import com.pusong.common.mybatis.core.page.TableDataInfo;
|
||||
import com.pusong.common.satoken.utils.LoginHelper;
|
||||
import com.pusong.system.domain.vo.SysOssVo;
|
||||
import com.pusong.system.service.ISysOssService;
|
||||
import jakarta.annotation.Resource;
|
||||
@ -285,10 +286,9 @@ public class PsTaskServiceImpl implements IPsTaskService {
|
||||
update.setId(mainTask.getId());
|
||||
update.setTaskStatus(TaskStatusEnum.ING.getCode());
|
||||
update.setStartDate(new Date());
|
||||
update.setOperateUser(LoginHelper.getUserId());
|
||||
baseMapper.updateById(update);
|
||||
|
||||
// contractInfoMapper.update(Wrappers.<PsContractInfo>lambdaUpdate().set(PsContractInfo::getContractCode).eq(PsContractInfo::getContractCode,mainTask.getContractCode()));
|
||||
|
||||
}
|
||||
PsTaskAppoint psTaskAppoint = new PsTaskAppoint();
|
||||
psTaskAppoint.setAppointStatus(AppointStatusEnum.ING.getCode());
|
||||
@ -402,7 +402,7 @@ public class PsTaskServiceImpl implements IPsTaskService {
|
||||
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()), "us.nick_name", bo.getCustomManagerName());//销售经理姓名
|
||||
lqw.like(StringUtils.isNotBlank(bo.getCustomManagerName()), "usr.nick_name", bo.getCustomManagerName());//销售经理姓名
|
||||
lqw.like(StringUtils.isNotBlank(bo.getCompanyAdress()), "com.company_adress", bo.getCompanyAdress());//公司地址
|
||||
lqw.like(StringUtils.isNotBlank(bo.getMobile()), "com.legal_person_phone", bo.getMobile());//法人手机号
|
||||
lqw.like(StringUtils.isNotBlank(bo.getIdNo()), "com.legal_person_idcard", bo.getIdNo());//法人身份证
|
||||
@ -413,6 +413,7 @@ public class PsTaskServiceImpl implements IPsTaskService {
|
||||
//执行者姓名
|
||||
lqw.exists(StringUtils.isNotBlank(bo.getExecutor()), "select 1 from ps_task_appoint appoint,sys_user su " +
|
||||
"where appoint.executor = su.user_id and appoint.task_id = main.id and su.nick_name like '%" + bo.getExecutor() + "%'");
|
||||
lqw.orderByDesc("main.create_time");
|
||||
return lqw;
|
||||
}
|
||||
|
||||
|
@ -25,10 +25,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
cus.id cus_id,
|
||||
cus.custom_name cus_custom_name ,
|
||||
cus.custom_mobile cus_custom_mobile,
|
||||
cus.custom_status cus_custom_status,
|
||||
us.nick_name custom_manager_name,
|
||||
(select ptm.invoice from ps_task_main ptm where ptm.task_type = '3'
|
||||
and ptm.contract_code = info.contract_code and ptm.task_status = 30 limit 0,1) as invoice_ossid
|
||||
|
||||
(select ptm.invoice from ps_task_main ptm where ptm.task_type = '3' and ptm.contract_code = info.contract_code and ptm.task_status = 30 limit 0,1)
|
||||
as invoice_ossid
|
||||
from ps_contract_info info
|
||||
left join ps_company_info com on info.company_id = com.id
|
||||
left join ps_custom_info cus on info.custom_id = cus.id
|
||||
|
@ -8,8 +8,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<sql id="queryCustomerList" >
|
||||
SELECT info.*
|
||||
, usr.nick_name as custom_manager_name
|
||||
,psinfo.custom_name as custom_introducer_name,
|
||||
EXISTS(SELECT * FROM ps_contract_info coninfo WHERE coninfo.custom_id = info.id and coninfo.contract_status != '10') have_contract
|
||||
,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)
|
||||
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))
|
||||
start_date
|
||||
,EXISTS(SELECT * FROM ps_contract_info coninfo WHERE coninfo.custom_id = info.id and coninfo.contract_status != '10') 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
|
||||
@ -42,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
custom.custom_mobile,
|
||||
(select GROUP_CONCAT(business.business_type SEPARATOR ',')
|
||||
from ps_contract_business business where business.contract_code = con.contract_code) as business_type_name,
|
||||
task.start_date,
|
||||
(select max(start_date) from ps_task_main ptm where ptm.contract_code = con.contract_code and ptm.task_type='1' ) start_date,
|
||||
com.finance_account_no,
|
||||
custom.custom_manager,
|
||||
com.company_adress,
|
||||
@ -53,21 +58,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
com.legal_person_idcard,
|
||||
com.legal_person_phone,
|
||||
(select GROUP_CONCAT(appoint.executor SEPARATOR ',')
|
||||
from ps_task_appoint appoint where appoint.task_id = task.id) as executors,
|
||||
from ps_task_appoint appoint where appoint.contract_code = con.contract_code) as executors,
|
||||
con.sign_desc,
|
||||
con.contract_amount,
|
||||
con.finish_date,
|
||||
con.confirm_ossid,
|
||||
(select par.approver_status from ps_approver_record par where par.contract_code = con.contract_code and business_type = 'free' order by id desc limit 0,1) approver_status
|
||||
from
|
||||
ps_custom_info custom
|
||||
left join
|
||||
(select * from ps_task_main main where main.start_date in (select max(ma.start_date) start_date from ps_task_main ma group by ma.custom_id))
|
||||
task on custom.id = task.custom_id
|
||||
left join
|
||||
ps_company_info com on com.id = task.company_id
|
||||
left join
|
||||
ps_contract_info con on con.contract_code = task.contract_code
|
||||
from
|
||||
ps_custom_info custom
|
||||
left join
|
||||
(select * from ps_contract_info info where info.create_time in (select max(pci.create_time) create_time from ps_contract_info pci group by pci.custom_id))
|
||||
con on con.custom_id = custom.id
|
||||
left join
|
||||
ps_company_info com on com.id = con.company_id
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user