#weaver-njpmsreport-2# 修复漏洞
parent
1bb01f6085
commit
5706027a6b
@ -1,199 +0,0 @@
|
||||
package com.weaver.seconddev.njprojectreport.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.common.cache.tablecache.impl.ComInfoCache;
|
||||
import com.weaver.project.service.RemoteMainlineService;
|
||||
import com.weaver.teams.security.context.UserContext;
|
||||
import com.weaver.workflow.common.util.OrgUtil;
|
||||
import com.weaver.workflow.core.entity.publicApi.RequestPAResultMessageEntity;
|
||||
import com.weaver.workflow.common.entity.org.WeaUser;
|
||||
import com.weaver.workflow.common.framework.util.ServiceUtil;
|
||||
import com.weaver.workflow.core.entity.publicApi.RequestPAResultEntity;
|
||||
import com.weaver.workflow.core.services.RequestPAService;
|
||||
import com.weaver.workflow.core.services.impl.RequestPAServiceImpl;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.weaver.seconddev.njprojectreport.util.RequestUtil;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/secondev/njpmsrequest")
|
||||
public class ProjectRequestController {
|
||||
|
||||
//日志
|
||||
private final Logger log = LoggerFactory.getLogger(ProjectRequestController.class);
|
||||
|
||||
public String tenant_key = "t7akvdnf84" ;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping({"/doCreateRequest"})
|
||||
@WeaPermission(publicPermission = true)
|
||||
public RequestPAResultEntity doCreateRequest(HttpServletRequest request) {
|
||||
|
||||
log.info("doCreateRequest");
|
||||
RequestPAResultEntity paResult = new RequestPAResultEntity();
|
||||
|
||||
Long employeeId = UserContext.getCurrentEmployeeId();
|
||||
String requestname = "验收项目知识分享流程超时未提交提醒" ;
|
||||
String remark = "请尽快提交" ;
|
||||
|
||||
String userId = request.getParameter("userId");
|
||||
String workflowId = request.getParameter("workflowId");
|
||||
String isnextflow = request.getParameter("isnextflow");
|
||||
String requestLevel= request.getParameter("requestLevel");
|
||||
String managerid = request.getParameter("managerid");
|
||||
String mainlineid = request.getParameter("mainlineid");
|
||||
|
||||
if(StringUtils.isBlank(requestLevel)){
|
||||
requestLevel = "0";
|
||||
}
|
||||
if(StringUtils.isBlank(isnextflow)){
|
||||
isnextflow = "0";
|
||||
}
|
||||
|
||||
log.info("doCreateRequest-userId:"+userId);
|
||||
log.info("doCreateRequest-workflowId:"+workflowId);
|
||||
log.info("doCreateRequest-isnextflow:"+isnextflow);
|
||||
log.info("doCreateRequest-requestLevel:"+requestLevel);
|
||||
|
||||
log.info("doCreateRequest-managerid:"+managerid);
|
||||
log.info("doCreateRequest-mainlineid:"+mainlineid);
|
||||
|
||||
if(StringUtils.isBlank(workflowId)){
|
||||
RequestPAResultMessageEntity resultMessage = new RequestPAResultMessageEntity();
|
||||
resultMessage.setErrcode("300");
|
||||
resultMessage.setErrmsg("获取创建的流程为空,无法提交");
|
||||
paResult.setMessage(resultMessage);
|
||||
return paResult;
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(userId)){
|
||||
RequestPAResultMessageEntity resultMessage = new RequestPAResultMessageEntity();
|
||||
resultMessage.setErrcode("300");
|
||||
resultMessage.setErrmsg("获取创建人为空,无法提交");
|
||||
paResult.setMessage(resultMessage);
|
||||
return paResult;
|
||||
}
|
||||
|
||||
// if(StringUtils.isBlank(managerid)){
|
||||
// RequestPAResultMessageEntity resultMessage = new RequestPAResultMessageEntity();
|
||||
// resultMessage.setErrcode("300");
|
||||
// resultMessage.setErrmsg("项目的项目经理为空,无法提交");
|
||||
// paResult.setMessage(resultMessage);
|
||||
// return paResult;
|
||||
// }
|
||||
//
|
||||
// if(StringUtils.isBlank(mainlineid)){
|
||||
// RequestPAResultMessageEntity resultMessage = new RequestPAResultMessageEntity();
|
||||
// resultMessage.setErrcode("300");
|
||||
// resultMessage.setErrmsg("项目编码空,无法提交");
|
||||
// paResult.setMessage(resultMessage);
|
||||
// return paResult;
|
||||
// }
|
||||
|
||||
String managerSubcompanyId = "" ;
|
||||
String mainlinename = "" ;
|
||||
String username = "";
|
||||
|
||||
// if(StringUtils.isNotEmpty(userId)){
|
||||
// HrmEmployeeComInfo hrmEmployeeComInfo = comInfoCache.getCacheById(HrmEmployeeComInfo.class,userId) ;
|
||||
// username = CommonUtils.null2String(hrmEmployeeComInfo.getUsername()+"") ;
|
||||
// }
|
||||
//
|
||||
// if(StringUtils.isNotEmpty(managerid)){
|
||||
// HrmEmployeeComInfo hrmEmployeeComInfo = comInfoCache.getCacheById(HrmEmployeeComInfo.class,managerid) ;
|
||||
// managerSubcompanyId = CommonUtils.null2String(hrmEmployeeComInfo.getSubcompanyId()+"") ;
|
||||
// }
|
||||
|
||||
// if(StringUtils.isNotEmpty(mainlineid)){
|
||||
// SimpleMainline simpleMainline = remoteMainlineService.get(Long.parseLong(mainlineid),tenant_key);
|
||||
// log.info("simpleMainline:"+simpleMainline.toString());
|
||||
// Map<String, Object> recordMap = RequestUtil.getmainlinename(mainlineid,tenant_key);
|
||||
// if(recordMap !=null && recordMap.size()>0){
|
||||
// mainlinename = CommonUtils.null2String(recordMap.get("name"));
|
||||
// }
|
||||
// }
|
||||
|
||||
Map<String, Object> requestMap = new HashMap<String, Object>();
|
||||
requestMap.put("userId",userId);
|
||||
requestMap.put("workflowId",workflowId);
|
||||
requestMap.put("requestname",requestname);
|
||||
requestMap.put("remark",remark);
|
||||
requestMap.put("isnextflow",isnextflow);
|
||||
requestMap.put("requestLevel",requestLevel);
|
||||
|
||||
JSONObject formData = new JSONObject();
|
||||
|
||||
JSONArray dataDetails = new JSONArray();
|
||||
JSONObject dataDetail = new JSONObject();
|
||||
dataDetail.put("dataKey","resource_n");
|
||||
dataDetail.put("content",employeeId);
|
||||
dataDetails.add(dataDetail);
|
||||
|
||||
// dataDetail = new JSONObject();
|
||||
// dataDetail.put("dataKey","mutiresource");
|
||||
// dataDetail.put("content",managerid);
|
||||
// dataDetails.add(dataDetail);
|
||||
|
||||
dataDetail = new JSONObject();
|
||||
dataDetail.put("dataKey","fenbu");
|
||||
dataDetail.put("content",managerSubcompanyId);
|
||||
dataDetails.add(dataDetail);
|
||||
|
||||
// dataDetail = new JSONObject();
|
||||
// dataDetail.put("dataKey","Project");
|
||||
// dataDetail.put("content",mainlineid);
|
||||
// dataDetails.add(dataDetail);
|
||||
|
||||
dataDetail = new JSONObject();
|
||||
dataDetail.put("dataKey","description");
|
||||
dataDetail.put("content","1111");
|
||||
dataDetails.add(dataDetail);
|
||||
|
||||
dataDetail = new JSONObject();
|
||||
dataDetail.put("dataKey","duohangwenbenhtml");
|
||||
dataDetail.put("content","<p>项目:"+mainlinename+" 未提交<第三集团军知识分享提交流程>,请务必尽快提交,如有疑问,请联系:"+username+"</p>");
|
||||
|
||||
dataDetails.add(dataDetail);
|
||||
|
||||
formData.put("dataDetails",dataDetails);
|
||||
requestMap.put("formData",formData);
|
||||
|
||||
log.info("doCreateRequest-create:params:{}", JSON.toJSONString(requestMap));
|
||||
|
||||
WeaUser user = getUser(Long.parseLong(userId));
|
||||
RequestPAService paService = (RequestPAService) ServiceUtil.getService(RequestPAServiceImpl.class, user);
|
||||
|
||||
return paService.create(requestMap);
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
private WeaUser getUser(long userId) {
|
||||
if (userId > 0L) {
|
||||
WeaUser user = OrgUtil.getUser(userId);
|
||||
if (user != null && user.getUserId() != null && user.getUserId() > 0L) {
|
||||
return user;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue