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