|
|
@@ -7,10 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.jzg.commons.core.base.BaseController;
|
|
|
import com.jzg.commons.core.page.HttpResult;
|
|
|
-import com.jzg.commons.entity.dto.AgreementAddParam;
|
|
|
-import com.jzg.commons.entity.dto.AgreementCopyParam;
|
|
|
-import com.jzg.commons.entity.dto.AgreementEditParam;
|
|
|
-import com.jzg.commons.entity.dto.AgreementParam;
|
|
|
+import com.jzg.commons.entity.dto.*;
|
|
|
import com.jzg.commons.entity.enums.YesNoEnum;
|
|
|
import com.jzg.commons.entity.po.*;
|
|
|
import com.jzg.commons.entity.vo.*;
|
|
|
@@ -24,7 +21,6 @@ import com.jzg.organization.service.*;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -48,7 +44,6 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
|
|
|
@Autowired
|
|
|
private PtlAgreementDeptService agreementDeptService;
|
|
|
|
|
|
- @Qualifier("baseController")
|
|
|
@Autowired
|
|
|
private BaseController baseController;
|
|
|
|
|
|
@@ -126,9 +121,10 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public boolean isExistsName(String agreementTitle, String id) {
|
|
|
+ public boolean isExistsName(String agreementTitle, String id, int isExternal) {
|
|
|
long count = this.count(new LambdaQueryWrapper<PtlAgreement>()
|
|
|
.eq(PtlAgreement::getAgreementTitle, agreementTitle)
|
|
|
+ .eq(PtlAgreement::getIsExternal, isExternal)
|
|
|
.ne(StringUtils.isNotNull(id),PtlAgreement::getId, id)
|
|
|
.eq(PtlAgreement::getIsDelete,0)
|
|
|
);
|
|
|
@@ -362,6 +358,56 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void contactAdd(AgreementContactAddParam param) {
|
|
|
+ PtlAgreement ptlAgreement = new PtlAgreement();
|
|
|
+ BeanUtils.copyProperties(param,ptlAgreement);
|
|
|
+ String sysCode = baseController.getUserSystemCode();
|
|
|
+
|
|
|
+ // 获取保险公司信息
|
|
|
+ HttpResult<EsmInsCompany> result = companyClient.findById(param.getCompanyId());
|
|
|
+ String companyCode = "";
|
|
|
+ if(result.getCode() == 200 && Objects.nonNull(result.getData())){
|
|
|
+ companyCode = result.getData().getCompanyCode();
|
|
|
+ }else{
|
|
|
+ throw new SystemException("无法获取到保险公司信息");
|
|
|
+ }
|
|
|
+ // code生成规则 系统code + 保险公司code + 时间戳
|
|
|
+ ptlAgreement.setAgreementCode(sysCode + companyCode + +System.currentTimeMillis());
|
|
|
+ ptlAgreement.setSerialNumber(0);
|
|
|
+ ptlAgreement.setIsExternal(1);
|
|
|
+ ptlAgreement.setIsEnable(YesNoEnum.NO.getCode()); // 启用
|
|
|
+
|
|
|
+ // 判断生效状态
|
|
|
+ LocalDateTime startDate = param.getStartDate();
|
|
|
+ LocalDateTime endDate = param.getEndDate();
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
+ //更新是否有效
|
|
|
+ if (now.isEqual(startDate) || (now.isAfter(startDate) && now.isBefore(endDate))) {
|
|
|
+ ptlAgreement.setValidStatus("0");
|
|
|
+ } else {
|
|
|
+ ptlAgreement.setValidStatus("1");
|
|
|
+ }
|
|
|
+ save(ptlAgreement);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void contactEdit(AgreementContactEditParam param) {
|
|
|
+ PtlAgreement ptlAgreement = new PtlAgreement();
|
|
|
+ BeanUtils.copyProperties(param,ptlAgreement);
|
|
|
+ // 判断生效状态
|
|
|
+ LocalDateTime startDate = param.getStartDate();
|
|
|
+ LocalDateTime endDate = param.getEndDate();
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
+ //更新是否有效
|
|
|
+ if (now.isEqual(startDate) || (now.isAfter(startDate) && now.isBefore(endDate))) {
|
|
|
+ ptlAgreement.setValidStatus("0");
|
|
|
+ } else {
|
|
|
+ ptlAgreement.setValidStatus("1");
|
|
|
+ }
|
|
|
+ updateById(ptlAgreement);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|