浏览代码

批量审核开发

anderx 1 年之前
父节点
当前提交
5c6adc8272

+ 16 - 4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ProjectTaskController.java

@@ -12,10 +12,7 @@ import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.file.FileUploadUtils;
 import com.ruoyi.common.utils.file.MimeTypeUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.project.bo.ProjectListInput;
-import com.ruoyi.project.bo.ProjectStaffRecordInput;
-import com.ruoyi.project.bo.ProjectStaffRecordOut;
-import com.ruoyi.project.bo.ProjectTaskListOut;
+import com.ruoyi.project.bo.*;
 import com.ruoyi.project.domain.ProjectStaff;
 import com.ruoyi.project.domain.ProjectStaffRecord;
 import com.ruoyi.project.domain.ProjectStaffRecordLog;
@@ -181,6 +178,21 @@ public class ProjectTaskController extends BaseController {
         return projectStaffRecordService.examineRecord(in);
     }
 
+
+    /**
+     * 批量审核成员打卡
+     * @param in
+     * @return
+     */
+    @PostMapping("/batchExamineRecord")
+    @ApiOperation("批量审核成员打卡")
+    public AjaxResult batchExamineRecord( @RequestBody batchExamineRecordInput in){
+        if (in.getProcessStatus()!=2 && in.getProcessStatus()!=3){
+            return AjaxResult.error("审核状态错误");
+        }
+        return projectStaffRecordService.batchExamineRecord(in);
+    }
+
     /**
      * 成员打卡列表
      * @param in

+ 204 - 0
ruoyi-system/src/main/java/com/ruoyi/project/bo/batchExamineRecordInput.java

@@ -0,0 +1,204 @@
+package com.ruoyi.project.bo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.util.Date;
+
+public class batchExamineRecordInput {
+    /**
+     * 项目编号
+     */
+    private String id;
+
+    /**
+     * 项目编号
+     */
+    private Long pid;
+
+    /**
+     * 成员编号
+     */
+    private Long aid;
+
+    /**
+     * 成员名称
+     */
+    private String name;
+
+    /**
+     * 项目状态
+     */
+    private Integer projectStatus;
+
+    /**
+     * 内容
+     */
+    private String content;
+
+    /**
+     * 附件地址
+     */
+    private String annexUrl;
+
+    /**
+     * 创建时间
+     */
+
+    private Date createTime;
+
+    /**
+     * 审核状态 0=未发起,1=待审核,2=已审核,3=驳回
+     */
+    private Integer processStatus;
+
+    /**
+     * 时长
+     */
+    private Double duration;
+
+    /**
+     * 审核人编号
+     */
+    private Long examineId;
+
+    /**
+     * 审核时间
+     */
+    private Date examineTime;
+
+    /**
+     * 审核名称
+     */
+    private String examineName;
+    private String examineContent;
+
+    /**
+     * 打卡时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date recordTime;
+
+    private static final long serialVersionUID = 1L;
+
+    public String getExamineContent() {
+        return examineContent;
+    }
+
+    public void setExamineContent(String examineContent) {
+        this.examineContent = examineContent;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public Long getPid() {
+        return pid;
+    }
+
+    public void setPid(Long pid) {
+        this.pid = pid;
+    }
+
+    public Long getAid() {
+        return aid;
+    }
+
+    public void setAid(Long aid) {
+        this.aid = aid;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getProjectStatus() {
+        return projectStatus;
+    }
+
+    public void setProjectStatus(Integer projectStatus) {
+        this.projectStatus = projectStatus;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public String getAnnexUrl() {
+        return annexUrl;
+    }
+
+    public void setAnnexUrl(String annexUrl) {
+        this.annexUrl = annexUrl;
+    }
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Integer getProcessStatus() {
+        return processStatus;
+    }
+
+    public void setProcessStatus(Integer processStatus) {
+        this.processStatus = processStatus;
+    }
+
+    public Double getDuration() {
+        return duration;
+    }
+
+    public void setDuration(Double duration) {
+        this.duration = duration;
+    }
+
+    public Long getExamineId() {
+        return examineId;
+    }
+
+    public void setExamineId(Long examineId) {
+        this.examineId = examineId;
+    }
+
+    public Date getExamineTime() {
+        return examineTime;
+    }
+
+    public void setExamineTime(Date examineTime) {
+        this.examineTime = examineTime;
+    }
+
+    public String getExamineName() {
+        return examineName;
+    }
+
+    public void setExamineName(String examineName) {
+        this.examineName = examineName;
+    }
+
+    public Date getRecordTime() {
+        return recordTime;
+    }
+
+    public void setRecordTime(Date recordTime) {
+        this.recordTime = recordTime;
+    }
+}
+

+ 5 - 0
ruoyi-system/src/main/java/com/ruoyi/project/service/ProjectStaffRecordService.java

@@ -3,6 +3,7 @@ package com.ruoyi.project.service;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.project.bo.ProjectStaffRecordInput;
 import com.ruoyi.project.bo.ProjectStaffRecordOut;
+import com.ruoyi.project.bo.batchExamineRecordInput;
 import com.ruoyi.project.domain.ProjectStaffRecord;
 import com.ruoyi.project.domain.ProjectStaffRecordLog;
 
@@ -16,6 +17,8 @@ public interface ProjectStaffRecordService {
 
     AjaxResult examineRecord(ProjectStaffRecord in);
 
+    AjaxResult batchExamineRecord(batchExamineRecordInput in);
+
     List<ProjectStaffRecordOut> listRecord(ProjectStaffRecordInput in);
 
     String importProject(List<ProjectStaffRecordOut> list, boolean updateSupport);
@@ -35,4 +38,6 @@ public interface ProjectStaffRecordService {
     void downloadFiles(String ids, HttpServletResponse response);
 
     AjaxResult checkRecordTime(AjaxResult ajaxResult, ProjectStaffRecord in);
+
+
 }

+ 70 - 22
ruoyi-system/src/main/java/com/ruoyi/project/service/impl/ProjectStaffRecordServiceImpl.java

@@ -16,6 +16,7 @@ import com.ruoyi.common.utils.file.FileUtils;
 import com.ruoyi.project.bo.MyMonthDays;
 import com.ruoyi.project.bo.ProjectStaffRecordInput;
 import com.ruoyi.project.bo.ProjectStaffRecordOut;
+import com.ruoyi.project.bo.batchExamineRecordInput;
 import com.ruoyi.project.domain.ProjectStaffRecord;
 import com.ruoyi.project.domain.ProjectStaffRecordLog;
 import com.ruoyi.project.domain.ProjectTask;
@@ -96,7 +97,7 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
             flag=true;
         }
         projectStaffRecordMapper.insertSelective(in);
-        addRecordLog(in,flag);
+        addRecordLog(in,flag,new Date());
         if (flag){
             addWechatAppSend(in, String.format("[%s]发起打卡,请及时审核!", username));
         }
@@ -339,6 +340,8 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
     }
 
 
+
+
     /**
      *
      * @param date 当前时间
@@ -425,23 +428,29 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
 
 
     private void addWechatAppSend(ProjectStaffRecord in, String remarks) {
+        addWechatAppSend(in.getId(), in.getProcessStatus(), in.getAid(),remarks);
+    }
+
+
+    private void addWechatAppSend(Long id,Integer processStatus,Long aid, String remarks) {
         //获取当事人
         String openId=null;
-        if (in.getProcessStatus()==1){
-            SysUser sysUser = userMapper.selectSuperUserByUid(in.getAid());
+        if (processStatus==1){
+            SysUser sysUser = userMapper.selectSuperUserByUid(aid);
             openId=sysUser.getOpenId();
             if (StringUtils.isBlank(openId)){
                 log.debug(String.format("查询上级openId为空,%s",remarks));
             }
-        }else if(in.getProcessStatus()==2||in.getProcessStatus()==3){
-            SysUser sysUser = userMapper.selectUserById(in.getAid());
+        }else if(processStatus==2||processStatus==3){
+            SysUser sysUser = userMapper.selectUserById(aid
+            );
             openId=sysUser.getOpenId();
             if (StringUtils.isBlank(openId)){
                 log.debug(String.format("查询发起人openId为空,%s",remarks));
             }
         }
         if (StringUtils.isNotBlank(openId)){
-            weChatService.addNotice(openId, in.getId(),new Date(),remarks);
+            weChatService.addNotice(openId, id,new Date(),remarks);
         }
     }
 
@@ -450,10 +459,11 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
      * @param in
      * @param flag  ture=正常流程审核,false=无需审核流程
      */
-    private void addRecordLog(ProjectStaffRecord in,boolean flag) {
+    private void addRecordLog(ProjectStaffRecord in,boolean flag,Date date) {
         ProjectStaffRecordLog log = new ProjectStaffRecordLog();
         log.setPsrId(in.getId());
         log.setProcessStatus(in.getProcessStatus());
+        log.setCreateTime(date);
         if (in.getProcessStatus()<2){
             log.setAid(in.getAid());
             log.setName(in.getName());
@@ -470,6 +480,27 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
         projectStaffRecordLogMapper.insertSelective(log);
     }
 
+    private void addRecordLog(Long id ,Integer processStatus,Long aid,String name,String content,boolean flag,Date date) {
+        ProjectStaffRecordLog log = new ProjectStaffRecordLog();
+        log.setPsrId(id);
+        log.setProcessStatus(processStatus);
+        log.setCreateTime(date);
+        if (processStatus<2){
+            log.setAid(aid);
+            log.setName(name);
+            log.setContent(getContent(processStatus));
+        }else {
+            log.setAid(SecurityUtils.getUserId());
+            log.setName(SecurityUtils.getLoginUser().getUser().getNickName());
+            if (flag){
+                log.setContent(getContent(processStatus)+content);
+            }else {
+                log.setContent("技术总监打卡无需审核");
+            }
+        }
+        projectStaffRecordLogMapper.insertSelective(log);
+    }
+
     private String getContent(Integer processStatus) {
         switch (processStatus) {
             case 0: return "修改了内容!";
@@ -491,45 +522,62 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
         if (in.getProcessStatus()==1){
             addWechatAppSend(in, String.format("[%s]发起打卡,及时是审核!", username));
         }
-        addRecordLog(in,true);
+        addRecordLog(in,true,new Date());
         return AjaxResult.success();
     }
 
     @Override
     public AjaxResult examineRecord(ProjectStaffRecord in) {
+        return examineRecord(in.getId(),in.getProcessStatus(),in.getContent(),new Date());
+    }
+
+    public AjaxResult examineRecord(Long id,Integer processStatus,String content,Date date) {
         ProjectStaffRecord newP = new ProjectStaffRecord();
-        newP.setId(in.getId());
-        newP.setProcessStatus(in.getProcessStatus());
+        newP.setId(id);
+        newP.setProcessStatus(processStatus);
         String username=SecurityUtils.getLoginUser().getUser().getNickName();
-        ProjectStaffRecord use = projectStaffRecordMapper.selectByPrimaryKey(in.getId());
-        in.setAid(use.getAid());
-        if (in.getProcessStatus()==2||in.getProcessStatus()==3){
+        ProjectStaffRecord use = projectStaffRecordMapper.selectByPrimaryKey(id);
+        if (processStatus==2||processStatus==3){
             if (use.getProcessStatus()!=1){
                 AjaxResult.error("项目流程无需审核!");
             }
-            if(in.getProcessStatus()==2){
+            if(processStatus==2){
                 sysUserMapper.userAddDuration(use.getAid(),use.getDuration());
                 projectTaskMapper.projectAddDuration(use.getPid(),use.getDuration());
             }
             newP.setExamineName(username);
             newP.setExamineId(SecurityUtils.getUserId());
-            newP.setExamineTime(new Date());
-            newP.setExamineContent(in.getContent());
+            newP.setExamineTime(date);
+            newP.setExamineContent(content);
         }
         projectStaffRecordMapper.updateByPrimaryKeySelective(newP);
-        if (in.getProcessStatus()==2){
-            addWechatAppSend(in, String.format("[%s]%s您的研发打卡.", username,"同意"));
-        }else if (in.getProcessStatus()==3){
-            addWechatAppSend(in, String.format("[%s]%s您的研发打卡.", username,"驳回"));
+        if (processStatus==2){
+            addWechatAppSend(id,processStatus,use.getAid(), String.format("[%s]%s您的研发打卡.", username,"同意"));
+        }else if (processStatus==3){
+            addWechatAppSend(id,processStatus,use.getAid(), String.format("[%s]%s您的研发打卡.", username,"驳回"));
+        }
+        addRecordLog(id,processStatus, newP.getAid(), username,content,true,date);
+        return AjaxResult.success();
+    }
+
+    @Override
+    public AjaxResult batchExamineRecord(batchExamineRecordInput in) {
+        if (in.getId()!=null){
+            String[] split = in.getId().split(",");
+            Date date=new Date();
+            if (in.getExamineTime()!=null)date.setTime(in.getExamineTime().getTime());
+            for (String s : split) {
+                examineRecord(Long.valueOf(s),in.getProcessStatus(),in.getContent(),date);
+                date.setTime(date.getTime()+2000);
+            }
         }
-        addRecordLog(in,true);
         return AjaxResult.success();
     }
 
     @Override
     public List<ProjectStaffRecordOut> listRecord(ProjectStaffRecordInput in) {
         if (in.getRoleType()==null)in.setRoleType(0);
-            in.setAid(SecurityUtils.getUserId());
+        in.setAid(SecurityUtils.getUserId());
         if (SecurityUtils.hashRoles(UserRolesType.CEO.getCode())||SecurityUtils.hashRoles(UserRolesType.ADMIN.getCode())){
             in.setRoleType(2);
         }

+ 4 - 1
ruoyi-system/src/main/resources/mapper/project/ProjectTaskMapper.xml

@@ -279,8 +279,11 @@
     <if test="name !=null">
       and a.name like concat('%',#{name},'%')
     </if>
+<!--    <if test="startTime !=null and endTime !=null">-->
+<!--      and a.create_time  between #{startTime} and #{endTime}-->
+<!--    </if>-->
     <if test="startTime !=null and endTime !=null">
-      and a.create_time  between #{startTime} and #{endTime}
+      and ( #{startTime}  between a.start_time and a.end_time or  #{endTime}  between a.start_time and a.end_time)
     </if>
     <if test="projectNumber !=null ">
       and a.project_number like concat('%',#{projectNumber},'%')