|
|
@ -25,6 +25,7 @@ import com.epmet.service.IcNoticeService; |
|
|
|
import com.epmet.service.IcTripReportRecordService; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
@ -41,6 +42,7 @@ import java.util.stream.Collectors; |
|
|
|
* @author generator generator@elink-cn.com |
|
|
|
* @since v1.0.0 2022-03-25 |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
@Service |
|
|
|
public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportRecordDao, IcTripReportRecordEntity> implements IcTripReportRecordService { |
|
|
|
@Autowired |
|
|
@ -108,12 +110,6 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR |
|
|
|
return wrapper; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public IcTripReportRecordDTO get(String id) { |
|
|
|
IcTripReportRecordEntity entity = baseDao.selectById(id); |
|
|
|
return ConvertUtils.sourceToTarget(entity, IcTripReportRecordDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* pc: 行程上报-新增 |
|
|
|
* @param formDTO |
|
|
@ -122,7 +118,7 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public String save(IcTripReportFormDTO formDTO) { |
|
|
|
//如果是单个录入的,默认数据属于当前用户所属组织id
|
|
|
|
if(IcResiUserConstant.USER_TYPE_OTHER.equals(formDTO.getUserType())){ |
|
|
|
if(IcResiUserConstant.USER_TYPE_INPUT.equals(formDTO.getUserType())){ |
|
|
|
//获取当前登录用户所属组织id
|
|
|
|
CustomerStaffInfoCacheResult staffInfo= queryCurrentStaff(formDTO.getCustomerId(),formDTO.getCurrentStaffId()); |
|
|
|
formDTO.setAgencyId(staffInfo.getAgencyId()); |
|
|
@ -141,24 +137,32 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR |
|
|
|
} |
|
|
|
//3.新增通知表信息
|
|
|
|
if (formDTO.getChannel().size() > NumConstant.ZERO && StringUtils.isNotBlank(formDTO.getContent())) { |
|
|
|
SendNoticeFormDTO dto = new SendNoticeFormDTO(); |
|
|
|
List<SendNoticeFormDTO.UserListBean> userList = new ArrayList<>(); |
|
|
|
//注意这里的userId是指的pc平台的居民
|
|
|
|
userList.add(ConvertUtils.sourceToTarget(formDTO, SendNoticeFormDTO.UserListBean.class)); |
|
|
|
dto.setCustomerId(formDTO.getCustomerId()); |
|
|
|
dto.setUserList(userList); |
|
|
|
dto.setChannel(formDTO.getChannel()); |
|
|
|
//通知来源 0 行程上报,1 疫苗接种,2 核酸检测
|
|
|
|
dto.setOrigin(NumConstant.ZERO_STR); |
|
|
|
dto.setContent(formDTO.getContent()); |
|
|
|
dto.setOrgName(agencyInfoCache.getOrganizationName()); |
|
|
|
icNoticeService.sendNotice(dto); |
|
|
|
sendNotice(formDTO,agencyInfoCache.getOrganizationName()); |
|
|
|
} |
|
|
|
return entity.getId(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 加入核算检测关注 |
|
|
|
* 行程上报-发送通知 |
|
|
|
* @param formDTO |
|
|
|
*/ |
|
|
|
private void sendNotice(IcTripReportFormDTO formDTO,String agencyName) { |
|
|
|
SendNoticeFormDTO dto = new SendNoticeFormDTO(); |
|
|
|
List<SendNoticeFormDTO.UserListBean> userList = new ArrayList<>(); |
|
|
|
//注意这里的userId是指的pc平台的居民
|
|
|
|
userList.add(ConvertUtils.sourceToTarget(formDTO, SendNoticeFormDTO.UserListBean.class)); |
|
|
|
dto.setCustomerId(formDTO.getCustomerId()); |
|
|
|
dto.setUserList(userList); |
|
|
|
dto.setChannel(formDTO.getChannel()); |
|
|
|
//通知来源 0 行程上报,1 疫苗接种,2 核酸检测
|
|
|
|
dto.setOrigin(NumConstant.ZERO_STR); |
|
|
|
dto.setContent(formDTO.getContent()); |
|
|
|
dto.setOrgName(agencyName); |
|
|
|
icNoticeService.sendNotice(dto); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 行程上报-加入核算检测关注 |
|
|
|
* @param formDTO |
|
|
|
*/ |
|
|
|
private void vaccinationAdd(IcTripReportFormDTO formDTO) { |
|
|
@ -181,16 +185,42 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void update(IcTripReportRecordDTO dto) { |
|
|
|
IcTripReportRecordEntity entity = ConvertUtils.sourceToTarget(dto, IcTripReportRecordEntity.class); |
|
|
|
public String update(IcTripReportFormDTO formDTO) { |
|
|
|
IcTripReportRecordEntity origin=baseDao.selectById(formDTO.getId()); |
|
|
|
if(null==origin){ |
|
|
|
log.warn("ic_trip_report_record记录不存在id:",formDTO.getId()); |
|
|
|
return formDTO.getId(); |
|
|
|
} |
|
|
|
//如果是单个录入的,默认数据属于当前用户所属组织id
|
|
|
|
if(IcResiUserConstant.USER_TYPE_INPUT.equals(formDTO.getUserType())){ |
|
|
|
//获取当前登录用户所属组织id
|
|
|
|
CustomerStaffInfoCacheResult staffInfo= queryCurrentStaff(formDTO.getCustomerId(),formDTO.getCurrentStaffId()); |
|
|
|
formDTO.setAgencyId(staffInfo.getAgencyId()); |
|
|
|
} |
|
|
|
IcTripReportRecordEntity entity = ConvertUtils.sourceToTarget(formDTO, IcTripReportRecordEntity.class); |
|
|
|
AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(entity.getAgencyId()); |
|
|
|
if (null == agencyInfoCache) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询组织信息异常", EpmetErrorCode.SERVER_ERROR.getMsg()); |
|
|
|
} |
|
|
|
entity.setPids(agencyInfoCache.getPids()); |
|
|
|
//1.修改行程记录表
|
|
|
|
updateById(entity); |
|
|
|
if(formDTO.getHeSuanCheck()){ |
|
|
|
// 2.加入核算检测关注名单,如果之前关注了,会在通知的service层移除
|
|
|
|
vaccinationAdd(formDTO); |
|
|
|
} |
|
|
|
//3.新增通知表信息
|
|
|
|
if (formDTO.getChannel().size() > NumConstant.ZERO && StringUtils.isNotBlank(formDTO.getContent())) { |
|
|
|
sendNotice(formDTO,agencyInfoCache.getOrganizationName()); |
|
|
|
} |
|
|
|
return entity.getId(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void delete(String[] ids) { |
|
|
|
// 逻辑删除(@TableLogic 注解)
|
|
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
|
public void delete(String customerId, String userId, String[] ids) { |
|
|
|
CustomerStaffInfoCacheResult staffInfo=queryCurrentStaff(customerId,userId); |
|
|
|
baseDao.batchDel(userId,staffInfo.getAgencyId(),ids); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|