|
|
@ -26,26 +26,20 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.dao.CustomerGridDao; |
|
|
|
import com.epmet.dao.PlacePatrolTeamDao; |
|
|
|
import com.epmet.dao.IcPlacePatrolTeamDao; |
|
|
|
import com.epmet.dto.CustomerGridDTO; |
|
|
|
import com.epmet.dto.PlacePatrolTeamStaffDTO; |
|
|
|
import com.epmet.dto.form.AddPlacePatrolTeamFormDTO; |
|
|
|
import com.epmet.dto.form.EditPlacePatrolTeamFormDTO; |
|
|
|
import com.epmet.dto.form.GetListPlaceOrgFormDTO; |
|
|
|
import com.epmet.dto.form.GetListPlacePatrolTeamFormDTO; |
|
|
|
import com.epmet.dto.result.GetListPlaceOrgResultDTO; |
|
|
|
import com.epmet.dto.result.GetListPlacePatrolTeamResultDTO; |
|
|
|
import com.epmet.dto.result.PlaceOrgDetailResultDTO; |
|
|
|
import com.epmet.dto.result.PlacePatrolTeamDetailResultDTO; |
|
|
|
import com.epmet.entity.PlaceOrgEntity; |
|
|
|
import com.epmet.entity.PlacePatrolTeamEntity; |
|
|
|
import com.epmet.entity.PlacePatrolTeamStaffEntity; |
|
|
|
import com.epmet.entity.IcPlacePatrolTeamEntity; |
|
|
|
import com.epmet.entity.IcPlacePatrolTeamStaffEntity; |
|
|
|
import com.epmet.feign.EpmetAdminOpenFeignClient; |
|
|
|
import com.epmet.service.PlacePatrolTeamService; |
|
|
|
import com.epmet.service.PlacePatrolTeamStaffService; |
|
|
|
import com.epmet.service.IcPlacePatrolTeamService; |
|
|
|
import com.epmet.service.IcPlacePatrolTeamStaffService; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import org.apache.ibatis.annotations.Param; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -64,12 +58,12 @@ import java.util.stream.Collectors; |
|
|
|
* @since v1.0.0 2021-11-18 |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
public class PlacePatrolTeamServiceImpl extends BaseServiceImpl<PlacePatrolTeamDao, PlacePatrolTeamEntity> implements PlacePatrolTeamService { |
|
|
|
private static final Logger log = LoggerFactory.getLogger(PlacePatrolTeamServiceImpl.class); |
|
|
|
public class IcPlacePatrolTeamServiceImpl extends BaseServiceImpl<IcPlacePatrolTeamDao, IcPlacePatrolTeamEntity> implements IcPlacePatrolTeamService { |
|
|
|
private static final Logger log = LoggerFactory.getLogger(IcPlacePatrolTeamServiceImpl.class); |
|
|
|
@Autowired |
|
|
|
private EpmetAdminOpenFeignClient epmetAdminOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private PlacePatrolTeamStaffService placePatrolTeamStaffService; |
|
|
|
private IcPlacePatrolTeamStaffService placePatrolTeamStaffService; |
|
|
|
@Autowired |
|
|
|
private CustomerGridDao customerGridDao; |
|
|
|
|
|
|
@ -81,15 +75,15 @@ public class PlacePatrolTeamServiceImpl extends BaseServiceImpl<PlacePatrolTeamD |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void add(AddPlacePatrolTeamFormDTO formDTO) { |
|
|
|
//1.分队主表新增数据
|
|
|
|
PlacePatrolTeamEntity entity = ConvertUtils.sourceToTarget(formDTO, PlacePatrolTeamEntity.class); |
|
|
|
IcPlacePatrolTeamEntity entity = ConvertUtils.sourceToTarget(formDTO, IcPlacePatrolTeamEntity.class); |
|
|
|
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); |
|
|
|
entity.setAgencyId(staffInfoCache.getAgencyId()); |
|
|
|
entity.setPids(staffInfoCache.getAgencyPIds()); |
|
|
|
insert(entity); |
|
|
|
//2.分队成员表新增数据
|
|
|
|
List<PlacePatrolTeamStaffEntity> entityList = new ArrayList<>(); |
|
|
|
List<IcPlacePatrolTeamStaffEntity> entityList = new ArrayList<>(); |
|
|
|
formDTO.getMemberList().forEach(m -> { |
|
|
|
PlacePatrolTeamStaffEntity entity1 = new PlacePatrolTeamStaffEntity(); |
|
|
|
IcPlacePatrolTeamStaffEntity entity1 = new IcPlacePatrolTeamStaffEntity(); |
|
|
|
entity1.setCustomerId(formDTO.getCustomerId()); |
|
|
|
entity1.setPlacePatrolTeamId(entity.getId()); |
|
|
|
entity1.setName(m.getName()); |
|
|
@ -108,16 +102,16 @@ public class PlacePatrolTeamServiceImpl extends BaseServiceImpl<PlacePatrolTeamD |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void edit(EditPlacePatrolTeamFormDTO formDTO) { |
|
|
|
//1.修改分队主表信息
|
|
|
|
PlacePatrolTeamEntity entity = baseDao.selectById(formDTO.getTeamId()); |
|
|
|
IcPlacePatrolTeamEntity entity = baseDao.selectById(formDTO.getTeamId()); |
|
|
|
if (null == entity) { |
|
|
|
throw new RenException(String.format("修改九小场所下巡查分队人员信息失败,分队信息不存在,分队Id->%s", formDTO.getTeamId())); |
|
|
|
} |
|
|
|
entity = ConvertUtils.sourceToTarget(formDTO, PlacePatrolTeamEntity.class); |
|
|
|
entity = ConvertUtils.sourceToTarget(formDTO, IcPlacePatrolTeamEntity.class); |
|
|
|
baseDao.updateById(entity); |
|
|
|
//2.全删全增分队成员字表数据
|
|
|
|
List<PlacePatrolTeamStaffEntity> entityList = new ArrayList<>(); |
|
|
|
List<IcPlacePatrolTeamStaffEntity> entityList = new ArrayList<>(); |
|
|
|
for (EditPlacePatrolTeamFormDTO.Member m : formDTO.getMemberList()) { |
|
|
|
PlacePatrolTeamStaffEntity entity1 = new PlacePatrolTeamStaffEntity(); |
|
|
|
IcPlacePatrolTeamStaffEntity entity1 = new IcPlacePatrolTeamStaffEntity(); |
|
|
|
entity1.setCustomerId(entity.getCustomerId()); |
|
|
|
entity1.setPlacePatrolTeamId(entity.getId()); |
|
|
|
entity1.setName(m.getName()); |