Commit 2b0b5ddc authored by mengmeng's avatar mengmeng

当事人评价唯一性优化

parent 125f2074
......@@ -54,7 +54,7 @@ public class FhjwCaseController {
return new Result<PageData<FhjwCaseDTO>>().ok(page);
}
// @Login
@Login
@GetMapping("{id}")
@ApiOperation("信息")
public Result<FhjwCaseDTO> get(@PathVariable("id") Long id){
......@@ -74,7 +74,7 @@ public class FhjwCaseController {
return new Result<FhjwCaseDTO>().ok(data);
}
// @Login
@Login
@PostMapping
@ApiOperation("保存")
public Result save(@RequestBody Map<String, Object> params){
......
......@@ -10,12 +10,15 @@ import io.hmit.entity.UserEntity;
import io.hmit.modules.fhjw.dao.FhiwFunctionDao;
import io.hmit.modules.fhjw.dto.FhiwFunctionDTO;
import io.hmit.modules.fhjw.dto.FhjwCaseDTO;
import io.hmit.modules.fhjw.dto.FhjwCommentDTO;
import io.hmit.modules.fhjw.dto.FhjwRoleFunctionDTO;
import io.hmit.modules.fhjw.dto.UserCaseDTO;
import io.hmit.modules.fhjw.entity.FhiwFunctionEntity;
import io.hmit.modules.fhjw.entity.FhjwCommentEntity;
import io.hmit.modules.fhjw.entity.UserCaseEntity;
import io.hmit.modules.fhjw.service.FhiwFunctionService;
import io.hmit.modules.fhjw.service.FhjwCaseService;
import io.hmit.modules.fhjw.service.FhjwCommentService;
import io.hmit.modules.fhjw.service.FhjwRoleFunctionService;
import io.hmit.modules.fhjw.service.UserCaseService;
import io.hmit.modules.user.dto.UserRoleDTO;
......@@ -66,6 +69,9 @@ public class FhiwFunctionServiceImpl extends CrudServiceImpl<FhiwFunctionDao, Fh
@Autowired
private RoleService roleService;
@Autowired
private FhjwCommentService fhjwCommentService;
@Autowired
private UserRoleService userRoleService;
......@@ -100,6 +106,8 @@ public class FhiwFunctionServiceImpl extends CrudServiceImpl<FhiwFunctionDao, Fh
boolean flag = false;
//判断是否有评价权限
boolean ifComment = false;
//判断是否已经评价过
boolean isExict = false;
//判断人员和案件是否已经绑定,当事人、代理人需要和案件关联后才能进行操作,否则显示无权限
//律师、代表委员、监督听证则无需和案件关联也可进行评价
......@@ -109,9 +117,15 @@ public class FhiwFunctionServiceImpl extends CrudServiceImpl<FhiwFunctionDao, Fh
Map<String, Object> query = new HashMap<>();
query.put("caseId",caseId);
query.put("userId",userId);
List<UserCaseDTO> userCases = userCaseService.list(query);
//当事人权限,则需要判断此案件是否有代理人,有代理人则不允许评价,无代理人则可以评价
if(userCases.size()>0){
List<FhjwCommentDTO> commentLists = fhjwCommentService.list(query);
if(commentLists.size()>0){
isExict = true;
}
ifComment = true;
if("当事人".equals(roleName)){
String agentName = fhjwCaseService.get(caseId).getAgentName();
......@@ -153,13 +167,15 @@ public class FhiwFunctionServiceImpl extends CrudServiceImpl<FhiwFunctionDao, Fh
//根据是否存在代理人,判断是否添加 "我要填写测评" 的权限!
Long funcId = baseDao.selectOne(new QueryWrapper<FhiwFunctionEntity>().eq("name","我要填写测评")).getId();
List<Long> funIds = new ArrayList<>();
if(flag){
logger.info("存在代理人");
System.out.println("isExict: "+isExict);
System.out.println("flag: "+flag);
if(flag || isExict){
logger.info("存在代理人或已经评价过");
funIds = fhjwRoleFunctionService.list(params).stream()
.filter(roleFunc -> !roleFunc.getFunctionId().equals(funcId))
.map(FhjwRoleFunctionDTO::getFunctionId).collect(Collectors.toList());
}else {
logger.info("不存在代理人");
logger.info("不存在代理人或未进行评价");
funIds = fhjwRoleFunctionService.list(params).stream()
.map(FhjwRoleFunctionDTO::getFunctionId).collect(Collectors.toList());
}
......
......@@ -48,9 +48,13 @@ public class FhjwCommentServiceImpl extends CrudServiceImpl<FhjwCommentDao, Fhjw
@Override
public QueryWrapper<FhjwCommentEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");
String caseId = params.get("caseId")==null?"":params.get("caseId").toString();
String userId = params.get("userId")==null?"":params.get("userId").toString();
QueryWrapper<FhjwCommentEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);
wrapper.eq(StringUtils.isNotBlank(caseId), "case_id", caseId);
wrapper.eq(StringUtils.isNotBlank(userId), "user_id", userId);
return wrapper;
}
......@@ -69,9 +73,9 @@ public class FhjwCommentServiceImpl extends CrudServiceImpl<FhjwCommentDao, Fhjw
//设置案件所属部门(根据承办人确定)
dto.setDeptId(caseDto.get(0).getDeptId());
//设置案件ID--律师、代表委员、监督听证权限和案件没有绑定人员则根据案件号获取第一个caseID
//设置案件ID--律师、代表委员、监督听证权限和案件没有绑定人员则根据案件号获取第一个caseID
dto.setCaseId(caseDto.get(0).getId());
//设置人员对应的caseID(存在相同受案号,不同当事人的情况,需要人员匹配caseID)
//设置人员对应的caseID(存在相同受案号,不同当事人的情况,需要将人员--caseID进行匹配)
List<Long> ids = caseDto.stream().map(FhjwCaseDTO::getId).collect(Collectors.toList());
for (Long id :ids){
UserCaseDTO userCaseDTO= userCaseService.getByUserACase(dto.getUserId(),id);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment