Browse Source

修改经销商端预测列表数据获取

zdd 3 months ago
parent
commit
2f4aef77eb

+ 17 - 4
blade-service/blade-factory/src/main/java/org/springblade/factory/api/controller/SalesForecastSummaryController.java

@@ -19,7 +19,10 @@ import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.factory.entity.*;
 import org.springblade.factory.service.*;
+import org.springblade.system.user.entity.User;
+import org.springblade.system.user.feign.IUserClient;
 import org.springblade.u9cloud.entity.ZcrmViewCustomerSel;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.dao.DuplicateKeyException;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
@@ -56,8 +59,8 @@ public class SalesForecastSummaryController {
 
 	private final PcBladeSalesForecastMainService salesForecastMainService;
 
-
-
+	@Autowired
+	private IUserClient userClient;
 	/**
 	 * 根据ID查询销售预测主表
 	 */
@@ -84,8 +87,12 @@ public class SalesForecastSummaryController {
 		@RequestParam(required = false) @ApiParam("开始日期(格式:yyyy-MM)") String startMonth,
 		@RequestParam(required = false) @ApiParam("结束日期(格式:yyyy-MM)") String endMonth) {
 		// 1. 获取当前登录用户ID,设置数据权限
-		Long customerId = AuthUtil.getUserId();
-		params.put("customerId", customerId);
+		Long userId = AuthUtil.getUserId();
+		R<User> user = userClient.userInfoById(userId);
+		if (user.getData() == null) {
+			return R.fail("用户不存在");
+		}
+		params.put("customerId", user.getData().getCustomerId());
 
 		// 2. 构建基础查询条件
 		QueryWrapper<PcBladeSalesForecastMain> queryWrapper = Condition.getQueryWrapper(params, PcBladeSalesForecastMain.class);
@@ -380,6 +387,12 @@ public class SalesForecastSummaryController {
 		ViewCustomerSel zcrmViewCustomerSel = customerSelService.selectZcrmViewCustomerSelByCustomerId(forecast.getCustomerId());
 		forecast.setCustomerCode(zcrmViewCustomerSel.getCustomerCode());
 		forecast.setCustomerName(zcrmViewCustomerSel.getCustomerName());
+
+
+
+
+
+
 		return forecastService.saveOrUpdateForecast(forecast);
 	}