Browse Source

1、修改任务分页列表中编辑,执行代码;2、删除问题代码;

tags/V1.3.3^2
wanjing 11 months ago
parent
commit
d40d8f6a8f
7 changed files with 43 additions and 60 deletions
  1. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionFileController.java
  2. +10
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/InspectionFileMapper.java
  3. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/delete/DeleteInspectionService.java
  4. +1
    -26
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/handle/EditHandle.java
  5. +1
    -17
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/handle/ExecuteHandle.java
  6. +11
    -13
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/delete/DeleteInspectionFileByIdListService.java
  7. +18
    -1
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionFileMapper.xml

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionFileController.java View File

@@ -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);
}

+ 10
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/InspectionFileMapper.java View File

@@ -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);

/**
*

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/delete/DeleteInspectionService.java View File

@@ -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("删除任务业务接口:逻辑删除任务问题失败");

+ 1
- 26
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/handle/EditHandle.java View File

@@ -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;

+ 1
- 17
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/handle/ExecuteHandle.java View File

@@ -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);
}

+ 11
- 13
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/delete/DeleteInspectionFileByIdListService.java View File

@@ -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();
}

+ 18
- 1
tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionFileMapper.xml View File

@@ -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>

Loading…
Cancel
Save