@ -29,6 +29,7 @@ import com.elink.esua.epdc.commons.tools.security.user.SecurityUser;
import com.elink.esua.epdc.commons.tools.security.user.UserDetail ;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils ;
import com.elink.esua.epdc.commons.tools.utils.Result ;
import com.elink.esua.epdc.dao.ModuleCategoryDao ;
import com.elink.esua.epdc.dao.NoticeDao ;
import com.elink.esua.epdc.dto.NoticeDTO ;
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO ;
@ -38,6 +39,7 @@ import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeListFormDTO;
import com.elink.esua.epdc.dto.epdc.form.v2.EpdcNoticeListV2FormDTO ;
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeDetailResultDTO ;
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeListResultDTO ;
import com.elink.esua.epdc.entity.ModuleCategoryEntity ;
import com.elink.esua.epdc.entity.NoticeEntity ;
import com.elink.esua.epdc.feign.AdminFeignClient ;
import com.elink.esua.epdc.redis.NoticeRedis ;
@ -74,6 +76,9 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity>
@Autowired
private ModuleCategoryService moduleCategoryService ;
@Autowired
private ModuleCategoryDao moduleCategoryDao ;
@Override
public PageData < NoticeDTO > page ( Map < String , Object > params ) {
String noticeTitle = ( String ) params . get ( "noticeTitle" ) ;
@ -224,6 +229,36 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity>
this . noticeDepartmentService . save ( entity . getId ( ) , noticeGridList ) ;
}
/ * *
* @Description 更新通知模块的更新时间
* @Author songyunpeng
* @Date 2020 / 11 / 18
* @Param [ noticeCategory ]
* @return void
* * /
private void updateModuleCategoryUpdateTime ( String noticeId ) {
try {
NoticeEntity noticeEntity = baseDao . selectById ( noticeId ) ;
Map < String , Object > param = new HashMap < > ( ) ;
param . put ( "CATEGORY_CODE" , noticeEntity . getNoticeCategory ( ) ) ;
List < ModuleCategoryEntity > moduleCategoryEntities = moduleCategoryDao . selectByMap ( param ) ;
if ( moduleCategoryEntities ! = null & & moduleCategoryEntities . size ( ) > 0 ) {
ModuleCategoryEntity moduleCategoryEntity = moduleCategoryEntities . get ( 0 ) ;
//获取第二层模块
String [ ] pIds = moduleCategoryEntity . getPids ( ) . split ( "," ) ;
//长度大于等于2代表处于大于或等于三级模块,此时只更新二级模块顺序
if ( pIds . length > = 2 ) {
ModuleCategoryEntity secModuleCategory = moduleCategoryDao . selectById ( pIds [ 1 ] ) ;
if ( secModuleCategory ! = null ) {
secModuleCategory . setSort ( 0 ) ;
moduleCategoryDao . updateById ( secModuleCategory ) ;
}
}
}
} catch ( Exception e ) {
e . printStackTrace ( ) ;
}
}
@Override
@Transactional ( rollbackFor = Exception . class )
@ -242,6 +277,8 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity>
entity . setNoticeReleaseState ( YesOrNoEnum . YES . value ( ) ) ;
entity . setReleaseTime ( new Date ( ) ) ;
this . updateById ( entity ) ;
//更新通知模块的更新时间
updateModuleCategoryUpdateTime ( noticeId ) ;
}
@Override