|
@@ -3,9 +3,16 @@ package com.fs.app.controller.store;
|
|
|
|
|
|
|
|
import cn.hutool.json.JSONArray;
|
|
import cn.hutool.json.JSONArray;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
+import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.fs.app.annotation.Login;
|
|
import com.fs.app.annotation.Login;
|
|
|
import com.fs.app.controller.AppBaseController;
|
|
import com.fs.app.controller.AppBaseController;
|
|
|
import com.fs.common.core.domain.R;
|
|
import com.fs.common.core.domain.R;
|
|
|
|
|
+import com.fs.common.core.domain.entity.SysDictData;
|
|
|
|
|
+import com.fs.company.domain.Company;
|
|
|
|
|
+import com.fs.company.domain.CompanyUser;
|
|
|
|
|
+import com.fs.company.service.ICompanyService;
|
|
|
|
|
+import com.fs.company.service.ICompanyUserService;
|
|
|
import com.fs.hisStore.domain.FsStoreProductAttrValueScrm;
|
|
import com.fs.hisStore.domain.FsStoreProductAttrValueScrm;
|
|
|
import com.fs.hisStore.domain.FsStoreProductPackageScrm;
|
|
import com.fs.hisStore.domain.FsStoreProductPackageScrm;
|
|
|
import com.fs.hisStore.domain.FsStoreProductScrm;
|
|
import com.fs.hisStore.domain.FsStoreProductScrm;
|
|
@@ -17,6 +24,7 @@ import com.fs.hisStore.service.IFsStoreProductAttrValueScrmService;
|
|
|
import com.fs.hisStore.service.IFsStoreProductPackageScrmService;
|
|
import com.fs.hisStore.service.IFsStoreProductPackageScrmService;
|
|
|
import com.fs.hisStore.service.IFsStoreProductScrmService;
|
|
import com.fs.hisStore.service.IFsStoreProductScrmService;
|
|
|
import com.fs.hisStore.vo.FsStoreProductPacketVO;
|
|
import com.fs.hisStore.vo.FsStoreProductPacketVO;
|
|
|
|
|
+import com.fs.system.service.ISysDictTypeService;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
@@ -40,6 +48,42 @@ public class StoreProductPackageScrmController extends AppBaseController {
|
|
|
private IFsStoreProductAttrValueScrmService attrValueService;
|
|
private IFsStoreProductAttrValueScrmService attrValueService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IFsStoreProductScrmService storeProductService;
|
|
private IFsStoreProductScrmService storeProductService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ICompanyUserService companyUserService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ICompanyService companyService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ISysDictTypeService dictTypeService;
|
|
|
|
|
+ @ApiOperation("获取套餐分类")
|
|
|
|
|
+ @GetMapping("/getPackagCateList")
|
|
|
|
|
+ public R getPackagCateList() {
|
|
|
|
|
+ List<SysDictData> result = new ArrayList<>();
|
|
|
|
|
+ try {
|
|
|
|
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
|
|
+ Long companyUserId = getCompanyUserId();
|
|
|
|
|
+ CompanyUser companyUser=companyUserService.selectCompanyUserById(companyUserId);
|
|
|
|
|
+ Company company = companyService.selectCompanyById(companyUser.getCompanyId());
|
|
|
|
|
+ String packageCateIds = company.getPackageCateIds();
|
|
|
|
|
+ List<String> cateIdList = objectMapper.readValue(packageCateIds, new TypeReference<List<String>>() {});
|
|
|
|
|
+ if(!cateIdList.isEmpty()){
|
|
|
|
|
+ List<SysDictData> data = dictTypeService.selectDictDataByType("store_product_package_cate");
|
|
|
|
|
+ if(data != null && !data.isEmpty()){
|
|
|
|
|
+
|
|
|
|
|
+ data.stream().forEach(item->{
|
|
|
|
|
+ if (cateIdList.contains(item.getDictValue())) {
|
|
|
|
|
+ result.add(item);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ return R.ok().put("data", result);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Login
|
|
@Login
|
|
|
@ApiOperation("获取套餐列表")
|
|
@ApiOperation("获取套餐列表")
|
|
|
@GetMapping("/getStoreProductPackage")
|
|
@GetMapping("/getStoreProductPackage")
|