diff --git a/src/main/java/com/weaver/seconddev/jcldoor/controller/HrmSelfHelpController.java b/src/main/java/com/weaver/seconddev/jcldoor/controller/HrmSelfHelpController.java index 3433070..e1cd822 100644 --- a/src/main/java/com/weaver/seconddev/jcldoor/controller/HrmSelfHelpController.java +++ b/src/main/java/com/weaver/seconddev/jcldoor/controller/HrmSelfHelpController.java @@ -1273,7 +1273,7 @@ public class HrmSelfHelpController { public WeaResult testSapi8(HttpServletRequest request){ //com.weaver.workrelate.performance.api.rest.RemotePerformanceService#queryFlowData - + log.error("testSapi8"); String groupId = "weaver-ebuilder-form-service"; String sourceType = "LOGIC"; SimpleEmployee employee = UserContext.getCurrentUser(); @@ -1289,6 +1289,7 @@ public class HrmSelfHelpController { JSONObject actionMsg = dataJson.getJSONObject("actionMsg"); if(actionMsg.containsKey("code")){ String code = actionMsg.getString("code"); + log.error("code:"+code); if("0".equals(code)){ JSONObject dataObject = dataJson.getJSONObject("data"); if(dataObject.containsKey("data")){ @@ -1297,27 +1298,29 @@ public class HrmSelfHelpController { JSONObject dataInfo = dataArray.getJSONObject(i); String userid = dataInfo.getString("userid"); String amount = dataInfo.getString("amount"); - - String sql = " select id from "+tablename+" where ry=? and tenant_key=? and delete_type=0 "; - List sqlparam = new ArrayList(); - SqlParamEntity sqlParamEntity = new SqlParamEntity(); - sqlParamEntity.setParamType(SqlParamType.VARCHAR); - sqlParamEntity.setValue(userid+""); - sqlparam.add(sqlParamEntity); - - sqlParamEntity = new SqlParamEntity(); - sqlParamEntity.setParamType(SqlParamType.VARCHAR); - sqlParamEntity.setValue(tenant_key+""); - sqlparam.add(sqlParamEntity); - - Map result = databaseUtils.execute(sourceType, groupId, sql); - List> recordList = databaseUtils.getDataSourceList(result); - if(!recordList.isEmpty()){ - jucailinPortalUtils.updateChatDayDate(userid,amount,sourceType,groupId,tenant_key,tablename); - }else{ - jucailinPortalUtils.insertChatDayDate(userid,amount,employeeId,sourceType,groupId,tenant_key,tablename); + if(StringUtils.isNotBlank(userid) && StringUtils.isNotBlank(amount)){ + String sql = " select id from "+tablename+" where ry=? and tenant_key=? and delete_type=0 "; + List sqlparam = new ArrayList(); + SqlParamEntity sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(userid+""); + sqlparam.add(sqlParamEntity); + + sqlParamEntity = new SqlParamEntity(); + sqlParamEntity.setParamType(SqlParamType.VARCHAR); + sqlParamEntity.setValue(tenant_key+""); + sqlparam.add(sqlParamEntity); + + Map result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam); + List> recordList = databaseUtils.getDataSourceList(result); + if(!recordList.isEmpty()){ + log.error("!recordList.isEmpty()"); + jucailinPortalUtils.updateChatDayDate(userid,amount,sourceType,groupId,tenant_key,tablename); + }else{ + log.error("recordList.isEmpty()"); + jucailinPortalUtils.insertChatDayDate(userid,amount,employeeId,sourceType,groupId,tenant_key,tablename); + } } - } } } @@ -1335,6 +1338,7 @@ public class HrmSelfHelpController { //com.weaver.workrelate.performance.api.rest.RemotePerformanceService#queryFlowData + log.error("testSapi9"); String groupId = "weaver-ebuilder-form-service"; String sourceType = "LOGIC"; SimpleEmployee employee = UserContext.getCurrentUser(); @@ -1350,6 +1354,7 @@ public class HrmSelfHelpController { JSONObject actionMsg = dataJson.getJSONObject("actionMsg"); if(actionMsg.containsKey("code")){ String code = actionMsg.getString("code"); + log.error("testSapi9-code:"+code); if("0".equals(code)){ JSONObject dataObject = dataJson.getJSONObject("data"); if(dataObject.containsKey("data")){ @@ -1358,26 +1363,22 @@ public class HrmSelfHelpController { JSONObject dataInfo = dataArray.getJSONObject(i); String userid = dataInfo.getString("userid"); String amount = dataInfo.getString("amount"); - - String sql = " select id from "+tablename+" where ry=? and tenant_key=? and delete_type=0 "; - List sqlparam = new ArrayList(); - SqlParamEntity sqlParamEntity = new SqlParamEntity(); - sqlParamEntity.setParamType(SqlParamType.VARCHAR); - sqlParamEntity.setValue(userid+""); - sqlparam.add(sqlParamEntity); - - sqlParamEntity = new SqlParamEntity(); - sqlParamEntity.setParamType(SqlParamType.VARCHAR); - sqlParamEntity.setValue(tenant_key+""); - sqlparam.add(sqlParamEntity); - - Map result = databaseUtils.execute(sourceType, groupId, sql); - List> recordList = databaseUtils.getDataSourceList(result); - if(!recordList.isEmpty()){ - jucailinPortalUtils.updateChatDayDate(userid,amount,sourceType,groupId,tenant_key,tablename); - }else{ - jucailinPortalUtils.insertChatDayDate(userid,amount,employeeId,sourceType,groupId,tenant_key,tablename); + log.error("userid:"+userid); + log.error("amount:"+amount); + + if(StringUtils.isNotBlank(userid) && StringUtils.isNotBlank(amount)){ + String sql = " select id from "+tablename+" where ry='"+userid+"' and tenant_key='"+tenant_key+"' and delete_type=0 "; + log.error("sql:"+sql); + + Map result = databaseUtils.execute(sourceType, groupId, sql); + List> recordList = databaseUtils.getDataSourceList(result); + if(!recordList.isEmpty()){ + jucailinPortalUtils.updateChatDayDate(userid,amount,sourceType,groupId,tenant_key,tablename); + }else{ + jucailinPortalUtils.insertChatDayDate(userid,amount,employeeId,sourceType,groupId,tenant_key,tablename); + } } + } } } diff --git a/src/main/java/com/weaver/seconddev/jcldoor/util/JucailinPortalUtils.java b/src/main/java/com/weaver/seconddev/jcldoor/util/JucailinPortalUtils.java index 572337a..4f2ef13 100644 --- a/src/main/java/com/weaver/seconddev/jcldoor/util/JucailinPortalUtils.java +++ b/src/main/java/com/weaver/seconddev/jcldoor/util/JucailinPortalUtils.java @@ -230,7 +230,7 @@ public class JucailinPortalUtils { sqlParamEntity.setValue(tenant_key+""); sqlparam.add(sqlParamEntity); - Map result = databaseUtils.execute(sourceType, groupId, sql); + Map result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam); List> recordList = databaseUtils.getDataSourceList(result); if(!recordList.isEmpty()){ updateChatGroupDate(userid,amount,sourceType,groupId,tenant_key,tablename); @@ -473,7 +473,7 @@ public class JucailinPortalUtils { sqlParamEntity.setValue(tenant_key+""); sqlparam.add(sqlParamEntity); - Map result = databaseUtils.execute(sourceType, groupId, sql); + Map result = databaseUtils.executeForQuery(sourceType, groupId, sql,sqlparam); List> recordList = databaseUtils.getDataSourceList(result); if(!recordList.isEmpty()){ updateChatDayDate(userid,amount,sourceType,groupId,tenant_key,tablename); @@ -508,6 +508,7 @@ public class JucailinPortalUtils { long generate = IdGenerator.generate(); String sql =" insert into "+tablename+"(id,ry,amount,form_data_id,data_index,create_time,update_time,tenant_key,is_delete,creator,delete_type) " + " values (" + generate + "," + userid + ",'"+amount+"'," + generate + ",0,now(),now(),'"+tenant_key+"'," + Character.MIN_VALUE + "," + employeeId + "," + Character.MIN_VALUE + ")"; + log.error("insertChatDayDate-sql:"+sql); Map result = databaseUtils.execute(sourceType, groupId, sql); Iterator> iterator = result.entrySet().iterator(); @@ -540,6 +541,8 @@ public class JucailinPortalUtils { public void updateChatDayDate(String userid,String amount,String sourceType,String groupId,String tenant_key,String tablename){ try { String sql =" update "+tablename+" set amount=?,update_time=now() where ry = ? and tenant_key= ? and delete_type=0 "; + log.error("updateChatDayDate-sql:"+sql); + List sqlparam = new ArrayList(); SqlParamEntity sqlParamEntity = new SqlParamEntity(); sqlParamEntity.setParamType(SqlParamType.VARCHAR);