|
|
@ -17,11 +17,9 @@ |
|
|
|
|
|
|
|
package com.elink.esua.epdc.modules.conflict.service.impl; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.elink.esua.epdc.commons.mybatis.utils.DeptEntityUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.NumConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.exception.RenException; |
|
|
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
|
|
@ -38,10 +36,8 @@ import com.elink.esua.epdc.dto.conflict.result.ConflictMediateDetailResultDTO; |
|
|
|
import com.elink.esua.epdc.dto.conflict.result.ConflictMediateHistoryResultDTO; |
|
|
|
import com.elink.esua.epdc.modules.conflict.dao.ConflictMediateDao; |
|
|
|
import com.elink.esua.epdc.modules.conflict.entity.ConflictMediateEntity; |
|
|
|
import com.elink.esua.epdc.modules.conflict.redis.ConflictMediateRedis; |
|
|
|
import com.elink.esua.epdc.modules.conflict.service.ConflictMediateService; |
|
|
|
import com.elink.esua.epdc.modules.feign.AdminFeignClient; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
@ -59,9 +55,6 @@ import java.util.Map; |
|
|
|
@Service |
|
|
|
public class ConflictMediateServiceImpl extends BaseServiceImpl<ConflictMediateDao, ConflictMediateEntity> implements ConflictMediateService { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ConflictMediateRedis conflictMediateRedis; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private AdminFeignClient adminFeignClient; |
|
|
|
|
|
|
@ -73,31 +66,15 @@ public class ConflictMediateServiceImpl extends BaseServiceImpl<ConflictMediateD |
|
|
|
return new PageData<>(list, page.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<ConflictMediateDTO> list(Map<String, Object> params) { |
|
|
|
List<ConflictMediateEntity> entityList = baseDao.selectList(getWrapper(params)); |
|
|
|
|
|
|
|
return ConvertUtils.sourceToTarget(entityList, ConflictMediateDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<ConflictMediateDTO> export(Map<String, Object> params) { |
|
|
|
List<ConflictMediateEntity> entityList = baseDao.selectList(getWrapper(params)); |
|
|
|
List<ConflictMediateEntity> entityList = baseDao.selectListOfConflictMediate(params); |
|
|
|
for (int i = 0; i < entityList.size(); i++) { |
|
|
|
entityList.get(i).setId(i + 1 + ""); |
|
|
|
entityList.get(i).setId(String.valueOf(i + NumConstant.ONE)); |
|
|
|
} |
|
|
|
return ConvertUtils.sourceToTarget(entityList, ConflictMediateDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
private QueryWrapper<ConflictMediateEntity> getWrapper(Map<String, Object> params) { |
|
|
|
String id = (String) params.get(FieldConstant.ID_HUMP); |
|
|
|
|
|
|
|
QueryWrapper<ConflictMediateEntity> wrapper = new QueryWrapper<>(); |
|
|
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|
|
|
|
|
|
|
return wrapper; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public ConflictMediateDTO get(String id) { |
|
|
|
ConflictMediateEntity entity = baseDao.selectById(id); |
|
|
@ -134,6 +111,7 @@ public class ConflictMediateServiceImpl extends BaseServiceImpl<ConflictMediateD |
|
|
|
} |
|
|
|
ConflictMediateEntity entity = ConvertUtils.sourceToTarget(dto, ConflictMediateEntity.class); |
|
|
|
entity.setUserId(user.getId()); |
|
|
|
entity.setDeptId(user.getDeptId()); |
|
|
|
entity.setUserName(user.getRealName()); |
|
|
|
entity.setSubmitTime(DateUtils.parse(dto.getSubmitTime(), DateUtils.DATE_PATTERN)); |
|
|
|
ParentAndAllDeptDTO parentAndAllDeptDTO = getParentAndAllDeptDTO(user.getDeptId().toString()); |
|
|
@ -175,12 +153,11 @@ public class ConflictMediateServiceImpl extends BaseServiceImpl<ConflictMediateD |
|
|
|
*/ |
|
|
|
private ParentAndAllDeptDTO getParentAndAllDeptDTO(String gridId) { |
|
|
|
// 获取组织结构冗余信息
|
|
|
|
Result<ParentAndAllDeptDTO> parentAndAllDeptDTOResult = adminFeignClient.getParentAndAllDept(gridId); |
|
|
|
ParentAndAllDeptDTO parentAndAllDeptDTO = parentAndAllDeptDTOResult.getData(); |
|
|
|
Result<ParentAndAllDeptDTO> adminResult = adminFeignClient.getParentAndAllDept(gridId); |
|
|
|
|
|
|
|
if (!parentAndAllDeptDTOResult.success()) { |
|
|
|
throw new RenException(parentAndAllDeptDTOResult.getMsg()); |
|
|
|
if (!adminResult.success()) { |
|
|
|
throw new RenException(adminResult.getMsg()); |
|
|
|
} |
|
|
|
return parentAndAllDeptDTO; |
|
|
|
return adminResult.getData(); |
|
|
|
} |
|
|
|
} |