From a4a5677e4b55dc3de91866e64ca5c977c399c7aa Mon Sep 17 00:00:00 2001
From: jiaosong <jiaosong6760@dingtalk.com>
Date: 星期一, 14 八月 2023 19:03:08 +0800
Subject: [PATCH] # 工资表配置表 联调修改

---
 server/src/main/java/doumeemes/service/business/impl/SalaryParamServiceImpl.java |   54 +++++++++++++++++++++++++++++++++++++++++++++---------
 server/src/main/resources/mappers/SalaryParamMapper.xml                          |    2 +-
 server/src/main/java/doumeemes/dao/business/model/SalaryParam.java               |    2 +-
 3 files changed, 47 insertions(+), 11 deletions(-)

diff --git a/server/src/main/java/doumeemes/dao/business/model/SalaryParam.java b/server/src/main/java/doumeemes/dao/business/model/SalaryParam.java
index 19f8762..9b815db 100644
--- a/server/src/main/java/doumeemes/dao/business/model/SalaryParam.java
+++ b/server/src/main/java/doumeemes/dao/business/model/SalaryParam.java
@@ -83,7 +83,7 @@
 
     @ApiModelProperty(value = "鏍囧噯鏃堕暱锛堢锛�")
     @ExcelColumn(name="鏍囧噯鏃堕暱锛堢锛�")
-    private String times;
+    private Integer times;
 
     @ApiModelProperty(value = "涓嶈壇鍝佹槸鍚﹁鍏� 0鍚� 1鏄�")
     @ExcelColumn(name="涓嶈壇鍝佹槸鍚﹁鍏� 0鍚� 1鏄�")
diff --git a/server/src/main/java/doumeemes/service/business/impl/SalaryParamServiceImpl.java b/server/src/main/java/doumeemes/service/business/impl/SalaryParamServiceImpl.java
index 95da0cb..7d63f71 100644
--- a/server/src/main/java/doumeemes/service/business/impl/SalaryParamServiceImpl.java
+++ b/server/src/main/java/doumeemes/service/business/impl/SalaryParamServiceImpl.java
@@ -29,10 +29,8 @@
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.multipart.MultipartFile;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Objects;
+import java.math.BigDecimal;
+import java.util.*;
 
 /**
  * 璁剧疆绫�-缁╂晥宸ヨ祫閰嶇疆琛⊿ervice瀹炵幇
@@ -228,13 +226,51 @@
             salaryParam.setProcedureId(procedures.getId());
             salaryParam.setMaterialId(material.getId());
             salaryParam.setSalary(salaryParamImportDTO.getSalary());
-            salaryParam.setNum(salaryParamImportDTO.getNUM());
-            //todo
-//            salaryParam.setTimes();
-//            salaryParam.setUnqualified(salaryParamImportDTO.getUnqualified() );
-//            salaryParam.setType(salaryParamImportDTO.getType());
+            salaryParam.setNum(new BigDecimal(salaryParamImportDTO.getNUM()));
+
+            salaryParam.setTimes(getIntegerTimes(salaryParamImportDTO.getTimesName()));
+
+            Integer unqualified = Optional.ofNullable(salaryParamImportDTO.getUnqualified()).map(s -> {
+                if ("鍚�".equals(s)) {
+                    return 0;
+                } else {
+                    return 1;
+                }
+            }).orElse(0);
+            salaryParam.setUnqualified(unqualified);
+
+            Integer type = Optional.ofNullable(salaryParamImportDTO.getUnqualified()).map(s -> {
+                if ("璁′欢".equals(s)) {
+                    return 0;
+                } else {
+                    return 1;
+                }
+            }).orElse(0);
+            salaryParam.setType(type);
             create(salaryParam);
         }
 
     }
+
+    private Integer getIntegerTimes(String a) {
+        int h =0,m=0,s=0;
+        try{
+            int hIndex =a.lastIndexOf("灏忔椂");
+            int mIndex=a.lastIndexOf("鍒嗛挓");
+            int sIndex =a.lastIndexOf("绉�");
+            if( hIndex>0){
+                h = Integer.parseInt(a.substring(0,hIndex));
+            }
+            if(mIndex > hIndex){
+                m = Integer.parseInt(a.substring(hIndex >=0?hIndex+2:0,mIndex));
+            }
+            if(sIndex > mIndex){
+               s = Integer.parseInt(a.substring(mIndex >=0?mIndex+2:0,mIndex));
+            }
+            return  h*3600+m*60+s;
+        }catch (Exception e){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝鏃堕暱銆�"+a+"銆戞牸寮忎笉姝g‘锛�" );
+        }
+
+    }
 }
diff --git a/server/src/main/resources/mappers/SalaryParamMapper.xml b/server/src/main/resources/mappers/SalaryParamMapper.xml
index 45c8024..e97d95f 100644
--- a/server/src/main/resources/mappers/SalaryParamMapper.xml
+++ b/server/src/main/resources/mappers/SalaryParamMapper.xml
@@ -18,7 +18,7 @@
         where
         sp.DELETED = 0
         <if test="model.keyWord != null and model.keyWord != ''">
-           ( and  p`NAME` like concat('%',#{model.keyWord},'%')
+           and  ( p`NAME` like concat('%',#{model.keyWord},'%')
             or   p.`CODE` = #{model.keyWord})</if>
         <if test="model.procedureName != null and model.procedureName != ''"> and p.`NAME` like concat('%',#{model.procedureName},'%')</if>
         <if test="model.type != null"> and sp.`TYPE` = #{model.type}</if>

--
Gitblit v1.9.3