瀏覽代碼

房间设置-销售目标设置(统计未处理)

WIN-B904R0U0NNS\Administrator 2 年之前
父節點
當前提交
fc3feb0fa3

+ 36 - 4
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusMarketObjectiveController.java

@@ -1,10 +1,7 @@
 package org.jeecg.modules.business.controller;
 
 import java.text.SimpleDateFormat;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
@@ -14,6 +11,8 @@ import javax.servlet.http.HttpServletResponse;
 
 import io.netty.util.internal.StringUtil;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.constant.CommonConstant;
+import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
@@ -111,6 +110,39 @@ public class BusMarketObjectiveController extends JeecgController<BusMarketObjec
 		return Result.OK("编辑成功!");
 	}
 
+	 /**
+	  *   批量添加或修改
+	  *
+	  * @param busMarketObjectives
+	  * @return
+	  */
+	 @AutoLog(value = "销售目标-批量添加或修改")
+	 @ApiOperation(value="销售目标-批量添加或修改", notes="销售目标-批量添加或修改")
+	 //@RequiresPermissions("business:bus_market_objective_info:add")
+	 @PostMapping(value = "/batchAddOrUpdate")
+	 public Result<String> batchAddOrUpdate(@RequestBody List<BusMarketObjective> busMarketObjectives) {
+		 BusMarketObjective firstModel = busMarketObjectives.get(0);
+		 LoginUser user = TokenUtils.getAuthUser();
+		 if(user.getRelTenantIds() != null && !user.getRelTenantIds().equals("")){
+		 } else {
+			 throw new JeecgBootException("当前登录人租户信息错误");
+		 }
+		 List<BusMarketObjective> newData = new ArrayList<>();
+	 	if (firstModel.getId() != null && !firstModel.getId().equals("")){
+			//修改
+			busMarketObjectiveService.updateBatchById(busMarketObjectives);
+		}else{
+			//添加
+			busMarketObjectives.forEach(item->{
+				item.setTenantId(user.getRelTenantIds());
+				item.setDelFlag(CommonConstant.DEL_FLAG_0);
+				newData.add(item);
+			});
+			busMarketObjectiveService.saveBatch(newData);
+		}
+		 return Result.OK("添加成功!");
+	 }
+
 	/**
 	 *   通过id删除
 	 *