Compare commits
No commits in common. "da7099359329a4d65c7b42e186457c519fafc69c" and "14c726cb9a888676c723bfd20d47c905a7c29a40" have entirely different histories.
da70993593
...
14c726cb9a
@ -74,7 +74,6 @@ public class AuthController {
|
||||
@PostMapping("/auth/login")
|
||||
public BaseResponse authLogin(@RequestBody @Validated UserLoginVO userLoginVO, @NotNull BindingResult bindingResult) {
|
||||
log.info("请求接口[POST]: /auth/login");
|
||||
|
||||
// 判断是否有参数错误
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultUtil.error(ErrorCode.REQUEST_BODY_ERROR, Processing.getValidatedErrorList(bindingResult));
|
||||
|
@ -5,7 +5,6 @@ import com.jsl.oa.mapper.ProjectMapper;
|
||||
import com.jsl.oa.model.doData.ProjectCuttingDO;
|
||||
import com.jsl.oa.model.doData.ProjectDO;
|
||||
import com.jsl.oa.model.doData.ProjectUserDO;
|
||||
import com.jsl.oa.model.doData.ProjectWorkDO;
|
||||
import com.jsl.oa.model.doData.info.ProjectShowDO;
|
||||
import com.jsl.oa.model.voData.ProjectEditVO;
|
||||
import com.jsl.oa.model.voData.ProjectInfoVO;
|
||||
@ -47,7 +46,6 @@ public class ProjectDAO {
|
||||
log.info("\t\t> 从 MySQL 更新数据");
|
||||
ProjectDO projectDO = new ProjectDO();
|
||||
Processing.copyProperties(projectEdit,projectDO);
|
||||
projectDO.setId(projectId);
|
||||
projectMapper.projectEdit(projectDO);
|
||||
log.info("\t\t> 从 MySQL 获取数据");
|
||||
return projectMapper.getProjectById(projectId);
|
||||
@ -240,9 +238,5 @@ public class ProjectDAO {
|
||||
return projectMapper.tget(id);
|
||||
}
|
||||
|
||||
public ProjectWorkDO getProjectWorkerById(Long id){
|
||||
return projectMapper.getProjectWorkById(id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -29,8 +29,4 @@ public interface ModuleMapper {
|
||||
|
||||
@Select("select * from organize_oa.oa_project_work where pid=#{id} and is_delete=0 and type=1 ")
|
||||
List<ProjectWorkDO> getAllMoudleByPid(Long id);
|
||||
|
||||
@Select("select principal_id from organize_oa.oa_project where id=(select project_id " +
|
||||
"from organize_oa.oa_project_work where oa_project_work.id = #{sysId})")
|
||||
Long getPridBySysyid(Integer sysId);
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import com.jsl.oa.model.doData.ProjectDO;
|
||||
import com.jsl.oa.model.doData.ProjectUserDO;
|
||||
import com.jsl.oa.model.doData.ProjectWorkDO;
|
||||
import com.jsl.oa.model.voData.ProjectInfoVO;
|
||||
import com.jsl.oa.model.voData.ProjectWorkSimpleVO;
|
||||
import com.jsl.oa.model.voData.ProjectWorkVO;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
|
||||
@ -110,14 +109,7 @@ public interface ProjectMapper {
|
||||
List<ProjectDO> tgetBytags(List<String> tags,List<Integer> isFinish);
|
||||
|
||||
@Select("select * from organize_oa.oa_project_work where id=#{id}")
|
||||
ProjectWorkSimpleVO getWorkById(Integer id);
|
||||
|
||||
ProjectWorkDO getWorkById(Integer id);
|
||||
@Select("select principal_id from organize_oa.oa_project_work where id=#{pid}")
|
||||
Long getPirIdbyWorkid(Long pid);
|
||||
|
||||
@Select("select principal_id from organize_oa.oa_project_work where id=#{id}")
|
||||
Long getPid(Integer id);
|
||||
|
||||
@Select("select * from organize_oa.oa_project_work where id=#{id}")
|
||||
ProjectWorkDO getProjectWorkById(Long id);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class ProjectDO {
|
||||
private Integer isDelete;
|
||||
private Integer isFinish;
|
||||
private Long workLoad;
|
||||
private Integer status;
|
||||
private boolean status;
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "UTC")
|
||||
private Timestamp beginTime;
|
||||
|
||||
|
@ -19,8 +19,7 @@ public class ProjectEditVO {
|
||||
private String file;
|
||||
private String description;
|
||||
private Integer isFinish;
|
||||
private Integer status;
|
||||
private Long workLoad;
|
||||
private boolean status;
|
||||
private Timestamp beginTime;
|
||||
private Timestamp completeTime;
|
||||
private Timestamp deadline;
|
||||
|
@ -1,35 +0,0 @@
|
||||
package com.jsl.oa.model.voData;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* 总体描述
|
||||
*
|
||||
* 在projectWorkDO上新增了负责人:principalUser,子系统名称:childSystemName
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ProjectWorkAndNameVO {
|
||||
|
||||
private Long id;
|
||||
private Long pid;
|
||||
private String childSystemName;
|
||||
private Long projectId;
|
||||
private Long principalId;
|
||||
private String principalUser;
|
||||
private Integer cycle;
|
||||
private Integer workLoad;
|
||||
private Integer type;
|
||||
private String name;
|
||||
private String description;
|
||||
private Integer isDelete;
|
||||
private Integer isFinish;
|
||||
private boolean status;
|
||||
private Timestamp beginTime;
|
||||
private Timestamp completeTime;
|
||||
}
|
||||
|
||||
|
@ -1,26 +0,0 @@
|
||||
package com.jsl.oa.model.voData;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class ProjectWorkSimpleVO {
|
||||
private String name;
|
||||
private Long principalId;
|
||||
private String principalUser;
|
||||
private Integer isFinish;
|
||||
private String description;
|
||||
private Long cycle;
|
||||
private Long projectId;
|
||||
private Long workLoad;
|
||||
private Long id;
|
||||
private String tags;
|
||||
private Integer status;
|
||||
private Timestamp beginTime;
|
||||
private Timestamp completeTime;
|
||||
}
|
@ -1,16 +1,10 @@
|
||||
package com.jsl.oa.services.impl;
|
||||
|
||||
import ch.qos.logback.core.joran.util.beans.BeanUtil;
|
||||
import com.jsl.oa.dao.ModuleDAO;
|
||||
import com.jsl.oa.dao.ProjectDAO;
|
||||
import com.jsl.oa.dao.UserDAO;
|
||||
import com.jsl.oa.mapper.ModuleMapper;
|
||||
import com.jsl.oa.mapper.RoleMapper;
|
||||
import com.jsl.oa.model.doData.ProjectDO;
|
||||
import com.jsl.oa.model.doData.ProjectWorkDO;
|
||||
import com.jsl.oa.model.doData.UserDO;
|
||||
import com.jsl.oa.model.voData.ProjectWorkAndNameVO;
|
||||
import com.jsl.oa.model.voData.ProjectWorkVO;
|
||||
import com.jsl.oa.services.ModuleService;
|
||||
import com.jsl.oa.utils.BaseResponse;
|
||||
import com.jsl.oa.utils.ErrorCode;
|
||||
@ -22,7 +16,6 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.xml.transform.Result;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@ -31,7 +24,6 @@ import java.util.List;
|
||||
public class ModuleServiceImpl implements ModuleService {
|
||||
private final RoleMapper roleMapper;
|
||||
private final ModuleDAO moduleDAO;
|
||||
private final ProjectDAO projectDAO;
|
||||
private final ModuleMapper moduleMapper;
|
||||
private final UserDAO userDAO;
|
||||
|
||||
@ -44,12 +36,12 @@ public class ModuleServiceImpl implements ModuleService {
|
||||
Long pid = moduleMapper.getPidByProjectid(projectId);
|
||||
//判断是否是项目负责人
|
||||
int is = 1;
|
||||
if (!pid.equals(userId)) {
|
||||
if(!pid.equals(userId)){
|
||||
log.info("不是负责人");
|
||||
is = 0;
|
||||
}
|
||||
|
||||
List<ProjectWorkDO> projectWorkDOList = moduleMapper.getByProjectId(projectId, userId, is);
|
||||
List<ProjectWorkDO> projectWorkDOList= moduleMapper.getByProjectId(projectId,userId,is);
|
||||
return ResultUtil.success(projectWorkDOList);
|
||||
}
|
||||
|
||||
@ -60,29 +52,14 @@ public class ModuleServiceImpl implements ModuleService {
|
||||
Long userId = Processing.getAuthHeaderToUserId(request);
|
||||
//获取子系统负责人id
|
||||
Long pid = moduleMapper.getPidBySysid(sysId);
|
||||
//获取项目负责人id
|
||||
Long prid = moduleMapper.getPridBySysyid(sysId);
|
||||
//判断是否是子系统/项目负责人
|
||||
//判断是否是子系统负责人
|
||||
int is = 1;
|
||||
if (!pid.equals(userId) && !prid.equals(userId)) {
|
||||
if(!pid.equals(userId)){
|
||||
is = 0;
|
||||
}
|
||||
|
||||
List<ProjectWorkDO> projectWorkDOList = moduleMapper.getBySysId(sysId, userId, is);
|
||||
// 封装VO类
|
||||
List<ProjectWorkAndNameVO> projectWorkAndNameVOS = new ArrayList<>();
|
||||
for (ProjectWorkDO projectWorkDO : projectWorkDOList) {
|
||||
ProjectWorkAndNameVO projectWorkAndNameVO = new ProjectWorkAndNameVO();
|
||||
Processing.copyProperties(projectWorkDO,projectWorkAndNameVO);
|
||||
// 添加负责人和子系统名称
|
||||
projectWorkAndNameVO.
|
||||
setChildSystemName(projectDAO.getProjectWorkerById(projectWorkDO.getPid()).getName())
|
||||
.setPrincipalUser(userDAO.getUserById(projectWorkDO.getPrincipalId()).getUsername());
|
||||
|
||||
projectWorkAndNameVOS.add(projectWorkAndNameVO);
|
||||
|
||||
}
|
||||
return ResultUtil.success(projectWorkAndNameVOS);
|
||||
List<ProjectWorkDO> projectWorkDOList = moduleMapper.getBySysId(sysId,userId,is);
|
||||
return ResultUtil.success(projectWorkDOList);
|
||||
}
|
||||
|
||||
|
||||
@ -90,7 +67,7 @@ public class ModuleServiceImpl implements ModuleService {
|
||||
public BaseResponse deleteById(HttpServletRequest request, Long id) {
|
||||
|
||||
// 检测是否为管理员
|
||||
if (!Processing.checkUserIsAdmin(request, roleMapper)) {
|
||||
if(!Processing.checkUserIsAdmin(request,roleMapper)){
|
||||
return ResultUtil.error(ErrorCode.NOT_PERMISSION);
|
||||
}
|
||||
|
||||
@ -99,12 +76,12 @@ public class ModuleServiceImpl implements ModuleService {
|
||||
return ResultUtil.success("删除成功");
|
||||
}
|
||||
|
||||
// 删除子模块方法
|
||||
public void deleteMoudule(Long id) {
|
||||
// 删除子模块方法
|
||||
public void deleteMoudule(Long id){
|
||||
//获取所有父Id=id的子模块
|
||||
List<ProjectWorkDO> projectWorkDOS = moduleMapper.getAllMoudleByPid(id);
|
||||
|
||||
for (ProjectWorkDO workDO : projectWorkDOS) {
|
||||
for(ProjectWorkDO workDO: projectWorkDOS){
|
||||
deleteMoudule(workDO.getId());
|
||||
}
|
||||
|
||||
|
@ -168,24 +168,8 @@ public class ProjectServiceImpl implements ProjectService {
|
||||
|
||||
@Override
|
||||
public BaseResponse getWorkById(Integer id) {
|
||||
ProjectWorkSimpleVO projectWorkSimpleVO = projectMapper.getWorkById(id);
|
||||
|
||||
projectWorkSimpleVO.setPrincipalUser(userDAO.getUserById(projectMapper.getPid(id)).getUsername());
|
||||
// 解析JSON字符串
|
||||
JsonNode rootNode = null;
|
||||
try {
|
||||
rootNode = objectMapper.readTree(projectWorkSimpleVO.getDescription());
|
||||
// 访问特定的key
|
||||
JsonNode targetNode = rootNode.get("description");
|
||||
if(targetNode != null && !rootNode.isNull()){
|
||||
projectWorkSimpleVO.setDescription(targetNode.asText());
|
||||
}else{
|
||||
projectWorkSimpleVO.setDescription("null");
|
||||
}
|
||||
} catch (JsonProcessingException ignored) {
|
||||
|
||||
}
|
||||
return ResultUtil.success(projectWorkSimpleVO);
|
||||
ProjectWorkDO projectWorkDO = projectMapper.getWorkById(id);
|
||||
return ResultUtil.success(projectWorkDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -15,7 +15,7 @@
|
||||
<select id="getBySysId" resultType="com.jsl.oa.model.doData.ProjectWorkDO">
|
||||
select * from organize_oa.oa_project_work where pid=#{sysId} and type=1
|
||||
<if test="is != 1 ">
|
||||
and (principal_id=#{userId} or principal_id is null)
|
||||
and principal_id=#{userId}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
@ -34,13 +34,13 @@
|
||||
<if test="deadline != null and deadline != ''">
|
||||
deadline = #{deadline},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
<if test="status != null and status != ''">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="isFinish != null">
|
||||
<if test="isFinish != null and isFinish != ''">
|
||||
is_finish = #{isFinish},
|
||||
</if>
|
||||
<if test="isDelete != null">
|
||||
<if test="isDelete != null and isDelete != ''">
|
||||
is_delete = #{isDelete},
|
||||
</if>
|
||||
</set>
|
||||
@ -113,7 +113,7 @@
|
||||
<if test="is != null">
|
||||
(principal_id = #{userId} and is_delete=false) or
|
||||
</if>
|
||||
id in(select project_id from organize_oa.oa_project_work where is_delete=false and principal_id=#{userId})
|
||||
id in(select project_id from organize_oa.oa_project_work where is_delete=false and status =1 and principal_id=#{userId})
|
||||
</select>
|
||||
|
||||
<select id="workget1" resultType="com.jsl.oa.model.doData.ProjectDO">
|
||||
|
Loading…
x
Reference in New Issue
Block a user