Przeglądaj źródła

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

Lijy 2 miesięcy temu
rodzic
commit
b526ba2c23

+ 18 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TaskController.java

@@ -528,8 +528,23 @@ public class TaskController {
                 return msg;
             }
         }
-        //检查前置任务是否都已经完成
+        //检查是否要核验成果文件
+        Task curTask = taskMapper.selectById(task.getId());
+        if (curTask.getAttachFileRequired() && task.getTaskStatus() == 0) {
+            Integer cnt = taskFilesMapper.selectCount(new QueryWrapper<TaskFiles>().eq("task_id",task.getId()));
+            if (cnt == 0) {
+                msg.setError("当前任务必须要上传成果附件才可以完成");
+                return msg;
+            } else {
+                cnt = taskFilesMapper.selectCount(new QueryWrapper<TaskFiles>().eq("task_id",task.getId()).eq("final_charge_status",0));
+                if (cnt > 0) {
+                    msg.setError("当前任务存在尚未审核通过的成果附件,不可完成");
+                    return msg;
+                }
+            }
+        }
 
+        //检查前置任务是否都已经完成
         boolean isFinishTask = false;
         if (task.getTaskStatus() == 0) {
             task.setTaskStatus(1);
@@ -620,9 +635,8 @@ public class TaskController {
         }
 
         //如果是里程碑,需要更新项目完成度
-        task = taskMapper.selectById(task.getId());
-        if (task.getTaskType() == 1) {
-            Integer projectId = task.getProjectId();
+        if (curTask.getTaskType() == 1) {
+            Integer projectId = curTask.getProjectId();
             updateProjectProgress(projectId);
         }
         return msg;

+ 2 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/WeiXinCorpController.java

@@ -1184,10 +1184,10 @@ public class WeiXinCorpController {
                             if (department.contains(",")) {
                                 String[] split = department.split(",");
                                 curUserWXDeptid = getMaxDeptIdFromArray(split);
-                            } else {
+                            } else if (!StringUtils.isEmpty(department)){
                                 curUserWXDeptid = Integer.valueOf(department);
                             }
-                        } else if (jsonObject.has("MainDepartment")) {
+                        } else if (jsonObject.has("MainDepartment") && !StringUtils.isEmpty(jsonObject.getString("MainDepartment"))) {
                             //取主部门
                             curUserWXDeptid = jsonObject.getInt("MainDepartment");
                         } else {

+ 7 - 6
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Task.java

@@ -15,18 +15,13 @@ import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import org.springframework.format.annotation.DateTimeFormat;
 
-import java.io.Serializable;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.util.List;
-
 /**
  * <p>
  * 
  * </p>
  *
  * @author Seyason
- * @since 2025-01-04
+ * @since 2025-02-28
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -305,6 +300,12 @@ public class Task extends Model<Task> {
      * 任务的外置状态显示 1审核中[待审核+(审核通过)] 2驳回[存在驳回文件]  3审核通过[全部审核通过]
      * */
     private int fileChargeStatus;
+    /**
+     * 完成任务时,成果文件是否必传
+     */
+    @TableField("attach_file_required")
+    private Boolean attachFileRequired;
+
 
     @Override
     protected Serializable pkVal() {

+ 3 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/DingDingServiceImpl.java

@@ -1364,18 +1364,18 @@ public class DingDingServiceImpl implements DingDingService {
                                         companyMapper.updateById(company);
                                     } else if ("RENEW".equals(orderType)) {
                                         System.out.println("==Push 推送事件 续费套餐=="+biz_data.toJSONString());
-                                        int serviceStopTime = biz_data.getIntValue("serviceStopTime");
+                                        long serviceStopTime = biz_data.getLongValue("serviceStopTime");
                                         company.setExpirationDate(LocalDateTime.ofEpochSecond(serviceStopTime/1000, 0, ZoneOffset.ofHours(8)));
                                         companyMapper.updateById(company);
                                     } else if ("RENEW_UPGRADE".equals(orderType)) {
                                         System.out.println("==Push 推送事件 续费升级套餐=="+biz_data.toJSONString());
-                                        int serviceStopTime = biz_data.getIntValue("serviceStopTime");
+                                        long serviceStopTime = biz_data.getLongValue("serviceStopTime");
                                         company.setStaffCountMax(subQuantity);
                                         company.setExpirationDate(LocalDateTime.ofEpochSecond(serviceStopTime/1000, 0, ZoneOffset.ofHours(8)));
                                         companyMapper.updateById(company);
                                     } else if ("RENEW_DEGRADE".equals(orderType)) {
                                         System.out.println("==Push 推送事件 续费降级套餐=="+biz_data.toJSONString());
-                                        int serviceStopTime = biz_data.getIntValue("serviceStopTime");
+                                        long serviceStopTime = biz_data.getLongValue("serviceStopTime");
                                         company.setStaffCountMax(subQuantity);
                                         company.setExpirationDate(LocalDateTime.ofEpochSecond(serviceStopTime/1000, 0, ZoneOffset.ofHours(8)));
                                         companyMapper.updateById(company);

+ 7 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ExpenseSheetServiceImpl.java

@@ -481,7 +481,7 @@ public class ExpenseSheetServiceImpl extends ServiceImpl<ExpenseSheetMapper, Exp
             }
         }
         //柘中报销人填写报销单信息,完善填报金额,第一审核人,第二审核人信息,给第一审核人发送信息
-        if (!isNew&& auditSetting != null && auditSetting.getAuditType() == 2&&sheet.getReviewProcess()==0){
+        if (!isNew&& auditSetting != null && auditSetting.getAuditType() == 2&&sheet.getReviewProcess()==0&&expenseMainType!=null){
             log.info("柘中报销人填写报销单信息,完善填报金额,第一审核人,第二审核人信息,给第一审核人发送信息");
             //发送给第一审核人审核
             List<User> targetUserList = new ArrayList<>();
@@ -762,6 +762,7 @@ public class ExpenseSheetServiceImpl extends ServiceImpl<ExpenseSheetMapper, Exp
         String token = request.getHeader("TOKEN");
         User user = userMapper.selectById(token);
         ExpenseSheet sheet = expenseSheetMapper.selectById(id);
+        ExpenseMainType expenseMainType = expenseMainTypeService.getById(sheet.getType());
         ExpenseAuditSetting expenseAuditSetting = expenseAuditSettingMapper.selectById(user.getCompanyId());
         if(expenseAuditSetting!=null&&expenseAuditSetting.getAuditType()==2){
             if(sheet.getReviewProcess()!=null&&sheet.getReviewProcess()==0&& org.apache.commons.lang3.StringUtils.isNotEmpty(sheet.getSecondCheckerId())){
@@ -815,12 +816,14 @@ public class ExpenseSheetServiceImpl extends ServiceImpl<ExpenseSheetMapper, Exp
                         informationList.add(information);
                     }
                     informationService.saveBatch(informationList);
-                }{
+                }
+                else if(wxCorpInfo != null&&expenseMainType!=null){
                     User targetUser = userMapper.selectById(sheet.getOwnerId());
                     //推送到企业微信
                     StringBuilder stringBuilder = new StringBuilder();
-                    stringBuilder.append("报销人:").append("$userName="+targetUser.getCorpwxUserid()+"$")
-                            .append(",填写了机械费用报销单的信息,请及时审核");
+                    stringBuilder.append("请及时审核").append("报销人:").append("$userName="+targetUser.getCorpwxUserid()+"$")
+                            .append(expenseMainType.getName()).append("的报销单");
+
 
                     wxCorpInfoService.sendWXCorpMsg(wxCorpInfo,secondChecker.getCorpwxUserid(), stringBuilder.toString(), "expense",
                             WxCorpInfoServiceImpl.TEXT_CARD_MSG_EXPENSE_NEED);

+ 56 - 54
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TaskMapper.xml

@@ -33,7 +33,9 @@
         <result column="ahead_tid" property="aheadTid" />
         <result column="sap_task_code" property="sapTaskCode" />
         <result column="plan_cost" property="planCost" />
+        <result column="attach_file_required" property="attachFileRequired" />
     </resultMap>
+
     <resultMap id="timeResultMap" type="com.management.platform.entity.TimeTask" >
         <id column="id" property="id" />
         <result column="name" property="name" />
@@ -97,16 +99,16 @@
         <result column="sap_task_code" property="sapTaskCode" />
         <result column="stages_name" property="stagesName" />
         <result column="department_name" property="departmentName" />
-
-<!--        <result column="charge_one_id" property="chargeOneId" />-->
-<!--        <result column="charge_one_status" property="chargeOneStatus" />-->
-<!--        <result column="charge_one_time" property="chargeOneTime" />-->
-<!--        <result column="charge_two_id" property="chargeTwoId" />-->
-<!--        <result column="charge_two_status" property="chargeTwoStatus" />-->
-<!--        <result column="charge_two_time" property="chargeTwoTime" />-->
-<!--        <result column="charge_stage" property="chargeStage" />-->
-<!--        <result column="final_charge_status" property="finalChargeStatus" />-->
-<!--        <result column="file_reject_reason" property="fileRejectReason"></result>-->
+        <result column="attach_file_required" property="attachFileRequired" />
+        <!--        <result column="charge_one_id" property="chargeOneId" />-->
+        <!--        <result column="charge_one_status" property="chargeOneStatus" />-->
+        <!--        <result column="charge_one_time" property="chargeOneTime" />-->
+        <!--        <result column="charge_two_id" property="chargeTwoId" />-->
+        <!--        <result column="charge_two_status" property="chargeTwoStatus" />-->
+        <!--        <result column="charge_two_time" property="chargeTwoTime" />-->
+        <!--        <result column="charge_stage" property="chargeStage" />-->
+        <!--        <result column="final_charge_status" property="finalChargeStatus" />-->
+        <!--        <result column="file_reject_reason" property="fileRejectReason"></result>-->
     </resultMap>
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
@@ -679,61 +681,61 @@
     <select id="getTaskFileChargePageTotal" resultType="java.lang.Integer">
         select count(*)
         from
-            (
-                select tf.task_id
-                from task_files tf
-                         left join task on tf.task_id = task.id
-                         left join project p on task.project_id = p.id
-                <where>
-                    tf.need_file_charge = 1
-                    and tf.final_charge_status = 0
-                    and task.task_status = 0
-                    and task.company_id = #{queryBO.companyId}
-                    and case tf.charge_stage
-                    when 1 then tf.charge_one_id = #{queryBO.userId} and tf.charge_one_status = 0
-                    when 2 then tf.charge_two_id = #{queryBO.userId} and tf.charge_two_status = 0
-                    end
-                    <if test="queryBO.taskName != null and queryBO.taskName != ''">
-                        and task.name like concat('%',#{queryBO.taskName},'%')
-                    </if>
-                    <if test="deptIds!=null and deptIds.size()>0">
-                        and p.dept_id in
-                        <foreach collection="deptIds" open="(" close=")" separator="," item="item">
-                            #{item}
-                        </foreach>
-                    </if>
-                </where>
-                group by tf.task_id
-            )tmp1
+        (
+        select tf.task_id
+        from task_files tf
+        left join task on tf.task_id = task.id
+        left join project p on task.project_id = p.id
+        <where>
+            tf.need_file_charge = 1
+            and tf.final_charge_status = 0
+            and task.task_status = 0
+            and task.company_id = #{queryBO.companyId}
+            and case tf.charge_stage
+            when 1 then tf.charge_one_id = #{queryBO.userId} and tf.charge_one_status = 0
+            when 2 then tf.charge_two_id = #{queryBO.userId} and tf.charge_two_status = 0
+            end
+            <if test="queryBO.taskName != null and queryBO.taskName != ''">
+                and task.name like concat('%',#{queryBO.taskName},'%')
+            </if>
+            <if test="deptIds!=null and deptIds.size()>0">
+                and p.dept_id in
+                <foreach collection="deptIds" open="(" close=")" separator="," item="item">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+        group by tf.task_id
+        )tmp1
     </select>
     <select id="getProjectAllTaskTimeCost"
             resultType="com.management.platform.entity.vo.ProjectTaskTimeCostVO">
         SELECT task.id as taskId,ifnull(task_executor.`plan_hours`,0) as planHours,
-        (SELECT IFNULL(SUM(working_time),0) FROM report WHERE report.`task_id` = task.id AND report.`state` = 1
-                                                          and report.creator_id = task_executor.executor_id) AS realHours,
-        task_executor.executor_id as executorId
+               (SELECT IFNULL(SUM(working_time),0) FROM report WHERE report.`task_id` = task.id AND report.`state` = 1
+                                                                 and report.creator_id = task_executor.executor_id) AS realHours,
+               task_executor.executor_id as executorId
         FROM task
-        LEFT JOIN project ON project.id = task.`project_id`
-        left join task_executor on task_executor.task_id=task.id
+                 LEFT JOIN project ON project.id = task.`project_id`
+                 left join task_executor on task_executor.task_id=task.id
         WHERE task.project_id = #{projectId}
           and project.id = #{projectId}
     </select>
     <select id="getProjectTaskTimeCostByIds" resultType="com.management.platform.entity.vo.ProjectTimeCostVO">
         select project_id,sum(planHours) as planHoursSum,sum(realHours) as realHoursSum
         from
-            (
-                SELECT task.project_id,task.id as taskId,ifnull(task_executor.`plan_hours`,0) as planHours,
-                       (SELECT IFNULL(SUM(working_time),0) FROM report
-                        WHERE report.`task_id` = task.id AND report.`state` = 1 and report.creator_id = task_executor.executor_id) AS realHours,
-                       task_executor.executor_id as executorId
-                FROM task
-                         LEFT JOIN project ON project.id = task.`project_id`
-                         left join task_executor on task_executor.task_id=task.id
-                WHERE task.project_id in
-                      <foreach collection="projectIds" item="projectId" separator="," open="(" close=")">
-                            #{projectId}
-                        </foreach>
-            )tmp1
+        (
+        SELECT task.project_id,task.id as taskId,ifnull(task_executor.`plan_hours`,0) as planHours,
+        (SELECT IFNULL(SUM(working_time),0) FROM report
+        WHERE report.`task_id` = task.id AND report.`state` = 1 and report.creator_id = task_executor.executor_id) AS realHours,
+        task_executor.executor_id as executorId
+        FROM task
+        LEFT JOIN project ON project.id = task.`project_id`
+        left join task_executor on task_executor.task_id=task.id
+        WHERE task.project_id in
+        <foreach collection="projectIds" item="projectId" separator="," open="(" close=")">
+            #{projectId}
+        </foreach>
+        )tmp1
         group by project_id
     </select>
 </mapper>

+ 3 - 0
fhKeeper/formulahousekeeper/timesheet/src/components/taskComponent.vue

@@ -41,6 +41,9 @@
                     </el-option>
                 </el-select>
             </el-form-item>
+            <el-form-item label="任务完成校验" v-if="user.timeType.taskFileCharge">
+                <el-checkbox v-model="addForm.attachFileRequired" >是否必须上传成果文件</el-checkbox>
+            </el-form-item>
             <el-form-item  :label="$t('taskdefinition')" prop="name">
                 <el-input v-model="addForm.name" :maxlength="40" :disabled="(this.addForm.id != null && user.id != this.addForm.createrId && currentProject.inchargerId != user.id) && !permissions.projectManagement && !permissions.editAnyTask && !(groupResponsibleId == user.id)" :placeholder="$t('enterthetaskcontent')" clearable></el-input>
             </el-form-item>