shichongfu
2023-06-02 bc0e6504f935fe54a3a68160db313f6d4f089b17
src/main/java/com/product/administration/service/CooperatesService.java
@@ -1,5 +1,6 @@
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;
@@ -8,6 +9,7 @@
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;
@@ -117,9 +119,9 @@
         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);
@@ -127,7 +129,7 @@
      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);//未收未办人数
@@ -142,7 +144,7 @@
      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);//未到环节人数
@@ -266,6 +268,11 @@
      return baseDao.add(fs);
   }
   @Override
   public boolean delSupplyText(FieldSetEntity fs) {
      return baseDao.delete(fs.getTableName(),new String[]{fs.getUUID()});
   }
   /**
    * @description: 协同办公催办
    * @author: ZhouJie
@@ -307,10 +314,12 @@
      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("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(" and ").append(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");