提交修改

This commit is contained in:
quyixiao 2020-09-21 16:14:52 +08:00
parent a43e44fed7
commit 0f43b2697e
6 changed files with 34 additions and 43 deletions

View File

@ -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());
}
/**
* 保存
*/

View File

@ -124,7 +124,7 @@ public class StaffRoleController {
List<Long> 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();
}

View File

@ -26,4 +26,5 @@ public class Auth {
private int downFile;
private int keyResult35;
private int keyResult37;
private int editScore;
}

View File

@ -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<RecordAuthMapper, RecordA
if (CollectionUtils.isNotEmpty(auths)) {
map = auths.stream().collect(Collectors.toMap(RecordAuth::getIdentity, RecordAuth::getStatus));
}
Auth auth = new Auth();
auth.setAdd(NumberUtil.objToIntDefault(map.get("add"), 0));
auth.setApprovel(NumberUtil.objToIntDefault(map.get("approvel"), 0));
auth.setCheckResult(NumberUtil.objToIntDefault(map.get("checkResult"), 0));
auth.setCheckWeight(NumberUtil.objToIntDefault(map.get("checkWeight"), 0));
auth.setCommit(NumberUtil.objToIntDefault(map.get("commit"), 0));
auth.setConfirmCommit(NumberUtil.objToIntDefault(map.get("confirmCommit"), 0));
auth.setKeyResult(NumberUtil.objToIntDefault(map.get("keyResult"), 0));
auth.setPriority(NumberUtil.objToIntDefault(map.get("priority"), 0));
auth.setReject(NumberUtil.objToIntDefault(map.get("reject"), 0));
auth.setScoreComment(NumberUtil.objToIntDefault(map.get("scoreComment"), 0));
auth.setSuperScore(NumberUtil.objToIntDefault(map.get("superScore"), 0));
auth.setTarget(NumberUtil.objToIntDefault(map.get("target"), 0));
auth.setEdit(NumberUtil.objToIntDefault(map.get("edit"), 0));
auth.setAcquireScore(NumberUtil.objToIntDefault(map.get("acquireScore"), 0));
auth.setWenhuaAdd(NumberUtil.objToIntDefault(map.get("wenhuaAdd"), 0));
auth.setWenHuaEdit(NumberUtil.objToIntDefault(map.get("wenHuaEdit"), 0));
auth.setWaitCommit(NumberUtil.objToIntDefault(map.get("waitCommit"), 0));
auth.setApprovelCommit(NumberUtil.objToIntDefault(map.get("approvelCommit"), 0));
auth.setUploadFile(NumberUtil.objToIntDefault(map.get("uploadFile"), 0));
auth.setKeyResult35(NumberUtil.objToIntDefault(map.get("keyResult35"), 0));
auth.setKeyResult37(NumberUtil.objToIntDefault(map.get("keyResult37"), 0));
return auth;
return JSONObject.parseObject(JSON.toJSONString(map),Auth.class);
}

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Maps;
import com.lz.common.utils.NumberUtil;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.StringUtil;
import com.lz.modules.app.dao.DepartmentsDao;
import com.lz.modules.app.dao.StaffDao;
import com.lz.modules.app.dto.StaffRoleResp;
@ -23,6 +24,7 @@ import com.lz.modules.sys.entity.SysMenuEntity;
import com.lz.modules.sys.entity.SysRoleEntity;
import com.lz.modules.sys.service.app.ResultRecordService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -109,6 +111,8 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
@Override
public PageUtils queryPage(Map<String, Object> 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<StaffRoleMapper, StaffRole
if (staffEntity != null) {
resp.setStaffName(staffEntity.getName());
}
Map<String, Integer> 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<StaffRoleMapper, StaffRole
@Override
public void deleteBatchIds(List<Long> 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<Long> menuIdList= new ArrayList<>();
List<Long> menuIdList1= new ArrayList<>();
if(staffRole!=null){
List<StaffRoleDepartment> staffRoleDepartments = staffRoleDepartmentMapper.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId());
List<DepartmentsEntity> departmentsEntities = departmentsDao.selectAll();
Map<String,List<DepartmentsEntity>> 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<DepartmentsEntity> 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;
}

View File

@ -88,7 +88,11 @@
</select>
<select id="selectByCondition" resultType="com.lz.modules.flow.entity.StaffRole">
select * from lz_staff_role where is_delete = 0 order by id desc
select * from lz_staff_role where is_delete = 0
<if test="params.name != null and params.name != '' ">
and staff_id in (select id from lz_staff where name like concat('%',#{params.name},'%'))
</if>
order by id desc
</select>