master:管理员审核流程完善;

pull/1121/head
liujiang 2025-04-14 23:55:35 +08:00
parent 77221dd460
commit a52539e753
19 changed files with 606 additions and 11 deletions

View File

@ -4,10 +4,14 @@ import cn.hutool.core.bean.BeanUtil;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.XktBaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.Page;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.web.controller.xkt.vo.store.StoreUpdateVO;
import com.ruoyi.xkt.dto.store.StoreCreateDTO;
import com.ruoyi.xkt.dto.store.StoreUpdateDTO;
import com.ruoyi.web.controller.xkt.vo.store.*;
import com.ruoyi.web.controller.xkt.vo.storeProd.StoreProdPageVO;
import com.ruoyi.web.controller.xkt.vo.storeProd.StoreProdResVO;
import com.ruoyi.xkt.dto.store.*;
import com.ruoyi.xkt.dto.storeProduct.StoreProdPageDTO;
import com.ruoyi.xkt.dto.storeProduct.StoreProdPageResDTO;
import com.ruoyi.xkt.service.IStoreService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -22,7 +26,7 @@ import org.springframework.web.bind.annotation.*;
* @author ruoyi
* @date 2025-03-26
*/
@Api(tags = "档口")
@Api(tags = "档口功能")
@RestController
@RequiredArgsConstructor
@RequestMapping("/rest/v1/stores")
@ -51,5 +55,59 @@ public class StoreController extends XktBaseController {
return R.ok(storeService.updateStore(BeanUtil.toBean(storeUpdateVO, StoreUpdateDTO.class)));
}
/**
*
*/
// @PreAuthorize("@ss.hasPermi('system:store:list')")
@ApiOperation(value = "查询档口列表 ", httpMethod = "POST", response = R.class)
@PostMapping("/page")
public R<Page<StorePageResDTO>> page(@Validated @RequestBody StorePageVO pageVO) {
return R.ok(storeService.page(BeanUtil.toBean(pageVO, StorePageDTO.class)));
}
/**
* /
*/
// @PreAuthorize("@ss.hasPermi('system:store:edit')")
@ApiOperation(value = "档口启用/停用", httpMethod = "PUT", response = R.class)
@Log(title = "档口启用/停用", businessType = BusinessType.UPDATE)
@PutMapping("/del-flag")
public R<Integer> updateDelFlag(@Validated @RequestBody StoreUpdateDelFlagVO updateDelFlagVO) {
return R.ok(storeService.updateDelFlag(BeanUtil.toBean(updateDelFlagVO, StoreUpdateDelFlagDTO.class)));
}
/**
*
*/
// @PreAuthorize("@ss.hasPermi('system:store:edit')")
@ApiOperation(value = "档口审核", httpMethod = "PUT", response = R.class)
@Log(title = "档口审核", businessType = BusinessType.UPDATE)
@PutMapping("/approve")
public R<Integer> approve(@Validated @RequestBody StoreAuditVO auditVO) {
return R.ok(storeService.approve(BeanUtil.toBean(auditVO, StoreAuditDTO.class)));
}
/**
*
*/
// @PreAuthorize("@ss.hasPermi('system:product:query')")
@ApiOperation(value = "获取档口详细信息", httpMethod = "GET", response = R.class)
@GetMapping(value = "/{storeId}")
public R<StoreBasicResVO> getInfo(@PathVariable("storeId") Long storeId) {
return R.ok(BeanUtil.toBean(storeService.getInfo(storeId), StoreBasicResVO.class));
}
/**
*
*/
// @PreAuthorize("@ss.hasPermi('system:product:query')")
@ApiOperation(value = "档口审核是获取档口基本信息", httpMethod = "GET", response = R.class)
@GetMapping(value = "/approve/{storeId}")
public R<StoreApproveResVO> getApproveInfo(@PathVariable("storeId") Long storeId) {
return R.ok(BeanUtil.toBean(storeService.getApproveInfo(storeId), StoreApproveResVO.class));
}
}

View File

@ -0,0 +1,22 @@
package com.ruoyi.web.controller.xkt.vo.store;
import com.ruoyi.web.controller.xkt.vo.storeCertificate.StoreCertResVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("档口基本信息")
@Data
public class StoreApproveResVO {
@ApiModelProperty(value = "档口基本信息")
private StoreBasicResVO basic;
@ApiModelProperty(value = "档口认证信息")
private StoreCertResVO certificate;
}

View File

@ -0,0 +1,31 @@
package com.ruoyi.web.controller.xkt.vo.store;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("更改档口基本信息")
@Data
@Accessors(chain = true)
public class StoreAuditVO {
@ApiModelProperty(value = "档口ID", required = true)
@NotNull(message = "档口ID不能为空")
private Long storeId;
@NotNull(message = "审核状态不能为空")
@ApiModelProperty(value = "审核状态", required = true)
private Boolean approve;
@ApiModelProperty(value = "拒绝理由")
private String rejectReason;
}

View File

@ -0,0 +1,62 @@
package com.ruoyi.web.controller.xkt.vo.store;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("档口基本信息")
@Data
public class StoreBasicResVO {
@ApiModelProperty(value = "档口ID")
private Long storeId;
@ApiModelProperty(value = "档口名称")
private String storeName;
@ApiModelProperty(value = "档口负责人ID")
private Long userId;
@ApiModelProperty(value = "档口负责人ID")
private String userName;
@ApiModelProperty(value = "品牌名称")
private String brandName;
@ApiModelProperty(value = "联系人")
private String contactName;
@ApiModelProperty(value = "联系电话")
private String contactPhone;
@ApiModelProperty(value = "备选联系电话")
private String contactBackPhone;
@ApiModelProperty(value = "微信账号")
private String wechatAccount;
@ApiModelProperty(value = "QQ账号")
private String qqAccount;
@ApiModelProperty(value = "支付宝账号")
private String alipayAccount;
@ApiModelProperty(value = "经营年限")
private Integer operateYears;
@ApiModelProperty(value = "档口地址")
private String storeAddress;
@ApiModelProperty(value = "工厂地址")
private String facAddress;
@ApiModelProperty(value = "生产规模")
private Integer prodScale;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@ApiModelProperty(value = "试用截止时间")
private Date trialEndTime;
@ApiModelProperty(value = "已使用文件大小")
private BigDecimal storageUsage;
@ApiModelProperty(value = "档口状态")
private Integer storeStatus;
@ApiModelProperty(value = "拒绝理由")
private String rejectReason;
@ApiModelProperty(value = "档口模板ID")
private Integer templateNum;
}

View File

@ -0,0 +1,24 @@
package com.ruoyi.web.controller.xkt.vo.store;
import com.ruoyi.web.controller.xkt.vo.BasePageVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@EqualsAndHashCode(callSuper = true)
@ApiModel("档口分页查询入参")
@Data
public class StorePageVO extends BasePageVO {
@ApiModelProperty(value = "档口名称")
private String storeName;
@ApiModelProperty(value = "档口状态")
private Integer storeStatus;
}

View File

@ -0,0 +1,27 @@
package com.ruoyi.web.controller.xkt.vo.store;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("更改档口基本信息")
@Data
@Accessors(chain = true)
public class StoreUpdateDelFlagVO {
@ApiModelProperty(value = "档口ID", required = true)
@NotNull(message = "档口ID不能为空")
private Long storeId;
@NotNull(message = "启用状态不能为空")
@ApiModelProperty(value = "启用状态", required = true)
private Boolean delFlag;
}

View File

@ -1,5 +1,6 @@
package com.ruoyi.common.core.domain.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType;
import com.ruoyi.common.annotation.Excel.Type;
@ -27,6 +28,7 @@ public class SysUser extends BaseEntity {
* ID
*/
@Excel(name = "用户序号", type = Type.EXPORT, cellType = ColumnType.NUMERIC, prompt = "用户编号")
@TableId(value = "user_id")
private Long userId;
/**

View File

@ -1,5 +1,6 @@
package com.ruoyi.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.core.domain.entity.SysUser;
import org.apache.ibatis.annotations.Param;
@ -10,7 +11,7 @@ import java.util.List;
*
* @author ruoyi
*/
public interface SysUserMapper {
public interface SysUserMapper extends BaseMapper<SysUser> {
/**
*
*

View File

@ -133,6 +133,11 @@ public class Store extends XktBaseEntity {
@Excel(name = "档口状态")
private Integer storeStatus;
/**
*
*/
private String rejectReason;
/**
* ID
*/

View File

@ -0,0 +1,22 @@
package com.ruoyi.xkt.dto.store;
import com.ruoyi.xkt.dto.storeCertificate.StoreCertResDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("档口基本信息")
@Data
public class StoreApproveResDTO {
@ApiModelProperty(value = "档口基本信息")
private StoreBasicResDTO basic;
@ApiModelProperty(value = "档口认证信息")
private StoreCertResDTO certificate;
}

View File

@ -0,0 +1,27 @@
package com.ruoyi.xkt.dto.store;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("更改档口基本信息")
@Data
@Accessors(chain = true)
public class StoreAuditDTO {
@ApiModelProperty(value = "档口ID")
private Long storeId;
@ApiModelProperty(value = "审核状态")
private Boolean approve;
@ApiModelProperty(value = "审核信息")
private String rejectReason;
}

View File

@ -0,0 +1,62 @@
package com.ruoyi.xkt.dto.store;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("档口基本信息")
@Data
public class StoreBasicResDTO {
@ApiModelProperty(value = "档口ID")
private Long storeId;
@ApiModelProperty(value = "档口名称")
private String storeName;
@ApiModelProperty(value = "档口负责人ID")
private Long userId;
@ApiModelProperty(value = "档口负责人ID")
private String userName;
@ApiModelProperty(value = "品牌名称")
private String brandName;
@ApiModelProperty(value = "联系人")
private String contactName;
@ApiModelProperty(value = "联系电话")
private String contactPhone;
@ApiModelProperty(value = "备选联系电话")
private String contactBackPhone;
@ApiModelProperty(value = "微信账号")
private String wechatAccount;
@ApiModelProperty(value = "QQ账号")
private String qqAccount;
@ApiModelProperty(value = "支付宝账号")
private String alipayAccount;
@ApiModelProperty(value = "经营年限")
private Integer operateYears;
@ApiModelProperty(value = "档口地址")
private String storeAddress;
@ApiModelProperty(value = "工厂地址")
private String facAddress;
@ApiModelProperty(value = "生产规模")
private Integer prodScale;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@ApiModelProperty(value = "试用截止时间")
private Date trialEndTime;
@ApiModelProperty(value = "已使用文件大小")
private BigDecimal storageUsage;
@ApiModelProperty(value = "档口状态")
private Integer storeStatus;
@ApiModelProperty(value = "拒绝理由")
private String rejectReason;
@ApiModelProperty(value = "档口模板ID")
private Integer templateNum;
}

View File

@ -0,0 +1,24 @@
package com.ruoyi.xkt.dto.store;
import com.ruoyi.xkt.dto.BasePageDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@EqualsAndHashCode(callSuper = true)
@ApiModel("档口分页查询入参")
@Data
public class StorePageDTO extends BasePageDTO {
@ApiModelProperty(value = "档口名称")
private String storeName;
@ApiModelProperty(value = "档口状态")
private Integer storeStatus;
}

View File

@ -0,0 +1,31 @@
package com.ruoyi.xkt.dto.store;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("档口分页返回数据")
@Data
public class StorePageResDTO {
@ApiModelProperty(value = "档口ID")
private Long storeId;
@ApiModelProperty(value = "档口名称")
private String storeName;
@ApiModelProperty(value = "档口负责人")
private String userName;
@ApiModelProperty(value = "联系电话")
private String contactPhone;
@ApiModelProperty(value = "备选联系电话")
private String contactBackPhone;
@ApiModelProperty(value = "档口状态")
private Integer storeStatus;
@ApiModelProperty(value = "启用状态")
private String delFlag;
}

View File

@ -0,0 +1,25 @@
package com.ruoyi.xkt.dto.store;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel("更改档口基本信息")
@Data
@Accessors(chain = true)
public class StoreUpdateDelFlagDTO {
@ApiModelProperty(value = "档口ID")
private Long storeId;
@ApiModelProperty(value = "启用状态")
private Boolean delFlag;
}

View File

@ -2,6 +2,8 @@ package com.ruoyi.xkt.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.xkt.domain.Store;
import com.ruoyi.xkt.dto.store.StorePageDTO;
import com.ruoyi.xkt.dto.store.StorePageResDTO;
import org.springframework.stereotype.Repository;
import java.util.List;
@ -61,4 +63,7 @@ public interface StoreMapper extends BaseMapper<Store> {
* @return
*/
public int deleteStoreByStoreIds(Long[] storeIds);
List<StorePageResDTO> selectStorePage(StorePageDTO pageDTO);
}

View File

@ -1,7 +1,7 @@
package com.ruoyi.xkt.service;
import com.ruoyi.xkt.dto.store.StoreCreateDTO;
import com.ruoyi.xkt.dto.store.StoreUpdateDTO;
import com.ruoyi.common.core.page.Page;
import com.ruoyi.xkt.dto.store.*;
/**
* Service
@ -17,7 +17,7 @@ public interface IStoreService {
* @param storeUpdateDTO
* @return int
*/
public int updateStore(StoreUpdateDTO storeUpdateDTO);
int updateStore(StoreUpdateDTO storeUpdateDTO);
/**
*
@ -25,6 +25,46 @@ public interface IStoreService {
* @param createDTO DTO
* @return int
*/
public int create(StoreCreateDTO createDTO);
int create(StoreCreateDTO createDTO);
/**
*
*
* @param pageDTO
* @return
*/
Page<StorePageResDTO> page(StorePageDTO pageDTO);
/**
* /
*
* @param delFlagDTO
* @return
*/
Integer updateDelFlag(StoreUpdateDelFlagDTO delFlagDTO);
/**
*
*
* @param auditDTO
* @return Integer
*/
Integer approve(StoreAuditDTO auditDTO);
/**
*
*
* @param storeId ID
* @return StoreBasicResDTO
*/
StoreBasicResDTO getInfo(Long storeId);
/**
*
*
* @param storeId ID
* @return StoreApproveResDTO
*/
StoreApproveResDTO getApproveInfo(Long storeId);
}

View File

@ -2,14 +2,20 @@ package com.ruoyi.xkt.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.Page;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.xkt.domain.Store;
import com.ruoyi.xkt.dto.store.StoreCreateDTO;
import com.ruoyi.xkt.dto.store.StoreUpdateDTO;
import com.ruoyi.xkt.dto.store.*;
import com.ruoyi.xkt.dto.storeCertificate.StoreCertResDTO;
import com.ruoyi.xkt.enums.StoreStatus;
import com.ruoyi.xkt.mapper.StoreMapper;
import com.ruoyi.xkt.service.IStoreCertificateService;
import com.ruoyi.xkt.service.IStoreService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@ -18,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
@ -32,6 +39,8 @@ import java.util.Optional;
public class StoreServiceImpl implements IStoreService {
final StoreMapper storeMapper;
final IStoreCertificateService storeCertService;
final SysUserMapper userMapper;
/**
*
@ -53,6 +62,102 @@ public class StoreServiceImpl implements IStoreService {
return this.storeMapper.insert(store);
}
/**
*
*
* @param pageDTO
* @return Page<StorePageResDTO>
*/
@Override
@Transactional(readOnly = true)
public Page<StorePageResDTO> page(StorePageDTO pageDTO) {
PageHelper.startPage(pageDTO.getPageNum(), pageDTO.getPageSize());
List<StorePageResDTO> storeList = this.storeMapper.selectStorePage(pageDTO);
return Page.convert(new PageInfo<>(storeList));
}
/**
* /
*
* @param delFlagDTO
* @return Integer
*/
@Override
@Transactional
public Integer updateDelFlag(StoreUpdateDelFlagDTO delFlagDTO) {
Store store = Optional.ofNullable(this.storeMapper.selectOne(new LambdaQueryWrapper<Store>()
.eq(Store::getId, delFlagDTO.getStoreId())))
.orElseThrow(() -> new ServiceException("档口不存在!", HttpStatus.ERROR));
store.setDelFlag(delFlagDTO.getDelFlag() ? Constants.UNDELETED : Constants.DELETED);
return storeMapper.updateById(store);
}
/**
*
*
* @param auditDTO
* @return Integer
*/
@Override
@Transactional
public Integer approve(StoreAuditDTO auditDTO) {
Store store = Optional.ofNullable(this.storeMapper.selectOne(new LambdaQueryWrapper<Store>()
.eq(Store::getId, auditDTO.getStoreId()).eq(Store::getDelFlag, Constants.UNDELETED)))
.orElseThrow(() -> new ServiceException("档口不存在!", HttpStatus.ERROR));
if (auditDTO.getApprove()) {
// 如果档口状态不为 待审核 或 审核驳回 则报错
if (!Objects.equals(store.getStoreStatus(), StoreStatus.UN_AUDITED.getValue()) ||
!Objects.equals(store.getStoreStatus(), StoreStatus.AUDIT_REJECTED.getValue())) {
throw new ServiceException("当前状态不为待审核 或 审核驳回,不可审核!", HttpStatus.ERROR);
}
store.setStoreStatus(StoreStatus.TRIAL_PERIOD.getValue());
} else {
store.setStoreStatus(StoreStatus.AUDIT_REJECTED.getValue());
store.setRejectReason(auditDTO.getRejectReason());
}
return this.storeMapper.updateById(store);
}
/**
*
*
* @param storeId ID
* @return StoreBasicResDTO
*/
@Override
@Transactional(readOnly = true)
public StoreBasicResDTO getInfo(Long storeId) {
Store store = Optional.ofNullable(this.storeMapper.selectOne(new LambdaQueryWrapper<Store>()
.eq(Store::getId, storeId))).orElseThrow(() -> new ServiceException("档口不存在!", HttpStatus.ERROR));
StoreBasicResDTO resDTO = BeanUtil.toBean(store, StoreBasicResDTO.class);
resDTO.setStoreId(storeId);
// TODO 用户名称
// TODO 用户名称
// TODO 用户名称
// 获取档口绑定的用户
/*SysUser user = Optional.ofNullable(this.userMapper.selectOne(new LambdaQueryWrapper<SysUser>()
.eq(SysUser::getUserId, store.getUserId()))).orElseThrow(() -> new ServiceException("用户不存在!", HttpStatus.ERROR));
resDTO.setUserName(user.getUserName());*/
return resDTO;
}
/**
*
*
* @param storeId ID
* @return StoreApproveResDTO
*/
@Override
@Transactional(readOnly = true)
public StoreApproveResDTO getApproveInfo(Long storeId) {
return new StoreApproveResDTO(){{
setBasic(getInfo(storeId));
setCertificate(storeCertService.getInfo(storeId));
}};
}
/**
*
*

View File

@ -172,4 +172,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<select id="selectStorePage" resultType="com.ruoyi.xkt.dto.store.StorePageResDTO">
SELECT
s.id AS storeId,
s.store_name,
u.user_name,
s.contact_phone,
s.contact_back_phone,
s.store_status,
s.del_flag
FROM
store s
LEFT JOIN sys_user u ON s.user_id = u.user_id
<if test="storeName != null and storeName != ''"> and s.store_name like concat('%', #{storeName}, '%')</if>
<if test="storeStatus != null and storeStatus != ''"> and s.store_status = #{storeStatus}</if>
</select>
</mapper>