Browse Source

新增修改文记录入职

anderx 8 months ago
parent
commit
750a06cac2

+ 46 - 7
src/main/java/com/goafanti/Interview/service/impl/UserArchivesInterviewServiceImpl.java

@@ -3,19 +3,16 @@ package com.goafanti.Interview.service.impl;
 import com.goafanti.Interview.bo.OutPublicAidUid;
 import com.goafanti.Interview.bo.UpdateUserBo;
 import com.goafanti.Interview.service.UserArchivesInterviewService;
-import com.goafanti.common.dao.PublicReleaseMapper;
-import com.goafanti.common.dao.UserArchivesInterviewMapper;
-import com.goafanti.common.dao.UserArchivesMapper;
-import com.goafanti.common.dao.UserFirstInterviewMapper;
-import com.goafanti.common.model.UserArchives;
-import com.goafanti.common.model.UserArchivesInterview;
-import com.goafanti.common.model.UserFirstInterview;
+import com.goafanti.common.dao.*;
+import com.goafanti.common.model.*;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.customer.bo.MyUserDetailsBo;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.math.BigDecimal;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -35,6 +32,8 @@ public class UserArchivesInterviewServiceImpl extends BaseMybatisDao<UserArchive
     private PublicReleaseMapper publicReleaseMapper;
     @Resource
     private UserFirstInterviewMapper userFirstInterviewMapper;
+    @Resource
+    private UserDataLogMapper userDataLogMapper;
 
     @Override
     public Pagination<UserArchivesInterview> list(UserArchivesInterview userArchivesInterview, Integer pageNo, Integer pageSize) {
@@ -113,6 +112,7 @@ public class UserArchivesInterviewServiceImpl extends BaseMybatisDao<UserArchive
             in.setId(userArchives.getId());
         }
         if (in.getId()!=null){
+            addUserDataLog(userArchives,in);
             userArchivesMapper.update(in);
         }else {
             in.setEarlyCommunication(null);
@@ -123,6 +123,45 @@ public class UserArchivesInterviewServiceImpl extends BaseMybatisDao<UserArchive
         return in;
     }
 
+    private void addUserDataLog(UserArchives use, UpdateUserBo in) {
+        Admin adminToken = TokenManager.getAdminToken();
+        String name= adminToken.getName();
+        StringBuilder str=new StringBuilder(name).append("修改了");
+        int length = str.length();
+        addPramUserDataLog(use, in, str);
+
+        if ((str.length()-length)>4){
+            userDataLogMapper.insert(new UserDataLog(use.getUid(),str.toString()));
+        }
+    }
+
+    private void addPramUserDataLog(UserArchives use, UpdateUserBo in, StringBuilder sb) {
+        JudgePram(sb,use.getCompanyCount(),in.getCompanyCount(),"母/子公司数");
+        JudgePram(sb,use.getSocialSecurityCount(),in.getSocialSecurityCount(),"社保人数");
+        JudgePram(sb,use.getExternalInvestCount(),in.getExternalInvestCount(),"对外投资控股的企业数");
+        JudgePram(sb,use.getExternalInvestIndustryName(),in.getExternalInvestIndustryName(),"对外投资控股的行业");
+        JudgePram(sb,use.getExternalInvestName(),in.getExternalInvestName(),"对外投资控股的企业");
+        JudgePram(sb,use.getFinancialRevenue(),in.getFinancialRevenue(),"财务数据-营收(万元)");
+        JudgePram(sb,use.getFinancialTax(),in.getFinancialTax(),"财务数据-税收(万元)");
+        JudgePram(sb,use.getFinancialProperty(),in.getFinancialProperty(),"财务数据-资产(万元)");
+        JudgePram(sb,use.getFinancialRd(),in.getFinancialRd(),"财务数据-研发费用(万元)");
+    }
+
+    private void JudgePram(StringBuilder sb,Object use, Object in, String name) {
+        if (use instanceof String){
+            if (!Objects.equals(use,in)) {
+                sb.append(name).append("[").append(use).append("=> ").append(in).append("];");
+            }
+        }
+        if (use instanceof BigDecimal){
+            BigDecimal inDb = BigDecimal.valueOf(Double.parseDouble(in.toString()));
+            if (inDb.compareTo((BigDecimal) use)!=0) {
+                sb.append(name).append("[").append(use).append("=> ").append(inDb).append("];");
+            }
+
+        }
+
+    }
 
 
     private void addUserArchivesInterview(UpdateUserBo in) {