|  |  |  | 
|---|
|  |  |  | package com.matrix.system.fenxiao.action; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import cn.hutool.core.collection.CollUtil; | 
|---|
|  |  |  | import cn.hutool.core.util.StrUtil; | 
|---|
|  |  |  | import com.matrix.system.hive.dao.SysVipInfoDao; | 
|---|
|  |  |  | import com.matrix.core.constance.MatrixConstance; | 
|---|
|  |  |  | import com.matrix.core.pojo.AjaxResult; | 
|---|
|  |  |  | import com.matrix.core.pojo.PaginationVO; | 
|---|
|  |  |  | import com.matrix.core.tools.WebUtil; | 
|---|
|  |  |  | import com.matrix.system.common.bean.BusParameterSettings; | 
|---|
|  |  |  | import com.matrix.system.common.bean.SysUsers; | 
|---|
|  |  |  | import com.matrix.system.common.constance.AppConstance; | 
|---|
|  |  |  | import com.matrix.system.common.dao.BusParameterSettingsDao; | 
|---|
|  |  |  | import com.matrix.system.fenxiao.constant.FenxiaoSettingConstant; | 
|---|
|  |  |  | import com.matrix.system.fenxiao.service.FenXiaoSettingService; | 
|---|
|  |  |  | import com.matrix.system.fenxiao.vo.FenXiaoSettingVo; | 
|---|
|  |  |  | import com.matrix.system.hive.action.util.QueryUtil; | 
|---|
|  |  |  | import com.matrix.system.hive.dao.ShoppingGoodsDao; | 
|---|
|  |  |  | import com.matrix.system.shopXcx.bean.ShopProduct; | 
|---|
|  |  |  | import com.matrix.system.shopXcx.dao.ShopProductDao; | 
|---|
|  |  |  | import org.springframework.beans.BeanUtils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.Arrays; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.matrix.system.hive.bean.ShoppingGoods; | 
|---|
|  |  |  | import com.matrix.system.hive.dao.ShoppingGoodsDao; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import cn.hutool.core.collection.CollUtil; | 
|---|
|  |  |  | import cn.hutool.core.util.StrUtil; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import org.apache.commons.collections.CollectionUtils; | 
|---|
|  |  |  | import org.springframework.beans.BeanUtils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.PostMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestBody; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.ResponseBody; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | @RequestMapping(value = "/fenXiao/ruleSetting") | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ShoppingGoodsDao shoppingGoodsDao; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SysVipInfoDao sysVipInfoDao; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ShopProductDao shopProductDao; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | *查询分销配置 | 
|---|
|  |  |  | 
|---|
|  |  |  | String[] FXKGName={"分销开关"}; | 
|---|
|  |  |  | List<FenXiaoSettingVo> fxkgRuleSettingsVo = getRuleSettingsVo(FXKGCode,FXKGName,companyId); | 
|---|
|  |  |  | result.putInMap("fxkg", fxkgRuleSettingsVo); | 
|---|
|  |  |  | //自购返佣 | 
|---|
|  |  |  | String[] ZGFYCode={FenxiaoSettingConstant.FX_ZGFY}; | 
|---|
|  |  |  | String[] ZGFYName={"自购返佣"}; | 
|---|
|  |  |  | List<FenXiaoSettingVo> zgfyRuleSettingsVo = getRuleSettingsVo(ZGFYCode,ZGFYName,companyId); | 
|---|
|  |  |  | result.putInMap("zgfy", zgfyRuleSettingsVo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //分销模式 | 
|---|
|  |  |  | String[] FXMSCode={FenxiaoSettingConstant.FX_MODEL}; | 
|---|
|  |  |  | String[] FXMSName={"分销模式"}; | 
|---|
|  |  |  | 
|---|
|  |  |  | result.putInMap("sqtj", sqtjRuleSettingsVo); | 
|---|
|  |  |  | if(CollUtil.isNotEmpty(sqtjRuleSettingsVo)){ | 
|---|
|  |  |  | for(FenXiaoSettingVo fenXiaoSettingVo : sqtjRuleSettingsVo) { | 
|---|
|  |  |  | if("3".equals(fenXiaoSettingVo.getParamValue())) { | 
|---|
|  |  |  | //选择申请条件条件3时,获得选中产品集合 | 
|---|
|  |  |  | if(FenxiaoSettingConstant.FX_APPLY_CONDITION_XFZDCP.equals(fenXiaoSettingVo.getParamValue())) { | 
|---|
|  |  |  | String paramValue1 = fenXiaoSettingVo.getParamValue1(); | 
|---|
|  |  |  | if(StrUtil.isNotEmpty(paramValue1)) { | 
|---|
|  |  |  | List<Integer> idsList = new ArrayList<>(); | 
|---|
|  |  |  | 
|---|
|  |  |  | idsList.add(parseInt); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<ShoppingGoods> list = shoppingGoodsDao.selectByIds(idsList); | 
|---|
|  |  |  | result.putInMap("order", list); | 
|---|
|  |  |  | //List<ShoppingGoods> list = shoppingGoodsDao.selectByIds(idsList); | 
|---|
|  |  |  | List<ShopProduct> shopProducts = shopProductDao.selectByIds(idsList); | 
|---|
|  |  |  | result.putInMap("order", shopProducts); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | List<ShopProduct> shopProducts = new ArrayList<>(); | 
|---|
|  |  |  | result.putInMap("order", shopProducts); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return result; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 列表显示 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @RequestMapping(value = "/selectProduct") | 
|---|
|  |  |  | public @ResponseBody | 
|---|
|  |  |  | AjaxResult selectProduct(ShopProduct shopProduct, PaginationVO pageVo) { | 
|---|
|  |  |  | QueryUtil.setQueryLimitCom(shopProduct); | 
|---|
|  |  |  | pageVo.setSort("createTime"); | 
|---|
|  |  |  | pageVo.setOrder("desc"); | 
|---|
|  |  |  | shopProduct.setDelFlag(AppConstance.DATA_USEABLE); | 
|---|
|  |  |  | shopProduct.setCompanyId(shopProduct.getCompanyId()); | 
|---|
|  |  |  | List<ShopProduct> dataList = shopProductDao.selectInPage(shopProduct, pageVo); | 
|---|
|  |  |  | AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, dataList, | 
|---|
|  |  |  | shopProductDao.selectTotalRecord(shopProduct)); | 
|---|
|  |  |  | return result; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | *获取对应的规则设置数据 | 
|---|
|  |  |  | * @param ArrayCode | 
|---|
|  |  |  | * @param ArrayName | 
|---|