|
@@ -18,6 +18,7 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.fuzamei.constant.HintMSG;
|
|
|
import com.fuzamei.constant.Role;
|
|
|
import com.fuzamei.constant.Roles;
|
|
|
+import com.fuzamei.entity.PlannerSupplier;
|
|
|
import com.fuzamei.entity.User;
|
|
|
import com.fuzamei.service.PlannerService;
|
|
|
import com.fuzamei.service.UserAuthoricationService;
|
|
@@ -103,6 +104,40 @@ public class PlannerAction {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 配置供应商后 点击提交完 再次插入供应商到中间表
|
|
|
+ * @param data
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value="inserAginSupplierList")
|
|
|
+ public Map<String, Object> inserAginSupplierList(@RequestBody PlannerSupplier pp){
|
|
|
+ try {
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ Integer user_id = ValidationUtil.checkAndAssignInt(req.getHeader("Authorization").split("&")[1]);
|
|
|
+ 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(",");
|
|
|
+ for (int i = 0; i < str.length; i++) {
|
|
|
+ //System.out.println(str.length);
|
|
|
+ //System.out.println(str[i]);
|
|
|
+ //plannerService.insertAgainSupplier(pp));
|
|
|
+ pp.setSupplierId(str[i]);
|
|
|
+ plannerService.insertAgainSupplier(pp);
|
|
|
+ }
|
|
|
+ //System.out.println(str+"aaaaa66666666666");
|
|
|
+
|
|
|
+
|
|
|
+ return JSONUtil.getJsonMap(200, true, "插入成功",str);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return JSONUtil.getJsonMap(500, false, "插入失败:"+e.getMessage(), null);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|