Browse Source

报销开发子报销列表新增字段

anderx 2 years ago
parent
commit
7d16f71143

+ 51 - 0
src/main/java/com/goafanti/expenseAccount/Enums/EATypes.java

@@ -0,0 +1,51 @@
+package com.goafanti.expenseAccount.Enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum EATypes {
+
+    QT(0,"其他"),
+    CLF(1,"差旅费"),
+    FYWBX(2,"非业务报销"),
+    DSFFK(3,"第三方付款"),
+    SQJZ(4,"申请借支"),
+    DQ(5,"抵扣");
+    private Integer code;
+    private String desc;
+
+    EATypes(Integer code, String desc){
+        this.code = code;
+        this.desc = desc;
+    }
+    private static Map<Integer,EATypes> status =new HashMap<>();
+
+    static {
+        for (EATypes e:EATypes.values()){
+            status.put(e.getCode(),e);
+        }
+    }
+    public static String getDescByCode(Integer code){
+        for (EATypes value : EATypes.values()) {
+            if (value.getCode() == code)return value.getDesc();
+        }
+        return "";
+    }
+
+
+    public Integer getCode() {
+        return code;
+    }
+
+    public void setCode(Integer code) {
+        this.code = code;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+    public void setDesc(String desc) {
+        this.desc = desc;
+    }
+}

+ 50 - 0
src/main/java/com/goafanti/expenseAccount/Enums/EAsecondaryTypes.java

@@ -0,0 +1,50 @@
+package com.goafanti.expenseAccount.Enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum EAsecondaryTypes {
+    ZDF(8,"招待费"),
+    BGF(9,"办公费"),
+    FLF(10,"福利费"),
+    WYSDF(11,"物业水电费"),
+    DYF(12,"打印费"),
+    QT(13,"其他");
+
+    private Integer code;
+    private String desc;
+
+    EAsecondaryTypes(Integer code, String desc){
+        this.code = code;
+        this.desc = desc;
+    }
+    private static Map<Integer, EAsecondaryTypes> status=new HashMap<Integer, EAsecondaryTypes>();
+
+    static {
+        for (EAsecondaryTypes value : EAsecondaryTypes.values()) {
+            status.put(value.code, value);
+        }
+    }
+    public static String getDescByCode(Integer code){
+        for (EATypes value : EATypes.values()) {
+            if (value.getCode() == code)return value.getDesc();
+        }
+        return "";
+    }
+
+    public Integer getCode() {
+        return code;
+    }
+
+    public void setCode(Integer code) {
+        this.code = code;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+    public void setDesc(String desc) {
+        this.desc = desc;
+    }
+}

+ 24 - 7
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -20,6 +20,8 @@ import com.goafanti.core.mybatis.JDBCIdGenerator;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.expenseAccount.Enums.EAProcessStatus;
+import com.goafanti.expenseAccount.Enums.EATypes;
+import com.goafanti.expenseAccount.Enums.EAsecondaryTypes;
 import com.goafanti.expenseAccount.bo.*;
 import com.goafanti.expenseAccount.service.ExpenseAccountService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -30,7 +32,6 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.util.*;
-import java.util.concurrent.atomic.AtomicReference;
 
 @Service
 public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapper> implements ExpenseAccountService {
@@ -708,13 +709,29 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         in.setPayDep(admin.getDepartmentId());
         Integer eaaid = expenseAccountPrivateMapper.selectByaidDefault(TokenManager.getAdminId());
         in.setEaaid(eaaid);
-        AtomicReference<BigDecimal> count = new AtomicReference<>(new BigDecimal(0));
-        list.stream().forEach(e -> {
-            count.set(count.get().add(e.getTotalAmount()));
-        });
-        in.setTotalAmount(count.get());
-        in.setRealAmount(count.get());
+        BigDecimal count = new BigDecimal(0);
+        List<String> typeList = new ArrayList<String>();
+        for (ExpenseAccount e : list) {
+            count.add(e.getTotalAmount());
+            StringBuffer types=new StringBuffer();
+            if (e.getType()!=0){
+                types=types.append(EATypes.getDescByCode(e.getType()));
+            }else {
+                types=types.append(e.getTypeOther());
+            }
+            if (e.getSecondaryType()!=0){
+                if (e.getSecondaryType()==13){
+                    types=types.append(e.getSecondaryTypeOther());
+                }else{
+                    types=types.append(EAsecondaryTypes.getDescByCode(e.getSecondaryType()));
+                }
+            }
+            if (typeList.contains(types.toString()))typeList.add(types.toString());
+        }
+        in.setTotalAmount(count);
+        in.setRealAmount(count);
         in.setExpenseMain(1);
+        in.setTypeOther(String.join(",",typeList));
         expenseAccountMapper.insertSelective(in);
         list.stream().forEach(e -> {
             ExpenseRelationship er=new ExpenseRelationship();