Ver código fonte

客户修改

Guo1B0 10 meses atrás
pai
commit
31cccfc430

+ 29 - 23
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/CustomServiceImpl.java

@@ -193,30 +193,36 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void getAndTransfer(Custom custom, User user) {
-        UpdateWrapper<Custom> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.eq("id", custom.getId());
-        Custom custom1 = customMapper.selectById(custom.getId());
-        String inchargerId = custom1.getInchargerId();
-        if (inchargerId == null) {
-            //认领
-            ActionLog actionLog = new ActionLog();
-            actionLog.setCode("custom");
-            actionLog.setCreatTime(new Date());
-            actionLog.setName("认领了客户");
-            actionLog.setUserId(user.getId());
-            actionLog.setItemId(custom.getId());
-            actionLogMapper.insert(actionLog);
-        } else {
-            //转移
-            ActionLog actionLog = new ActionLog();
-            actionLog.setCode("custom");
-            actionLog.setCreatTime(new Date());
-            actionLog.setName("转移了客户");
-            actionLog.setUserId(user.getId());
-            actionLog.setItemId(custom.getId());
-            actionLogMapper.insert(actionLog);
+        String ids1 = custom.getIds();
+        List<Integer> ids = Arrays.stream(ids1.split(","))
+                .map(Integer::parseInt)
+                .collect(Collectors.toList());
+        for (Integer id : ids) {
+            UpdateWrapper<Custom> updateWrapper = new UpdateWrapper<>();
+            updateWrapper.eq("id", id);
+//        updateWrapper.eq("id", custom.getId()).set("incharger_id",custom.getInchargerId());
+            String inchargerId = custom.getInchargerId();
+            if (inchargerId == null) {
+                //认领
+                ActionLog actionLog = new ActionLog();
+                actionLog.setCode("custom");
+                actionLog.setCreatTime(new Date());
+                actionLog.setName("认领了客户");
+                actionLog.setUserId(user.getId());
+                actionLog.setItemId(id);
+                actionLogMapper.insert(actionLog);
+            } else {
+                //转移
+                ActionLog actionLog = new ActionLog();
+                actionLog.setCode("custom");
+                actionLog.setCreatTime(new Date());
+                actionLog.setName("转移了客户");
+                actionLog.setUserId(user.getId());
+                actionLog.setItemId(id);
+                actionLogMapper.insert(actionLog);
+            }
+            customMapper.update(custom, updateWrapper);
         }
-        customMapper.update(custom, updateWrapper);
     }
 
     @Autowired