注掉部分超哥代码 使程序先跑起来
This commit is contained in:
+5
-5
@@ -77,11 +77,11 @@ public class SarStandardsInfoController extends BaseController<SarStandardsInfo>
|
||||
@Autowired
|
||||
ISarLawsInfoService sarLawsInfoEOService;
|
||||
|
||||
@ApiOperation(value="SarStandardsInfoEO|反向标准操作")
|
||||
@GetMapping(value = "/reverseQueryStand")
|
||||
public void reverseQueryStand(@RequestParam(name="ids",required=true) String ids, String standName, String type) {
|
||||
this.sarStandardsInfoEOService.reverseQueryStand(Arrays.asList(ids.split(",")),standName,type);
|
||||
}
|
||||
// @ApiOperation(value="SarStandardsInfoEO|反向标准操作")
|
||||
// @GetMapping(value = "/reverseQueryStand")
|
||||
// public void reverseQueryStand(@RequestParam(name="ids",required=true) String ids, String standName, String type) {
|
||||
// this.sarStandardsInfoEOService.reverseQueryStand(Arrays.asList(ids.split(",")),standName,type);
|
||||
// }
|
||||
|
||||
@ApiOperation(value = "|SarStandardsInfoEO|自定义分页查询")
|
||||
@GetMapping("/getSarStandardsInfoPage")
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import java.util.Map;
|
||||
*/
|
||||
public interface ISarStandardsInfoService extends IService<SarStandardsInfo> {
|
||||
|
||||
void reverseQueryStand(List<String> ids, String standName,String type);
|
||||
// void reverseQueryStand(List<String> ids, String standName,String type);
|
||||
|
||||
List<SarStandardsInfo> getSarStandardsInfoPage(SarStandardsInfoEOPage page) throws Exception;
|
||||
|
||||
|
||||
+53
-53
@@ -194,59 +194,59 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
|
||||
@Autowired
|
||||
private StandLawsSearchService standLawsSearchService;
|
||||
|
||||
/**
|
||||
* 反向操作标准
|
||||
*/
|
||||
@Override
|
||||
@Async
|
||||
public void reverseQueryStand(List<String> ids, String standName,String type){
|
||||
String fieldInfo = InitStandAttrUtil.queryField;
|
||||
if (StringUtils.isNotBlank(fieldInfo) && StringUtils.isNotBlank(type)) {
|
||||
List<Map<String, Object>> getAttrListMap = sarStandAttrInfoEODao.selectStandFieldAndDataListMap(fieldInfo, ids);
|
||||
getAttrListMap.forEach(attrMap -> {
|
||||
List<String> list = Collections.singletonList(attrMap.get(type).toString());
|
||||
list.add(standName);
|
||||
String reverseStandName = list.stream().map(String::toString).collect(Collectors.joining(","));
|
||||
attrMap.put(type,reverseStandName);
|
||||
SarStandAttrInfo sarStandAttrInfo = map2Object(attrMap,SarStandAttrInfo.class);
|
||||
sarStandAttrInfoEODao.updateById(sarStandAttrInfo);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T map2Object(Map<String, Object> map, Class<T> clazz) {
|
||||
|
||||
T obj = null;
|
||||
try {
|
||||
BeanInfo bean = Introspector.getBeanInfo(clazz);
|
||||
PropertyDescriptor[] propertyDescriptorArr = bean.getPropertyDescriptors();
|
||||
for (int i = 0; i < propertyDescriptorArr.length; i++) {
|
||||
PropertyDescriptor propertyDescriptor = propertyDescriptorArr[i];
|
||||
String name = propertyDescriptor.getName();
|
||||
if(map.containsKey(name)) {
|
||||
Object value = map.get(name);
|
||||
if("null".equals(value)) {
|
||||
value = null;
|
||||
}
|
||||
Object[] objArr = new Object[0];
|
||||
objArr[0] = value;
|
||||
try {
|
||||
propertyDescriptor.getWriteMethod().invoke(obj, objArr);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (IntrospectionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
// /**
|
||||
// * 反向操作标准
|
||||
// */
|
||||
// @Override
|
||||
// @Async
|
||||
// public void reverseQueryStand(List<String> ids, String standName,String type){
|
||||
// String fieldInfo = InitStandAttrUtil.queryField;
|
||||
// if (StringUtils.isNotBlank(fieldInfo) && StringUtils.isNotBlank(type)) {
|
||||
// List<Map<String, Object>> getAttrListMap = sarStandAttrInfoEODao.selectStandFieldAndDataListMap(fieldInfo, ids);
|
||||
// getAttrListMap.forEach(attrMap -> {
|
||||
// List<String> list = Collections.singletonList(attrMap.get(type).toString());
|
||||
// list.add(standName);
|
||||
// String reverseStandName = list.stream().map(String::toString).collect(Collectors.joining(","));
|
||||
// attrMap.put(type,reverseStandName);
|
||||
// SarStandAttrInfo sarStandAttrInfo = map2Object(attrMap,SarStandAttrInfo.class);
|
||||
// sarStandAttrInfoEODao.updateById(sarStandAttrInfo);
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static <T> T map2Object(Map<String, Object> map, Class<T> clazz) {
|
||||
//
|
||||
// T obj = null;
|
||||
// try {
|
||||
// BeanInfo bean = Introspector.getBeanInfo(clazz);
|
||||
// PropertyDescriptor[] propertyDescriptorArr = bean.getPropertyDescriptors();
|
||||
// for (int i = 0; i < propertyDescriptorArr.length; i++) {
|
||||
// PropertyDescriptor propertyDescriptor = propertyDescriptorArr[i];
|
||||
// String name = propertyDescriptor.getName();
|
||||
// if(map.containsKey(name)) {
|
||||
// Object value = map.get(name);
|
||||
// if("null".equals(value)) {
|
||||
// value = null;
|
||||
// }
|
||||
// Object[] objArr = new Object[0];
|
||||
// objArr[0] = value;
|
||||
// try {
|
||||
// propertyDescriptor.getWriteMethod().invoke(obj, objArr);
|
||||
// } catch (IllegalAccessException e) {
|
||||
// e.printStackTrace();
|
||||
// } catch (IllegalArgumentException e) {
|
||||
// e.printStackTrace();
|
||||
// } catch (InvocationTargetException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// } catch (IntrospectionException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return obj;
|
||||
// }
|
||||
|
||||
|
||||
/***
|
||||
|
||||
Reference in New Issue
Block a user