Commit 920123fe authored by cq990612's avatar cq990612

优化代码结构

parent 80be1447
...@@ -73,7 +73,7 @@ public enum BASE_RESP_CODE_ENUM { ...@@ -73,7 +73,7 @@ public enum BASE_RESP_CODE_ENUM {
ORDINARY_MEMBERS_ARE_MANAGEMENT("653", "普通成员不能有管理角色"), ORDINARY_MEMBERS_ARE_MANAGEMENT("653", "普通成员不能有管理角色"),
REPEAT_WITH_OLDTIME("654", "日期与其他节假日或工作日冲突"), REPEAT_WITH_OLDTIME("654", "日期与其他节假日或工作日冲突"),
BUDGET_CANNOT_BELESSTHAN_ZERO("655", "预算不能小于0"), BUDGET_CANNOT_BELESSTHAN_ZERO("655", "预算不能小于0"),
ITEMOADUPLICATE("656", "OA编号重复"), ITEMOADUPLICATE("656", "编号重复"),
NO_AUTHORITY("657", "暂无该权限"), NO_AUTHORITY("657", "暂无该权限"),
THEPERIOD_CANNOT_BELESS_THANONEDAY("658", "设置的期限不能小于1天"), THEPERIOD_CANNOT_BELESS_THANONEDAY("658", "设置的期限不能小于1天"),
DUPLICATE_HOLIDAY_NAME("659", "节假日名称重复"), DUPLICATE_HOLIDAY_NAME("659", "节假日名称重复"),
...@@ -81,7 +81,9 @@ public enum BASE_RESP_CODE_ENUM { ...@@ -81,7 +81,9 @@ public enum BASE_RESP_CODE_ENUM {
CENTERMANAGERALREADYEXISTS("661","该中心已经有中心负责人"), CENTERMANAGERALREADYEXISTS("661","该中心已经有中心负责人"),
ROLE_CANNOTBE_EMPTY("662", "设置的角色不能为空"), ROLE_CANNOTBE_EMPTY("662", "设置的角色不能为空"),
NOADMIN_ISTRATIVE_RIGHTS("663", "设置的负责人没有管理权限"), NOADMIN_ISTRATIVE_RIGHTS("663", "设置的负责人没有管理权限"),
NON_PROJECT_OPPORTUNITYNUMBERNAME_ISEMPTY("664","非项目,无商机属性") NON_PROJECT_OPPORTUNITYNUMBERNAME_ISEMPTY("664", "非项目,无商机属性"),
THEPROJECT_HASBEEN_CLOSED("665", "该项目/商机已经结束,请重新选择填报"),
THISTYPEOF_WORKINGHOURS_HASENDE("666", "该工时类型已经结束,请选择其他类型"),
; ;
......
...@@ -2,6 +2,7 @@ package cn.wisenergy.mapper; ...@@ -2,6 +2,7 @@ package cn.wisenergy.mapper;
import cn.wisenergy.model.app.WorkType; import cn.wisenergy.model.app.WorkType;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -15,7 +16,7 @@ public interface WorkTypeMapper extends BaseMapper<WorkType> { ...@@ -15,7 +16,7 @@ public interface WorkTypeMapper extends BaseMapper<WorkType> {
List<Integer> getIdByReviewer(Integer reviewer); List<Integer> getIdByReviewer(Integer reviewer);
List<WorkType> getByIsDelete(Integer isDelete); List<WorkType> getByIsStatus(Integer status);
int updateIsDeleteById(Integer id, Integer isDelete); int updateIsStatusById(@Param("id") Integer id, @Param("status") Integer status);
} }
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.wisenergy.mapper.WorkTypeMapper"> <mapper namespace="cn.wisenergy.mapper.WorkTypeMapper">
<update id="updateIsDeleteById"> <update id="updateIsStatusById">
update work_type update work_type
<set> <set>
<if test="null != isDelete"> <if test="null != status">
is_delete = #{isDelete}, status = #{status},
</if> </if>
</set> </set>
<where> <where>
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<select id="getAll" resultType="cn.wisenergy.model.app.WorkType"> <select id="getAll" resultType="cn.wisenergy.model.app.WorkType">
SELECT id,name,reviewer,is_delete SELECT id,`name`,reviewer,status
FROM work_type FROM work_type
</select> </select>
...@@ -27,12 +27,12 @@ ...@@ -27,12 +27,12 @@
FROM work_type FROM work_type
WHERE reviewer = #{reviewer} WHERE reviewer = #{reviewer}
</select> </select>
<select id="getByIsDelete" resultType="cn.wisenergy.model.app.WorkType"> <select id="getByIsStatus" resultType="cn.wisenergy.model.app.WorkType">
SELECT id,name,reviewer,is_delete SELECT id,name,reviewer,status
FROM work_type FROM work_type
<where> <where>
<if test="null != isDelete"> <if test="null != status">
is_delete = #{isDelete} status = #{status}
</if> </if>
</where> </where>
......
...@@ -31,8 +31,8 @@ public class WorkType implements Serializable, Comparable{ ...@@ -31,8 +31,8 @@ public class WorkType implements Serializable, Comparable{
@ApiModelProperty(name = "reviewer",value = "检查者:1:该项目负责人 2:系统自动 3:部门或中心负责人") @ApiModelProperty(name = "reviewer",value = "检查者:1:该项目负责人 2:系统自动 3:部门或中心负责人")
private Integer reviewer; private Integer reviewer;
@ApiModelProperty(name = "isDelete",value = "0:正常 1:删除") @ApiModelProperty(name = "status",value = "0:禁用 1:正常")
private Integer isDelete; private Integer status;
@Override @Override
......
...@@ -16,7 +16,7 @@ public interface WorkTypeService { ...@@ -16,7 +16,7 @@ public interface WorkTypeService {
Boolean addAndModifyWorkType(WorkType workType); Boolean addAndModifyWorkType(WorkType workType);
Boolean deleteTypeById(Integer id); Boolean modifyStatusById(Integer id,Integer status);
List<WorkType> getByIsDelete(Integer isSort,Integer isDelete); List<WorkType> getByIsStatus(Integer isSort,Integer status);
} }
...@@ -214,11 +214,15 @@ public class WorkProjectServiceImpl implements WorkProjectService { ...@@ -214,11 +214,15 @@ public class WorkProjectServiceImpl implements WorkProjectService {
} }
Integer rank = null; Integer rank = null;
Integer projectLevel = null;
for (WorkLevel level : workLevels) { for (WorkLevel level : workLevels) {
if (LevelEnum.PROJECT_MANAGER.getLevelName().equals(level.getName())) { if (LevelEnum.PROJECT_MANAGER.getLevelName().equals(level.getName())) {
if (null == rank) { if (null == rank) {
rank = level.getRank(); rank = level.getRank();
} }
if (LevelRankEnum.PROJECT_LEVEL.getRank().equals(level.getRank())) {
projectLevel = 1;
}
if (null != rank && rank < level.getRank()) { if (null != rank && rank < level.getRank()) {
rank = level.getRank(); rank = level.getRank();
} }
...@@ -232,7 +236,9 @@ public class WorkProjectServiceImpl implements WorkProjectService { ...@@ -232,7 +236,9 @@ public class WorkProjectServiceImpl implements WorkProjectService {
int pageSize = gmpv.getPageSize() == null ? 10 : gmpv.getPageSize(); int pageSize = gmpv.getPageSize() == null ? 10 : gmpv.getPageSize();
Integer isConclusion = gmpv.getIsConclusion(); Integer isConclusion = gmpv.getIsConclusion();
List<ManagerProjectsDto> managerProjectsDto; List<ManagerProjectsDto> managerProjectsDto;
if (null == projectLevel) {
gmpv.setUserId(null);
}
// 中心级 // 中心级
if (rank.equals(LevelRankEnum.CENTRAL_LEVEL.getRank())) { if (rank.equals(LevelRankEnum.CENTRAL_LEVEL.getRank())) {
List<Integer> deptIds = new ArrayList<>(); List<Integer> deptIds = new ArrayList<>();
......
...@@ -78,19 +78,19 @@ public class WorkTypeServiceImpl implements WorkTypeService { ...@@ -78,19 +78,19 @@ public class WorkTypeServiceImpl implements WorkTypeService {
@Transactional @Transactional
@Override @Override
public Boolean deleteTypeById(Integer id) { public Boolean modifyStatusById(Integer id,Integer status) {
log.info("WorkTypeServiceImpl[]deleteTypeById[]input.param.id:{}" + id); log.info("WorkTypeServiceImpl[]modifyStatusById[]input.param.id:{},status:{}" + id,status);
if (null == id) { if (null == id || null == status) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL); throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
} }
int i = workTypeMapper.updateIsDeleteById(id, 0); int i = workTypeMapper.updateIsStatusById(id, status);
return i>0; return i>0;
} }
@Override @Override
public List<WorkType> getByIsDelete(Integer isSort,Integer isDelete) { public List<WorkType> getByIsStatus(Integer isSort,Integer status) {
log.info("WorkTypeServiceImpl[]getByIsDelete[]"); log.info("WorkTypeServiceImpl[]getByIsStatus[]");
List<WorkType> workTypes = workTypeMapper.getByIsDelete(isDelete); List<WorkType> workTypes = workTypeMapper.getByIsStatus(status);
if (CollectionUtils.isEmpty(workTypes)) { if (CollectionUtils.isEmpty(workTypes)) {
return null; return null;
} }
......
...@@ -129,12 +129,15 @@ public class SystemController extends BaseController { ...@@ -129,12 +129,15 @@ public class SystemController extends BaseController {
return getResult(aBoolean); return getResult(aBoolean);
} }
@ApiOperation(value = "删除工时类型", notes = "删除工时类型", httpMethod = "DELETE") @ApiOperation(value = "修改工时类型状态", notes = "修改工时类型状态", httpMethod = "PUT")
@ApiImplicitParam(name = "id",value = "类型id",dataType ="int", required = true) @ApiImplicitParams({
@DeleteMapping("/modifyWorkType") @ApiImplicitParam(name = "id",value = "类型id",dataType ="int", required = true),
public Result<Boolean> deleteTypeById(Integer id) { @ApiImplicitParam(name = "status",value = "状态:0无效 1正常",dataType ="int", required = true)
log.info("SystemController[]modifyRole[]input.param.id:{}" + id); })
Boolean aBoolean = workTypeService.deleteTypeById(id); @PutMapping("/modifyStatus")
public Result<Boolean> modifyStatusById(Integer id,Integer status) {
log.info("SystemController[]modifyStatusById[]input.param.id:{},status:{}" + id,status);
Boolean aBoolean = workTypeService.modifyStatusById(id,status);
return getResult(aBoolean); return getResult(aBoolean);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment