feat:平台账号

This commit is contained in:
苏竹红
2025-04-09 10:04:35 +08:00
parent f42f751cce
commit abc7c206c4
19 changed files with 425 additions and 25 deletions

View File

@@ -1,6 +1,12 @@
package com.cool.store.service;
import com.cool.store.dto.AccountAuditDTO;
import com.cool.store.dto.AccountEntryStatusAuditDTO;
import com.cool.store.dto.ModifyPasswordDTO;
import com.cool.store.dto.ShopAccount.ShopAccountDTO;
import com.cool.store.dto.yun.AccountEntryStatusChangeDTO;
import com.cool.store.enums.DownSystemTypeEnum;
import com.cool.store.request.ZxjpApiRequest;
import java.util.List;
@@ -19,6 +25,52 @@ public interface ShopAccountService {
*/
List<ShopAccountDTO> getShopAccountByShopId(Long shopId);
/**
* modifyPassword
* @param modifyPasswordDTO
* @return
*/
Boolean modifyPassword(ModifyPasswordDTO modifyPasswordDTO);
/**
* getData
* @param shopId
* @param systemType
* @return
*/
ZxjpApiRequest getData(Long shopId, DownSystemTypeEnum systemType);
/**
* 审核平台账号
* @param accountAuditDTO
* @return
*/
Boolean auditAccount(AccountAuditDTO accountAuditDTO);
/**
* 进件审核
* @param accountEntryStatusAuditDTO
* @return
*/
Boolean accountEntryStatusAudit(AccountEntryStatusAuditDTO accountEntryStatusAuditDTO);
/**
* 进件状态修改
* @param accountEntryStatusChangeDTO
* @return
*/
Boolean accountEntryStatusChange(AccountEntryStatusChangeDTO accountEntryStatusChangeDTO);
/**
* 推送数据
* @param accountAuditDTO
* @return
*/
Boolean pushData(AccountAuditDTO accountAuditDTO);

View File

@@ -8,7 +8,6 @@ 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;
@@ -40,7 +39,7 @@ public class OpenApiServiceImpl implements OpenApiService {
Integer openStatus = statusRefreshDTO.getOpenStatus()?OpenStatusEnum.OPENSTATUSENUM_5.getCode():OpenStatusEnum.OPENSTATUSENUM_6.getCode();
accountDAO.updateStatusByShopIdAndSystemName(shopInfoDO.getId(), Arrays.asList(statusRefreshDTO.getSystemSource()), openStatus);
//订货系统开通完成
//订货系统开通完成 todo suzhuhong_
return Boolean.TRUE;
}

View File

@@ -318,7 +318,7 @@ public class PreparationServiceImpl implements PreparationService {
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());
shopAccountDAO.updateEntryStatusByShopIdAndSystemName(shopId, Arrays.asList(ShopAccountEnum.HUOMA.getSystemName()), OpenStatusEnum.OPENSTATUSENUM_2.getCode());
}
}
return Boolean.TRUE;
@@ -337,7 +337,7 @@ public class PreparationServiceImpl implements PreparationService {
log.info("selectSiteAndBuildStoreComplete flag2->{} flag3->{}",flag2,flag3);
//都完成了 进件状态修改
if (flag2 && flag3) {
shopAccountDAO.updateStatusByShopIdAndSystemName(shopId, Arrays.asList(ShopAccountEnum.HuoMa.getSystemName()), OpenStatusEnum.OPENSTATUSENUM_2.getCode());
shopAccountDAO.updateStatusByShopIdAndSystemName(shopId, Arrays.asList(ShopAccountEnum.HUOMA.getSystemName()), OpenStatusEnum.OPENSTATUSENUM_2.getCode());
}
}
return Boolean.TRUE;

View File

@@ -1,26 +1,32 @@
package com.cool.store.service.impl;
import com.cool.store.dao.HyPartnerUserInfoDAO;
import com.cool.store.dao.ShopAccountDAO;
import com.cool.store.dao.ShopInfoDAO;
import com.cool.store.dto.AccountAuditDTO;
import com.cool.store.dto.AccountEntryStatusAuditDTO;
import com.cool.store.dto.ModifyPasswordDTO;
import com.cool.store.dto.ShopAccount.ShopAccountDTO;
import com.cool.store.dto.yun.AccountEntryStatusChangeDTO;
import com.cool.store.entity.HyPartnerUserInfoDO;
import com.cool.store.entity.ShopAccountDO;
import com.cool.store.entity.ShopInfoDO;
import com.cool.store.enums.DownSystemTypeEnum;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.OpenStatusEnum;
import com.cool.store.enums.ShopAccountEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.ShopAccountMapper;
import com.cool.store.request.ZxjpApiRequest;
import com.cool.store.response.MiniShopsResponse;
import com.cool.store.service.ShopAccountService;
import com.cool.store.service.ShopService;
import com.cool.store.service.SyncDataService;
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.*;
import java.util.stream.Collectors;
/**
@@ -37,6 +43,10 @@ public class ShopAccountServiceImpl implements ShopAccountService {
ShopInfoDAO shopInfoDAO;
@Resource
ShopService shopService;
@Resource
HyPartnerUserInfoDAO hyPartnerUserInfoDAO;
@Resource
SyncDataService syncDataService;
@Override
public List<ShopAccountDTO> getShopAccountByShopId(Long shopId) {
@@ -73,32 +83,121 @@ public class ShopAccountServiceImpl implements ShopAccountService {
}
Boolean modifyPasswordDTO(ModifyPasswordDTO modifyPasswordDTO){
@Override
public Boolean modifyPassword(ModifyPasswordDTO modifyPasswordDTO){
//查询
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(modifyPasswordDTO.getShopId());
if (Objects.isNull(shopInfo)){
throw new ServiceException(ErrorCodeEnum.SHOP_NOT_EXIST);
}
HyPartnerUserInfoDO hyPartnerUserInfoDO = hyPartnerUserInfoDAO.selectByPartnerId(shopInfo.getPartnerId());
hyPartnerUserInfoDO.setDownstreamSystemPassword(modifyPasswordDTO.getPassword());
hyPartnerUserInfoDO.setDownstreamSystemSalting(modifyPasswordDTO.getPasswordSalt());
hyPartnerUserInfoDO.setUpdateTime(new Date());
hyPartnerUserInfoDAO.updatePasswordByPartnerId(hyPartnerUserInfoDO);
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());
//批量修改密码 密码盐
shopAccountDAO.batchUpdatePasswordByShopIds(shopIdList,modifyPasswordDTO.getPassword(),modifyPasswordDTO.getPasswordSalt(),new Date());
//当前加盟商所有开店成功的CODE
List<String> shopCodeList = shopListSuccessOpen.stream().map(MiniShopsResponse::getShopCode).collect(Collectors.toList());
//推送下游系统
//火码实时该状态
// TODO: 2025/4/8 suzhuhong_
return Boolean.TRUE;
}
@Override
public ZxjpApiRequest getData(Long shopId, DownSystemTypeEnum systemType){
return syncDataService.getData(shopId,systemType);
}
@Override
public Boolean auditAccount(AccountAuditDTO accountAuditDTO) {
if (accountAuditDTO.getShopId()==null||accountAuditDTO.getAuditFlag()==null||accountAuditDTO.getShopAccountEnum()==null){
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
List<ShopAccountDO> accountDOS = shopAccountDAO.selectByShopId(accountAuditDTO.getShopId());
if (CollectionUtils.isEmpty(accountDOS)){
throw new ServiceException(ErrorCodeEnum.SYSTEM_DATA_ERROR);
}
Map<String, ShopAccountDO> map = accountDOS.stream().collect(Collectors.toMap(ShopAccountDO::getSystemName, data -> data));
ShopAccountDO shopAccountDO = map.get(accountAuditDTO.getShopAccountEnum().getSystemName());
if (Objects.isNull(shopAccountDO)){
throw new ServiceException(ErrorCodeEnum.SYSTEM_DATA_ERROR);
}
if (!OpenStatusEnum.OPENSTATUSENUM_2.getCode().equals(shopAccountDO.getStatus())){
throw new ServiceException(ErrorCodeEnum.CURRENT_STATUS_NOT_OPERATION);
}
OpenStatusEnum openStatusEnum = accountAuditDTO.getAuditFlag() == 1 ? OpenStatusEnum.OPENSTATUSENUM_4 : OpenStatusEnum.OPENSTATUSENUM_3;
shopAccountDAO.updateStatusByShopIdAndSystemName(accountAuditDTO.getShopId(),Arrays.asList(shopAccountDO.getSystemName()),openStatusEnum.getCode());
return Boolean.TRUE;
}
@Override
public Boolean accountEntryStatusAudit(AccountEntryStatusAuditDTO dto) {
if (dto.getShopId()==null||dto.getAuditFlag()==null){
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
List<ShopAccountDO> accountDOS = shopAccountDAO.selectByShopId(dto.getShopId());
if (CollectionUtils.isEmpty(accountDOS)){
return Boolean.FALSE;
}
Map<String, ShopAccountDO> map = accountDOS.stream().collect(Collectors.toMap(ShopAccountDO::getSystemName, data -> data));
ShopAccountDO shopAccountDO = map.get(ShopAccountEnum.HUOMA.getSystemName());
if (Objects.isNull(shopAccountDO)){
throw new ServiceException(ErrorCodeEnum.SYSTEM_DATA_ERROR);
}
if (!OpenStatusEnum.OPENSTATUSENUM_2.getCode().equals(shopAccountDO.getEntryStatus())){
throw new ServiceException(ErrorCodeEnum.CURRENT_STATUS_NOT_OPERATION);
}
OpenStatusEnum openStatusEnum = dto.getAuditFlag() == 1 ? OpenStatusEnum.OPENSTATUSENUM_4 : OpenStatusEnum.OPENSTATUSENUM_3;
//修改进件状态
shopAccountDAO.updateEntryStatusByShopIdAndSystemName(dto.getShopId(),Arrays.asList(shopAccountDO.getSystemName()),openStatusEnum.getCode());
return Boolean.TRUE;
}
@Override
public Boolean accountEntryStatusChange(AccountEntryStatusChangeDTO dto) {
if (dto.getShopId()==null||dto.getEntryStatus()==null){
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
List<ShopAccountDO> accountDOS = shopAccountDAO.selectByShopId(dto.getShopId());
if (CollectionUtils.isEmpty(accountDOS)){
return Boolean.FALSE;
}
Map<String, ShopAccountDO> map = accountDOS.stream().collect(Collectors.toMap(ShopAccountDO::getSystemName, data -> data));
ShopAccountDO shopAccountDO = map.get(ShopAccountEnum.HUOMA.getSystemName());
if (Objects.isNull(shopAccountDO)){
throw new ServiceException(ErrorCodeEnum.SYSTEM_DATA_ERROR);
}
//不是审核中 已进件 进件失败状态不支持修改
if (!OpenStatusEnum.getSpecialList().contains(shopAccountDO.getEntryStatus())){
throw new ServiceException(ErrorCodeEnum.CURRENT_ENTRY_STATUS_NOT_OPERATION);
}
//修改进件状态
shopAccountDAO.updateEntryStatusByShopIdAndSystemName(dto.getShopId(),Arrays.asList(shopAccountDO.getSystemName()),dto.getEntryStatus());
return Boolean.TRUE;
}
@Override
public Boolean pushData(AccountAuditDTO accountAuditDTO) {
if (accountAuditDTO.getShopId()==null||accountAuditDTO.getShopAccountEnum()==null){
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
// TODO: 2025/4/8 suzhuhong_
return null;
}
}