Browse Source

服务商入驻V1.0.0

kaick 1 năm trước cách đây
mục cha
commit
bb7b8a63a0

+ 39 - 0
src/main/java/com/caimei365/user/controller/ProvidersController.java

@@ -0,0 +1,39 @@
+package com.caimei365.user.controller;
+
+import com.caimei365.user.model.ResponseJson;
+import com.caimei365.user.model.po.CmProviders;
+import com.caimei365.user.model.vo.CmProvidersVO;
+import com.caimei365.user.service.CmProvidersService;
+import com.caimei365.user.utils.BeanUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+/**
+ * 服务商入驻Controller
+ *
+ * @author Kaick
+ * @date 2023-12-14
+ */
+@RestController
+@RequestMapping("/user/providers")
+public class ProvidersController {
+    @Resource
+    private CmProvidersService cmProvidersService;
+
+
+    /**
+     * 服务商入驻信息查询
+     */
+    @GetMapping("/from")
+    public ResponseJson getProvidersFrom(String providersId,String providersName) {
+        if (StringUtils.isBlank(providersId)&&StringUtils.isBlank(providersName)) {
+            return ResponseJson.error("参数异常!");
+        }
+        CmProviders cmProviders = cmProvidersService.getByCmProviders(new CmProviders().setId(providersId).setName(providersName).setStatus(90));
+        return ResponseJson.success(BeanUtil.setValue(cmProviders, CmProvidersVO.class));
+    }
+}

+ 8 - 0
src/main/java/com/caimei365/user/mapper/BaseMapper.java

@@ -1,5 +1,6 @@
 package com.caimei365.user.mapper;
 
+import com.caimei365.user.model.po.CmRelatedImage;
 import com.caimei365.user.model.po.CmUser;
 import com.caimei365.user.model.po.WxUnion;
 import com.caimei365.user.model.vo.*;
@@ -237,4 +238,11 @@ public interface BaseMapper {
      * 通过对象查询unionid与不同应用的openid关系对象
      */
     WxUnion getByWxUnion(@Param("type") Integer type,@Param("openid")String openid,@Param("unionId")String unionId);
+
+    /**
+     * 通过对象查询相关图片列表
+     * @param cmRelatedImage 相关图片
+     * @return 相关图片集合
+     */
+    List<String> getRelatedImageList(CmRelatedImage cmRelatedImage);
 }

+ 82 - 0
src/main/java/com/caimei365/user/model/po/CmProviders.java

@@ -0,0 +1,82 @@
+package com.caimei365.user.model.po;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.apache.ibatis.type.Alias;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 对象 cm_providers
+ *
+ * @author Kaick
+ * @date 2023-12-14
+ */
+@Accessors(chain  = true )
+@Data
+@Alias("CmProviders")
+public class CmProviders implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    /** id */
+    private String id;
+
+    /** 用户id */
+    private Integer userId;
+
+    /** 服务商名称 */
+    private String name;
+
+    /** 服务商级别为:1级,2级,3级 */
+    private Integer serviceLevel;
+
+    /** 服务商类型: 1个人,1企业 */
+    private Integer serviceCategory;
+
+    /** 服务商地址 */
+    private String address;
+
+    /** 联系人 */
+    private String linkMan;
+
+    /** 联系电话 */
+    private String mobile;
+
+    /** 状态:90上线,91下线 */
+    private Integer status;
+
+    /** 简介 */
+    private String text;
+
+    /** 服务商二维码 */
+    private String qrCodeImage;
+
+    /** 资格证书图片 */
+    private String qualificationImage;
+
+    /** 资格证书编号 */
+    private String qualificationId;
+
+    /** 创建人 */
+    private String createBy;
+
+    /** 修改时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date updateTime;
+
+    /** 添加时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createTime;
+
+    /**
+     * 相关简介图集合
+     */
+    private List<String> textRelateds;
+}
+
+
+

+ 54 - 0
src/main/java/com/caimei365/user/model/po/CmRelatedImage.java

@@ -0,0 +1,54 @@
+package com.caimei365.user.model.po;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.apache.ibatis.type.Alias;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 相关图片对象 cm_related_image
+ *
+ * @author Kaick
+ * @date 2023-12-14
+ */
+@Accessors(chain  = true )
+@Data
+@Alias("CmRelatedImage")
+public class CmRelatedImage implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    /** id */
+    private String id;
+
+    /** 分类:1分销报备凭证图片(cm_reporting_member)
+     ,2 (cm_providers)服务商相关简介图
+     ,3 (cm_providers)服务商相关资料文件
+     ,4 (cm_providers_contract)服务商相关合同文件 */
+    private String type;
+
+    /** 归属者Id(type字段表Id) */
+    private String authorId;
+
+    /** 图片 */
+    private String image;
+
+    /** 删除状态 0正常,其他删除 */
+    private Integer delFlag;
+
+    /** 修改时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date updateTime;
+
+    /** 添加时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createTime;
+
+
+}
+
+
+

+ 61 - 0
src/main/java/com/caimei365/user/model/vo/CmProvidersVO.java

@@ -0,0 +1,61 @@
+package com.caimei365.user.model.vo;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 对象 cm_providers VO对象
+ *
+ * @author Kaick
+ * @date 2023-12-14
+ */
+@Accessors(chain  = true )
+@Data
+public class CmProvidersVO implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+    /** id */
+    private String id;
+
+    /** 用户id */
+    private Integer userId;
+
+    /** 服务商名称 */
+    private String name;
+
+    /** 服务商级别为:1级,2级,3级 */
+    private Integer serviceLevel;
+
+    /** 服务商类型: 1个人,1企业 */
+    private Integer serviceCategory;
+
+    /** 服务商地址 */
+    private String address;
+
+    /** 联系人 */
+    private String linkMan;
+
+    /** 联系电话 */
+    private String mobile;
+
+    /** 简介 */
+    private String text;
+
+    /** 服务商二维码 */
+    private String qrCodeImage;
+
+    /** 资格证书图片 */
+    private String qualificationImage;
+
+    /** 资格证书编号 */
+    private String qualificationId;
+
+    /**
+     * 相关简介图集合
+     */
+    private List<String> textRelateds;
+
+}

+ 22 - 0
src/main/java/com/caimei365/user/service/CmProvidersService.java

@@ -0,0 +1,22 @@
+package com.caimei365.user.service;
+
+import com.caimei365.user.model.po.CmProviders;
+
+/**
+ * Service接口
+ *
+ * @author Kaick
+ * @date 2023-12-14
+ */
+public interface CmProvidersService
+{
+
+
+    /**
+     * 通过对象查询
+     *
+     * @param cmProviders
+     * @return
+     */
+    CmProviders getByCmProviders(CmProviders cmProviders);
+}

+ 43 - 0
src/main/java/com/caimei365/user/service/impl/CmProvidersServiceImpl.java

@@ -0,0 +1,43 @@
+package com.caimei365.user.service.impl;
+
+import com.caimei365.user.mapper.BaseMapper;
+import com.caimei365.user.mapper.CmProvidersMapper;
+import com.caimei365.user.model.po.CmProviders;
+import com.caimei365.user.model.po.CmRelatedImage;
+import com.caimei365.user.service.CmProvidersService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+/**
+ * Service业务层处理
+ *
+ * @author Kaick
+ * @date 2023-12-14
+ */
+@Service
+public class CmProvidersServiceImpl implements CmProvidersService
+{
+    @Resource
+    private CmProvidersMapper cmProvidersMapper;
+    @Resource
+    private BaseMapper baseMapper;
+
+    /**
+     * 通过对象查询
+     *
+     * @param cmProviders
+     * @return
+     */
+    @Override
+    public CmProviders getByCmProviders(CmProviders cmProviders)
+    {
+        CmProviders byCmProviders = cmProvidersMapper.getByCmProviders(cmProviders);
+        if(null!=byCmProviders){
+            byCmProviders.setTextRelateds(baseMapper.getRelatedImageList(new CmRelatedImage().setType("2").setAuthorId(byCmProviders.getId())));
+        }
+        return byCmProviders;
+    }
+
+
+}

+ 27 - 0
src/main/resources/mapper/BaseMapper.xml

@@ -757,4 +757,31 @@
         </where>
         limit 1
     </select>
+
+    <select id="getRelatedImageList" parameterType="CmRelatedImage" resultType="String">
+        select
+        cm_related_image.image
+        from cm_related_image AS cm_related_image
+        <where>  cm_related_image.delFlag = 0
+            <if test="id != null  and id != ''"> and cm_related_image.id = #{id}</if>
+            <if test="type != null  and type != ''">
+                and cm_related_image.type
+                <if test="type.toUpperCase().indexOf('=')==-1">
+                    = #{type}
+                </if>
+                <if test="type.toUpperCase().indexOf('=')!=-1">
+                    <if test="type.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="type.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="typeIn" collection="type.substring(type.toUpperCase().indexOf('=')+1,type.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{typeIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="authorId != null  and authorId != ''"> and cm_related_image.authorId = #{authorId}</if>
+            <if test="image != null  and image != ''"> and cm_related_image.image = #{image}</if>
+        </where>
+        group by cm_related_image.id
+        order by cm_related_image.createTime desc
+    </select>
+
 </mapper>

+ 226 - 0
src/main/resources/mapper/CmProvidersMapper.xml

@@ -0,0 +1,226 @@
+<?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.caimei365.user.mapper.CmProvidersMapper">
+
+    <resultMap type="CmProviders" id="CmProvidersResult">
+        <result property="id"    column="id"    />
+        <result property="userId"    column="userId"    />
+        <result property="name"    column="name"    />
+        <result property="serviceLevel"    column="serviceLevel"    />
+        <result property="serviceCategory"    column="serviceCategory"    />
+        <result property="address"    column="address"    />
+        <result property="linkMan"    column="linkMan"    />
+        <result property="mobile"    column="mobile"    />
+        <result property="status"    column="status"    />
+        <result property="text"    column="text"    />
+        <result property="qrCodeImage"    column="qrCodeImage"    />
+        <result property="qualificationImage"    column="qualificationImage"    />
+        <result property="qualificationId"    column="qualificationId"    />
+        <result property="createBy"    column="createBy"    />
+        <result property="updateTime"    column="updateTime"    />
+        <result property="createTime"    column="createTime"    />
+    </resultMap>
+
+    <sql id="selectCmProvidersVo">
+        select
+            cm_providers.id,
+            cm_providers.userId,
+            cm_providers.name,
+            cm_providers.serviceLevel,
+            cm_providers.serviceCategory,
+            cm_providers.address,
+            cm_providers.linkMan,
+            cm_providers.mobile,
+            cm_providers.status,
+            cm_providers.text,
+            cm_providers.qrCodeImage,
+            cm_providers.qualificationImage,
+            cm_providers.qualificationId,
+            cm_providers.createBy,
+            cm_providers.updateTime,
+            cm_providers.createTime
+    </sql>
+
+    <select id="getByCmProviders" parameterType="CmProviders" resultMap="CmProvidersResult">
+        <include refid="selectCmProvidersVo"/>
+        from cm_providers AS cm_providers
+        <where>
+            <if test="id != null  and id != ''"> and cm_providers.id = #{id}</if>
+            <if test="userId != null "> and cm_providers.userId = #{userId}</if>
+            <if test="name != null  and name != ''"> and cm_providers.name =#{name}</if>
+            <if test="serviceLevel != null "> and cm_providers.serviceLevel = #{serviceLevel}</if>
+            <if test="serviceCategory != null "> and cm_providers.serviceCategory = #{serviceCategory}</if>
+            <if test="address != null  and address != ''"> and cm_providers.address = #{address}</if>
+            <if test="linkMan != null  and linkMan != ''"> and cm_providers.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''"> and cm_providers.mobile = #{mobile}</if>
+            <if test="status != null "> and cm_providers.status = #{status}</if>
+            <if test="text != null  and text != ''"> and cm_providers.text = #{text}</if>
+            <if test="qrCodeImage != null  and qrCodeImage != ''"> and cm_providers.qrCodeImage = #{qrCodeImage}</if>
+            <if test="qualificationImage != null  and qualificationImage != ''"> and cm_providers.qualificationImage = #{qualificationImage}</if>
+            <if test="qualificationId != null  and qualificationId != ''"> and cm_providers.qualificationId = #{qualificationId}</if>
+        </where>
+        group by cm_providers.id
+        limit 0,1
+    </select>
+
+    <select id="getCmProvidersList" parameterType="CmProviders" resultMap="CmProvidersResult">
+        <include refid="selectCmProvidersVo"/>
+        from cm_providers AS cm_providers
+        <where>
+            <if test="id != null  and id != ''"> and cm_providers.id = #{id}</if>
+            <if test="userId != null "> and cm_providers.userId = #{userId}</if>
+            <if test="name != null  and name != ''"> and cm_providers.name like concat('%', #{name}, '%')</if>
+            <if test="serviceLevel != null "> and cm_providers.serviceLevel = #{serviceLevel}</if>
+            <if test="serviceCategory != null "> and cm_providers.serviceCategory = #{serviceCategory}</if>
+            <if test="address != null  and address != ''"> and cm_providers.address = #{address}</if>
+            <if test="linkMan != null  and linkMan != ''"> and cm_providers.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''"> and cm_providers.mobile = #{mobile}</if>
+            <if test="status != null "> and cm_providers.status = #{status}</if>
+            <if test="text != null  and text != ''"> and cm_providers.text = #{text}</if>
+            <if test="qrCodeImage != null  and qrCodeImage != ''"> and cm_providers.qrCodeImage = #{qrCodeImage}</if>
+            <if test="qualificationImage != null  and qualificationImage != ''"> and cm_providers.qualificationImage = #{qualificationImage}</if>
+            <if test="qualificationId != null  and qualificationId != ''"> and cm_providers.qualificationId = #{qualificationId}</if>
+        </where>
+        group by cm_providers.id
+        order by cm_providers.createTime desc
+    </select>
+
+    <select id="getCount" parameterType="CmProviders" resultType="int">
+        select count(1)
+        from cm_providers AS cm_providers
+        <where>
+            <if test="id != null  and id != ''"> and cm_providers.id = #{id}</if>
+            <if test="userId != null "> and cm_providers.userId = #{userId}</if>
+            <if test="name != null  and name != ''"> and cm_providers.name like concat('%', #{name}, '%')</if>
+            <if test="serviceLevel != null "> and cm_providers.serviceLevel = #{serviceLevel}</if>
+            <if test="serviceCategory != null "> and cm_providers.serviceCategory = #{serviceCategory}</if>
+            <if test="address != null  and address != ''"> and cm_providers.address = #{address}</if>
+            <if test="linkMan != null  and linkMan != ''"> and cm_providers.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''"> and cm_providers.mobile = #{mobile}</if>
+            <if test="status != null "> and cm_providers.status = #{status}</if>
+            <if test="text != null  and text != ''"> and cm_providers.text = #{text}</if>
+            <if test="qrCodeImage != null  and qrCodeImage != ''"> and cm_providers.qrCodeImage = #{qrCodeImage}</if>
+            <if test="qualificationImage != null  and qualificationImage != ''"> and cm_providers.qualificationImage = #{qualificationImage}</if>
+            <if test="qualificationId != null  and qualificationId != ''"> and cm_providers.qualificationId = #{qualificationId}</if>
+        </where>
+    </select>
+
+    <select id="getCmProvidersById" parameterType="String" resultMap="CmProvidersResult">
+        <include refid="selectCmProvidersVo"/>
+        from cm_providers AS cm_providers
+        where  cm_providers.id = #{id}
+    </select>
+
+
+    <select id="getById" parameterType="CmProviders" resultType="String">
+        select id
+        from cm_providers AS cm_providers
+        <where>
+            <if test="id != null  and id != ''"> and cm_providers.id = #{id}</if>
+            <if test="userId != null "> and cm_providers.userId = #{userId}</if>
+            <if test="name != null  and name != ''"> and cm_providers.name like concat('%', #{name}, '%')</if>
+            <if test="serviceLevel != null "> and cm_providers.serviceLevel = #{serviceLevel}</if>
+            <if test="serviceCategory != null "> and cm_providers.serviceCategory = #{serviceCategory}</if>
+            <if test="address != null  and address != ''"> and cm_providers.address = #{address}</if>
+            <if test="linkMan != null  and linkMan != ''"> and cm_providers.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''"> and cm_providers.mobile = #{mobile}</if>
+            <if test="status != null "> and cm_providers.status = #{status}</if>
+            <if test="text != null  and text != ''"> and cm_providers.text = #{text}</if>
+            <if test="qrCodeImage != null  and qrCodeImage != ''"> and cm_providers.qrCodeImage = #{qrCodeImage}</if>
+            <if test="qualificationImage != null  and qualificationImage != ''"> and cm_providers.qualificationImage = #{qualificationImage}</if>
+            <if test="qualificationId != null  and qualificationId != ''"> and cm_providers.qualificationId = #{qualificationId}</if>
+        </where>
+        group by cm_providers.id
+        limit 0,1
+    </select>
+
+    <insert id="addCmProviders" parameterType="CmProviders" useGeneratedKeys="true" keyProperty="id">
+        insert into cm_providers
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null and id != ''">id,</if>
+            <if test="userId != null">userId,</if>
+            <if test="name != null and name != ''">name,</if>
+            <if test="serviceLevel != null">serviceLevel,</if>
+            <if test="serviceCategory != null">serviceCategory,</if>
+            <if test="address != null and address != ''">address,</if>
+            <if test="linkMan != null and linkMan != ''">linkMan,</if>
+            <if test="mobile != null and mobile != ''">mobile,</if>
+            <if test="status != null">status,</if>
+            <if test="text != null and text != ''">text,</if>
+            <if test="qrCodeImage != null and qrCodeImage != ''">qrCodeImage,</if>
+            <if test="qualificationImage != null and qualificationImage != ''">qualificationImage,</if>
+            <if test="qualificationId != null and qualificationId != ''">qualificationId,</if>
+            <if test="createBy != null and createBy != ''">createBy,</if>
+            <if test="updateTime != null">updateTime,</if>
+            <if test="createTime != null">createTime,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null and id != ''">#{id},</if>
+            <if test="userId != null">#{userId},</if>
+            <if test="name != null and name != ''">#{name},</if>
+            <if test="serviceLevel != null">#{serviceLevel},</if>
+            <if test="serviceCategory != null">#{serviceCategory},</if>
+            <if test="address != null and address != ''">#{address},</if>
+            <if test="linkMan != null and linkMan != ''">#{linkMan},</if>
+            <if test="mobile != null and mobile != ''">#{mobile},</if>
+            <if test="status != null">#{status},</if>
+            <if test="text != null and text != ''">#{text},</if>
+            <if test="qrCodeImage != null and qrCodeImage != ''">#{qrCodeImage},</if>
+            <if test="qualificationImage != null and qualificationImage != ''">#{qualificationImage},</if>
+            <if test="qualificationId != null and qualificationId != ''">#{qualificationId},</if>
+            <if test="createBy != null and createBy != ''">#{createBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="createTime != null">#{createTime},</if>
+        </trim>
+    </insert>
+
+    <update id="updateCmProviders" parameterType="CmProviders">
+        update cm_providers
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="userId != null">userId = #{userId},</if>
+            <if test="name != null and name != ''">name = #{name},</if>
+            <if test="serviceLevel != null">serviceLevel = #{serviceLevel},</if>
+            <if test="serviceCategory != null">serviceCategory = #{serviceCategory},</if>
+            <if test="address != null and address != ''">address = #{address},</if>
+            <if test="linkMan != null and linkMan != ''">linkMan = #{linkMan},</if>
+            <if test="mobile != null and mobile != ''">mobile = #{mobile},</if>
+            <if test="status != null">status = #{status},</if>
+            <if test="text != null and text != ''">text = #{text},</if>
+            <if test="qrCodeImage != null and qrCodeImage != ''">qrCodeImage = #{qrCodeImage},</if>
+            <if test="qualificationImage != null and qualificationImage != ''">qualificationImage = #{qualificationImage},</if>
+            <if test="qualificationId != null and qualificationId != ''">qualificationId = #{qualificationId},</if>
+            <if test="createBy != null and createBy != ''">createBy = #{createBy},</if>
+            <if test="updateTime != null">updateTime = #{updateTime},</if>
+            <if test="createTime != null">createTime = #{createTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="delCmProvidersById" parameterType="String">
+        delete
+        from cm_providers where id = #{id}
+    </delete>
+
+    <delete id="delCmProviders" parameterType="CmProviders">
+        delete
+        from cm_providers AS cm_providers
+        <where>
+            <if test="id != null  and id != ''"> and cm_providers.id = #{id}</if>
+            <if test="userId != null "> and cm_providers.userId = #{userId}</if>
+            <if test="name != null  and name != ''"> and cm_providers.name like concat('%', #{name}, '%')</if>
+            <if test="serviceLevel != null "> and cm_providers.serviceLevel = #{serviceLevel}</if>
+            <if test="serviceCategory != null "> and cm_providers.serviceCategory = #{serviceCategory}</if>
+            <if test="address != null  and address != ''"> and cm_providers.address = #{address}</if>
+            <if test="linkMan != null  and linkMan != ''"> and cm_providers.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''"> and cm_providers.mobile = #{mobile}</if>
+            <if test="status != null "> and cm_providers.status = #{status}</if>
+            <if test="text != null  and text != ''"> and cm_providers.text = #{text}</if>
+            <if test="qrCodeImage != null  and qrCodeImage != ''"> and cm_providers.qrCodeImage = #{qrCodeImage}</if>
+            <if test="qualificationImage != null  and qualificationImage != ''"> and cm_providers.qualificationImage = #{qualificationImage}</if>
+            <if test="qualificationId != null  and qualificationId != ''"> and cm_providers.qualificationId = #{qualificationId}</if>
+        </where>
+    </delete>
+
+</mapper>