|
@@ -9,7 +9,6 @@ import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.common.utils.bean.BeanValidators;
|
|
import com.ruoyi.common.utils.bean.BeanValidators;
|
|
|
import com.ruoyi.project.bo.ProjectStaffRecordInput;
|
|
import com.ruoyi.project.bo.ProjectStaffRecordInput;
|
|
|
import com.ruoyi.project.bo.ProjectStaffRecordOut;
|
|
import com.ruoyi.project.bo.ProjectStaffRecordOut;
|
|
|
-import com.ruoyi.project.bo.ProjectTaskListOut;
|
|
|
|
|
import com.ruoyi.project.domain.ProjectStaffRecord;
|
|
import com.ruoyi.project.domain.ProjectStaffRecord;
|
|
|
import com.ruoyi.project.domain.ProjectStaffRecordLog;
|
|
import com.ruoyi.project.domain.ProjectStaffRecordLog;
|
|
|
import com.ruoyi.project.domain.ProjectTask;
|
|
import com.ruoyi.project.domain.ProjectTask;
|
|
@@ -19,6 +18,7 @@ import com.ruoyi.project.mapper.ProjectTaskMapper;
|
|
|
import com.ruoyi.project.service.ProjectStaffRecordService;
|
|
import com.ruoyi.project.service.ProjectStaffRecordService;
|
|
|
import com.ruoyi.system.mapper.SysUserMapper;
|
|
import com.ruoyi.system.mapper.SysUserMapper;
|
|
|
import com.ruoyi.system.service.ISysDeptService;
|
|
import com.ruoyi.system.service.ISysDeptService;
|
|
|
|
|
+import com.ruoyi.system.service.ISysUserService;
|
|
|
import com.ruoyi.weChat.service.WeChatService;
|
|
import com.ruoyi.weChat.service.WeChatService;
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -26,8 +26,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import javax.validation.Validator;
|
|
import javax.validation.Validator;
|
|
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
|
public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService {
|
|
public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService {
|
|
@@ -47,6 +49,8 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
|
|
|
private WeChatService weChatService;
|
|
private WeChatService weChatService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ISysDeptService deptService;
|
|
private ISysDeptService deptService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private SysUserMapper userMapper;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public AjaxResult add(ProjectStaffRecord in) {
|
|
public AjaxResult add(ProjectStaffRecord in) {
|
|
@@ -55,18 +59,43 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
|
|
|
in.setAid(userId);
|
|
in.setAid(userId);
|
|
|
in.setName(username);
|
|
in.setName(username);
|
|
|
if(in.getProcessStatus()>1)in.setProcessStatus(1);
|
|
if(in.getProcessStatus()>1)in.setProcessStatus(1);
|
|
|
|
|
+ boolean flag=false;
|
|
|
if (SecurityUtils.hashRoles(UserRolesType.INSPECTORS.getCode())){
|
|
if (SecurityUtils.hashRoles(UserRolesType.INSPECTORS.getCode())){
|
|
|
in.setProcessStatus(2);
|
|
in.setProcessStatus(2);
|
|
|
sysUserMapper.userAddDuration(userId,in.getDuration());
|
|
sysUserMapper.userAddDuration(userId,in.getDuration());
|
|
|
projectTaskMapper.projectAddDuration(in.getPid(),in.getDuration());
|
|
projectTaskMapper.projectAddDuration(in.getPid(),in.getDuration());
|
|
|
}else {
|
|
}else {
|
|
|
-// weChatService.addNotice();
|
|
|
|
|
|
|
+ flag=true;
|
|
|
}
|
|
}
|
|
|
addRecordLog(in);
|
|
addRecordLog(in);
|
|
|
projectStaffRecordMapper.insertSelective(in);
|
|
projectStaffRecordMapper.insertSelective(in);
|
|
|
|
|
+ if (flag){
|
|
|
|
|
+ addWechatAppSend(in, String.format("[%s]发起研发打卡,请及时审核!", username));
|
|
|
|
|
+ }
|
|
|
return AjaxResult.success();
|
|
return AjaxResult.success();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private void addWechatAppSend(ProjectStaffRecord in, String remarks) {
|
|
|
|
|
+ //获取当事人
|
|
|
|
|
+ String openId=null;
|
|
|
|
|
+ if (in.getProcessStatus()==1){
|
|
|
|
|
+ SysUser sysUser = userMapper.selectSuperUserByUid(in.getAid());
|
|
|
|
|
+ openId=sysUser.getOpenId();
|
|
|
|
|
+ if (StringUtils.isNull(openId)){
|
|
|
|
|
+ log.debug(String.format("查询上级openId为空,%s",remarks));
|
|
|
|
|
+ }
|
|
|
|
|
+ }else if(in.getProcessStatus()==2||in.getProcessStatus()==3){
|
|
|
|
|
+ SysUser sysUser = userMapper.selectUserById(in.getAid());
|
|
|
|
|
+ openId=sysUser.getOpenId();
|
|
|
|
|
+ if (StringUtils.isNull(openId)){
|
|
|
|
|
+ log.debug(String.format("查询发起人openId,%s",remarks));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isNotNull(openId)){
|
|
|
|
|
+ weChatService.addNotice(openId, in.getId(),new Date(),remarks);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private void addRecordLog(ProjectStaffRecord in) {
|
|
private void addRecordLog(ProjectStaffRecord in) {
|
|
|
ProjectStaffRecordLog log = new ProjectStaffRecordLog();
|
|
ProjectStaffRecordLog log = new ProjectStaffRecordLog();
|
|
|
log.setPsrId(in.getId());
|
|
log.setPsrId(in.getId());
|
|
@@ -96,11 +125,18 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
|
|
|
@Override
|
|
@Override
|
|
|
public AjaxResult update(ProjectStaffRecord in) {
|
|
public AjaxResult update(ProjectStaffRecord in) {
|
|
|
Long userId = SecurityUtils.getUserId();
|
|
Long userId = SecurityUtils.getUserId();
|
|
|
|
|
+ ProjectStaffRecord projectStaffRecord = projectStaffRecordMapper.selectByPrimaryKey(in.getId());
|
|
|
|
|
+ if (projectStaffRecord.getProcessStatus()!=0&&projectStaffRecord.getProcessStatus()!=3){
|
|
|
|
|
+ AjaxResult.success("打卡只有草稿和驳回状态才可以修改!");
|
|
|
|
|
+ }
|
|
|
String username = SecurityUtils.getLoginUser().getUser().getNickName();
|
|
String username = SecurityUtils.getLoginUser().getUser().getNickName();
|
|
|
in.setAid(userId);
|
|
in.setAid(userId);
|
|
|
in.setName(username);
|
|
in.setName(username);
|
|
|
if(in.getProcessStatus()>1)in.setProcessStatus(1);
|
|
if(in.getProcessStatus()>1)in.setProcessStatus(1);
|
|
|
projectStaffRecordMapper.updateByPrimaryKeySelective(in);
|
|
projectStaffRecordMapper.updateByPrimaryKeySelective(in);
|
|
|
|
|
+ if (in.getProcessStatus()==1){
|
|
|
|
|
+ addWechatAppSend(in, String.format("[%s]发起研发打卡,及时是审核!", username));
|
|
|
|
|
+ }
|
|
|
addRecordLog(in);
|
|
addRecordLog(in);
|
|
|
return AjaxResult.success();
|
|
return AjaxResult.success();
|
|
|
}
|
|
}
|
|
@@ -110,6 +146,7 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
|
|
|
ProjectStaffRecord newP = new ProjectStaffRecord();
|
|
ProjectStaffRecord newP = new ProjectStaffRecord();
|
|
|
newP.setId(in.getId());
|
|
newP.setId(in.getId());
|
|
|
newP.setProcessStatus(in.getProcessStatus());
|
|
newP.setProcessStatus(in.getProcessStatus());
|
|
|
|
|
+ String username=SecurityUtils.getLoginUser().getUser().getNickName();
|
|
|
if (in.getProcessStatus()==2){
|
|
if (in.getProcessStatus()==2){
|
|
|
ProjectStaffRecord use = projectStaffRecordMapper.selectByPrimaryKey(in.getId());
|
|
ProjectStaffRecord use = projectStaffRecordMapper.selectByPrimaryKey(in.getId());
|
|
|
if (use.getProcessStatus()!=1){
|
|
if (use.getProcessStatus()!=1){
|
|
@@ -117,11 +154,16 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
|
|
|
}
|
|
}
|
|
|
sysUserMapper.userAddDuration(use.getAid(),use.getDuration());
|
|
sysUserMapper.userAddDuration(use.getAid(),use.getDuration());
|
|
|
projectTaskMapper.projectAddDuration(use.getPid(),use.getDuration());
|
|
projectTaskMapper.projectAddDuration(use.getPid(),use.getDuration());
|
|
|
- newP.setExamineName(SecurityUtils.getLoginUser().getUser().getNickName());
|
|
|
|
|
|
|
+ newP.setExamineName(username);
|
|
|
newP.setExamineId(SecurityUtils.getUserId());
|
|
newP.setExamineId(SecurityUtils.getUserId());
|
|
|
newP.setExamineTime(new Date());
|
|
newP.setExamineTime(new Date());
|
|
|
}
|
|
}
|
|
|
projectStaffRecordMapper.updateByPrimaryKeySelective(newP);
|
|
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,"驳回"));
|
|
|
|
|
+ }
|
|
|
addRecordLog(in);
|
|
addRecordLog(in);
|
|
|
return AjaxResult.success();
|
|
return AjaxResult.success();
|
|
|
}
|
|
}
|