| | |
| | | package com.product.administration.service; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.product.admin.service.UserService; |
| | | import com.product.administration.config.CmnConst; |
| | |
| | | import com.product.core.config.CoreConst; |
| | | import com.product.core.dao.BaseDao; |
| | | import com.product.core.entity.DataTableEntity; |
| | | import com.product.core.entity.FieldMetaEntity; |
| | | import com.product.core.entity.FieldSetEntity; |
| | | import com.product.core.exception.BaseException; |
| | | import com.product.core.permission.PermissionService; |
| | |
| | | @Component |
| | | @Service |
| | | public class CooperatesService extends AbstractBaseService implements ICooperatesService { |
| | | @Autowired |
| | | public BaseDao baseDao; |
| | | @Autowired |
| | | public FlowCoordinationService flowCoordinationService; |
| | | @Autowired |
| | | PermissionService permissionService; |
| | | @Autowired |
| | | QueryFilterService queryFilterService; |
| | | @Autowired |
| | | @Qualifier("userOperService") |
| | | UserService userService; |
| | | @Autowired |
| | | public BaseDao baseDao; |
| | | @Autowired |
| | | public FlowCoordinationService flowCoordinationService; |
| | | @Autowired |
| | | PermissionService permissionService; |
| | | @Autowired |
| | | QueryFilterService queryFilterService; |
| | | @Autowired |
| | | @Qualifier("userOperService") |
| | | UserService userService; |
| | | |
| | | /** |
| | | * @Date: 2020-03-23 18:10 |
| | | * @Author: ZhouJie |
| | | * @Description: 协同办公列表 |
| | | */ |
| | | public DataTableEntity getCooperateList(FieldSetEntity fs) throws BaseException { |
| | | /** |
| | | * @Date: 2020-03-23 18:10 |
| | | * @Author: ZhouJie |
| | | * @Description: 协同办公列表 |
| | | */ |
| | | public DataTableEntity getCooperateList(FieldSetEntity fs) throws BaseException { |
| | | String queryFilter = BaseUtil.ifNull(BaseUtil.ifNotNull(queryFilterService.getQueryFilter(fs), (value) -> value + " and "), ""); |
| | | |
| | | String filter = queryFilter + " created_by = ? "; |
| | |
| | | DataTableEntity dt = baseDao.listTable(CmnConst.PRODUCT_OA_COOPERATES, filter, params.toArray(), null, CmnConst.CREATED_UTC_DATETIME + " DESC", fs.getInteger(CmnConst.PAGESIZE), fs.getInteger(CmnConst.CPAGE)); |
| | | baseDao.loadPromptData(dt); |
| | | return dt; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @Date: 2020-03-23 17:52 |
| | | * @Author: ZhouJie |
| | | * @Description: 协同办公详情 |
| | | */ |
| | | public String getCooperateInfo(FieldSetEntity fs) throws BaseException { |
| | | FieldSetEntity fse = baseDao.getFieldSetEntity(CmnConst.PRODUCT_OA_COOPERATES, fs.getString(CmnConst.UUID), true); |
| | | DataTableEntity copsub = fse.getSubDataTable(CmnConst.PRODUCT_OA_COOPERATE_SUB); |
| | | baseDao.loadPromptData(copsub); |
| | | /** |
| | | * @Date: 2020-03-23 17:52 |
| | | * @Author: ZhouJie |
| | | * @Description: 协同办公详情 |
| | | */ |
| | | public String getCooperateInfo(FieldSetEntity fs) throws BaseException { |
| | | FieldSetEntity fse = baseDao.getFieldSetEntity(CmnConst.PRODUCT_OA_COOPERATES, fs.getString(CmnConst.UUID), true); |
| | | DataTableEntity copsub = fse.getSubDataTable(CmnConst.PRODUCT_OA_COOPERATE_SUB); |
| | | baseDao.loadPromptData(copsub); |
| | | |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | stringBuilder.append(" select ifnull(concat(tricode,'-',receiver) ,receiver) code,uuid,title,cooperate_uuid,grade,receiver as id,receiver,sender, "); |
| | | stringBuilder.append(" receiver_name,(select user_name FROM product_sys_users where user_id=receiver) label,sender_name,status, "); |
| | | stringBuilder.append(" tricode,opinion,handle_time,type,attachments from product_oa_cooperate_flow_node where cooperate_uuid=? ORDER BY tricode "); |
| | | DataTableEntity dt = baseDao.listTable(stringBuilder.toString(), new Object[]{fs.getString("uuid")}); |
| | | JSONArray json = null; |
| | | if (dt != null && dt.getRows() > 0) { |
| | | DataTableEntity subData = baseDao.listTable(CmnConst.PRODUCT_OA_COOPERATE_FLOW_REPLY, BaseUtil.buildQuestionMarkFilter("parent_uuid", dt.getRows(), true), dt.getUuids()); |
| | | baseDao.loadPromptData(subData); |
| | | Map<String, DataTableEntity> subMaps = new HashMap<>(); |
| | | for (int i = 0; i < subData.getRows(); i++) { |
| | | FieldSetEntity ff = subData.getFieldSetEntity(i); |
| | | String parent_uuid = ff.getString("parent_uuid"); |
| | | if (subMaps.get(parent_uuid) == null) { |
| | | subMaps.put(parent_uuid, new DataTableEntity()); |
| | | } |
| | | subMaps.get(parent_uuid).addFieldSetEntity(ff); |
| | | } |
| | | dt.getMeta().setTableName(new Object[]{"product_oa_cooperate_flow_node"}); |
| | | DataTableEntity dd = dt.clones(); |
| | | for (int i = 0; i < dt.getRows(); i++) { |
| | | String userId = dt.getString(i, "id"); |
| | | String userAvatar = userService.getUserAvatar(userId); |
| | | if (!StringUtils.isEmpty(userAvatar)) { |
| | | if (i == 0) { |
| | | dt.setFieldValue(i, "avatar", userAvatar); |
| | | } |
| | | dd.setFieldValue(i, "avatar", userAvatar); |
| | | } |
| | | dd.getFieldSetEntity(i).addSubDataTable(subMaps.get(dt.getFieldSetEntity(i).getUUID())); |
| | | } |
| | | fse.addSubDataTable(dd); |
| | | json = BaseUtil.dataTableToTreeData(dt, "code", "tricode", null, false); |
| | | } |
| | | String sql = " select count(*) sum from product_oa_cooperate_flow_node where cooperate_uuid =? and status =? "; |
| | | String sql1 = " select count(*) sum from product_oa_cooperate_flow_node where cooperate_uuid =? "; |
| | | String sql0 = " select count(*) sum from product_oa_cooperate_flow_node where cooperate_uuid =? and (status =? or status is null) "; |
| | | FieldSetEntity fss = baseDao.getFieldSetEntityBySQL(sql1, new Object[]{fs.getString(CmnConst.UUID)}, true); |
| | | FieldSetEntity fs0 = baseDao.getFieldSetEntityBySQL(sql0, new Object[]{fs.getString(CmnConst.UUID), 0}, true); |
| | | FieldSetEntity fs1 = baseDao.getFieldSetEntityBySQL(sql, new Object[]{fs.getString(CmnConst.UUID), 1}, true); |
| | | FieldSetEntity fs2 = baseDao.getFieldSetEntityBySQL(sql, new Object[]{fs.getString(CmnConst.UUID), 2}, true); |
| | | if (fss.getInteger("sum") == null) { |
| | | fse.setValue("totals", 0);//流程共有人数 |
| | | } else { |
| | | fse.setValue("totals", fss.getInteger("sum") - 1); |
| | | } |
| | | if (fs0.getInteger("sum") == null) { |
| | | fse.setValue("uncollectd", 0);//未收未办人数 |
| | | } else { |
| | | fse.setValue("uncollectd", fs0.getInteger("sum")); |
| | | } |
| | | if (fs1.getInteger("sum") == null) { |
| | | fse.setValue("received", 0);//已收未办人数 |
| | | } else { |
| | | fse.setValue("received", fs1.getInteger("sum")); |
| | | } |
| | | if (fs2.getInteger("sum") == null) { |
| | | fse.setValue("done", 0);//已收已办人数 |
| | | } else { |
| | | fse.setValue("done", fs2.getInteger("sum") - 1); |
| | | } |
| | | int a = fse.getInteger("totals") - fse.getInteger("uncollectd") - fse.getInteger("received") - fse.getInteger("done"); |
| | | fse.setValue("not_yet", a);//未到环节人数 |
| | | if (fse.getString("attachment") == null || "".equals(fse.getString("attachment"))) { |
| | | fse.setValue("attachment_number", 0);//附件数量 |
| | | } else { |
| | | int b = 0; |
| | | String str = fse.getString("attachment"); |
| | | String[] array = str.split(","); |
| | | b = array.length;//存在符号的个数 |
| | | fse.setValue("attachment_number", b); |
| | | } |
| | | if ("1".equals(fs.getString("countersign_type"))) { |
| | | fse.setValue("countersign_type", 1); |
| | | } |
| | | String emergency_degree = fse.getString("emergency_degree"); |
| | | baseDao.loadPromptData(fse); |
| | | Map map = new HashMap(); |
| | | map.put("document_process", json); |
| | | fse.setValue(CoreConst.API_RETURN_KEY_STATUS, fse.getString("status_save_value")); |
| | | // String s = String.copyValueOf(emergency_degree.toCharArray(), 0, emergency_degree.length()); |
| | | fse.setValue("emergency_degree_show_value", fse.getString("emergency_degree")); |
| | | fse.setValue("emergency_degree", emergency_degree); |
| | | return BaseUtil.success(fse, map); |
| | | } |
| | | |
| | | /** |
| | | * @Date: 2020-03-23 14:56 |
| | | * @Author: ZhouJie |
| | | * @Description: 新增协同办公 |
| | | */ |
| | | @Transactional |
| | | public String addCooperate(FieldSetEntity fs) throws BaseException { |
| | | fs.setValue("created_by", SpringMVCContextHolder.getCurrentUser().getUser_id()); |
| | | fs.setValue("created_utc_datetime", new Date()); |
| | | String uuid = baseDao.add(fs); |
| | | flowCoordinationService.saveCoordinationStartFlow(fs); |
| | | return uuid; |
| | | } |
| | | |
| | | /** |
| | | * @Date: 2020-03-23 17:03 |
| | | * @Author: ZhouJie |
| | | * @Description: 修改协同办公 |
| | | */ |
| | | @Transactional |
| | | public boolean updateCooperate(FieldSetEntity fs) throws BaseException { |
| | | fs.setValue("updated_by", SpringMVCContextHolder.getCurrentUser().getUser_id()); |
| | | fs.setValue("updated_utc_datetime", new Date()); |
| | | fs.setValue("type", 0); |
| | | Boolean flag = baseDao.update(fs); |
| | | flowCoordinationService.saveCoordinationStartFlow(fs); |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * @Date: 2020-03-23 17:30 |
| | | * @Author: ZhouJie |
| | | * @Description: 删除协同办公 |
| | | */ |
| | | @Transactional |
| | | public boolean deleteCooperate(FieldSetEntity fs) throws BaseException { |
| | | String uuid = fs.getUUID(); |
| | | String[] uuids = uuid.split(","); |
| | | return baseDao.delete(CmnConst.PRODUCT_OA_COOPERATES, BaseUtil.buildQuestionMarkFilter(CmnConst.UUID, uuids.length, true), uuids); |
| | | } |
| | | |
| | | /** |
| | | * @Date: 2020-04-01 16:30 |
| | | * @Author: ZhouJie |
| | | * @Description: 协同办公送办 |
| | | */ |
| | | public void sendCooperate(FieldSetEntity fs) throws BaseException { |
| | | DataTableEntity dt = fs.getSubDataTable("document_process"); |
| | | if (dt != null && dt.getRows() > 0) { |
| | | for (int i = 0; i < dt.getRows(); i++) { |
| | | FieldSetEntity fss = dt.getFieldSetEntity(i); |
| | | if (fs.getString("flow_node_uuid") == null) { |
| | | if (fss.getString("sender_name") == null) { |
| | | fss.setValue("status", 2); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (fs.getUUID() == null) { |
| | | fs.setValue("created_by", SpringMVCContextHolder.getCurrentUser().getUser_id()); |
| | | fs.setValue("created_utc_datetime", new Date()); |
| | | fs.setValue("start_time", new Date());//发起时间 |
| | | baseDao.add(fs); |
| | | } else { |
| | | fs.setValue("updated_by", SpringMVCContextHolder.getCurrentUser().getUser_id()); |
| | | fs.setValue("updated_utc_datetime", new Date()); |
| | | fs.setValue("start_time", new Date());//发起时间 |
| | | if (fs.getInteger("type") == 4) { |
| | | baseDao.update(fs); |
| | | } |
| | | } |
| | | flowCoordinationService.saveCoordinationStartFlow(fs); |
| | | } |
| | | |
| | | /** |
| | | * @description: 暂存待办 |
| | | * @author: ZhouJie |
| | | * @date: 2021-05-26 16:53 |
| | | */ |
| | | public void saveTodo(FieldSetEntity fs) throws BaseException { |
| | | fs.setValue("status", 1); |
| | | baseDao.update(fs); |
| | | } |
| | | |
| | | /** |
| | | * @description: 协同补充正文 |
| | | * @author: ZhouJie |
| | | * @date: 2021-05-28 14:54 |
| | | */ |
| | | @Transactional |
| | | public String addSupplyText(FieldSetEntity fs) { |
| | | fs.setValue("cooperate_uuid", fs.getString("cooperate_uuid")); |
| | | fs.setValue("created_by", SpringMVCContextHolder.getCurrentUser().getUser_id()); |
| | | fs.setValue("created_utc_datetime", new Date()); |
| | | return baseDao.add(fs); |
| | | } |
| | | |
| | | /** |
| | | * @description: 协同办公催办 |
| | | * @author: ZhouJie |
| | | * @date: 2021-06-03 17:20 |
| | | */ |
| | | public void urging(FieldSetEntity fse) { |
| | | FieldSetEntity fs = baseDao.getFieldSetEntity(CmnConst.PRODUCT_OA_COOPERATES, fse.getString("cooperate_uuid"), false); |
| | | WebsocketMesssageServiceThread.getInstance().appendMessage( |
| | | fse.getString("receiver"), |
| | | "协同《" + fs.getString("title") + "》" + fse.getString("content"), |
| | | "催办:", |
| | | SpringMVCContextHolder.getCurrentUser().getUser_id(), |
| | | CoreConst.SYSTEM_MESSAGE_TYPE_DEALT + "", |
| | | CmnConst.PRODUCT_OA_COOPERATE_URL + "?" + CmnConst.UUID + "=" + fs.getString(CoreConst.UUID) + "&" + CmnConst.FIELD_COOPERATE_FLOW_NODE_UUID + "=" + fse.getUUID(), |
| | | CmnConst.PRODUCT_OA_COOPERATES, |
| | | fs.getUUID(), |
| | | fs.getInteger(CoreConst.CREATED_BY), |
| | | 0, |
| | | 0 |
| | | ); |
| | | } |
| | | |
| | | /** |
| | | * @description: 消息状态改为“已收未办” |
| | | * @author: ZhouJie |
| | | * @date: 2021-06-11 11:00 |
| | | */ |
| | | public boolean modifyState(String node_uuid) { |
| | | String sql = " update product_oa_cooperate_flow_node set status=1 where status=0 and uuid=?"; |
| | | return baseDao.executeUpdate(sql, new Object[]{node_uuid}); |
| | | } |
| | | |
| | | /** |
| | | * @description: 消息处理列表 |
| | | * @author: ZhouJie |
| | | * @date: 2021-06-16 11:34 |
| | | */ |
| | | public DataTableEntity getNowUserList(FieldSetEntity fs) { |
| | | int user_id = SpringMVCContextHolder.getCurrentUser().getUser_id(); |
| | | String queryFilter = queryFilterService.getQueryFilter(fs); |
| | | StringBuffer str = new StringBuffer(); |
| | | str.append(" select lc.*,lcn.uuid flow_node_uuid from product_oa_cooperate_flow_node lcn LEFT JOIN product_oa_COOPERATEs lc "); |
| | | str.append(" on lc.uuid=lcn.cooperate_uuid where lcn.receiver=? and lcn.status=? and sender_name is not null "); |
| | | if (!StringUtils.isEmpty(queryFilter)) { |
| | | str.append(" and ").append(queryFilter); |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | stringBuilder.append(" select ifnull(concat(tricode,'-',receiver) ,receiver) code,uuid,title,cooperate_uuid,grade,receiver as id,receiver,sender, "); |
| | | stringBuilder.append(" receiver_name,(select user_name FROM product_sys_users where user_id=receiver) label,sender_name,status, "); |
| | | stringBuilder.append(" tricode,opinion,handle_time,type,attachments from product_oa_cooperate_flow_node where cooperate_uuid=? ORDER BY tricode "); |
| | | DataTableEntity dt = baseDao.listTable(stringBuilder.toString(), new Object[]{fs.getString("uuid")}); |
| | | JSONArray json = null; |
| | | if (dt != null && dt.getRows() > 0) { |
| | | DataTableEntity subData = baseDao.listTable(CmnConst.PRODUCT_OA_COOPERATE_FLOW_REPLY, BaseUtil.buildQuestionMarkFilter("parent_uuid", dt.getRows(), true), dt.getUuids()); |
| | | baseDao.loadPromptData(subData); |
| | | Map<String, DataTableEntity> subMaps = new HashMap<>(); |
| | | for (int i = 0; i < subData.getRows(); i++) { |
| | | FieldSetEntity ff = subData.getFieldSetEntity(i); |
| | | String parent_uuid = ff.getString("parent_uuid"); |
| | | if (subMaps.get(parent_uuid) == null) { |
| | | subMaps.put(parent_uuid, new DataTableEntity()); |
| | | } |
| | | subMaps.get(parent_uuid).addFieldSetEntity(ff); |
| | | } |
| | | dt.getMeta().setTableName(new Object[]{"product_oa_cooperate_flow_node"}); |
| | | DataTableEntity dd = dt.clones(); |
| | | for (int i = 0; i < dt.getRows(); i++) { |
| | | String userId = dt.getString(i, "id"); |
| | | String userAvatar = userService.getUserAvatar(userId); |
| | | if (!StringUtils.isEmpty(userAvatar)) { |
| | | if (i == 0) { |
| | | dt.setFieldValue(i, "avatar", userAvatar); |
| | | } |
| | | dd.setFieldValue(i, "avatar", userAvatar); |
| | | } |
| | | dd.getFieldSetEntity(i).addSubDataTable(subMaps.get(dt.getFieldSetEntity(i).getUUID())); |
| | | } |
| | | fse.addSubDataTable(dd); |
| | | json = BaseUtil.dataTableToTreeData(dt, "code", "tricode", null, false); |
| | | } |
| | | DataTableEntity dt = baseDao.listTable(str.toString(), new Object[]{user_id, 2}); |
| | | dt.getMeta().addAliasTable("product_oa_COOPERATEs", "lc"); |
| | | String sql = " select count(*) sum from product_oa_cooperate_flow_node where cooperate_uuid =? and status =? and tricode is not null"; |
| | | String sql1 = " select count(*) sum from product_oa_cooperate_flow_node where cooperate_uuid =? and tricode is not null"; |
| | | String sql0 = " select count(*) sum from product_oa_cooperate_flow_node where cooperate_uuid =? and (status =? or status is null) and tricode is not null"; |
| | | FieldSetEntity fss = baseDao.getFieldSetEntityBySQL(sql1, new Object[]{fs.getString(CmnConst.UUID)}, true); |
| | | FieldSetEntity fs0 = baseDao.getFieldSetEntityBySQL(sql0, new Object[]{fs.getString(CmnConst.UUID), 0}, true); |
| | | FieldSetEntity fs1 = baseDao.getFieldSetEntityBySQL(sql, new Object[]{fs.getString(CmnConst.UUID), 1}, true); |
| | | FieldSetEntity fs2 = baseDao.getFieldSetEntityBySQL(sql, new Object[]{fs.getString(CmnConst.UUID), 2}, true); |
| | | if (fss.getInteger("sum") == null) { |
| | | fse.setValue("totals", 0);//流程共有人数 |
| | | } else { |
| | | fse.setValue("totals", fss.getInteger("sum")); |
| | | } |
| | | if (fs0.getInteger("sum") == null) { |
| | | fse.setValue("uncollectd", 0);//未收未办人数 |
| | | } else { |
| | | fse.setValue("uncollectd", fs0.getInteger("sum")); |
| | | } |
| | | if (fs1.getInteger("sum") == null) { |
| | | fse.setValue("received", 0);//已收未办人数 |
| | | } else { |
| | | fse.setValue("received", fs1.getInteger("sum")); |
| | | } |
| | | if (fs2.getInteger("sum") == null) { |
| | | fse.setValue("done", 0);//已收已办人数 |
| | | } else { |
| | | fse.setValue("done", fs2.getInteger("sum")); |
| | | } |
| | | int a = fse.getInteger("totals") - fse.getInteger("uncollectd") - fse.getInteger("received") - fse.getInteger("done"); |
| | | fse.setValue("not_yet", a);//未到环节人数 |
| | | if (fse.getString("attachment") == null || "".equals(fse.getString("attachment"))) { |
| | | fse.setValue("attachment_number", 0);//附件数量 |
| | | } else { |
| | | int b = 0; |
| | | String str = fse.getString("attachment"); |
| | | String[] array = str.split(","); |
| | | b = array.length;//存在符号的个数 |
| | | fse.setValue("attachment_number", b); |
| | | } |
| | | if ("1".equals(fs.getString("countersign_type"))) { |
| | | fse.setValue("countersign_type", 1); |
| | | } |
| | | String emergency_degree = fse.getString("emergency_degree"); |
| | | baseDao.loadPromptData(fse); |
| | | Map map = new HashMap(); |
| | | map.put("document_process", json); |
| | | fse.setValue(CoreConst.API_RETURN_KEY_STATUS, fse.getString("status_save_value")); |
| | | // String s = String.copyValueOf(emergency_degree.toCharArray(), 0, emergency_degree.length()); |
| | | fse.setValue("emergency_degree_show_value", fse.getString("emergency_degree")); |
| | | fse.setValue("emergency_degree", emergency_degree); |
| | | return BaseUtil.success(fse, map); |
| | | } |
| | | |
| | | /** |
| | | * @Date: 2020-03-23 14:56 |
| | | * @Author: ZhouJie |
| | | * @Description: 新增协同办公 |
| | | */ |
| | | @Transactional |
| | | public String addCooperate(FieldSetEntity fs) throws BaseException { |
| | | fs.setValue("created_by", SpringMVCContextHolder.getCurrentUser().getUser_id()); |
| | | fs.setValue("created_utc_datetime", new Date()); |
| | | String uuid = baseDao.add(fs); |
| | | flowCoordinationService.saveCoordinationStartFlow(fs); |
| | | return uuid; |
| | | } |
| | | |
| | | /** |
| | | * @Date: 2020-03-23 17:03 |
| | | * @Author: ZhouJie |
| | | * @Description: 修改协同办公 |
| | | */ |
| | | @Transactional |
| | | public boolean updateCooperate(FieldSetEntity fs) throws BaseException { |
| | | fs.setValue("updated_by", SpringMVCContextHolder.getCurrentUser().getUser_id()); |
| | | fs.setValue("updated_utc_datetime", new Date()); |
| | | fs.setValue("type", 0); |
| | | Boolean flag = baseDao.update(fs); |
| | | flowCoordinationService.saveCoordinationStartFlow(fs); |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * @Date: 2020-03-23 17:30 |
| | | * @Author: ZhouJie |
| | | * @Description: 删除协同办公 |
| | | */ |
| | | @Transactional |
| | | public boolean deleteCooperate(FieldSetEntity fs) throws BaseException { |
| | | String uuid = fs.getUUID(); |
| | | String[] uuids = uuid.split(","); |
| | | return baseDao.delete(CmnConst.PRODUCT_OA_COOPERATES, BaseUtil.buildQuestionMarkFilter(CmnConst.UUID, uuids.length, true), uuids); |
| | | } |
| | | |
| | | /** |
| | | * @Date: 2020-04-01 16:30 |
| | | * @Author: ZhouJie |
| | | * @Description: 协同办公送办 |
| | | */ |
| | | public void sendCooperate(FieldSetEntity fs) throws BaseException { |
| | | DataTableEntity dt = fs.getSubDataTable("document_process"); |
| | | if (dt != null && dt.getRows() > 0) { |
| | | for (int i = 0; i < dt.getRows(); i++) { |
| | | FieldSetEntity fss = dt.getFieldSetEntity(i); |
| | | if (fs.getString("flow_node_uuid") == null) { |
| | | if (fss.getString("sender_name") == null) { |
| | | fss.setValue("status", 2); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (fs.getUUID() == null) { |
| | | fs.setValue("created_by", SpringMVCContextHolder.getCurrentUser().getUser_id()); |
| | | fs.setValue("created_utc_datetime", new Date()); |
| | | fs.setValue("start_time", new Date());//发起时间 |
| | | baseDao.add(fs); |
| | | } else { |
| | | fs.setValue("updated_by", SpringMVCContextHolder.getCurrentUser().getUser_id()); |
| | | fs.setValue("updated_utc_datetime", new Date()); |
| | | fs.setValue("start_time", new Date());//发起时间 |
| | | if (fs.getInteger("type") == 4) { |
| | | baseDao.update(fs); |
| | | } |
| | | } |
| | | flowCoordinationService.saveCoordinationStartFlow(fs); |
| | | } |
| | | |
| | | /** |
| | | * @description: 暂存待办 |
| | | * @author: ZhouJie |
| | | * @date: 2021-05-26 16:53 |
| | | */ |
| | | public void saveTodo(FieldSetEntity fs) throws BaseException { |
| | | fs.setValue("status", 1); |
| | | baseDao.update(fs); |
| | | } |
| | | |
| | | /** |
| | | * @description: 协同补充正文 |
| | | * @author: ZhouJie |
| | | * @date: 2021-05-28 14:54 |
| | | */ |
| | | @Transactional |
| | | public String addSupplyText(FieldSetEntity fs) { |
| | | fs.setValue("cooperate_uuid", fs.getString("cooperate_uuid")); |
| | | fs.setValue("created_by", SpringMVCContextHolder.getCurrentUser().getUser_id()); |
| | | fs.setValue("created_utc_datetime", new Date()); |
| | | return baseDao.add(fs); |
| | | } |
| | | |
| | | /** |
| | | * @description: 协同办公催办 |
| | | * @author: ZhouJie |
| | | * @date: 2021-06-03 17:20 |
| | | */ |
| | | public void urging(FieldSetEntity fse) { |
| | | FieldSetEntity fs = baseDao.getFieldSetEntity(CmnConst.PRODUCT_OA_COOPERATES, fse.getString("cooperate_uuid"), false); |
| | | WebsocketMesssageServiceThread.getInstance().appendMessage( |
| | | fse.getString("receiver"), |
| | | "协同《" + fs.getString("title") + "》" + fse.getString("content"), |
| | | "催办:", |
| | | SpringMVCContextHolder.getCurrentUser().getUser_id(), |
| | | CoreConst.SYSTEM_MESSAGE_TYPE_DEALT + "", |
| | | CmnConst.PRODUCT_OA_COOPERATE_URL + "?" + CmnConst.UUID + "=" + fs.getString(CoreConst.UUID) + "&" + CmnConst.FIELD_COOPERATE_FLOW_NODE_UUID + "=" + fse.getUUID(), |
| | | CmnConst.PRODUCT_OA_COOPERATES, |
| | | fs.getUUID(), |
| | | fs.getInteger(CoreConst.CREATED_BY), |
| | | 0, |
| | | 0 |
| | | ); |
| | | } |
| | | |
| | | /** |
| | | * @description: 消息状态改为“已收未办” |
| | | * @author: ZhouJie |
| | | * @date: 2021-06-11 11:00 |
| | | */ |
| | | public boolean modifyState(String node_uuid) { |
| | | String sql = " update product_oa_cooperate_flow_node set status=1 where status=0 and uuid=?"; |
| | | return baseDao.executeUpdate(sql, new Object[]{node_uuid}); |
| | | } |
| | | |
| | | /** |
| | | * @description: 消息处理列表 |
| | | * @author: ZhouJie |
| | | * @date: 2021-06-16 11:34 |
| | | */ |
| | | public DataTableEntity getNowUserList(FieldSetEntity fs) { |
| | | int user_id = SpringMVCContextHolder.getCurrentUser().getUser_id(); |
| | | String queryFilter = queryFilterService.getQueryFilter(fs); |
| | | StringBuffer str = new StringBuffer(); |
| | | str.append("SELECT * FROM ( "); |
| | | str.append(" select lc.*,lcn.uuid flow_node_uuid from product_oa_cooperate_flow_node as lcn LEFT JOIN product_oa_cooperates as lc "); |
| | | str.append(" on lc.uuid=lcn.cooperate_uuid where lcn.receiver=? and lcn.status=? and sender_name is not null "); |
| | | str.append(" ) a"); |
| | | if (!StringUtils.isEmpty(queryFilter)) { |
| | | str.append(" where ").append(queryFilter); |
| | | } |
| | | DataTableEntity dt = baseDao.listTable(str.toString(), new Object[]{user_id, 2}, fs.getInteger(CmnConst.PAGESIZE), fs.getInteger(CmnConst.CPAGE)); |
| | | dt.getMeta().addAliasTable("product_oa_cooperates", "lc"); |
| | | dt.getMeta().addAliasTable("product_oa_cooperate_flow_node", "lcn"); |
| | | baseDao.loadPromptData(dt); |
| | | return dt; |
| | | } |
| | | baseDao.loadPromptData(dt); |
| | | return dt; |
| | | } |
| | | |
| | | |
| | | } |