Browse Source

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

Min 10 months ago
parent
commit
b29be03903

+ 70 - 47
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/BusinessOpportunityController.java

@@ -6,8 +6,10 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.management.platform.entity.*;
 import com.management.platform.mapper.BusinessOpportunityMapper;
+import com.management.platform.mapper.ClueMapper;
 import com.management.platform.mapper.SysFormMapper;
 import com.management.platform.mapper.UserMapper;
 import com.management.platform.service.*;
@@ -24,6 +26,7 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.text.SimpleDateFormat;
 import java.util.*;
 
 /**
@@ -41,6 +44,8 @@ public class BusinessOpportunityController {
     private ExcelExportServiceImpl excelExportService;
     @Resource
     private SysFormMapper sysFormMapper;
+    @Resource
+    private ClueMapper clueMapper;
     @Autowired
     private WxCorpInfoService wxCorpInfoService;
     @Resource
@@ -95,61 +100,75 @@ public class BusinessOpportunityController {
         JSONArray configObJSONArray = configOb.getJSONArray("list");
         List<List<String>> dataList=new ArrayList<>();
         List<String> titleList=new ArrayList<>();
+        List<String> modelList=new ArrayList<>();
         for (int i = 0; i < configObJSONArray.size(); i++) {
             JSONObject item = configObJSONArray.getJSONObject(i);
-            titleList.add(item.getString("label"));
+            String type = item.getString("type");
+            if (type.equals("grid")){
+                JSONArray columns = item.getJSONArray("columns");
+                for (int j = 0; j < columns.size(); j++) {
+                    JSONObject columnsJSONObject = columns.getJSONObject(j);
+                    JSONArray listJsonArray = columnsJSONObject.getJSONArray("list");
+                    for (int k = 0; k < listJsonArray.size(); k++) {
+                        JSONObject listJsonArrayJSONObject = listJsonArray.getJSONObject(k);
+                        titleList.add(listJsonArrayJSONObject.getString("label"));
+                        modelList.add(listJsonArrayJSONObject.getString("model"));
+                    }
+                }
+            }
+            else {
+                titleList.add(item.getString("label"));
+                modelList.add(item.getString("model"));
+            }
         }
         dataList.add(titleList);
-        HttpRespMsg msg = list(bo, request);
-        Map<String, Object> msgData = (Map<String, Object>) msg.getData();
-        List<BusinessOpportunity> bos = (List<BusinessOpportunity>) msgData.get("data");
-        for (BusinessOpportunity bo1 : bos) {
+
+        HttpRespMsg respMsg = list(bo,request);
+        Map<String, Object> msgData = (Map<String, Object>) respMsg.getData();
+        List<BusinessOpportunity> list = (List<BusinessOpportunity>) msgData.get("data");
+
+        for (BusinessOpportunity data : list) {
             List<String> item=new ArrayList<>();
-            for (int i = 0; i < configObJSONArray.size(); i++) {
-                JSONObject target = configObJSONArray.getJSONObject(i);
-                if(target.getString("type").equals("grid")){
-                    JSONArray columns = target.getJSONArray("columns");
-                    for (int i1 = 0; i1 < columns.size(); i1++) {
-                        JSONObject columnsJSONObject = columns.getJSONObject(i1);
-                        JSONArray list = columnsJSONObject.getJSONArray("list");
-                        for (int i2 = 0; i2 < list.size(); i2++) {
-                            JSONObject object = list.getJSONObject(i2);
-                            String model = object.getString("model");
-                            String targetName = model.substring(0, 1).toUpperCase() + model.substring(1);
-                            Class<? extends BusinessOpportunity> aClass = bo1.getClass();
-                            String value = String.valueOf(aClass.getMethod("get" + targetName).invoke(bo1)==null?"":aClass.getMethod("get" + targetName).invoke(bo1));
-                            if(model.equals("inchargerId")){
-                                if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
-                                    value = "$userName"+String.valueOf(aClass.getMethod("getInchargerName").invoke(bo1))+"$";
-                                }else {
-                                    value = String.valueOf(aClass.getMethod("getInchargerName").invoke(bo1));
-                                }
-                            }
-                            item.add(value);
-                        }
+            for (int i = 0; i < modelList.size(); i++) {
+
+                String model = modelList.get(i);
+                String targetName = model.substring(0, 1).toUpperCase() + model.substring(1);
+                Class<? extends BusinessOpportunity> aClass = data.getClass();
+                String value = "";
+
+                if(model.equals("inchargerId")){
+                    if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                        value = "$userName"+String.valueOf(aClass.getMethod("getInchargerName").invoke(data))+"$";
+                    }else {
+                        value = String.valueOf(aClass.getMethod("getInchargerName").invoke(data)).equals("null") ? "" :String.valueOf(aClass.getMethod("getInchargerName").invoke(data));
                     }
                 }else {
-                    String model = target.getString("model");
-                    String targetName = model.substring(0, 1).toUpperCase() + model.substring(1);
-                    Class<? extends BusinessOpportunity> aClass = bo1.getClass();
-                    Object o = aClass.getMethod("get" + targetName).invoke(bo1) == null ? "" : aClass.getMethod("get" + targetName).invoke(bo1);
-                    String value = String.valueOf(o);
-                    if(model.equals("inchargerId")){
-                        if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
-                            value = "$userName"+String.valueOf(aClass.getMethod("getInchargerName").invoke(bo1))+"$";
-                        }else {
-                            value = String.valueOf(aClass.getMethod("getInchargerName").invoke(bo1));
-                        }
-                    }
-                    if(model.equals("contactsId")){
-                        if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
-                            value = "$userName"+String.valueOf(aClass.getMethod("getContactsName").invoke(bo1))+"$";
-                        }else {
-                            value = String.valueOf(aClass.getMethod("getContactsName").invoke(bo1));
-                        }
-                    }
-                    item.add(value);
+                    value= String.valueOf(aClass.getMethod("get" + targetName).invoke(data)==null?"":aClass.getMethod("get" + targetName).invoke(data));
                 }
+
+                if(model.equals("contactsId")){
+                    value = String.valueOf(aClass.getMethod("getContactsName").invoke(data));
+                }
+                if(model.equals("customerId")){
+                    value = String.valueOf(aClass.getMethod("getCustomerName").invoke(data));
+                }
+                if(model.equals("expectedTransactionDate")){
+                    Date date = (Date) aClass.getMethod("getExpectedTransactionDate").invoke(data);
+                    // 如果日期不为空,格式化日期
+                    if (date != null) {
+                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+                        value = sdf.format(date);
+                    } else {
+                        value = "";
+                }                }
+                if(model.equals("stageId")){
+                    value = String.valueOf(aClass.getMethod("getStageValue").invoke(data));
+                }
+                if(model.equals("creatorId")){
+                    value = String.valueOf(aClass.getMethod("getCreatorName").invoke(data));
+                }
+
+                item.add(value);
             }
             dataList.add(item);
         }
@@ -217,6 +236,10 @@ public class BusinessOpportunityController {
         HttpRespMsg msg = new HttpRespMsg();
         if (bo.getId() == null){
             //新增
+            if (bo.getClueId()!= null ){
+
+                clueMapper.update(null, new UpdateWrapper<Clue>().eq("id",bo.getClueId()).set("is_bo",1));
+            }
             bo.setCompanyId(user.getCompanyId());
             bo.setCreatorId(user.getId());
             bo.setUserId(user.getId());

+ 48 - 53
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/CustomController.java

@@ -114,67 +114,62 @@ public class CustomController {
         JSONArray configObJSONArray = configOb.getJSONArray("list");
         List<List<String>> dataList=new ArrayList<>();
         List<String> titleList=new ArrayList<>();
+        List<String> modelList=new ArrayList<>();
         for (int i = 0; i < configObJSONArray.size(); i++) {
             JSONObject item = configObJSONArray.getJSONObject(i);
-            titleList.add(item.getString("label"));
+            String type = item.getString("type");
+            if (type.equals("grid")){
+                JSONArray columns = item.getJSONArray("columns");
+                for (int j = 0; j < columns.size(); j++) {
+                    JSONObject columnsJSONObject = columns.getJSONObject(j);
+                    JSONArray listJsonArray = columnsJSONObject.getJSONArray("list");
+                    for (int k = 0; k < listJsonArray.size(); k++) {
+                        JSONObject listJsonArrayJSONObject = listJsonArray.getJSONObject(k);
+                        titleList.add(listJsonArrayJSONObject.getString("label"));
+                        modelList.add(listJsonArrayJSONObject.getString("model"));
+                    }
+                }
+            }
+            else {
+                titleList.add(item.getString("label"));
+                modelList.add(item.getString("model"));
+            }
         }
         dataList.add(titleList);
-        HttpRespMsg msg = list(custom, request);
-        Map<String, Object> msgData = (Map<String, Object>) msg.getData();
-        List<Custom> bos = (List<Custom>) msgData.get("data");
-        for (Custom bo1 : bos) {
+
+        HttpRespMsg respMsg = list(custom,request);
+        Map<String, Object> msgData = (Map<String, Object>) respMsg.getData();
+        List<Custom> list = (List<Custom>) msgData.get("data");
+
+        for (Custom data : list) {
             List<String> item=new ArrayList<>();
-            for (int i = 0; i < configObJSONArray.size(); i++) {
-                JSONObject target = configObJSONArray.getJSONObject(i);
-                if(target.getString("type").equals("grid")){
-                    JSONArray columns = target.getJSONArray("columns");
-                    for (int i1 = 0; i1 < columns.size(); i1++) {
-                        JSONObject columnsJSONObject = columns.getJSONObject(i1);
-                        JSONArray list = columnsJSONObject.getJSONArray("list");
-                        for (int i2 = 0; i2 < list.size(); i2++) {
-                            JSONObject object = list.getJSONObject(i2);
-                            String model = object.getString("model");
-                            String targetName = model.substring(0, 1).toUpperCase() + model.substring(1);
-                            Class<? extends Custom> aClass = bo1.getClass();
-                            String value = String.valueOf(aClass.getMethod("get" + targetName).invoke(bo1)==null?"":aClass.getMethod("get" + targetName).invoke(bo1));
-                            if(model.equals("inchargerId")){
-                                if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
-                                    value = "$userName"+String.valueOf(aClass.getMethod("getInchargerName").invoke(bo1))+"$";
-                                }else {
-                                    value = String.valueOf(aClass.getMethod("getInchargerName").invoke(bo1));
-                                }
-                            }
-                            if(model.equals("customSourceValue")){
-                                if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
-                                    value = "$userName"+String.valueOf(aClass.getMethod("getCustomSourceValue").invoke(bo1))+"$";
-                                }else {
-                                    value = String.valueOf(aClass.getMethod("getCustomSourceValue").invoke(bo1)).equals("null") ?"" :String.valueOf(aClass.getMethod("getCustomSourceValue").invoke(bo1));
-                                }
-                            }
-                            item.add(value);
-                        }
+            for (int i = 0; i < modelList.size(); i++) {
+
+                String model = modelList.get(i);
+                String targetName = model.substring(0, 1).toUpperCase() + model.substring(1);
+                Class<? extends Custom> aClass = data.getClass();
+                String value = "";
+
+                if(model.equals("inchargerId")){
+                    if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                        value = "$userName"+String.valueOf(aClass.getMethod("getInchargerName").invoke(data))+"$";
+                    }else {
+                        value = String.valueOf(aClass.getMethod("getInchargerName").invoke(data)).equals("null") ? "" :String.valueOf(aClass.getMethod("getInchargerName").invoke(data));
                     }
                 }else {
-                    String model = target.getString("model");
-                    String targetName = model.substring(0, 1).toUpperCase() + model.substring(1);
-                    Class<? extends Custom> aClass = bo1.getClass();
-                    String value = String.valueOf(aClass.getMethod("get" + targetName).invoke(bo1)==null?"":aClass.getMethod("get" + targetName).invoke(bo1));
-                    if(model.equals("inchargerId")){
-                        if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
-                            value = "$userName"+String.valueOf(aClass.getMethod("getInchargerName").invoke(bo1))+"$";
-                        }else {
-                            value = String.valueOf(aClass.getMethod("getInchargerName").invoke(bo1));
-                        }
-                    }
-                    if(model.equals("contactsId")){
-                        if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
-                            value = "$userName"+String.valueOf(aClass.getMethod("getContactsName").invoke(bo1))+"$";
-                        }else {
-                            value = String.valueOf(aClass.getMethod("getContactsName").invoke(bo1));
-                        }
-                    }
-                    item.add(value);
+                    value= String.valueOf(aClass.getMethod("get" + targetName).invoke(data)==null?"":aClass.getMethod("get" + targetName).invoke(data));
+                }
+
+                if(model.equals("clueSourceId")){
+                    value = String.valueOf(aClass.getMethod("getClueSourceValue").invoke(data));
+                }
+                if(model.equals("customerLevelId")){
+                    value = String.valueOf(aClass.getMethod("getCustomerLevelValue").invoke(data));
+                }
+                if(model.equals("customerIndustryId")){
+                    value = String.valueOf(aClass.getMethod("getCustomerIndustryValue").invoke(data));
                 }
+                item.add(value);
             }
             dataList.add(item);
         }

+ 2 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/BusinessOpportunity.java

@@ -39,6 +39,8 @@ public class BusinessOpportunity extends Model<BusinessOpportunity> {
 
     @TableField(exist = false)
     private String productName;
+    @TableField(exist = false)
+    private Integer clueId;
 
     /**
      * 商机名称

+ 5 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Clue.java

@@ -34,7 +34,11 @@ public class Clue extends Model<Clue> {
      * 公司id
      */
     @TableField("company_id")
-    private Integer companyId;
+    private Integer companyId;/**
+     * 公司id
+     */
+    @TableField("is_bo")
+    private Integer isBo;
     //创建人
     @TableField("create_id")
     private String createId;

+ 6 - 6
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ClueMapper.xml

@@ -59,7 +59,7 @@
         from clue c
         left join sys_dict sd on c.customer_level_id = sd.id
         where
-            c.company_id = #{companyId} and is_delete = #{isDelete}
+            c.company_id = #{companyId} and is_delete = #{isDelete} and c.is_bo = 0
         <if test="inchargerId != null and inchargerId != ''  ">
            and c.incharger_id =#{inchargerId}
         </if>
@@ -130,7 +130,7 @@
         from clue c
         left join sys_dict sd on c.customer_level_id = sd.id
         where
-        c.company_id = #{clue.companyId} and is_delete = #{clue.isDelete}
+        c.company_id = #{clue.companyId} and c.is_delete = #{clue.isDelete} and c.is_bo = 0
         and (c.incharger_id in
         (SELECT id from `user` WHERE department_id = (SELECT department_id from `user` WHERe id = #{userId}))
         or c.incharger_id is null)
@@ -204,7 +204,7 @@
         from clue c
         left join sys_dict sd on c.customer_level_id = sd.id
         where
-        c.company_id = #{clue.companyId} and c.is_delete = #{clue.isDelete}
+        c.company_id = #{clue.companyId} and c.is_delete = #{clue.isDelete} and c.is_bo = 0
         and (c.incharger_id = #{userId} or c.incharger_id is null)
         <if test="clue.inchargerId != null and clue.inchargerId != ''  ">
           and c.incharger_id =#{clue.inchargerId}
@@ -251,7 +251,7 @@
         select count(*)
         from clue c
         where
-        company_id = #{companyId} and is_delete = #{isDelete}
+        company_id = #{companyId} and is_delete = #{isDelete} and is_bo = 0
         <if test="inchargerId != null and inchargerId != ''  ">
             and incharger_id = #{inchargerId}
         </if>
@@ -282,7 +282,7 @@
         COUNT(c.id)
         from clue c
         where
-        c.company_id = #{clue.companyId} and is_delete = #{clue.isDelete}
+        c.company_id = #{clue.companyId} and c.is_delete = #{clue.isDelete} and c.is_bo = 0
         and c.incharger_id in
         (SELECT id from `user` WHERE department_id = (SELECT department_id from `user` WHERe id = #{userId}))
         and c.incharger_id is null
@@ -316,7 +316,7 @@
             count(c.id)
         from clue c
         where
-        c.company_id = #{clue.companyId} and c.is_delete = #{clue.isDelete}
+        c.company_id = #{clue.companyId} and c.is_delete = #{clue.isDelete} and c.is_bo = 0
         and (c.incharger_id = #{userId} or c.incharger_id is null)
         <if test="clue.inchargerId != null and clue.inchargerId != ''  ">
             and c.incharger_id =#{clue.inchargerId}