Browse Source

结算上下级关系配置

FengChaoYu 5 months ago
parent
commit
d0d0ba7373

+ 47 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/contract/SettleRelaConfigVO.java

@@ -0,0 +1,47 @@
+package com.gree.mall.manager.bean.contract;
+
+import com.gree.mall.manager.annotation.ZfireField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel
+@ZfireField(tbName = "a")
+public class SettleRelaConfigVO {
+
+    @ZfireField(tbName = "b")
+    @ApiModelProperty(value = "所属公司")
+    private String belongCompany;
+
+    @ZfireField(tbName = "b")
+    @ApiModelProperty(value = "所属公司编号")
+    private String belongCompanyCode;
+
+    @ZfireField(tbName = "b", colName = "name")
+    @ApiModelProperty(value = "上级网点名称")
+    private String parentName;
+
+    @ApiModelProperty(value = "上级网点编号")
+    private String websitId;
+
+    @ZfireField(tbName = "d", colName = "name")
+    @ApiModelProperty(value = "下级网点名称")
+    private String subName;
+
+    @ZfireField(tbName = "c")
+    @ApiModelProperty(value = "下级网点编号")
+    private String subWebsitId;
+
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+
+    @ApiModelProperty(value = "创建时间")
+    private String createTime;
+
+    @ApiModelProperty(value = "修改人")
+    private String updateBy;
+
+    @ApiModelProperty(value = "修改时间")
+    private String updateTime;
+}

+ 18 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/contract/WebsitFollowConfigBean.java

@@ -0,0 +1,18 @@
+package com.gree.mall.manager.bean.contract;
+
+import com.gree.mall.manager.plus.entity.WebsitFollowConfig;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ApiModel
+public class WebsitFollowConfigBean extends WebsitFollowConfig {
+
+    @ApiModelProperty(value = "明细")
+    private List<WebsitFollowConfigItemBean> items;
+}

+ 22 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/contract/WebsitFollowConfigItemBean.java

@@ -0,0 +1,22 @@
+package com.gree.mall.manager.bean.contract;
+
+import com.gree.mall.manager.plus.entity.WebsitFollowConfigItem;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ApiModel
+public class WebsitFollowConfigItemBean extends WebsitFollowConfigItem {
+
+    @ApiModelProperty(value = "所属公司")
+    private String belongCompany;
+
+    @ApiModelProperty(value = "所属公司编号")
+    private String belongCompanyCode;
+
+    @ApiModelProperty(value = "网点名称")
+    private String name;
+}

+ 3 - 0
mall-server-api/src/main/java/com/gree/mall/manager/commonmapper/CommonMapper.java

@@ -7,6 +7,7 @@ import com.gree.mall.manager.bean.activity.PromotionActivityVO;
 import com.gree.mall.manager.bean.admin.AdminCompanyPayConfigVO;
 import com.gree.mall.manager.bean.charging.ChargingStandardBean;
 import com.gree.mall.manager.bean.common.AmityUrlVO;
+import com.gree.mall.manager.bean.contract.SettleRelaConfigVO;
 import com.gree.mall.manager.bean.engin.OrderEnginBaseVO;
 import com.gree.mall.manager.bean.engin.ProjectRepairVO;
 import com.gree.mall.manager.bean.es.ESGoodsVO;
@@ -696,4 +697,6 @@ public interface CommonMapper {
     IPage<ComList> queryComList(Page page,
                                 @Param("adminWebsitIds") List<String> adminWebsitIds,
                                 @Param("userName") String userName);
+
+    IPage<SettleRelaConfigVO> settleRelaConfigPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);
 }

+ 140 - 0
mall-server-api/src/main/java/com/gree/mall/manager/controller/contract/SettleRelaConfigController.java

@@ -0,0 +1,140 @@
+package com.gree.mall.manager.controller.contract;
+
+import cn.hutool.core.lang.TypeReference;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.gree.mall.manager.annotation.ZfireList;
+import com.gree.mall.manager.bean.contract.SettleRelaConfigVO;
+import com.gree.mall.manager.bean.contract.WebsitFollowConfigBean;
+import com.gree.mall.manager.constant.Constant;
+import com.gree.mall.manager.exception.RemoteServiceException;
+import com.gree.mall.manager.helper.ResponseHelper;
+import com.gree.mall.manager.logic.contract.SettleRelaConfigLogic;
+import com.gree.mall.manager.plus.entity.AdminWebsit;
+import com.gree.mall.manager.zfire.bean.ZfireParamBean;
+import com.gree.mall.manager.zfire.util.FieldUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.integration.redis.util.RedisLockRegistry;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Lock;
+
+@Slf4j
+@RestController
+@Api(value = "结算上下级关系API", tags ={"结算上下级关系API"} )
+@RequestMapping(value = "/settle/rela/config", produces = "application/json; charset=utf-8")
+public class SettleRelaConfigController {
+
+    @Resource
+    SettleRelaConfigLogic settleRelaConfigLogic;
+    @Resource
+    RedisLockRegistry redisLockRegistry;
+
+
+    @ZfireList
+    @PostMapping("/list")
+    @ApiOperation(value = "列表")
+    public ResponseHelper<IPage<SettleRelaConfigVO>> page(
+            @RequestBody ZfireParamBean zfireParamBean
+    ) {
+        IPage<SettleRelaConfigVO> page = settleRelaConfigLogic.page(zfireParamBean);
+        return ResponseHelper.success(page, new TypeReference<SettleRelaConfigVO>() {});
+    }
+
+    @PostMapping("/list/export")
+    @ApiOperation("导出")
+    public void listExport(
+            @RequestBody ZfireParamBean zfireParamBean,
+            HttpServletRequest request,
+            HttpServletResponse response
+    ) throws Exception {
+        //2.查询要导出的内容
+        IPage<SettleRelaConfigVO> baseVOIPage = settleRelaConfigLogic.page(zfireParamBean);
+        //3.导出
+        FieldUtils.exportData(baseVOIPage.getRecords(), zfireParamBean.getExportFields(), request, response);
+    }
+
+    @PostMapping("/detail")
+    @ApiOperation(value = "详情")
+    public ResponseHelper<WebsitFollowConfigBean> detail(
+            @ApiParam(value = "websitId", required = true) @RequestParam String websitId
+    ) throws RemoteServiceException {
+        WebsitFollowConfigBean bean = settleRelaConfigLogic.detail(websitId);
+        return ResponseHelper.success(bean);
+    }
+
+    @PostMapping("/query/sub/websit")
+    @ApiOperation(value = "查询下级网点")
+    public ResponseHelper<List<AdminWebsit>> querySubWebsit(
+            @ApiParam(value = "网点编号", required = true) @RequestParam String websitId,
+            @ApiParam(value = "网点名称", required = true) @RequestParam String websitName
+    ) throws RemoteServiceException {
+        List<AdminWebsit> list = settleRelaConfigLogic.querySubWebsit(websitId, websitName);
+        return ResponseHelper.success(list);
+    }
+
+    @PostMapping("/add")
+    @ApiOperation(value = "添加")
+    public ResponseHelper add(
+            @RequestBody WebsitFollowConfigBean bean
+    ) throws Exception {
+        Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_ORDER + bean.getWebsitId());
+        try {
+            if (obtain.tryLock(5, TimeUnit.SECONDS)) {
+                settleRelaConfigLogic.add(bean);
+            }
+        } catch (Exception e) {
+            log.error("【添加上下级关系处理】失败", e);
+            throw e;
+        } finally {
+            obtain.unlock();
+        }
+        return ResponseHelper.success();
+    }
+
+    @PostMapping("/edit")
+    @ApiOperation(value = "编辑")
+    public ResponseHelper edit(
+            @RequestBody WebsitFollowConfigBean bean
+    ) throws Exception {
+        Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_ORDER + bean.getWebsitId());
+        try {
+            if (obtain.tryLock(5, TimeUnit.SECONDS)) {
+                settleRelaConfigLogic.edit(bean);
+            }
+        } catch (Exception e) {
+            log.error("【编辑上下级关系处理】失败", e);
+            throw e;
+        } finally {
+            obtain.unlock();
+        }
+        return ResponseHelper.success();
+    }
+
+    @PostMapping("/import")
+    @ApiOperation(value = "导入(下载模板:结算上下级关系配置模板.xlsx)")
+    public ResponseHelper<String> materialImportData (
+            @RequestPart("file") MultipartFile file
+    ) throws Exception {
+        Lock obtain = redisLockRegistry.obtain(Constant.RedisPrefix.LOCK_ORDER + ":settlerelaimport");
+        try {
+            if (obtain.tryLock(5, TimeUnit.SECONDS)) {
+                settleRelaConfigLogic.importData(file);
+            }
+        } catch (Exception e) {
+            log.error("【导入上下级关系处理】失败", e);
+            throw e;
+        } finally {
+            obtain.unlock();
+        }
+        return ResponseHelper.success();
+    }
+}

+ 282 - 0
mall-server-api/src/main/java/com/gree/mall/manager/logic/contract/SettleRelaConfigLogic.java

@@ -0,0 +1,282 @@
+package com.gree.mall.manager.logic.contract;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gree.mall.manager.bean.admin.AdminUserCom;
+import com.gree.mall.manager.bean.contract.SettleRelaConfigVO;
+import com.gree.mall.manager.bean.contract.WebsitFollowConfigBean;
+import com.gree.mall.manager.bean.contract.WebsitFollowConfigItemBean;
+import com.gree.mall.manager.commonmapper.CommonMapper;
+import com.gree.mall.manager.exception.RemoteServiceException;
+import com.gree.mall.manager.logic.common.CommonLogic;
+import com.gree.mall.manager.plus.entity.AdminWebsit;
+import com.gree.mall.manager.plus.entity.WebsitFollowConfig;
+import com.gree.mall.manager.plus.entity.WebsitFollowConfigItem;
+import com.gree.mall.manager.plus.service.AdminWebsitService;
+import com.gree.mall.manager.plus.service.WebsitFollowConfigItemService;
+import com.gree.mall.manager.plus.service.WebsitFollowConfigService;
+import com.gree.mall.manager.utils.CommonUtils;
+import com.gree.mall.manager.utils.excel.ExcelUtils;
+import com.gree.mall.manager.zfire.bean.ZfireParamBean;
+import com.gree.mall.manager.zfire.util.FieldUtils;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+@Slf4j
+@Service
+@RequiredArgsConstructor
+public class SettleRelaConfigLogic {
+    private final CommonLogic commonLogic;
+    private final CommonMapper commonMapper;
+    private final WebsitFollowConfigService websitFollowConfigService;
+    private final WebsitFollowConfigItemService websitFollowConfigItemService;
+    private final AdminWebsitService adminWebsitService;
+
+    public IPage<SettleRelaConfigVO> page(ZfireParamBean zfireParamBean) {
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+        FieldUtils.supplyParam(zfireParamBean, SettleRelaConfigVO.class, adminUser);
+        return commonMapper.settleRelaConfigPage(new Page(zfireParamBean.getPageNum(), zfireParamBean.getPageSize()), zfireParamBean);
+    }
+
+    public WebsitFollowConfigBean detail(String websitId) {
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+        final WebsitFollowConfig config = websitFollowConfigService.getById(websitId);
+        WebsitFollowConfigBean bean = new WebsitFollowConfigBean();
+        BeanUtils.copyProperties(config, bean);
+        final List<WebsitFollowConfigItem> items = websitFollowConfigItemService.lambdaQuery()
+                .eq(WebsitFollowConfigItem::getCompanyWechatId, adminUser.getCompanyWechatId())
+                .eq(WebsitFollowConfigItem::getParentId, websitId)
+                .list();
+        if (CollectionUtil.isNotEmpty(items)) {
+            final List<AdminWebsit> websitList = adminWebsitService.lambdaQuery()
+                    .eq(AdminWebsit::getCompanyWechatId, adminUser.getCompanyWechatId())
+                    .eq(AdminWebsit::getWebsitId, items.stream()
+                            .map(WebsitFollowConfigItem::getSubWebsitId)
+                            .collect(Collectors.toList()))
+                    .list();
+            final Map<String, AdminWebsit> websitMap = websitList.stream()
+                    .collect(Collectors.toMap(AdminWebsit::getWebsitId, Function.identity()));
+
+            List<WebsitFollowConfigItemBean> beanList = new ArrayList<>();
+            for (WebsitFollowConfigItem item : items) {
+                final AdminWebsit websit = websitMap.get(item.getSubWebsitId());
+                WebsitFollowConfigItemBean itemBean = new WebsitFollowConfigItemBean();
+                BeanUtils.copyProperties(item, itemBean);
+                itemBean.setName(websit.getName());
+                itemBean.setBelongCompany(websit.getBelongCompany());
+                itemBean.setBelongCompanyCode(websit.getBelongCompanyCode());
+                beanList.add(itemBean);
+            }
+            bean.setItems(beanList);
+        }
+        return bean;
+    }
+
+    public List<AdminWebsit> querySubWebsit(String websitId, String websitName) {
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+        final List<AdminWebsit> websitList = adminWebsitService.lambdaQuery()
+                .eq(AdminWebsit::getCompanyWechatId, adminUser.getCompanyWechatId())
+                .eq(AdminWebsit::getLevel, 2)
+                .like(StringUtils.isNotBlank(websitId), AdminWebsit::getWebsitId, websitId)
+                .like(StringUtils.isNotBlank(websitName), AdminWebsit::getName, websitName)
+                .orderByAsc(AdminWebsit::getBelongCompanyCode)
+                .orderByAsc(AdminWebsit::getWebsitId)
+                .list();
+
+        final List<WebsitFollowConfigItem> items = websitFollowConfigItemService.lambdaQuery()
+                .eq(WebsitFollowConfigItem::getCompanyWechatId, adminUser.getCompanyWechatId())
+                .list();
+
+        final List<String> useList = items.stream().map(WebsitFollowConfigItem::getSubWebsitId).collect(Collectors.toList());
+
+        List<AdminWebsit> list = new ArrayList<>();
+        for (AdminWebsit websit : websitList) {
+            if (!useList.contains(websit.getWebsitId())) {
+                list.add(websit);
+            }
+        }
+
+        return list;
+    }
+
+    @Transactional
+    public void add(WebsitFollowConfigBean bean) {
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+        if (adminUser.getType().equals(2)) {
+            throw new RemoteServiceException("平台账号禁止操作");
+        }
+
+        this.checkConfigInfo(adminUser.getCompanyWechatId(), bean.getWebsitId());
+
+        WebsitFollowConfig config = new WebsitFollowConfig();
+        config.setCompanyWechatId(adminUser.getCompanyWechatId())
+                .setCompanyWechatName(adminUser.getCompanyName())
+                .setWebsitId(bean.getWebsitId())
+                .insert();
+
+        if (CollectionUtil.isNotEmpty(bean.getItems())) {
+            final List<WebsitFollowConfigItem> existItems = websitFollowConfigItemService.lambdaQuery()
+                    .eq(WebsitFollowConfigItem::getCompanyWechatId, config.getCompanyWechatId())
+                    .in(WebsitFollowConfigItem::getSubWebsitId, bean.getItems().stream()
+                            .map(WebsitFollowConfigItemBean::getSubWebsitId)
+                            .collect(Collectors.toList()))
+                    .list();
+            if (CollectionUtil.isNotEmpty(existItems)) {
+                final String err = existItems.stream().map(WebsitFollowConfigItem::getSubWebsitId).collect(Collectors.joining(","));
+                throw new RemoteServiceException(err + "已有上级关系");
+            }
+            List<WebsitFollowConfigItem> items = new ArrayList<>();
+            for (WebsitFollowConfigItemBean itemBean : bean.getItems()) {
+                WebsitFollowConfigItem item = new WebsitFollowConfigItem();
+                item.setCompanyWechatId(config.getCompanyWechatId())
+                        .setCompanyWechatName(config.getCompanyWechatName())
+                        .setParentId(config.getWebsitId())
+                        .setSubWebsitId(itemBean.getSubWebsitId());
+                items.add(item);
+            }
+            websitFollowConfigItemService.saveBatch(items);
+        }
+    }
+
+    @Transactional
+    public void edit(WebsitFollowConfigBean bean) {
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+        if (adminUser.getType().equals(2)) {
+            throw new RemoteServiceException("平台账号禁止操作");
+        }
+        final WebsitFollowConfig config = websitFollowConfigService.lambdaQuery()
+                .eq(WebsitFollowConfig::getCompanyWechatId, adminUser.getCompanyWechatId())
+                .eq(WebsitFollowConfig::getWebsitId, bean.getWebsitId())
+                .one();
+        if (Objects.isNull(config)) {
+            throw new RemoteServiceException("上级网点信息不存在");
+        }
+        // 清空关系明细
+        websitFollowConfigItemService.lambdaUpdate()
+                .eq(WebsitFollowConfigItem::getCompanyWechatId, adminUser.getCompanyWechatId())
+                .eq(WebsitFollowConfigItem::getParentId, bean.getWebsitId())
+                .remove();
+        if (CollectionUtil.isNotEmpty(bean.getItems())) {
+            final List<WebsitFollowConfigItem> existItems = websitFollowConfigItemService.lambdaQuery()
+                    .eq(WebsitFollowConfigItem::getCompanyWechatId, config.getCompanyWechatId())
+                    .in(WebsitFollowConfigItem::getSubWebsitId, bean.getItems().stream()
+                            .map(WebsitFollowConfigItemBean::getSubWebsitId)
+                            .collect(Collectors.toList()))
+                    .list();
+            if (CollectionUtil.isNotEmpty(existItems)) {
+                final String err = existItems.stream().map(v -> v.getParentId() + ":" + v.getSubWebsitId()).collect(Collectors.joining(","));
+                throw new RemoteServiceException(err + "已有上级关系");
+            }
+            List<WebsitFollowConfigItem> items = new ArrayList<>();
+            for (WebsitFollowConfigItemBean itemBean : bean.getItems()) {
+                WebsitFollowConfigItem item = new WebsitFollowConfigItem();
+                item.setCompanyWechatId(config.getCompanyWechatId())
+                        .setCompanyWechatName(config.getCompanyWechatName())
+                        .setParentId(config.getWebsitId())
+                        .setSubWebsitId(itemBean.getSubWebsitId());
+                items.add(item);
+            }
+            websitFollowConfigItemService.saveBatch(items);
+        }
+    }
+
+    @Transactional
+    public void importData(MultipartFile file) throws Exception {
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+
+        if (adminUser.getType() == 2) {
+            throw new RemoteServiceException("平台账号禁止操作");
+        }
+
+        String companyWechatId = adminUser.getAdminCompanyWechat().getCompanyWechatId();
+        String companyName = adminUser.getAdminCompanyWechat().getCompanyName();
+
+        List<Object> objects = ExcelUtils.importExcel(file);
+        Map<String, List<String>> importMap = new HashMap<>();
+
+        for (int i = 0; i < objects.size(); i++) {
+            List<Object> row = (List<Object>) objects.get(i);
+            row = CommonUtils.initList2(row, 2);
+
+            if (Objects.isNull(row.get(0))) {
+                throw new RemoteServiceException("第" + (i + 1) + "行, 上级网点编号不能为空");
+            }
+            if (Objects.isNull(row.get(1))) {
+                throw new RemoteServiceException("第" + (i + 1) + "行, 下级网点编号不能为空");
+            }
+
+            String parentId = (String) row.get(0);
+            String subId = (String) row.get(1);
+
+            if (importMap.containsKey(StrUtil.trim(parentId))) {
+                importMap.get(StrUtil.trim(parentId)).add(subId);
+            } else {
+                importMap.put(StrUtil.trim(parentId), new ArrayList<String>() {{ this.add(StrUtil.trim(subId)); }});
+            }
+        }
+
+        if (CollectionUtil.isEmpty(importMap)) {
+            throw new RemoteServiceException("导入数据为空");
+        }
+
+        // 产生关系对象
+        for (Map.Entry<String, List<String>> entry : importMap.entrySet()) {
+            WebsitFollowConfig config = new WebsitFollowConfig();
+
+            this.checkConfigInfo(companyWechatId, entry.getKey());
+
+            config.setCompanyWechatId(companyWechatId)
+                    .setCompanyWechatName(companyName)
+                    .setWebsitId(entry.getKey())
+                    .insert();
+
+            final List<WebsitFollowConfigItem> existItems = websitFollowConfigItemService.lambdaQuery()
+                    .eq(WebsitFollowConfigItem::getCompanyWechatId, config.getCompanyWechatId())
+                    .in(WebsitFollowConfigItem::getSubWebsitId, entry.getValue())
+                    .list();
+            if (CollectionUtil.isNotEmpty(existItems)) {
+                final String err = existItems.stream().map(v -> v.getParentId() + ":" + v.getSubWebsitId()).collect(Collectors.joining(","));
+                throw new RemoteServiceException(err + "已有上级关系");
+            }
+            List<WebsitFollowConfigItem> items = new ArrayList<>();
+            for (String subId : entry.getValue()) {
+                WebsitFollowConfigItem item = new WebsitFollowConfigItem();
+                item.setCompanyWechatId(config.getCompanyWechatId())
+                        .setCompanyWechatName(config.getCompanyWechatName())
+                        .setParentId(config.getWebsitId())
+                        .setSubWebsitId(subId);
+                items.add(item);
+            }
+            websitFollowConfigItemService.saveBatch(items);
+        }
+    }
+
+    private void checkConfigInfo(String companyWechatId, String websitId) {
+        final Integer existData = websitFollowConfigService.lambdaQuery()
+                .eq(WebsitFollowConfig::getCompanyWechatId, companyWechatId)
+                .eq(WebsitFollowConfig::getWebsitId, websitId)
+                .count();
+        if (existData > 0) {
+            throw new RemoteServiceException(websitId + "已配置过关系, 添加失败");
+        }
+        final Integer count = adminWebsitService.lambdaQuery()
+                .eq(AdminWebsit::getCompanyWechatId, companyWechatId)
+                .eq(AdminWebsit::getWebsitId, websitId)
+                .eq(AdminWebsit::getLevel, 1)
+                .count();
+        if (count == 0) {
+            throw new RemoteServiceException(websitId + "不是一级网点, 添加失败");
+        }
+    }
+}

+ 23 - 2
mall-server-api/src/main/resources/mapper/CommonMapper.xml

@@ -1,8 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.gree.mall.manager.commonmapper.CommonMapper">
-    <update id="settleBankAccountList"></update>
-
 
     <select id="queryChargingStandrdList" resultType="com.gree.mall.manager.bean.charging.ChargingStandardBean">
         select
@@ -1337,4 +1335,27 @@
             and not exists (select 1 from com_detail_log where user_name=#{userName} and com_list_id=a.id)
     </select>
 
+    <select id="settleRelaConfigPage"
+            resultType="com.gree.mall.manager.bean.contract.SettleRelaConfigVO">
+        SELECT
+            ${ex.selected},
+            b.name AS parentName,
+            d.name AS subName
+        FROM
+            websit_follow_config a
+            LEFT JOIN admin_websit b ON a.websit_id = b.websit_id
+            LEFT JOIN websit_follow_config_item c ON a.websit_id = c.parent_id
+            LEFT JOIN admin_websit d ON c.sub_websit_id = d.websit_id
+        ${ex.query}
+        <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
+            AND a.websit_id IN
+            <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="ex.orderBy == null or ex.orderBy ==''">
+            ORDER BY a.create_time DESC
+        </if>
+        ${ex.orderBy}
+    </select>
 </mapper>

BIN
mall-server-api/src/main/resources/template/结算上下级关系配置模板.xlsx