Commit 920123fe authored by cq990612's avatar cq990612

优化代码结构

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