平台建店接口

This commit is contained in:
shuo.wang
2024-10-10 18:52:36 +08:00
parent dac7330dfd
commit 10e324a656
25 changed files with 1122 additions and 41 deletions

View File

@@ -10,6 +10,12 @@ public enum AuditTypeEnum {
UPLOAD_RENT_CONTRACT(6, "上传租赁合同"),
PAY_FRANCHISE_FEE(7,"缴纳加盟费"),
SIGN_FRANCHISE(8,"加盟合同签约"),
DOU_YIN(9,"抖音"),
KUAI_SHOU(10,"快手"),
MEI_TUAN_TUAN_GOU(11,"美团团购"),
E_LE_ME(12,"饿了么"),
MEI_TUAN_WAI_MAI(13,"美团外卖"),
YING_ZHANG_TONG(14,"营帐通");
;
private Integer code;

View File

@@ -224,7 +224,7 @@ public enum ErrorCodeEnum {
UPDATE_FAIL(131000,"修改失败,表单不存在!",null),
LICENSE_LEGAL_STAGE_FAIL(131001,"营业执照阶段未上传!",null),
BUILD_INFORMATION_STAGE_FAIL(131002,"建店资料收集阶段未完成",null)
GET_JURIDICAL_ID_CARD_NO_FAIL(131002,"获取法人身份证信息失败",null)
;

View File

@@ -0,0 +1,27 @@
package com.cool.store.enums;
/**
* @Author: WangShuo
* @Date: 2024/09/13/下午1:58
* @Version 1.0
* @注释:
*/
public enum OperationLogAuditEnum {
SUBMIT_AUDIT(0,"提交审批"),
PASS(1,"审批通过"),
REFUSE(2,"审批拒绝"),
WAIT_AUDIT(3,"待审批");
private int code;
private String desc;
OperationLogAuditEnum(int code, String desc) {
this.code = code;
this.desc = desc;
}
public int getCode() {
return code;
}
public String getDesc() {
return desc;
}
}

View File

@@ -0,0 +1,25 @@
package com.cool.store.enums;
/**
* @Author: WangShuo
* @Date: 2024/10/10/上午11:08
* @Version 1.0
* @注释:
*/
public enum OperationStatusEnum {
NOT_PROCESSED(0,"未处理"),
PROCESSED(1,"已处理");
private int code;
private String msg;
OperationStatusEnum(int code, String msg) {
this.code = code;
this.msg = msg;
}
public int getCode() {
return code;
}
public String getMsg() {
return msg;
}
}

View File

@@ -0,0 +1,30 @@
package com.cool.store.enums;
public enum OperationTypeEnum {
OPERATION_TYPE_0(0, "提交"),
OPERATION_TYPE_1(1, "审批"),
OPERATION_TYPE_2(2, "跳过"),
;
private Integer code;
private String message;
OperationTypeEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
public Integer getCode() {
return code;
}
public String getMessage() {
return message;
}
}

View File

@@ -0,0 +1,30 @@
package com.cool.store.enums;
/**
* @Author: WangShuo
* @Date: 2024/10/10/上午10:36
* @Version 1.0
* @注释:
*/
public enum PlatformBuildEnum {
DOU_YIN(1,"抖音"),
KUAI_SHOU(2,"快手"),
MEI_TUAN_TUAN_GOU(3,"美团团购"),
E_LE_ME(4,"饿了么"),
MEI_TUAN_WAI_MAI(5,"美团外卖"),
YING_ZHANG_TONG(6,"营帐通");
private Integer code;
private String message;
PlatformBuildEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
public Integer getCode() {
return code;
}
public String getMessage() {
return message;
}
}

View File

@@ -31,7 +31,14 @@ public enum UserRoleEnum {
ENGINEER_DEP_MANAGER(260000000L, "工程部高级经理"),
STRONG_INVESTMENT_COMMISSIONER(270000000L, "强加盟招商专员"),
HUO_MA_EMPLOYEE(280000000L,"火码"),
IT_EMPLOYEE(290000000L,"IT")
IT_EMPLOYEE(290000000L,"IT"),
DOU_YIN_CUSTOMER(300000000L,"抖音客服"),
MEI_TUAN_OPERATIONS_CUSTOMER(310000000L,"美团运营大区客服"),
MEI_TUAN_HEADQUARTERS_BUILD_CUSTOMER(320000000L,"美团总部建店客服"),
E_L_ME_TUAN_OPERATIONS_CUSTOMER(330000000L,"饿了么运营大区客服"),
E_L_ME_HEADQUARTERS_BUILD_CUSTOMER(340000000L,"饿了么总部建店客服"),
MEI_TUAN_BUY_CUSTOMER(350000000L,"美团团购客服"),
KUAI_SHOU_CUSTOMER(360000000L,"快手客服"),
;
private Long code;

View File

@@ -0,0 +1,80 @@
package com.cool.store.dao;
import com.cool.store.dto.OperationLogDTO;
import com.cool.store.entity.OperationLogDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.OperationLogMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* @Author: WangShuo
* @Date: 2024/08/28/下午5:01
* @Version 1.0
* @注释:
*/
@Repository
public class OperationLogDAO {
@Resource
private OperationLogMapper operationLogMapper;
public Long addOperationLog(OperationLogDO operationLogDO) {
if (Objects.isNull(operationLogDO)) {
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
operationLogDO.setCreateTime(new Date());
operationLogMapper.insertSelective(operationLogDO);
return operationLogDO.getId();
}
public Long batchAddOperationLog(List<OperationLogDO> operationLogDO) {
if (CollectionUtils.isEmpty(operationLogDO)) {
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
return operationLogMapper.batchAddOperationLog(operationLogDO);
}
public Boolean batchUpdateByPrimaryKeySelective(List<OperationLogDO> operationLogs) {
if (CollectionUtils.isEmpty(operationLogs)) {
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
for (OperationLogDO operationLog : operationLogs) {
operationLogMapper.updateByPrimaryKeySelective(operationLog);
}
return Boolean.TRUE;
}
public OperationLogDO getBySubStageStatusEnumAndAuditIdNotNull(Long shopId, ShopSubStageStatusEnum shopSubStageStatusEnum,Integer type) {
if (Objects.isNull(shopId) || Objects.isNull(shopSubStageStatusEnum)) {
return null;
}
return operationLogMapper.getOrderByTime(shopId,shopSubStageStatusEnum.getShopSubStageStatus(),type);
}
public List<OperationLogDO> getBySubStageStatusEnumAndsStatus(Long shopId, ShopSubStageStatusEnum shopSubStageStatusEnum,Integer type) {
if (Objects.isNull(shopId) || Objects.isNull(shopSubStageStatusEnum)) {
return null;
}
return operationLogMapper.getBySubStageStatusEnumAndsStatus(shopId,shopSubStageStatusEnum.getShopSubStageStatus(),type);
}
public List<OperationLogDO> getByShopSubStage(Long shopId, List<Integer> shopSubStageStatusList, List<Integer> types) {
if (Objects.isNull(shopId) || CollectionUtils.isEmpty(shopSubStageStatusList)) {
return null;
}
return operationLogMapper.getByShopSubStage(shopId,shopSubStageStatusList,types);
}
public Integer updateByPrimaryKeySelective(OperationLogDO operationLogDO) {
if (Objects.isNull(operationLogDO) ) {
return null;
}
return operationLogMapper.updateByPrimaryKeySelective(operationLogDO);
}
}

View File

@@ -27,7 +27,7 @@ public class PlatformBuildDAO {
return platformBuildMapper.insertSelective(platformBuildDO);
}
public Integer updateByShopIdSelective(PlatformBuildDO platformBuildDO) {
public Integer updateByShopIdAndTypeSelective(PlatformBuildDO platformBuildDO) {
if (platformBuildDO == null) {
return 0;
}

View File

@@ -0,0 +1,30 @@
package com.cool.store.mapper;
import com.cool.store.dto.OperationLogDTO;
import com.cool.store.entity.OperationLogDO;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
/**
* @author EDY
* @description 针对表【xfsg_operation_log(操作日志)】的数据库操作Mapper
* @createDate 2024-08-27 11:24:09
* @Entity com.cool.store.entity.OperationLogDO
*/
public interface OperationLogMapper extends Mapper<OperationLogDO> {
OperationLogDO getOrderByTime(@Param("shopId") Long shopId, @Param("shopSubStageStatus") Integer shopSubStageStatus, @Param("type") Integer type);
List<OperationLogDO> getBySubStageStatusEnumAndsStatus(@Param("shopId") Long shopId, @Param("shopSubStageStatus") Integer shopSubStageStatus, @Param("type") Integer type);
List<OperationLogDO> getByShopSubStage(@Param("shopId") Long shopId, @Param("shopSubStageStatusList") List<Integer> shopSubStageStatusList, @Param("types") List<Integer> types);
Long batchAddOperationLog(@Param("list") List<OperationLogDO> operationLogDO) ;
}

View File

@@ -0,0 +1,80 @@
<?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.cool.store.mapper.OperationLogMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.OperationLogDO">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="shopId" column="shop_id" jdbcType="BIGINT"/>
<result property="shopSubStage" column="shop_sub_stage" jdbcType="INTEGER"/>
<result property="shopSubStageStatus" column="shop_sub_stage_status" jdbcType="INTEGER"/>
<result property="status" column="status" jdbcType="INTEGER"/>
<result property="type" column="type" jdbcType="INTEGER"/>
<result property="remarks" column="remarks" jdbcType="VARCHAR"/>
<result property="operatorName" column="operator_name" jdbcType="VARCHAR"/>
<result property="operator" column="operator" jdbcType="VARCHAR"/>
<result property="auditResultId" column="audit_result_id" jdbcType="BIGINT"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="createUserId" column="create_user_id" jdbcType="VARCHAR"/>
<result property="updateUserId" column="update_user_id" jdbcType="VARCHAR"/>
<result property="deleted" column="deleted" jdbcType="TINYINT"/>
</resultMap>
<sql id="Base_Column_List">
id
,shop_id,shop_sub_stage,
shop_sub_stage_status,status,type,remarks,
operator_name,operator,audit_result_id,
create_time,update_time,create_user_id,
update_user_id,deleted
</sql>
<insert id="batchAddOperationLog">
<foreach collection="list" separator=";" item="item">
INSERT INTO xfsg_operation_log( shop_id, shop_sub_stage, shop_sub_stage_status, status, type, remarks, operator_name,operator,audit_result_id,create_time,create_user_id,update_user_id)
VALUES(#{item.shopId}, #{item.shopSubStage}, #{item.shopSubStageStatus}, #{item.status}, #{item.type}, #{item.remarks}, #{item.operatorName}, #{item.operator},#{item.auditResultId}
,#{item.createTime},#{item.createUserId},#{item.updateUserId})
</foreach>
</insert>
<select id="getOrderByTime" resultType="com.cool.store.entity.OperationLogDO">
select *
from xfsg_operation_log
where shop_id = #{shopId}
and shop_sub_stage_status = #{shopSubStageStatus}
<if test="type !=null">
and type = #{type}
</if>
and audit_result_id is not null
order by create_time desc limit 1
</select>
<select id="getByShopSubStage" resultType="com.cool.store.entity.OperationLogDO">
select *
from xfsg_operation_log
where shop_id = #{shopId}
<if test="shopSubStageStatusList !=null and shopSubStageStatusList.size()>0">
and shop_sub_stage_status in
<foreach collection="shopSubStageStatusList" index="index" item="shopSubStageStatus" open="(" close=")"
separator=",">
#{shopSubStageStatus}
</foreach>
</if>
<if test="types !=null and types.size()>0">
and type in
<foreach collection="types" index="index" item="type" open="(" close=")" separator=",">
#{type}
</foreach>
</if>
</select>
<select id="getBySubStageStatusEnumAndsStatus" resultType="com.cool.store.entity.OperationLogDO">
select *
from xfsg_operation_log
where shop_id = #{shopId}
and shop_sub_stage_status = #{shopSubStageStatus}
<if test="type !=null">
and type = #{type}
</if>
and status = 0
order by create_time desc
</select>
</mapper>

View File

@@ -12,7 +12,6 @@
<result property="settlerIdCardFront" column="settler_id_card_front" jdbcType="VARCHAR"/>
<result property="settlerIdCardReverse" column="settler_id_card_reverse" jdbcType="VARCHAR"/>
<result property="settlerIdCardNo" column="settler_id_card_no" jdbcType="VARCHAR"/>
<result property="settlerName" column="settler_name" jdbcType="VARCHAR"/>
<result property="settlerBankPhotoUrl" column="settler_bank_photo_url" jdbcType="VARCHAR"/>
<result property="settlerBankNumber" column="settler_bank_number" jdbcType="VARCHAR"/>
<result property="settlerBankMobile" column="settler_bank_mobile" jdbcType="VARCHAR"/>

View File

@@ -0,0 +1,19 @@
package com.cool.store.dto;
import com.cool.store.entity.OperationLogDO;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @Author: WangShuo
* @Date: 2024/10/10/下午3:09
* @Version 1.0
* @注释:
*/
@Data
public class OperationLogDTO {
private Date createTime;
private List<OperationLogDO> operationLogDOList;
}

View File

@@ -0,0 +1,48 @@
package com.cool.store.entity;
import lombok.Data;
import javax.persistence.*;
import java.util.Date;
/**
* @TableName xfsg_operation_log
*/
@Table(name ="xfsg_operation_log")
@Data
public class OperationLogDO {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "shop_id")
private Long shopId;
@Column(name = "shop_sub_stage")
private Integer shopSubStage;
@Column(name = "shop_sub_stage_status")
private Integer shopSubStageStatus;
@Column(name = "status")
private Integer status;
@Column(name = "type")
private Integer type;
@Column(name = "remarks")
private String remarks;
@Column(name = "operator_name")
private String operatorName;
@Column(name = "operator")
private String operator;
@Column(name = "audit_result_id")
private Long auditResultId;
@Column(name = "create_time")
private Date createTime;
@Column(name = "update_time")
private Date updateTime;
@Column(name = "create_user_id")
private String createUserId;
@Column(name = "update_user_id")
private String updateUserId;
@Column(name = "deleted")
private Integer deleted;
}

View File

@@ -50,11 +50,6 @@ public class PlatformBuildDO {
@Column(name = "settler_id_card_reverse")
private String settlerIdCardReverse;
/**
* 结算人姓名
*/
@Column(name = "settler_name")
private String settlerName;
/**
* 结算人身份证号

View File

@@ -0,0 +1,53 @@
package com.cool.store.request;
import com.cool.store.entity.ShopAuditInfoDO;
import com.cool.store.enums.AuditResultTypeEnum;
import com.cool.store.enums.AuditTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @Author: WangShuo
* @Date: 2024/10/10/下午1:35
* @Version 1.0
* @注释:
*/
@Data
public class PlatformBuildAuditRequest {
@NotNull
private Long shopId;
@ApiModelProperty(value = "'1-抖音2-快手3-美团团购4-饿了么5-美团外卖6-(营帐通)',")
private Integer type;
@ApiModelProperty("审核结果,0通过1拒绝")
private Integer resultType;
@ApiModelProperty("原因")
private String reason;
@ApiModelProperty(value = "操作人id", hidden = true)
private String operateUserId;
@ApiModelProperty(value = "操作人姓名", hidden = true)
private String operateUserName;
public static ShopAuditInfoDO convert(PlatformBuildAuditRequest request, AuditTypeEnum auditType) {
ShopAuditInfoDO result = new ShopAuditInfoDO();
result.setShopId(request.getShopId());
result.setAuditType(auditType.getCode());
result.setSubmittedUserId(request.getOperateUserId());
result.setSubmittedUserName(request.getOperateUserName());
result.setResultType(request.getResultType());
if (AuditResultTypeEnum.PASS.getCode().equals(request.getResultType())) {
result.setPassReason(request.getReason());
} else {
result.setRejectReason(request.getReason());
}
return result;
}
}

View File

@@ -21,7 +21,8 @@ public class PlatformBuildRequest {
@NotNull
private Long shopId;
@ApiModelProperty(value = "'1-抖音2-快手3-美团团购4-饿了么5-美团外卖6-(营帐通)',",hidden = true)
@NotNull
@ApiModelProperty(value = "'1-抖音2-快手3-美团团购4-饿了么5-美团外卖6-(营帐通)',")
private Integer type;
@NotBlank
@@ -34,11 +35,6 @@ public class PlatformBuildRequest {
@ApiModelProperty("结算人身份证反面(图片)")
private String settlerIdCardReverse;
@NotBlank
@Length(max = 120 , message = "结算人姓名 长度不能超过128")
@ApiModelProperty("结算人姓名")
private String settlerName;
@NotBlank
@Length(max = 64 , message = "结算人身份证号 长度不能超过64")
@ApiModelProperty("结算人身份证号")
@@ -64,21 +60,34 @@ public class PlatformBuildRequest {
@ApiModelProperty("结算开户银行支行")
private String settlerBankName;
@Length(max =1020, message = "门店定位截图(快手&抖音) 长度不能超过1020")
@Length(max =1020, message = "门店定位截图 长度不能超过1020")
@ApiModelProperty("门店定位截图(快手&抖音)")
private String storePositioningUrl;
@Length(max =1020, message = "授权书(抖音非法人结算需要) 长度不能超过1020")
@ApiModelProperty("授权书(抖音非法人结算需要)")
@Length(max =1020, message = "授权书 长度不能超过1020")
@ApiModelProperty("授权书(抖音&快手非法人结算需要)")
private String authorizationUrl;
@Length(max =250, message = "平台账号 长度不能超过250")
@ApiModelProperty("平台账号(快手,需要)")
private String account;
public PlatformBuildDO toDO(){
PlatformBuildDO platformBuildDO = new PlatformBuildDO();
platformBuildDO.setShopId(this.shopId);
platformBuildDO.setType(this.type);
platformBuildDO.setSettlerIdCardFront(this.settlerIdCardFront);
platformBuildDO.setSettlerIdCardReverse(this.settlerIdCardReverse);
platformBuildDO.setSettlerIdCardNo(this.settlerIdCardNo);
platformBuildDO.setSettlerName(this.settlerName);
platformBuildDO.setSettlerBankPhotoUrl(this.settlerBankPhotoUrl);
platformBuildDO.setSettlerBankNumber(this.settlerBankNumber);
platformBuildDO.setSettlerBankMobile(this.settlerBankMobile);
platformBuildDO.setSettlerBankName(this.settlerBankName);
platformBuildDO.setStorePositioningUrl(this.storePositioningUrl);
platformBuildDO.setAuthorizationUrl(this.authorizationUrl);
platformBuildDO.setAccount(this.account);
return platformBuildDO;
}

View File

@@ -23,6 +23,8 @@ public class AuditInfoResponse {
private List<AuditUserInfoVO> list;
@ApiModelProperty("操作类型 0 提交审批 1-审批通过 2 审批不通过 3-待审批")
private Integer type;
@ApiModelProperty("是否处理0-未处理,1-处理")
private Integer status;
@ApiModelProperty("生成时间")
private Date createTime;
@ApiModelProperty("备注")

View File

@@ -0,0 +1,49 @@
package com.cool.store.response;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
/**
* @Author: WangShuo
* @Date: 2024/10/10/上午10:54
* @Version 1.0
* @注释:
*/
@Data
public class PlatformBuildResponse {
private Long shopId;
@ApiModelProperty("结算人身份证正面(图片)")
private String settlerIdCardFront;
@ApiModelProperty("结算人身份证反面(图片)")
private String settlerIdCardReverse;
@ApiModelProperty("结算人身份证号")
private String settlerIdCardNo;
@ApiModelProperty("结算人银行卡照片")
private String settlerBankPhotoUrl;
@ApiModelProperty("结算人银行卡号")
private String settlerBankNumber;
@ApiModelProperty("结算人银行卡预留手机号")
private String settlerBankMobile;
@ApiModelProperty("结算开户银行支行")
private String settlerBankName;
@ApiModelProperty("门店定位截图(快手&抖音)")
private String storePositioningUrl;
@ApiModelProperty("授权书(抖音&快手非法人结算需要)")
private String authorizationUrl;
@ApiModelProperty("平台账号(快手,需要)")
private String account;
@ApiModelProperty("原因")
private String reason;
}

View File

@@ -0,0 +1,22 @@
package com.cool.store.service;
import com.cool.store.entity.EnterpriseUserDO;
import com.cool.store.entity.OperationLogDO;
import com.cool.store.enums.OperationStatusEnum;
import com.cool.store.enums.OperationTypeEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.response.AuditInfoResponse;
import java.util.List;
public interface OperationLogService {
Boolean addOperationLog(Long shopId, ShopSubStageStatusEnum shopSubStageStatusEnum, String userId, String userName, OperationTypeEnum operationTypeEnum, String remark, OperationStatusEnum operationStatusEnum);
Long addOperationLog(Long shopId, ShopSubStageStatusEnum shopSubStageStatusEnum,String userId, List<EnterpriseUserDO> operationUserList, OperationTypeEnum operationTypeEnum, String remark,OperationStatusEnum operationStatusEnum);
List<AuditInfoResponse> getAuditInfo(Long shopId,List<Integer> shopSubStageStatusList);
Boolean batchUpdateProcessed( List<OperationLogDO> operationLogs,Long audit , String userId, String reason);
}

View File

@@ -1,7 +1,10 @@
package com.cool.store.service;
import com.cool.store.request.PlatformBuildAuditRequest;
import com.cool.store.request.PlatformBuildRequest;
import com.cool.store.response.PlatformBuildResponse;
import com.cool.store.vo.PartnerUserInfoVO;
/**
* @author EDY
@@ -10,12 +13,17 @@ import com.cool.store.request.PlatformBuildRequest;
*/
public interface PlatformBuildService {
Boolean isJuridical(Long shopId);
String juridicalIdCard(Long shopId);
Integer submitOrUpdate(PlatformBuildRequest request,String userId);
Integer submitOrUpdate(PlatformBuildRequest request, PartnerUserInfoVO partnerUserInfoVO);
PlatformBuildResponse get(Long shopId,Integer type);
//第一层审批
Integer firstAudit(PlatformBuildAuditRequest request);
//第二层审批 美团外卖&饿了么
Integer secondAudit(PlatformBuildAuditRequest request);
}

View File

@@ -0,0 +1,177 @@
package com.cool.store.service.impl;
import com.cool.store.dao.EnterpriseUserDAO;
import com.cool.store.dao.OperationLogDAO;
import com.cool.store.dao.ShopAuditInfoDAO;
import com.cool.store.dto.OperationLogDTO;
import com.cool.store.entity.EnterpriseUserDO;
import com.cool.store.entity.OperationLogDO;
import com.cool.store.entity.ShopAuditInfoDO;
import com.cool.store.enums.AuditResultTypeEnum;
import com.cool.store.enums.OperationLogAuditEnum;
import com.cool.store.enums.OperationStatusEnum;
import com.cool.store.enums.OperationTypeEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.response.AuditInfoResponse;
import com.cool.store.service.OperationLogService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class OperationLogServiceImpl implements OperationLogService {
@Resource
private ShopAuditInfoDAO shopAuditInfoDAO;
@Resource
private OperationLogDAO operationLogDAO;
@Resource
private EnterpriseUserDAO enterpriseUserDAO;
@Override
public Boolean addOperationLog(Long shopId, ShopSubStageStatusEnum shopSubStageStatusEnum, String userId, String userName, OperationTypeEnum operationTypeEnum, String remark, OperationStatusEnum operationStatusEnum) {
OperationLogDO OperationLogDO = new OperationLogDO();
OperationLogDO.setShopId(shopId);
OperationLogDO.setShopSubStage(shopSubStageStatusEnum.getShopSubStageEnum().getShopSubStage());
OperationLogDO.setShopSubStageStatus(shopSubStageStatusEnum.getShopSubStageStatus());
OperationLogDO.setType(operationTypeEnum.getCode());
OperationLogDO.setStatus(operationStatusEnum.getCode());
OperationLogDO.setOperatorName(userName);
OperationLogDO.setOperator(userId);
OperationLogDO.setCreateUserId(userId);
OperationLogDO.setRemarks(remark);
OperationLogDO.setCreateTime(new Date());
operationLogDAO.addOperationLog(OperationLogDO);
return Boolean.TRUE;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Long addOperationLog(Long shopId, ShopSubStageStatusEnum shopSubStageStatusEnum, String userId, List<EnterpriseUserDO> operationUserList, OperationTypeEnum operationTypeEnum, String remark, OperationStatusEnum operationStatusEnum) {
List<OperationLogDO> operationLogDOList = new ArrayList<>();
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(Calendar.SECOND, 1);
Date date = calendar.getTime();
for (EnterpriseUserDO operationUser : operationUserList) {
OperationLogDO OperationLogDO = new OperationLogDO();
OperationLogDO.setShopId(shopId);
OperationLogDO.setShopSubStage(shopSubStageStatusEnum.getShopSubStageEnum().getShopSubStage());
OperationLogDO.setShopSubStageStatus(shopSubStageStatusEnum.getShopSubStageStatus());
OperationLogDO.setType(operationTypeEnum.getCode());
OperationLogDO.setStatus(operationStatusEnum.getCode());
OperationLogDO.setOperatorName(operationUser.getName());
OperationLogDO.setOperator(operationUser.getUserId());
OperationLogDO.setCreateUserId(userId);
OperationLogDO.setRemarks(remark);
OperationLogDO.setCreateTime(date);
operationLogDOList.add(OperationLogDO);
}
return operationLogDAO.batchAddOperationLog(operationLogDOList);
}
@Override
public List<AuditInfoResponse> getAuditInfo(Long shopId, List<Integer> shopSubStageStatusList) {
List<AuditInfoResponse> responses = new ArrayList<>();
List<OperationLogDO> logList = operationLogDAO.getByShopSubStage(shopId, shopSubStageStatusList, null);
Map<Date,List<OperationLogDO>> operationLogMap = logList.stream().collect(Collectors.groupingBy(OperationLogDO::getCreateTime));
for (Date date : operationLogMap.keySet()) {
List<OperationLogDO> operations = operationLogMap.get(date);
AuditInfoResponse auditInfoResponse = new AuditInfoResponse();
List<AuditInfoResponse.AuditUserInfoVO> list = new ArrayList<>();
List<String> userIds = new ArrayList<>();
Long auditId = null;
Integer operationType = 0;
for (OperationLogDO operationLogDO : operations) {
//提交时候只会有一个人
if (operationLogDO.getType().equals(OperationTypeEnum.OPERATION_TYPE_0.getCode())) {
operationType = operationLogDO.getType();
auditInfoResponse.setType(OperationLogAuditEnum.SUBMIT_AUDIT.getCode());
auditInfoResponse.setStatus(operationLogDO.getStatus());
AuditInfoResponse.AuditUserInfoVO user = new AuditInfoResponse.AuditUserInfoVO();
user.setUserId(operationLogDO.getOperator());
user.setName(operationLogDO.getOperatorName());
auditInfoResponse.setList(Collections.singletonList(user));
auditInfoResponse.setActualUserId(operationLogDO.getOperator());
auditInfoResponse.setCreateTime(operationLogDO.getCreateTime());
}
//审批
if (operationLogDO.getType().equals(OperationTypeEnum.OPERATION_TYPE_1.getCode())) {
operationType = operationLogDO.getType();
userIds.add(operationLogDO.getOperator());
if (Objects.isNull(operationLogDO.getUpdateTime())) {
auditInfoResponse.setCreateTime(operationLogDO.getCreateTime());
} else {
auditInfoResponse.setCreateTime(operationLogDO.getUpdateTime());
}
auditInfoResponse.setStatus(operationLogDO.getStatus());
// 判断审批人
if (Objects.nonNull(operationLogDO.getAuditResultId())) {
auditId = operationLogDO.getAuditResultId();
auditInfoResponse.setActualUserId(operationLogDO.getOperator());
auditInfoResponse.setRemark(operationLogDO.getRemarks());
}
}
}
if (operationType.equals(OperationTypeEnum.OPERATION_TYPE_1.getCode())) {
Map<String, EnterpriseUserDO> userInfoMap = enterpriseUserDAO.getUserInfoMap(userIds);
for (EnterpriseUserDO enterpriseUserDO : userInfoMap.values()) {
AuditInfoResponse.AuditUserInfoVO user = new AuditInfoResponse.AuditUserInfoVO();
user.setUserId(enterpriseUserDO.getUserId());
user.setName(enterpriseUserDO.getName());
user.setAvatar(enterpriseUserDO.getAvatar());
list.add(user);
}
auditInfoResponse.setList(list);
if (Objects.nonNull(auditId)) {
ShopAuditInfoDO auditInfo = shopAuditInfoDAO.getAuditInfo(auditId);
if (Objects.nonNull(auditInfo)) {
if (auditInfo.getResultType().equals(AuditResultTypeEnum.PASS.getCode())) {
auditInfoResponse.setType(OperationLogAuditEnum.PASS.getCode());
auditInfoResponse.setRemark(auditInfo.getPassReason());
} else {
auditInfoResponse.setRemark(auditInfo.getRejectReason());
auditInfoResponse.setType(OperationLogAuditEnum.REFUSE.getCode());
}
}
} else {
auditInfoResponse.setType(OperationLogAuditEnum.WAIT_AUDIT.getCode());
}
}
responses.add(auditInfoResponse);
}
return responses.stream().sorted(Comparator.comparing(AuditInfoResponse::getCreateTime)).collect(Collectors.toList());
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean batchUpdateProcessed(List<OperationLogDO> operationLogs, Long audit, String userId, String reason) {
List<OperationLogDO> operationLogList = new ArrayList<>();
for (OperationLogDO operationLogDO : operationLogs) {
operationLogDO.setUpdateTime(new Date());
operationLogDO.setUpdateUserId(userId);
operationLogDO.setStatus(OperationStatusEnum.PROCESSED.getCode());
if (operationLogDO.getOperator().equals(userId)) {
operationLogDO.setAuditResultId(audit);
}
operationLogDO.setRemarks(reason);
operationLogList.add(operationLogDO);
}
return operationLogDAO.batchUpdateByPrimaryKeySelective(operationLogList);
}
}

View File

@@ -1,51 +1,296 @@
package com.cool.store.service.impl;
import com.cool.store.dao.BuildInformationDAO;
import com.cool.store.entity.BuildInformationDO;
import com.cool.store.entity.LicenseTransactDO;
import com.cool.store.entity.PlatformBuildDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dao.*;
import com.cool.store.entity.*;
import com.cool.store.enums.*;
import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.ApplyLicenseMapper;
import com.cool.store.request.PlatformBuildAuditRequest;
import com.cool.store.request.PlatformBuildRequest;
import com.cool.store.response.PlatformBuildResponse;
import com.cool.store.service.OperationLogService;
import com.cool.store.service.PlatformBuildService;
import com.cool.store.mapper.PlatformBuildMapper;
import com.cool.store.service.UserAuthMappingService;
import com.cool.store.utils.poi.StringUtils;
import com.cool.store.vo.PartnerUserInfoVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import springfox.documentation.swagger2.mappers.LicenseMapper;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* @author EDY
* @description 针对表【xfsg_platform_build(平台建店表)】的数据库操作Service实现
* @createDate 2024-10-09 14:54:40
*/
@Service
public class PlatformBuildServiceImpl implements PlatformBuildService{
import static com.cool.store.enums.point.ShopSubStageStatusEnum.*;
/**
* @author EDY
* @description 针对表【xfsg_platform_build(平台建店表)】的数据库操作Service实现
* @createDate 2024-10-09 14:54:40
*/
@Service
public class PlatformBuildServiceImpl implements PlatformBuildService {
@Resource
private ApplyLicenseMapper applyLicenseMapper;
@Autowired
private BuildInformationDAO buildInformationDAO;
@Autowired
private PlatformBuildDAO platformBuildDAO;
@Resource
private OperationLogService operationLogService;
@Resource
private ShopStageInfoDAO shopStageInfoDAO;
@Autowired
private UserAuthMappingService userAuthMappingService;
@Autowired
private ShopInfoDAO shopInfoDAO;
@Autowired
private ShopAuditInfoDAO shopAuditInfoDAO;
@Autowired
private OperationLogDAO operationLogDAO;
@Override
public Boolean isJuridical(Long shopId) {
LicenseTransactDO licenseTransactDO = applyLicenseMapper.selectByShopId(shopId);
if(Objects.isNull(licenseTransactDO) || StringUtils.isBlank(licenseTransactDO.getLicenseLegalPerson())){
throw new ServiceException(ErrorCodeEnum.LICENSE_LEGAL_STAGE_FAIL);
public String juridicalIdCard(Long shopId) {
BuildInformationDO informationDO = buildInformationDAO.selectOneByShopId(shopId);
if (Objects.isNull(informationDO) || StringUtils.isBlank(informationDO.getJuridicalIdCardNo())) {
throw new ServiceException(ErrorCodeEnum.GET_JURIDICAL_ID_CARD_NO_FAIL);
}
return Boolean.FALSE;
return informationDO.getJuridicalIdCardNo();
}
@Override
public Integer submitOrUpdate(PlatformBuildRequest request, String userId) {
@Transactional(rollbackFor = Exception.class)
public Integer submitOrUpdate(PlatformBuildRequest request, PartnerUserInfoVO partnerUserInfoVO) {
Integer type = request.getType();
Long shopId = request.getShopId();
PlatformBuildDO platformBuildDO = platformBuildDAO.selectOneByShopId(shopId, type);
PlatformBuildDO platformBuild = request.toDO();
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
Long regionId = shopInfo.getRegionId();
//抖音
if (type.equals(PlatformBuildEnum.DOU_YIN.getCode())) {
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_18);
if (!shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_180.getShopSubStageStatus())
&& !shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_182.getShopSubStageStatus())) {
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
}
if (Objects.isNull(platformBuildDO)) {
extracted(partnerUserInfoVO, shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_180, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_181,
userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.DOU_YIN_CUSTOMER, regionId));
} else {
extracted(partnerUserInfoVO, shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_182, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_181,
userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.DOU_YIN_CUSTOMER, regionId));
return platformBuildDAO.updateByShopIdAndTypeSelective(platformBuild);
}
}
//快手
if (type.equals(PlatformBuildEnum.KUAI_SHOU.getCode())) {
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_22);
if (!shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_220.getShopSubStageStatus())
&& !shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_222.getShopSubStageStatus())) {
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
}
if (Objects.isNull(platformBuildDO)) {
extracted(partnerUserInfoVO, shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_220, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_221,
userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.KUAI_SHOU_CUSTOMER, regionId));
} else {
extracted(partnerUserInfoVO, shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_222, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_221,
userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.KUAI_SHOU_CUSTOMER, regionId));
return platformBuildDAO.updateByShopIdAndTypeSelective(platformBuild);
}
}
//美团团购
if (type.equals(PlatformBuildEnum.MEI_TUAN_TUAN_GOU.getCode())) {
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_20);
if (!shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_200.getShopSubStageStatus())
&& !shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_203.getShopSubStageStatus())) {
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
}
if (Objects.isNull(platformBuildDO)) {
extracted(partnerUserInfoVO, shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_200, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_201,
userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.MEI_TUAN_BUY_CUSTOMER, regionId));
} else {
extracted(partnerUserInfoVO, shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_202, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_201,
userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.MEI_TUAN_BUY_CUSTOMER, regionId));
return platformBuildDAO.updateByShopIdAndTypeSelective(platformBuild);
}
}
//饿了么
if (type.equals(PlatformBuildEnum.E_LE_ME.getCode())) {
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_21);
if (!shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_210.getShopSubStageStatus())
&& !shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_214.getShopSubStageStatus())) {
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
}
if (Objects.isNull(platformBuildDO)) {
extracted(partnerUserInfoVO, shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_210, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_211,
userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.E_L_ME_TUAN_OPERATIONS_CUSTOMER, regionId));
} else {
extracted(partnerUserInfoVO, shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_214, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_211,
userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.E_L_ME_TUAN_OPERATIONS_CUSTOMER, regionId));
return platformBuildDAO.updateByShopIdAndTypeSelective(platformBuild);
}
}
//美团外卖
if (type.equals(PlatformBuildEnum.MEI_TUAN_WAI_MAI.getCode())) {
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_19);
if (!shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_190.getShopSubStageStatus())
&& !shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_194.getShopSubStageStatus())) {
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
}
if (Objects.isNull(platformBuildDO)) {
extracted(partnerUserInfoVO, shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_190, SHOP_SUB_STAGE_STATUS_191,
userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.MEI_TUAN_OPERATIONS_CUSTOMER, regionId));
} else {
extracted(partnerUserInfoVO, shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_194, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_191,
userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.MEI_TUAN_OPERATIONS_CUSTOMER, regionId));
return platformBuildDAO.updateByShopIdAndTypeSelective(platformBuild);
}
}
return platformBuildDAO.insertSelective(platformBuild);
}
private void extracted(PartnerUserInfoVO partnerUserInfoVO, Long shopId, ShopSubStageStatusEnum nowShopSubStageStatusEnum, ShopSubStageStatusEnum nextShopSubStageStatusEnum, List<EnterpriseUserDO> operationUserList) {
shopStageInfoDAO.updateShopStageInfo(shopId, nextShopSubStageStatusEnum);
operationLogService.addOperationLog(shopId, nowShopSubStageStatusEnum,
partnerUserInfoVO.getPartnerId(), partnerUserInfoVO.getUsername(), OperationTypeEnum.OPERATION_TYPE_0, null, OperationStatusEnum.PROCESSED);
operationLogService.addOperationLog(shopId, nextShopSubStageStatusEnum, partnerUserInfoVO.getPartnerId(),
operationUserList, OperationTypeEnum.OPERATION_TYPE_1, null, OperationStatusEnum.NOT_PROCESSED);
}
@Override
public PlatformBuildResponse get(Long shopId, Integer type) {
PlatformBuildDO platformBuildDO = platformBuildDAO.selectOneByShopId(shopId, type);
PlatformBuildResponse platformBuildResponse = new PlatformBuildResponse();
if (Objects.isNull(platformBuildDO)) {
return platformBuildResponse;
}
BeanUtils.copyProperties(platformBuildDO, platformBuildResponse);
ShopAuditInfoDO auditInfo = shopAuditInfoDAO.getAuditInfo(platformBuildDO.getAuditId());
if (Objects.nonNull(auditInfo)) {
if (auditInfo.getResultType().equals(AuditResultTypeEnum.PASS.getCode())) {
platformBuildResponse.setReason(auditInfo.getPassReason());
} else {
platformBuildResponse.setReason(auditInfo.getRejectReason());
}
}
return platformBuildResponse;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Integer firstAudit(PlatformBuildAuditRequest request) {
Integer type = request.getType();
Long shopId = request.getShopId();
PlatformBuildDO platformBuildDO = platformBuildDAO.selectOneByShopId(shopId, type);
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId());
Long regionId = shopInfo.getRegionId();
if (type.equals(PlatformBuildEnum.DOU_YIN.getCode())) {
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_18);
if (!shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_181.getShopSubStageStatus())) {
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
}
ShopAuditInfoDO shopAuditInfoDO = PlatformBuildAuditRequest.convert(request, AuditTypeEnum.DOU_YIN);
return doThing(platformBuildDO, request, shopAuditInfoDO, shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_181, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_183, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_182);
}
if (type.equals(PlatformBuildEnum.KUAI_SHOU.getCode())) {
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_22);
if (!shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_221.getShopSubStageStatus())) {
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
}
ShopAuditInfoDO shopAuditInfoDO = PlatformBuildAuditRequest.convert(request, AuditTypeEnum.KUAI_SHOU);
return doThing(platformBuildDO, request, shopAuditInfoDO, shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_221, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_223, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_222);
}
if (type.equals(PlatformBuildEnum.MEI_TUAN_TUAN_GOU.getCode())) {
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_20);
if (!shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_201.getShopSubStageStatus())) {
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
}
ShopAuditInfoDO shopAuditInfoDO = PlatformBuildAuditRequest.convert(request, AuditTypeEnum.MEI_TUAN_TUAN_GOU);
return doThing(platformBuildDO, request, shopAuditInfoDO, shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_201, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_203, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_202);
}
if (type.equals(PlatformBuildEnum.E_LE_ME.getCode())) {
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_21);
if (!shopSubStageInfo.getShopSubStageStatus().equals(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_211.getShopSubStageStatus())) {
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
}
ShopAuditInfoDO shopAuditInfoDO = PlatformBuildAuditRequest.convert(request, AuditTypeEnum.E_LE_ME);
doThing(platformBuildDO, request, shopAuditInfoDO, shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_211, SHOP_SUB_STAGE_STATUS_213, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_214);
if (request.getResultType().equals(AuditResultTypeEnum.PASS.getCode())) {
operationLogService.addOperationLog(shopId, SHOP_SUB_STAGE_STATUS_213, request.getOperateUserId(),
userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.E_L_ME_HEADQUARTERS_BUILD_CUSTOMER,regionId), OperationTypeEnum.OPERATION_TYPE_1, null, OperationStatusEnum.NOT_PROCESSED);
}
return CommonConstants.ONE;
}
if (type.equals(PlatformBuildEnum.MEI_TUAN_WAI_MAI.getCode())) {
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_19);
if (!shopSubStageInfo.getShopSubStageStatus().equals(SHOP_SUB_STAGE_STATUS_191.getShopSubStageStatus())) {
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
}
ShopAuditInfoDO shopAuditInfoDO = PlatformBuildAuditRequest.convert(request, AuditTypeEnum.MEI_TUAN_WAI_MAI);
doThing(platformBuildDO, request, shopAuditInfoDO, shopId, SHOP_SUB_STAGE_STATUS_191, SHOP_SUB_STAGE_STATUS_193, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_194);
if (request.getResultType().equals(AuditResultTypeEnum.PASS.getCode())) {
operationLogService.addOperationLog(shopId, SHOP_SUB_STAGE_STATUS_193, request.getOperateUserId(),
userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.MEI_TUAN_HEADQUARTERS_BUILD_CUSTOMER,regionId), OperationTypeEnum.OPERATION_TYPE_1, null, OperationStatusEnum.NOT_PROCESSED);
}
return CommonConstants.ONE;
}
return 0;
}
@Override
public Integer secondAudit(PlatformBuildAuditRequest request) {
Integer type = request.getType();
Long shopId = request.getShopId();
PlatformBuildDO platformBuildDO = platformBuildDAO.selectOneByShopId(shopId, type);
if (type.equals(PlatformBuildEnum.E_LE_ME.getCode())) {
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_21);
if (!shopSubStageInfo.getShopSubStageStatus().equals(SHOP_SUB_STAGE_STATUS_213.getShopSubStageStatus())) {
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
}
ShopAuditInfoDO shopAuditInfoDO = PlatformBuildAuditRequest.convert(request, AuditTypeEnum.E_LE_ME);
return doThing(platformBuildDO, request, shopAuditInfoDO, shopId, SHOP_SUB_STAGE_STATUS_213, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_215, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_214);
}
if (type.equals(PlatformBuildEnum.MEI_TUAN_WAI_MAI.getCode())) {
ShopStageInfoDO shopSubStageInfo = shopStageInfoDAO.getShopSubStageInfo(shopId, ShopSubStageEnum.SHOP_STAGE_19);
if (!shopSubStageInfo.getShopSubStageStatus().equals(SHOP_SUB_STAGE_STATUS_193.getShopSubStageStatus())) {
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
}
ShopAuditInfoDO shopAuditInfoDO = PlatformBuildAuditRequest.convert(request, AuditTypeEnum.MEI_TUAN_WAI_MAI);
return doThing(platformBuildDO, request, shopAuditInfoDO, shopId, SHOP_SUB_STAGE_STATUS_193, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_195, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_194);
}
return 0;
}
private Integer doThing(PlatformBuildDO platformBuildDO, PlatformBuildAuditRequest request, ShopAuditInfoDO shopAuditInfoDO, Long shopId, ShopSubStageStatusEnum nowStatus, ShopSubStageStatusEnum passStatus, ShopSubStageStatusEnum rejectStatus) {
Long auditId = shopAuditInfoDAO.addAuditInfo(shopAuditInfoDO);
if (request.getResultType().equals(AuditResultTypeEnum.PASS.getCode())) {
shopStageInfoDAO.updateShopStageInfo(shopId, passStatus);
} else {
shopStageInfoDAO.updateShopStageInfo(shopId, rejectStatus);
}
List<OperationLogDO> operationLogs = operationLogDAO.getBySubStageStatusEnumAndsStatus(shopId, nowStatus, OperationTypeEnum.OPERATION_TYPE_1.getCode());
operationLogService.batchUpdateProcessed(operationLogs, auditId, request.getOperateUserId(), request.getReason());
platformBuildDO.setAuditId(auditId);
platformBuildDO.setUpdateTime(new Date());
platformBuildDO.setUpdateUser(request.getOperateUserId());
return platformBuildDAO.updateByShopIdAndTypeSelective(platformBuildDO);
}
}

View File

@@ -0,0 +1,90 @@
package com.cool.store.controller.webb;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.PartnerUserHolder;
import com.cool.store.enums.PlatformBuildEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.request.PlatformBuildAuditRequest;
import com.cool.store.response.AuditInfoResponse;
import com.cool.store.response.PlatformBuildResponse;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.OperationLogService;
import com.cool.store.service.PlatformBuildService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* @Author: WangShuo
* @Date: 2024/10/10/下午3:58
* @Version 1.0
* @注释:
*/
@Api("pc平台建店")
@RestController
@RequestMapping("/pc/platformBuild")
public class PCPlatformBuildController {
@Resource
private OperationLogService operationLogService;
@Resource
private PlatformBuildService platformBuildService;
@ApiOperation("根据type获取平台建店详情:1-抖音2-快手3-美团团购4-饿了么5-美团外卖")
@GetMapping("/get")
public ResponseResult<PlatformBuildResponse> get(@RequestParam("shopId") Long shopId,@RequestParam("type") Integer type) {
return ResponseResult.success(platformBuildService.get(shopId, PlatformBuildEnum.DOU_YIN.getCode()));
}
@ApiOperation("一级审批")
@PostMapping("/firstAudit")
public ResponseResult<Integer> firstAudit(@RequestBody @Validated PlatformBuildAuditRequest request) {
request.setOperateUserId(CurrentUserHolder.getUserId());
request.setOperateUserName(CurrentUserHolder.getUser().getName());
return ResponseResult.success(platformBuildService.firstAudit(request));
}
@ApiOperation("二级级审批 美团外卖&饿了么")
@PostMapping("/secondAudit")
public ResponseResult<Integer> secondAudit(@RequestBody @Validated PlatformBuildAuditRequest request) {
request.setOperateUserId(CurrentUserHolder.getUserId());
request.setOperateUserName(CurrentUserHolder.getUser().getName());
return ResponseResult.success(platformBuildService.secondAudit(request));
}
@ApiOperation("根据type获取平台建店审批记录:1-抖音2-快手3-美团团购4-饿了么5-美团外卖")
@GetMapping("/getAuditInfo")
public ResponseResult<List<AuditInfoResponse>> getAuditInfo(@RequestParam("shopId") Long shopId, @RequestParam("type") Integer type) {
List<Integer> shopSubStageStatusList = new ArrayList<>();
if (type.equals(PlatformBuildEnum.DOU_YIN.getCode())) {
shopSubStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_180.getShopSubStageStatus());
shopSubStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_181.getShopSubStageStatus());
shopSubStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_182.getShopSubStageStatus());
}else if (type.equals(PlatformBuildEnum.KUAI_SHOU.getCode())) {
shopSubStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_220.getShopSubStageStatus());
shopSubStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_221.getShopSubStageStatus());
shopSubStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_222.getShopSubStageStatus());
}else if (type.equals(PlatformBuildEnum.MEI_TUAN_TUAN_GOU.getCode())) {
shopSubStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_200.getShopSubStageStatus());
shopSubStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_201.getShopSubStageStatus());
shopSubStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_202.getShopSubStageStatus());
}else if (type.equals(PlatformBuildEnum.E_LE_ME.getCode())) {
shopSubStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_210.getShopSubStageStatus());
shopSubStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_211.getShopSubStageStatus());
shopSubStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_213.getShopSubStageStatus());
shopSubStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_214.getShopSubStageStatus());
}else if (type.equals(PlatformBuildEnum.MEI_TUAN_WAI_MAI.getCode())) {
shopSubStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_190.getShopSubStageStatus());
shopSubStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_191.getShopSubStageStatus());
shopSubStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_193.getShopSubStageStatus());
shopSubStageStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_194.getShopSubStageStatus());
}
return ResponseResult.success(operationLogService.getAuditInfo(shopId, shopSubStageStatusList));
}
}

View File

@@ -0,0 +1,50 @@
package com.cool.store.controller.webc;
import com.cool.store.context.PartnerUserHolder;
import com.cool.store.enums.PlatformBuildEnum;
import com.cool.store.request.PlatformBuildRequest;
import com.cool.store.response.PlatformBuildResponse;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.PlatformBuildService;
import com.cool.store.vo.PartnerUserInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* @Author: WangShuo
* @Date: 2024/10/10/下午3:58
* @Version 1.0
* @注释:
*/
@Api("mini平台建店")
@RestController
@RequestMapping("/mini/platformBuild")
public class MiniPlatformBuildController {
@Resource
private PlatformBuildService platformBuildService;
@ApiOperation("获取是法人身份证号")
@GetMapping("/getJuridicalIdCard")
public ResponseResult<String> getJuridicalIdCard(@RequestParam("shopId") Long shopId) {
return ResponseResult.success(platformBuildService.juridicalIdCard(shopId));
}
@ApiOperation("根据type获取平台建店详情:1-抖音2-快手3-美团团购4-饿了么5-美团外卖")
@GetMapping("/get")
public ResponseResult<PlatformBuildResponse> get(@RequestParam("shopId") Long shopId,@RequestParam("type") Integer type) {
return ResponseResult.success(platformBuildService.get(shopId, PlatformBuildEnum.DOU_YIN.getCode()));
}
@ApiOperation("根据type 提交或修改 平台建店详情:1-抖音2-快手3-美团团购4-饿了么5-美团外卖")
@PostMapping("/submitOrUpdate")
public ResponseResult<Integer> submitOrUpdate(@RequestBody @Validated PlatformBuildRequest request) {
return ResponseResult.success(platformBuildService.submitOrUpdate(request, PartnerUserHolder.getUser()));
}
}