提交修改

This commit is contained in:
quyixiao 2020-10-30 17:04:45 +08:00
parent 428fb0fe40
commit 00f05d3cab
8 changed files with 82 additions and 3 deletions

View File

@ -986,7 +986,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")
public R newResultRecordList(RecordDetailDto recordDetailDto) {
if(recordDetailDto.getLoginUserId() ==null && getUser() !=null ){

View File

@ -1,6 +1,8 @@
package com.lz.modules.app.controller;
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.dingtalk.api.response.OapiCrmAuthGroupMemberListResponse;
import com.lz.common.utils.R;
@ -40,6 +42,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
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
*/
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lz.modules.flow.entity.AuthDto;
import com.lz.modules.flow.entity.RecordAuth;
import org.apache.ibatis.annotations.Mapper;
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> 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();
Long getRoleIdByStaffRoleInfo(String flowStaffIdRole,Long approvalStaffId);
Map<String, Integer> selectAuthByRoleIds(List<Long> roleIds);
}

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.StaffService;
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.model.Auth;
import com.lz.modules.flow.model.StaffRoleDto;
@ -116,8 +117,20 @@ public class RecordAuthServiceImpl extends ServiceImpl<RecordAuthMapper, RecordA
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<>();
if (CollectionUtils.isNotEmpty(auths)) {
for(RecordAuth recordAuth : auths){

View File

@ -1114,9 +1114,37 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
end.setFlowName("线束");
flowRecordList.add(end);
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.put("flowRecordList", flowRecordList);
map.put("resultCommentList", resultCommentList);
map.put("auth",auth);
return R.ok().put("data", map);
}

View File

@ -98,5 +98,15 @@
</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>