需求
给了一个需求,说是将我们第三方单据进来时候增加一个限制,将传进来的数据处理一下,判断合同,项目,往来单位,业务科目是否停用,但是这个功能有点特殊,首先呢这个功能是流传下来的shi山,然后大面积改肯定是不可能了,然后呢单据根据单据类型分为四种,其中三种都是特殊单据,一种是非三种特殊单据,之前因为这个功能优化了一次,将多次的sql查询统一完成,但是三种特殊单据。目前的方法两种,第一种是在上次优化的地方再次进行增加限制,缺点是我增加了限制之后还需要对于其他三种特殊单据进行改造,第二种就是在最开始,在区分单据类型之前进行处理。想了想还是第二种消耗的更少,于是开始做。
方法
因为功能是判断合同,项目,往来单位,业务科目是否停用,所以最开始的想法是殊途同归,我把一个完成了,然后穿进去不同的表不就好了,不行在switch case,初步定的是这个想法。
/**
* 根据不同入参判断取值以及塞数
* @param hashMap
* @param jsonObjectThis
* @param ZBConfig
* @param tabletype
* @return
*/
public HashMap<String,String> checkContractProjectCorrespondenceUnitBusinessSubjectsDeactivate(HashMap<String,String> hashMap,JSONArray jsonObjectThis,BzzxdrszEntitycccc ZBConfig,String tabletype) {
String sql = "SELECT MBDRSZMX_QZVAL,MBDRSZMX_SRCBH FROM BZZXDRSZMX WHERE MBDRSZMX_PID = ?1 AND MBDRSZMX_QZLX = '0' AND MBDRSZMX_QZTAB like "+tabletype;
Query query = entityManager.createNativeQuery(sql);
query.setParameter(1, ZBConfig.getMbdrszId());
query.unwrap(SQLQuery.class).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
List<Map<String, String>> ZDB = query.getResultList();
for (int j = 0; j< jsonObjectThis.size(); j++) {
JSONObject jsonObject = jsonObjectThis.getJSONObject(j);
for (int i = 0; i < ZDB.size(); i++) {
Map<String, String> map = ZDB.get(i);
//目前只接受纯大写和纯小写
if (("ID".equals(map.get("MBDRSZMX_QZVAL"))) || ("id".equals(map.get("MBDRSZMX_QZVAL")))) {
//如果map里面有值则添加
if (!StringUtils.isEmpty(hashMap.get("ID"))) {
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
String id = hashMap.get("ID");
hashMap.put("ID", id + "," + "'"+String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH")))+"'");
}
}
//没有则新增
else {
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
hashMap.put("ID", "'"+String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH")))+"'");
}
}
} else if (("CODE".equals(map.get("MBDRSZMX_QZVAL"))) || ("code".equals(map.get("MBDRSZMX_QZVAL")))) {
//如果map里面有值则添加
if (!StringUtils.isEmpty(hashMap.get("CODE"))) {
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
String id = hashMap.get("CODE");
hashMap.put("CODE", id + "," + "'"+String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH")))+"'");
}
}
//没有则新增
else {
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
hashMap.put("CODE", "'"+String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH")))+"'");
}
}
}
}
}
return hashMap;
}
首先是通过导入设置的配置找到,合同,项目,往来单位,业务科目,的语句。
/**
* sql
* 开始判断
* @param hashMap
* @param tabletype
* @return
*/
public ResultRetBZ judgeDeactivate(HashMap<String,String> hashMap,String tabletype){
ResultRetBZ re = new ResultRetBZ();
//没有对应的表的数据
if(hashMap.size()==0){
logger.error("hashMap.size()==0");
re.setResult(true);
return re;
}
String sql = "";
switch (tabletype) {
case "BFCONTRACT":
sql = "SELECT ID,CODE,STATE_ISENABLED FROM BFCONTRACT WHERE ";
break;
case "BFPROJECTINFO":
sql = "SELECT ID,CODE,STATE_ISENABLED FROM BFPROJECTINFO WHERE ";
break;
case "BFPARTNER":
sql = "SELECT ID,CODE,STATE_ISENABLED FROM BFPARTNER WHERE ";
break;
case "BFJZYWACCOUNT":
sql = "SELECT ID,CODE,ISDISABLED FROM BFJZYWACCOUNT WHERE ";
break;
default:
break;
}
//目前到现在只有三种可能性,只有id没有code,只有code没有id,code和id都有
if(hashMap.size() == 2){
sql = sql+"ID IN ("+" "+hashMap.get("ID")+" "+") AND CODE IN ("+" "+hashMap.get("CODE")+" "+")";
}else {
if(StringUtils.isEmpty(hashMap.get("ID"))){
sql = sql+"CODE IN ("+" "+hashMap.get("CODE")+" "+")";
}else{
sql = sql+"ID IN ("+" "+hashMap.get("ID")+" "+")";
}
}
Query query = entityManager.createNativeQuery(sql);
query.unwrap(SQLQuery.class).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
List<Map<String, Object>> retInfo = query.getResultList();
for (int i = 0; i < retInfo.size(); i++) {
Map<String, Object> stringObjectMap = retInfo.get(i);
switch (tabletype) {
case "BFCONTRACT":
if("0".equals(String.valueOf(stringObjectMap.get("STATE_ISENABLED")))){
re.setResult(false);
re.setMessage("合同编号:"+stringObjectMap.get("CODE")+",合同ID:"+stringObjectMap.get("ID")+",财务云已停用");
logger.error(re.getMessage());
return re;
}
break;
case "BFPROJECTINFO":
if("0".equals(String.valueOf(stringObjectMap.get("STATE_ISENABLED")))){
re.setResult(false);
re.setMessage("项目编号:"+stringObjectMap.get("CODE")+",项目ID:"+stringObjectMap.get("ID")+",财务云已停用");
return re;
}
break;
case "BFPARTNER":
if("0".equals(String.valueOf(stringObjectMap.get("STATE_ISENABLED")))){
re.setResult(false);
re.setMessage("往来单位编号:"+stringObjectMap.get("CODE")+",往来单位D:"+stringObjectMap.get("ID")+",财务云已停用");
return re;
}
break;
case "BFJZYWACCOUNT":
if("0".equals(String.valueOf(stringObjectMap.get("ISDISABLED")))){
re.setResult(false);
re.setMessage("业务科目编号:"+stringObjectMap.get("CODE")+",业务科目ID:"+stringObjectMap.get("ID")+",财务云已停用");
return re;
}
break;
default:
break;
}
}
re.setResult(true);
return re;
}
然后通过不同的入参来进行处理。
问题
后面发现了问题,也就是说我要停用四个我就是要处理四边,调用四次方法,包括数据库查询也是使用四次,然后我就想着要不写在一起试试。
/**
* 根据不同入参判断取值以及塞数
* 进入的参数是HashMap<String,HashMap<String,String>>
* @param hashMap
* @param jsonObjectThis
* @param ZBConfig
* @return
*/
public HashMap<String,HashMap<String,String>> checkContractProjectCorrespondenceUnitBusinessSubjectsDeactivateother(HashMap<String,HashMap<String,String>> hashMap,JSONArray jsonObjectThis,BzzxdrszEntitycccc ZBConfig) {
String sql = "SELECT MBDRSZMX_QZTAB,MBDRSZMX_QZVAL,MBDRSZMX_SRCBH FROM BZZXDRSZMX WHERE MBDRSZMX_PID = ?1 AND MBDRSZMX_QZLX = '0' AND (MBDRSZMX_QZTAB like '%BFCONTRACT%' or MBDRSZMX_QZTAB like '%BFPROJECTINFO%' or MBDRSZMX_QZTAB like '%BFPARTNER%' or MBDRSZMX_QZTAB like '%BFJZYWACCOUNT%')";
Query query = entityManager.createNativeQuery(sql);
query.setParameter(1, ZBConfig.getMbdrszId());
query.unwrap(SQLQuery.class).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
List<Map<String, String>> ZDB = query.getResultList();
for (int j = 0; j < jsonObjectThis.size(); j++) {
JSONObject jsonObject = jsonObjectThis.getJSONObject(j);
for (int i = 0; i < ZDB.size(); i++) {
Map<String, String> map = ZDB.get(i);
String mbdrszmx_qztab = map.get("MBDRSZMX_QZTAB");
if (mbdrszmx_qztab.contains("BFCONTRACT")||mbdrszmx_qztab.contains("bfcontract")) {
HashMap<String, String> bfcontract = new HashMap<>();
//是否存放了BFCONTRACT
if (StringUtils.isEmpty(hashMap.get("BFCONTRACT"))) {
logger.info("StringUtils.isEmpty(hashMap.get(\"BFCONTRACT\"))");
//目前只接受纯大写和纯小写
if (("ID".equals(map.get("MBDRSZMX_QZVAL"))) || ("id".equals(map.get("MBDRSZMX_QZVAL")))) {
logger.info("(\"ID\".equals(map.get(\"MBDRSZMX_QZVAL\"))) || (\"id\".equals(map.get(\"MBDRSZMX_QZVAL\"))");
//如果map里面有值则添加
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
logger.info("null != jsonObject.get(map.get(\"MBDRSZMX_SRCBH\")");
bfcontract.put("ID", "'" + String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH"))) + "'");
}
} else if (("CODE".equals(map.get("MBDRSZMX_QZVAL"))) || ("code".equals(map.get("MBDRSZMX_QZVAL")))) {
logger.info("(\"CODE\".equals(map.get(\"MBDRSZMX_QZVAL\"))) || (\"code\".equals(map.get(\"MBDRSZMX_QZVAL\"))");
//如果map里面有值则添加
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
logger.info("null != jsonObject.get(map.get(\"MBDRSZMX_SRCBH\")");
bfcontract.put("CODE", "'" + String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH"))) + "'");
}
}
} else {
bfcontract = hashMap.get("BFCONTRACT");
logger.info("bfcontract = hashMap.get(\"BFCONTRACT\");");
logger.info(bfcontract.get("ID"));
logger.info(bfcontract.get("CODE"));
if (("ID".equals(map.get("MBDRSZMX_QZVAL"))) || ("id".equals(map.get("MBDRSZMX_QZVAL")))) {
logger.info("(\"ID\".equals(map.get(\"MBDRSZMX_QZVAL\"))) || (\"id\".equals(map.get(\"MBDRSZMX_QZVAL\"))");
logger.info(bfcontract.get("ID"));
logger.info(bfcontract.get("CODE"));
//如果map里面有值则添加
if (!StringUtils.isEmpty(bfcontract.get("ID"))) {
logger.info("!StringUtils.isEmpty(bfcontract.get(\"ID\")");
logger.info(bfcontract.get("ID"));
logger.info(bfcontract.get("CODE"));
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
String id = bfcontract.get("ID");
bfcontract.put("ID", id + "," + "'" + String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH"))) + "'");
logger.info("null != jsonObject.get(map.get(\"MBDRSZMX_SRCBH\"))");
logger.info(bfcontract.get("ID"));
logger.info(bfcontract.get("CODE"));
}
}
//没有则新增
else {
logger.info("null != jsonObject.get(map.get(\"MBDRSZMX_SRCBH\"))else");
logger.info(bfcontract.get("ID"));
logger.info(bfcontract.get("CODE"));
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
bfcontract.put("ID", "'" + String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH"))) + "'");
logger.info("bfcontract.put(\"ID\", \"'\" + String.valueOf(jsonObject.get(map.get(\"MBDRSZMX_SRCBH\"))) + \"'\");");
logger.info(bfcontract.get("ID"));
logger.info(bfcontract.get("CODE"));
}
}
} else if (("CODE".equals(map.get("MBDRSZMX_QZVAL"))) || ("code".equals(map.get("MBDRSZMX_QZVAL")))) {
logger.info("null != jsonObject.get(map.get(\"MBDRSZMX_SRCBH\"))else");
logger.info(bfcontract.get("ID"));
logger.info(bfcontract.get("CODE"));
//如果map里面有值则添加
if (!StringUtils.isEmpty(bfcontract.get("CODE"))) {
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
String id = bfcontract.get("CODE");
bfcontract.put("CODE", id + "," + "'" + String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH"))) + "'");
}
}
//没有则新增
else {
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
bfcontract.put("CODE", "'" + String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH"))) + "'");
}
}
}
}
hashMap.put("BFCONTRACT", bfcontract);
} else if (mbdrszmx_qztab.contains("BFPROJECTINFO")||mbdrszmx_qztab.contains("bfprojectinfo")) {
HashMap<String, String> bfcontract = new HashMap<>();
//是否存放了BFCONTRACT
if (StringUtils.isEmpty(hashMap.get("BFPROJECTINFO"))) {
//目前只接受纯大写和纯小写
if (("ID".equals(map.get("MBDRSZMX_QZVAL"))) || ("id".equals(map.get("MBDRSZMX_QZVAL")))) {
//如果map里面有值则添加
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
bfcontract.put("ID", "'" + String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH"))) + "'");
}
} else if (("CODE".equals(map.get("MBDRSZMX_QZVAL"))) || ("code".equals(map.get("MBDRSZMX_QZVAL")))) {
//如果map里面有值则添加
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
bfcontract.put("CODE", "'" + String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH"))) + "'");
}
}
} else {
bfcontract = hashMap.get("BFPROJECTINFO");
if (("ID".equals(map.get("MBDRSZMX_QZVAL"))) || ("id".equals(map.get("MBDRSZMX_QZVAL")))) {
//如果map里面有值则添加
if (!StringUtils.isEmpty(bfcontract.get("ID"))) {
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
String id = bfcontract.get("ID");
bfcontract.put("ID", id + "," + "'" + String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH"))) + "'");
}
}
//没有则新增
else {
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
bfcontract.put("ID", "'" + String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH"))) + "'");
}
}
} else if (("CODE".equals(map.get("MBDRSZMX_QZVAL"))) || ("code".equals(map.get("MBDRSZMX_QZVAL")))) {
//如果map里面有值则添加
if (!StringUtils.isEmpty(bfcontract.get("CODE"))) {
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
String id = bfcontract.get("CODE");
bfcontract.put("CODE", id + "," + "'" + String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH"))) + "'");
}
}
//没有则新增
else {
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
bfcontract.put("CODE", "'" + String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH"))) + "'");
}
}
}
}
hashMap.put("BFPROJECTINFO", bfcontract);
} else if (mbdrszmx_qztab.contains("BFPARTNER")||mbdrszmx_qztab.contains("bfpartner")) {
HashMap<String, String> bfcontract = new HashMap<>();
//是否存放了BFCONTRACT
if (StringUtils.isEmpty(hashMap.get("BFPARTNER"))) {
//目前只接受纯大写和纯小写
if (("ID".equals(map.get("MBDRSZMX_QZVAL"))) || ("id".equals(map.get("MBDRSZMX_QZVAL")))) {
//如果map里面有值则添加
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
bfcontract.put("ID", "'" + String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH"))) + "'");
}
} else if (("CODE".equals(map.get("MBDRSZMX_QZVAL"))) || ("code".equals(map.get("MBDRSZMX_QZVAL")))) {
//如果map里面有值则添加
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
bfcontract.put("CODE", "'" + String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH"))) + "'");
}
}
} else {
bfcontract = hashMap.get("BFPARTNER");
if (("ID".equals(map.get("MBDRSZMX_QZVAL"))) || ("id".equals(map.get("MBDRSZMX_QZVAL")))) {
//如果map里面有值则添加
if (!StringUtils.isEmpty(bfcontract.get("ID"))) {
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
String id = bfcontract.get("ID");
bfcontract.put("ID", id + "," + "'" + String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH"))) + "'");
}
}
//没有则新增
else {
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
bfcontract.put("ID", "'" + String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH"))) + "'");
}
}
} else if (("CODE".equals(map.get("MBDRSZMX_QZVAL"))) || ("code".equals(map.get("MBDRSZMX_QZVAL")))) {
//如果map里面有值则添加
if (!StringUtils.isEmpty(bfcontract.get("CODE"))) {
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
String id = bfcontract.get("CODE");
bfcontract.put("CODE", id + "," + "'" + String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH"))) + "'");
}
}
//没有则新增
else {
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
bfcontract.put("CODE", "'" + String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH"))) + "'");
}
}
}
}
hashMap.put("BFPARTNER", bfcontract);
} else if (mbdrszmx_qztab.contains("BFJZYWACCOUNT")||mbdrszmx_qztab.contains("bfjzywaccount")) {
HashMap<String, String> bfcontract = new HashMap<>();
//是否存放了BFCONTRACT
if (StringUtils.isEmpty(hashMap.get("BFJZYWACCOUNT"))) {
//目前只接受纯大写和纯小写
if (("ID".equals(map.get("MBDRSZMX_QZVAL"))) || ("id".equals(map.get("MBDRSZMX_QZVAL")))) {
//如果map里面有值则添加
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
bfcontract.put("ID", "'" + String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH"))) + "'");
}
} else if (("CODE".equals(map.get("MBDRSZMX_QZVAL"))) || ("code".equals(map.get("MBDRSZMX_QZVAL")))) {
//如果map里面有值则添加
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
bfcontract.put("CODE", "'" + String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH"))) + "'");
}
}
} else {
bfcontract = hashMap.get("BFJZYWACCOUNT");
if (("ID".equals(map.get("MBDRSZMX_QZVAL"))) || ("id".equals(map.get("MBDRSZMX_QZVAL")))) {
//如果map里面有值则添加
if (!StringUtils.isEmpty(bfcontract.get("ID"))) {
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
String id = bfcontract.get("ID");
bfcontract.put("ID", id + "," + "'" + String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH"))) + "'");
}
}
//没有则新增
else {
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
bfcontract.put("ID", "'" + String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH"))) + "'");
}
}
} else if (("CODE".equals(map.get("MBDRSZMX_QZVAL"))) || ("code".equals(map.get("MBDRSZMX_QZVAL")))) {
//如果map里面有值则添加
if (!StringUtils.isEmpty(bfcontract.get("CODE"))) {
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
String id = bfcontract.get("CODE");
bfcontract.put("CODE", id + "," + "'" + String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH"))) + "'");
}
}
//没有则新增
else {
if (null != jsonObject.get(map.get("MBDRSZMX_SRCBH"))) {
bfcontract.put("CODE", "'" + String.valueOf(jsonObject.get(map.get("MBDRSZMX_SRCBH"))) + "'");
}
}
}
}
hashMap.put("BFJZYWACCOUNT", bfcontract);
}
}
}
return hashMap;
}
public ResultRetBZ judgeDeactivateOther(HashMap<String,HashMap<String,String>> hashMap){
ResultRetBZ re = new ResultRetBZ();
//没有对应的表的数据
if(hashMap.size()==0){
logger.error("hashMap.size()==0");
re.setResult(true);
return re;
}
for(String key : hashMap.keySet()){
HashMap<String, String> stringStringHashMap = hashMap.get(key);
String sql = "";
switch (key) {
case "BFCONTRACT":
sql = "SELECT ID,CODE,STATE_ISENABLED FROM BFCONTRACT WHERE ";
break;
case "BFPROJECTINFO":
sql = "SELECT ID,CODE,STATE_ISENABLED FROM BFPROJECTINFO WHERE ";
break;
case "BFPARTNER":
sql = "SELECT ID,CODE,STATE_ISENABLED FROM BFPARTNER WHERE ";
break;
case "BFJZYWACCOUNT":
sql = "SELECT ID,CODE,ISDISABLED FROM BFJZYWACCOUNT WHERE ";
break;
default:
break;
}
//目前到现在只有三种可能性,只有id没有code,只有code没有id,code和id都有
if(stringStringHashMap.size() == 2){
sql = sql+"ID IN ("+" "+stringStringHashMap.get("ID")+" "+") AND CODE IN ("+" "+stringStringHashMap.get("CODE")+" "+")";
}else {
if(StringUtils.isEmpty(stringStringHashMap.get("ID"))){
sql = sql+"CODE IN ("+" "+stringStringHashMap.get("CODE")+" "+")";
}else{
sql = sql+"ID IN ("+" "+stringStringHashMap.get("ID")+" "+")";
}
}
Query query = entityManager.createNativeQuery(sql);
query.unwrap(SQLQuery.class).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
List<Map<String, Object>> retInfo = query.getResultList();
for (int i = 0; i < retInfo.size(); i++) {
Map<String, Object> stringObjectMap = retInfo.get(i);
switch (key) {
case "BFCONTRACT":
if("0".equals(String.valueOf(stringObjectMap.get("STATE_ISENABLED")))){
re.setResult(false);
re.setMessage("合同编号:"+stringObjectMap.get("CODE")+",合同ID:"+stringObjectMap.get("ID")+",财务云已停用");
logger.error(re.getMessage());
return re;
}
break;
case "BFPROJECTINFO":
if("0".equals(String.valueOf(stringObjectMap.get("STATE_ISENABLED")))){
re.setResult(false);
re.setMessage("项目编号:"+stringObjectMap.get("CODE")+",项目ID:"+stringObjectMap.get("ID")+",财务云已停用");
return re;
}
break;
case "BFPARTNER":
if("0".equals(String.valueOf(stringObjectMap.get("STATE_ISENABLED")))){
re.setResult(false);
re.setMessage("往来单位编号:"+stringObjectMap.get("CODE")+",往来单位D:"+stringObjectMap.get("ID")+",财务云已停用");
return re;
}
break;
case "BFJZYWACCOUNT":
if("0".equals(String.valueOf(stringObjectMap.get("ISDISABLED")))){
re.setResult(false);
re.setMessage("业务科目编号:"+stringObjectMap.get("CODE")+",业务科目ID:"+stringObjectMap.get("ID")+",财务云已停用");
return re;
}
break;
default:
break;
}
}
}
re.setResult(true);
return re;
}
虽然代码复用功能凉凉,但是感觉性能感觉提升了,访问数据库的次数减少了。