Ver código fonte

报价单管理批量编辑调整

haoyu 2 anos atrás
pai
commit
69c7dd1c47

+ 4 - 0
src/main/java/com/ydtech/modules/admin/controller/SysQuotationController.java

@@ -113,6 +113,9 @@ public class SysQuotationController extends BaseController {
     @ApiOperation(value = "报价单授权批量编辑")
     @PostMapping(value = "/batch")
     public HttpResult<SysOrganizationQuotation> batch(@RequestBody SysOrganizationQuotation sysOrganizationQuotation) {
+        if (sysOrganizationQuotation.getOrganizationIds().size() == 0){
+            return HttpResult.ok("编辑失败,未选中修改机构");
+        }
         // 构造查询条件,根据提供的组织ID集合查询出对应的报价单授权信息,然后进行删除
         LambdaQueryWrapper<SysOrganizationQuotation> removeWrapper = new LambdaQueryWrapper<>();
         removeWrapper.in(SysOrganizationQuotation::getOrganizationId, sysOrganizationQuotation.getOrganizationIds());
@@ -124,6 +127,7 @@ public class SysQuotationController extends BaseController {
             SysOrganizationQuotation quotation = new SysOrganizationQuotation();
             quotation.setOrganizationId(organizationId);
             quotation.setThemeId(sysOrganizationQuotation.getThemeId());
+            quotation.setThemeCode(sysOrganizationQuotation.getThemeCode());
             quotation.setUserId(getUserId());
             quotation.setCreateTime(new Date());
             quotations.add(quotation);

+ 2 - 2
src/main/java/com/ydtech/modules/admin/service/impl/SysOrganizationQuotationImpl.java

@@ -34,7 +34,7 @@ public class SysOrganizationQuotationImpl extends ServiceImpl<SysOrganizationQuo
         // 将报价主题列表转换为Map,以主题ID为键
         Map<String, SysQuotationTheme> themeMap = quotationThemes.stream()
                 .collect(Collectors.toMap(
-                        SysQuotationTheme::getId,
+                        SysQuotationTheme::getThemeCode,
                         Theme -> Theme
                 ));
 
@@ -63,7 +63,7 @@ public class SysOrganizationQuotationImpl extends ServiceImpl<SysOrganizationQuo
             sysDept.setThemeName("无");
             // 如果找到了报价信息,则设置部门的主题名称和颜色
             if (quotation != null) {
-                SysQuotationTheme sysQuotationTheme = themeMap.get(quotation.getThemeId());
+                SysQuotationTheme sysQuotationTheme = themeMap.get(quotation.getThemeCode());
                 if (sysQuotationTheme != null) {
                     sysDept.setThemeName(sysQuotationTheme.getQuotationAbbr());
                     sysDept.setThemeColour(sysQuotationTheme.getThemeColour());