|
@@ -16,9 +16,12 @@ import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.factory.entity.PcBladeSalesForecastSummary;
|
|
|
import org.springblade.factory.entity.PjpfBrandDesc;
|
|
|
import org.springblade.factory.entity.PjpfStockDesc;
|
|
|
+import org.springblade.factory.entity.ViewCustomerSel;
|
|
|
import org.springblade.factory.service.PcBladeSalesForecastSummaryService;
|
|
|
import org.springblade.factory.service.PjpfBrandDescService;
|
|
|
import org.springblade.factory.service.PjpfStockDescService;
|
|
|
+import org.springblade.factory.service.ZcrmViewCustomerSelService;
|
|
|
+import org.springblade.u9cloud.entity.ZcrmViewCustomerSel;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
import springfox.documentation.annotations.ApiIgnore;
|
|
@@ -29,6 +32,7 @@ import java.time.LocalDate;
|
|
|
import java.time.format.DateTimeParseException;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
* 销售预测接口 控制器
|
|
@@ -44,6 +48,8 @@ public class SalesForecastSummaryController {
|
|
|
/* ========== 经销商提报 ========== */
|
|
|
private final PcBladeSalesForecastSummaryService forecastService;
|
|
|
|
|
|
+ private final ZcrmViewCustomerSelService customerSelService;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 销售预测汇总列表
|
|
@@ -190,6 +196,9 @@ public class SalesForecastSummaryController {
|
|
|
public R<String> addForecastSummarySubmit(@RequestBody PcBladeSalesForecastSummary forecast) {
|
|
|
// 设置当前登录用户ID作为经销商ID
|
|
|
forecast.setCustomerId(AuthUtil.getUserId());
|
|
|
+ ViewCustomerSel zcrmViewCustomerSel = customerSelService.selectZcrmViewCustomerSelByCustomerId(forecast.getCustomerId());
|
|
|
+ forecast.setCustomerCode(zcrmViewCustomerSel.getCustomerCode());
|
|
|
+ forecast.setCustomerName(zcrmViewCustomerSel.getCustomerName());
|
|
|
return forecastService.saveOrUpdateForecast(forecast);
|
|
|
}
|
|
|
|
|
@@ -199,6 +208,11 @@ public class SalesForecastSummaryController {
|
|
|
@PostMapping("/update")
|
|
|
public R<String> updateForecastSummarySubmit(@RequestBody PcBladeSalesForecastSummary forecast) {
|
|
|
// 验证权限,确保只能修改自己的预测数据
|
|
|
+
|
|
|
+ if (!Objects.equals(forecast.getCustomerId(), AuthUtil.getUserId())) {
|
|
|
+ return R.data("非法操作ID不一致");
|
|
|
+ }
|
|
|
+
|
|
|
if (forecast.getCustomerId() == null) {
|
|
|
forecast.setCustomerId(AuthUtil.getUserId());
|
|
|
}
|
|
@@ -214,6 +228,9 @@ public class SalesForecastSummaryController {
|
|
|
Long customerId = AuthUtil.getUserId();
|
|
|
for (PcBladeSalesForecastSummary forecast : forecasts) {
|
|
|
forecast.setCustomerId(customerId);
|
|
|
+ ViewCustomerSel zcrmViewCustomerSel = customerSelService.selectZcrmViewCustomerSelByCustomerId(forecast.getCustomerId());
|
|
|
+ forecast.setCustomerCode(zcrmViewCustomerSel.getCustomerCode());
|
|
|
+ forecast.setCustomerName(zcrmViewCustomerSel.getCustomerName());
|
|
|
}
|
|
|
return forecastService.batchSaveOrUpdateForecasts(forecasts);
|
|
|
}
|