@@ -132,7 +132,7 @@ public class InspectionFileController { | |||
* @param idList | |||
* @return | |||
*/ | |||
@GetMapping("/delete/{idList}") | |||
@DeleteMapping("/delete/{idList}") | |||
public JsonResult deletedByIdList(@PathVariable("idList") List<String> idList) { | |||
return iInspectionFileService.deletedByIdList(idList); | |||
} |
@@ -34,7 +34,16 @@ public interface InspectionFileMapper extends BaseMapper<InspectionFile> { | |||
* @param map | |||
* @return | |||
*/ | |||
int deleteLogicByMap(Map<String, Object> map); | |||
int deleteLogicByInspectionId(Map<String, Object> map); | |||
/** | |||
* | |||
* 逻辑删除巡检任务问题 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
int deleteLogicByIdList(Map<String, Object> map); | |||
/** | |||
* |
@@ -233,7 +233,7 @@ public class DeleteInspectionService { | |||
*/ | |||
private JsonResult deleteInspectionFileByLogic(Inspection inspection) { | |||
Map<String, Object> map = this.getInspectionMap(inspection); | |||
Integer rowId = inspectionFileMapper.deleteLogicByMap(map); | |||
Integer rowId = inspectionFileMapper.deleteLogicByInspectionId(map); | |||
log.info("删除任务, 返回结果: rowId={}", rowId); | |||
if (rowId < 0) { | |||
log.info("删除任务业务接口:逻辑删除任务问题失败"); |
@@ -62,32 +62,7 @@ public class EditHandle implements GenerateInspectionFieldHander { | |||
} | |||
return; | |||
} | |||
if (user.getId().equals(inspectionVo.getCreateUser())) { | |||
// 自己创建的任务 | |||
inspectionVo.setEdit(true); | |||
} else { | |||
// 非本人创建,判断该用户是不是该部门管理员 | |||
// 本部门主管编辑本部门任务 | |||
// 查询部门管理员,若是部门管理员可修改,非部门管理员不能修改 | |||
User userTmp = userMapper.selectOne(new LambdaQueryWrapper<User>() | |||
.eq(User::getDeptId, user.getDeptId()) | |||
.eq(User::getRoleId, DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode()) | |||
.eq(User::getMark, MarkEnum.VALID.getCode())); | |||
if (ObjectUtil.isNull(userTmp)) { | |||
if (null != handler) { | |||
handler.handler(user, dept, inspectionVo); | |||
return; | |||
} | |||
} | |||
if (!user.getId().equals(userTmp.getId())) { | |||
if (null != handler) { | |||
handler.handler(user, dept, inspectionVo); | |||
return; | |||
} | |||
} | |||
inspectionVo.setEdit(true); | |||
} | |||
inspectionVo.setEdit(true); | |||
if (null != handler) { | |||
handler.handler(user, dept, inspectionVo); | |||
return; |
@@ -44,23 +44,7 @@ public class ExecuteHandle implements GenerateInspectionFieldHander { | |||
} | |||
return; | |||
} | |||
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) { | |||
// 超级管理员不能执行任务操作 | |||
inspectionVo.setExecute(false); | |||
} else if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission()) { | |||
// 管理员可对本部门的任务执行此操作 | |||
if (user.getDeptId().equals(inspectionVo.getDeptId())) { | |||
if (1 == inspectionVo.getExecutionStatus()) { | |||
inspectionVo.setExecute(true); | |||
} | |||
} | |||
} else if (DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) { | |||
// 普通用户可对自己创建的任务执行此操作 | |||
if (user.getId().equals(inspectionVo.getCreateUser())) { | |||
inspectionVo.setExecute(true); | |||
} | |||
} | |||
inspectionVo.setExecute(true); | |||
if (null != handler) { | |||
handler.handler(user, dept, inspectionVo); | |||
} |
@@ -34,7 +34,7 @@ public class DeleteInspectionFileByIdListService { | |||
* @return | |||
*/ | |||
public JsonResult deletedByIdList(List<String> idList) { | |||
log.info("进入删除任务问题接口"); | |||
log.info("进入删除问题接口"); | |||
String userId = CurrentUserUtil.getUserId(); | |||
JsonResult result = this.check(idList); | |||
if (0 != result.getCode()) { | |||
@@ -42,17 +42,15 @@ public class DeleteInspectionFileByIdListService { | |||
return result; | |||
} | |||
for (String id : idList) { | |||
Map<String, Object> map = new HashMap<>(); | |||
map.put("inspectionId", id); | |||
map.put("mark", 0); | |||
map.put("updateUser", userId); | |||
map.put("updateTime", DateUtils.now()); | |||
Integer rowId = inspectionFileMapper.deleteLogicByMap(map); | |||
if (rowId <= 0) { | |||
log.info("删除任务问题失败:inspectionFileId:{}", id); | |||
throw new ServiceException("删除任务问题失败"); | |||
} | |||
Map<String, Object> map = new HashMap<>(); | |||
map.put("idList", idList); | |||
map.put("mark", 0); | |||
map.put("updateUser", userId); | |||
map.put("updateTime", DateUtils.now()); | |||
Integer rowId = inspectionFileMapper.deleteLogicByIdList(map); | |||
if (rowId <= 0) { | |||
log.info("删除问题失败:inspectionFileId:{}", idList); | |||
throw new ServiceException("删除问题失败"); | |||
} | |||
return JsonResult.success(); | |||
} | |||
@@ -65,7 +63,7 @@ public class DeleteInspectionFileByIdListService { | |||
*/ | |||
private JsonResult check(List<String> idList) { | |||
if (CollectionUtil.isEmpty(idList)) { | |||
throw new ServiceException("任务ID为空"); | |||
throw new ServiceException("问题ID为空"); | |||
} | |||
return JsonResult.success(); | |||
} |
@@ -151,7 +151,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
</foreach> | |||
</insert> | |||
<update id="deleteLogicByMap" parameterType="hashmap"> | |||
<update id="deleteLogicByInspectionId" parameterType="hashmap"> | |||
update th_inspection_file | |||
<trim prefix="SET" suffixOverrides=","> | |||
<if test="updateUser != null and updateUser != ''"> update_user = #{updateUser}, </if> | |||
@@ -163,6 +163,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
</where> | |||
</update> | |||
<update id="deleteLogicByIdList" parameterType="hashmap"> | |||
update th_inspection_file | |||
<trim prefix="SET" suffixOverrides=","> | |||
<if test="updateUser != null and updateUser != ''"> update_user = #{updateUser}, </if> | |||
<if test="updateTime != null"> update_time = #{updateTime}, </if> | |||
<if test="mark != null"> mark = #{mark},</if> | |||
</trim> | |||
<where> | |||
<if test="idList != null and idList.size() > 0"> | |||
id in | |||
<foreach collection="idList" item="id" separator="," open="(" close=")"> | |||
#{id} | |||
</foreach> | |||
</if> | |||
</where> | |||
</update> | |||
<delete id="deleteByInspectionId" parameterType="String"> | |||
delete from th_inspection_file where inspection_id = #{id} | |||
</delete> |