Browse Source

济南:批量修改公司小程序配置

liupeng 1 week ago
parent
commit
c3791d2662

+ 34 - 2
fs-admin/src/main/java/com/fs/his/controller/FsCompanyController.java

@@ -28,6 +28,7 @@ import com.fs.system.service.ISysConfigService;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
@@ -50,8 +51,7 @@ import com.fs.common.core.page.TableDataInfo;
  */
 @RestController
 @RequestMapping("/his/company")
-public class FsCompanyController extends BaseController
-{
+public class FsCompanyController extends BaseController {
     @Autowired
     private ICompanyService companyService;
     @Autowired
@@ -263,4 +263,36 @@ public class FsCompanyController extends BaseController
         return companyDivConfigService.setDiv(param);
     }
 
+    @PostMapping("/exitMiniProgram")
+    @Log(title = "批量修改小程序", businessType = BusinessType.UPDATE)
+    public R exitMiniProgram(@RequestBody Company company) {
+        // 1. 前置校验:核心参数非空校验
+        if (CollectionUtils.isEmpty(company.getIds())) {
+            return R.error("请选择需要修改的企业ID");
+        }
+        if (isNNull(company.getCourseMiniAppId())&&isListNull(company.getMiniAppMaster()) && isListNull(company.getMiniAppServer())) {
+            return R.error("请选择要修改的小程序");
+        } else {
+            for (Long id : company.getIds()) {
+                Company c = companyService.selectCompanyById(id);
+                c.setMoney(null);
+                c.setUpdateMiniApp(true);
+                if (company.getCourseMiniAppId()!= null&&!company.getCourseMiniAppId().isEmpty()) c.setCourseMiniAppId(company.getCourseMiniAppId());
+                if (company.getMiniAppMaster()!=null&&!company.getMiniAppMaster().isEmpty()) c.setMiniAppMaster(company.getMiniAppMaster());
+                if (company.getMiniAppServer()!=null&&!company.getMiniAppServer().isEmpty()) c.setMiniAppServer(company.getMiniAppServer());
+                companyService.updateCompany(c);
+            }
+            return R.ok();
+        }
+    }
+   public boolean isNNull(String value){
+        if (value==null)return true;
+        if (value.isEmpty())return true;
+        return false;
+    }
+    public boolean isListNull(List<String> value){
+        if (value==null)return true;
+        if (value.isEmpty())return true;
+        return false;
+    }
 }

+ 2 - 0
fs-service/src/main/java/com/fs/company/domain/Company.java

@@ -136,4 +136,6 @@ public class Company extends BaseEntity
     /** 所属部门id */
     private Long deptId;
 
+    @TableField(exist = false)
+    private List<Long> ids;
 }