From 0f43b2697e281ecd77f6dc2203edce5c9caf4606 Mon Sep 17 00:00:00 2001 From: quyixiao <2621048238@qq.com> Date: Mon, 21 Sep 2020 16:14:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ResultRecordController.java | 8 +++--- .../app/controller/StaffRoleController.java | 12 ++++----- .../java/com/lz/modules/flow/model/Auth.java | 1 + .../service/impl/RecordAuthServiceImpl.java | 26 +++---------------- .../service/impl/StaffRoleServiceImpl.java | 24 +++++++++++------ .../resources/mapper/flow/StaffRoleMapper.xml | 6 ++++- 6 files changed, 34 insertions(+), 43 deletions(-) diff --git a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java index e781119e..602c1293 100644 --- a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java +++ b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java @@ -35,11 +35,13 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import java.math.BigDecimal; import java.text.SimpleDateFormat; -import java.time.LocalDate; import java.util.*; import java.util.stream.Collectors; @@ -486,7 +488,6 @@ public class ResultRecordController extends AbstractController { BigDecimal checkWeight = NumberUtil.objToBigDecimalDefault(resultDetail.getCheckWeight(), BigDecimal.ZERO); BigDecimal acquireScore = NumberUtil.objToBigDecimalDefault(resultDetail.getAcquireScore(), BigDecimal.ZERO); sum = sum.add(checkWeight.multiply(acquireScore)); - } sum = BigDecimalUtil.setScale(sum, 3); String scoreLevel = resultDetailService.getScoreLevel(sum.doubleValue()); @@ -497,7 +498,6 @@ public class ResultRecordController extends AbstractController { } return R.ok("保存成功").put("recordId", resultRecord.getId()); } - /** * 保存 */ diff --git a/src/main/java/com/lz/modules/app/controller/StaffRoleController.java b/src/main/java/com/lz/modules/app/controller/StaffRoleController.java index 3e9e4eae..398b70d2 100644 --- a/src/main/java/com/lz/modules/app/controller/StaffRoleController.java +++ b/src/main/java/com/lz/modules/app/controller/StaffRoleController.java @@ -124,7 +124,7 @@ public class StaffRoleController { List menuIdList = req.getMenuIdList(); for(Long menuId : menuIdList) { if (menuId <= 0) { - continue; + break; } StaffRoleDepartment staffRoleDepartment = staffRoleDepartmentService.selectStaffRoleDepartmentByDepartmentIdRoleIds(menuId, ids); if (staffRoleDepartment != null) { @@ -152,8 +152,7 @@ public class StaffRoleController { } } - - if (req.getId() == null) { + if (req.getId() == null || req.getId() <= 0) { staffRoleService.insertStaffRole(staffRole); } else { staffRoleService.updateStaffRoleById(staffRole); @@ -164,11 +163,10 @@ public class StaffRoleController { /** * 删除 */ - @RequestMapping("/delete") + @RequestMapping("/delete/{id}") @RequiresPermissions("user:lzstaffrole:delete") - public R delete(@RequestBody Long[] ids) { - staffRoleService.deleteBatchIds(Arrays.asList(ids)); - + public R delete(@PathVariable("id") String id) { + staffRoleService.deleteBatchIds(Arrays.asList(NumberUtil.objToLongDefault(id,0l))); return R.ok(); } diff --git a/src/main/java/com/lz/modules/flow/model/Auth.java b/src/main/java/com/lz/modules/flow/model/Auth.java index 0a64abd0..1094049c 100644 --- a/src/main/java/com/lz/modules/flow/model/Auth.java +++ b/src/main/java/com/lz/modules/flow/model/Auth.java @@ -26,4 +26,5 @@ public class Auth { private int downFile; private int keyResult35; private int keyResult37; + private int editScore; } diff --git a/src/main/java/com/lz/modules/flow/service/impl/RecordAuthServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/RecordAuthServiceImpl.java index 463c92c5..6098226b 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/RecordAuthServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/RecordAuthServiceImpl.java @@ -1,5 +1,6 @@ package com.lz.modules.flow.service.impl; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.lz.common.utils.NumberUtil; @@ -17,6 +18,7 @@ import com.lz.modules.flow.model.Auth; import com.lz.modules.flow.model.StaffRoleDto; import com.lz.modules.flow.service.RecordAuthService; import org.apache.commons.collections.CollectionUtils; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -107,29 +109,7 @@ public class RecordAuthServiceImpl extends ServiceImpl params) { + + PageUtils pageUtils = PageUtils.startPage( NumberUtil.objToIntDefault(params.get("page"), 1), NumberUtil.objToIntDefault(params.get("limit"), 10)).doSelect( @@ -124,6 +128,7 @@ public class StaffRoleServiceImpl extends ServiceImpl types = JSONObject.parseObject(resp.getTypeRoleIds(), Map.class); Long type1 = NumberUtil.objToLongDefault(types.get("type1"),0l); Long type2 = NumberUtil.objToLongDefault(types.get("type2"),0l); @@ -152,32 +157,35 @@ public class StaffRoleServiceImpl extends ServiceImpl asList) { for (Long a : asList) { - staffRoleMapper.selectByStaffId(a); + staffRoleMapper.deleteStaffRoleById(a); } } + @Override public SysRoleEntity getRole(Long id) { StaffRole staffRole = staffRoleMapper.selectStaffRoleById(id); SysRoleEntity role = new SysRoleEntity(); List menuIdList= new ArrayList<>(); + List menuIdList1= new ArrayList<>(); if(staffRole!=null){ List staffRoleDepartments = staffRoleDepartmentMapper.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId()); + List departmentsEntities = departmentsDao.selectAll(); + Map> map= resultRecordService.getStringListMap(departmentsEntities); role.setRoleId(staffRole.getId()); role.setRoleName(staffRole.getDepartmentLevel()); for(StaffRoleDepartment staffRoleDepartment: staffRoleDepartments){ - if(staffRoleDepartment.getDepartmentId().equals("379454542") - || staffRoleDepartment.getDepartmentId().equals("154274609")){ - continue; + List list = map.get(staffRoleDepartment.getDepartmentId()); + if(list == null || list.size() == 0){ + menuIdList.add(NumberUtil.objToLongDefault(staffRoleDepartment.getDepartmentId(),0l)); + }else{ + menuIdList1.add(NumberUtil.objToLongDefault(staffRoleDepartment.getDepartmentId(),0l)); } - menuIdList.add(NumberUtil.objToLongDefault(staffRoleDepartment.getDepartmentId(),0l)); } } menuIdList.add(-666666l); - menuIdList.add(379454542l); - menuIdList.add(154274609l); + menuIdList.addAll(menuIdList1); role.setMenuIdList(menuIdList); - return role; } diff --git a/src/main/resources/mapper/flow/StaffRoleMapper.xml b/src/main/resources/mapper/flow/StaffRoleMapper.xml index f1ba59da..69a78b03 100644 --- a/src/main/resources/mapper/flow/StaffRoleMapper.xml +++ b/src/main/resources/mapper/flow/StaffRoleMapper.xml @@ -88,7 +88,11 @@