From 5506edbe54883b31db3cc8e4a1d9d0795a18a3c9 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 27 十二月 2024 14:37:54 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/2.0.1' into 2.0.1

---
 server/service/src/main/java/com/doumee/service/business/impl/InsuranceServiceImpl.java |   47 ++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 38 insertions(+), 9 deletions(-)

diff --git a/server/service/src/main/java/com/doumee/service/business/impl/InsuranceServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/InsuranceServiceImpl.java
index 04808f9..4acc4f0 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/InsuranceServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/InsuranceServiceImpl.java
@@ -1,5 +1,6 @@
 package com.doumee.service.business.impl;
 
+import com.doumee.biz.system.SystemDictDataBiz;
 import com.doumee.core.constants.ResponseStatus;
 import com.doumee.core.exception.BusinessException;
 import com.doumee.core.model.LoginUserInfo;
@@ -41,6 +42,8 @@
     private InsuranceMapper insuranceMapper;
     @Autowired
     private WorktypeMapper worktypeMapper;
+    @Autowired
+    private SystemDictDataBiz systemDictDataBiz;
 
     @Override
     @Transactional
@@ -133,6 +136,15 @@
         if(worktypeList.size()==0){
             throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝宸ョ涓嶈兘涓虹┖锛�");
         }
+        if(StringUtils.isNotBlank(insurance.getEnglishName()) && insurance.getEnglishName().length()>100){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝鑻辨枃鍚嶈秴闀匡紒");
+        }
+        if(StringUtils.isNotBlank(insurance.getLinkName()) && insurance.getLinkName().length()>10){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝鑱旂郴浜哄悕绉拌秴闀匡紒");
+        }
+        if(StringUtils.isNotBlank(insurance.getLinkPhone()) && insurance.getLinkPhone().length()!=11){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝璇疯緭鍏ユ纭殑鎵嬫満鍙凤紒");
+        }
         insurance.setWorktypeList(worktypeList);
     }
 
@@ -208,6 +220,13 @@
         updateModel.setEditDate(new Date());
         updateModel.setRemark(insurance.getRemark());
         updateModel.setSortnum(insurance.getSortnum());
+        updateModel.setLogo(insurance.getLogo());
+        updateModel.setEnglishName(insurance.getEnglishName());
+        updateModel.setLinkName(insurance.getLinkName());
+        updateModel.setLinkPhone(insurance.getLinkPhone());
+        updateModel.setPolicy(insurance.getPolicy());
+        updateModel.setAgreement(insurance.getAgreement());
+        updateModel.setClaimsInformation(insurance.getClaimsInformation());
         insuranceMapper.updateById(updateModel);
 
         //濡傛灉淇敼锛屽垯浜х敓涓�涓柊鐨勫巻鍙茬増鏈� ~
@@ -219,6 +238,13 @@
         newModel.setName(updateModel.getName());
         newModel.setBaseId(insurance.getId());
         newModel.setDataType(Constants.TWO);
+        newModel.setLogo(insurance.getLogo());
+        newModel.setEnglishName(insurance.getEnglishName());
+        newModel.setLinkName(insurance.getLinkName());
+        newModel.setLinkPhone(insurance.getLinkPhone());
+        newModel.setPolicy(insurance.getPolicy());
+        newModel.setAgreement(insurance.getAgreement());
+        newModel.setClaimsInformation(insurance.getClaimsInformation());
         insuranceMapper.insert(newModel);
 
         //鍒犻櫎鎵�鏈夊伐绉嶆暟鎹�
@@ -355,16 +381,19 @@
         if (pageWrap.getModel().getBaseId() != null) {
             queryWrapper.lambda().eq(Insurance::getBaseId, pageWrap.getModel().getBaseId());
         }
- /*       for(PageWrap.SortData sortData: pageWrap.getSorts()) {
-            if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) {
-                queryWrapper.orderByDesc(sortData.getProperty());
-            } else {
-                queryWrapper.orderByAsc(sortData.getProperty());
-            }
-
-        }*/
         queryWrapper.lambda().orderByAsc(Insurance::getSortnum);
-        return PageData.from(insuranceMapper.selectPage(page, queryWrapper));
+        PageData<Insurance> pageData = PageData.from(insuranceMapper.selectPage(page, queryWrapper));
+        if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(pageData.getRecords())){
+            String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()
+                    +systemDictDataBiz.queryByCode(Constants.OSS,Constants.INSURANCE).getCode();
+            for (Insurance insurance:pageData.getRecords()) {
+                if (StringUtils.isNotBlank(insurance.getLogo())) {
+                    insurance.setLogoFullUrl(path + insurance.getLogo() );
+                }
+            }
+        }
+
+        return pageData;
     }
 
     @Override

--
Gitblit v1.9.3