Jelajahi Sumber

1.增加会员等级关系接口
2.增加会员等级商品规格接口
3.师傅列表-v2接口增加接参过滤逻辑

FengChaoYu 4 minggu lalu
induk
melakukan
7e3f37255a

+ 69 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/user/UserLevelGoodsVO.java

@@ -0,0 +1,69 @@
+package com.gree.mall.manager.bean.user;
+
+import com.gree.mall.manager.annotation.ZfireField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+@ApiModel
+@ZfireField(tbName = "b")
+public class UserLevelGoodsVO {
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "id")
+    private String id;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "会员等级id")
+    private String userLevelId;
+
+    @ZfireField(tbName = "a")
+    @ApiModelProperty(value = "商户名称")
+    private String companyWechatName;
+
+    @ZfireField(tbName = "a")
+    @ApiModelProperty(value = "会员等级名称")
+    private String levelName;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "商品id")
+    private String goodsId;
+
+    @ApiModelProperty(value = "商品名称")
+    private String goodsName;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "商品规格id")
+    private String goodsSpecId;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "物料编号(对应商品物料id)")
+    private String goodsSpecCode;
+
+    @ApiModelProperty(value = "规格名称")
+    private String goodsSpecName;
+
+    @ApiModelProperty(value = "规格值")
+    private String goodsSpecValue;
+
+    @ApiModelProperty(value = "商品规格价格")
+    private BigDecimal goodsSpecPrice;
+
+    @ApiModelProperty(value = "商品规格首件运费")
+    private BigDecimal goodsSpecFirstFee;
+
+    @ApiModelProperty(value = "商品规格续件运费")
+    private BigDecimal goodsSpecContinueFee;
+
+    @ApiModelProperty(value = "商品规格新价格")
+    private BigDecimal goodsSpecNewPrice;
+
+    @ApiModelProperty(value = "商品规格新首件运费")
+    private BigDecimal goodsSpecNewFirstFee;
+
+    @ApiModelProperty(value = "商品规格新续件运费")
+    private BigDecimal goodsSpecNewContinueFee;
+}

+ 40 - 0
mall-server-api/src/main/java/com/gree/mall/manager/bean/user/UserLevelRelaVO.java

@@ -0,0 +1,40 @@
+package com.gree.mall.manager.bean.user;
+
+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 UserLevelRelaVO {
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "商户Id")
+    private String companyWechatId;
+
+    @ZfireField(tbName = "d")
+    @ApiModelProperty(value = "商户名称")
+    private String companyName;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "用户id")
+    private String userId;
+
+    @ZfireField(tbName = "c")
+    @ApiModelProperty(value = "用户名称")
+    private String nickName;
+
+    @ZfireField(tbName = "c")
+    @ApiModelProperty(value = "用户手机")
+    private String mobile;
+
+    @ZfireField(hide = true)
+    @ApiModelProperty(value = "会员等级id")
+    private String userLevelId;
+
+    @ZfireField(tbName = "b")
+    @ApiModelProperty(value = "会员等级名称")
+    private String levelName;
+}

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

@@ -24,9 +24,7 @@ import com.gree.mall.manager.bean.settle.SettleExpenseVO;
 import com.gree.mall.manager.bean.settle.SettleMonthWagesVO;
 import com.gree.mall.manager.bean.settle.SettleMonthWagesWorkerVO;
 import com.gree.mall.manager.bean.settle.repair.*;
-import com.gree.mall.manager.bean.user.UserCompanyCreditBillItemVO;
-import com.gree.mall.manager.bean.user.UserCompanyCreditBillVO;
-import com.gree.mall.manager.bean.user.UserLevelVO;
+import com.gree.mall.manager.bean.user.*;
 import com.gree.mall.manager.bean.workorder.*;
 import com.gree.mall.manager.enums.UserTypeEnum;
 import com.gree.mall.manager.plus.entity.CommonFile;
@@ -653,4 +651,18 @@ public interface CommonMapper {
     List<GoodsLibraryDocumentsRelaBean> findGoodsDocumentsCategoryListByGoodsLibraryId(@Param("id") String goodsLibraryId);
 
     List<GoodsDocumentsRelaBean> findGoodsDocumentsCategoryListByGoodsId(@Param("id") String goodsId);
+
+    /**
+     * 会员等级关系列表
+     * @param page
+     * @return
+     */
+    IPage<UserLevelRelaVO> userLevelRelaPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);
+
+    /**
+     * 会员等级商品规格列表
+     * @param page
+     * @return
+     */
+    IPage<UserLevelGoodsVO> userLevelGoodsPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);
 }

+ 51 - 0
mall-server-api/src/main/java/com/gree/mall/manager/controller/member/UserLevelController.java

@@ -4,12 +4,15 @@ 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.user.UserLevelBean;
+import com.gree.mall.manager.bean.user.UserLevelGoodsVO;
+import com.gree.mall.manager.bean.user.UserLevelRelaVO;
 import com.gree.mall.manager.bean.user.UserLevelVO;
 import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.helper.ResponseHelper;
 import com.gree.mall.manager.logic.user.UserLevelLogic;
 import com.gree.mall.manager.plus.entity.UserLevel;
 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;
@@ -17,6 +20,8 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 
 @Slf4j
 @RestController
@@ -90,4 +95,50 @@ public class UserLevelController {
         userLevelLogic.addGoods(userLevel);
         return ResponseHelper.success();
     }
+
+    @ZfireList
+    @PostMapping("/rela/list")
+    @ApiOperation(value = "会员等级关系-列表")
+    public ResponseHelper<IPage<UserLevelRelaVO>> relaList(
+            @RequestBody ZfireParamBean zfireParamBean
+    ) {
+        IPage<UserLevelRelaVO> page = userLevelLogic.relaList(zfireParamBean);
+        return ResponseHelper.success(page, new TypeReference<UserLevelRelaVO>() {});
+    }
+
+    @PostMapping("/rela/list/export")
+    @ApiOperation("会员等级关系-导出")
+    public void relaListExport(
+            @RequestBody ZfireParamBean zfireParamBean,
+            HttpServletRequest request,
+            HttpServletResponse response
+    ) throws Exception {
+        //2.查询要导出的内容
+        IPage<UserLevelRelaVO> baseVOIPage = userLevelLogic.relaList(zfireParamBean);
+        //3.导出
+        FieldUtils.exportData(baseVOIPage.getRecords(), zfireParamBean.getExportFields(), request, response);
+    }
+
+    @ZfireList
+    @PostMapping("/goods/list")
+    @ApiOperation(value = "会员等级商品规格-列表")
+    public ResponseHelper<IPage<UserLevelGoodsVO>> goodsList(
+            @RequestBody ZfireParamBean zfireParamBean
+    ) {
+        IPage<UserLevelGoodsVO> page = userLevelLogic.goodsList(zfireParamBean);
+        return ResponseHelper.success(page, new TypeReference<UserLevelGoodsVO>() {});
+    }
+
+    @PostMapping("/goods/list/export")
+    @ApiOperation("会员等级商品规格-导出")
+    public void goodsListExport(
+            @RequestBody ZfireParamBean zfireParamBean,
+            HttpServletRequest request,
+            HttpServletResponse response
+    ) throws Exception {
+        //2.查询要导出的内容
+        IPage<UserLevelGoodsVO> baseVOIPage = userLevelLogic.goodsList(zfireParamBean);
+        //3.导出
+        FieldUtils.exportData(baseVOIPage.getRecords(), zfireParamBean.getExportFields(), request, response);
+    }
 }

+ 16 - 0
mall-server-api/src/main/java/com/gree/mall/manager/logic/user/UserLevelLogic.java

@@ -7,6 +7,8 @@ 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.user.UserLevelBean;
+import com.gree.mall.manager.bean.user.UserLevelGoodsVO;
+import com.gree.mall.manager.bean.user.UserLevelRelaVO;
 import com.gree.mall.manager.bean.user.UserLevelVO;
 import com.gree.mall.manager.commonmapper.CommonMapper;
 import com.gree.mall.manager.commonmapper.UserLevelCMapper;
@@ -274,4 +276,18 @@ public class UserLevelLogic {
                 .eq(UserLevel::getId, userLevel.getId())
                 .update();
     }
+
+    public IPage<UserLevelRelaVO> relaList(ZfireParamBean zfireParamBean) {
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+
+        FieldUtils.supplyParam(zfireParamBean, UserLevelRelaVO.class, adminUser);
+        return commonMapper.userLevelRelaPage(new Page(zfireParamBean.getPageNum(), zfireParamBean.getPageSize()), zfireParamBean);
+    }
+
+    public IPage<UserLevelGoodsVO> goodsList(ZfireParamBean zfireParamBean) {
+        AdminUserCom adminUser = commonLogic.getAdminUser();
+
+        FieldUtils.supplyParam(zfireParamBean, UserLevelGoodsVO.class, adminUser);
+        return commonMapper.userLevelGoodsPage(new Page(zfireParamBean.getPageNum(), zfireParamBean.getPageSize()), zfireParamBean);
+    }
 }

+ 5 - 0
mall-server-api/src/main/java/com/gree/mall/manager/zfire/bean/WorkerParamBean.java

@@ -11,4 +11,9 @@ public class WorkerParamBean extends ZfireParamBean {
     @ApiModelProperty(value = "是否按师傅编号分组")
     private Boolean isGroupByWorkerId = Boolean.FALSE;
 
+    @ApiModelProperty(value = "过滤会员等级商户id")
+    private String filterUserLevelCompanyId;
+    @ApiModelProperty(value = "过滤已选会员等级id")
+    private String filterUserLevelId;
+
 }

+ 47 - 21
mall-server-api/src/main/resources/mapper/CommonMapper.xml

@@ -91,35 +91,33 @@
 
 
     <select id="userList" resultType="com.gree.mall.manager.bean.listvo.UserVO">
-        select
+        SELECT
         ${ex.selected}
-        <!--
-        b.websit_id,
-        c.name as 'websit_name',
-        d.nick_name as 'slaveWorkerName'
-        -->
-        from user a
-        <!--
-           join websit_user b on a.user_id = b.user_id
-           join admin_websit c on c.websit_id = b.websit_id
-           left join user d on b.slave_worker_id = d.user_id
-           -->
+        FROM user a
+            <if test="ex.filterUserLevelId != null and ex.filterUserLevelId != ''">
+                LEFT JOIN user_level_rela b ON a.user_id = b.user_id
+                AND b.company_wechat_id = #{ex.filterUserLevelCompanyId}
+                AND b.user_level_id = #{ex.filterUserLevelId}
+            </if>
         ${ex.query}
-       <!--
-       <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
-           AND c.websit_id IN
-           <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
-               #{item}
-           </foreach>
-       </if>
-       -->
+        <if test="ex.filterUserLevelId != null and ex.filterUserLevelId != ''">
+            AND NOT EXISTS (
+            -- 排除在同一个企业下关联了其他用户等级的用户
+            SELECT 1
+            FROM user_level_rela ulr_other
+            WHERE
+                ulr_other.user_id = a.user_id
+                AND ulr_other.company_wechat_id = #{ex.filterUserLevelCompanyId}
+                AND ulr_other.user_level_id != #{ex.filterUserLevelId}
+            )
+        </if>
         <if test="isOK != null and isOK == true">
             AND a.worker_number IS NOT NULL
         </if>
         <if test="ex.isGroupByWorkerId != null and ex.isGroupByWorkerId == true">
             GROUP BY a.worker_number
         </if>
-        ORDER BY <!-- FIELD(b.examine_status,'WAIT','OK','FAIL'), --> a.create_time DESC
+        ORDER BY a.create_time DESC
     </select>
 
     <select id="userServiceList" resultType="com.gree.mall.manager.bean.listvo.User2VO">
@@ -1273,5 +1271,33 @@
             a.goods_id = #{id}
     </select>
 
+    <select id="userLevelRelaPage" resultType="com.gree.mall.manager.bean.user.UserLevelRelaVO">
+        SELECT
+        ${ex.selected}
+        FROM
+            user_level_rela a
+            LEFT JOIN user_level b ON a.user_level_id = b.id
+            LEFT JOIN user c ON a.user_id = c.user_id
+            LEFT JOIN admin_company_wechat d ON a.company_wechat_id = d.company_wechat_id
+        ${ex.query}
+        <if test="ex.orderBy == null or ex.orderBy ==''">
+            ORDER BY a.id DESC
+        </if>
+        ${ex.orderBy}
+    </select>
+
+    <select id="userLevelGoodsPage" resultType="com.gree.mall.manager.bean.user.UserLevelGoodsVO">
+        SELECT
+        ${ex.selected}
+        FROM
+            user_level a
+            JOIN user_level_goods b ON a.id = b.user_level_id
+        ${ex.query}
+        <if test="ex.orderBy == null or ex.orderBy ==''">
+            ORDER BY a.id DESC
+        </if>
+        ${ex.orderBy}
+    </select>
+
 
 </mapper>