@ -22,10 +22,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.constants.ImportTaskConstants ;
import com.epmet.dao.IcEpidemicSpecialAttentionDao ;
import com.epmet.dto.IcEpidemicSpecialAttentionDTO ;
import com.epmet.dto.form.CancelAttentionPackageFormDTO ;
import com.epmet.dto.form.ImportTaskCommonFormDTO ;
import com.epmet.dto.form.VaccinationAddFormDTO ;
import com.epmet.dto.form.VaccinationListFormDTO ;
import com.epmet.dto.form.* ;
import com.epmet.dto.result.UploadImgResultDTO ;
import com.epmet.dto.result.VaccinationListResultDTO ;
import com.epmet.entity.IcEpidemicSpecialAttentionEntity ;
@ -35,6 +32,7 @@ import com.epmet.excel.error.EpidemicSpecialAttentionErrorModel;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient ;
import com.epmet.feign.OssFeignClient ;
import com.epmet.service.IcEpidemicSpecialAttentionService ;
import com.epmet.service.IcNoticeService ;
import com.github.pagehelper.PageHelper ;
import com.github.pagehelper.PageInfo ;
import lombok.extern.slf4j.Slf4j ;
@ -71,6 +69,8 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient ;
@Autowired
private OssFeignClient ossFeignClient ;
@Autowired
private IcNoticeService noticeService ;
@Override
public PageData < IcEpidemicSpecialAttentionDTO > page ( Map < String , Object > params ) {
@ -207,7 +207,19 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi
e . setCustomerId ( formDTO . getCustomerId ( ) ) ;
} ) ;
insertBatch ( entities ) ;
//TODO 发送通知
//新增通知表信息
List < IcEpidemicSpecialAttentionDTO > needSedNotice = formDTO . getList ( ) . stream ( ) . filter ( l - > CollectionUtils . isNotEmpty ( l . getChannel ( ) ) ) . collect ( Collectors . toList ( ) ) ;
if ( CollectionUtils . isNotEmpty ( needSedNotice ) ) {
SendNoticeFormDTO dto = new SendNoticeFormDTO ( ) ;
List < SendNoticeFormDTO . UserListBean > userListBeans = ConvertUtils . sourceToTarget ( needSedNotice , SendNoticeFormDTO . UserListBean . class ) ;
dto . setCustomerId ( formDTO . getCustomerId ( ) ) ;
dto . setUserList ( userListBeans ) ;
dto . setChannel ( needSedNotice . get ( NumConstant . ZERO ) . getChannel ( ) ) ;
dto . setOrigin ( needSedNotice . get ( NumConstant . ZERO ) . getAttentionType ( ) . toString ( ) ) ;
dto . setContent ( needSedNotice . get ( NumConstant . ZERO ) . getContent ( ) ) ;
dto . setStaffId ( formDTO . getUserId ( ) ) ;
noticeService . sendNotice ( dto ) ;
}
}
/ * *
@ -220,7 +232,7 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi
* /
@Override
@Transactional ( rollbackFor = Exception . class )
public void vaccinationUpdate ( IcEpidemicSpecialAttentionDTO formDTO ) {
public void vaccinationUpdate ( IcEpidemicSpecialAttentionDTO formDTO , TokenDto tokenDto ) {
LambdaQueryWrapper < IcEpidemicSpecialAttentionEntity > w = new LambdaQueryWrapper < > ( ) ;
IcEpidemicSpecialAttentionEntity e = new IcEpidemicSpecialAttentionEntity ( ) ;
w . eq ( IcEpidemicSpecialAttentionEntity : : getIdCard , formDTO . getIdCard ( ) )
@ -229,7 +241,17 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi
e . setReason ( formDTO . getReason ( ) ) ;
e . setRemark ( formDTO . getRemark ( ) ) ;
update ( e , w ) ;
//TODO 通知
if ( CollectionUtils . isNotEmpty ( formDTO . getChannel ( ) ) ) {
SendNoticeFormDTO dto = new SendNoticeFormDTO ( ) ;
SendNoticeFormDTO . UserListBean userListBean = ConvertUtils . sourceToTarget ( formDTO , SendNoticeFormDTO . UserListBean . class ) ;
dto . setCustomerId ( tokenDto . getCustomerId ( ) ) ;
dto . setUserList ( Arrays . asList ( userListBean ) ) ;
dto . setChannel ( formDTO . getChannel ( ) ) ;
dto . setOrigin ( formDTO . getAttentionType ( ) . toString ( ) ) ;
dto . setContent ( formDTO . getContent ( ) ) ;
dto . setStaffId ( tokenDto . getUserId ( ) ) ;
noticeService . sendNotice ( dto ) ;
}
}
/ * *
@ -277,7 +299,7 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi
for ( int i = 0 ; i < list . size ( ) ; i + + ) {
list . get ( i ) . setNum ( i + 1 ) ;
list . get ( i ) . setAttentionType ( attentionType ) ;
list . get ( i ) . setChannel ( getChannel ( list . get ( i ) . getChannelString ( ) ) ) ;
// list.get(i).setChannel(getChannel(list.get(i).getChannelString()));
if ( StringUtils . isBlank ( list . get ( i ) . getName ( ) ) & & ! list . get ( i ) . getAddStatus ( ) ) {
errorInfo . add ( getErrorInfo ( list . get ( i ) , "姓名不能为空" , i + 1 ) ) ;
list . get ( i ) . setAddStatus ( true ) ;
@ -294,26 +316,28 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi
continue ;
}
}
Map < String , Long > groupByIdCard = list . stream ( ) . collect ( Collectors . groupingBy ( ImportEpidemicSpecialAttention : : getIdCard , Collectors . counting ( ) ) ) ;
groupByIdCard . forEach ( ( idCard , count ) - > {
if ( Integer . valueOf ( count . toString ( ) ) . compareTo ( 1 ) ! = 0 ) {
for ( ImportEpidemicSpecialAttention i : list ) {
if ( idCard . equals ( i . getIdCard ( ) ) & & ! i . getAddStatus ( ) ) {
errorInfo . add ( getErrorInfo ( i , "数据重复" , i . getNum ( ) ) ) ;
i . setAddStatus ( true ) ;
if ( list . size ( ) > errorInfo . size ( ) ) {
Map < String , Long > groupByIdCard = list . stream ( ) . collect ( Collectors . groupingBy ( ImportEpidemicSpecialAttention : : getIdCard , Collectors . counting ( ) ) ) ;
groupByIdCard . forEach ( ( idCard , count ) - > {
if ( Integer . valueOf ( count . toString ( ) ) . compareTo ( 1 ) ! = 0 ) {
for ( ImportEpidemicSpecialAttention i : list ) {
if ( idCard . equals ( i . getIdCard ( ) ) & & ! i . getAddStatus ( ) ) {
errorInfo . add ( getErrorInfo ( i , "数据重复" , i . getNum ( ) ) ) ;
i . setAddStatus ( true ) ;
}
}
}
}
} ) ;
List < String > idCards = list . stream ( ) . map ( m - > m . getIdCard ( ) ) . collect ( Collectors . toList ( ) ) ;
List < String > existList = baseDao . getExistList ( attentionType , idCards ) ;
if ( CollectionUtils . isNotEmpty ( existList ) ) {
for ( String s : existList ) {
for ( int i = NumConstant . ZERO ; i < list . size ( ) ; i + + ) {
if ( s . equals ( list . get ( i ) . getIdCard ( ) ) & & ! list . get ( i ) . getAddStatus ( ) ) {
errorInfo . add ( getErrorInfo ( list . get ( i ) , "数据已存在" , list . get ( i ) . getNum ( ) ) ) ;
list . get ( i ) . setAddStatus ( true ) ;
continue ;
} ) ;
List < String > idCards = list . stream ( ) . map ( m - > m . getIdCard ( ) ) . collect ( Collectors . toList ( ) ) ;
List < String > existList = baseDao . getExistList ( attentionType , idCards ) ;
if ( CollectionUtils . isNotEmpty ( existList ) ) {
for ( String s : existList ) {
for ( int i = NumConstant . ZERO ; i < list . size ( ) ; i + + ) {
if ( s . equals ( list . get ( i ) . getIdCard ( ) ) & & ! list . get ( i ) . getAddStatus ( ) ) {
errorInfo . add ( getErrorInfo ( list . get ( i ) , "数据已存在" , list . get ( i ) . getNum ( ) ) ) ;
list . get ( i ) . setAddStatus ( true ) ;
continue ;
}
}
}
}
@ -330,6 +354,19 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi
e . setCustomerId ( tokenDto . getCustomerId ( ) ) ;
} ) ;
insertBatch ( entities ) ;
// send msg 产品说导入不用发通知
/ * List < ImportEpidemicSpecialAttention > needSendList = needInsert . stream ( ) . filter ( l - > CollectionUtils . isNotEmpty ( l . getChannel ( ) ) ) . collect ( Collectors . toList ( ) ) ;
if ( CollectionUtils . isNotEmpty ( needSendList ) ) {
SendNoticeFormDTO dto = new SendNoticeFormDTO ( ) ;
List < SendNoticeFormDTO . UserListBean > userListBeans = ConvertUtils . sourceToTarget ( needSendList , SendNoticeFormDTO . UserListBean . class ) ;
dto . setCustomerId ( tokenDto . getCustomerId ( ) ) ;
dto . setUserList ( userListBeans ) ;
dto . setChannel ( needSendList . get ( NumConstant . ZERO ) . getChannel ( ) ) ;
dto . setOrigin ( needSendList . get ( NumConstant . ZERO ) . getAttentionType ( ) . toString ( ) ) ;
dto . setContent ( needSendList . get ( NumConstant . ZERO ) . getContent ( ) ) ;
dto . setStaffId ( tokenDto . getUserId ( ) ) ;
noticeService . sendNotice ( dto ) ;
} * /
}
if ( CollectionUtils . isNotEmpty ( errorInfo ) ) {
String url = importOssUpload ( errorInfo , EpidemicSpecialAttentionErrorModel . class ) ;
@ -399,8 +436,8 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi
if ( CollectionUtils . isEmpty ( idCardSet ) ) {
return new ArrayList < > ( ) ;
}
//关注类型,核酸检测:2,疫苗接种:1
return baseDao . getIdCardList ( customerId , idCardSet , NumConstant . TW O) ;
//关注类型,核酸检测:2,疫苗接种:1,行程上报:0
return baseDao . getIdCardList ( customerId , idCardSet , NumConstant . ZER O) ;
}
/ * *