Merge branch 'version_performance_2.0' of http://gitlab.ldxinyong.com/enterpriseManagement/lz_management into version_performance_2.0

This commit is contained in:
杜建超 2020-10-30 18:20:43 +08:00
commit de859ed647
10 changed files with 149 additions and 33 deletions

View File

@ -430,7 +430,7 @@ public class ResultRecordController extends AbstractController {
scores) { scores) {
if(scoreDto.getApprovalId().longValue() == score.getApprovalId().longValue()){ if(scoreDto.getApprovalId().longValue() == score.getApprovalId().longValue()){
ResultScoreDto scoreDto1 = new ResultScoreDto(); ResultScoreDto scoreDto1 = new ResultScoreDto();
BeanUtils.copyProperties(scoreDto1, score); BeanUtils.copyProperties(score, scoreDto1);
scoreDto1.setApprovalId(scoreDto.getApprovalId()); scoreDto1.setApprovalId(scoreDto.getApprovalId());
scoreDto1.setApprovalName(scoreDto.getApprovalName()); scoreDto1.setApprovalName(scoreDto.getApprovalName());
scoreDto1.setWeight(scoreDto.getWeight()); scoreDto1.setWeight(scoreDto.getWeight());
@ -604,6 +604,7 @@ public class ResultRecordController extends AbstractController {
}else{ }else{
updateScores.add(resultScore); updateScores.add(resultScore);
} }
resultScore.setDetailId(detailDto.getId());
} }
resultDetail.setAcquireScore(score); resultDetail.setAcquireScore(score);
weight = weight.add(resultDetail.getCheckWeight()); weight = weight.add(resultDetail.getCheckWeight());
@ -989,7 +990,7 @@ public class ResultRecordController extends AbstractController {
/** /**
* 删除 * 删除
*/ */
// http://localhost:8080/lz_management/user/lzresultrecord/new/resultRecordDetail?resultRecordId=215 // http://localhost:8080/lz_management/user/lzresultrecord/new/resultRecordDetail?resultRecordId=267&loginUserId=313
@RequestMapping("/new/resultRecordDetail") @RequestMapping("/new/resultRecordDetail")
public R newResultRecordList(RecordDetailDto recordDetailDto) { public R newResultRecordList(RecordDetailDto recordDetailDto) {
if(recordDetailDto.getLoginUserId() ==null && getUser() !=null ){ if(recordDetailDto.getLoginUserId() ==null && getUser() !=null ){

View File

@ -1,6 +1,8 @@
package com.lz.modules.app.controller; package com.lz.modules.app.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dingtalk.api.response.OapiCrmAuthGroupMemberListResponse; import com.dingtalk.api.response.OapiCrmAuthGroupMemberListResponse;
import com.lz.common.utils.R; import com.lz.common.utils.R;
@ -40,6 +42,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -265,6 +268,16 @@ public class TestController {
} }
public static void main(String[] args) {
String a = "{\"313\":[17,20,13]}";
Map<String,Object> map = JSONObject.parseObject(a,Map.class);
List<Long> roleIds = null;
for (Map.Entry<String, Object> entry : map.entrySet()) {
if(entry.getValue() !=null ){
roleIds = JSON.parseArray(entry.getValue().toString(),Long.class);
}
}
System.out.println(roleIds);
}
} }

View File

@ -8,6 +8,7 @@ package com.lz.modules.flow.dao;
* @since 2020-08-18 * @since 2020-08-18
*/ */
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lz.modules.flow.entity.AuthDto;
import com.lz.modules.flow.entity.RecordAuth; import com.lz.modules.flow.entity.RecordAuth;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -37,4 +38,6 @@ public interface RecordAuthMapper extends BaseMapper<RecordAuth> {
List<RecordAuth> selectAuthInfo(@Param("roleId") Long roleId); List<RecordAuth> selectAuthInfo(@Param("roleId") Long roleId);
List<RecordAuth> selectAll(); List<RecordAuth> selectAll();
List<AuthDto> selectAuthByRoleIds(@Param("roleIds") List<Long> roleIds);
} }

View File

@ -0,0 +1,10 @@
package com.lz.modules.flow.entity;
import lombok.Data;
@Data
public class AuthDto {
private String identity ;
private Integer status;
}

View File

@ -45,4 +45,6 @@ public interface RecordAuthService extends IService<RecordAuth> {
List<RecordAuth> selectAll(); List<RecordAuth> selectAll();
Long getRoleIdByStaffRoleInfo(String flowStaffIdRole,Long approvalStaffId); Long getRoleIdByStaffRoleInfo(String flowStaffIdRole,Long approvalStaffId);
Map<String, Integer> selectAuthByRoleIds(List<Long> roleIds);
} }

View File

@ -264,39 +264,41 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
evaluationGroup.setGmtCreate(null); evaluationGroup.setGmtCreate(null);
evaluationGroup.setGmtModified(null); evaluationGroup.setGmtModified(null);
evaluationGroupService.insertEvaluationGroup(evaluationGroup); evaluationGroupService.insertEvaluationGroup(evaluationGroup);
}
//拷贝考评组的指标信息
List<ResultTagetLib> resultTagetLibs = new ArrayList<>();
//拷贝考评组的指标信息 for (ResultModelDto dto:resultModelDtos
List<ResultTagetLib> resultTagetLibs = new ArrayList<>();
for (ResultModelDto dto:resultModelDtos
) {
dto.setEvaluationGroupId(evaluationGroup.getId());//设置拷贝组的id
//下面拷贝一份考评组信息的维度信息
ResultModel resultModel = new ResultModel();
BeanUtils.copyProperties(dto, resultModel);
resultModel.setId(null);
resultModelService.insertResultModel(resultModel);
List<ResultTagetLibDto> libDtos = resultTagetLibService.selectResultTagetLibDtoByModelId(dto.getId());
dto.setTagetLibs(libDtos);
for (ResultTagetLibDto libDto: libDtos
) { ) {
//下面拷贝考评组里面的指标信息
ResultTagetLib resultTagetLib = new ResultTagetLib();
BeanUtils.copyProperties(libDto, resultTagetLib); dto.setEvaluationGroupId(evaluationGroup.getId());//设置拷贝组的id
resultTagetLib.setModelId(resultModel.getId());//设置新的维度id //下面拷贝一份考评组信息的维度信息
resultTagetLib.setId(null); ResultModel resultModel = new ResultModel();
resultTagetLibs.add(resultTagetLib); BeanUtils.copyProperties(dto, resultModel);
resultModel.setId(null);
resultModelService.insertResultModel(resultModel);
List<ResultTagetLibDto> libDtos = resultTagetLibService.selectResultTagetLibDtoByModelId(dto.getId());
dto.setTagetLibs(libDtos);
for (ResultTagetLibDto libDto: libDtos
) {
//下面拷贝考评组里面的指标信息
ResultTagetLib resultTagetLib = new ResultTagetLib();
BeanUtils.copyProperties(libDto, resultTagetLib);
resultTagetLib.setModelId(resultModel.getId());//设置新的维度id
resultTagetLib.setId(null);
resultTagetLibs.add(resultTagetLib);
}
}
if(resultTagetLibs.size() > 0){
//插入备份的考评组指标信息
resultTagetLibService.insertResultTagetLibs(resultTagetLibs);
} }
} }
if(resultTagetLibs.size() > 0){
//插入备份的考评组指标信息
resultTagetLibService.insertResultTagetLibs(resultTagetLibs);
}

View File

@ -12,6 +12,7 @@ import com.lz.modules.app.service.DepartmentsService;
import com.lz.modules.app.service.DepartmentsStaffRelateService; import com.lz.modules.app.service.DepartmentsStaffRelateService;
import com.lz.modules.app.service.StaffService; import com.lz.modules.app.service.StaffService;
import com.lz.modules.flow.dao.RecordAuthMapper; import com.lz.modules.flow.dao.RecordAuthMapper;
import com.lz.modules.flow.entity.AuthDto;
import com.lz.modules.flow.entity.RecordAuth; import com.lz.modules.flow.entity.RecordAuth;
import com.lz.modules.flow.model.Auth; import com.lz.modules.flow.model.Auth;
import com.lz.modules.flow.model.StaffRoleDto; import com.lz.modules.flow.model.StaffRoleDto;
@ -116,8 +117,20 @@ public class RecordAuthServiceImpl extends ServiceImpl<RecordAuthMapper, RecordA
return 0l; return 0l;
} }
@Override
public Map<String, Integer> selectAuthByRoleIds(List<Long> roleIds) {
Map<String,Integer> map = new HashMap<>();
List<AuthDto> list = recordAuthMapper.selectAuthByRoleIds(roleIds);
if(CollectionUtils.isNotEmpty(list)){
for(AuthDto authDto:list){
map.put(authDto.getIdentity(),authDto.getStatus());
}
}
return map;
}
public Auth getAuth(List<RecordAuth> auths) {
public Auth getAuth(List<RecordAuth> auths) {
Map<String, Integer> map = new HashMap<>(); Map<String, Integer> map = new HashMap<>();
if (CollectionUtils.isNotEmpty(auths)) { if (CollectionUtils.isNotEmpty(auths)) {
for(RecordAuth recordAuth : auths){ for(RecordAuth recordAuth : auths){

View File

@ -1114,9 +1114,37 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
end.setFlowName("线束"); end.setFlowName("线束");
flowRecordList.add(end); flowRecordList.add(end);
List<ResultComment> resultCommentList = resultCommentService.selectByRecordId(recordDetailDto.getResultRecordId()); List<ResultComment> resultCommentList = resultCommentService.selectByRecordId(recordDetailDto.getResultRecordId());
Map<String,Integer> auth = new HashMap<>();
List<FlowRecord> currentResultRecords = flowRecordService.selectFlowRecordByRecordIdStatus(recordDetailDto.getResultRecordId(),2);
if(currentResultRecords !=null && currentResultRecords.size() > 0 ){
FlowRecord currentResultRecord = null;
for(FlowRecord flowRecord:currentResultRecords){
if(flowRecord.getApprovalStaffId().equals(recordDetailDto.getLoginUserId())){
currentResultRecord = flowRecord;
break;
}
}
if(currentResultRecord !=null){
if(StringUtil.isNotBlank(currentResultRecord.getFlowStaffIdRole())){
Map<String,Object> map = JSONObject.parseObject(currentResultRecord.getFlowStaffIdRole(),Map.class);
List<Long> roleIds = null;
for (Map.Entry<String, Object> entry : map.entrySet()) {
if(entry.getValue() !=null ){
roleIds = JSON.parseArray(entry.getValue().toString(),Long.class);
}
}
if(roleIds !=null && roleIds.size() > 0){
auth = recordAuthService.selectAuthByRoleIds(roleIds);
}
}
}
}
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("flowRecordList", flowRecordList); map.put("flowRecordList", flowRecordList);
map.put("resultCommentList", resultCommentList); map.put("resultCommentList", resultCommentList);
map.put("auth",auth);
return R.ok().put("data", map); return R.ok().put("data", map);
} }

View File

@ -98,5 +98,15 @@
</select> </select>
<select id="selectAuthByRoleIds" resultType="com.lz.modules.flow.entity.AuthDto">
select * from (select identity ,status from lz_record_auth where id in (select auth_id from lz_record_role_auth
where role_id in
<foreach item="item" collection="roleIds" open="(" separator="," close=")">
#{item}
</foreach>
) order by status desc ) a group by identity
</select>
</mapper> </mapper>

View File

@ -3,6 +3,7 @@ package com.lz.mysql;
import com.lz.common.utils.StringUtil; import com.lz.common.utils.StringUtil;
import com.lz.modules.flow.entity.FlowChartRole; import com.lz.modules.flow.entity.FlowChartRole;
import org.springframework.util.ResourceUtils; import org.springframework.util.ResourceUtils;
import org.springframework.util.StopWatch;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
@ -49,11 +50,43 @@ public class MysqlMain {
public static String dto_exclude = ",is_delete,gmt_create,gmt_modified,";//生成dto时排除字段前后都要加英文逗号 public static String dto_exclude = ",is_delete,gmt_create,gmt_modified,";//生成dto时排除字段前后都要加英文逗号
public static String req_exclude = ",,";//生成Req时排除字段前后都要加英文逗号 public static String req_exclude = ",,";//生成Req时排除字段前后都要加英文逗号
public static class TestStaticAndHuo{
public static int compare(Long a, Long b){
return a.compareTo(b);
}
public static boolean isEmpt(String str){
return str == null || str.length() == 0;
}
}
/** /**
* @param args * @param args
*/ */
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
/*Long a = 2l;
Long b = 3l;
String value = "aaa";
StopWatch stopWatch = new StopWatch();
stopWatch.start("测试静态方法");
for(int i = 0; i < 10000; i++){
if(TestStaticAndHuo.isEmpt(value)){
}
}
stopWatch.stop();
stopWatch.start("测试对象方法");
for(int i = 0; i < 10000; i++){
if(value == null || value.length() == 0){
}
}
stopWatch.stop();
System.out.println(stopWatch.prettyPrint());*/
/*List<TestMap> testMaps = new ArrayList<>(); /*List<TestMap> testMaps = new ArrayList<>();
TestMap test = new TestMap(); TestMap test = new TestMap();
test.setName("123"); test.setName("123");
@ -78,7 +111,6 @@ public class MysqlMain {
} }
}).collect(Collectors.joining(","));*/ }).collect(Collectors.joining(","));*/
String path = ResourceUtils.getURL("classpath:").getPath(); String path = ResourceUtils.getURL("classpath:").getPath();
System.out.println(path); System.out.println(path);
String dir = null; String dir = null;
@ -147,6 +179,8 @@ public class MysqlMain {
for (int i = 0; i < list2.size(); i++) { for (int i = 0; i < list2.size(); i++) {
MysqlUtilTable2XML.printXMLForMap(list2.get(i)); MysqlUtilTable2XML.printXMLForMap(list2.get(i));
} }
} }
} }