招商加盟

This commit is contained in:
SjS 2025-04-08 16:04:36 +08:00
parent 3b68b1a111
commit 8098ebc3da
10 changed files with 978 additions and 0 deletions

View File

@ -0,0 +1,75 @@
package com.ruoyi.bst.mchApply.domain;
import java.time.LocalDateTime;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 招商加盟对象 bst_mch_apply
*
* @author ruoyi
* @date 2025-04-08
*/
@Data
public class MchApply extends BaseEntity
{
private static final long serialVersionUID = 1L;
private Long applyId;
@Excel(name = "用户id")
@ApiModelProperty("用户id")
private Long userId;
@Excel(name = "申请状态", readConverterExp = "0=审核中1审核通过2已驳回")
@ApiModelProperty("申请状态")
private String status;
@Excel(name = "姓名")
@ApiModelProperty("姓名")
private String name;
@Excel(name = "手机号")
@ApiModelProperty("手机号")
private String mobile;
@Excel(name = "详细信息")
@ApiModelProperty("详细信息")
private String content;
@Excel(name = "反馈信息", readConverterExp = "对=外")
@ApiModelProperty("反馈信息")
private String callback;
@Excel(name = "审核人id")
@ApiModelProperty("审核人id")
private Long verifyBy;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("审核时间")
private LocalDateTime verifyTime;
@Excel(name = "审核意见")
@ApiModelProperty("审核意见")
private String verifyRemark;
@Excel(name = "是否有设备")
@ApiModelProperty("是否有设备")
private Integer hasDevice;
@Excel(name = "经营模式", readConverterExp = "1=个体,2=企业,3=政府,4=机构")
@ApiModelProperty("经营模式")
private String operateMode;
@Excel(name = "使用场景列表")
@ApiModelProperty("使用场景列表")
private String scenes;
}

View File

@ -0,0 +1,16 @@
package com.ruoyi.bst.mchApply.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class MchApplyQuery extends MchApply{
@ApiModelProperty("用户名称")
private String userName;
@ApiModelProperty("审核人名称")
private String verifyName;
}

View File

@ -0,0 +1,15 @@
package com.ruoyi.bst.mchApply.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class MchApplyVO extends MchApply{
@ApiModelProperty("用户名称")
private String userName;
@ApiModelProperty("审核人名称")
private String verifyName;
}

View File

@ -0,0 +1,22 @@
package com.ruoyi.bst.mchApply.domain.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum MchApplyStatus {
APPROVING("1"), // 审核中
PASSED("2"), // 审核通过
REJECTED("3") // 审核驳回
;
private final String status;
public static String getStatusByPass(boolean pass) {
return pass ? PASSED.getStatus() : REJECTED.getStatus();
}
}

View File

@ -0,0 +1,82 @@
package com.ruoyi.bst.mchApply.mapper;
import java.util.List;
import com.ruoyi.bst.mchApply.domain.MchApply;
import com.ruoyi.bst.mchApply.domain.MchApplyVO;
import com.ruoyi.bst.mchApply.domain.MchApplyQuery;
import org.apache.ibatis.annotations.Param;
/**
* 招商加盟Mapper接口
*
* @author ruoyi
* @date 2025-04-08
*/
public interface MchApplyMapper
{
/**
* 查询招商加盟
*
* @param applyId 招商加盟主键
* @return 招商加盟
*/
MchApplyVO selectMchApplyByApplyId(Long applyId);
/**
* 查询招商加盟列表
*
* @param query 招商加盟
* @return 招商加盟集合
*/
List<MchApplyVO> selectMchApplyList(@Param("query")MchApplyQuery query);
/**
* 新增招商加盟
*
* @param mchApply 招商加盟
* @return 结果
*/
int insertMchApply(MchApply mchApply);
/**
* 批量新增招商加盟
*/
int batchInsert(@Param("list") List<? extends MchApply> list);
/**
* 批量修改招商加盟
*/
int batchUpdate(@Param("list") List<? extends MchApply> list);
/**
* 修改招商加盟
*
* @param mchApply 招商加盟
* @return 结果
*/
public int updateMchApply(@Param("data") MchApply mchApply);
/**
* 删除招商加盟
*
* @param applyId 招商加盟主键
* @return 结果
*/
int deleteMchApplyByApplyId(Long applyId);
/**
* 根据条件更新
* @param data
* @param query
* @return
*/
int updateWithCondition(@Param("data") MchApply data, @Param("query") MchApplyQuery query);
/**
* 批量删除招商加盟
*
* @param applyIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteMchApplyByApplyIds(Long[] applyIds);
}

View File

@ -0,0 +1,404 @@
<?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.ruoyi.bst.mchApply.mapper.MchApplyMapper">
<resultMap type="MchApplyVO" id="MchApplyResult" autoMapping="true">
<result property="applyId" column="apply_id" />
<result property="userId" column="user_id" />
<result property="status" column="status" />
<result property="name" column="name" />
<result property="mobile" column="mobile" />
<result property="content" column="content" />
<result property="remark" column="remark" />
<result property="callback" column="callback" />
<result property="verifyBy" column="verify_by" />
<result property="verifyTime" column="verify_time" />
<result property="verifyRemark" column="verify_remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="deleted" column="deleted" />
<result property="hasDevice" column="has_device" />
<result property="operateMode" column="operate_mode" />
<result property="scenes" column="scenes" />
</resultMap>
<sql id="selectMchApplyVo">
select
bma.apply_id,
bma.user_id,
bma.status,
bma.name,
bma.mobile,
bma.content,
bma.remark,
bma.callback,
bma.verify_by,
bma.verify_time,
bma.verify_remark,
bma.create_time,
bma.update_time,
bma.deleted,
bma.has_device,
bma.operate_mode,
bma.scenes,
su.user_name as userName,
su_verify.user_name as verifyName
from bst_mch_apply bma
left join sys_user su on bma.user_id = su.user_id
left join sys_user su_verify on bma.verify_by = su_verify.user_id
</sql>
<sql id="searchCondition">
<if test="query.userId != null "> and bma.user_id = #{query.userId}</if>
<if test="query.status != null"> and bma.status = #{query.status}</if>
<if test="query.name != null"> and bma.name like concat('%', #{query.name}, '%')</if>
<if test="query.userName != null"> and su.user_name like concat('%', #{query.userName}, '%')</if>
<if test="query.mobile != null"> and bma.mobile like concat('%', #{query.mobile}, '%')</if>
<if test="query.verifyBy != null "> and bma.verify_by = #{query.verifyBy}</if>
<if test="query.verifyName != null "> and su.user_name like concat('%', #{query.verifyName}, '%')</if>
<if test="query.deleted == null">and deleted = false</if>
<if test="query.deleted != null">and deleted = #{query.deleted}</if>
<if test="query.applyId != null">and apply_id = #{query.applyId}</if>
<if test="query.hasDevice != null">and has_device = #{query.hasDevice}</if>
<if test="query.operateMode != null">and operate_mode = #{query.operateMode}</if>
${@com.ruoyi.framework.util.DataScopeUtil@dataScope(
null,
"bma.user_id,bma.verify_by",
null,
null,
query.scope
)}
${query.params.dataScope}
</sql>
<select id="selectMchApplyList" parameterType="MchApplyQuery" resultMap="MchApplyResult">
<include refid="selectMchApplyVo"/>
<where>
<include refid="searchCondition"/>
</where>
</select>
<select id="selectMchApplyByApplyId" parameterType="Long" resultMap="MchApplyResult">
<include refid="selectMchApplyVo"/>
where apply_id = #{applyId}
</select>
<insert id="insertMchApply" parameterType="MchApply" useGeneratedKeys="true" keyProperty="applyId">
insert into bst_mch_apply
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="status != null and status != ''">status,</if>
<if test="name != null and name != ''">name,</if>
<if test="mobile != null and mobile != ''">mobile,</if>
<if test="content != null and content != ''">content,</if>
<if test="remark != null">remark,</if>
<if test="callback != null">callback,</if>
<if test="verifyBy != null">verify_by,</if>
<if test="verifyTime != null">verify_time,</if>
<if test="verifyRemark != null">verify_remark,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="deleted != null">deleted,</if>
<if test="hasDevice != null">has_device,</if>
<if test="operateMode != null">operate_mode,</if>
<if test="scenes != null">scenes,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="mobile != null and mobile != ''">#{mobile},</if>
<if test="content != null and content != ''">#{content},</if>
<if test="remark != null">#{remark},</if>
<if test="callback != null">#{callback},</if>
<if test="verifyBy != null">#{verifyBy},</if>
<if test="verifyTime != null">#{verifyTime},</if>
<if test="verifyRemark != null">#{verifyRemark},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="deleted != null">#{deleted},</if>
<if test="hasDevice != null">#{hasDevice},</if>
<if test="operateMode != null">#{operateMode},</if>
<if test="scenes != null">#{scenes},</if>
</trim>
</insert>
<insert id="batchInsert" parameterType="MchApply" useGeneratedKeys="true" keyProperty="applyId">
insert into bst_mch_apply
<trim prefix="(" suffix=")" suffixOverrides=",">
user_id,
status,
name,
mobile,
content,
remark,
callback,
verify_by,
verify_time,
verify_remark,
create_time,
update_time,
deleted,
has_device,
operate_mode,
scenes,
</trim>
values
<foreach collection="list" item="i" separator=",">
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="i.userId != null ">#{i.userId},</if>
<if test="i.userId == null ">default,</if>
<if test="i.status != null and i.status != ''">#{i.status},</if>
<if test="i.status == null or i.status == ''">default,</if>
<if test="i.name != null and i.name != ''">#{i.name},</if>
<if test="i.name == null or i.name == ''">default,</if>
<if test="i.mobile != null and i.mobile != ''">#{i.mobile},</if>
<if test="i.mobile == null or i.mobile == ''">default,</if>
<if test="i.content != null and i.content != ''">#{i.content},</if>
<if test="i.content == null or i.content == ''">default,</if>
<if test="i.remark != null ">#{i.remark},</if>
<if test="i.remark == null ">default,</if>
<if test="i.callback != null ">#{i.callback},</if>
<if test="i.callback == null ">default,</if>
<if test="i.verifyBy != null ">#{i.verifyBy},</if>
<if test="i.verifyBy == null ">default,</if>
<if test="i.verifyTime != null ">#{i.verifyTime},</if>
<if test="i.verifyTime == null ">default,</if>
<if test="i.verifyRemark != null ">#{i.verifyRemark},</if>
<if test="i.verifyRemark == null ">default,</if>
<if test="i.createTime != null ">#{i.createTime},</if>
<if test="i.createTime == null ">default,</if>
<if test="i.updateTime != null ">#{i.updateTime},</if>
<if test="i.updateTime == null ">default,</if>
<if test="i.deleted != null ">#{i.deleted},</if>
<if test="i.deleted == null ">default,</if>
<if test="i.hasDevice != null ">#{i.hasDevice},</if>
<if test="i.hasDevice == null ">default,</if>
<if test="i.operateMode != null ">#{i.operateMode},</if>
<if test="i.operateMode == null ">default,</if>
<if test="i.scenes != null ">#{i.scenes},</if>
<if test="i.scenes == null ">default,</if>
</trim>
</foreach>
</insert>
<update id="batchUpdate">
update bst_mch_apply
<trim prefix="SET" suffixOverrides=",">
<foreach open="user_id = CASE apply_id" collection="list" item="item" close="END,">
<choose>
<when test="item.userId != null ">
WHEN #{item.apply_id} THEN #{item.userId}
</when>
<otherwise>
WHEN #{item.apply_id} THEN `user_id`
</otherwise>
</choose>
</foreach>
<foreach open="status = CASE apply_id" collection="list" item="item" close="END,">
<choose>
<when test="item.status != null and item.status != ''">
WHEN #{item.apply_id} THEN #{item.status}
</when>
<otherwise>
WHEN #{item.apply_id} THEN `status`
</otherwise>
</choose>
</foreach>
<foreach open="name = CASE apply_id" collection="list" item="item" close="END,">
<choose>
<when test="item.name != null and item.name != ''">
WHEN #{item.apply_id} THEN #{item.name}
</when>
<otherwise>
WHEN #{item.apply_id} THEN `name`
</otherwise>
</choose>
</foreach>
<foreach open="mobile = CASE apply_id" collection="list" item="item" close="END,">
<choose>
<when test="item.mobile != null and item.mobile != ''">
WHEN #{item.apply_id} THEN #{item.mobile}
</when>
<otherwise>
WHEN #{item.apply_id} THEN `mobile`
</otherwise>
</choose>
</foreach>
<foreach open="content = CASE apply_id" collection="list" item="item" close="END,">
<choose>
<when test="item.content != null and item.content != ''">
WHEN #{item.apply_id} THEN #{item.content}
</when>
<otherwise>
WHEN #{item.apply_id} THEN `content`
</otherwise>
</choose>
</foreach>
<foreach open="remark = CASE apply_id" collection="list" item="item" close="END,">
<choose>
<when test="item.remark != null ">
WHEN #{item.apply_id} THEN #{item.remark}
</when>
<otherwise>
WHEN #{item.apply_id} THEN `remark`
</otherwise>
</choose>
</foreach>
<foreach open="callback = CASE apply_id" collection="list" item="item" close="END,">
<choose>
<when test="item.callback != null ">
WHEN #{item.apply_id} THEN #{item.callback}
</when>
<otherwise>
WHEN #{item.apply_id} THEN `callback`
</otherwise>
</choose>
</foreach>
<foreach open="verify_by = CASE apply_id" collection="list" item="item" close="END,">
<choose>
<when test="item.verifyBy != null ">
WHEN #{item.apply_id} THEN #{item.verifyBy}
</when>
<otherwise>
WHEN #{item.apply_id} THEN `verify_by`
</otherwise>
</choose>
</foreach>
<foreach open="verify_time = CASE apply_id" collection="list" item="item" close="END,">
<choose>
<when test="item.verifyTime != null ">
WHEN #{item.apply_id} THEN #{item.verifyTime}
</when>
<otherwise>
WHEN #{item.apply_id} THEN `verify_time`
</otherwise>
</choose>
</foreach>
<foreach open="verify_remark = CASE apply_id" collection="list" item="item" close="END,">
<choose>
<when test="item.verifyRemark != null ">
WHEN #{item.apply_id} THEN #{item.verifyRemark}
</when>
<otherwise>
WHEN #{item.apply_id} THEN `verify_remark`
</otherwise>
</choose>
</foreach>
<foreach open="create_time = CASE apply_id" collection="list" item="item" close="END,">
<choose>
<when test="item.createTime != null ">
WHEN #{item.apply_id} THEN #{item.createTime}
</when>
<otherwise>
WHEN #{item.apply_id} THEN `create_time`
</otherwise>
</choose>
</foreach>
<foreach open="update_time = CASE apply_id" collection="list" item="item" close="END,">
<choose>
<when test="item.updateTime != null ">
WHEN #{item.apply_id} THEN #{item.updateTime}
</when>
<otherwise>
WHEN #{item.apply_id} THEN `update_time`
</otherwise>
</choose>
</foreach>
<foreach open="deleted = CASE apply_id" collection="list" item="item" close="END,">
<choose>
<when test="item.deleted != null ">
WHEN #{item.apply_id} THEN #{item.deleted}
</when>
<otherwise>
WHEN #{item.apply_id} THEN `deleted`
</otherwise>
</choose>
</foreach>
<foreach open="has_device = CASE apply_id" collection="list" item="item" close="END,">
<choose>
<when test="item.hasDevice != null ">
WHEN #{item.apply_id} THEN #{item.hasDevice}
</when>
<otherwise>
WHEN #{item.apply_id} THEN `has_device`
</otherwise>
</choose>
</foreach>
<foreach open="operate_mode = CASE apply_id" collection="list" item="item" close="END,">
<choose>
<when test="item.operateMode != null ">
WHEN #{item.apply_id} THEN #{item.operateMode}
</when>
<otherwise>
WHEN #{item.apply_id} THEN `operate_mode`
</otherwise>
</choose>
</foreach>
<foreach open="scenes = CASE apply_id" collection="list" item="item" close="END,">
<choose>
<when test="item.scenes != null ">
WHEN #{item.apply_id} THEN #{item.scenes}
</when>
<otherwise>
WHEN #{item.apply_id} THEN `scenes`
</otherwise>
</choose>
</foreach>
</trim>
where apply_id in
<foreach item="item" collection="list" open="(" separator="," close=")">
#{item.applyId}
</foreach>
</update>
<update id="updateMchApply" parameterType="MchApply">
update bst_mch_apply
<trim prefix="SET" suffixOverrides=",">
<include refid="updateColumns"/>
</trim>
where apply_id = #{data.applyId}
</update>
<update id="updateWithCondition">
update bst_mch_apply bma
<trim prefix="SET" suffixOverrides=",">
<include refid="updateColumns"/>
</trim>
<where>
<include refid="searchCondition"/>
</where>
</update>
<sql id="updateColumns">
<if test="data.userId != null">user_id = #{data.userId},</if>
<if test="data.status != null and data.status != ''">status = #{data.status},</if>
<if test="data.name != null and data.name != ''">name = #{data.name},</if>
<if test="data.mobile != null and data.mobile != ''">mobile = #{data.mobile},</if>
<if test="data.content != null and data.content != ''">content = #{data.content},</if>
<if test="data.remark != null">remark = #{data.remark},</if>
<if test="data.callback != null">callback = #{data.callback},</if>
<if test="data.verifyBy != null">verify_by = #{data.verifyBy},</if>
<if test="data.verifyTime != null">verify_time = #{data.verifyTime},</if>
<if test="data.verifyRemark != null">verify_remark = #{data.verifyRemark},</if>
<if test="data.createTime != null">create_time = #{data.createTime},</if>
<if test="data.updateTime != null">update_time = #{data.updateTime},</if>
<if test="data.deleted != null">deleted = #{data.deleted},</if>
<if test="data.hasDevice != null">has_device = #{data.hasDevice},</if>
<if test="data.operateMode != null">operate_mode = #{data.operateMode},</if>
<if test="data.scenes != null">scenes = #{data.scenes},typeHandler=com.ruoyi.system.mapper.typehandler.StringSplitListTypeHandler},</if>
</sql>
<delete id="deleteMchApplyByApplyId" parameterType="Long">
delete from bst_mch_apply where apply_id = #{applyId}
</delete>
<delete id="deleteMchApplyByApplyIds" parameterType="String">
delete from bst_mch_apply where apply_id in
<foreach item="applyId" collection="array" open="(" separator="," close=")">
#{applyId}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,65 @@
package com.ruoyi.bst.mchApply.service;
import java.util.List;
import com.ruoyi.bst.mchApply.domain.MchApply;
import com.ruoyi.bst.mchApply.domain.MchApplyVO;
import com.ruoyi.bst.mchApply.domain.MchApplyQuery;
/**
* 招商加盟Service接口
*
* @author ruoyi
* @date 2025-04-08
*/
public interface MchApplyService
{
/**
* 查询招商加盟
*
* @param applyId 招商加盟主键
* @return 招商加盟
*/
public MchApplyVO selectMchApplyByApplyId(Long applyId);
/**
* 查询招商加盟列表
*
* @param mchApply 招商加盟
* @return 招商加盟集合
*/
public List<MchApplyVO> selectMchApplyList(MchApplyQuery mchApply);
/**
* 新增招商加盟
*
* @param mchApply 招商加盟
* @return 结果
*/
public int insertMchApply(MchApply mchApply);
/**
* 修改招商加盟
*
* @param mchApply 招商加盟
* @return 结果
*/
public int updateMchApply(MchApply mchApply);
/**
* 批量删除招商加盟
*
* @param applyIds 需要删除的招商加盟主键集合
* @return 结果
*/
public int deleteMchApplyByApplyIds(Long[] applyIds);
/**
* 删除招商加盟信息
*
* @param applyId 招商加盟主键
* @return 结果
*/
public int deleteMchApplyByApplyId(Long applyId);
boolean verify(Long applyId, Boolean pass, String remark);
}

View File

@ -0,0 +1,146 @@
package com.ruoyi.bst.mchApply.service.impl;
import java.time.LocalDateTime;
import java.util.List;
import com.ruoyi.bst.mchApply.domain.enums.MchApplyStatus;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServiceUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.bst.mchApply.mapper.MchApplyMapper;
import com.ruoyi.bst.mchApply.domain.MchApply;
import com.ruoyi.bst.mchApply.domain.MchApplyVO;
import com.ruoyi.bst.mchApply.domain.MchApplyQuery;
import com.ruoyi.bst.mchApply.service.MchApplyService;
import org.springframework.transaction.support.TransactionTemplate;
/**
* 招商加盟Service业务层处理
*
* @author ruoyi
* @date 2025-04-08
*/
@Service
public class MchApplyServiceImpl implements MchApplyService
{
@Autowired
private MchApplyMapper mchApplyMapper;
@Autowired
private TransactionTemplate transactionTemplate;
/**
* 查询招商加盟
*
* @param applyId 招商加盟主键
* @return 招商加盟
*/
@Override
public MchApplyVO selectMchApplyByApplyId(Long applyId)
{
return mchApplyMapper.selectMchApplyByApplyId(applyId);
}
/**
* 查询招商加盟列表
*
* @param mchApply 招商加盟
* @return 招商加盟
*/
@Override
public List<MchApplyVO> selectMchApplyList(MchApplyQuery mchApply)
{
return mchApplyMapper.selectMchApplyList(mchApply);
}
/**
* 新增招商加盟
*
* @param mchApply 招商加盟
* @return 结果
*/
@Override
public int insertMchApply(MchApply mchApply)
{
mchApply.setCreateTime(DateUtils.getNowDate());
return mchApplyMapper.insertMchApply(mchApply);
}
/**
* 修改招商加盟
*
* @param mchApply 招商加盟
* @return 结果
*/
@Override
public int updateMchApply(MchApply mchApply)
{
mchApply.setUpdateTime(DateUtils.getNowDate());
return mchApplyMapper.updateMchApply(mchApply);
}
/**
* 批量删除招商加盟
*
* @param applyIds 需要删除的招商加盟主键
* @return 结果
*/
@Override
public int deleteMchApplyByApplyIds(Long[] applyIds)
{
return mchApplyMapper.deleteMchApplyByApplyIds(applyIds);
}
/**
* 删除招商加盟信息
*
* @param applyId 招商加盟主键
* @return 结果
*/
@Override
public int deleteMchApplyByApplyId(Long applyId)
{
return mchApplyMapper.deleteMchApplyByApplyId(applyId);
}
/**
* 审核
*
* @param applyId 申请id
* @param pass 是否通过
* @param remark 审核意见
*/
@Override
public boolean verify(Long applyId, Boolean pass, String remark) {
ServiceUtil.assertion(applyId == null, "id不允许为空");
ServiceUtil.assertion(pass == null, "是否通过不允许为空");
ServiceUtil.assertion(remark == null, "审核意见不允许为空");
// 查询申请数据
MchApplyVO dbApply = selectMchApplyByApplyId(applyId);
ServiceUtil.assertion(dbApply == null, "申请不存在");
// 修改内容
MchApply apply = new MchApply();
apply.setVerifyBy(SecurityUtils.getUserId());
apply.setVerifyTime(LocalDateTime.now());
apply.setStatus(MchApplyStatus.getStatusByPass(pass));
apply.setVerifyRemark(remark);
// 修改条件
MchApplyQuery condition = new MchApplyQuery();
condition.setApplyId(applyId);
condition.setStatus(MchApplyStatus.APPROVING.getStatus());
transactionTemplate.execute(status -> {
// 修改申请状态
int i = mchApplyMapper.updateWithCondition(apply, condition);
ServiceUtil.assertion(i != 1, "当前申请状态已发生变更,请刷新后重试");
return Boolean.TRUE;
});
return true;
}
}

View File

@ -0,0 +1,35 @@
package com.ruoyi.web.app;
import com.ruoyi.bst.fault.domain.FaultVO;
import com.ruoyi.bst.mchApply.domain.MchApplyVO;
import com.ruoyi.bst.mchApply.service.MchApplyService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import io.swagger.annotations.ApiOperation;
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.RestController;
@RestController
@RequestMapping("/app/mchApply")
public class AppMchApply extends BaseController {
@Autowired
private MchApplyService mchApplyService;
/**
* 新增合作申请
* @param mchApply
* @return
*/
@ApiOperation("故障申报")
@PostMapping
public AjaxResult add(@RequestBody MchApplyVO mchApply) {
mchApply.setUserId(getUserId());
mchApply.setName(getUsername());
return success(mchApplyService.insertMchApply(mchApply));
}
}

View File

@ -0,0 +1,118 @@
package com.ruoyi.web.bst;
import com.ruoyi.bst.mchApply.domain.MchApply;
import com.ruoyi.bst.mchApply.domain.MchApplyQuery;
import com.ruoyi.bst.mchApply.domain.MchApplyVO;
import com.ruoyi.bst.mchApply.service.MchApplyService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 招商加盟Controller
*
* @author ruoyi
* @date 2025-04-08
*/
@RestController
@RequestMapping("/bst/mchApply")
public class MchApplyController extends BaseController
{
@Autowired
private MchApplyService mchApplyService;
/**
* 查询招商加盟列表
*/
@PreAuthorize("@ss.hasPermi('bst:mchApply:list')")
@GetMapping("/list")
public TableDataInfo list(MchApplyQuery query)
{
startPage();
startOrderBy();
List<MchApplyVO> list = mchApplyService.selectMchApplyList(query);
return getDataTable(list);
}
/**
* 导出招商加盟列表
*/
@PreAuthorize("@ss.hasPermi('bst:mchApply:export')")
@Log(title = "招商加盟", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MchApplyQuery query)
{
List<MchApplyVO> list = mchApplyService.selectMchApplyList(query);
ExcelUtil<MchApplyVO> util = new ExcelUtil<MchApplyVO>(MchApplyVO.class);
util.exportExcel(response, list, "招商加盟数据");
}
/**
* 获取招商加盟详细信息
*/
@PreAuthorize("@ss.hasPermi('bst:mchApply:query')")
@GetMapping(value = "/{applyId}")
public AjaxResult getInfo(@PathVariable("applyId") Long applyId)
{
return success(mchApplyService.selectMchApplyByApplyId(applyId));
}
/**
* 新增招商加盟
*/
@PreAuthorize("@ss.hasPermi('bst:mchApply:add')")
@Log(title = "招商加盟", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MchApply mchApply)
{
return toAjax(mchApplyService.insertMchApply(mchApply));
}
/**
* 修改招商加盟
*/
@PreAuthorize("@ss.hasPermi('bst:mchApply:edit')")
@Log(title = "招商加盟", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MchApply mchApply)
{
return toAjax(mchApplyService.updateMchApply(mchApply));
}
/**
* 删除招商加盟
*/
@PreAuthorize("@ss.hasPermi('bst:mchApply:remove')")
@Log(title = "招商加盟", businessType = BusinessType.DELETE)
@DeleteMapping("/{applyIds}")
public AjaxResult remove(@PathVariable Long[] applyIds)
{
return toAjax(mchApplyService.deleteMchApplyByApplyIds(applyIds));
}
/**
* 商家合作申请
* @param applyId
* @param pass
* @param remark
* @return
*/
@PreAuthorize("@ss.hasPermi('bst:mchApply:verify')")
@Log(title = "商家合作申请", businessType = BusinessType.VERIFY)
@PutMapping("/{applyId}/verify")
public AjaxResult verify(@PathVariable @ApiParam("申请id") Long applyId,
@RequestParam @ApiParam("是否通过") Boolean pass,
@RequestParam @ApiParam("审核意见") String remark) {
return toAjax(mchApplyService.verify(applyId, pass, remark));
}
}