Browse Source

conflict

master
zhizhi wu 4 years ago
parent
commit
03fdb03082
  1. 56
      src/main/java/com/ccsens/carbasics/api/RoleController.java
  2. 12
      src/main/java/com/ccsens/carbasics/service/ExportService.java
  3. 18
      src/main/java/com/ccsens/carbasics/service/IRoleCarService.java
  4. 69
      src/main/java/com/ccsens/carbasics/service/RoleCarService.java
  5. 4
      src/main/java/com/ccsens/carbasics/util/Constant.java

56
src/main/java/com/ccsens/carbasics/api/RoleController.java

@ -2,6 +2,7 @@ package com.ccsens.carbasics.api;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.ccsens.carbasics.service.IRoleCarService;
import com.ccsens.cloudutil.annotation.MustLogin; import com.ccsens.cloudutil.annotation.MustLogin;
import com.ccsens.common.bean.dto.CRoleDto; import com.ccsens.common.bean.dto.CRoleDto;
import com.ccsens.common.bean.vo.CRoleVo; import com.ccsens.common.bean.vo.CRoleVo;
@ -32,38 +33,41 @@ import java.util.List;
public class RoleController { public class RoleController {
@Resource @Resource
private IProRoleService roleService; private IProRoleService roleService;
@Resource
private IRoleCarService roleCarService;
@MustLogin @MustLogin
@ApiOperation(value = "根据项目id查找角色", notes = "") @ApiOperation(value = "根据项目id查找角色", notes = "")
@RequestMapping(value = "/show", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) @RequestMapping(value = "/show", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<CRoleVo.QueryRole> queryByProjectId(@ApiParam @Validated @RequestBody QueryDto<CRoleDto.QueryRoleById> params) { public JsonResponse<CRoleVo.QueryRole> queryByProjectId(@ApiParam @Validated @RequestBody QueryDto<CRoleDto.QueryRoleById> params) {
params.getParam().setNum(0); params.getParam().setNum(0);
CRoleVo.QueryRole queryRole = roleService.queryShowRole(params.getParam(), params.getUserId()); // CRoleVo.QueryRole queryRole = roleService.queryShowRole(params.getParam(), params.getUserId());
List<CRoleVo.RoleInfo> r1 = new ArrayList<>(); CRoleVo.QueryRole queryRole = roleCarService.queryShowRoleCar(params.getParam(), params.getUserId());
List<CRoleVo.RoleInfo> r2 = new ArrayList<>(); // List<CRoleVo.RoleInfo> r1 = new ArrayList<>();
//处理角色,只查看自己所属的角色 // List<CRoleVo.RoleInfo> r2 = new ArrayList<>();
if(ObjectUtil.isNotNull(queryRole)){ // //处理角色,只查看自己所属的角色
if(CollectionUtil.isNotEmpty(queryRole.getVisibleList())){ // if(ObjectUtil.isNotNull(queryRole)){
queryRole.getVisibleList().forEach(roleInfo -> { // if(CollectionUtil.isNotEmpty(queryRole.getVisibleList())){
if(roleInfo.getMine() == 1){ // queryRole.getVisibleList().forEach(roleInfo -> {
r1.add(roleInfo); // if(roleInfo.getMine() == 1){
}else { // r1.add(roleInfo);
r2.add(roleInfo); // }else {
} // r2.add(roleInfo);
}); // }
} // });
if(CollectionUtil.isNotEmpty(queryRole.getInvisibleList())){ // }
queryRole.getInvisibleList().forEach(roleInfo -> { // if(CollectionUtil.isNotEmpty(queryRole.getInvisibleList())){
if(roleInfo.getMine() == 1){ // queryRole.getInvisibleList().forEach(roleInfo -> {
r1.add(roleInfo); // if(roleInfo.getMine() == 1){
}else { // r1.add(roleInfo);
r2.add(roleInfo); // }else {
} // r2.add(roleInfo);
}); // }
} // });
} // }
queryRole.setVisibleList(r1); // }
queryRole.setInvisibleList(r2); // queryRole.setVisibleList(r1);
// queryRole.setInvisibleList(r2);
return JsonResponse.newInstance().ok(queryRole); return JsonResponse.newInstance().ok(queryRole);
} }

12
src/main/java/com/ccsens/carbasics/service/ExportService.java

@ -50,9 +50,15 @@ public class ExportService implements IExportService{
//基本信息查询患者年龄 //基本信息查询患者年龄
FirstAid firstAid = firstAidDao.selectByPrimaryKey(param.getFirstAidId()); FirstAid firstAid = firstAidDao.selectByPrimaryKey(param.getFirstAidId());
if (ObjectUtil.isNotNull(firstAid)) { if (ObjectUtil.isNotNull(firstAid)) {
textMap.put("age",String.valueOf(firstAid.getAge())); if (ObjectUtil.isNotNull(firstAid.getAge())) {
textMap.put("CJBL-NAME",firstAid.getName()); textMap.put("age",String.valueOf(firstAid.getAge()));
textMap.put("CJBL-SEX",firstAid.getGender()==1?"男":"女"); }
if (StrUtil.isNotBlank(firstAid.getName())) {
textMap.put("CJBL-NAME",firstAid.getName());
}
if (ObjectUtil.isNotNull(firstAid.getGender())) {
textMap.put("CJBL-SEX",firstAid.getGender()==1?"男":"女");
}
} }
//当前时间 //当前时间
// long currentTime = System.currentTimeMillis(); // long currentTime = System.currentTimeMillis();

18
src/main/java/com/ccsens/carbasics/service/IRoleCarService.java

@ -0,0 +1,18 @@
package com.ccsens.carbasics.service;
import com.ccsens.common.bean.dto.CRoleDto;
import com.ccsens.common.bean.vo.CRoleVo;
/**
* @author AUSU
*/
public interface IRoleCarService {
/**
* 查询用户角色列表
* @param param 项目id
* @param userId 用户id
* @return 角色展示列表
*/
CRoleVo.QueryRole queryShowRoleCar(CRoleDto.QueryRoleById param, Long userId);
}

69
src/main/java/com/ccsens/carbasics/service/RoleCarService.java

@ -0,0 +1,69 @@
package com.ccsens.carbasics.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.ccsens.carbasics.util.Constant;
import com.ccsens.common.bean.dto.CRoleDto;
import com.ccsens.common.bean.po.ProRole;
import com.ccsens.common.bean.vo.CRoleVo;
import com.ccsens.common.persist.dao.ProRoleDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* @author AUSU
*/
@Slf4j
@Service
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class RoleCarService implements IRoleCarService {
@Resource
private ProRoleDao proRoleDao;
@Override
public CRoleVo.QueryRole queryShowRoleCar(CRoleDto.QueryRoleById param, Long userId) {
//返回的对象
CRoleVo.QueryRole queryRole = new CRoleVo.QueryRole();
List<CRoleVo.RoleInfo> visibleList = new ArrayList<>();
List<CRoleVo.RoleInfo> invisibleList = new ArrayList<>();
//查询当前用户在项目下的角色,没有则算作关注者
List<ProRole> userRoleList = proRoleDao.queryRoleByUserId(param.getProjectId(),userId);
//查询平车角色
CRoleVo.RoleInfo carRole = proRoleDao.queryByName(Constant.CAR_ROLE_NAME, param.getProjectId());
if (CollectionUtil.isNotEmpty(userRoleList)) {
if (1 < userRoleList.size()) {
userRoleList.forEach(userRole -> {
if (CollectionUtil.isEmpty(visibleList)) {
CRoleVo.RoleInfo userRoleInfo = new CRoleVo.RoleInfo();
BeanUtil.copyProperties(userRole,userRoleInfo);
visibleList.add(userRoleInfo);
}else {
CRoleVo.RoleInfo userRoleInfo = new CRoleVo.RoleInfo();
BeanUtil.copyProperties(userRole,userRoleInfo);
invisibleList.add(userRoleInfo);
}
});
}else {
CRoleVo.RoleInfo userRoleInfo = new CRoleVo.RoleInfo();
BeanUtil.copyProperties(userRoleList.get(0),userRoleInfo);
visibleList.add(userRoleInfo);
}
}
if (ObjectUtil.isNotNull(carRole)) {
visibleList.add(carRole);
}
queryRole.setVisibleList(visibleList);
queryRole.setInvisibleList(invisibleList);
//查询平车角色
return queryRole;
}
}

4
src/main/java/com/ccsens/carbasics/util/Constant.java

@ -25,6 +25,10 @@ public class Constant {
public final static String QCP_NOTIFY_STEP = "notify_step"; public final static String QCP_NOTIFY_STEP = "notify_step";
} }
/**平车角色名*/
public static final String CAR_ROLE_NAME = "平车";
public static final class TimeCheck{ public static final class TimeCheck{
public static final Map<String, Map<String, TimeCheckItem>> compareItems = new HashMap<>(); public static final Map<String, Map<String, TimeCheckItem>> compareItems = new HashMap<>();
static { static {

Loading…
Cancel
Save