Преглед на файлове

Merge branch 'master' of http://git.mokasz.com/marketing/moka-private

leon преди 5 години
родител
ревизия
c46a6e72ad
променени са 1 файла, в които са добавени 52 реда и са изтрити 2 реда
  1. 52 2
      src/main/java/com/mokamrp/privates/controller/pangu/FosterwxTaskScheduleController.java

+ 52 - 2
src/main/java/com/mokamrp/privates/controller/pangu/FosterwxTaskScheduleController.java

@@ -7,8 +7,10 @@ import com.mokamrp.privates.entity.EditHandle;
 import com.mokamrp.privates.entity.PostBasePageHandle;
 import com.mokamrp.privates.entity.PostBasePageHandle;
 import com.mokamrp.privates.help.AjaxResult;
 import com.mokamrp.privates.help.AjaxResult;
 import com.mokamrp.privates.interceptor.AuthUser;
 import com.mokamrp.privates.interceptor.AuthUser;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxTaskList;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxTaskSchedule;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxTaskSchedule;
 import com.mokamrp.privates.mapper.pojo.User;
 import com.mokamrp.privates.mapper.pojo.User;
+import com.mokamrp.privates.service.pangu.FosterwxTaskListService;
 import com.mokamrp.privates.service.pangu.FosterwxTaskScheduleService;
 import com.mokamrp.privates.service.pangu.FosterwxTaskScheduleService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
@@ -17,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
 
 
 import javax.validation.Valid;
 import javax.validation.Valid;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
+import java.util.HashMap;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
@@ -36,6 +39,9 @@ public class FosterwxTaskScheduleController extends BaseController<FosterwxTaskS
     @Autowired
     @Autowired
     public FosterwxTaskScheduleService fosterwxTaskScheduleService;
     public FosterwxTaskScheduleService fosterwxTaskScheduleService;
 
 
+    @Autowired
+    private FosterwxTaskListService fosterwxTaskListService;
+
     /*
     /*
      * @fast
      * @fast
      * 默认生成的控制器所继承的父类中有index/add/edit/del四个基础方法,均为post json请求
      * 默认生成的控制器所继承的父类中有index/add/edit/del四个基础方法,均为post json请求
@@ -94,9 +100,53 @@ public class FosterwxTaskScheduleController extends BaseController<FosterwxTaskS
 
 
         List<FosterwxTaskSchedule> fosterwxTaskScheduleList = fosterwxTaskScheduleService.list(fosterwxTaskScheduleLambdaQueryWrapper);
         List<FosterwxTaskSchedule> fosterwxTaskScheduleList = fosterwxTaskScheduleService.list(fosterwxTaskScheduleLambdaQueryWrapper);
 
 
-        return null;
-    }
+        if (fosterwxTaskScheduleList.isEmpty()) return AjaxResult.error("无法获取任务排期详情!");
+
+        String mobileCode = "";
+        for (FosterwxTaskSchedule fosterwxTaskSchedule : fosterwxTaskScheduleList) {
+            Integer code = fosterwxTaskSchedule.getMobileCode();
+            // 第一条数据
+            if (mobileCode.isEmpty()) {
+                mobileCode = String.format("%03d", code);
+            } else {
+                // 按顿号分组数据
+                String[] mobileArry = mobileCode.split("、");
+                if (mobileArry[mobileArry.length - 1].contains("-")) {
+                    // 已经有组了
+                    String[] mobiles = mobileArry[mobileArry.length - 1].split("-");
+                    if (Integer.valueOf(mobiles[1]) + 1 == code) {
+                        mobileArry[mobileArry.length - 1] = mobiles[0] + "-" + String.format("%03d", code);
+                        mobileCode = "";
+                        for (int i = 0; i < mobileArry.length; i++) {
+                            mobileCode += mobileArry[i] + "、";
+                        }
+                    } else {
+                        mobileCode += String.format("%03d", code) + "、";
+                    }
+                } else {
+                    if (Integer.valueOf(mobileArry[mobileArry.length - 1]) + 1 == code) {
+                        mobileArry[mobileArry.length - 1] += "-" + String.format("%03d", code);
+                        mobileCode = "";
+                        for (int i = 0; i < mobileArry.length; i++) {
+                            mobileCode += mobileArry[i] + "、";
+                        }
+                    } else {
+                        mobileCode += String.format("%03d", code) + "、";
+                    }
+                }
+            }
+        }
 
 
+        Map<String, Object> res = new HashMap<>();
 
 
+        StringBuffer sb = new StringBuffer();
+        sb.append("手机编号:" + mobileCode + "<br><br>");
+        FosterwxTaskList fosterwxTaskList = fosterwxTaskListService.getById(fosterwxTaskScheduleList.get(0).getTaskId());
+        sb.append("任务内容:" + fosterwxTaskList.getTaskContent());
+
+        res.put("content", sb);
+
+        return AjaxResult.success(res);
+    }
 }
 }