杜洪波
5 天以前 15cb14e5d1fe955df8d1b73c2c6c8ca768a64441
src/main/java/com/product/administration/service/AnnouncementService.java
@@ -10,6 +10,7 @@
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.product.administration.config.CmnConst;
import com.product.administration.service.ide.IAnnouncementService;
import com.product.core.config.CoreConst;
import com.product.core.dao.BaseDao;
import com.product.core.entity.DataTableEntity;
@@ -19,11 +20,12 @@
import com.product.core.service.support.AbstractBaseService;
import com.product.core.service.support.QueryFilterService;
import com.product.core.spring.context.SpringMVCContextHolder;
import com.product.core.transfer.Transactional;
import com.product.core.websocket.service.WebsocketMesssageServiceThread;
import com.product.util.BaseUtil;
@Component
public class AnnouncementService extends AbstractBaseService {
public class AnnouncementService extends AbstractBaseService implements IAnnouncementService{
    @Autowired
    public QueryFilterService queryFilterService;
    @Autowired
@@ -37,6 +39,8 @@
        return baseDao.add(fse);
    }
    @Override
    @Transactional
    public boolean releaseAnnouncement(FieldSetEntity fse) throws BaseException {
        fse.setValue("publish_status", 1);
        int user_id = SpringMVCContextHolder.getCurrentUser().getUser_id();
@@ -48,7 +52,7 @@
        for (int i = 0; i < extentArr.length; i++) {
            FieldSetEntity fs = new FieldSetEntity();
            FieldMetaEntity metaEntity = new FieldMetaEntity();
            metaEntity.setTableName(new Object[]{CmnConst.product_oa_ANNOUNCEMENT_ROLE});
            metaEntity.setTableName(new Object[]{CmnConst.PRODUCT_OA_ANNOUNCEMENT_ROLE});
            fs.setMeta(metaEntity);
            fs.setValue("user_id", extentArr[i]);
            fs.setValue("status", 0);
@@ -66,17 +70,17 @@
            }
        }
        WebsocketMesssageServiceThread.getInstance().appendMessage(fse.getString("extent"), "[公告]" + user_name + "发布了《" + fse.getString("title") + "》公告", "[公告]" + user_name + "发布了《" + fse.getString("title") + "》公告",
                user_id, "1", COOPERATE_URL + "?" + CoreConst.UUID + "=" + uuid + "&news=1", CmnConst.product_oa_ANNOUNCEMENT, fse.getUUID(), user_id, 0, 0);
                user_id, "1", COOPERATE_URL + "?" + CoreConst.UUID + "=" + uuid + "&news=1", CmnConst.PRODUCT_OA_ANNOUNCEMENT, fse.getUUID(), user_id, 0, 0);
        return !StringUtils.isEmpty(uuid);
    }
    public boolean remindAnnouncement(FieldSetEntity fs) throws BaseException {
        FieldSetEntity fse = baseDao.getFieldSetEntity(CmnConst.product_oa_ANNOUNCEMENT, fs.getUUID(), false);
        FieldSetEntity fse = baseDao.getFieldSetEntity(CmnConst.PRODUCT_OA_ANNOUNCEMENT, fs.getUUID(), false);
        String user_name = SpringMVCContextHolder.getCurrentUser().getUser_name();
        int user_id = SpringMVCContextHolder.getCurrentUser().getUser_id();
        WebsocketMesssageServiceThread.getInstance().appendMessage(fs.getString("extent"), "[公告]" + user_name + "提醒你查看公告《" + fse.getString("title") + "》", "[公告]" + user_name + "提醒你查看公告《" + fse.getString("title") + "》",
                user_id, "1", COOPERATE_URL + "?" + CoreConst.UUID + "=" + fs.getUUID() + "&news=1", CmnConst.product_oa_ANNOUNCEMENT, fse.getUUID(), user_id, 0, 0);
                user_id, "1", COOPERATE_URL + "?" + CoreConst.UUID + "=" + fs.getUUID() + "&news=1", CmnConst.PRODUCT_OA_ANNOUNCEMENT, fse.getUUID(), user_id, 0, 0);
        return !StringUtils.isEmpty(fs.getUUID());
    }
@@ -88,7 +92,7 @@
    }
    public FieldSetEntity getAnnouncement(FieldSetEntity fse) throws BaseException {
        return baseDao.getFieldSetEntity(CmnConst.product_oa_ANNOUNCEMENT, fse.getString("uuid"), false);
        return baseDao.getFieldSetEntity(CmnConst.PRODUCT_OA_ANNOUNCEMENT, fse.getString("uuid"), false);
    }
    public DataTableEntity listAnnouncement(FieldSetEntity fse) throws BaseException {
@@ -96,7 +100,7 @@
        if (!BaseUtil.dataTableIsEmpty(fse.getSubDataTable("systemSeniorQueryString"))) {
            queryFilter = " and " + queryFilterService.getQueryFilter(fse);
        }
        DataTableEntity dt = baseDao.listTable(CmnConst.product_oa_ANNOUNCEMENT, "publish_status=0 " + queryFilter, new Object[]{},
        DataTableEntity dt = baseDao.listTable(CmnConst.PRODUCT_OA_ANNOUNCEMENT, "publish_status=0 " + queryFilter, new Object[]{},
                new Object[]{}, " created_utc_datetime desc ", fse.getInteger("pagesize"), fse.getInteger("cpage"));
        baseDao.loadPromptData(dt);
        return dt;
@@ -107,7 +111,7 @@
        if (!BaseUtil.dataTableIsEmpty(fse.getSubDataTable("systemSeniorQueryString"))) {
            queryFilter = " and " + queryFilterService.getQueryFilter(fse);
        }
        DataTableEntity dt = baseDao.listTable(CmnConst.product_oa_ANNOUNCEMENT, "publish_status=1" + queryFilter, new Object[]{},
        DataTableEntity dt = baseDao.listTable(CmnConst.PRODUCT_OA_ANNOUNCEMENT, "publish_status=1" + queryFilter, new Object[]{},
                new Object[]{}, " created_utc_datetime desc ", fse.getInteger("pagesize"), fse.getInteger("cpage"));
        baseDao.loadPromptData(dt);
        return dt;
@@ -124,7 +128,7 @@
        if (!StringUtils.isEmpty(fse.getString("type"))) {
            type = " and type='" + fse.getString("type") + "'";
        }
        DataTableEntity dt = baseDao.listTable(CmnConst.product_oa_ANNOUNCEMENT,
        DataTableEntity dt = baseDao.listTable(CmnConst.PRODUCT_OA_ANNOUNCEMENT,
                "publish_status=1 and concat(',',extent,',') like '%" + id + "%'" + type + queryFilter, new Object[]{},
                new Object[]{}, CmnConst.CREATED_UTC_DATETIME + " desc", fse.getInteger("pagesize"), fse.getInteger("cpage"));
        baseDao.loadPromptData(dt);
@@ -161,14 +165,14 @@
    public boolean delAnnouncement(FieldSetEntity fse) throws BaseException {
        String[] uuid = fse.getString("uuid").split(",");
        return baseDao.delete(CmnConst.product_oa_ANNOUNCEMENT, uuid);
        return baseDao.delete(CmnConst.PRODUCT_OA_ANNOUNCEMENT, uuid);
    }
    public FieldSetEntity findAnnouncement(FieldSetEntity fse) throws BaseException {
//      FieldSetEntity fs = baseDao.getFieldSetEntity(CmnConst.product_oa_ANNOUNCEMENT, fse.getString("uuid"), false);
        String sqlfs = "SELECT *,(SELECT user_name FROM " + CmnConst.PRODUCT_SYS_USERS + " WHERE user_id=a.created_by)created_by_save,(SELECT user_name FROM " + CmnConst.PRODUCT_SYS_USERS + " WHERE user_id=a.updated_by)updated_by_save from " + CmnConst.product_oa_ANNOUNCEMENT + " a WHERE uuid=?";
        String sqlfs = "SELECT *,(SELECT user_name FROM " + CmnConst.PRODUCT_SYS_USERS + " WHERE user_id=a.created_by)created_by_save,(SELECT user_name FROM " + CmnConst.PRODUCT_SYS_USERS + " WHERE user_id=a.updated_by)updated_by_save from " + CmnConst.PRODUCT_OA_ANNOUNCEMENT + " a WHERE uuid=?";
        FieldSetEntity fs = baseDao.getFieldSetEntityBySQL(sqlfs, new String[]{fse.getString("uuid")}, false);
        String sql = "SELECT b.user_id user_id,b.show_name show_name,c.org_level_name,a.status FROM " + CmnConst.product_oa_ANNOUNCEMENT_ROLE + " a LEFT JOIN product_sys_staffs b on a.user_id=b.user_id LEFT JOIN product_sys_org_levels c on b.dept_uuid=c.uuid WHERE a.announcement_uuid=?";
        String sql = "SELECT b.user_id user_id,b.show_name show_name,c.org_level_name,a.status FROM " + CmnConst.PRODUCT_OA_ANNOUNCEMENT_ROLE + " a LEFT JOIN product_sys_staffs b on a.user_id=b.user_id LEFT JOIN product_sys_org_levels c on b.dept_uuid=c.uuid WHERE a.announcement_uuid=?";
        DataTableEntity dt = baseDao.listTable(sql, new String[]{fs.getUUID()});
        fs.addSubDataTable(dt);
        fs.setValue("number", dt.getRows());
@@ -183,7 +187,7 @@
    }
    public boolean readAnnouncementRemind(FieldSetEntity fs) throws BaseException {
        FieldSetEntity fse = baseDao.getFieldSetEntity(CmnConst.product_oa_ANNOUNCEMENT, fs.getUUID(), false);
        FieldSetEntity fse = baseDao.getFieldSetEntity(CmnConst.PRODUCT_OA_ANNOUNCEMENT, fs.getUUID(), false);
        String expiration_date = fse.getString("expiration_date");
        SimpleDateFormat tempDate = new SimpleDateFormat("yyyy-MM-dd");
@@ -207,7 +211,7 @@
        //当前人uuid
        int user_id = SpringMVCContextHolder.getCurrentUser().getUser_id();
        String id = "," + user_id + ",";
        DataTableEntity dt = baseDao.listTable(CmnConst.product_oa_ANNOUNCEMENT,
        DataTableEntity dt = baseDao.listTable(CmnConst.PRODUCT_OA_ANNOUNCEMENT,
                "publish_status=1 and concat(',',extent,',') like '%" + id + "%'", new Object[]{},
                new Object[]{},  CmnConst.CREATED_UTC_DATETIME + " desc", 5, 1);
        baseDao.loadPromptData(dt);