修改需求
This commit is contained in:
parent
303ca75743
commit
f9dbd1956d
@ -37,6 +37,6 @@ public interface ProjectMapper extends MyMapper<Project> {
|
|||||||
* @param status
|
* @param status
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public void updateProjectStatus(String id, String contractno, int status, String endTime);
|
public void updateProjectStatus(String setuptime,String id, String contractno, int status, String updatetime);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// 项目创建者 或者 管理员
|
// 项目创建者 或者 管理员
|
||||||
if (user!=null && p.getCreateUserId().equals(user.getUsername()) || ActivityConstants.isAdmin(user.getUsername())) {
|
if (user != null && p.getCreateUserId().equals(user.getUsername()) || ActivityConstants.isAdmin(user.getUsername())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// 项目负责人
|
// 项目负责人
|
||||||
@ -129,7 +129,7 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
|
|
||||||
User user = (User) SecurityUtils.getSubject().getPrincipal();
|
User user = (User) SecurityUtils.getSubject().getPrincipal();
|
||||||
// logger.info("查询用户信息:"+JSON.toJSONString(user));
|
// logger.info("查询用户信息:"+JSON.toJSONString(user));
|
||||||
if(user==null) {
|
if (user == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// 项目创建者
|
// 项目创建者
|
||||||
@ -150,12 +150,12 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
if (user == null && SpringContextHolder.isProd()) {
|
if (user == null && SpringContextHolder.isProd()) {
|
||||||
throw new ParameterException("登录失效,请重新登录!");
|
throw new ParameterException("登录失效,请重新登录!");
|
||||||
}
|
}
|
||||||
if(user != null) {
|
if (user != null) {
|
||||||
String isAdmin = ActivityConstants.isAdmin(user.getUsername()) ? "Y" : "N";
|
String isAdmin = ActivityConstants.isAdmin(user.getUsername()) ? "Y" : "N";
|
||||||
project.setIsAdmin(isAdmin);
|
project.setIsAdmin(isAdmin);
|
||||||
project.setLoginName(user.getUsername());
|
project.setLoginName(user.getUsername());
|
||||||
}
|
}
|
||||||
if(user==null && !SpringContextHolder.isProd())project.setIsAdmin("Y"); // 测试默认用管理员权限查询
|
if (user == null && !SpringContextHolder.isProd()) project.setIsAdmin("Y"); // 测试默认用管理员权限查询
|
||||||
|
|
||||||
return mapper.getList(project);
|
return mapper.getList(project);
|
||||||
}
|
}
|
||||||
@ -181,20 +181,21 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
throw new ParameterException("参数不能为空");
|
throw new ParameterException("参数不能为空");
|
||||||
}
|
}
|
||||||
Project project = mapper.findById(pid);
|
Project project = mapper.findById(pid);
|
||||||
if(project == null){
|
if (project == null) {
|
||||||
throw new ParameterException("记录不存在或已被删除");
|
throw new ParameterException("记录不存在或已被删除");
|
||||||
}
|
}
|
||||||
|
|
||||||
User user = (User) SecurityUtils.getSubject().getPrincipal(); //上线时放开
|
User user = (User) SecurityUtils.getSubject().getPrincipal(); //上线时放开
|
||||||
if(user==null) {
|
if (user == null) {
|
||||||
throw new ServiceException("登陆失败,请重新登陆!");
|
throw new ServiceException("登陆失败,请重新登陆!");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> fzrIds = StringUtils.isNotBlank(project.getFzrIds()) ? Arrays.asList(project.getFzrIds().split(",")) : new ArrayList<>();
|
List<String> fzrIds = StringUtils.isNotBlank(project.getFzrIds()) ? Arrays.asList(project.getFzrIds().split(",")) : new ArrayList<>();
|
||||||
List<String> csrIds = StringUtils.isNotBlank(project.getCsrIds()) ? Arrays.asList(project.getCsrIds().split(",")) : new ArrayList<>();
|
List<String> csrIds = StringUtils.isNotBlank(project.getCsrIds()) ? Arrays.asList(project.getCsrIds().split(",")) : new ArrayList<>();
|
||||||
|
|
||||||
boolean allowModify = (project!=null && project.getStatus()!=null && project.getStatus()!=0); // 0为作废状态,不给修改
|
boolean allowModify = (project != null && project.getStatus() != null && project.getStatus() != 0); // 0为作废状态,不给修改
|
||||||
if(allowModify)allowModify = StringUtils.equals(user.getUsername(), project.getCreateUserId()) || fzrIds.contains(user.getUsername());
|
if (allowModify)
|
||||||
|
allowModify = StringUtils.equals(user.getUsername(), project.getCreateUserId()) || fzrIds.contains(user.getUsername());
|
||||||
project.setAllowModify(allowModify); // 是否有修改权限
|
project.setAllowModify(allowModify); // 是否有修改权限
|
||||||
|
|
||||||
List<Map<String, Object>> fzrMap = qywxUserMapper.getUserInfoByUserIds(fzrIds);
|
List<Map<String, Object>> fzrMap = qywxUserMapper.getUserInfoByUserIds(fzrIds);
|
||||||
@ -204,7 +205,7 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
obj.put("csrData", csrMap); // 抄送人数据
|
obj.put("csrData", csrMap); // 抄送人数据
|
||||||
obj.put("project", project); // 项目详情
|
obj.put("project", project); // 项目详情
|
||||||
List<ProjectFiles> list = projectFilesMapper.getList(pid);
|
List<ProjectFiles> list = projectFilesMapper.getList(pid);
|
||||||
obj.put("fileList",list);
|
obj.put("fileList", list);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,24 +256,24 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String[] fzrIds = null, csrIds = null;
|
String[] fzrIds = null, csrIds = null;
|
||||||
if(StringUtils.isNotBlank(p.getFzrIds()))fzrIds = p.getFzrIds().split(",");
|
if (StringUtils.isNotBlank(p.getFzrIds())) fzrIds = p.getFzrIds().split(",");
|
||||||
if(StringUtils.isNotBlank(p.getCsrIds()))csrIds = p.getCsrIds().split(",");
|
if (StringUtils.isNotBlank(p.getCsrIds())) csrIds = p.getCsrIds().split(",");
|
||||||
|
|
||||||
if (fzrIds == null || fzrIds.length == 0) {
|
if (fzrIds == null || fzrIds.length == 0) {
|
||||||
throw new ParameterException("请选择项目负责人!");
|
throw new ParameterException("请选择项目负责人!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deptIds == null)
|
if (deptIds == null)
|
||||||
deptIds = new String[] {};
|
deptIds = new String[]{};
|
||||||
if (csrIds == null)
|
if (csrIds == null)
|
||||||
csrIds = new String[] {};
|
csrIds = new String[]{};
|
||||||
User user = (User) SecurityUtils.getSubject().getPrincipal(); //上线时放开
|
User user = (User) SecurityUtils.getSubject().getPrincipal(); //上线时放开
|
||||||
if(user==null) {
|
if (user == null) {
|
||||||
throw new ServiceException("登陆失败,请重新登陆!");
|
throw new ServiceException("登陆失败,请重新登陆!");
|
||||||
}
|
}
|
||||||
p.setId(UUIDUtil.uuid());
|
p.setId(UUIDUtil.uuid());
|
||||||
p.setCreateUserId(user.getUsername());
|
p.setCreateUserId(user.getUsername());
|
||||||
p.setNotify((short)0);
|
p.setNotify((short) 0);
|
||||||
p.setCreateTime(DateUtil.currentTimestamp());
|
p.setCreateTime(DateUtil.currentTimestamp());
|
||||||
p.setUpdateTime(DateUtil.currentTimestamp());
|
p.setUpdateTime(DateUtil.currentTimestamp());
|
||||||
mapper.insert(p);
|
mapper.insert(p);
|
||||||
@ -342,8 +343,8 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
|
|
||||||
|
|
||||||
//导入附件信息
|
//导入附件信息
|
||||||
if(filesList!=null && filesList.size()>0) {
|
if (filesList != null && filesList.size() > 0) {
|
||||||
for(ProjectFiles projectFiles: filesList) {
|
for (ProjectFiles projectFiles : filesList) {
|
||||||
projectFiles.setProjectId(p.getId());
|
projectFiles.setProjectId(p.getId());
|
||||||
projectFilesMapper.insert(projectFiles);
|
projectFilesMapper.insert(projectFiles);
|
||||||
}
|
}
|
||||||
@ -352,9 +353,9 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
//导入城市信息
|
//导入城市信息
|
||||||
String area = p.getArea();
|
String area = p.getArea();
|
||||||
ProjectCity projectCity = null;
|
ProjectCity projectCity = null;
|
||||||
if(StringUtils.isNotBlank(area)) {
|
if (StringUtils.isNotBlank(area)) {
|
||||||
String[] cityTypes = area.split(",");
|
String[] cityTypes = area.split(",");
|
||||||
for(String type: cityTypes) {
|
for (String type : cityTypes) {
|
||||||
projectCity = new ProjectCity();
|
projectCity = new ProjectCity();
|
||||||
projectCity.setId(UUIDUtil.uuid());
|
projectCity.setId(UUIDUtil.uuid());
|
||||||
projectCity.setType(type);
|
projectCity.setType(type);
|
||||||
@ -368,14 +369,14 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
if (fzrIds != null && fzrIds.length > 0) {
|
if (fzrIds != null && fzrIds.length > 0) {
|
||||||
for (String userid : fzrIds) {
|
for (String userid : fzrIds) {
|
||||||
SyUsers syUsers = syUsersMapper.findByUserName(userid);
|
SyUsers syUsers = syUsersMapper.findByUserName(userid);
|
||||||
if(syUsers!=null)fzNames.add(syUsers.getTrueName());
|
if (syUsers != null) fzNames.add(syUsers.getTrueName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String toUser = "";
|
String toUser = "";
|
||||||
if (fzrIds != null && fzrIds.length > 0){
|
if (fzrIds != null && fzrIds.length > 0) {
|
||||||
toUser = StringUtils.join(fzrIds, "|");
|
toUser = StringUtils.join(fzrIds, "|");
|
||||||
}
|
}
|
||||||
if (csrIds != null && csrIds.length > 0){
|
if (csrIds != null && csrIds.length > 0) {
|
||||||
toUser += (StringUtils.isBlank(toUser) ? "" : "|") + StringUtils.join(csrIds, "|");
|
toUser += (StringUtils.isBlank(toUser) ? "" : "|") + StringUtils.join(csrIds, "|");
|
||||||
}
|
}
|
||||||
sendWxMsgByCreateProject(p, StringUtils.trimToEmpty(StringUtils.join(fzNames, ",")), toUser);
|
sendWxMsgByCreateProject(p, StringUtils.trimToEmpty(StringUtils.join(fzNames, ",")), toUser);
|
||||||
@ -386,13 +387,14 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送新建项目通知
|
* 发送新建项目通知
|
||||||
|
*
|
||||||
* @param p 项目参数
|
* @param p 项目参数
|
||||||
* @param fzrNames 负责人姓名,多个用英文逗号分隔
|
* @param fzrNames 负责人姓名,多个用英文逗号分隔
|
||||||
* @param toUser 接收人的userId, 多个用|隔开
|
* @param toUser 接收人的userId, 多个用|隔开
|
||||||
*/
|
*/
|
||||||
private void sendWxMsgByCreateProject(Project p, String fzrNames, String toUser){
|
private void sendWxMsgByCreateProject(Project p, String fzrNames, String toUser) {
|
||||||
String name = StringUtils.trimToEmpty(p.getName());
|
String name = StringUtils.trimToEmpty(p.getName());
|
||||||
if (name.length() > 20){
|
if (name.length() > 20) {
|
||||||
name = name.substring(0, 20) + " ...";
|
name = name.substring(0, 20) + " ...";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,7 +402,7 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
+ "</div><br><br>" + "项目名称:" + name
|
+ "</div><br><br>" + "项目名称:" + name
|
||||||
+ "<br>" + "客户单位:"
|
+ "<br>" + "客户单位:"
|
||||||
+ projectClientService.getNamesById(p.getProjectClientId()) + "<br>" + "项目时间:"
|
+ projectClientService.getNamesById(p.getProjectClientId()) + "<br>" + "项目时间:"
|
||||||
+ DateUtil.date2String(p.getStartTime(), "MM-dd") + " ~ " + DateUtil.date2String(p.getEndTime()!=null?p.getEndTime():p.getPlanTime(), "MM-dd")
|
+ DateUtil.date2String(p.getStartTime(), "MM-dd") + " ~ " + DateUtil.date2String(p.getEndTime() != null ? p.getEndTime() : p.getPlanTime(), "MM-dd")
|
||||||
+ "<br>" + "负责人:" + fzrNames // StringUtils.trimToEmpty(StringUtils.join(fzrNames, ","))
|
+ "<br>" + "负责人:" + fzrNames // StringUtils.trimToEmpty(StringUtils.join(fzrNames, ","))
|
||||||
+ "<br>" + "创建人:" + syUsersMapper.findByUserName(p.getCreateUserId()).getTrueName();
|
+ "<br>" + "创建人:" + syUsersMapper.findByUserName(p.getCreateUserId()).getTrueName();
|
||||||
if (StringUtils.isNotBlank(toUser)) {
|
if (StringUtils.isNotBlank(toUser)) {
|
||||||
@ -419,13 +421,13 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Transactional
|
@Transactional
|
||||||
public void updateProject(Project p, Integer isSendMsg, String[] deptIds, List<ProjectFiles> filesList) {
|
public void updateProject(Project p, Integer isSendMsg, String[] deptIds, List<ProjectFiles> filesList) {
|
||||||
if(p==null) {
|
if (p == null) {
|
||||||
throw new ParameterException("项目信息不能为空!");
|
throw new ParameterException("项目信息不能为空!");
|
||||||
}
|
}
|
||||||
if(p.getStartTime()==null) {
|
if (p.getStartTime() == null) {
|
||||||
throw new ParameterException("开始时间不能为空!");
|
throw new ParameterException("开始时间不能为空!");
|
||||||
}
|
}
|
||||||
if(p.getPlanTime()==null) {
|
if (p.getPlanTime() == null) {
|
||||||
throw new ParameterException("计划时间不能为空!");
|
throw new ParameterException("计划时间不能为空!");
|
||||||
}
|
}
|
||||||
if (p.getStartTime().getTime() > p.getPlanTime().getTime()) {
|
if (p.getStartTime().getTime() > p.getPlanTime().getTime()) {
|
||||||
@ -434,16 +436,16 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
//修改项目不能修改结束时间
|
//修改项目不能修改结束时间
|
||||||
p.setEndTime(null);
|
p.setEndTime(null);
|
||||||
String[] fzrIds = null, csrIds = null;
|
String[] fzrIds = null, csrIds = null;
|
||||||
if(StringUtils.isNotBlank(p.getFzrIds()))fzrIds = p.getFzrIds().split(",");
|
if (StringUtils.isNotBlank(p.getFzrIds())) fzrIds = p.getFzrIds().split(",");
|
||||||
if(StringUtils.isNotBlank(p.getCsrIds()))csrIds = p.getCsrIds().split(",");
|
if (StringUtils.isNotBlank(p.getCsrIds())) csrIds = p.getCsrIds().split(",");
|
||||||
|
|
||||||
if (fzrIds == null || fzrIds.length == 0) {
|
if (fzrIds == null || fzrIds.length == 0) {
|
||||||
throw new ParameterException("请选择项目负责人!");
|
throw new ParameterException("请选择项目负责人!");
|
||||||
}
|
}
|
||||||
if (deptIds == null)
|
if (deptIds == null)
|
||||||
deptIds = new String[] {};
|
deptIds = new String[]{};
|
||||||
if (csrIds == null)
|
if (csrIds == null)
|
||||||
csrIds = new String[] {};
|
csrIds = new String[]{};
|
||||||
|
|
||||||
// 自动加上所有上级到抄送人员
|
// 自动加上所有上级到抄送人员
|
||||||
Map<String, List<String>> map = selectLeaderUsers(Utility.strArrayToString(fzrIds), true);
|
Map<String, List<String>> map = selectLeaderUsers(Utility.strArrayToString(fzrIds), true);
|
||||||
@ -461,7 +463,7 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
throw new ParameterException("项目不存在,修改失败!");
|
throw new ParameterException("项目不存在,修改失败!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(oldPro.getStatus()!=null && oldPro.getStatus()==0){
|
if (oldPro.getStatus() != null && oldPro.getStatus() == 0) {
|
||||||
throw new ParameterException("项目已作废,不可修改!");
|
throw new ParameterException("项目已作废,不可修改!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -606,13 +608,13 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
}
|
}
|
||||||
for (ProjectUser projectUser : c) {
|
for (ProjectUser projectUser : c) {
|
||||||
projectUserMapper.insertOrUpdate(projectUser.getId(), projectUser.getProjectId(), projectUser.getType(),
|
projectUserMapper.insertOrUpdate(projectUser.getId(), projectUser.getProjectId(), projectUser.getType(),
|
||||||
projectUser.getTableId(),projectUser.getUpdateTime(),projectUser.getCreateTime());
|
projectUser.getTableId(), projectUser.getUpdateTime(), projectUser.getCreateTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
//导入附件信息前,先删除原有附件信息
|
//导入附件信息前,先删除原有附件信息
|
||||||
projectFilesMapper.deleteByProjectId(p.getId());
|
projectFilesMapper.deleteByProjectId(p.getId());
|
||||||
if(filesList!=null && filesList.size()>0) {
|
if (filesList != null && filesList.size() > 0) {
|
||||||
for(ProjectFiles projectFiles: filesList) {
|
for (ProjectFiles projectFiles : filesList) {
|
||||||
projectFiles.setProjectId(p.getId());
|
projectFiles.setProjectId(p.getId());
|
||||||
projectFilesMapper.insert(projectFiles);
|
projectFilesMapper.insert(projectFiles);
|
||||||
}
|
}
|
||||||
@ -622,9 +624,9 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
projectCityMapper.deleteByProjectId(p.getId());
|
projectCityMapper.deleteByProjectId(p.getId());
|
||||||
String area = p.getArea();
|
String area = p.getArea();
|
||||||
ProjectCity projectCity = null;
|
ProjectCity projectCity = null;
|
||||||
if(StringUtils.isNotBlank(area)) {
|
if (StringUtils.isNotBlank(area)) {
|
||||||
String[] cityTypes = area.split(",");
|
String[] cityTypes = area.split(",");
|
||||||
for(String type: cityTypes) {
|
for (String type : cityTypes) {
|
||||||
projectCity = new ProjectCity();
|
projectCity = new ProjectCity();
|
||||||
projectCity.setId(UUIDUtil.uuid());
|
projectCity.setId(UUIDUtil.uuid());
|
||||||
projectCity.setType(type);
|
projectCity.setType(type);
|
||||||
@ -638,20 +640,20 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
if (fzrIds != null && fzrIds.length > 0) {
|
if (fzrIds != null && fzrIds.length > 0) {
|
||||||
for (String userid : fzrIds) {
|
for (String userid : fzrIds) {
|
||||||
SyUsers syUsers = syUsersMapper.findByUserName(userid);
|
SyUsers syUsers = syUsersMapper.findByUserName(userid);
|
||||||
if(syUsers!=null)fzNames.add(syUsers.getTrueName());
|
if (syUsers != null) fzNames.add(syUsers.getTrueName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String toUser = ""; // 修改项目只发送给新增的负责人和抄送人
|
String toUser = ""; // 修改项目只发送给新增的负责人和抄送人
|
||||||
if (fzrIds != null && fzrIds.length > 0){
|
if (fzrIds != null && fzrIds.length > 0) {
|
||||||
for(String fzr : fzrIds){
|
for (String fzr : fzrIds) {
|
||||||
if(!fzrIdsOld.contains(fzr) && !toUser.contains(fzr)){
|
if (!fzrIdsOld.contains(fzr) && !toUser.contains(fzr)) {
|
||||||
toUser += (StringUtils.isBlank(toUser) ? "" : "|") + fzr;
|
toUser += (StringUtils.isBlank(toUser) ? "" : "|") + fzr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (csrIds != null && csrIds.length > 0){
|
if (csrIds != null && csrIds.length > 0) {
|
||||||
for(String csr : csrIds){
|
for (String csr : csrIds) {
|
||||||
if(!csrIdsOld.contains(csr) && !toUser.contains(csr)){
|
if (!csrIdsOld.contains(csr) && !toUser.contains(csr)) {
|
||||||
toUser += (StringUtils.isBlank(toUser) ? "" : "|") + csr;
|
toUser += (StringUtils.isBlank(toUser) ? "" : "|") + csr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -668,7 +670,7 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
return map;
|
return map;
|
||||||
User loginuser = (User) SecurityUtils.getSubject().getPrincipal();
|
User loginuser = (User) SecurityUtils.getSubject().getPrincipal();
|
||||||
String myUserId = "";
|
String myUserId = "";
|
||||||
if(loginuser!=null)loginuser.getUsername();
|
if (loginuser != null) loginuser.getUsername();
|
||||||
userIds += ("," + myUserId); // 自动加上本人的上级
|
userIds += ("," + myUserId); // 自动加上本人的上级
|
||||||
String sql = null;
|
String sql = null;
|
||||||
List<String> retUserIds = new ArrayList<String>();
|
List<String> retUserIds = new ArrayList<String>();
|
||||||
@ -708,7 +710,7 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
userIds += StringUtils.isBlank(userIds) ? uid : ("," + uid);
|
userIds += StringUtils.isBlank(userIds) ? uid : ("," + uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!toTop)break;
|
if (!toTop) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
map.put("userIds", retUserIds);
|
map.put("userIds", retUserIds);
|
||||||
@ -724,7 +726,7 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
Map<String, List<String>> map = new HashMap<String, List<String>>();
|
Map<String, List<String>> map = new HashMap<String, List<String>>();
|
||||||
|
|
||||||
User loginuser = (User) SecurityUtils.getSubject().getPrincipal();
|
User loginuser = (User) SecurityUtils.getSubject().getPrincipal();
|
||||||
if(loginuser!=null){
|
if (loginuser != null) {
|
||||||
userIds += ("," + loginuser.getUsername()); // 自动加上本人的上级
|
userIds += ("," + loginuser.getUsername()); // 自动加上本人的上级
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -754,14 +756,14 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userList == null || userList.isEmpty()){
|
if (userList == null || userList.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Map<String, Object> user2 : userList) {
|
for (Map<String, Object> user2 : userList) {
|
||||||
user = user2;
|
user = user2;
|
||||||
String uid = (String) user.get("UserID");
|
String uid = (String) user.get("UserID");
|
||||||
if (params.contains(uid) || retUserIds.contains(uid)){
|
if (params.contains(uid) || retUserIds.contains(uid)) {
|
||||||
continue; // 过滤掉重复的用户
|
continue; // 过滤掉重复的用户
|
||||||
}
|
}
|
||||||
retUserIds.add(uid);
|
retUserIds.add(uid);
|
||||||
@ -775,7 +777,7 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!toTop)break;
|
if (!toTop) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return retArray;
|
return retArray;
|
||||||
@ -828,14 +830,14 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteProject(String[] ids) {
|
public void deleteProject(String[] ids) {
|
||||||
logger.info("*******"+ JSON.toJSONString(ids));
|
logger.info("*******" + JSON.toJSONString(ids));
|
||||||
if(ids==null || ids.length<1) {
|
if (ids == null || ids.length < 1) {
|
||||||
throw new ParameterException("删除项目id不能为空!");
|
throw new ParameterException("删除项目id不能为空!");
|
||||||
}
|
}
|
||||||
|
|
||||||
for(String id:ids){
|
for (String id : ids) {
|
||||||
Project p = mapper.findById(id);
|
Project p = mapper.findById(id);
|
||||||
if(p==null)continue;
|
if (p == null) continue;
|
||||||
// 非创建人或管理员不能删除项目,测试阶段放开
|
// 非创建人或管理员不能删除项目,测试阶段放开
|
||||||
if (!hasUpdateProject(p.getId())) {
|
if (!hasUpdateProject(p.getId())) {
|
||||||
throw new ServiceException("你没有权限删除此项目!");
|
throw new ServiceException("你没有权限删除此项目!");
|
||||||
@ -849,8 +851,8 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
|
|
||||||
// 删除项目任务日志
|
// 删除项目任务日志
|
||||||
List<String> projectTaskIds = projectTaskMapper.getProjectTaskIds(p.getId());
|
List<String> projectTaskIds = projectTaskMapper.getProjectTaskIds(p.getId());
|
||||||
if(projectTaskIds!=null && projectTaskIds.size()>0) {
|
if (projectTaskIds != null && projectTaskIds.size() > 0) {
|
||||||
for(String taskId : projectTaskIds) {
|
for (String taskId : projectTaskIds) {
|
||||||
journalMapper.deleteByTaskId(taskId);
|
journalMapper.deleteByTaskId(taskId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -870,7 +872,7 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String,Set<String>> selectCityByUserIds(String userIds) {
|
public Map<String, Set<String>> selectCityByUserIds(String userIds) {
|
||||||
if (StringUtils.isBlank(userIds)) {
|
if (StringUtils.isBlank(userIds)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -898,7 +900,7 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Map<String,Set<String>> resultMap = new HashMap<>();
|
Map<String, Set<String>> resultMap = new HashMap<>();
|
||||||
// 通过部门id去查询地域
|
// 通过部门id去查询地域
|
||||||
Set<String> city = new HashSet<String>();
|
Set<String> city = new HashSet<String>();
|
||||||
Set<String> cityId = new HashSet<String>();
|
Set<String> cityId = new HashSet<String>();
|
||||||
@ -908,9 +910,9 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
Map<String, String> dep = new HashMap<String, String>();
|
Map<String, String> dep = new HashMap<String, String>();
|
||||||
if (depId != null && (!depId.equals("1"))) {
|
if (depId != null && (!depId.equals("1"))) {
|
||||||
boolean flag = true;
|
boolean flag = true;
|
||||||
int i= 0;
|
int i = 0;
|
||||||
//找到一级机构或者循环超过5次
|
//找到一级机构或者循环超过5次
|
||||||
while (flag||i>5) {
|
while (flag || i > 5) {
|
||||||
dep = queryParentId(depId, depList);
|
dep = queryParentId(depId, depList);
|
||||||
i++;
|
i++;
|
||||||
if (dep != null && dep.get("ParentId") != null && dep.get("ParentId").equals("1")) {
|
if (dep != null && dep.get("ParentId") != null && dep.get("ParentId").equals("1")) {
|
||||||
@ -941,8 +943,8 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resultMap.put("city",city);
|
resultMap.put("city", city);
|
||||||
resultMap.put("cityId",cityId);
|
resultMap.put("cityId", cityId);
|
||||||
return resultMap;
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -967,20 +969,26 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateProjectStatus(String id, String contractno, String status) {
|
public void updateProjectStatus(String id, String contractno, String status) {
|
||||||
if(StringUtils.isBlank(id)) {
|
if (StringUtils.isBlank(id)) {
|
||||||
throw new ParameterException("项目id不能为空");
|
throw new ParameterException("项目id不能为空");
|
||||||
}
|
}
|
||||||
if(StringUtils.isBlank(status)) {
|
if (StringUtils.isBlank(status)) {
|
||||||
throw new ParameterException("状态不能为空");
|
throw new ParameterException("状态不能为空");
|
||||||
}
|
}
|
||||||
if(Integer.parseInt(status)==3 && StringUtils.isBlank(contractno)) {
|
if (Integer.parseInt(status) == 3 && StringUtils.isBlank(contractno)) {
|
||||||
throw new ParameterException("合同号不能为空");
|
throw new ParameterException("合同号不能为空");
|
||||||
}
|
}
|
||||||
Date endTime = null;
|
Date endTime = null;
|
||||||
if (status.equals("3")){
|
String setuptime = null;
|
||||||
endTime = new Date();
|
String updatetime = null;
|
||||||
|
if (status.equals("1")) {
|
||||||
|
//如果任务已经结束,改成运行中,重置结束时间
|
||||||
|
setuptime = "1";
|
||||||
|
} else if (status.equals("3")) {
|
||||||
|
//任务结束,修改时间
|
||||||
|
updatetime = "1";
|
||||||
}
|
}
|
||||||
mapper.updateProjectStatus(id, contractno, Integer.parseInt(status),DateUtil.date2String(new Date(),DateUtil.PATTERN_STANDARD));
|
mapper.updateProjectStatus(setuptime, id, contractno, Integer.parseInt(status),updatetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -147,7 +147,10 @@
|
|||||||
<if test="contractno != null and contractno != ''">
|
<if test="contractno != null and contractno != ''">
|
||||||
_contractno = #{contractno},
|
_contractno = #{contractno},
|
||||||
</if>
|
</if>
|
||||||
<if test="endTime != null and endTime != ''">
|
<if test="setuptime != null and setuptime != ''">
|
||||||
|
_end_time = NULL,
|
||||||
|
</if>
|
||||||
|
<if test="updatetime != null and updatetime != ''">
|
||||||
_end_time = NOW(),
|
_end_time = NOW(),
|
||||||
</if>
|
</if>
|
||||||
_status = #{status} where id = #{id}
|
_status = #{status} where id = #{id}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user