|
@@ -9,15 +9,26 @@ import com.ydtech.modules.esm.model.EsmInsCompany;
|
|
|
import com.ydtech.modules.esm.service.EsmInsCompanyService;
|
|
import com.ydtech.modules.esm.service.EsmInsCompanyService;
|
|
|
import com.ydtech.modules.protocol.dao.PtlNonCarInsuranceProductMapper;
|
|
import com.ydtech.modules.protocol.dao.PtlNonCarInsuranceProductMapper;
|
|
|
import com.ydtech.modules.protocol.entity.po.PtlNonCarInsuranceProduct;
|
|
import com.ydtech.modules.protocol.entity.po.PtlNonCarInsuranceProduct;
|
|
|
|
|
+import com.ydtech.modules.protocol.entity.po.PtlNonCarProductImg;
|
|
|
|
|
+import com.ydtech.modules.protocol.entity.po.PtlNonCarProductScheme;
|
|
|
import com.ydtech.modules.protocol.entity.vo.PtlNonCarInsuranceProductPageVo;
|
|
import com.ydtech.modules.protocol.entity.vo.PtlNonCarInsuranceProductPageVo;
|
|
|
|
|
+import com.ydtech.modules.protocol.entity.vo.PtlNonCarInsuranceProductQueryVo;
|
|
|
import com.ydtech.modules.protocol.entity.vo.PtlNonCarInsuranceProductSaveVo;
|
|
import com.ydtech.modules.protocol.entity.vo.PtlNonCarInsuranceProductSaveVo;
|
|
|
|
|
+import com.ydtech.modules.protocol.entity.vo.PtlNonCarProductSchemeVo;
|
|
|
import com.ydtech.modules.protocol.service.PtlNonCarInsuranceProductService;
|
|
import com.ydtech.modules.protocol.service.PtlNonCarInsuranceProductService;
|
|
|
|
|
+import com.ydtech.modules.protocol.service.PtlNonCarProductImgService;
|
|
|
|
|
+import com.ydtech.modules.protocol.service.PtlNonCarProductSchemeService;
|
|
|
import com.ydtech.modules.protocol.utils.AssertionUtils;
|
|
import com.ydtech.modules.protocol.utils.AssertionUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
+import com.ydtech.utils.StringUtils;
|
|
|
|
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Collections;
|
|
import java.util.Collections;
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -30,9 +41,13 @@ public class PtlNonCarInsuranceProductServiceImpl extends ServiceImpl<PtlNonCarI
|
|
|
implements PtlNonCarInsuranceProductService {
|
|
implements PtlNonCarInsuranceProductService {
|
|
|
|
|
|
|
|
private final EsmInsCompanyService esmInsCompanyService;
|
|
private final EsmInsCompanyService esmInsCompanyService;
|
|
|
|
|
+ private final PtlNonCarProductImgService ptlNonCarProductImgService;
|
|
|
|
|
+ private final PtlNonCarProductSchemeService ptlNonCarProductSchemeService;
|
|
|
|
|
|
|
|
- public PtlNonCarInsuranceProductServiceImpl(EsmInsCompanyService esmInsCompanyService) {
|
|
|
|
|
|
|
+ public PtlNonCarInsuranceProductServiceImpl(EsmInsCompanyService esmInsCompanyService,PtlNonCarProductImgService ptlNonCarProductImgService,PtlNonCarProductSchemeService ptlNonCarProductSchemeService) {
|
|
|
this.esmInsCompanyService = esmInsCompanyService;
|
|
this.esmInsCompanyService = esmInsCompanyService;
|
|
|
|
|
+ this.ptlNonCarProductImgService = ptlNonCarProductImgService;
|
|
|
|
|
+ this.ptlNonCarProductSchemeService=ptlNonCarProductSchemeService;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -43,6 +58,12 @@ public class PtlNonCarInsuranceProductServiceImpl extends ServiceImpl<PtlNonCarI
|
|
|
|
|
|
|
|
// 获取最新的流水单号
|
|
// 获取最新的流水单号
|
|
|
LambdaQueryWrapper<PtlNonCarInsuranceProduct> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<PtlNonCarInsuranceProduct> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+
|
|
|
|
|
+ String code = esmInsCompany.getCode();
|
|
|
|
|
+ String insuranceCode = nonCarInsuranceProduct.getInsuranceCode();
|
|
|
|
|
+ String keyTemp=code+insuranceCode;
|
|
|
|
|
+ //按照保司+险类做前缀查询最大次数
|
|
|
|
|
+ wrapper.like(PtlNonCarInsuranceProduct::getProductCode,keyTemp);
|
|
|
wrapper.orderByDesc(PtlNonCarInsuranceProduct::getId).last("limit 1");
|
|
wrapper.orderByDesc(PtlNonCarInsuranceProduct::getId).last("limit 1");
|
|
|
PtlNonCarInsuranceProduct entity = getOne(wrapper);
|
|
PtlNonCarInsuranceProduct entity = getOne(wrapper);
|
|
|
|
|
|
|
@@ -56,21 +77,39 @@ public class PtlNonCarInsuranceProductServiceImpl extends ServiceImpl<PtlNonCarI
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 产品代码 保司代码+险类代码+三位流水号,系统根据规则默认带出
|
|
// 产品代码 保司代码+险类代码+三位流水号,系统根据规则默认带出
|
|
|
- String code = esmInsCompany.getCode();
|
|
|
|
|
- String insuranceCode = nonCarInsuranceProduct.getInsuranceCode();
|
|
|
|
|
String productCode = code + insuranceCode + serialNumber;
|
|
String productCode = code + insuranceCode + serialNumber;
|
|
|
|
|
|
|
|
ptlNonCarInsuranceProduct.setProductCode(productCode);
|
|
ptlNonCarInsuranceProduct.setProductCode(productCode);
|
|
|
|
|
+ ptlNonCarInsuranceProduct.setSaveDate(new Date());
|
|
|
boolean b = save(ptlNonCarInsuranceProduct);
|
|
boolean b = save(ptlNonCarInsuranceProduct);
|
|
|
AssertionUtils.isSucceed(b, "保存失败");
|
|
AssertionUtils.isSucceed(b, "保存失败");
|
|
|
return HttpResult.ok("保存成功");
|
|
return HttpResult.ok("保存成功");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @Transactional
|
|
|
public HttpResult<Object> reviseNonCarInsuranceProduct(String productId, PtlNonCarInsuranceProductSaveVo nonCarInsuranceProduct) {
|
|
public HttpResult<Object> reviseNonCarInsuranceProduct(String productId, PtlNonCarInsuranceProductSaveVo nonCarInsuranceProduct) {
|
|
|
- PtlNonCarInsuranceProduct nonCar = getByProductId(productId);
|
|
|
|
|
|
|
+ PtlNonCarInsuranceProduct nonCar = getById(productId);
|
|
|
BeanUtils.copyProperties(nonCarInsuranceProduct, nonCar);
|
|
BeanUtils.copyProperties(nonCarInsuranceProduct, nonCar);
|
|
|
|
|
+ nonCar.setSaveDate(new Date());
|
|
|
boolean b = updateById(nonCar);
|
|
boolean b = updateById(nonCar);
|
|
|
|
|
+ //修改插入非车产品图片表
|
|
|
|
|
+ List<String> imgUrlList= nonCarInsuranceProduct.getProductImage();
|
|
|
|
|
+ List<PtlNonCarProductImg> imgList=new ArrayList<>();
|
|
|
|
|
+ if(imgUrlList!=null){
|
|
|
|
|
+ for(int i=0;i<imgUrlList.size();i++){
|
|
|
|
|
+ PtlNonCarProductImg tempImgDto=new PtlNonCarProductImg();
|
|
|
|
|
+ tempImgDto.setProductCode(nonCarInsuranceProduct.getProductCode());
|
|
|
|
|
+ tempImgDto.setSerialNo(String.valueOf(i));
|
|
|
|
|
+ tempImgDto.setProductImage(imgUrlList.get(i));
|
|
|
|
|
+ imgList.add(tempImgDto);
|
|
|
|
|
+ }
|
|
|
|
|
+ ptlNonCarProductImgService.saveBatchImg(nonCarInsuranceProduct.getProductCode(),imgList);;
|
|
|
|
|
+ }
|
|
|
|
|
+ //方案配置信息进行存储
|
|
|
|
|
+ if(nonCarInsuranceProduct.getSchemeInfo()!=null){
|
|
|
|
|
+ ptlNonCarProductSchemeService.saveBatchSchemeInfo(nonCarInsuranceProduct.getProductCode(),nonCarInsuranceProduct.getSchemeInfo());
|
|
|
|
|
+ }
|
|
|
AssertionUtils.isSucceed(b, "修改失败");
|
|
AssertionUtils.isSucceed(b, "修改失败");
|
|
|
return HttpResult.ok("修改成功");
|
|
return HttpResult.ok("修改成功");
|
|
|
}
|
|
}
|
|
@@ -87,7 +126,15 @@ public class PtlNonCarInsuranceProductServiceImpl extends ServiceImpl<PtlNonCarI
|
|
|
Integer pageNum = ptlNonCarInsuranceProductPageVo.getPageNum();
|
|
Integer pageNum = ptlNonCarInsuranceProductPageVo.getPageNum();
|
|
|
Integer pageSize = ptlNonCarInsuranceProductPageVo.getPageSize();
|
|
Integer pageSize = ptlNonCarInsuranceProductPageVo.getPageSize();
|
|
|
Page<PtlNonCarInsuranceProduct> ptlAgreementPage = new Page<>(pageNum, pageSize);
|
|
Page<PtlNonCarInsuranceProduct> ptlAgreementPage = new Page<>(pageNum, pageSize);
|
|
|
- Page<PtlNonCarInsuranceProduct> agreementPage = page(ptlAgreementPage);
|
|
|
|
|
|
|
+ LambdaQueryWrapper<PtlNonCarInsuranceProduct> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ wrapper.eq(StringUtils.isNotEmpty(ptlNonCarInsuranceProductPageVo.getProductCode()),PtlNonCarInsuranceProduct::getProductCode,ptlNonCarInsuranceProductPageVo.getProductCode());
|
|
|
|
|
+ wrapper.like(StringUtils.isNotEmpty(ptlNonCarInsuranceProductPageVo.getProductName()),PtlNonCarInsuranceProduct::getProductName,ptlNonCarInsuranceProductPageVo.getProductName());
|
|
|
|
|
+ wrapper.eq(StringUtils.isNotEmpty(ptlNonCarInsuranceProductPageVo.getInsuranceCode()),PtlNonCarInsuranceProduct::getInsuranceCode,ptlNonCarInsuranceProductPageVo.getInsuranceCode());
|
|
|
|
|
+ wrapper.eq(StringUtils.isNotEmpty(ptlNonCarInsuranceProductPageVo.getCompanyId()),PtlNonCarInsuranceProduct::getCompanyId,ptlNonCarInsuranceProductPageVo.getCompanyId());
|
|
|
|
|
+ wrapper.eq(StringUtils.isNotEmpty(ptlNonCarInsuranceProductPageVo.getIsEffective()),PtlNonCarInsuranceProduct::getIsEffective,ptlNonCarInsuranceProductPageVo.getIsEffective());
|
|
|
|
|
+ wrapper.ge(StringUtils.isNotEmpty(ptlNonCarInsuranceProductPageVo.getValidStartDate()),PtlNonCarInsuranceProduct::getValidStartDate,ptlNonCarInsuranceProductPageVo.getValidStartDate()); //表中起期大于等于录入条件中起期
|
|
|
|
|
+ wrapper.le(StringUtils.isNotEmpty(ptlNonCarInsuranceProductPageVo.getValidEndDate()),PtlNonCarInsuranceProduct::getValidEndDate,ptlNonCarInsuranceProductPageVo.getValidEndDate()); //表中止期小于等于录入条件中止期
|
|
|
|
|
+ Page<PtlNonCarInsuranceProduct> agreementPage = page(ptlAgreementPage,wrapper);
|
|
|
PageResult<PtlNonCarInsuranceProduct> ptlAgreementPageResult = new PageResult<>(pageNum, pageSize, (int) agreementPage.getTotal(), agreementPage.getRecords());
|
|
PageResult<PtlNonCarInsuranceProduct> ptlAgreementPageResult = new PageResult<>(pageNum, pageSize, (int) agreementPage.getTotal(), agreementPage.getRecords());
|
|
|
return HttpResult.ok(ptlAgreementPageResult);
|
|
return HttpResult.ok(ptlAgreementPageResult);
|
|
|
}
|
|
}
|
|
@@ -104,4 +151,20 @@ public class PtlNonCarInsuranceProductServiceImpl extends ServiceImpl<PtlNonCarI
|
|
|
return HttpResult.ok(Collections.emptyList());
|
|
return HttpResult.ok(Collections.emptyList());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public HttpResult<PtlNonCarInsuranceProductQueryVo> getByProductId(String productId) {
|
|
|
|
|
+ PtlNonCarInsuranceProductQueryVo resultVo=new PtlNonCarInsuranceProductQueryVo();
|
|
|
|
|
+ //获取产品主表
|
|
|
|
|
+ PtlNonCarInsuranceProduct nonCarInsuranceProduct = getById(productId);
|
|
|
|
|
+ resultVo.setPtlNonCarInsuranceProduct(nonCarInsuranceProduct);
|
|
|
|
|
+ //获取产品图片表
|
|
|
|
|
+ List<PtlNonCarProductImg> productImgs=ptlNonCarProductImgService.findAllProductImgs(nonCarInsuranceProduct.getProductCode());
|
|
|
|
|
+ resultVo.setProductImgs(productImgs);
|
|
|
|
|
+ //获取方案配置信息
|
|
|
|
|
+ List<PtlNonCarProductSchemeVo> schemesList=ptlNonCarProductSchemeService.findAllProductSchemeInfo(nonCarInsuranceProduct.getProductCode());
|
|
|
|
|
+ resultVo.setSchemeInfo(schemesList);
|
|
|
|
|
+ AssertionUtils.isEmpty(nonCarInsuranceProduct, "没有此非车产品");
|
|
|
|
|
+ return HttpResult.ok(resultVo);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|