1.修改文件发布-编号规则。

This commit is contained in:
翟林帆 2022-07-26 15:28:08 +08:00
parent 4f6d48fbcd
commit 8f216e4fd1
2 changed files with 13 additions and 19 deletions

View File

@ -23,17 +23,17 @@ public class ProcesNumberUtil {
* @return
*/
public synchronized String getProcessNum(String levelCode, String regionCode) {
String querySql = "select ID,NUMBER from BO_ACT_PROCESSNUMBER where LEVELNUM = '%s' and REGIONCODE='%s'";
String querySql = "select ID,NUMBERS from BO_ACT_PROCESSNUMBER where LEVELNUM = '%s' and REGIONCODE='%s'";
RowMap result = DBSql.getMap(String.format(querySql, levelCode, regionCode));
//如果没有就新增
if (result == null) {
String sql = "insert into BO_ACT_PROCESSNUMBER (ID,LEVELNUM,REGIONCODE,NUMBER) values ('%s', '%s', '%s',%s)";
String sql = "insert into BO_ACT_PROCESSNUMBER (ID,LEVELNUM,REGIONCODE,NUMBERS) values ('%s', '%s', '%s',%s)";
String id = UUIDGener.getUUID();
DBSql.update(String.format(sql, id, levelCode, regionCode, 1));
return "01";
}
int nowNum = result.getInt("NUMBER");
String updateSql = "update BO_ACT_PROCESSNUMBER set NUMBER=%s where ID='%s'";
int nowNum = result.getInt("NUMBERS");
String updateSql = "update BO_ACT_PROCESSNUMBER set NUMBERS=%s where ID='%s'";
DBSql.update(String.format(updateSql, nowNum + 1, result.getString("ID")));
if (nowNum < 10) {
return "0" + nowNum;
@ -47,19 +47,14 @@ public class ProcesNumberUtil {
* @return
*/
public String getNumber(String bindId) {
System.out.println("生成编号并写入数据库===============================================");
System.out.println("生成编号并写入数据库===============");
//查询出主表数据
BO mainData = SDK.getBOAPI().getByProcess("BO_ACT_COE_PUBLISH", bindId);
System.out.println("mainData==============================="+mainData);
//根据主表数据查询出权限的编码
String qxSql = "select * from BO_ACT_AUTH_INFO where ORGNAME='%s' and LEVEL_1_PROCESS_NAME='%s' and LEVEL_2_PROCESS_NAME='%s' and LEVEL_3_PROCESS_NAME='%s'" +
" and ADAPT_REGION_NAME = '%s' and APPLICABLE_PRODUCT='%s'";
RowMap authData = DBSql.getMap(String.format(qxSql, mainData.getString("ADAPT_NAME_THE_COMPANY"), mainData.getString("LEVEL_1_PROCESS_NAME")
, mainData.getString("LEVEL_2_PROCESS_NAME"), mainData.getString("LEVEL_3_PROCESS_NAME"), mainData.getString("ADAPT_REGION_NAME"), mainData.getString("APPLICABLE_PRODUCT")));
System.out.println("authData==========================="+authData);
//获取所有的流程编码 如果为空则为00
String orgCode = authData.getString("ORGCODE");
String levelOne = authData.getString("LEVEL_1_PROCESS_ID");
@ -82,17 +77,14 @@ public class ProcesNumberUtil {
}
String levelnum = levelOne + "." + levelTwo + "." + levelThree;
System.out.println("levelnum========================="+levelnum);
String updateSql = "update BO_ACT_COE_PUBLISH_N set PROCESS_NUMBER='%s' where ID = '%S'";
String updateSql = "update BO_ACT_COE_PUBLISH_N set PROCESS_NUMBER='%s' where ID = '%s'";
for (BO nowData : dataList) {
String number = getProcessNum(levelnum, orgCode);
String publishfileid=nowData.getString("PUBLISHFILEID");
RowMap rowMap=DBSql.getMap("SELECT PLCATEGORY FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID='"+publishfileid+"' ");
String name = "00R00";
String fileName = "file_number";
if(rowMap!=null){
String plcategory=rowMap.getString("PLCATEGORY");
System.out.println("plcategory"+plcategory);
@ -101,15 +93,19 @@ public class ProcesNumberUtil {
}else if(plcategory.equals("control")){
name = "00/R00";
}else if(plcategory.equals("data")){
fileName = "form_number";
name = "00/T00";
}
}
String processNum = levelnum + "." + name +"V1.0"+orgCode + regionCode + productCode;
DBSql.update(String.format(updateSql, processNum, nowData.getId()));
String s = nowData.getId();
int update = DBSql.update(String.format(updateSql, processNum, s.toLowerCase()));
System.out.println("表单文件编号回填:"+update+"--->"+processNum);
String publishFileId = nowData.getString("PUBLISHFILEID");
String updateAttrsql = "update APP_ACT_COE_PAL_PROP set PROPERTYVALUE='%s' where PROPERTYID='%s' AND PLID='%s'";
DBSql.update(String.format(updateAttrsql, processNum, "number", publishFileId));
int update2 = DBSql.update(String.format(updateAttrsql, processNum, fileName, publishFileId));
System.out.println("模型文件编号回填:"+update2+"--->"+processNum);
//更新流程绩效的编号----规则没看懂
}
return "OK";

View File

@ -6,7 +6,6 @@ import com.actionsoft.apps.coe.pal.pal.manage.publish.model.PublishHistoryModel;
import com.actionsoft.apps.coe.pal.pal.manage.publish.model.PublishListHistoryModel;
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepository;
import com.actionsoft.apps.coe.pal.publisher.client.util.ProcesNumberUtil;
import com.actionsoft.apps.coe.pal.publisher.constant.PublisherConstant;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener;
@ -36,7 +35,6 @@ public class PublishExecuteListenerInterfaceCreateNo extends ExecuteListener imp
@Override
public void execute(ProcessExecutionContext param) throws Exception {
System.out.println("任务完成后生成文件编号===============");
String processInstId = param.getProcessInstance().getId();
//by bzp 测试编号生成
new ProcesNumberUtil().getNumber(processInstId);