Browse Source

Merge remote-tracking branch 'origin/develop' into release_temp

master
yinzuomei 4 years ago
parent
commit
5171ede9d4
  1. 5
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/SpecialSubjectDTO.java
  2. 9
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/QuerySpecialSubFormDTO.java
  3. 15
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/WorkSpecialSubjectResultDTO.java
  4. 4
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/SpecialSubjectController.java
  5. 7
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/SpecialSubjectEntity.java
  6. 33
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/SpecialSubjectServiceImpl.java
  7. 1
      epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.6__add_del_staffid.sql
  8. 2
      epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/SpecialSubjectDao.xml

5
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/SpecialSubjectDTO.java

@ -112,4 +112,9 @@ public class SpecialSubjectDTO implements Serializable {
* 扩展属性标签颜色
*/
private String tagColor;
/**
* 删除人id
*/
private String delStaffId;
}

9
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/QuerySpecialSubFormDTO.java

@ -29,4 +29,13 @@ public class QuerySpecialSubFormDTO implements Serializable {
*/
@NotBlank(message = "pids不能为空", groups = AddUserInternalGroup.class)
private String pids;
/**
* 当前登录用户userId,
*/
private String userId;
/**
* 当前登录用户客户id
*/
private String customerId;
}

15
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/WorkSpecialSubjectResultDTO.java

@ -42,9 +42,22 @@ public class WorkSpecialSubjectResultDTO implements Serializable {
private String addOrgId;
private String orgLevel;
/**
* 创建时间
* 创建时间-前端无用
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createdTime;
/**
* 创建人-前端无用
*/
private String createdBy;
/**
* 新增此专题用户所属的组织id
* mean:当前人是谁
* -前端无用
*/
private String addUserAgencyId;
}

4
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/SpecialSubjectController.java

@ -93,7 +93,9 @@ public class SpecialSubjectController {
* @Date 2021/7/15 21:17
**/
@PostMapping("existedlist")
public Result<List<WorkSpecialSubjectResultDTO>> queryExistedList(@RequestBody QuerySpecialSubFormDTO formDTO) {
public Result<List<WorkSpecialSubjectResultDTO>> queryExistedList(@LoginUser TokenDto tokenDto, @RequestBody QuerySpecialSubFormDTO formDTO) {
formDTO.setUserId(tokenDto.getUserId());
formDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(formDTO, QuerySpecialSubFormDTO.AddUserInternalGroup.class);
return new Result<List<WorkSpecialSubjectResultDTO>>().ok(specialSubjectService.queryExistedList(formDTO));
}

7
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/SpecialSubjectEntity.java

@ -52,6 +52,7 @@ public class SpecialSubjectEntity extends BaseEpmetEntity {
/**
* 新增此专题时用户所在的组织id或者网格id
* mean:给谁添加的
*/
private String addOrgId;
@ -76,7 +77,13 @@ public class SpecialSubjectEntity extends BaseEpmetEntity {
/**
* 新增此专题用户所属的组织id
* mean:当前人是谁
*/
private String addUserAgencyId;
/**
* 删除人id
*/
private String delStaffId;
}

33
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/SpecialSubjectServiceImpl.java

@ -145,6 +145,8 @@ public class SpecialSubjectServiceImpl extends BaseServiceImpl<SpecialSubjectDao
QuerySpecialSubFormDTO querySpecialSubFormDTO=new QuerySpecialSubFormDTO();
querySpecialSubFormDTO.setOrgId(formDTO.getOrgId());
querySpecialSubFormDTO.setPids(formDTO.getPids());
querySpecialSubFormDTO.setUserId(formDTO.getAddUserId());
querySpecialSubFormDTO.setCustomerId(formDTO.getCustomerId());
List<WorkSpecialSubjectResultDTO> havedList=this.queryExistedList(querySpecialSubFormDTO);
List<String> haveTagIds=havedList.stream().map(WorkSpecialSubjectResultDTO::getTagId).distinct().collect(Collectors.toList());
haveTagIds.forEach(tagId->{
@ -156,6 +158,7 @@ public class SpecialSubjectServiceImpl extends BaseServiceImpl<SpecialSubjectDao
SpecialSubjectEntity insertEntity = ConvertUtils.sourceToTarget(formDTO, SpecialSubjectEntity.class);
StaffInfoFromDTO staffInfoFromDTO = new StaffInfoFromDTO();
staffInfoFromDTO.setStaffId(formDTO.getAddUserId());
staffInfoFromDTO.setCustomerId(formDTO.getCustomerId());
Result<MineResultDTO> result = govOrgOpenFeignClient.queryStaffProfile(staffInfoFromDTO);
if(result.success()&&null!=result.getData()){
insertEntity.setAddUserAgencyId(result.getData().getAgencyId());
@ -180,6 +183,7 @@ public class SpecialSubjectServiceImpl extends BaseServiceImpl<SpecialSubjectDao
SpecialSubjectEntity original = baseDao.selectById(formDTO.getSpecialSubjectId());
if (null != original) {
if (!original.getAddOrgId().equals(formDTO.getOrgId())) {
log.warn("当前专题id=" + original.getId() + ";是属于orgId=" + original.getAddOrgId() + ";当前用户正处在orgId=" + formDTO.getOrgId()+";所以无权删除");
throw new RenException(EpmetErrorCode.CAN_NOT_DEL_SPECIAL_PROJECT.getCode(), EpmetErrorCode.CAN_NOT_DEL_SPECIAL_PROJECT.getMsg());
}
baseDao.delSpecialSubject(formDTO.getSpecialSubjectId(), formDTO.getUserId());
@ -197,6 +201,13 @@ public class SpecialSubjectServiceImpl extends BaseServiceImpl<SpecialSubjectDao
*/
@Override
public List<WorkSpecialSubjectResultDTO> queryExistedList(QuerySpecialSubFormDTO formDTO) {
StaffInfoFromDTO staffInfoFromDTO = new StaffInfoFromDTO();
staffInfoFromDTO.setStaffId(formDTO.getUserId());
staffInfoFromDTO.setCustomerId(formDTO.getCustomerId());
Result<MineResultDTO> staffResult = govOrgOpenFeignClient.queryStaffProfile(staffInfoFromDTO);
if (!staffResult.success() && null == staffResult.getData()) {
throw new RenException("查询当前工作人员信息异常");
}
List<WorkSpecialSubjectResultDTO> resultDTOList = new ArrayList<>();
List<String> notList = new ArrayList<>();
//当前组织或者网格自己建立的
@ -207,11 +218,20 @@ public class SpecialSubjectServiceImpl extends BaseServiceImpl<SpecialSubjectDao
result.setSpecialSubjectId(dto.getId());
result.setTagId(dto.getTagId());
result.setTagName(dto.getTagName());
result.setCanDel(true);
//1、如果当前专题是给当前所在组织(or网格)添加的;
//2、当前工作人员所属的组织,与专题添加人所属的组织一致,同时满足这两个条件即可删除
if(dto.getAddUserAgencyId().equals(staffResult.getData().getAgencyId())
&& dto.getAddOrgId().equals(formDTO.getOrgId())){
result.setCanDel(true);
}else{
result.setCanDel(false);
}
result.setAddOrgId(dto.getAddOrgId());
result.setOrgLevel(dto.getOrgLevel());
result.setTagColor(dto.getTagColor());
result.setCreatedTime(dto.getCreatedTime());
result.setCreatedBy(dto.getCreatedBy());
result.setAddUserAgencyId(dto.getAddUserAgencyId());
currentOrgList.add(result);
});
if (CollectionUtils.isNotEmpty(currentOrgList)) {
@ -231,11 +251,20 @@ public class SpecialSubjectServiceImpl extends BaseServiceImpl<SpecialSubjectDao
result.setSpecialSubjectId(dto.getId());
result.setTagId(dto.getTagId());
result.setTagName(dto.getTagName());
result.setCanDel(false);
//1、如果当前专题是给当前所在组织(or网格)添加的;
//2、当前工作人员所属的组织,与专题添加人所属的组织一致,同时满足这两个条件即可删除
if (dto.getAddUserAgencyId().equals(staffResult.getData().getAgencyId())
&& dto.getAddOrgId().equals(formDTO.getOrgId())) {
result.setCanDel(true);
} else {
result.setCanDel(false);
}
result.setAddOrgId(dto.getAddOrgId());
result.setOrgLevel(dto.getOrgLevel());
result.setTagColor(dto.getTagColor());
result.setCreatedTime(dto.getCreatedTime());
result.setCreatedBy(dto.getCreatedBy());
result.setAddUserAgencyId(dto.getAddUserAgencyId());
resultDTOList.add(result);
});
}

1
epmet-module/gov-voice/gov-voice-server/src/main/resources/db/migration/V0.0.6__add_del_staffid.sql

@ -0,0 +1 @@
alter table special_subject add COLUMN DEL_STAFF_ID VARCHAR(64) COMMENT '删除人id' AFTER ADD_USER_AGENCY_ID;

2
epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/SpecialSubjectDao.xml

@ -4,7 +4,7 @@
<mapper namespace="com.epmet.dao.SpecialSubjectDao">
<update id="delSpecialSubject" parameterType="map">
update special_subject set del_flag='1',UPDATED_BY=#{userId},UPDATED_TIME=Now()
update special_subject set del_flag='1',UPDATED_BY=#{userId},UPDATED_TIME=Now(),DEL_STAFF_ID=#{userId}
where id=#{id}
</update>

Loading…
Cancel
Save