| | |
| | | package com.product.administration.service; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.product.admin.service.UserService; |
| | | import com.product.administration.config.CmnConst; |
| | | import com.product.administration.service.ide.ICooperatesService; |
| | | import com.product.common.lang.StringUtils; |
| | |
| | | import com.product.core.spring.context.SpringMVCContextHolder; |
| | | import com.product.core.transfer.Transactional; |
| | | import com.product.core.websocket.service.WebsocketMesssageServiceThread; |
| | | import com.product.module.sys.service.UserService; |
| | | import com.product.util.BaseUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Qualifier; |
| | | import org.springframework.stereotype.Component; |
| | | import com.product.tool.flow.service.FlowCoordinationService; |
| | | |
| | |
| | | * @author: ZhouJie |
| | | * @Description: 协同办公 |
| | | */ |
| | | @Component |
| | | @Service |
| | | public class CooperatesService extends AbstractBaseService implements ICooperatesService { |
| | | @Autowired |
| | |
| | | @Autowired |
| | | QueryFilterService queryFilterService; |
| | | @Autowired |
| | | @Qualifier("userOperService") |
| | | UserService userService; |
| | | |
| | | /** |
| | |
| | | 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); |
| | | |
| | | for (int i = 0; i <copsub.getRows() ; i++) { |
| | | String userId = copsub.getString(i, "created_by_save_value"); |
| | | String userAvatar = userService.getUserAvatar(userId); |
| | | if (!StringUtils.isEmpty(userAvatar)) { |
| | | copsub.setFieldValue(i, "avatar", userAvatar); |
| | | } |
| | | } |
| | | 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 "); |
| | | stringBuilder.append(" tricode,opinion,handle_time,type,attachments,is_hide_commentss 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) { |
| | |
| | | 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) "; |
| | | 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); |
| | |
| | | if (fss.getInteger("sum") == null) { |
| | | fse.setValue("totals", 0);//流程共有人数 |
| | | } else { |
| | | fse.setValue("totals", fss.getInteger("sum") - 1); |
| | | fse.setValue("totals", fss.getInteger("sum")); |
| | | } |
| | | if (fs0.getInteger("sum") == null) { |
| | | fse.setValue("uncollectd", 0);//未收未办人数 |
| | |
| | | if (fs2.getInteger("sum") == null) { |
| | | fse.setValue("done", 0);//已收已办人数 |
| | | } else { |
| | | fse.setValue("done", fs2.getInteger("sum") - 1); |
| | | 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);//未到环节人数 |
| | |
| | | */ |
| | | public void saveTodo(FieldSetEntity fs) throws BaseException { |
| | | fs.setValue("status", 1); |
| | | fs.setValue("handle_time", new Date()); |
| | | baseDao.update(fs); |
| | | } |
| | | |
| | |
| | | fs.setValue("created_by", SpringMVCContextHolder.getCurrentUser().getUser_id()); |
| | | fs.setValue("created_utc_datetime", new Date()); |
| | | return baseDao.add(fs); |
| | | } |
| | | |
| | | @Override |
| | | public boolean delSupplyText(FieldSetEntity fs) { |
| | | return baseDao.delete(fs.getTableName(),new String[]{fs.getUUID()}); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public DataTableEntity getNowUserList(FieldSetEntity fs) { |
| | | int user_id = SpringMVCContextHolder.getCurrentUser().getUser_id(); |
| | | fs.getMeta().addAliasTable("product_oa_cooperates", "lc"); |
| | | fs.getMeta().addAliasTable("product_oa_cooperate_flow_node", "lcn"); |
| | | 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("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 "); |
| | | if (!StringUtils.isEmpty(queryFilter)) { |
| | | str.append(" and ").append(queryFilter); |
| | | str.append(" and ").append(queryFilter); |
| | | } |
| | | str.append(" order by start_time desc) a"); |
| | | 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"); |