|
@@ -115,26 +115,30 @@ public class PlannerAction {
|
|
@SuppressWarnings("unchecked")
|
|
@SuppressWarnings("unchecked")
|
|
Integer user_id = ValidationUtil.checkAndAssignInt(req.getHeader("Authorization").split("&")[1]);
|
|
Integer user_id = ValidationUtil.checkAndAssignInt(req.getHeader("Authorization").split("&")[1]);
|
|
userAuthoricationService.queryUserAuthority(user_id, Roles.ADMIN);
|
|
userAuthoricationService.queryUserAuthority(user_id, Roles.ADMIN);
|
|
- Integer plannerId = ValidationUtil.checkAndAssignInt(pp.getPlannerId());//得到计划员id
|
|
|
|
- plannerService.deleteBeforeSupplierByUserId(plannerId);//(前端传来的计划员id)根据计划员id先删除之前所对应的供应商
|
|
|
|
-
|
|
|
|
- String supplierId = ValidationUtil.checkNullAndAssignString(pp.getSupplierId());//得到挪动得供应商id
|
|
|
|
- //System.out.println(pp.getSupplierId());
|
|
|
|
- String[] str=supplierId.split(",");
|
|
|
|
|
|
+ Integer plannerId = ValidationUtil.checkAndAssignInt(pp.getPlannerId());//得到前端传来的计划员id
|
|
|
|
+
|
|
|
|
+ if(pp.getSupplierId().equals("")) {//如果传过来得到的供应商是空的 (点击配置后,什么操作都没做) 就报异常 不让删除原先得供应商
|
|
|
|
+ throw new RuntimeException("操作异常");
|
|
|
|
+
|
|
|
|
+ }else {//否则就做先删除原先得 在添加新得到id做插入操作
|
|
|
|
+ plannerService.deleteBeforeSupplierByUserId(plannerId);//(前端传来的计划员id)根据计划员id先删除之前所对应的供应商
|
|
|
|
+ plannerService.insertAgainSupplier(pp);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //String supplierId = ValidationUtil.checkNullAndAssignString(pp.getSupplierId());//得到挪动得供应商id 要以逗号隔开传过来
|
|
|
|
+ /*String[] str=supplierId.split(",");
|
|
for (int i = 0; i < str.length; i++) {
|
|
for (int i = 0; i < str.length; i++) {
|
|
//System.out.println(str.length);
|
|
//System.out.println(str.length);
|
|
//System.out.println(str[i]);
|
|
//System.out.println(str[i]);
|
|
- //plannerService.insertAgainSupplier(pp));
|
|
|
|
pp.setSupplierId(str[i]);
|
|
pp.setSupplierId(str[i]);
|
|
plannerService.insertAgainSupplier(pp);
|
|
plannerService.insertAgainSupplier(pp);
|
|
- }
|
|
|
|
- //System.out.println(str+"aaaaa66666666666");
|
|
|
|
|
|
+ }*/
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
- return JSONUtil.getJsonMap(200, true, "插入成功",str);
|
|
|
|
|
|
+ return JSONUtil.getJsonMap(200, true, HintMSG.OPERATION_SUCCESS,pp);//待
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- e.printStackTrace();
|
|
|
|
- return JSONUtil.getJsonMap(500, false, "插入失败:"+e.getMessage(), null);
|
|
|
|
|
|
+ return JSONUtil.getJsonMap(500, false, HintMSG.OPERATION_FAIL+":"+e.getMessage(), null);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|