Author SHA1 Message Date
xu_lw 54ba97dc42 支持RequestParam、RequestBody 2019-09-10 15:20:57 +08:00
xu_lw e353a6986a 修改数据字典 2019-09-10 13:07:35 +08:00
3 changed files with 56 additions and 19 deletions
+10 -11
View File
@@ -14,7 +14,7 @@ var storage = {
}
const dict = {
flag: false,
flags: [],
formatter: function(row, column, cellValue, index) {
if (cellValue == null || cellValue === '') {
return ''
@@ -24,7 +24,7 @@ const dict = {
name = column.property
}
let data = storage.get(name)
console.log('data1:' + data)
// console.log('data1:' + name + '=' + data)
if (!data) {
dict.getHlpData(name)
@@ -34,7 +34,7 @@ const dict = {
if (!data.hasOwnProperty(cellValue)) {
return cellValue
}
console.log('data2:' + data[cellValue])
// console.log('data2:' + name + '=' + data[cellValue])
return data[cellValue]
},
@@ -45,15 +45,15 @@ const dict = {
}
let data2 = []
for (var key in data) {
data2.push({value: key, label: data[key]})
data2.push({ value: key, label: data[key] })
}
return data2
},
getHlpData: function(name) {
if (dict.flag) {
if (dict.flags[name]) {
return
}
dict.flag = true
dict.flags[name] = true
if (storage.get(name)) {
return
@@ -63,10 +63,10 @@ const dict = {
url: httpRequest.adornUrl('/buipubbpc1/buiHlpQueryByName.do'),
method: 'get',
params: httpRequest.adornParams({
'name': name
name: name
})
}).then(({data}) => {
dict.flag = false
}).then(({ data }) => {
dict.flags[name] = false
if (isGDASucc(data)) {
if (data.data) {
let data1 = {}
@@ -88,7 +88,6 @@ const dict = {
remove: function(name) {
storage.remove(name)
}
}
export default dict
export default dict
@@ -12,13 +12,19 @@ import com.yuangou.ecp.bp.core.common.message.YGBizMessageContext;
import com.yuangou.ecp.bp.core.common.message.YGEDB;
import com.yuangou.ecp.bp.core.common.yglog4j.Logger;
import com.yuangou.ecp.bp.core.common.yglog4j.YGLogger;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.reflect.MethodUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.lang.reflect.UndeclaredThrowableException;
import java.util.ArrayList;
import java.util.List;
/**
@@ -54,9 +60,39 @@ public abstract class BaseAction extends AbstractTransaction {
if( types.length == 1 ) {
resultT = (ResultT) MethodUtils.invokeMethod(bean, methodName, new Object[] {bizCtx});
} else {
obj = ((Class) types[1]).newInstance();
EDBUtil.edb2objNam(root, obj);
resultT = (ResultT) MethodUtils.invokeMethod(bean, methodName, new Object[] {bizCtx, obj});
List params = new ArrayList();
params.add(bizCtx);
Annotation[][] parameterAnnotations = method.getParameterAnnotations();
int i = 1;
for( int j = 0; parameterAnnotations != null && j < parameterAnnotations.length; j++ ) {
Annotation[] parameterAnnotation = parameterAnnotations[j];
for (Annotation annotation : parameterAnnotation) {
if (annotation instanceof RequestParam) {
RequestParam param = (RequestParam) annotation;
String value = root.getData(param.value());
// if(value ==null ) {
// value = param.defaultValue();
// }
if( value == null && param.required() ){
throw new IllegalArgumentException(param.name() + " is required");
}
params.add(value);
} else if( annotation instanceof RequestBody ) {
obj = ((Class) types[1]).newInstance();
EDBUtil.edb2objNam(root, obj);
params.add(obj);
}
}
}
if( params.size() == 1 ) {
obj = ((Class) types[1]).newInstance();
EDBUtil.edb2objNam(root, obj);
params.add(obj);
}
resultT = (ResultT) MethodUtils.invokeMethod(bean, methodName, params.toArray());
}
// root = YGEDBFactory.createEDB();
@@ -16,6 +16,7 @@ import com.yuangou.ecp.bp.core.common.yglog4j.YGLogger;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;
/**
* 系统配置信息表管理服务
@@ -30,18 +31,19 @@ public class BuiConfigDeleteAction extends BaseAction {
* 删除记录
*
* @param bizCtx
* @param reqBO
* @param ids
* @return
* @throws YGException
*/
public ResultT execute(YGBizMessageContext bizCtx, BuiConfigDeleteReqBO reqBO) throws YGException {
public ResultT execute(YGBizMessageContext bizCtx, @RequestParam("ids") String ids) throws YGException {
YGBizMessage bizMsg = bizCtx.getCurrentMsg();
Logger msgLog = YGLogger.getLogger(bizMsg);
msgLog.info("delete, reqBO=" + JSONObject.toJSON(reqBO));
// msgLog.info("delete, reqBO=" + JSONObject.toJSON(reqBO));
msgLog.info("delete, reqBO=" + ids);
ValidatorUtil.validateObject(reqBO);
// ValidatorUtil.validateObject(reqBO);
int retCod = buiConfigMapper.deleteByPrimaryKey(reqBO.getIds());
int retCod = buiConfigMapper.deleteByPrimaryKey(ids);
ResultT resultT = new ResultT();
if (retCod > 0) {