feat:平台账号

This commit is contained in:
苏竹红
2025-04-08 15:22:47 +08:00
parent c431754f28
commit c08905399c
29 changed files with 1294 additions and 19 deletions

View File

@@ -0,0 +1,51 @@
package com.cool.store.enums;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @Author suzhuhong
* @Date 2025/4/7 15:01
* @Version 1.0
*/
public enum OpenStatusEnum {
OPENSTATUSENUM_1(1,"开通资料收集中"),
OPENSTATUSENUM_2(2,"资料审核中"),
OPENSTATUSENUM_3(3,"资料审核失败"),
OPENSTATUSENUM_4(4,"开通中"),
OPENSTATUSENUM_5(5,"开通成功"),
OPENSTATUSENUM_6(6,"开通失败"),
;
private Integer code;
private String name;
OpenStatusEnum(Integer code,String name){
this.code = code;
this.name = name;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

View File

@@ -7,8 +7,8 @@ package com.cool.store.enums;
* @注释:
*/
public enum PlatformBuildEnum {
DOU_YIN(1,"抖音"),
KUAI_SHOU(2,"快手"),
DOU_YIN(1,"抖音团购"),
KUAI_SHOU(2,"快手团购"),
MEI_TUAN_TUAN_GOU(3,"美团团购"),
E_LE_ME(4,"饿了么"),
MEI_TUAN_WAI_MAI(5,"美团外卖"),
@@ -26,5 +26,13 @@ public enum PlatformBuildEnum {
return message;
}
public static String getMessageByCode(Integer code) {
for (PlatformBuildEnum value : PlatformBuildEnum.values()) {
if (value.getCode().equals(code)) {
return value.getMessage();
}
}
return null; // 或者抛出异常
}
}

View File

@@ -0,0 +1,54 @@
package com.cool.store.enums;
import java.util.Arrays;
import java.util.List;
/**
* @Author suzhuhong
* @Date 2025/4/7 14:57
* @Version 1.0
*/
public enum ShopAccountEnum {
HuoMa("火码POS",OpenStatusEnum.OPENSTATUSENUM_1),
YLS("云流水",OpenStatusEnum.OPENSTATUSENUM_1),
XZG("新掌柜",OpenStatusEnum.OPENSTATUSENUM_1),
MTTG("美团团购",OpenStatusEnum.OPENSTATUSENUM_1),
DY("抖音团购",OpenStatusEnum.OPENSTATUSENUM_1),
KS("快手团购",OpenStatusEnum.OPENSTATUSENUM_1),
MT("美团外卖",OpenStatusEnum.OPENSTATUSENUM_1),
ELM("饿了么外卖",OpenStatusEnum.OPENSTATUSENUM_1),
;
public static List<String> getSpecialList(){
return Arrays.asList(HuoMa.getSystemName(),YLS.getSystemName(),XZG.getSystemName());
}
private String systemName;
private OpenStatusEnum initStatus;
ShopAccountEnum(String systemName,OpenStatusEnum initStatus){
this.systemName = systemName;
this.initStatus = initStatus;
}
public String getSystemName() {
return systemName;
}
public void setSystemName(String systemName) {
this.systemName = systemName;
}
public OpenStatusEnum getInitStatus() {
return initStatus;
}
public void setInitStatus(OpenStatusEnum initStatus) {
this.initStatus = initStatus;
}
}

View File

@@ -0,0 +1,120 @@
package com.cool.store.dao;
import com.cool.store.constants.CommonConstants;
import com.cool.store.entity.HyPartnerUserInfoDO;
import com.cool.store.entity.ShopAccountDO;
import com.cool.store.enums.OpenStatusEnum;
import com.cool.store.enums.PlatformBuildEnum;
import com.cool.store.enums.ShopAccountEnum;
import com.cool.store.mapper.ShopAccountMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* @Author suzhuhong
* @Date 2025/4/7 14:26
* @Version 1.0
*/
@Component
public class ShopAccountDAO {
@Resource
ShopAccountMapper shopAccountMapper;
public Integer initShopAccount(HyPartnerUserInfoDO partnerUserInfoDO, List<Long> shopIds){
List<ShopAccountDO> shopAccountDOS = new ArrayList<>();
for (Long shopId : shopIds) {
for (ShopAccountEnum shopAccountEnum: ShopAccountEnum.values()) {
ShopAccountDO shopAccountDO = new ShopAccountDO();
shopAccountDO.setShopId(shopId);
shopAccountDO.setSystemName(shopAccountEnum.getSystemName());
shopAccountDO.setBoundPhone(partnerUserInfoDO.getMobile());
shopAccountDO.setPasswordSalt(partnerUserInfoDO.getDownstreamSystemSalting());
shopAccountDO.setPassword(partnerUserInfoDO.getDownstreamSystemPassword());
shopAccountDO.setStatus(shopAccountEnum.getInitStatus().getCode());
if (ShopAccountEnum.HuoMa.equals(shopAccountEnum)){
shopAccountDO.setEntryStatus(CommonConstants.ONE);
}
shopAccountDOS.add(shopAccountDO);
}
}
return shopAccountMapper.batchInsert(shopAccountDOS);
}
int batchInsert(List<ShopAccountDO> list){
if (CollectionUtils.isEmpty(list)){
return CommonConstants.ZERO;
}
return shopAccountMapper.batchInsert(list);
}
/**
* 根据shopId查询多条数据
* @param shopId 店铺ID
* @return 店铺账号列表
*/
public List<ShopAccountDO> selectByShopId(Long shopId){
return shopAccountMapper.selectByShopId(shopId);
}
/**
* 根据shopId与system_name修改status
* @param shopId 店铺ID
* @param systemName 系统名称
* @param status 状态
* @return 影响的行数
*/
public int updateStatusByShopIdAndSystemName(Long shopId, List<String> systemNameList, Integer status){
return shopAccountMapper.updateStatusByShopIdAndSystemName(shopId,systemNameList,status);
}
public int updateEntryStatusByShopIdAndSystemName(Long shopId, List<String> systemNameList, Integer status){
return shopAccountMapper.updateEntryStatusByShopIdAndSystemName(shopId,systemNameList,status);
}
/**
* changeStatus
* @param shopId
* @param type
* @param account
* @param password
* @param resultType
* @return
*/
public Boolean changeStatus(Long shopId,Integer type,String account ,String password,Integer resultType){
if (Objects.isNull(shopId)||Objects.isNull(resultType)){
return Boolean.FALSE;
}
Integer openStatus = resultType == 1 ? OpenStatusEnum.OPENSTATUSENUM_6.getCode() : OpenStatusEnum.OPENSTATUSENUM_5.getCode();
String systemName = PlatformBuildEnum.getMessageByCode(type);
shopAccountMapper.updateAccountByShopIdAndSystemName(shopId,systemName,account,password,openStatus);
return Boolean.TRUE;
}
/**
* 只修改 POS 云流水 新掌柜
* @param shopIds
* @param password
* @param passwordSalt
* @param lastSyncTime
* @return
*/
public int batchUpdatePasswordByShopIds( List<Long> shopIds, String password, String passwordSalt, Date lastSyncTime){
return shopAccountMapper.batchUpdatePasswordByShopIds(
shopIds, password, passwordSalt, lastSyncTime
);
}
}

View File

@@ -186,6 +186,13 @@ public class ShopInfoDAO {
return shopInfoMapper.selectByStoreNum(storeNum);
}
public ShopInfoDO selectByStoreCode(String storeCode){
if (StringUtils.isBlank(storeCode)) {
return null;
}
return shopInfoMapper.selectByStoreCode(storeCode);
}
public List<ShopInfoDO> selectByIdOrSelectAll(Long shopId){
return shopInfoMapper.selectByIdOrSelectAll(shopId);

View File

@@ -0,0 +1,74 @@
package com.cool.store.mapper;
import com.cool.store.entity.ShopAccountDO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import tk.mybatis.mapper.common.Mapper;
import java.util.Date;
import java.util.List;
public interface ShopAccountMapper extends Mapper<ShopAccountDO> {
/**
* 批量新增店铺账号
* @param list 店铺账号列表
* @return 影响的行数
*/
int batchInsert(List<ShopAccountDO> list);
/**
* 根据shopId查询多条数据
* @param shopId 店铺ID
* @return 店铺账号列表
*/
List<ShopAccountDO> selectByShopId(Long shopId);
/**
* 根据shopId与system_name修改status
* @param shopId 店铺ID
* @param systemName 系统名称
* @param status 状态
* @param lastSyncTime 最后同步时间
* @return 影响的行数
*/
int updateStatusByShopIdAndSystemName(
@Param("shopId") Long shopId,
@Param("systemNameList") List<String> systemNameList,
@Param("status") Integer status
);
int updateEntryStatusByShopIdAndSystemName(
@Param("shopId") Long shopId,
@Param("systemNameList") List<String> systemNameList,
@Param("entryStatus") Integer entryStatus
);
int updateAccountByShopIdAndSystemName(
@Param("shopId") Long shopId,
@Param("systemName") String systemName,
@Param("account") String account,
@Param("password") String password,
@Param("status") Integer status
);
/**
* 批量修改密码和密码盐
* @param shopIds 店铺ID列表
* @param password 新密码
* @param passwordSalt 新密码盐
* @param lastSyncTime 最后同步时间
* @return 影响的行数
*/
int batchUpdatePasswordByShopIds(
@Param("shopIds") List<Long> shopIds,
@Param("password") String password,
@Param("passwordSalt") String passwordSalt,
@Param("lastSyncTime") Date lastSyncTime
);
}

View File

@@ -0,0 +1,7 @@
package com.cool.store.mapper;
import com.cool.store.entity.ShopAccountDO;
import tk.mybatis.mapper.common.Mapper;
public interface ShopAccountMapper extends Mapper<ShopAccountDO> {
}

View File

@@ -92,6 +92,8 @@ public interface ShopInfoMapper extends Mapper<ShopInfoDO> {
Long getRegionIdByid(@Param("shopId") Long shopId);
ShopInfoDO selectByStoreNum(@Param("storeNum") String storeNum);
ShopInfoDO selectByStoreCode(@Param("storeNum") String storeCode);
/**
* @Auther: wangshuo
* @Date: 2024/5/3

View File

@@ -0,0 +1,129 @@
<?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.ShopAccountMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.ShopAccountDO">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
<result column="system_name" jdbcType="VARCHAR" property="systemName" />
<result column="account" jdbcType="VARCHAR" property="account" />
<result column="bound_phone" jdbcType="VARCHAR" property="boundPhone" />
<result column="password_salt" jdbcType="VARCHAR" property="passwordSalt" />
<result column="password" jdbcType="VARCHAR" property="password" />
<result column="status" jdbcType="BIT" property="status" />
<result column="entry_status" jdbcType="TINYINT" property="entryStatus" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="last_sync_time" jdbcType="TIMESTAMP" property="lastSyncTime" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
</resultMap>
<!-- 批量新增 -->
<insert id="batchInsert">
INSERT INTO xfsg_shop_account (
shop_id,
system_name,
account,
bound_phone,
password_salt,
password,
status,
entry_status,
last_sync_time,
remark
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.shopId},
#{item.systemName},
#{item.account},
#{item.boundPhone},
#{item.passwordSalt},
#{item.password},
#{item.status},
#{item.entryStatus},
#{item.lastSyncTime},
#{item.remark}
)
</foreach>
</insert>
<!-- 根据shopId查询多条数据 -->
<select id="selectByShopId" resultMap="BaseResultMap">
SELECT
id,
shop_id,
system_name,
account,
bound_phone,
password_salt,
password,
status,
entry_status,
create_time,
last_sync_time,
remark
FROM
xfsg_shop_account
WHERE
shop_id = #{shopId}
</select>
<!-- 根据shopId与system_name修改status -->
<update id="updateStatusByShopIdAndSystemName">
UPDATE
xfsg_shop_account
SET
status = #{status,jdbcType=BIT}
WHERE
shop_id = #{shopId}
and system_name in
<foreach close=")" collection="systemNameList" item="systemName" open="(" separator=",">
#{systemName}
</foreach>
</update>
<update id="updateEntryStatusByShopIdAndSystemName">
UPDATE
xfsg_shop_account
SET
entry_status = #{entryStatus,jdbcType=BIT}
WHERE
shop_id = #{shopId}
and system_name in
<foreach close=")" collection="systemNameList" item="systemName" open="(" separator=",">
#{systemName}
</foreach>
</update>
<update id="updateAccountByShopIdAndSystemName">
UPDATE
xfsg_shop_account
SET
account = #{account},
password = #{password},
status = #{status},
WHERE
shop_id = #{shopId}
AND system_name = #{systemName}
</update>
<!-- 批量修改密码和密码盐 -->
<update id="batchUpdatePasswordByShopIds">
UPDATE
xfsg_shop_account
SET
password = #{password},
password_salt = #{passwordSalt},
last_sync_time = #{lastSyncTime,jdbcType=TIMESTAMP}
WHERE
system_name in ('火码POS','云流水','新掌柜')
and shop_id IN
<foreach close=")" collection="shopIds" item="shopId" open="(" separator=",">
#{shopId}
</foreach>
</update>
</mapper>

View File

@@ -173,6 +173,12 @@
from xfsg_shop_info
where store_num = #{storeNum}
</select>
<select id="selectByStoreCode" resultType="com.cool.store.entity.ShopInfoDO">
select
<include refid="allColumn"/>
from xfsg_shop_info
where store_code = #{storeCode}
</select>
<select id="selectShopListByRegionId" resultType="com.cool.store.entity.ShopInfoDO">
select
xsi.id,xsi.line_id as lineId,xsi.region_id as regionId,xsi.shop_name as shopName,xsi.store_num as

View File

@@ -0,0 +1,22 @@
package com.cool.store.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author suzhuhong
* @Date 2025/4/7 16:31
* @Version 1.0
*/
@Data
public class ModifyPasswordDTO {
@ApiModelProperty("盐值")
String passwordSalt;
@ApiModelProperty("密码")
String password;
@ApiModelProperty("门店ID")
Long shopId;
}

View File

@@ -0,0 +1,57 @@
package com.cool.store.dto.ShopAccount;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import java.util.Date;
/**
* @Author suzhuhong
* @Date 2025/4/7 15:53
* @Version 1.0
*/
@Data
public class ShopAccountDTO {
@ApiModelProperty("id")
private Integer id;
@ApiModelProperty("店铺ID")
private Long shopId;
@Column(name = "system_name")
@ApiModelProperty("系统名称")
private String systemName;
@ApiModelProperty("账号")
private String account;
@Column(name = "绑定的手机")
@ApiModelProperty("id")
private String boundPhone;
@ApiModelProperty("密码")
private String password;
@ApiModelProperty("状态1-开通资料收集中, 2-资料审核中, 3-资料审核失败, 4-开通中, 5-开通成功, 6-开通失败")
private Integer status;
@ApiModelProperty(" 只有火码需要 进件状态1-进件资料收集中, 2-进件资料审核中, 3-进件资料审核失败, 4-进件中, 5-进件成功, 6-进件失败")
private Integer entryStatus;
@ApiModelProperty("创建时间")
private Date createTime;
@ApiModelProperty("最新同步时间")
private Date lastSyncTime;
@ApiModelProperty("备注")
private String remark;
}

View File

@@ -0,0 +1,25 @@
package com.cool.store.dto;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
/**
* @Author suzhuhong
* @Date 2025/4/7 16:55
* @Version 1.0
*/
@Data
public class StatusRefreshDTO {
@NotEmpty(message = "来源不能为空")
private String systemSource;
@NotEmpty(message = "门店编码不能为空")
private String shopCode;
@NotEmpty(message = "开通状态")
private Boolean openStatus;
}

View File

@@ -0,0 +1,80 @@
package com.cool.store.entity;
import lombok.Data;
import java.util.Date;
import javax.persistence.*;
@Table(name = "xfsg_shop_accounts")
@Data
public class ShopAccountDO {
/**
* 主键ID
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 店铺ID
*/
@Column(name = "shop_id")
private Long shopId;
/**
* 系统名称
*/
@Column(name = "system_name")
private String systemName;
/**
* 账号
*/
private String account;
/**
* 绑定的手机
*/
@Column(name = "bound_phone")
private String boundPhone;
/**
* 密码盐
*/
@Column(name = "password_salt")
private String passwordSalt;
/**
* 密码
*/
private String password;
/**
* 状态1-开通资料收集中, 2-资料审核中, 3-资料审核失败, 4-开通中, 5-开通成功, 6-开通失败
*/
private Integer status;
/**
* 只有火码需要 进件状态1-进件资料收集中, 2-进件资料审核中, 3-进件资料审核失败, 4-进件中, 5-进件成功, 6-进件失败
*/
@Column(name = "entry_status")
private Integer entryStatus;
/**
* 创建时间
*/
@Column(name = "create_time")
private Date createTime;
/**
* 最新同步时间
*/
@Column(name = "last_sync_time")
private Date lastSyncTime;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,292 @@
package com.cool.store.entity;
import java.util.Date;
import javax.persistence.*;
@Table(name = "xfsg_shop_accounts")
public class ShopAccountDO {
/**
* 主键ID
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 店铺ID
*/
@Column(name = "shop_id")
private Integer shopId;
/**
* 系统名称
*/
@Column(name = "system_name")
private String systemName;
/**
* 账号
*/
private String account;
/**
* 绑定的手机
*/
@Column(name = "bound_phone")
private String boundPhone;
/**
* 密码盐
*/
@Column(name = "password_salt")
private String passwordSalt;
/**
* 密码
*/
private String password;
/**
* 状态1-开通资料收集中, 2-资料审核中, 3-资料审核失败, 4-开通中, 5-开通成功, 6-开通失败
*/
private Boolean status;
/**
* 只有火码需要 进件状态1-进件资料收集中, 2-进件资料审核中, 3-进件资料审核失败, 4-进件中, 5-进件成功, 6-进件失败
*/
@Column(name = "entry_status")
private Byte entryStatus;
/**
* 创建时间
*/
@Column(name = "create_time")
private Date createTime;
/**
* 最新同步时间
*/
@Column(name = "last_sync_time")
private Date lastSyncTime;
/**
* 备注
*/
private String remark;
/**
* 获取主键ID
*
* @return id - 主键ID
*/
public Integer getId() {
return id;
}
/**
* 设置主键ID
*
* @param id 主键ID
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取店铺ID
*
* @return shop_id - 店铺ID
*/
public Integer getShopId() {
return shopId;
}
/**
* 设置店铺ID
*
* @param shopId 店铺ID
*/
public void setShopId(Integer shopId) {
this.shopId = shopId;
}
/**
* 获取系统名称
*
* @return system_name - 系统名称
*/
public String getSystemName() {
return systemName;
}
/**
* 设置系统名称
*
* @param systemName 系统名称
*/
public void setSystemName(String systemName) {
this.systemName = systemName;
}
/**
* 获取账号
*
* @return account - 账号
*/
public String getAccount() {
return account;
}
/**
* 设置账号
*
* @param account 账号
*/
public void setAccount(String account) {
this.account = account;
}
/**
* 获取绑定的手机
*
* @return bound_phone - 绑定的手机
*/
public String getBoundPhone() {
return boundPhone;
}
/**
* 设置绑定的手机
*
* @param boundPhone 绑定的手机
*/
public void setBoundPhone(String boundPhone) {
this.boundPhone = boundPhone;
}
/**
* 获取密码盐
*
* @return password_salt - 密码盐
*/
public String getPasswordSalt() {
return passwordSalt;
}
/**
* 设置密码盐
*
* @param passwordSalt 密码盐
*/
public void setPasswordSalt(String passwordSalt) {
this.passwordSalt = passwordSalt;
}
/**
* 获取密码
*
* @return password - 密码
*/
public String getPassword() {
return password;
}
/**
* 设置密码
*
* @param password 密码
*/
public void setPassword(String password) {
this.password = password;
}
/**
* 获取状态1-开通资料收集中, 2-资料审核中, 3-资料审核失败, 4-开通中, 5-开通成功, 6-开通失败
*
* @return status - 状态1-开通资料收集中, 2-资料审核中, 3-资料审核失败, 4-开通中, 5-开通成功, 6-开通失败
*/
public Boolean getStatus() {
return status;
}
/**
* 设置状态1-开通资料收集中, 2-资料审核中, 3-资料审核失败, 4-开通中, 5-开通成功, 6-开通失败
*
* @param status 状态1-开通资料收集中, 2-资料审核中, 3-资料审核失败, 4-开通中, 5-开通成功, 6-开通失败
*/
public void setStatus(Boolean status) {
this.status = status;
}
/**
* 获取只有火码需要 进件状态1-进件资料收集中, 2-进件资料审核中, 3-进件资料审核失败, 4-进件中, 5-进件成功, 6-进件失败
*
* @return entry_status - 只有火码需要 进件状态1-进件资料收集中, 2-进件资料审核中, 3-进件资料审核失败, 4-进件中, 5-进件成功, 6-进件失败
*/
public Byte getEntryStatus() {
return entryStatus;
}
/**
* 设置只有火码需要 进件状态1-进件资料收集中, 2-进件资料审核中, 3-进件资料审核失败, 4-进件中, 5-进件成功, 6-进件失败
*
* @param entryStatus 只有火码需要 进件状态1-进件资料收集中, 2-进件资料审核中, 3-进件资料审核失败, 4-进件中, 5-进件成功, 6-进件失败
*/
public void setEntryStatus(Byte entryStatus) {
this.entryStatus = entryStatus;
}
/**
* 获取创建时间
*
* @return create_time - 创建时间
*/
public Date getCreateTime() {
return createTime;
}
/**
* 设置创建时间
*
* @param createTime 创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取最新同步时间
*
* @return last_sync_time - 最新同步时间
*/
public Date getLastSyncTime() {
return lastSyncTime;
}
/**
* 设置最新同步时间
*
* @param lastSyncTime 最新同步时间
*/
public void setLastSyncTime(Date lastSyncTime) {
this.lastSyncTime = lastSyncTime;
}
/**
* 获取备注
*
* @return remark - 备注
*/
public String getRemark() {
return remark;
}
/**
* 设置备注
*
* @param remark 备注
*/
public void setRemark(String remark) {
this.remark = remark;
}
}

View File

@@ -0,0 +1,21 @@
package com.cool.store.service;
import com.cool.store.dto.StatusRefreshDTO;
/**
* @Author suzhuhong
* @Date 2025/4/7 16:53
* @Version 1.0
*/
public interface OpenApiService {
/**
* 修改状态
* @param statusRefreshDTO
* @return
*/
Boolean statusRefresh(StatusRefreshDTO statusRefreshDTO);
}

View File

@@ -76,4 +76,31 @@ public interface PreparationService {
* @return
*/
Map<Long,Integer> getShopStatus(List<Long> shopIds);
/**
* POS进件状态修改
* 装修完成 工商证照办理完成 建店材料收集完成
* @param shopId
* @return
*/
Boolean buildStoreAndDecorationComplete(Long shopId);
/**
* POS 建店昨天完成
* 选址与建店资料完成(加盟合同完成)
* @param shopId
* @return
*/
Boolean selectSiteAndBuildStoreComplete(Long shopId);
/**
* 新管家状态修改
* 建店完成
* @param shopId
* @return
*/
Boolean buildStoreComplete(Long shopId);
}

View File

@@ -0,0 +1,25 @@
package com.cool.store.service;
import com.cool.store.dto.ShopAccount.ShopAccountDTO;
import java.util.List;
/**
* @Author suzhuhong
* @Date 2025/4/7 15:51
* @Version 1.0
*/
public interface ShopAccountService {
/**
* 根据门店查询数据
* @param shopId
* @return
*/
List<ShopAccountDTO> getShopAccountByShopId(Long shopId);
}

View File

@@ -125,6 +125,7 @@ public class ApplyLicenseServiceImpl implements ApplyLicenseService {
shopStageInfoDAO.updateShopStageAndAuditInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_33, null);
preparationService.licenseCompleted(request.getShopId());
preparationService.updateShopStatus(request.getShopId());
preparationService.buildStoreAndDecorationComplete(request.getShopId());
}
return Boolean.TRUE;
}

View File

@@ -709,6 +709,7 @@ public class DecorationServiceImpl implements DecorationService {
//更新阶段状态验收完毕
shopStageInfoDAO.updateShopStageAndAuditInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_123, null);
preparationService.updateShopStatus(request.getShopId());
preparationService.buildStoreAndDecorationComplete(request.getShopId());
} else {
//未通过至为待验收
shopStageInfoDAO.updateShopStageAndAuditInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_121, null);

View File

@@ -0,0 +1,47 @@
package com.cool.store.service.impl;
import com.cool.store.dao.ShopAccountDAO;
import com.cool.store.dao.ShopInfoDAO;
import com.cool.store.dto.StatusRefreshDTO;
import com.cool.store.entity.ShopInfoDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.OpenStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.service.OpenApiService;
import com.google.common.collect.Lists;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Objects;
/**
* @Author suzhuhong
* @Date 2025/4/7 16:54
* @Version 1.0
*/
@Service
public class OpenApiServiceImpl implements OpenApiService {
@Resource
ShopAccountDAO accountDAO;
@Resource
ShopInfoDAO shopInfoDAO;
@Override
public Boolean statusRefresh(StatusRefreshDTO statusRefreshDTO) {
//查询门店编码
ShopInfoDO shopInfoDO = shopInfoDAO.selectByStoreCode(statusRefreshDTO.getShopCode());
if (Objects.isNull(shopInfoDO)){
throw new ServiceException(ErrorCodeEnum.SHOP_NOT_EXIST);
}
Integer openStatus = statusRefreshDTO.getOpenStatus()?OpenStatusEnum.OPENSTATUSENUM_5.getCode():OpenStatusEnum.OPENSTATUSENUM_6.getCode();
accountDAO.updateStatusByShopIdAndSystemName(shopInfoDO.getId(), Arrays.asList(statusRefreshDTO.getSystemSource()), openStatus);
//订货系统开通完成
return Boolean.TRUE;
}
}

View File

@@ -97,6 +97,10 @@ public class OrderSysInfoServiceImpl implements OrderSysInfoService {
//初始化数据
preparationService.licenseCompleted(request.getShopId());
preparationService.sysStoreCompleted(request.getShopId());
preparationService.buildStoreAndDecorationComplete(request.getShopId());
preparationService.selectSiteAndBuildStoreComplete(request.getShopId());
preparationService.buildStoreComplete(request.getShopId());
ShopInfoDO shopInfoDO = shopInfoDAO.getShopInfo(request.getShopId());
LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(shopInfoDO.getLineId());

View File

@@ -80,6 +80,8 @@ public class PlatformBuildServiceImpl implements PlatformBuildService {
private RegionMapper regionMapper;
@Resource
private CommonService commonService;
@Resource
ShopAccountDAO accountDAO;
@Override
public String juridicalIdCard(Long shopId) {
@@ -491,6 +493,8 @@ public class PlatformBuildServiceImpl implements PlatformBuildService {
}
List<OperationLogDO> operationLogs = operationLogDAO.getBySubStageStatusEnumAndsStatus(shopId, nowStatus, OperationTypeEnum.OPERATION_TYPE_1.getCode());
operationLogService.batchUpdateProcessed(operationLogs, auditId, request.getOperateUserId(), request.getReason());
//平台账号维护
accountDAO.changeStatus(shopId,platformBuildDO.getType(),request.getAccount(),request.getPassword(),request.getResultType());
platformBuildDO.setAuditId(auditId);
platformBuildDO.setAccount(request.getAccount());
platformBuildDO.setPassword(request.getPassword());
@@ -498,6 +502,7 @@ public class PlatformBuildServiceImpl implements PlatformBuildService {
platformBuildDO.setUpdateUser(request.getOperateUserId());
platformBuildDO.setPoi(request.getPoi());
platformBuildDO.setStoreId(request.getStoreId());
return platformBuildDAO.updateByShopIdAndTypeSelective(platformBuildDO);
}
}

View File

@@ -370,6 +370,7 @@ public class PointServiceImpl implements PointService {
updateShopInfo.setShopName(pointInfo.getPointName());
shopInfoDAO.updateShopInfo(updateShopInfo);
shopStageInfoDAO.batchUpdateShopStageStatus(pointInfo.getShopId(), Arrays.asList(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_12, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_20));
preparationService.selectSiteAndBuildStoreComplete(pointInfo.getShopId());
Map<String, String> templateParam = new HashMap<>();
templateParam.put("pointName", pointInfo.getAddress());
}
@@ -836,6 +837,7 @@ public class PointServiceImpl implements PointService {
updateStatusList.add(ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_20);
Map<String, String> templateParam = new HashMap<>();
templateParam.put("pointName", pointInfo.getAddress());
preparationService.selectSiteAndBuildStoreComplete(shopId);
}
updateStatusList.add(selectStatus);
shopStageInfoDAO.batchUpdateShopStageStatus(shopId, updateStatusList);

View File

@@ -4,15 +4,8 @@ import com.cool.store.constants.CommonConstants;
import com.cool.store.dao.*;
import com.cool.store.dto.Preparation.PreparationDTO;
import com.cool.store.dto.Preparation.ScheduleDTO;
import com.cool.store.dto.decoration.ConstructionScheduleDTO;
import com.cool.store.dto.decoration.DecorationDTO;
import com.cool.store.dto.decoration.ProjectDTO;
import com.cool.store.dto.openPreparation.OpenPlanShopInfoDTO;
import com.cool.store.entity.*;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.MessageEnum;
import com.cool.store.enums.SMSMsgEnum;
import com.cool.store.enums.point.ShopStageEnum;
import com.cool.store.enums.*;
import com.cool.store.enums.point.ShopStatusEnum;
import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
@@ -21,23 +14,19 @@ import com.cool.store.request.PreparationRequest;
import com.cool.store.service.*;
import com.cool.store.utils.poi.DateUtils;
import com.cool.store.utils.poi.StringUtils;
import com.cool.store.utils.poi.constant.Constants;
import com.cool.store.vo.Preparation.PreparationProcessVO;
import com.cool.store.vo.Preparation.PreparationScheduleDetailVO;
import com.cool.store.vo.Preparation.PreparationScheduleVO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@@ -46,9 +35,9 @@ import java.util.stream.Collectors;
* @Version 1.0
*/
@Service
@Slf4j
public class PreparationServiceImpl implements PreparationService {
private static final Logger log = LoggerFactory.getLogger(PreparationServiceImpl.class);
@Resource
private CommonService commonService;
@Resource
@@ -311,5 +300,65 @@ public class PreparationServiceImpl implements PreparationService {
return map;
}
@Resource
ShopAccountDAO shopAccountDAO;
@Override
public Boolean buildStoreAndDecorationComplete(Long shopId) {
List<ShopStageInfoDO> shopStageInfo = shopStageInfoDAO.getShopStageInfo(shopId, null);
if (CollectionUtils.isNotEmpty(shopStageInfo)) {
Map<Integer, ShopStageInfoDO> shopStageInfoDOMap = shopStageInfo.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopSubStage, data -> data));
Boolean flag1 = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_33.getShopSubStageStatus().
equals(shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_3.getShopSubStage()).getShopSubStageStatus());
Boolean flag2 = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_112.getShopSubStageStatus().
equals(shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_12.getShopSubStage()).getShopSubStageStatus());
Boolean flag3 = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_153.getShopSubStageStatus().
equals(shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_15.getShopSubStage()).getShopSubStageStatus());
log.info("buildStoreAndDecorationComplete flag1->{} flag2->{} flag3->{}",flag1,flag2,flag3);
//都完成了 进件状态修改
if (flag1 && flag2 && flag3) {
shopAccountDAO.updateEntryStatusByShopIdAndSystemName(shopId, Arrays.asList(ShopAccountEnum.HuoMa.getSystemName()), OpenStatusEnum.OPENSTATUSENUM_2.getCode());
}
}
return Boolean.TRUE;
}
@Override
public Boolean selectSiteAndBuildStoreComplete(Long shopId) {
List<ShopStageInfoDO> shopStageInfo = shopStageInfoDAO.getShopStageInfo(shopId, null);
if (CollectionUtils.isNotEmpty(shopStageInfo)) {
Map<Integer, ShopStageInfoDO> shopStageInfoDOMap = shopStageInfo.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopSubStage, data -> data));
Boolean flag2 = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_12.getShopSubStageStatus().
equals(shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_1.getShopSubStage()).getShopSubStageStatus());
Boolean flag3 = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_153.getShopSubStageStatus().
equals(shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_15.getShopSubStage()).getShopSubStageStatus());
log.info("selectSiteAndBuildStoreComplete flag2->{} flag3->{}",flag2,flag3);
//都完成了 进件状态修改
if (flag2 && flag3) {
shopAccountDAO.updateStatusByShopIdAndSystemName(shopId, Arrays.asList(ShopAccountEnum.HuoMa.getSystemName()), OpenStatusEnum.OPENSTATUSENUM_2.getCode());
}
}
return Boolean.TRUE;
}
@Override
public Boolean buildStoreComplete(Long shopId) {
List<ShopStageInfoDO> shopStageInfo = shopStageInfoDAO.getShopStageInfo(shopId, null);
if (CollectionUtils.isNotEmpty(shopStageInfo)) {
Map<Integer, ShopStageInfoDO> shopStageInfoDOMap = shopStageInfo.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopSubStage, data -> data));
Boolean flag3 = ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_153.getShopSubStageStatus().
equals(shopStageInfoDOMap.get(ShopSubStageEnum.SHOP_STAGE_15.getShopSubStage()).getShopSubStageStatus());
log.info("selectSiteAndBuildStoreComplete flag3->{}",flag3);
//建店完成了 状态修改
if (flag3) {
shopAccountDAO.updateStatusByShopIdAndSystemName(shopId, Arrays.asList(ShopAccountEnum.YLS.getSystemName(),ShopAccountEnum.XZG.getSystemName()), OpenStatusEnum.OPENSTATUSENUM_2.getCode());
}
}
return Boolean.TRUE;
}
}

View File

@@ -0,0 +1,104 @@
package com.cool.store.service.impl;
import com.cool.store.dao.ShopAccountDAO;
import com.cool.store.dao.ShopInfoDAO;
import com.cool.store.dto.ModifyPasswordDTO;
import com.cool.store.dto.ShopAccount.ShopAccountDTO;
import com.cool.store.entity.ShopAccountDO;
import com.cool.store.entity.ShopInfoDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.ShopAccountEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.ShopAccountMapper;
import com.cool.store.response.MiniShopsResponse;
import com.cool.store.service.ShopAccountService;
import com.cool.store.service.ShopService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @Author suzhuhong
* @Date 2025/4/7 15:51
* @Version 1.0
*/
@Service
public class ShopAccountServiceImpl implements ShopAccountService {
@Resource
ShopAccountDAO shopAccountDAO;
@Resource
ShopInfoDAO shopInfoDAO;
@Resource
ShopService shopService;
@Override
public List<ShopAccountDTO> getShopAccountByShopId(Long shopId) {
if (Objects.isNull(shopId)){
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE);
}
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
if (Objects.isNull(shopInfo)){
throw new ServiceException(ErrorCodeEnum.SHOP_NOT_EXIST);
}
List<ShopAccountDO> shopAccountDOS = shopAccountDAO.selectByShopId(shopId);
List<ShopAccountDTO> result= new ArrayList<>();
if (CollectionUtils.isEmpty(shopAccountDOS)){
return result;
}
shopAccountDOS.forEach(x->{
ShopAccountDTO shopAccountDTO = new ShopAccountDTO();
shopAccountDTO.setShopId(x.getShopId());
shopAccountDTO.setSystemName(x.getSystemName());
shopAccountDTO.setAccount(x.getAccount());
if (ShopAccountEnum.getSpecialList().contains(x.getSystemName())){
shopAccountDTO.setAccount(shopInfo.getShopCode());
}
shopAccountDTO.setPassword(x.getPassword());
shopAccountDTO.setStatus(x.getStatus());
shopAccountDTO.setEntryStatus(x.getEntryStatus());
shopAccountDTO.setLastSyncTime(x.getLastSyncTime());
shopAccountDTO.setRemark(x.getRemark());
result.add(shopAccountDTO);
});
return result;
}
Boolean modifyPasswordDTO(ModifyPasswordDTO modifyPasswordDTO){
//查询
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(modifyPasswordDTO.getShopId());
if (Objects.isNull(shopInfo)){
throw new ServiceException(ErrorCodeEnum.SHOP_NOT_EXIST);
}
List<MiniShopsResponse> shopListSuccessOpen = shopService.getShopListSuccessOpen(shopInfo.getLineId());
//修改数据
List<Long> shopIdList = shopListSuccessOpen.stream().map(MiniShopsResponse::getShopId).collect(Collectors.toList());
shopAccountDAO.batchUpdatePasswordByShopIds(shopIdList,modifyPasswordDTO.getPassword(),modifyPasswordDTO.getPasswordSalt(),new Date());
//当前加盟商所有开店成功的CODE
List<String> shopCodeList = shopListSuccessOpen.stream().map(MiniShopsResponse::getShopCode).collect(Collectors.toList());
//推送下游系统
//火码实时该状态
return Boolean.TRUE;
}
}

View File

@@ -87,6 +87,10 @@ public class ShopServiceImpl implements ShopService {
private RegionService regionService;
@Resource
PreparationService preparationService;
@Resource
ShopAccountDAO shopAccountDAO;
@Resource
HyPartnerUserInfoDAO hyPartnerUserInfoDAO;
@Override
@@ -122,6 +126,9 @@ public class ShopServiceImpl implements ShopService {
shopInfoDAO.batchAddShop(addShopList);
List<Long> shopIds = addShopList.stream().map(ShopInfoDO::getId).collect(Collectors.toList());
Integer result = shopStageInfoDAO.initShopStageInfo(lineInfo.getId(), shopIds, true);
//初始化平台账号
HyPartnerUserInfoDO hyPartnerUserInfoDO = hyPartnerUserInfoDAO.selectByPartnerId(lineInfo.getPartnerId());
shopAccountDAO.initShopAccount(hyPartnerUserInfoDO,shopIds);
Set<String> publishFranchiseFeeUsers = new HashSet<>();
List<EnterpriseUserDO> joinUser = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.JOIN_OFFICE, lineInfo.getRegionId());
if (Objects.nonNull(joinUser)) {
@@ -343,7 +350,9 @@ public class ShopServiceImpl implements ShopService {
} else {
shopStageInfoDAO.initShopStageInfo(request.getLineId(), Collections.singletonList(shopId), false);
}
//初始化平台账号
HyPartnerUserInfoDO hyPartnerUserInfoDO = hyPartnerUserInfoDAO.selectByPartnerId(lineInfo.getPartnerId());
shopAccountDAO.initShopAccount(hyPartnerUserInfoDO,Collections.singletonList(shopId));
return shopId;
}

View File

@@ -1,11 +1,15 @@
package com.cool.store.controller.webb;
import com.cool.store.dto.StatusRefreshDTO;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.OpenApiService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @Author suzhuhong
* @Date 2025/4/5 18:19
@@ -16,9 +20,12 @@ import org.springframework.web.bind.annotation.RestController;
@Api(tags = "对外接口")
public class OpenApiController {
@Resource
OpenApiService openApiService;
@GetMapping("/statusRefresh")
public ResponseResult<Boolean> statusRefresh(){
return ResponseResult.success(Boolean.TRUE);
public ResponseResult<Boolean> statusRefresh(StatusRefreshDTO statusRefreshDTO){
return ResponseResult.success(openApiService.statusRefresh(statusRefreshDTO));
}
}

View File

@@ -0,0 +1,39 @@
package com.cool.store.controller.webb;
import com.cool.store.dto.ShopAccount.ShopAccountDTO;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.ShopAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author suzhuhong
* @Date 2025/4/8 14:52
* @Version 1.0
*/
@RestController
@RequestMapping("/pc/account")
@Api(tags = "平台账号")
@Slf4j
public class ShopAccountController {
@Resource
ShopAccountService accountService;
@ApiOperation("根据门店shopId查询平台账号")
@GetMapping("/getShopAccountByShopId")
public ResponseResult<List<ShopAccountDTO>> getShopAccountByShopId(@RequestParam(value = "shopId", required = true) Long shopId) {
return ResponseResult.success(accountService.getShopAccountByShopId(shopId));
}
}