|
@@ -13,6 +13,7 @@ import com.ydtech.modules.protocol.entity.constants.PtlApiType;
|
|
|
import com.ydtech.modules.protocol.entity.dto.PtlInsAttributionTemplateQueryDto;
|
|
import com.ydtech.modules.protocol.entity.dto.PtlInsAttributionTemplateQueryDto;
|
|
|
import com.ydtech.modules.protocol.entity.po.PtlCrawlerApi;
|
|
import com.ydtech.modules.protocol.entity.po.PtlCrawlerApi;
|
|
|
import com.ydtech.modules.protocol.entity.po.PtlInsAttributionTemplate;
|
|
import com.ydtech.modules.protocol.entity.po.PtlInsAttributionTemplate;
|
|
|
|
|
+import com.ydtech.modules.protocol.entity.vo.PtlCrawlerApiSaveVo;
|
|
|
import com.ydtech.modules.protocol.entity.vo.PtlInsAttributionTemplateQueryVo;
|
|
import com.ydtech.modules.protocol.entity.vo.PtlInsAttributionTemplateQueryVo;
|
|
|
import com.ydtech.modules.protocol.entity.vo.PtlInsAttributionTemplateSaveVo;
|
|
import com.ydtech.modules.protocol.entity.vo.PtlInsAttributionTemplateSaveVo;
|
|
|
import com.ydtech.modules.protocol.entity.vo.PtlInsAttributionTemplateVo;
|
|
import com.ydtech.modules.protocol.entity.vo.PtlInsAttributionTemplateVo;
|
|
@@ -104,7 +105,8 @@ public class PtlInsAttributionTemplateServiceImpl extends ServiceImpl<PtlInsAttr
|
|
|
public HttpResult<BasePageResult<PtlInsAttributionTemplate>> getAll(PtlInsAttributionTemplateQueryVo queryVo) {
|
|
public HttpResult<BasePageResult<PtlInsAttributionTemplate>> getAll(PtlInsAttributionTemplateQueryVo queryVo) {
|
|
|
Page<PtlInsAttributionTemplate> pageQuery = new Page<>(queryVo.getPageNum(), queryVo.getPageSize());
|
|
Page<PtlInsAttributionTemplate> pageQuery = new Page<>(queryVo.getPageNum(), queryVo.getPageSize());
|
|
|
LambdaQueryWrapper<PtlInsAttributionTemplate> queryWrapper = new LambdaQueryWrapper<PtlInsAttributionTemplate>()
|
|
LambdaQueryWrapper<PtlInsAttributionTemplate> queryWrapper = new LambdaQueryWrapper<PtlInsAttributionTemplate>()
|
|
|
- .eq(!StringUtils.isNullOrEmpty(queryVo.getInsCompanyId()), PtlInsAttributionTemplate::getInsCompanyId, queryVo.getInsCompanyId());
|
|
|
|
|
|
|
+ .eq(!StringUtils.isNullOrEmpty(queryVo.getInsCompanyId()), PtlInsAttributionTemplate::getInsCompanyId, queryVo.getInsCompanyId())
|
|
|
|
|
+ .eq(!StringUtils.isNullOrEmpty(queryVo.getApiType()), PtlInsAttributionTemplate::getApiType, queryVo.getApiType());
|
|
|
Page<PtlInsAttributionTemplate> page = page(pageQuery, queryWrapper);
|
|
Page<PtlInsAttributionTemplate> page = page(pageQuery, queryWrapper);
|
|
|
BasePageResult<PtlInsAttributionTemplate> pageResult = new BasePageResult<>(queryVo.getPageNum(), page.getSize(), page.getTotal(), page.getPages(), page.getRecords());
|
|
BasePageResult<PtlInsAttributionTemplate> pageResult = new BasePageResult<>(queryVo.getPageNum(), page.getSize(), page.getTotal(), page.getPages(), page.getRecords());
|
|
|
return HttpResult.ok("succeed", pageResult);
|
|
return HttpResult.ok("succeed", pageResult);
|
|
@@ -127,13 +129,23 @@ public class PtlInsAttributionTemplateServiceImpl extends ServiceImpl<PtlInsAttr
|
|
|
EsmInsCompany esmInsCompany = esmInsCompanyService.isExists(ptlInsAttributionTemplateSaveVo.getInsCompanyId());
|
|
EsmInsCompany esmInsCompany = esmInsCompanyService.isExists(ptlInsAttributionTemplateSaveVo.getInsCompanyId());
|
|
|
PtlInsAttributionTemplate ptlInsAttributionTemplate = new PtlInsAttributionTemplate(ptlInsAttributionTemplateSaveVo, esmInsCompany.getNamesimple());
|
|
PtlInsAttributionTemplate ptlInsAttributionTemplate = new PtlInsAttributionTemplate(ptlInsAttributionTemplateSaveVo, esmInsCompany.getNamesimple());
|
|
|
ptlInsAttributionTemplate.setId(id);
|
|
ptlInsAttributionTemplate.setId(id);
|
|
|
-
|
|
|
|
|
LambdaQueryWrapper<PtlInsAttributionTemplate> wrapper = byInsCompanyIdAndApiType(ptlInsAttributionTemplateSaveVo.getInsCompanyId(), ptlInsAttributionTemplateSaveVo.getApiType());
|
|
LambdaQueryWrapper<PtlInsAttributionTemplate> wrapper = byInsCompanyIdAndApiType(ptlInsAttributionTemplateSaveVo.getInsCompanyId(), ptlInsAttributionTemplateSaveVo.getApiType());
|
|
|
PtlInsAttributionTemplate ptlInsAttributionTemplateOne = getOne(wrapper);
|
|
PtlInsAttributionTemplate ptlInsAttributionTemplateOne = getOne(wrapper);
|
|
|
if (!ObjectUtils.isEmpty(ptlInsAttributionTemplateOne) && !Objects.equals(ptlInsAttributionTemplateOne.getId(), id)) {
|
|
if (!ObjectUtils.isEmpty(ptlInsAttributionTemplateOne) && !Objects.equals(ptlInsAttributionTemplateOne.getId(), id)) {
|
|
|
throw new SystemException("一个保险公司,一种api方式只能配置一种");
|
|
throw new SystemException("一个保险公司,一种api方式只能配置一种");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (PtlApiType.PTL_API_2.getCode() == ptlInsAttributionTemplateSaveVo.getApiType()) {
|
|
|
|
|
+ LambdaQueryWrapper<PtlCrawlerApi> crawlerApiWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ crawlerApiWrapper.eq(PtlCrawlerApi::getTemplateId, ptlInsAttributionTemplate.getId());
|
|
|
|
|
+ ptlCrawlerApiService.remove(crawlerApiWrapper);
|
|
|
|
|
+
|
|
|
|
|
+ // 保存请求链接
|
|
|
|
|
+ List<PtlCrawlerApi> ptlCrawlerApiList = PtlCrawlerApi.toPtlCrawlerApiList(ptlInsAttributionTemplate.getId(), ptlInsAttributionTemplateSaveVo.getApi());
|
|
|
|
|
+ boolean b = ptlCrawlerApiService.saveBatch(ptlCrawlerApiList);
|
|
|
|
|
+ AssertionUtils.isSucceed(b, "保险公司api请求插入失败");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
boolean b = updateById(ptlInsAttributionTemplate);
|
|
boolean b = updateById(ptlInsAttributionTemplate);
|
|
|
AssertionUtils.isSucceed(b, "保险公司归属信息模板修改失败");
|
|
AssertionUtils.isSucceed(b, "保险公司归属信息模板修改失败");
|
|
|
return HttpResult.ok("修改成功");
|
|
return HttpResult.ok("修改成功");
|