|
|
@@ -6,6 +6,7 @@ import com.usoftchina.smartschool.context.BaseContextHolder;
|
|
|
import com.usoftchina.smartschool.exception.BizException;
|
|
|
import com.usoftchina.smartschool.page.PageRequest;
|
|
|
import com.usoftchina.smartschool.school.business.service.NoticeService;
|
|
|
+import com.usoftchina.smartschool.school.common.service.MessageLogService;
|
|
|
import com.usoftchina.smartschool.school.dto.BatchDealBaseDTO;
|
|
|
import com.usoftchina.smartschool.school.dto.DocBaseDTO;
|
|
|
import com.usoftchina.smartschool.school.dto.ListReqDTO;
|
|
|
@@ -14,10 +15,7 @@ import com.usoftchina.smartschool.school.exception.BizExceptionCode;
|
|
|
import com.usoftchina.smartschool.school.mapper.NoticeMapper;
|
|
|
import com.usoftchina.smartschool.school.mapper.SchoolTemplateMapper;
|
|
|
import com.usoftchina.smartschool.school.mapper.SysSchoolMapper;
|
|
|
-import com.usoftchina.smartschool.school.po.Notify;
|
|
|
-import com.usoftchina.smartschool.school.po.SchoolNoticer;
|
|
|
-import com.usoftchina.smartschool.school.po.SchoolTemplate;
|
|
|
-import com.usoftchina.smartschool.school.po.SysSchool;
|
|
|
+import com.usoftchina.smartschool.school.po.*;
|
|
|
import com.usoftchina.smartschool.utils.DateUtils;
|
|
|
import com.usoftchina.smartschool.utils.StringUtils;
|
|
|
import com.usoftchina.smartschool.wechat.api.WechatApi;
|
|
|
@@ -50,6 +48,12 @@ public class NoticeServiceImpl implements NoticeService{
|
|
|
@Autowired
|
|
|
private SchoolTemplateMapper schoolTemplateMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private MessageLogService messageLogService;
|
|
|
+
|
|
|
+ private static final String CODE = "Notice";
|
|
|
+ private static final String NAME = "学校通知";
|
|
|
+
|
|
|
@Value("${smartschool.domain.wechat}")
|
|
|
private String baseWechatUrl;
|
|
|
|
|
|
@@ -61,6 +65,7 @@ public class NoticeServiceImpl implements NoticeService{
|
|
|
}
|
|
|
Long school_id = BaseContextHolder.getSchoolId();
|
|
|
formdata.setSchool_id(school_id);
|
|
|
+ DocBaseDTO docBaseDTO = null;
|
|
|
//新增
|
|
|
if (StringUtils.isEmpty(formdata.getNotify_id()) || "0".equals(formdata.getNotify_id().toString())) {
|
|
|
formdata.setNotify_status(2);
|
|
|
@@ -68,15 +73,18 @@ public class NoticeServiceImpl implements NoticeService{
|
|
|
Calendar calendar= Calendar.getInstance();
|
|
|
formdata.setCreate_date(calendar.getTime());
|
|
|
noticeMapper.insertSelective(formdata);
|
|
|
-
|
|
|
+ docBaseDTO = new DocBaseDTO(formdata.getNotify_id(), CODE, NAME);
|
|
|
+ messageLogService.save(docBaseDTO);
|
|
|
} else {
|
|
|
//更新
|
|
|
noticeMapper.updateByPrimaryKeySelective(formdata);
|
|
|
+ docBaseDTO = new DocBaseDTO(formdata.getNotify_id(), CODE, NAME);
|
|
|
+ messageLogService.update(docBaseDTO);
|
|
|
if(formdata.getNotify_status()==1){
|
|
|
publish(formdata.getNotify_id());
|
|
|
}
|
|
|
}
|
|
|
- return new DocBaseDTO(formdata.getNotify_id());
|
|
|
+ return docBaseDTO;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -111,6 +119,7 @@ public class NoticeServiceImpl implements NoticeService{
|
|
|
throw new BizException(BizExceptionCode.NOTICE_RELEASE_STATUS);
|
|
|
}
|
|
|
noticeMapper.deleteByPrimaryKey(id);
|
|
|
+ messageLogService.delete(new DocBaseDTO(id, CODE, NAME));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -175,5 +184,6 @@ public class NoticeServiceImpl implements NoticeService{
|
|
|
wechatApi.largeMessages(transferDTO);
|
|
|
}
|
|
|
noticeMapper.updateByPublish(id);
|
|
|
+ messageLogService.customizeLog(new DocBaseDTO(id, CODE, NAME), Operation.PUBLISH);
|
|
|
}
|
|
|
}
|