|
@@ -6,19 +6,127 @@ import com.alibaba.fastjson.JSONObject;
|
|
import com.jeeplus.common.config.Global;
|
|
import com.jeeplus.common.config.Global;
|
|
import com.jeeplus.common.persistence.Page;
|
|
import com.jeeplus.common.persistence.Page;
|
|
import com.jeeplus.common.utils.StringUtils;
|
|
import com.jeeplus.common.utils.StringUtils;
|
|
|
|
+import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecords;
|
|
|
|
+import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectRecordsService;
|
|
import com.jeeplus.modules.workprojectnotify.entity.WorkProjectNotify;
|
|
import com.jeeplus.modules.workprojectnotify.entity.WorkProjectNotify;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
public class ConvertServiceUtil {
|
|
public class ConvertServiceUtil {
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private RuralProjectRecordsService ruralProjectRecordsService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 批量将cpa系统待办返回的字段转换为当前系统待办需要的字段
|
|
* 批量将cpa系统待办返回的字段转换为当前系统待办需要的字段
|
|
* @param res
|
|
* @param res
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public static List<WorkProjectNotify> convertWorkProjectNotifyList(List<Map<String, Object>> res) throws Exception {
|
|
public static List<WorkProjectNotify> convertWorkProjectNotifyList(List<Map<String, Object>> res) throws Exception {
|
|
|
|
+ List<WorkProjectNotify> resp = new ArrayList<>();
|
|
|
|
+ List<WorkProjectNotify> workProjectNotifyList = JSON.parseArray(JSON.toJSONString(res), WorkProjectNotify.class);
|
|
|
|
+ String cpa_task = Global.getConfig("CPA_TASK"); // 获取cpa可查看的待办数据
|
|
|
|
+ for (WorkProjectNotify workProjectNotify : workProjectNotifyList) {
|
|
|
|
+ if ("ccpm".equals(workProjectNotify.getBelongProject())) {
|
|
|
|
+ resp.add(workProjectNotify);
|
|
|
|
+ } else if ("cpa".equals(workProjectNotify.getBelongProject())) {
|
|
|
|
+ if (StringUtils.isNotBlank(workProjectNotify.getType())) {
|
|
|
|
+ if (StringUtils.isNotBlank(cpa_task) && cpa_task.contains(workProjectNotify.getType())) {
|
|
|
|
+ // 评估-报销审批
|
|
|
|
+ if ("Process_1665383385070".equals(workProjectNotify.getType())) {
|
|
|
|
+ workProjectNotify.setType("13");
|
|
|
|
+ resp.add(workProjectNotify);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return resp;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ *
|
|
|
|
+ * @param workProjectNotifyList
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public static List<Map<String,Object>> copyNotifyListToCenter(List<WorkProjectNotify> workProjectNotifyList) {
|
|
|
|
+ List<Map<String, Object>> res = new ArrayList<>();
|
|
|
|
+ for (WorkProjectNotify workProjectNotify : workProjectNotifyList) {
|
|
|
|
+ Map<String, Object> stringObjectMap = copyNotifyToCenter(workProjectNotify);
|
|
|
|
+ res.add(stringObjectMap);
|
|
|
|
+ }
|
|
|
|
+ return res;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 将本系统待办信息字段改为业务系统字段
|
|
|
|
+ * @param workProjectNotify
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public static Map<String,Object> copyNotifyToCenter(WorkProjectNotify workProjectNotify) {
|
|
|
|
+ Map<String, Object> res = new HashMap<>();
|
|
|
|
+ Map<String, Object> vars = new HashMap<>();
|
|
|
|
+ Map<String, Object> task = new HashMap<>();
|
|
|
|
+ if (Objects.nonNull(workProjectNotify)) {
|
|
|
|
+ // 所属系统
|
|
|
|
+ if (Objects.nonNull(workProjectNotify.getBelongProject())) {
|
|
|
|
+ res.put("belongProject", workProjectNotify.getBelongProject());
|
|
|
|
+ } else {
|
|
|
|
+ res.put("belongProject", "ccpm");
|
|
|
|
+ }
|
|
|
|
+ // 标题
|
|
|
|
+ if (Objects.nonNull(workProjectNotify.getTitle())){
|
|
|
|
+ vars.put("title", workProjectNotify.getTitle());
|
|
|
|
+ }
|
|
|
|
+ // 流程名称
|
|
|
|
+ if (Objects.nonNull(workProjectNotify.getTypeLabel())){
|
|
|
|
+ res.put("processDefinitionName", workProjectNotify.getTypeLabel());
|
|
|
|
+ }
|
|
|
|
+ // 流程类型
|
|
|
|
+ if (Objects.nonNull(workProjectNotify.getType())){
|
|
|
|
+ task.put("processDefKey", workProjectNotify.getType());
|
|
|
|
+ }
|
|
|
|
+ // 当前环节
|
|
|
|
+ if (Objects.nonNull(workProjectNotify.getNotifyRole())){
|
|
|
|
+ task.put("name", workProjectNotify.getNotifyRole());
|
|
|
|
+ }
|
|
|
|
+ // 流程发起人
|
|
|
|
+ if (Objects.nonNull(workProjectNotify.getCreateUserName())){
|
|
|
|
+ vars.put("userName", workProjectNotify.getCreateUserName());
|
|
|
|
+ }
|
|
|
|
+ // 创建时间
|
|
|
|
+ if (Objects.nonNull(workProjectNotify.getCreateDate())){
|
|
|
|
+ task.put("createTime", workProjectNotify.getCreateDate());
|
|
|
|
+// task.setCreateTime((new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).parse(map.get("createDate").toString()));
|
|
|
|
+ }
|
|
|
|
+ // 流程id
|
|
|
|
+ if (Objects.nonNull(workProjectNotify.getId())){
|
|
|
|
+ task.put("id", workProjectNotify.getId());
|
|
|
|
+ }
|
|
|
|
+ // 数据id
|
|
|
|
+ if (Objects.nonNull(workProjectNotify.getNotifyId())){
|
|
|
|
+ vars.put("notifyId", workProjectNotify.getNotifyId());
|
|
|
|
+ }
|
|
|
|
+ // 审批状态
|
|
|
|
+ if (Objects.nonNull(workProjectNotify.getRemarks())){
|
|
|
|
+ vars.put("remarks", workProjectNotify.getRemarks());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ res.put("vars", vars);
|
|
|
|
+ res.put("task", task);
|
|
|
|
+ res.put("status", "todo");
|
|
|
|
+ return res;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 批量将cpa系统待办返回的字段转换为当前系统待办需要的字段 old
|
|
|
|
+ * @param res
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Deprecated
|
|
|
|
+ public static List<WorkProjectNotify> convertWorkProjectNotifyListOld(List<Map<String, Object>> res) throws Exception {
|
|
ArrayList<WorkProjectNotify> workProjectNotifyList = new ArrayList<>();
|
|
ArrayList<WorkProjectNotify> workProjectNotifyList = new ArrayList<>();
|
|
String cpa_task = Global.getConfig("CPA_TASK"); // 获取cpa可查看的待办数据
|
|
String cpa_task = Global.getConfig("CPA_TASK"); // 获取cpa可查看的待办数据
|
|
if (StringUtils.isNotBlank(cpa_task)) {
|
|
if (StringUtils.isNotBlank(cpa_task)) {
|
|
@@ -33,10 +141,6 @@ public class ConvertServiceUtil {
|
|
for (Map<String, Object> item : res) {
|
|
for (Map<String, Object> item : res) {
|
|
Map<String, Object> vars = JSON.parseObject(JSON.toJSONString(item.get("vars")), Map.class);
|
|
Map<String, Object> vars = JSON.parseObject(JSON.toJSONString(item.get("vars")), Map.class);
|
|
Map<String, Object> task = JSON.parseObject(JSON.toJSONString(item.get("task")), Map.class);
|
|
Map<String, Object> task = JSON.parseObject(JSON.toJSONString(item.get("task")), Map.class);
|
|
- if (Objects.nonNull(vars.get("agree"))) {
|
|
|
|
- boolean agree = Boolean.parseBoolean(vars.get("agree").toString());
|
|
|
|
- String s = new String();
|
|
|
|
- }
|
|
|
|
for (String taskAlias : taskAliasList) {
|
|
for (String taskAlias : taskAliasList) {
|
|
// vars.get("agree") 的值为false时,此流程为驳回状态。值为null或其他时,此流程为待审批状态
|
|
// vars.get("agree") 的值为false时,此流程为驳回状态。值为null或其他时,此流程为待审批状态
|
|
if (taskAlias.equals(task.get("processDefKey").toString()) &&
|
|
if (taskAlias.equals(task.get("processDefKey").toString()) &&
|
|
@@ -55,6 +159,7 @@ public class ConvertServiceUtil {
|
|
* @param map
|
|
* @param map
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
|
|
+ @Deprecated
|
|
public static WorkProjectNotify convertWorkProjectNotify(Map<String, Object> map) throws Exception {
|
|
public static WorkProjectNotify convertWorkProjectNotify(Map<String, Object> map) throws Exception {
|
|
WorkProjectNotify workProjectNotify = new WorkProjectNotify();
|
|
WorkProjectNotify workProjectNotify = new WorkProjectNotify();
|
|
|
|
|
|
@@ -117,23 +222,25 @@ public class ConvertServiceUtil {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public static Page getSortAndPaging(Page<WorkProjectNotify> page, List<WorkProjectNotify> list) {
|
|
public static Page getSortAndPaging(Page<WorkProjectNotify> page, List<WorkProjectNotify> list) {
|
|
- // 将数据按照createDate倒序排序
|
|
|
|
- list.sort(new Comparator<WorkProjectNotify>() {
|
|
|
|
- @Override
|
|
|
|
- public int compare(WorkProjectNotify o1, WorkProjectNotify o2) {
|
|
|
|
- return o2.getCreateDate().compareTo(o1.getCreateDate());
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- // 将数据分页
|
|
|
|
- page.setCount(list.size());
|
|
|
|
List<WorkProjectNotify> records = new ArrayList<>();
|
|
List<WorkProjectNotify> records = new ArrayList<>();
|
|
- int startIndex = (int) ((page.getPageNo() - 1) * page.getPageSize());
|
|
|
|
- for (int i = 0; i < page.getPageSize() ; i ++) {
|
|
|
|
- if (startIndex == list.size() || Objects.isNull(list.get(startIndex))) {
|
|
|
|
- break;
|
|
|
|
|
|
+ if (list.size() > 0) {
|
|
|
|
+ // 将数据按照createDate倒序排序
|
|
|
|
+ list.sort(new Comparator<WorkProjectNotify>() {
|
|
|
|
+ @Override
|
|
|
|
+ public int compare(WorkProjectNotify o1, WorkProjectNotify o2) {
|
|
|
|
+ return o2.getCreateDate().compareTo(o1.getCreateDate());
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ // 将数据分页
|
|
|
|
+ page.setCount(list.size());
|
|
|
|
+ int startIndex = (int) ((page.getPageNo() - 1) * page.getPageSize());
|
|
|
|
+ for (int i = 0; i < page.getPageSize() ; i ++) {
|
|
|
|
+ if (startIndex == list.size() || Objects.isNull(list.get(startIndex))) {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ records.add(list.get(startIndex));
|
|
|
|
+ startIndex++;
|
|
}
|
|
}
|
|
- records.add(list.get(startIndex));
|
|
|
|
- startIndex++;
|
|
|
|
}
|
|
}
|
|
page.setList(records);
|
|
page.setList(records);
|
|
return page;
|
|
return page;
|