Merge remote-tracking branch 'origin/cc_20250325_select' into cc_20250325_select
This commit is contained in:
@@ -243,6 +243,10 @@ public enum ErrorCodeEnum {
|
||||
THIRD_API_ERROR(151001,"第三方服务异常->{0}",null),
|
||||
THIRD_API_SIGN_ERROR(151002,"签名失败->{0}",null),
|
||||
THIRD_API_TIME_IS_NULL(151003,"单据⽇期不能为空",null),
|
||||
|
||||
SYSTEM_DATA_ERROR(151004,"平台账号不能为空",null),
|
||||
CURRENT_STATUS_NOT_OPERATION(151005,"平台账号当前非审核状态!不能提交审核",null),
|
||||
CURRENT_ENTRY_STATUS_NOT_OPERATION(151006,"进件状态未审核!不能执行该操作",null),
|
||||
;
|
||||
|
||||
|
||||
|
||||
@@ -27,6 +27,9 @@ public enum OpenStatusEnum {
|
||||
private String name;
|
||||
|
||||
|
||||
public static List<Integer> getSpecialList(){
|
||||
return Arrays.asList(OPENSTATUSENUM_4.getCode(),OPENSTATUSENUM_5.getCode(),OPENSTATUSENUM_6.getCode());
|
||||
}
|
||||
|
||||
OpenStatusEnum(Integer code,String name){
|
||||
this.code = code;
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.List;
|
||||
*/
|
||||
public enum ShopAccountEnum {
|
||||
|
||||
HuoMa("火码POS",OpenStatusEnum.OPENSTATUSENUM_1),
|
||||
HUOMA("火码POS",OpenStatusEnum.OPENSTATUSENUM_1),
|
||||
YLS("云流水",OpenStatusEnum.OPENSTATUSENUM_1),
|
||||
XZG("新掌柜",OpenStatusEnum.OPENSTATUSENUM_1),
|
||||
MTTG("美团团购",OpenStatusEnum.OPENSTATUSENUM_1),
|
||||
@@ -23,7 +23,11 @@ public enum ShopAccountEnum {
|
||||
|
||||
|
||||
public static List<String> getSpecialList(){
|
||||
return Arrays.asList(HuoMa.getSystemName(),YLS.getSystemName(),XZG.getSystemName());
|
||||
return Arrays.asList(HUOMA.getSystemName(),YLS.getSystemName(),XZG.getSystemName());
|
||||
}
|
||||
|
||||
public static List<ShopAccountEnum> getSpecialEnumList(){
|
||||
return Arrays.asList(HUOMA,YLS,XZG);
|
||||
}
|
||||
|
||||
private String systemName;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class PasswordUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用 SHA-256 加密密码
|
||||
* 使用 MD5 加密密码
|
||||
*
|
||||
* @param plainPassword 明文密码
|
||||
* @param salt 盐值
|
||||
@@ -52,7 +52,7 @@ public class PasswordUtil {
|
||||
*/
|
||||
public static String encryptPassword(String plainPassword, byte[] salt) {
|
||||
try {
|
||||
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
|
||||
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
|
||||
// 将盐值和明文密码拼接后进行哈希计算
|
||||
messageDigest.update(salt);
|
||||
byte[] hashedBytes = messageDigest.digest(plainPassword.getBytes());
|
||||
|
||||
@@ -36,10 +36,13 @@ public class ShopAccountDAO {
|
||||
shopAccountDO.setShopId(shopId);
|
||||
shopAccountDO.setSystemName(shopAccountEnum.getSystemName());
|
||||
shopAccountDO.setBoundPhone(partnerUserInfoDO.getMobile());
|
||||
shopAccountDO.setPasswordSalt(partnerUserInfoDO.getDownstreamSystemSalting());
|
||||
shopAccountDO.setPassword(partnerUserInfoDO.getDownstreamSystemPassword());
|
||||
//其他账户不使用统一密码
|
||||
if (ShopAccountEnum.getSpecialEnumList().contains(shopAccountEnum)){
|
||||
shopAccountDO.setPasswordSalt(partnerUserInfoDO.getDownstreamSystemSalting());
|
||||
shopAccountDO.setPassword(partnerUserInfoDO.getDownstreamSystemPassword());
|
||||
}
|
||||
shopAccountDO.setStatus(shopAccountEnum.getInitStatus().getCode());
|
||||
if (ShopAccountEnum.HuoMa.equals(shopAccountEnum)){
|
||||
if (ShopAccountEnum.HUOMA.equals(shopAccountEnum)){
|
||||
shopAccountDO.setEntryStatus(CommonConstants.ONE);
|
||||
}
|
||||
shopAccountDOS.add(shopAccountDO);
|
||||
@@ -116,5 +119,10 @@ public class ShopAccountDAO {
|
||||
}
|
||||
|
||||
|
||||
public List<ShopAccountDO> getALlFail(){
|
||||
return shopAccountMapper.getALlFail();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -69,6 +69,12 @@ public interface ShopAccountMapper extends Mapper<ShopAccountDO> {
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* 查询云流水、新掌柜 POS失败的数据 重新推数据
|
||||
* @return
|
||||
*/
|
||||
List<ShopAccountDO> getALlFail();
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -126,4 +126,11 @@
|
||||
#{shopId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
<select id="getALlFail">
|
||||
select * from xfsg_shop_account WHERE
|
||||
system_name in ('火码POS','云流水','新掌柜')
|
||||
and status = 6
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.cool.store.dto;
|
||||
|
||||
import com.cool.store.enums.ShopAccountEnum;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2025/4/8 20:32
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class AccountAuditDTO {
|
||||
|
||||
@ApiModelProperty(value = "门店ID",required = true)
|
||||
@NotNull(message = "门店ID不能为空")
|
||||
private Long shopId;
|
||||
|
||||
@ApiModelProperty("审核标识 1-通过 2-拒绝 推送数据时不需要传 审核开通数据时必传")
|
||||
private Integer auditFlag;
|
||||
|
||||
@ApiModelProperty(value = "HUOMA-火码 YLS-云流水 XZG-新掌柜" ,required = true)
|
||||
private ShopAccountEnum shopAccountEnum;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.cool.store.dto;
|
||||
|
||||
import com.cool.store.enums.ShopAccountEnum;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2025/4/8 21:13
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class AccountEntryStatusAuditDTO {
|
||||
|
||||
@ApiModelProperty(value = "门店ID",required = true)
|
||||
@NotNull(message = "门店ID不能为空")
|
||||
private Long shopId;
|
||||
|
||||
@ApiModelProperty(value = "审核标识 1-通过 2-拒绝",required = true)
|
||||
private Integer auditFlag;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.cool.store.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2025/4/8 21:15
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class AccountEntryStatusChangeDTO {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "门店ID" ,required = true)
|
||||
@NotNull(message = "门店ID不能为空")
|
||||
private Long shopId;
|
||||
|
||||
@ApiModelProperty(value = "进件状态 5-进件成功 6-进件失败",required = true)
|
||||
@Max(6)
|
||||
@Min(5)
|
||||
private Integer entryStatus;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.cool.store.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2025/4/9 15:08
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class GetAccessTokenDTO {
|
||||
|
||||
private String mobile;
|
||||
|
||||
private String shopCode;
|
||||
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package com.cool.store.dto;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2025/4/7 16:31
|
||||
@@ -11,12 +13,14 @@ import lombok.Data;
|
||||
@Data
|
||||
public class ModifyPasswordDTO {
|
||||
|
||||
@ApiModelProperty("盐值")
|
||||
@ApiModelProperty(value = "盐值",required = true)
|
||||
String passwordSalt;
|
||||
@ApiModelProperty("密码")
|
||||
@ApiModelProperty(value = "密码",required = true)
|
||||
String password;
|
||||
@ApiModelProperty("门店ID")
|
||||
@ApiModelProperty(value = "门店ID",required = true)
|
||||
Long shopId;
|
||||
@ApiModelProperty(value = "门店ID",hidden = true)
|
||||
List<String> shopCode;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.cool.store.dto;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.cool.store.response.bigdata;
|
||||
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.enums.ResponseCodeEnum;
|
||||
import lombok.Data;
|
||||
import org.slf4j.MDC;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
@@ -12,4 +15,18 @@ public class ApiResponse<T> {
|
||||
private String msg;
|
||||
private int code;
|
||||
private T data;
|
||||
private String stackTrace;
|
||||
private String requestId;
|
||||
|
||||
|
||||
public ApiResponse(int code, String msg, T data) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
this.data = data;
|
||||
this.requestId = MDC.get(CommonConstants.REQUEST_ID);
|
||||
}
|
||||
|
||||
public static<T> ApiResponse<T> success(T data) {
|
||||
return new ApiResponse(ResponseCodeEnum.SUCCESS.getCode(), "ok", data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.cool.store.dto.GetAccessTokenDTO;
|
||||
import com.cool.store.dto.ModifyPasswordDTO;
|
||||
import com.cool.store.request.ZxjpApiRequest;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2025/4/9 14:23
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface PushService {
|
||||
|
||||
|
||||
/**
|
||||
* 推送数据到下游系统 新管家
|
||||
* @param zxjpApiRequest
|
||||
* @return
|
||||
*/
|
||||
Boolean pushDataToXGJ(ZxjpApiRequest zxjpApiRequest);
|
||||
|
||||
/**
|
||||
* 推送数据到下游系统 POS
|
||||
* @param zxjpApiRequest
|
||||
* @return
|
||||
*/
|
||||
Boolean pushDataToPOS(ZxjpApiRequest zxjpApiRequest);
|
||||
|
||||
/**
|
||||
* 修改密码推送到下游系统
|
||||
* @param modifyPasswordDTO
|
||||
* @return
|
||||
*/
|
||||
Boolean modifyDownstreamSystem(ModifyPasswordDTO modifyPasswordDTO);
|
||||
|
||||
|
||||
/**
|
||||
* 获取云流水token
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
String getYlsToken(GetAccessTokenDTO dto);
|
||||
|
||||
/**
|
||||
* 获取新管家token
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
String getXzgToken(GetAccessTokenDTO dto);
|
||||
|
||||
/**
|
||||
* 获取Pos token
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
String getPosToken(GetAccessTokenDTO dto);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -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.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);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,13 +2,15 @@ package com.cool.store.service.impl;
|
||||
|
||||
import com.cool.store.dao.ShopAccountDAO;
|
||||
import com.cool.store.dao.ShopInfoDAO;
|
||||
import com.cool.store.dao.ShopStageInfoDAO;
|
||||
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.enums.ShopAccountEnum;
|
||||
import com.cool.store.enums.point.ShopSubStageStatusEnum;
|
||||
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;
|
||||
@@ -28,6 +30,8 @@ public class OpenApiServiceImpl implements OpenApiService {
|
||||
ShopAccountDAO accountDAO;
|
||||
@Resource
|
||||
ShopInfoDAO shopInfoDAO;
|
||||
@Resource
|
||||
ShopStageInfoDAO shopStageInfoDAO;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -41,6 +45,9 @@ public class OpenApiServiceImpl implements OpenApiService {
|
||||
accountDAO.updateStatusByShopIdAndSystemName(shopInfoDO.getId(), Arrays.asList(statusRefreshDTO.getSystemSource()), openStatus);
|
||||
|
||||
//订货系统开通完成
|
||||
if (ShopAccountEnum.YLS.getSystemName().equals(statusRefreshDTO.getSystemSource())){
|
||||
shopStageInfoDAO.updateShopStageInfo(shopInfoDO.getId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_173);
|
||||
}
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -0,0 +1,251 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.dto.GetAccessTokenDTO;
|
||||
import com.cool.store.dto.ModifyPasswordDTO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.request.ZxjpApiRequest;
|
||||
import com.cool.store.response.huoma.ShopBaseInfoResponse;
|
||||
import com.cool.store.response.oppty.OpportunityApiResponse;
|
||||
import com.cool.store.service.PushService;
|
||||
import com.cool.store.utils.HmacSigner;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JavaType;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.*;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2025/4/9 14:24
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PushServiceImpl implements PushService {
|
||||
|
||||
// TODO: 2025/4/9 suzhuhong_
|
||||
|
||||
@Value("${api.auth.url}")
|
||||
private String url;
|
||||
|
||||
@Value("${api.auth.username}")
|
||||
private String username;
|
||||
|
||||
@Value("${api.auth.secret}")
|
||||
private String secret;
|
||||
|
||||
@Value("${xgj.api.auth.url}")
|
||||
private String xgjUrl;
|
||||
|
||||
@Value("${xgj.api.auth.username}")
|
||||
private String xgjUsername;
|
||||
|
||||
@Value("${xgj.api.auth.secret}")
|
||||
private String xgjSecret;
|
||||
|
||||
@Value("${yls.api.auth.url}")
|
||||
private String ylsUrl;
|
||||
|
||||
@Value("${yls.api.auth.username}")
|
||||
private String ylsUsername;
|
||||
|
||||
@Value("${yls.api.auth.secret}")
|
||||
private String ylsSecret;
|
||||
|
||||
@Value("${xzg.api.auth.url}")
|
||||
private String xzgUrl;
|
||||
|
||||
@Value("${xzg.api.auth.username}")
|
||||
private String xzgUsername;
|
||||
|
||||
@Value("${xzg.api.auth.secret}")
|
||||
private String xzgSecret;
|
||||
|
||||
@Resource
|
||||
OkHttpClient okHttpClient;
|
||||
@Resource
|
||||
ObjectMapper objectMapper;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean pushDataToXGJ(ZxjpApiRequest zxjpApiRequest) {
|
||||
String apiUrl = xgjUrl + "XXX";
|
||||
return executeApiCall(apiUrl,zxjpApiRequest, Boolean.class,xgjUsername,xgjSecret);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean pushDataToPOS(ZxjpApiRequest zxjpApiRequest) {
|
||||
String apiUrl = url + "XXX";
|
||||
return executeApiCall(apiUrl,zxjpApiRequest, Boolean.class,username,secret);
|
||||
}
|
||||
|
||||
private Boolean modifyXGJPassword(ModifyPasswordDTO dto) {
|
||||
String apiUrl = xgjUrl + "XXX";
|
||||
return executeApiCall(apiUrl,dto, Boolean.class,xgjUsername,xgjSecret);
|
||||
}
|
||||
|
||||
private Boolean modifyPosPassword(ModifyPasswordDTO dto) {
|
||||
String apiUrl = url + "XXX";
|
||||
return executeApiCall(apiUrl,dto, Boolean.class,username,secret);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean modifyDownstreamSystem(ModifyPasswordDTO modifyPasswordDTO) {
|
||||
try {
|
||||
this.modifyPosPassword(modifyPasswordDTO);
|
||||
this.modifyXGJPassword(modifyPasswordDTO);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(ErrorCodeEnum.THIRD_API_ERROR);
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getYlsToken(GetAccessTokenDTO dto) {
|
||||
String apiUrl = url + "XXX";
|
||||
return executeApiCall(apiUrl,dto, String.class,ylsUsername,ylsSecret);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getXzgToken(GetAccessTokenDTO dto) {
|
||||
String apiUrl = url + "XXX";
|
||||
return executeApiCall(apiUrl,dto, String.class,xzgUsername,xzgSecret);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPosToken(GetAccessTokenDTO dto) {
|
||||
String apiUrl = url + "XXX";
|
||||
return executeApiCall(apiUrl,dto, String.class,username,secret);
|
||||
}
|
||||
|
||||
|
||||
private <T> T executeApiCall(String url, Object requestBody, Class<T> responseType,String username,String secret) {
|
||||
// 1. 打印请求前日志
|
||||
logRequest(url, requestBody);
|
||||
|
||||
try {
|
||||
Request request = buildRequest(requestBody, url,username,secret);
|
||||
|
||||
try (Response response = okHttpClient.newCall(request).execute()) {
|
||||
// 2. 获取原始响应内容
|
||||
String responseBody = response.body().string();
|
||||
|
||||
// 3. 打印响应日志
|
||||
logResponse(url, response.code(), responseBody);
|
||||
|
||||
if (!response.isSuccessful()) {
|
||||
throw new ServiceException(ErrorCodeEnum.THIRD_API_ERROR,
|
||||
"HTTP请求失败,状态码: " + response.code());
|
||||
}
|
||||
|
||||
// 4. 解析响应
|
||||
JavaType javaType = objectMapper.getTypeFactory()
|
||||
.constructParametricType(OpportunityApiResponse.class, responseType);
|
||||
|
||||
OpportunityApiResponse<T> apiResponse = objectMapper.readValue(responseBody, javaType);
|
||||
|
||||
if (apiResponse.getCode() != 200) {
|
||||
throw new ServiceException(ErrorCodeEnum.THIRD_API_ERROR,
|
||||
"业务逻辑错误: " + apiResponse.getMsg());
|
||||
}
|
||||
|
||||
return apiResponse.getData();
|
||||
}
|
||||
} catch (ServiceException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("API调用异常 - URL: {}, 错误: {}", url, e.getMessage(), e);
|
||||
throw new ServiceException(ErrorCodeEnum.THIRD_API_ERROR, "接口调用异常: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void logRequest(String url, Object requestBody) {
|
||||
if (log.isInfoEnabled()) {
|
||||
try {
|
||||
log.info("\n======= 请求开始 =======\n" +
|
||||
"API地址: {}\n" +
|
||||
"请求参数: {}\n" +
|
||||
"======= 请求结束 =======",
|
||||
url,
|
||||
objectMapper.writerWithDefaultPrettyPrinter()
|
||||
.writeValueAsString(requestBody));
|
||||
} catch (JsonProcessingException e) {
|
||||
log.warn("日志JSON序列化失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录响应日志
|
||||
*/
|
||||
private void logResponse(String url, int statusCode, String responseBody) {
|
||||
if (log.isInfoEnabled()) {
|
||||
try {
|
||||
// 尝试美化JSON输出
|
||||
Object json = objectMapper.readValue(responseBody, Object.class);
|
||||
String prettyResponse = objectMapper.writerWithDefaultPrettyPrinter()
|
||||
.writeValueAsString(json);
|
||||
|
||||
log.info("\n======= 响应开始 =======\n" +
|
||||
"API地址: {}\n" +
|
||||
"HTTP状态码: {}\n" +
|
||||
"响应内容: {}\n" +
|
||||
"======= 响应结束 =======",
|
||||
url,
|
||||
statusCode,
|
||||
prettyResponse);
|
||||
} catch (Exception e) {
|
||||
// 非JSON响应或解析失败时直接输出原始内容
|
||||
log.info("\n======= 响应开始 =======\n" +
|
||||
"API地址: {}\n" +
|
||||
"HTTP状态码: {}\n" +
|
||||
"原始响应: {}\n" +
|
||||
"======= 响应结束 =======",
|
||||
url,
|
||||
statusCode,
|
||||
responseBody);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Request buildRequest(Object requestBody, String url,String username,String secret) {
|
||||
|
||||
try {
|
||||
Map<String, String> authHeaders = HmacSigner.generateHeaders(
|
||||
username, secret, JSONObject.toJSONString(requestBody));
|
||||
|
||||
log.debug("签名生成 - 签名结果: {}", JSONObject.toJSONString(authHeaders));
|
||||
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json"),
|
||||
JSONObject.toJSONString(requestBody)
|
||||
);
|
||||
|
||||
return new Request.Builder()
|
||||
.url(url)
|
||||
.post(body)
|
||||
.addHeader("Content-Type", "application/json")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("x-Date", authHeaders.get("x-Date"))
|
||||
.addHeader("Digest", authHeaders.get("Digest"))
|
||||
.addHeader("Authorization", authHeaders.get("Authorization"))
|
||||
.build();
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(ErrorCodeEnum.THIRD_API_SIGN_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -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.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.PushService;
|
||||
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,12 @@ public class ShopAccountServiceImpl implements ShopAccountService {
|
||||
ShopInfoDAO shopInfoDAO;
|
||||
@Resource
|
||||
ShopService shopService;
|
||||
@Resource
|
||||
HyPartnerUserInfoDAO hyPartnerUserInfoDAO;
|
||||
@Resource
|
||||
SyncDataService syncDataService;
|
||||
@Resource
|
||||
PushService pushService;
|
||||
|
||||
@Override
|
||||
public List<ShopAccountDTO> getShopAccountByShopId(Long shopId) {
|
||||
@@ -73,32 +85,132 @@ 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());
|
||||
|
||||
modifyPasswordDTO.setShopCode(shopCodeList);
|
||||
|
||||
//推送下游系统
|
||||
|
||||
|
||||
//火码实时该状态
|
||||
pushService.modifyDownstreamSystem(modifyPasswordDTO);
|
||||
|
||||
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);
|
||||
}
|
||||
DownSystemTypeEnum downSystemTypeEnum = DownSystemTypeEnum.XGJ;
|
||||
if ( ShopAccountEnum.HUOMA.equals(accountAuditDTO.getShopAccountEnum())){
|
||||
downSystemTypeEnum = DownSystemTypeEnum.POS;
|
||||
}
|
||||
ZxjpApiRequest data = this.getData(accountAuditDTO.getShopId(), downSystemTypeEnum);
|
||||
// TODO: 2025/4/8 suzhuhong_
|
||||
try {
|
||||
if (DownSystemTypeEnum.POS.equals(downSystemTypeEnum)){
|
||||
pushService.pushDataToPOS(data);
|
||||
}else {
|
||||
pushService.pushDataToXGJ(data);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(ErrorCodeEnum.THIRD_API_ERROR, "接口调用异常: " + e.getMessage());
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
@@ -8,24 +9,19 @@ import com.cool.store.request.huoma.ShopBasicInfoRequest;
|
||||
import com.cool.store.response.IncomeBaseResponse;
|
||||
import com.cool.store.response.IncomeSummaryResponse;
|
||||
import com.cool.store.response.OrderSummaryResponse;
|
||||
import com.cool.store.response.bigdata.ApiResponse;
|
||||
import com.cool.store.response.huoma.ShopBaseInfoResponse;
|
||||
import com.cool.store.response.oppty.OpportunityApiResponse;
|
||||
import com.cool.store.service.HuoMaService;
|
||||
import com.cool.store.utils.HmacSigner;
|
||||
import com.cool.store.utils.JsonUtils;
|
||||
import com.cool.store.utils.SignatureUtils;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JavaType;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.*;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -35,7 +31,7 @@ import java.util.Map;
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class HuoMaServiceImpl implements HuoMaService {
|
||||
public class ThirdHuoMaServiceImpl implements HuoMaService {
|
||||
|
||||
@Value("${api.auth.url}")
|
||||
private String url;
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.cool.store.controller.webb;
|
||||
|
||||
import com.cool.store.dto.StatusRefreshDTO;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.response.bigdata.ApiResponse;
|
||||
import com.cool.store.service.OpenApiService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -24,8 +24,8 @@ public class OpenApiController {
|
||||
OpenApiService openApiService;
|
||||
|
||||
@GetMapping("/statusRefresh")
|
||||
public ResponseResult<Boolean> statusRefresh(StatusRefreshDTO statusRefreshDTO){
|
||||
return ResponseResult.success(openApiService.statusRefresh(statusRefreshDTO));
|
||||
public ApiResponse<Boolean> statusRefresh(StatusRefreshDTO statusRefreshDTO){
|
||||
return ApiResponse.success(openApiService.statusRefresh(statusRefreshDTO));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -243,4 +243,19 @@ public class PCTestController {
|
||||
return ResponseResult.success(syncDataService.getData(shopId, DownSystemTypeEnum.getByCode(type)));
|
||||
}
|
||||
|
||||
|
||||
@Resource
|
||||
ShopAccountDAO shopAccountDAO;
|
||||
@Resource
|
||||
HyPartnerUserInfoDAO hyPartnerUserInfoDAO;
|
||||
@GetMapping("/initShopAccount")
|
||||
@ApiOperation("初始化门店账号")
|
||||
public ResponseResult<Integer> initShopAccount(@RequestParam(value = "partnerId", required = true) String partnerId,
|
||||
@RequestParam(value = "shopId", required = true) Long shopId) {
|
||||
// 调用第三方接口
|
||||
HyPartnerUserInfoDO hyPartnerUserInfoDO = hyPartnerUserInfoDAO.selectByPartnerId(partnerId);
|
||||
return ResponseResult.success(shopAccountDAO.initShopAccount(hyPartnerUserInfoDO,Arrays.asList(shopId)));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
package com.cool.store.controller.webb;
|
||||
|
||||
import com.cool.store.dto.AccountAuditDTO;
|
||||
import com.cool.store.dto.AccountEntryStatusAuditDTO;
|
||||
import com.cool.store.dto.GetAccessTokenDTO;
|
||||
import com.cool.store.dto.ShopAccount.ShopAccountDTO;
|
||||
import com.cool.store.dto.AccountEntryStatusChangeDTO;
|
||||
import com.cool.store.enums.DownSystemTypeEnum;
|
||||
import com.cool.store.request.ZxjpApiRequest;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.PushService;
|
||||
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 org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
@@ -28,6 +33,8 @@ public class ShopAccountController {
|
||||
|
||||
@Resource
|
||||
ShopAccountService accountService;
|
||||
@Resource
|
||||
PushService pushService;
|
||||
|
||||
@ApiOperation("根据门店shopId查询平台账号")
|
||||
@GetMapping("/getShopAccountByShopId")
|
||||
@@ -35,5 +42,55 @@ public class ShopAccountController {
|
||||
return ResponseResult.success(accountService.getShopAccountByShopId(shopId));
|
||||
}
|
||||
|
||||
@ApiOperation("根据门店shopId与平台名称查询数据")
|
||||
@GetMapping("/getData")
|
||||
public ResponseResult<ZxjpApiRequest> getData(@RequestParam(value = "shopId", required = true) Long shopId,
|
||||
@RequestParam(value = "systemName", required = true) DownSystemTypeEnum systemName) {
|
||||
return ResponseResult.success(accountService.getData(shopId,systemName));
|
||||
}
|
||||
|
||||
@ApiOperation("开通状态审核")
|
||||
@PostMapping("/auditAccount")
|
||||
public ResponseResult<Boolean> auditAccount(@RequestBody @Validated AccountAuditDTO accountAuditDTO) {
|
||||
return ResponseResult.success(accountService.auditAccount(accountAuditDTO));
|
||||
}
|
||||
|
||||
@ApiOperation("推送数据")
|
||||
@PostMapping("/pushData")
|
||||
public ResponseResult<Boolean> pushData(@RequestBody @Validated AccountAuditDTO accountAuditDTO) {
|
||||
return ResponseResult.success(accountService.pushData(accountAuditDTO));
|
||||
}
|
||||
|
||||
@ApiOperation("进件状态审核")
|
||||
@PostMapping("/accountEntryStatusAudit")
|
||||
public ResponseResult<Boolean> accountEntryStatusAudit(@RequestBody @Validated AccountEntryStatusAuditDTO dto) {
|
||||
return ResponseResult.success(accountService.accountEntryStatusAudit(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("进件状态修改")
|
||||
@PostMapping("/accountEntryStatusChange")
|
||||
public ResponseResult<Boolean> accountEntryStatusChange(@RequestBody @Validated AccountEntryStatusChangeDTO dto) {
|
||||
return ResponseResult.success(accountService.accountEntryStatusChange(dto));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("获取云流水免登token")
|
||||
@PostMapping("/getYlsToken")
|
||||
public ResponseResult<String> getYlsToken(@RequestBody @Validated GetAccessTokenDTO dto) {
|
||||
return ResponseResult.success(pushService.getYlsToken(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("获取POS免登token")
|
||||
@PostMapping("/getPosToken")
|
||||
public ResponseResult<String> getPosToken(@RequestBody @Validated GetAccessTokenDTO dto) {
|
||||
return ResponseResult.success(pushService.getPosToken(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("获取新掌柜免登token")
|
||||
@PostMapping("/getXzgToken")
|
||||
public ResponseResult<String> getXzgToken(@RequestBody @Validated GetAccessTokenDTO dto) {
|
||||
return ResponseResult.success(pushService.getXzgToken(dto));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.cool.store.controller.webc;
|
||||
|
||||
import com.cool.store.dto.ModifyPasswordDTO;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2025/4/8 16:17
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags ="小程序账号管理")
|
||||
@RequestMapping({"/mini/account"})
|
||||
public class MiniShopAccountController {
|
||||
|
||||
|
||||
@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));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("修改密码")
|
||||
@GetMapping("/modifyPassword")
|
||||
public ResponseResult<Boolean> modifyPassword(@RequestBody ModifyPasswordDTO request) {
|
||||
return ResponseResult.success(accountService.modifyPassword(request));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -101,6 +101,8 @@ public class XxlJobHandler {
|
||||
ApplyLicenseMapper applyLicenseMapper;
|
||||
@Resource
|
||||
private TallyBookService tallyBookService;
|
||||
@Resource
|
||||
ShopAccountDAO accountDAO;
|
||||
|
||||
|
||||
|
||||
@@ -337,5 +339,45 @@ public class XxlJobHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@XxlJob("rePush")
|
||||
public void rePush() {
|
||||
log.info("------start rePush------");
|
||||
boolean hasNext = true;
|
||||
int pageNum = 1;
|
||||
int pageSize = 10;
|
||||
List<Long> shopIdList = new ArrayList<>();
|
||||
while (hasNext) {
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
//获取成功开店的门店
|
||||
List<ShopAccountDO> accountDOS = accountDAO.getALlFail();
|
||||
|
||||
if (CollectionUtils.isEmpty(accountDOS)) {
|
||||
log.info("------rePush is empty------");
|
||||
break;
|
||||
}
|
||||
for (ShopAccountDO accountDO : accountDOS){
|
||||
try {
|
||||
// TODO: 2025/4/8 suzhuhong_
|
||||
//推送数据 如果云流水或者新掌柜其中一个失败了 还要不要推送数据
|
||||
|
||||
//如果是POS推送成功 修改状态 还要修改阶段数据
|
||||
|
||||
//云流水 新掌柜 等待回调
|
||||
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
if (accountDOS.size() < pageSize){
|
||||
hasNext = false;
|
||||
}
|
||||
pageNum++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ enterprise.dingCorpId=wpayJeDAAAhGIFgUJpJN-zg39JuNbYhg
|
||||
##qywx.task.notice.url1=https://tstore-api.coolstore.cn/notice?corpId=%s&appType=%s&target=%s
|
||||
qywx.task.notice.url2=https://tstore-h5.coolstore.cn/?corpId=%s&appType=%s#/notice?target=%s¬iceType=zx&corpId=%s&appType=%s&eid=%s
|
||||
|
||||
#机会点
|
||||
#机会点地址
|
||||
third.party.appKey=IGSAEQoakR2HEaYx
|
||||
third.party.appSecret=aPsA99K1obFeFm3m
|
||||
zx.opportunity.url=https://snp.wenmatech.com/
|
||||
@@ -93,9 +93,25 @@ zx.big.data.url=https://ds.zhengxinfood.com/
|
||||
zx.big.data.appKey=ff203b5567744feaaae49fb86f58c5bf
|
||||
zx.big.data.appSecret=35b8b9a400b4430fa022190be0913cd6
|
||||
|
||||
#火吗POS
|
||||
api.auth.url=https://api.zhengxindzg.cn
|
||||
api.auth.username=GkqgAhUJ7p9swJo
|
||||
api.auth.secret=NzVrnS3OWiupdDY
|
||||
|
||||
#新管家账号
|
||||
xgj.api.auth.url=****
|
||||
xgj.api.auth.username=****
|
||||
xgj.api.auth.secret=****
|
||||
|
||||
#云流水账号
|
||||
yls.api.auth.url=****
|
||||
yls.api.auth.username=****
|
||||
yls.api.auth.secret=****
|
||||
|
||||
#新掌柜账号
|
||||
xzg.api.auth.url=****
|
||||
xzg.api.auth.username=****
|
||||
xzg.api.auth.secret=****
|
||||
|
||||
cool.api.appKey=123
|
||||
cool.api.secret=123
|
||||
|
||||
Reference in New Issue
Block a user