|
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.management.platform.entity.*;
|
|
|
import com.management.platform.mapper.*;
|
|
|
+import com.management.platform.service.CompanyDingdingService;
|
|
|
import com.management.platform.service.ProjectDocumentService;
|
|
|
import com.management.platform.service.WxCorpInfoService;
|
|
|
import com.management.platform.task.SFTPAsyncUploader;
|
|
@@ -13,6 +14,7 @@ import com.management.platform.util.DocumentTypeUtil;
|
|
|
import com.management.platform.util.FileUtil;
|
|
|
import com.management.platform.util.HttpRespMsg;
|
|
|
import com.management.platform.util.MessageUtils;
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.util.StringUtils;
|
|
@@ -27,7 +29,6 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.time.LocalDateTime;
|
|
|
-import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.UUID;
|
|
|
|
|
@@ -71,6 +72,9 @@ public class TaskFilesController {
|
|
|
@Resource
|
|
|
private WxCorpInfoMapper wxCorpInfoMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private CompanyDingdingService companyDingdingService;
|
|
|
+
|
|
|
/**
|
|
|
* 获取该项目下的所有有效的文件列表
|
|
|
* @param keyword
|
|
@@ -273,7 +277,13 @@ public class TaskFilesController {
|
|
|
|
|
|
@RequestMapping(value="delete")
|
|
|
public HttpRespMsg delFile(@RequestParam Integer id,HttpServletRequest request) {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
TaskFiles taskFiles = taskFilesMapper.selectById(id);
|
|
|
+ User user = userMapper.selectById(request.getHeader("Token"));
|
|
|
+ if(!taskFiles.getCreatorId().equals(user.getId())){
|
|
|
+ msg.setError("您非文件上传人,无法删除");
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
if (taskFiles.getDocumentId() == null) {
|
|
|
//仅当前任务上传的,需要把文件删掉
|
|
|
File dir = new File(uploadPath);
|
|
@@ -285,7 +295,7 @@ public class TaskFilesController {
|
|
|
taskFilesMapper.deleteById(id);
|
|
|
|
|
|
//判断文件阶段做回退处理
|
|
|
- User user = userMapper.selectById(request.getHeader("Token"));
|
|
|
+
|
|
|
TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
|
|
|
if(1 == timeType.getTaskFileCharge()){
|
|
|
this.resetTaskChargeStatus(taskFiles.getTaskId());
|
|
@@ -312,7 +322,7 @@ public class TaskFilesController {
|
|
|
// wxCorpInfoService.sendWXCorpMsg(info,tmpUser.getCorpwxUserid(),content+",请及时审核",null, WxCorpInfoServiceImpl.TEXT_CARD_MSG_TASK_FILE_UPDATE);
|
|
|
// }
|
|
|
|
|
|
- HttpRespMsg msg = new HttpRespMsg();
|
|
|
+
|
|
|
msg.data=MessageUtils.message("file.deleteSuc");
|
|
|
return msg;
|
|
|
}
|
|
@@ -341,35 +351,58 @@ public class TaskFilesController {
|
|
|
public HttpRespMsg getTaskFiles(Integer taskId,HttpServletRequest request) {
|
|
|
User user = userMapper.selectById(request.getHeader("Token"));
|
|
|
Task task = taskMapper.selectById(taskId);
|
|
|
- HashMap<String,Object> map = new HashMap<>();
|
|
|
TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id",user.getCompanyId()));
|
|
|
+ CompanyDingding dingding = companyDingdingService.getOne(new LambdaQueryWrapper<CompanyDingding>().eq(CompanyDingding::getCompanyId, user.getCompanyId()));
|
|
|
+ String fileChargeStatusText = "";
|
|
|
+ int fileChargeStatus = 0;
|
|
|
if(1 == timeType.getTaskFileCharge()){
|
|
|
- if(1 == task.getFinalChargeStatus()){
|
|
|
- map.put("fileChargeStatusText","审核通过");
|
|
|
- } else if (0 == task.getFinalChargeStatus()) {
|
|
|
- String name = "";
|
|
|
- String statusText = "";
|
|
|
- int finalStatus = 1==task.getChargeStage()?task.getChargeOneStatus():task.getChargeTwoStatus();
|
|
|
- String userId = 1==task.getChargeStage()?task.getChargeOneId():task.getChargeTwoId();
|
|
|
- User chargeUser = userMapper.selectById(userId);
|
|
|
- if(null != chargeUser){
|
|
|
- name = chargeUser.getName();
|
|
|
- }
|
|
|
- switch (finalStatus)
|
|
|
- {
|
|
|
- case 0: statusText = "待审核";break;
|
|
|
- case 1: statusText = "通过";break;
|
|
|
- case 2: statusText = "驳回";break;
|
|
|
+ if(org.apache.commons.lang3.StringUtils.isNotBlank(task.getChargeOneId())
|
|
|
+ &&org.apache.commons.lang3.StringUtils.isNotBlank(task.getChargeTwoId())){
|
|
|
+ if(1 == task.getFinalChargeStatus()){
|
|
|
+ fileChargeStatusText = "审核通过";
|
|
|
+ fileChargeStatus = 1;
|
|
|
+ } else if (0 == task.getFinalChargeStatus()) {
|
|
|
+ String name = "";
|
|
|
+ String statusText = "";
|
|
|
+ String userWxId = "";
|
|
|
+ int finalStatus = 1==task.getChargeStage()?task.getChargeOneStatus():task.getChargeTwoStatus();
|
|
|
+ String userId = 1==task.getChargeStage()?task.getChargeOneId():task.getChargeTwoId();
|
|
|
+ User chargeUser = userMapper.selectById(userId);
|
|
|
+ if(null != chargeUser){
|
|
|
+ if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
+ userWxId = chargeUser.getCorpwxRealUserid();
|
|
|
+ }else if(dingding!=null&&dingding.getContactNeedTranslate()==1){
|
|
|
+ userWxId = chargeUser.getDingdingUserid();
|
|
|
+ }
|
|
|
+ name = chargeUser.getName();
|
|
|
+ }
|
|
|
+ switch (finalStatus)
|
|
|
+ {
|
|
|
+ case 0: statusText = "待审核";fileChargeStatus = 0;break;
|
|
|
+ case 1: statusText = "通过";break;
|
|
|
+ case 2: statusText = "驳回";fileChargeStatus = 2;break;
|
|
|
+ }
|
|
|
+ if(org.apache.commons.lang3.StringUtils.isBlank(userWxId)){
|
|
|
+ fileChargeStatusText = statusText+"("+name+")";
|
|
|
+ }else{
|
|
|
+ fileChargeStatusText = statusText+"("+("$userName=" + userWxId + "$")+")";
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
- map.put("fileChargeStatusText",statusText+"("+name+")");
|
|
|
}
|
|
|
}
|
|
|
List<TaskFiles> list = taskFilesMapper.selectList(new LambdaQueryWrapper<TaskFiles>()
|
|
|
.eq(TaskFiles::getTaskId,taskId)
|
|
|
);
|
|
|
- map.put("fileList",list);
|
|
|
+ if(CollectionUtils.isNotEmpty(list)){
|
|
|
+ for (TaskFiles taskFiles : list) {
|
|
|
+ taskFiles.setFileChargeStatusText(fileChargeStatusText);
|
|
|
+ taskFiles.setFileChargeStatus(fileChargeStatus);
|
|
|
+ }
|
|
|
+ }
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
- msg.data = map;
|
|
|
+ msg.data = list;
|
|
|
return msg;
|
|
|
}
|
|
|
|