puzhibing
2023-06-01 c4a098e3f88bc5071e36b92b9e5dcceb51129957
management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TSystemBulletinController.java
@@ -3,6 +3,8 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.core.base.controller.BaseController;
import com.stylefeng.guns.core.util.DateUtil;
import com.stylefeng.guns.modular.system.controller.util.LabelReplaceUtil;
import com.stylefeng.guns.modular.system.enums.StatusEnum;
import com.stylefeng.guns.modular.system.enums.UserTypeEnum;
import com.stylefeng.guns.modular.system.model.TDriver;
import com.stylefeng.guns.modular.system.model.TSystemBulletinUser;
@@ -39,8 +41,6 @@
    @Autowired
    private ITSystemBulletinService tSystemBulletinService;
    @Autowired
    private ITDriverService tDriverService;
    @Autowired
    private ITSystemBulletinUserService tSystemBulletinUserService;
@@ -85,10 +85,11 @@
        }
        if(StringUtils.hasLength(createTime)){
            String[] split = createTime.split(" - ");
            Date startTime = DateUtil.getDate_str4(split[0]);
            Date endTime = DateUtil.getDate_str4(split[1]);
            Date startTime = DateUtil.getDate_str3(split[0]+" 00:00:00");
            Date endTime = DateUtil.getDate_str3(split[1]+" 23:59:59");
            wrapper.between("createTime",startTime,endTime);
        }
        wrapper.ne("status",3);
        return tSystemBulletinService.selectList(wrapper);
    }
@@ -108,6 +109,7 @@
    @ResponseBody
    @Transactional(rollbackFor = Exception.class)
    public Object add(TSystemBulletin tSystemBulletin) {
        tSystemBulletin.setContent(LabelReplaceUtil.replace(tSystemBulletin.getContent()));
        tSystemBulletin.setState(1);
        tSystemBulletin.setCreateTime(new Date());
        tSystemBulletin.setStatus(1);
@@ -122,6 +124,7 @@
    @ResponseBody
    @Transactional(rollbackFor = Exception.class)
    public Object addSend(TSystemBulletin tSystemBulletin) {
        tSystemBulletin.setContent(LabelReplaceUtil.replace(tSystemBulletin.getContent()));
        tSystemBulletin.setState(2);
        tSystemBulletin.setCreateTime(new Date());
        tSystemBulletin.setStatus(1);
@@ -137,6 +140,7 @@
    @ResponseBody
    @Transactional(rollbackFor = Exception.class)
    public Object editSend(TSystemBulletin tSystemBulletin) {
        tSystemBulletin.setContent(LabelReplaceUtil.replace(tSystemBulletin.getContent()));
        tSystemBulletin.setState(2);
        tSystemBulletinService.updateById(tSystemBulletin);
        tSystemBulletinService.sendBulletin(tSystemBulletin);
@@ -147,9 +151,17 @@
     * 删除
     */
    @RequestMapping(value = "/delete")
    @Transactional(rollbackFor = Exception.class)
    @ResponseBody
    public Object delete(@RequestParam Integer tSystemBulletinId) {
        tSystemBulletinService.deleteById(tSystemBulletinId);
        TSystemBulletin tSystemBulletin = tSystemBulletinService.selectById(tSystemBulletinId);
        tSystemBulletin.setStatus(StatusEnum.DELETE.getCode());
        tSystemBulletinService.updateById(tSystemBulletin);
        // 公告用户关联关系状态修改
        tSystemBulletinUserService.deleteBulletinUser(tSystemBulletinId);
        return SUCCESS_TIP;
    }
@@ -159,6 +171,7 @@
    @RequestMapping(value = "/update")
    @ResponseBody
    public Object update(TSystemBulletin tSystemBulletin) {
        tSystemBulletin.setContent(LabelReplaceUtil.replace(tSystemBulletin.getContent()));
        tSystemBulletinService.updateById(tSystemBulletin);
        return SUCCESS_TIP;
    }