合同
This commit is contained in:
parent
b55b87df8e
commit
3c10e741ae
@ -65,12 +65,12 @@
|
||||
<#list business as item>
|
||||
<tr >
|
||||
<td>
|
||||
${item.businessType}
|
||||
${item.businessTypeName}
|
||||
</td>
|
||||
<td colspan="2">
|
||||
<div style="height: 5pt;width: 1pt"></div>
|
||||
<p class="content" style="text-indent:5pt">
|
||||
${item.businessType}-金额:${item.businessAmount}元
|
||||
${item.businessTypeName}-金额:${item.businessAmount}元
|
||||
<#if item.businessDesc?? && item.businessDesc != "">
|
||||
-备注:${item.businessDesc}
|
||||
</#if>
|
||||
@ -114,8 +114,8 @@
|
||||
<span style="">合同金额:共计¥</span>
|
||||
<span style=" text-decoration:underline"> ${contract.contractAmount}</span>
|
||||
<span style="">元(大写金额:</span>
|
||||
<span style=" text-decoration:underline">${contractAmount} </span>
|
||||
<span style="">元整),垫付项目中涉及银行开户、刻章等,实际价格以第三方机构及政府规定为准。除此之外,甲方无需向乙方支付其他任何费用。</span></p>
|
||||
<span style=" text-decoration:underline">${contractAmount} )</span>
|
||||
<span style="">,垫付项目中涉及银行开户、刻章等,实际价格以第三方机构及政府规定为准。除此之外,甲方无需向乙方支付其他任何费用。</span></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr >
|
||||
@ -134,7 +134,7 @@
|
||||
<td colspan="2">
|
||||
<div style="height: 5pt;width: 1pt"></div>
|
||||
<p class="content" style="text-indent:5pt">
|
||||
<#if text2?? && text2 != "">
|
||||
<#if contract.signDesc?? && contract.signDesc != "">
|
||||
${contract.signDesc?if_exists}
|
||||
<#else>
|
||||
无
|
||||
@ -234,12 +234,12 @@
|
||||
<span style=" text-decoration:underline"> </span> 月
|
||||
<span style=" text-decoration:underline"> </span> 日-->
|
||||
</p>
|
||||
|
||||
<#if isSign?? && isSign>
|
||||
<div style="height: 500px;width: 100%;padding-top: -120px;padding-left: 120px">
|
||||
<img style="width:150px; height:150px; " src="${imagePath}/doc/image/allZ.png"/>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</#if>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
@ -3,10 +3,14 @@ package com.pusong.common.doc.util;
|
||||
public class NumBerTool {
|
||||
private static final String[] NUMBERS = {"零", "壹", "贰", "叁", "肆", "伍", "陆",
|
||||
"柒", "捌", "玖"};
|
||||
/** 整数部分的单位 */
|
||||
/**
|
||||
* 整数部分的单位
|
||||
*/
|
||||
private static final String[] IUNIT = {"元", "拾", "佰", "仟", "万", "拾", "佰",
|
||||
"仟", "亿", "拾", "佰", "仟", "万", "拾", "佰", "仟"};
|
||||
/** 小数部分的单位 */
|
||||
/**
|
||||
* 小数部分的单位
|
||||
*/
|
||||
private static final String[] DUNIT = {"角", "分"};
|
||||
|
||||
|
||||
@ -45,6 +49,7 @@ public class NumBerTool {
|
||||
int[] decimals = toArray(decimalStr);// 小数部分数字
|
||||
return getChineseInteger(integers, isMust5) + getChineseDecimal(decimals);
|
||||
}
|
||||
|
||||
/**
|
||||
* 整数部分和小数部分转换为数组,从高位至低位
|
||||
*/
|
||||
@ -55,6 +60,7 @@ public class NumBerTool {
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到中文金额的整数部分。
|
||||
*/
|
||||
@ -83,6 +89,7 @@ public class NumBerTool {
|
||||
}
|
||||
return chineseInteger.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到中文金额的小数部分。
|
||||
*/
|
||||
@ -95,8 +102,12 @@ public class NumBerTool {
|
||||
chineseDecimal.append(decimals[i] == 0 ? ""
|
||||
: (NUMBERS[decimals[i]] + DUNIT[i]));
|
||||
}
|
||||
if(decimals.length == 0){
|
||||
chineseDecimal.append("整");
|
||||
}
|
||||
return chineseDecimal.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断第5位数字的单位"万"是否应加。
|
||||
*/
|
||||
|
@ -44,7 +44,7 @@ public class PDFBuilder extends PdfPageEventHelper {
|
||||
sb.append("\u00a0");
|
||||
}
|
||||
Blank = sb.toString();
|
||||
fontDetail = new Font(baseFont);
|
||||
fontDetail = new Font(baseFont,8);
|
||||
} catch (DocumentException e) {
|
||||
log.error("初始化字体失败", e);
|
||||
} catch (IOException e) {
|
||||
|
@ -25,6 +25,18 @@ public class PdfGenerator {
|
||||
public static final String HEAD = "head";
|
||||
//是否签章
|
||||
public static final String SIGN = "isSign";
|
||||
public static Configuration configuration =null;
|
||||
static {
|
||||
configuration = new Configuration(Configuration.VERSION_2_3_31);
|
||||
// 设置模板目录
|
||||
File file = new File(System.getProperty("user.dir") + "/doc");
|
||||
try {
|
||||
configuration.setDirectoryForTemplateLoading(file);
|
||||
} catch (IOException e) {
|
||||
configuration =null;
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
|
||||
@ -61,10 +73,6 @@ public class PdfGenerator {
|
||||
|
||||
|
||||
public static void makePdf(Map<String, Object> data ,String pdfpath,String templateName) throws Exception{
|
||||
// 设置模板目录
|
||||
Configuration configuration = new Configuration(Configuration.VERSION_2_3_31);
|
||||
File file = new File(System.getProperty("user.dir") + "/doc");
|
||||
configuration.setDirectoryForTemplateLoading(file);
|
||||
// 加载模板
|
||||
Template template = configuration.getTemplate(templateName);
|
||||
data.put("imagePath",System.getProperty("user.dir"));
|
||||
|
@ -1,5 +1,8 @@
|
||||
package com.pusong.common.json.config;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||
@ -11,6 +14,7 @@ import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilde
|
||||
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.time.LocalDateTime;
|
||||
@ -34,7 +38,17 @@ public class JacksonConfig {
|
||||
javaTimeModule.addSerializer(Long.class, BigNumberSerializer.INSTANCE);
|
||||
javaTimeModule.addSerializer(Long.TYPE, BigNumberSerializer.INSTANCE);
|
||||
javaTimeModule.addSerializer(BigInteger.class, BigNumberSerializer.INSTANCE);
|
||||
javaTimeModule.addSerializer(BigDecimal.class, ToStringSerializer.instance);
|
||||
// javaTimeModule.addSerializer(BigDecimal.class, ToStringSerializer.instance);
|
||||
//去掉最后面的0并转为字符串
|
||||
javaTimeModule.addSerializer(BigDecimal.class, new JsonSerializer<BigDecimal>() {
|
||||
@Override
|
||||
public void serialize(BigDecimal value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
|
||||
if (value != null) {
|
||||
gen.writeString(value.stripTrailingZeros().toPlainString());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(formatter));
|
||||
javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(formatter));
|
||||
|
@ -88,7 +88,7 @@ public class PsContractInfoController extends BaseController {
|
||||
/**
|
||||
* 分页查询合同列表
|
||||
*/
|
||||
@SaCheckPermission("business:contractInfo:list")
|
||||
@SaCheckPermission("business:contractInfo:LIST")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<PsContractInfoVo> list(PsContractInfoQueryBo bo, PageQuery pageQuery) {
|
||||
return psContractInfoService.queryPageList(bo, pageQuery);
|
||||
|
@ -19,6 +19,7 @@ import com.pusong.common.mybatis.core.page.PageQuery;
|
||||
import com.pusong.business.domain.vo.PsTaskMainVo;
|
||||
import com.pusong.business.service.IPsTaskService;
|
||||
import com.pusong.common.mybatis.core.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -157,6 +158,32 @@ public class PsTaskController extends BaseController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传发票
|
||||
* @param id 任务id
|
||||
* @param file 发票文件
|
||||
* @return
|
||||
*/
|
||||
@Log(title = "免费工单任务作废")
|
||||
@SaCheckPermission("business:task:list")
|
||||
@GetMapping("/invoice")
|
||||
public R<Void> taskReset(@RequestPart("file") MultipartFile file, @NotNull Long id) {
|
||||
psTaskMainService.invoice(file,id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务暂停
|
||||
* @param id 任务id
|
||||
* @return
|
||||
*/
|
||||
@Log(title = "任务暂停")
|
||||
@SaCheckPermission("business:task:list")
|
||||
@GetMapping("/pause")
|
||||
public R<Void> pause( @NotNull Long id) {
|
||||
// psTaskMainService.pause(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 导出主任务列表
|
||||
|
@ -34,10 +34,6 @@ public class PsApproverRecord extends TenantEntity {
|
||||
* 关联业务id
|
||||
*/
|
||||
private String businessId;
|
||||
/**
|
||||
* 客户来源
|
||||
*/
|
||||
private String customSource;
|
||||
/**
|
||||
* 合同编码
|
||||
*/
|
||||
|
@ -136,4 +136,9 @@ public class PsContractInfo extends TenantEntity {
|
||||
* 服务周期结束时间
|
||||
*/
|
||||
private Date endServiceDate;
|
||||
|
||||
/**
|
||||
* 是否作废
|
||||
*/
|
||||
private String isCancel;
|
||||
}
|
||||
|
@ -70,5 +70,8 @@ public class PsTaskMain extends TenantEntity {
|
||||
@TableLogic
|
||||
private Long delFlag;
|
||||
|
||||
|
||||
/**
|
||||
* 发票
|
||||
*/
|
||||
private String invoice;
|
||||
}
|
||||
|
@ -41,6 +41,10 @@ public class PsContractBusinessBo {
|
||||
*/
|
||||
@NotBlank(message = "服务类型不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String businessType;
|
||||
/**
|
||||
* 服务类型名称,生成pdf使用
|
||||
*/
|
||||
private String businessTypeName;
|
||||
|
||||
/**
|
||||
* 服务总金额
|
||||
|
@ -24,6 +24,10 @@ import java.util.List;
|
||||
@EqualsAndHashCode
|
||||
public class PsContractInfoQueryBo {
|
||||
|
||||
/**
|
||||
* 查询类型1合同列表 2待回款列表 3已汇款列表
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
||||
* 合同编码
|
||||
*/
|
||||
|
@ -190,4 +190,8 @@ public class PsContractInfoVo implements Serializable {
|
||||
* 汇款记录信息信息
|
||||
*/
|
||||
private List<PsContractPayVo> contractPayVoList;
|
||||
/**
|
||||
* 是否作废 02审批中03是04否
|
||||
*/
|
||||
private String isCancel;
|
||||
}
|
||||
|
@ -103,4 +103,9 @@ public class PsTaskMainVo implements Serializable {
|
||||
* 任务资料信息
|
||||
*/
|
||||
private List<PsTaskMediaVo> taskMediaVoList;
|
||||
|
||||
/**
|
||||
* 发票
|
||||
*/
|
||||
private String invoice;
|
||||
}
|
||||
|
@ -16,30 +16,36 @@ public enum ContractStatusEnum {
|
||||
RETURN("30","已回款(待派单处理)"),
|
||||
UPDATEAPPROVER("33","修改审批中"),
|
||||
EXECUTION("40","已派单(处理中)"),
|
||||
SUCCESS("50","已完成(任务已全部完成+回款全部完成+合同已回传)"),
|
||||
CANCELLATION("60","已作废"),
|
||||
CANAPPROVER("61","作废审批中");
|
||||
SUCCESS("50","已完成(任务已全部完成+回款全部完成+合同已回传)");
|
||||
private String code;
|
||||
private String text;
|
||||
|
||||
/**
|
||||
* 返回已回款之后的状态
|
||||
* @return
|
||||
*/
|
||||
public static List<String> getReturn(){
|
||||
return List.of(RETURN.code, UPDATEAPPROVER.code,EXECUTION.code,SUCCESS.code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否为已回款之后的合同
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public static boolean isReturn(String code){
|
||||
List<String> list = List.of(INIT.code, CREATE.code,CANCELLATION.code,CANAPPROVER.code);
|
||||
List<String> list = getReturn();
|
||||
if(StringUtils.isNotBlank(code) && list.contains(code)){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回无效合同集合
|
||||
* @return
|
||||
*/
|
||||
public static List<String> isValid(){
|
||||
return List.of(INIT.code, CANAPPROVER.code);
|
||||
return List.of(INIT.code);
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,15 @@ public enum TaskStatusEnum {
|
||||
|
||||
private String code;
|
||||
private String text;
|
||||
|
||||
/**
|
||||
* 返回已完成的任务状态
|
||||
* @return
|
||||
*/
|
||||
public static List<String> returnFinish() {
|
||||
return List.of(FINISH.code,CANCEL.code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断能否派单
|
||||
*/
|
||||
@ -36,7 +45,7 @@ public enum TaskStatusEnum {
|
||||
*/
|
||||
public static Boolean canUpload(String taskStatus){
|
||||
if(StringUtils.equals(taskStatus,FINISH.getCode())
|
||||
|| StringUtils.equals(taskStatus,OA.getCode())){
|
||||
|| StringUtils.equals(taskStatus,CANCEL.getCode())){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -47,7 +56,7 @@ public enum TaskStatusEnum {
|
||||
public static Boolean canFinish(String taskStatus){
|
||||
//不能点:作废 完成 审批中
|
||||
if(StringUtils.equals(taskStatus,CANCEL.getCode()) || StringUtils.equals(taskStatus,FINISH.getCode())
|
||||
|| StringUtils.equals(taskStatus,OA.getCode())){
|
||||
|| StringUtils.equals(taskStatus,OA.getCode())|| StringUtils.equals(taskStatus,CANCELAPPO.getCode())){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -109,6 +109,12 @@ public interface IPsContractInfoService {
|
||||
* @param businessProject 服务项目
|
||||
*/
|
||||
void freeWork(String contractCode,String businessType,String businessProject);
|
||||
|
||||
/**
|
||||
* 合同完成
|
||||
* @param contractCode 合同编码
|
||||
*/
|
||||
void finish(String contractCode);
|
||||
/**
|
||||
* 查询符合条件的合同基本信息列表
|
||||
*
|
||||
|
@ -9,6 +9,8 @@ import com.pusong.business.domain.vo.PsTaskAppointVo;
|
||||
import com.pusong.business.domain.vo.PsTaskMainVo;
|
||||
import com.pusong.common.mybatis.core.page.TableDataInfo;
|
||||
import com.pusong.common.mybatis.core.page.PageQuery;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -105,7 +107,12 @@ public interface IPsTaskService {
|
||||
* @param desc 作废原因
|
||||
*/
|
||||
void cancel(Long id,String desc);
|
||||
|
||||
/**
|
||||
* 上传发票
|
||||
* @param id 任务主表id
|
||||
* @param file 发票文件
|
||||
*/
|
||||
void invoice(MultipartFile file, @NotNull Long id);
|
||||
/* *//**
|
||||
* 查询主任务
|
||||
*
|
||||
|
@ -1,16 +1,25 @@
|
||||
package com.pusong.business.service.approver.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.pusong.business.domain.PsApproverRecord;
|
||||
import com.pusong.business.domain.PsContractInfo;
|
||||
import com.pusong.business.domain.PsTaskAppoint;
|
||||
import com.pusong.business.domain.PsTaskMain;
|
||||
import com.pusong.business.enums.ApproverTypeEnum;
|
||||
import com.pusong.business.enums.CommonStatusEnum;
|
||||
import com.pusong.business.enums.ContractStatusEnum;
|
||||
import com.pusong.business.enums.TaskStatusEnum;
|
||||
import com.pusong.business.mapper.PsTaskAppointMapper;
|
||||
import com.pusong.business.mapper.PsTaskMainMapper;
|
||||
import com.pusong.business.service.IPsContractBusinessService;
|
||||
import com.pusong.business.service.IPsContractInfoService;
|
||||
import com.pusong.business.service.IPsTaskService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 合同作废审批
|
||||
*/
|
||||
@ -23,6 +32,8 @@ public class CancellaApproverServiceImpl extends ApproverAbstractServiceImpl {
|
||||
return ApproverTypeEnum.CANCELLA.getCode();
|
||||
}
|
||||
private final IPsContractInfoService contractInfoService;
|
||||
private final PsTaskMainMapper taskMainMapper;
|
||||
private final PsTaskAppointMapper taskAppointMapper;
|
||||
|
||||
/**
|
||||
* 1 审批成功 合同作废成功,合同状态显示为【已作废】
|
||||
@ -32,8 +43,17 @@ public class CancellaApproverServiceImpl extends ApproverAbstractServiceImpl {
|
||||
public void success(PsApproverRecord psApproverRecord) {
|
||||
PsContractInfo psContractInfo = new PsContractInfo();
|
||||
psContractInfo.setContractCode(psApproverRecord.getContractCode());
|
||||
psContractInfo.setContractStatus(ContractStatusEnum.CANCELLATION.getCode());
|
||||
psContractInfo.setIsCancel(CommonStatusEnum.SUCCESS.getCode());
|
||||
contractInfoService.updateByCode(psContractInfo);
|
||||
//主任务作废
|
||||
taskMainMapper.update(Wrappers.<PsTaskMain>lambdaUpdate()
|
||||
.set(PsTaskMain::getTaskStatus,TaskStatusEnum.CANCEL)
|
||||
.eq(PsTaskMain::getContractCode, psApproverRecord.getContractCode())
|
||||
.ne(PsTaskMain::getTaskStatus,TaskStatusEnum.CANCEL));
|
||||
//子任务作废
|
||||
taskAppointMapper.update(Wrappers.<PsTaskAppoint>lambdaUpdate()
|
||||
.set(PsTaskAppoint::getAppointStatus, TaskStatusEnum.AppointStatusEnum.CANCEL.getCode())
|
||||
.eq(PsTaskAppoint::getContractCode, psApproverRecord.getContractCode()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -44,7 +64,7 @@ public class CancellaApproverServiceImpl extends ApproverAbstractServiceImpl {
|
||||
public void fail(PsApproverRecord psApproverRecord) {
|
||||
PsContractInfo info = new PsContractInfo();
|
||||
info.setContractCode(psApproverRecord.getContractCode());
|
||||
info.setContractStatus(psApproverRecord.getUpdateData());
|
||||
info.setIsCancel(CommonStatusEnum.FAIL.getCode());
|
||||
contractInfoService.updateByCode(info);
|
||||
}
|
||||
}
|
||||
|
@ -73,6 +73,7 @@ public class PayContractApproverServiceImpl extends ApproverAbstractServiceImpl
|
||||
updateInfo.setContractStatus(ContractStatusEnum.RETURN.getCode());
|
||||
psContractInfoService.updateByCode(updateInfo);
|
||||
}
|
||||
psContractInfoService.finish(psApproverRecord.getContractCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,6 +45,7 @@ public class RolbackApproverServiceImpl extends ApproverAbstractServiceImpl {
|
||||
psContractInfo.setRollBackStatus(CommonStatusEnum.SUCCESS.getCode());
|
||||
psContractInfo.setRollBackPdf(Long.valueOf(psApproverRecord.getUpdateData()));
|
||||
contractInfoService.updateByCode(psContractInfo);
|
||||
contractInfoService.finish(psContractInfo.getContractCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -8,6 +8,7 @@ import com.pusong.business.enums.ContractStatusEnum;
|
||||
import com.pusong.business.enums.TaskStatusEnum;
|
||||
import com.pusong.business.mapper.PsTaskMainMapper;
|
||||
import com.pusong.business.service.IPsContractInfoService;
|
||||
import com.pusong.business.service.impl.PsContractInfoServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -24,6 +25,7 @@ public class TaskFinishApproverServiceImpl extends ApproverAbstractServiceImpl {
|
||||
return ApproverTypeEnum.TASKFINISH.getCode();
|
||||
}
|
||||
private final PsTaskMainMapper taskMainMapper;
|
||||
private final IPsContractInfoService contractInfoService;
|
||||
|
||||
/**
|
||||
* 1 审批成功 任务的状态变为成功
|
||||
@ -34,7 +36,7 @@ public class TaskFinishApproverServiceImpl extends ApproverAbstractServiceImpl {
|
||||
PsTaskMain info = taskMainMapper.selectById(psApproverRecord.getBusinessId());
|
||||
info.setTaskStatus(TaskStatusEnum.FINISH.getCode());
|
||||
taskMainMapper.updateById(info);
|
||||
|
||||
contractInfoService.finish(info.getContractCode());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -8,6 +8,7 @@ import com.pusong.business.domain.bo.*;
|
||||
import com.pusong.business.domain.vo.*;
|
||||
import com.pusong.business.enums.*;
|
||||
import com.pusong.business.mapper.PsContractBusinessMapper;
|
||||
import com.pusong.business.mapper.PsTaskMainMapper;
|
||||
import com.pusong.business.service.*;
|
||||
import com.pusong.business.service.approver.ApproverContainer;
|
||||
import com.pusong.business.service.approver.ApproverService;
|
||||
@ -71,6 +72,7 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
private final ApproverContainer container;
|
||||
|
||||
private final IPsTaskService taskMainService;
|
||||
private final PsTaskMainMapper taskMainMapper;
|
||||
|
||||
private final ISysDictDataService dictDataService;
|
||||
public static String getContractCode(){
|
||||
@ -118,6 +120,7 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
BigDecimal sum = bo.getBusinessList().stream().map(PsContractBusinessBo::getBusinessAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
add.setContractAmount(sum);//合同总金额
|
||||
add.setContractStatus(type == 1?ContractStatusEnum.INIT.getCode():ContractStatusEnum.CREATE.getCode());//合同状态
|
||||
add.setIsCancel(CommonStatusEnum.INIT.getCode());
|
||||
baseMapper.insertOrUpdate(add);
|
||||
//4.删除所有服务类型和服务项目,.插入服务类型
|
||||
businessService.saveList(bo.getBusinessList(),add.getContractCode());
|
||||
@ -205,6 +208,14 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<PsContractInfoVo> queryPageList(PsContractInfoQueryBo bo, PageQuery pageQuery) {
|
||||
if(bo.getType() == null || bo.getType() == 1){//合同列表(要作废数据)
|
||||
}else if(bo.getType() == 2){//待回款(不要作废数据)
|
||||
bo.setInContractStatus(List.of(ContractStatusEnum.CREATE.getCode()));
|
||||
}else if (bo.getType() == 3){//已回款(要特定的作废数据)
|
||||
bo.setInContractStatus(ContractStatusEnum.getReturn());
|
||||
}else if (bo.getType() == 4){//托管续费合同
|
||||
}
|
||||
|
||||
QueryWrapper<PsContractInfo> lqw = buildQueryWrapper(bo);
|
||||
Page<PsContractInfoVo> result = baseMapper.selectPageContractList(pageQuery.build(), lqw);
|
||||
if(CollectionUtils.isEmpty(result.getRecords())){
|
||||
@ -248,6 +259,16 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
//3.插入公司信息
|
||||
companyInfoService.saveBo(bo.getCompanyInfoBo());
|
||||
//4.装填合同信息
|
||||
bo.getBusinessList().forEach(item->{
|
||||
BigDecimal mony = BigDecimal.ZERO;
|
||||
if(CollectionUtils.isNotEmpty(item.getDetailBos())){
|
||||
mony = item.getDetailBos().stream().map(PsContractBusinessDetailBo::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
}
|
||||
//服务类别填了才会修改服务项目的金额
|
||||
if(mony.compareTo(BigDecimal.ZERO) > 0){
|
||||
item.setBusinessAmount(mony);
|
||||
}
|
||||
});
|
||||
BigDecimal sum = bo.getBusinessList().stream().map(PsContractBusinessBo::getBusinessAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
bo.setContractAmount(sum);//合同总金额
|
||||
|
||||
@ -266,18 +287,6 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
PsContractInfo add = new PsContractInfo();
|
||||
MapstructUtils.convert(bo,add);
|
||||
add.setCompanyId(bo.getCompanyInfoBo().getId());//公司id
|
||||
bo.getBusinessList().forEach(item->{
|
||||
BigDecimal mony = BigDecimal.ZERO;
|
||||
if(CollectionUtils.isNotEmpty(item.getDetailBos())){
|
||||
mony = item.getDetailBos().stream().map(PsContractBusinessDetailBo::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
}
|
||||
//服务类别填了才会修改服务项目的金额
|
||||
if(mony.compareTo(BigDecimal.ZERO) > 0){
|
||||
item.setBusinessAmount(mony);
|
||||
}
|
||||
});
|
||||
|
||||
add.setContractAmount(sum);//合同总金额
|
||||
this.updateByCode(add);
|
||||
//4.删除所有服务类型和服务项目,.插入服务类型
|
||||
businessService.saveList(bo.getBusinessList(),add.getContractCode());
|
||||
@ -299,16 +308,14 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
PsContractInfoVo infoVo = this.queryContractByCode(contractCode);
|
||||
//没有任何一笔收款:点击【作废】,直接作废合同
|
||||
if(CollectionUtils.isEmpty(infoVo.getContractPayVoList())){
|
||||
info.setContractStatus(ContractStatusEnum.CANCELLATION.getCode());
|
||||
//todo (1)已派单:撤回任务派单,不在任务列表展示
|
||||
// (2)未派单:更新任务列表,不在任务列表展示
|
||||
info.setIsCancel(CommonStatusEnum.SUCCESS.getCode());
|
||||
}else{
|
||||
|
||||
if(StringUtils.isBlank(desc)){throw new ServiceException("请填写作废原因");}
|
||||
//有收款:点击【作废】填写【作废原因】后发起【作废】审批
|
||||
ApproverService service = container.getService(ApproverTypeEnum.CANCELLA.getCode());
|
||||
service.apply(contractCode,contractCode,desc, infoVo.getContractStatus());
|
||||
info.setContractStatus(ContractStatusEnum.CANAPPROVER.getCode());
|
||||
service.apply(contractCode,contractCode,desc, null);
|
||||
info.setIsCancel(CommonStatusEnum.ING.getCode());
|
||||
|
||||
}
|
||||
updateByCode(info);
|
||||
@ -335,6 +342,7 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
//没有任何退款处理:【合同列表】状态更新为【待回款】,并显示在【待回款列表】中
|
||||
info.setContractStatus(ContractStatusEnum.CREATE.getCode());
|
||||
}
|
||||
info.setIsCancel(CommonStatusEnum.INIT.getCode());
|
||||
updateByCode(info);
|
||||
return true;
|
||||
}
|
||||
@ -356,6 +364,9 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
public Long makePdf(PsContractInfo add ,PsContractInfoBo bo){
|
||||
Long ossId = null;
|
||||
SysDictData main = dictDataService.selectDict("contract_main", add.getContractMain());
|
||||
bo.getBusinessList().forEach(item->{
|
||||
item.setBusinessTypeName(dictDataService.selectDictLabel("contract_type",item.getBusinessType()));
|
||||
});
|
||||
try{
|
||||
//生成合同pdf
|
||||
PsCustomInfo customer = customInfoService.listById(add.getCustomId());
|
||||
@ -374,7 +385,8 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
map.put(PdfGenerator.HEAD,head);
|
||||
//是否签章
|
||||
map.put(PdfGenerator.SIGN,StringUtils.equals(CommonStatusEnum.SUCCESS.getCode(),add.getSignStatus()));
|
||||
String path = System.getProperty("user.dir")+"test.pdf";
|
||||
|
||||
String path = System.getProperty("user.dir")+"/"+bo.getCompanyInfoBo().getCompanyName()+"-"+add.getContractCode()+".pdf";
|
||||
log.info(JSON.toJSONString(map));
|
||||
// path = "D:/王立帅/临时/output.pdf";
|
||||
PdfGenerator.makePdf(map, path,TenplateEnum.CONTRACT.getName());
|
||||
@ -426,6 +438,28 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
service.apply(info.getContractCode(),info.getContractCode(),null, businessType+"@@"+businessProject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 合同完成
|
||||
* @param contractCode 合同编码
|
||||
*/
|
||||
public void finish(String contractCode){
|
||||
Long num = taskMainMapper.selectCount(Wrappers.<PsTaskMain>lambdaQuery()
|
||||
.eq(PsTaskMain::getContractCode, contractCode)
|
||||
.ne(PsTaskMain::getTaskType, TaskTypeEnum.INVOICE.getCode())
|
||||
.notIn(PsTaskMain::getTaskStatus, TaskStatusEnum.returnFinish()));
|
||||
PsContractInfoVo info = this.queryContractByCode(contractCode);
|
||||
//任务已完成 合同已回传 回款已结束
|
||||
if(info.getRollBackStatus().equals(CommonStatusEnum.SUCCESS.getCode())
|
||||
&& num<=0 && info.getResidualMoney().compareTo(BigDecimal.ZERO)<=0){
|
||||
PsContractInfo psContractInfo = new PsContractInfo();
|
||||
psContractInfo.setContractCode(contractCode);
|
||||
info.setContractStatus(ContractStatusEnum.SUCCESS.getCode());
|
||||
this.updateByCode(psContractInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private QueryWrapper<PsContractInfo> buildQueryWrapper(PsContractInfoQueryBo bo) {
|
||||
QueryWrapper<PsContractInfo> qw = Wrappers.query();
|
||||
//删除标志
|
||||
@ -443,7 +477,19 @@ public class PsContractInfoServiceImpl implements IPsContractInfoService {
|
||||
qw.like( StringUtils.isNotBlank(bo.getCompanyName()),"com.company_name", bo.getCompanyName());
|
||||
//用户表条件
|
||||
qw.like( StringUtils.isNotBlank(bo.getCustomManagerName()),"us.nick_name", bo.getCustomManagerName());
|
||||
|
||||
|
||||
//待回款(不要作废数据) 已回款(需要展示退款中的作废数据)
|
||||
qw.ne(bo.getType() != null && (bo.getType() == 2 || (bo.getType() == 3)),"info.is_cancel",CommonStatusEnum.SUCCESS.getCode());
|
||||
qw.or().gt(bo.getType() != null && 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");
|
||||
|
||||
qw.orderByDesc("info.create_time");
|
||||
|
||||
return qw;
|
||||
}
|
||||
private PsContractInfoVo fillContractInfo(PsContractInfoVo vo){
|
||||
|
@ -31,9 +31,11 @@ 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.system.domain.vo.SysOssVo;
|
||||
import com.pusong.system.service.ISysOssService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -43,6 +45,7 @@ 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;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
@ -208,6 +211,10 @@ public class PsTaskServiceImpl implements IPsTaskService {
|
||||
if(!TaskStatusEnum.canAppoint(mainTask.getTaskStatus())){
|
||||
throw new ServiceException("任务已完成,无法继续派单");
|
||||
}
|
||||
if(StringUtils.equals(TaskTypeEnum.INVOICE.getCode(),mainTask.getTaskType())){
|
||||
throw new ServiceException("发票任务无需派单");
|
||||
}
|
||||
|
||||
List<PsTaskAppoint> list = appointMapper.selectList(Wrappers.<PsTaskAppoint>lambdaQuery()
|
||||
.eq(PsTaskAppoint::getDelFlag,"0").eq(PsTaskAppoint::getTaskId, bo.getId())
|
||||
.eq(PsTaskAppoint::getAppointType, bo.getAppointType())
|
||||
@ -341,7 +348,19 @@ public class PsTaskServiceImpl implements IPsTaskService {
|
||||
return lqw;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上传发票
|
||||
* @param id 任务主表id
|
||||
* @param file 发票文件
|
||||
*/
|
||||
public void invoice(MultipartFile file, Long id){
|
||||
PsTaskMain info = baseMapper.selectById(id);
|
||||
if(!StringUtils.equals(TaskTypeEnum.INVOICE.getCode(),info.getTaskType())){
|
||||
throw new ServiceException("发票任务才可以上传发票");
|
||||
}
|
||||
SysOssVo vo = ossService.upload(file);
|
||||
info.setInvoice(vo.getOssId()+"");
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
|
Loading…
Reference in New Issue
Block a user