|
@@ -5,26 +5,35 @@
|
|
|
|
|
|
package com.minto.app.task.manager;
|
|
|
|
|
|
+import com.minto.app.collaboration.beans.ColAffairBean;
|
|
|
import com.minto.app.task.beans.TaskMemberBean;
|
|
|
import com.minto.app.task.beans.TaskMemberPhaseReportConfig;
|
|
|
import com.minto.app.task.beans.TaskTypeSettingBean;
|
|
|
import com.minto.app.task.dao.ITaskListManagerDao;
|
|
|
import com.minto.app.task.dao.ITaskMemberDao;
|
|
|
import com.minto.app.task.dao.ITaskTypeSettingDao;
|
|
|
+import com.minto.app.task.enums.TaskEnum;
|
|
|
+import com.minto.app.tipenum.manager.TipEnumManager;
|
|
|
+import com.minto.app.tipenum.po.TipEnumBean;
|
|
|
import com.minto.core.common.AppContext;
|
|
|
-import com.minto.core.util.CollectionUtil;
|
|
|
-import com.minto.core.util.DateUtil;
|
|
|
-import com.minto.core.util.StringUtil;
|
|
|
-import com.minto.core.util.UUIDUtil;
|
|
|
+import com.minto.core.constants.BaseConstants;
|
|
|
+import com.minto.core.po.BasePO;
|
|
|
+import com.minto.core.util.*;
|
|
|
import com.minto.tip.common.exceptions.BusinessException;
|
|
|
+import org.apache.poi.ss.formula.functions.T;
|
|
|
import org.hibernate.criterion.Criterion;
|
|
|
+import org.hibernate.criterion.DetachedCriteria;
|
|
|
import org.hibernate.criterion.Restrictions;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.sql.Array;
|
|
|
import java.sql.SQLException;
|
|
|
import java.util.*;
|
|
|
+import java.util.function.Function;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* Created by tq on 2024/10/10.
|
|
@@ -33,6 +42,8 @@ import java.util.*;
|
|
|
public class TaskTypeSettingManagerImpl implements ITaskTypeSettingManager{
|
|
|
@Resource
|
|
|
private ITaskTypeSettingDao taskTypeSettingDao;
|
|
|
+ @Autowired
|
|
|
+ private ITaskListManager taskListManager;
|
|
|
|
|
|
@Override
|
|
|
public void saveListByTypeSettingStr(Long userId, Long taskId, String typeSettingStr) {
|
|
@@ -56,4 +67,92 @@ public class TaskTypeSettingManagerImpl implements ITaskTypeSettingManager{
|
|
|
|
|
|
taskTypeSettingDao.saveAll(taskTypeSettingBeanList);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> selectTaskTypeSettingByTask(Long taskId, Long taskTypeId) {
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ result.put("isShowTaskTypeSetting",false);
|
|
|
+ //查询事项配置的字段信息
|
|
|
+ List<Map<String,Object>> cols = taskListManager.find1TemplateCols(taskTypeId,"task");
|
|
|
+ if (cols.isEmpty()) return result;
|
|
|
+
|
|
|
+ //查询字典信息
|
|
|
+ TipEnumManager tipEnumManager = AppContext.getBean(TipEnumManager.class);
|
|
|
+ TipEnumBean tipEnum = tipEnumManager.getTipEnumByTypeAndKey("0", "matter_type_settings");
|
|
|
+ List<TipEnumBean> matterTypeSettingsList =tipEnumManager.findTipEnumsByType(String.valueOf(tipEnum.getId()));
|
|
|
+ Map<Long, String> matterTypeSettingsMap = matterTypeSettingsList.stream().collect(Collectors.toMap(TipEnumBean::getId, TipEnumBean::getValue));
|
|
|
+
|
|
|
+ //如果该事项类型配置了指标类型字段信息,则查询相关信息后返回
|
|
|
+ cols.stream().forEach(e -> {
|
|
|
+ if ("type_setting".equals(e.get("fieldName").toString())){
|
|
|
+ result.put("isShowTaskTypeSetting",true);
|
|
|
+ Criterion c = Restrictions.eq("referenceId",taskId);
|
|
|
+ List<TaskTypeSettingBean> taskTypeSettingList = taskTypeSettingDao.findBy(TaskTypeSettingBean.class, c);
|
|
|
+ Iterator<TaskTypeSettingBean> iterator = taskTypeSettingList.iterator();
|
|
|
+ //列表中删除案件比信息
|
|
|
+ while (iterator.hasNext()){
|
|
|
+ TaskTypeSettingBean next = iterator.next();
|
|
|
+ if (next.getTypeId().longValue() == -1){
|
|
|
+ result.put("caseProportion",next);
|
|
|
+ iterator.remove();
|
|
|
+ }else {
|
|
|
+ next.setTypeName(matterTypeSettingsMap.get(next.getTypeId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ result.put("taskTypeSettingList",taskTypeSettingList);
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updateTaskTypeSetting(Long userId, Long id, Integer typeState) {
|
|
|
+ TaskTypeSettingBean bean = taskTypeSettingDao.get(TaskTypeSettingBean.class, id);
|
|
|
+ if (null != bean){
|
|
|
+ bean.setTypeState(typeState);
|
|
|
+ bean.setUpdateBy(userId);
|
|
|
+ bean.setUpdateTime(DateUtil.now());
|
|
|
+ }
|
|
|
+ taskTypeSettingDao.update(bean);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void saveCaseProportion(Long userId, Long taskId, Integer typeState) {
|
|
|
+ DetachedCriteria detachedCriteria = DetachedCriteria.forClass(TaskTypeSettingBean.class);
|
|
|
+ detachedCriteria.add(Restrictions.eq("referenceId",taskId));
|
|
|
+ detachedCriteria.add(Restrictions.eq("typeId",-1));
|
|
|
+ TaskTypeSettingBean bean = (TaskTypeSettingBean) taskTypeSettingDao.get(detachedCriteria);
|
|
|
+
|
|
|
+ if (null == bean){
|
|
|
+ bean = new TaskTypeSettingBean();
|
|
|
+ bean.setId(UUIDUtil.UUIDLong());
|
|
|
+ bean.setCreateTime(DateUtil.now());
|
|
|
+ bean.setCreateBy(userId);
|
|
|
+ }
|
|
|
+
|
|
|
+ bean.setReferenceId(taskId);
|
|
|
+ bean.setTypeId(-1L);
|
|
|
+ bean.setTypeState(typeState);
|
|
|
+ bean.setUpdateTime(DateUtil.now());
|
|
|
+ bean.setUpdateBy(userId);
|
|
|
+
|
|
|
+ taskTypeSettingDao.saveOrUpdate(bean);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<Long, BigDecimal> findReachPerGroupByTypeId() {
|
|
|
+ List<Map<String, Object>> list = taskTypeSettingDao.findReachCountGroupByTypeId();
|
|
|
+ Map<Long, BigDecimal> map = new HashMap<>();
|
|
|
+ if (!list.isEmpty()){
|
|
|
+ list.stream().forEach(e -> {
|
|
|
+ BigDecimal hundredBigDecimal = new BigDecimal(100);
|
|
|
+ BigDecimal reachPer = new BigDecimal(e.get("reachNum").toString()).divide(new BigDecimal(e.get("allNum").toString()), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ map.put(Long.parseLong(e.get("id").toString()),reachPer.multiply(hundredBigDecimal));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
}
|