zhaoq 5 hónapja
szülő
commit
2d732e12bd

+ 5 - 1
tc-service/tap-task/src/main/java/com/minto/app/task/dao/ITaskTypeSettingDao.java

@@ -2,6 +2,9 @@ package com.minto.app.task.dao;
 
 import com.minto.core.dao.BaseDao;
 
+import java.util.List;
+import java.util.Map;
+
 
 /**
  * 应用模块名称<p>
@@ -11,5 +14,6 @@ import com.minto.core.dao.BaseDao;
  * @since 2024/10/10
  */
 public interface ITaskTypeSettingDao extends BaseDao{
-
+    //分组统计
+    List<Map<String, Object>> findReachCountGroupByTypeId();
 }

+ 13 - 1
tc-service/tap-task/src/main/java/com/minto/app/task/dao/TaskTypeSettingDaoImpl.java

@@ -5,6 +5,7 @@ import com.minto.core.dao.BaseDaoImpl;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 应用模块名称<p>
@@ -15,5 +16,16 @@ import java.util.List;
  */
 @Repository("taskTypeSettingDao")
 public class TaskTypeSettingDaoImpl extends BaseDaoImpl implements ITaskTypeSettingDao{
-
+    @Override
+    public List<Map<String, Object>> findReachCountGroupByTypeId() {
+        StringBuilder sql = new StringBuilder();
+        sql.append(" select ");
+        sql.append(" tts.type_id as typeId, ");
+        sql.append(" count(CASE WHEN tts.type_state = '2' THEN tts.id END)as reachNum, ");
+        sql.append(" count(tts.id) as allNum ");
+        sql.append(" from XIZANG_DUBAN_TEST.task_type_setting tts ");
+        sql.append(" where tts.type_id != -1 ");
+        sql.append(" group by tts.type_id ");
+        return getHibernateTpl().queryBySql(sql.toString(), null);
+    }
 }

+ 3 - 0
tc-service/tap-task/src/main/java/com/minto/app/task/manager/TaskAnalysisManagerImpl.java

@@ -74,6 +74,9 @@ public class TaskAnalysisManagerImpl implements ITaskAnalysisManager{
     @Autowired
     private TaskApi taskApi;
 
+    @Autowired
+    private ITaskTypeSettingManager taskTypeSettingManager;
+
 
     @Override
     public List<Map<String, Object>> countWorkEfficient(Map<String, Object> param) throws BusinessException{

+ 103 - 4
tc-service/tap-task/src/main/java/com/minto/app/task/manager/TaskTypeSettingManagerImpl.java

@@ -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;
+    }
 }

+ 4 - 1
tip-api/src/main/java/com/minto/app/task/beans/TaskTypeSettingBean.java

@@ -34,7 +34,7 @@ public class TaskTypeSettingBean extends BasePO{
     /**
      * 指标类型状态:0未满足 1:已满足
      */
-    private Long typeState;
+    private Integer typeState;
 
     /**
      * 创建人
@@ -55,4 +55,7 @@ public class TaskTypeSettingBean extends BasePO{
      * 修改时间
      */
     private Date updateTime;
+
+    //指标类型名称
+    private String typeName;
 }

+ 17 - 0
tip-api/src/main/java/com/minto/app/task/manager/ITaskTypeSettingManager.java

@@ -5,12 +5,29 @@
 
 package com.minto.app.task.manager;
 
+import com.minto.app.task.beans.TaskTypeSettingBean;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 事项关联指标类型设置
  */
 public interface ITaskTypeSettingManager {
 
+    //保存事项关联指标类型数据
     void saveListByTypeSettingStr(Long userId, Long taskId, String typeSettingStr);
 
+    //根据事项类型和事项id查询指标类型数据
+    Map<String, Object> selectTaskTypeSettingByTask(Long taskId, Long taskTypeId);
+
+    //修改指标类型状态
+    void updateTaskTypeSetting(Long userId, Long id, Integer typeState);
+
+    //案件比保存
+    void saveCaseProportion(Long userId, Long taskId, Integer typeState);
+
+    //获取各指标类型完成率
+    Map<Long, BigDecimal> findReachPerGroupByTypeId();
 }

+ 6 - 0
tip-front/src/main/java/com/minto/app/task/controller/MtTaskController.java

@@ -168,6 +168,8 @@ public class MtTaskController extends BaseController {
 	private  IResourceManager resourceManager;
 	@Autowired
 	private ISpaceManager spaceManager;
+	@Autowired
+	private ITaskTypeSettingManager taskTypeSettingManager;
 
 	/**
 	 * 修改阶段页面
@@ -3031,6 +3033,10 @@ public class MtTaskController extends BaseController {
 			}
 			model.put("isOutTask",isOutTask);
 
+			//查询指标类型数据
+			Map<String, Object> taskTypeSettingMap = taskTypeSettingManager.selectTaskTypeSettingByTask(id, Long.valueOf(summary.getTaskTypeId()));
+			model.put("taskTypeSettingMap",taskTypeSettingMap);
+
 			//检查是否已汇总
 			TaskReportBean latestSumByTaskId = taskInfoManager.findLatestSumByTaskId(summary.getId());
 			boolean isLatestSum = false;

+ 11 - 1
tip-front/src/main/java/com/minto/app/task/service/TaskListWebService.java

@@ -82,7 +82,17 @@ public interface TaskListWebService {
      */
     List<Map<String,Object>> findAllTaskColumnsDealFields(Long taskType);
 
+    /**
+     * 查询事项关联指标类型
+     * @param taskId
+     * @param taskTypeId
+     * @return
+     */
+    Map<String,Object> findTaskTypeSetting(Long taskId, Long taskTypeId) throws BusinessException;
 
+    //更新指标类型状态
+    void updateTaskTypeSetting(Long id, Integer typeState);
 
-
+    //案件比保存
+    void saveCaseProportion(Long taskId, Integer typeState);
 }

+ 20 - 0
tip-front/src/main/java/com/minto/app/task/service/impl/TaskListWebServiceImpl.java

@@ -3,6 +3,7 @@ package com.minto.app.task.service.impl;
 import com.github.pagehelper.PageInfo;
 import com.minto.app.task.beans.TaskSummaryBean;
 import com.minto.app.task.manager.ITaskListManager;
+import com.minto.app.task.manager.ITaskTypeSettingManager;
 import com.minto.app.task.service.TaskListWebService;
 import com.minto.core.common.AppContext;
 import com.minto.core.util.dt.DTPageInfo;
@@ -20,6 +21,8 @@ import java.util.Map;
 public class TaskListWebServiceImpl implements TaskListWebService {
     @Autowired
     private ITaskListManager taskListManager;
+    @Autowired
+    private ITaskTypeSettingManager taskTypeSettingManager;
 
     @AjaxSupport
     @Override
@@ -79,4 +82,21 @@ public class TaskListWebServiceImpl implements TaskListWebService {
     public List<Map<String, Object>> findAllTaskColumnsDealFields(Long taskType) {
         return taskListManager.findAllTaskColumnsDealFields(taskType);
     }
+    @AjaxSupport
+    @Override
+    public Map<String, Object> findTaskTypeSetting(Long taskId, Long taskTypeId) {
+        return taskTypeSettingManager.selectTaskTypeSettingByTask(taskId,taskTypeId);
+    }
+    @AjaxSupport
+    @Override
+    public void updateTaskTypeSetting(Long id, Integer typeState) {
+        Long userId = AppContext.currentUserId();
+        taskTypeSettingManager.updateTaskTypeSetting(userId,id,typeState);
+    }
+    @AjaxSupport
+    @Override
+    public void saveCaseProportion(Long taskId, Integer typeState) {
+        Long userId = AppContext.currentUserId();
+        taskTypeSettingManager.saveCaseProportion(userId,taskId,typeState);
+    }
 }

+ 63 - 1
tip-front/src/main/webapp/tc_suite/minto/task/showTaskDetail_anchor.jsp

@@ -1002,7 +1002,13 @@
                     </div>
                     <c:if test="${isSupervisePerson || isSuperviseBoss || isCreator}">
                         <div class="navLiMax" data-sta="signIn">
-                            <a class="navName" data-target="signIn" href="javascript:;">${tc:i18n("task.signing.situation")}</a><!--签收情况-->
+                            <a class="navName" data-target="signIn" href="javascript:;">${tc:i18n("task.signing.situation")}1</a><!--签收情况-->
+                            <span class="navCircularMax"></span>
+                        </div>
+                    </c:if>
+                    <c:if test="${isSupervisePerson || isSuperviseBoss || isCreator}">
+                        <div class="navLiMax" data-sta="signIn">
+                            <a class="navName" data-target="signIn" href="javascript:;">${tc:i18n("task.signing.situation")}1</a><!--签收情况-->
                             <span class="navCircularMax"></span>
                         </div>
                     </c:if>
@@ -1068,6 +1074,62 @@
                         </div>
                     </div>
 
+                    <c:if test="${taskTypeSettingMap.isShowTaskTypeSetting}">
+                        <c:if test="${isSupervisePerson || isSuperviseBoss || isCreator}">
+<%--                            <a name="signIn" id="signIn"></a>--%>
+                            <div class="mt-fold">
+                                <div class="mt-fold-title mt-fold-open">
+                                    <span>指标类型</span>
+                                    <i class="mt-icon mt-icon-arrow tran"></i>
+                                </div>
+                                <div class="mt-fold-content">
+                                    <div class="signInDetail">
+                                        <table class="mt-table table table-bordered mt-center">
+                                            <thead>
+                                            <tr>
+                                                <td class="fixedTd" >指标类型</td>
+                                                <td class="fixedTd" >状态值 </td>
+                                                <td class="fixedTd" >最新修改时间</td>
+                                            </tr>
+                                            </thead>
+                                            <tbody>
+                                            <c:forEach items="${taskTypeSettingMap.taskTypeSettingList}" var="sign" varStatus="s">
+                                                <tr class="sign-unit">
+                                                    <td class="fixedTd">
+                                                            ${sign.typeName}
+                                                    </td>
+                                                    <td class="fixedTd">
+                                                        <select name="typeStateSelect">
+                                                            <option value="">请选择</option>
+                                                            <option value="0" <c:if test="${0==sign.typeState}">selected="selected"</c:if> >未满足</option>
+                                                            <option value="1" <c:if test="${1==sign.typeState}">selected="selected"</c:if> >已满足</option>
+                                                        </select>
+                                                    </td>
+                                                    <td class="fixedTd" style="white-space: nowrap">
+                                                        <fmt:formatDate type="time" value="${sign.updateTime}" pattern="yyyy-MM-dd HH:mm"/>
+                                                    </td>
+                                                </tr>
+                                            </c:forEach>
+                                            <tr class="sign-unit">
+                                                <td class="fixedTd">
+                                                        案件比
+                                                </td>
+                                                <td class="fixedTd">
+                                                        1:<input style="width:60px;" type="text" class="mt-input" id="typeStateInput" name="typeStateInput" value="${taskTypeSettingMap.caseProportion.typeState}">
+                                                        <button class="typeStateInputSave mt-btn">确认</button>
+                                                </td>
+                                                <td class="fixedTd" style="white-space: nowrap">
+                                                    <fmt:formatDate type="time" value="${taskTypeSettingMap.caseProportion.updateTime}" pattern="yyyy-MM-dd HH:mm"/>
+                                                </td>
+                                            </tr>
+                                            </tbody>
+                                        </table>
+                                    </div>
+                                </div>
+                            </div>
+                        </c:if>
+                    </c:if>
+
                     <c:if test="${needSign}">
                         <c:if test="${isSupervisePerson || isSuperviseBoss || isCreator}">
                             <a name="signIn" id="signIn"></a>