Merge remote-tracking branch 'origin/master' into cc_20250903_big_screen
# Conflicts: # coolstore-partner-web/src/main/java/com/cool/store/config/SignValidateFilter.java
This commit is contained in:
@@ -26,6 +26,11 @@ public class CommonConstants {
|
||||
|
||||
public static final int NORMAL_LOCK_TIMES = 60 * 1000;
|
||||
|
||||
/**
|
||||
* 短期token过期时间,单位秒
|
||||
*/
|
||||
public static final int SHORT_TERM_TOKEN_EXPIRE = 60 * 5;
|
||||
|
||||
public static final int AN_HOUR_SECONDS = 3600;
|
||||
//十秒
|
||||
public static final int TEN_SECONDS = 10000;
|
||||
@@ -55,6 +60,11 @@ public class CommonConstants {
|
||||
|
||||
public static final String ZXJP_MINI_PROGRAM_LOGIN_FLAG = "zxjp_mini_program_login_flag:{0}";
|
||||
|
||||
/**
|
||||
* 小程序短期token key
|
||||
*/
|
||||
public static final String ZXJP_MIN_PROGRAM_SHORT_TERM_LOGIN_FLAG = "zxjp_mini_program_short_term_login_flag:{0}";
|
||||
|
||||
public static final String ROOT_DEPT_ID_STR = "1";
|
||||
|
||||
public static final Integer DEAL_RECORD_MAX_SIZE = 1000;
|
||||
|
||||
@@ -32,6 +32,9 @@ public enum RocketMqGroupEnum {
|
||||
*/
|
||||
FEI_SHU_EVENT_LISTENER("fei_shu_event_listener", new ArrayList<>(Arrays.asList(RocketMqTagEnum.USER_EVENT, RocketMqTagEnum.AUTH_SCOPE_CHANGE, RocketMqTagEnum.DEPT_EVENT))),
|
||||
|
||||
|
||||
STORE_USER_UPDATE("store_user_update", new ArrayList<>(Arrays.asList(RocketMqTagEnum.STORE_USER_UPDATE)))
|
||||
|
||||
;
|
||||
|
||||
private final String group;
|
||||
|
||||
@@ -18,6 +18,7 @@ public enum RocketMqTagEnum {
|
||||
ZXJP_CREATE_STORE("zxjp_create_store", "正新鸡排招商创建门店"),
|
||||
PARTNER_LICENSE_SYNC_QUEUE("partner_license_sync_queue", "招商证照信息同步"),
|
||||
BUSINESS_SYNC("business_sync", "工商食安信息同步"),
|
||||
STORE_USER_UPDATE("store_user_update", "门店信息人员变更同步菜品");
|
||||
;
|
||||
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ public class CoolDateUtils {
|
||||
public static final String DATE_FORMAT_SEC_6 = "yyyy.MM.dd";
|
||||
public static final String DATE_FORMAT_SEC_7 = "yyyy/MM/dd HH:mm";
|
||||
public static final String DATE_FORMAT_SEC_8 = "yyyyMMdd";
|
||||
public static final String DATE_FORMAT_SEC_9 = "yyyyMMddHHmmssSSS";
|
||||
|
||||
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
|
||||
@@ -146,6 +147,13 @@ public class CoolDateUtils {
|
||||
return LocalDate.now().format(DATE_FORMATTER);
|
||||
}
|
||||
|
||||
public static final String getTodayMillis(){
|
||||
DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern(DATE_FORMAT_SEC_9);
|
||||
return LocalDateTime.now().format(DATE_FORMATTER);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取当前日期字符串 (yyyy-MM-dd)
|
||||
*/
|
||||
|
||||
@@ -62,6 +62,8 @@ public class SignatureUtils {
|
||||
.add(timeStamp)
|
||||
.add(random)
|
||||
.toString();
|
||||
|
||||
log.info("plainText:{}",plainText);
|
||||
// 签名算法
|
||||
Signature signature = Signature.getInstance("SHA256WithRSA");
|
||||
|
||||
|
||||
@@ -72,8 +72,8 @@ public class StoreDao {
|
||||
}
|
||||
|
||||
|
||||
public List<StoreDO> list() {
|
||||
return storeMapper.list();
|
||||
public List<StoreDO> list(Integer isIot) {
|
||||
return storeMapper.list(isIot);
|
||||
}
|
||||
|
||||
public List<StoreDO> getStoreNumByStoreCodes(List<String> storeCodeIds) {
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.cool.store.dao.store;
|
||||
|
||||
import cn.hutool.core.collection.CollStreamUtil;
|
||||
import com.cool.store.entity.store.StoreMasterSignerInfoDO;
|
||||
import com.cool.store.mapper.store.StoreMasterSignerInfoMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 门店签约信息DAO
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2025/9/23
|
||||
*/
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class StoreMasterSignerInfoDAO {
|
||||
private final StoreMasterSignerInfoMapper storeMasterSignerInfoMapper;
|
||||
|
||||
/**
|
||||
* 获取门店签约信息Map
|
||||
*/
|
||||
public Map<String, StoreMasterSignerInfoDO> getSignerMapByStoreIds(List<String> storeIds) {
|
||||
if (CollectionUtils.isEmpty(storeIds)) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
List<StoreMasterSignerInfoDO> list = storeMasterSignerInfoMapper.selectByStoreIds(storeIds);
|
||||
return CollStreamUtil.toMap(list, StoreMasterSignerInfoDO::getStoreId, v -> v);
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ public interface StoreMapper {
|
||||
* 分页查询门店数据
|
||||
* @return
|
||||
*/
|
||||
List<StoreDO> list();
|
||||
List<StoreDO> list(@Param("isIot") Integer isIot);
|
||||
|
||||
List<StoreAreaDTO> getStoreAreaList( @Param("storeIds") List<String> storeIds);
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.cool.store.mapper.store;
|
||||
|
||||
|
||||
import com.cool.store.entity.store.StoreMasterSignerInfoDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @date 2025-09-23 11:32
|
||||
*/
|
||||
public interface StoreMasterSignerInfoMapper {
|
||||
|
||||
/**
|
||||
* 根据门店id查询签约信息
|
||||
*/
|
||||
List<StoreMasterSignerInfoDO> selectByStoreIds(@Param("storeIds") List<String> storeIds);
|
||||
}
|
||||
@@ -44,6 +44,12 @@
|
||||
<result column="join_brand" property="joinBrand" jdbcType="TINYINT"/>
|
||||
<result column="store_type" property="storeType" jdbcType="TINYINT"/>
|
||||
<result column="mini_program_order_store_name" property="miniProgramOrderStoreName"/>
|
||||
<result column="is_iot" property="isIot" jdbcType="TINYINT"/>
|
||||
<result column="addressee_name" property="addresseeName" jdbcType="VARCHAR"/>
|
||||
<result column="addressee_mobile" property="addresseeMobile" jdbcType="VARCHAR"/>
|
||||
<result column="addressee_area" property="addresseeArea" jdbcType="VARCHAR"/>
|
||||
<result column="addressee_address" property="addresseeAddress" jdbcType="VARCHAR"/>
|
||||
<result column="branch" property="branch" jdbcType="TINYINT"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getByStoreId" resultMap="BaseResultMap">
|
||||
@@ -88,6 +94,15 @@
|
||||
</select>
|
||||
|
||||
<select id="listByMobile" resultMap="BaseResultMap">
|
||||
select a.*
|
||||
from store_${enterpriseId} a left join store_master_signer_info_${enterpriseId} b on a.store_id = b.store_id
|
||||
<where>
|
||||
and a.is_delete = 'effective'
|
||||
<if test="mobile!=null and mobile !=''">
|
||||
and ( b.signer1_mobile = #{mobile} or b.signer2_mobile = #{mobile})
|
||||
</if>
|
||||
</where>
|
||||
union
|
||||
select *
|
||||
from store_${enterpriseId}
|
||||
<where>
|
||||
@@ -99,37 +114,65 @@
|
||||
</select>
|
||||
|
||||
<select id="getSubStoreByRegionIdsAndMobile" resultType="com.cool.store.response.MiniShopsResponse">
|
||||
select store_id as storeId, store_name as shopName, store_num as shopCode, store_address as detailAddress
|
||||
from store_${enterpriseId}
|
||||
where is_delete = 'effective'
|
||||
<choose>
|
||||
<!-- 情况1:regionIdList不为空,使用UNION优化 -->
|
||||
<when test="regionIdList != null and regionIdList.size > 0">
|
||||
SELECT store_id as storeId, store_name as shopName, store_num as shopCode, store_address as detailAddress
|
||||
FROM store_${enterpriseId} a
|
||||
WHERE a.is_delete = 'effective' and a.store_status != 'closed'
|
||||
<if test="storeName!=null and storeName!=''">
|
||||
and store_name like concat('%', #{storeName}, '%')
|
||||
AND a.store_name LIKE CONCAT('%', #{storeName}, '%')
|
||||
</if>
|
||||
<if test="storeNum!=null and storeNum!=''">
|
||||
and store_num = #{storeNum}
|
||||
AND a.store_num = #{storeNum}
|
||||
</if>
|
||||
and (
|
||||
<if test="regionIdList != null and regionIdList.size >0 ">
|
||||
<foreach collection="regionIdList" item="regionId" separator=" or " open=" (" close=" )">
|
||||
region_path like concat('%/', #{regionId}, '/%')
|
||||
AND (
|
||||
<foreach collection="regionIdList" item="regionId" separator=" OR ">
|
||||
a.region_path LIKE CONCAT('%/', #{regionId}, '/%')
|
||||
</foreach>
|
||||
)
|
||||
|
||||
UNION
|
||||
|
||||
SELECT a.store_id as storeId, a.store_name as shopName, a.store_num as shopCode, a.store_address as detailAddress
|
||||
FROM store_${enterpriseId} a
|
||||
INNER JOIN store_master_signer_info_${enterpriseId} b ON a.store_id = b.store_id
|
||||
WHERE a.is_delete = 'effective' and a.store_status != 'closed'
|
||||
<if test="storeName!=null and storeName!=''">
|
||||
AND a.store_name LIKE CONCAT('%', #{storeName}, '%')
|
||||
</if>
|
||||
<if test="mobile!=null and mobile !=''">
|
||||
<choose>
|
||||
<when test="regionIdList != null and regionIdList.size >0 ">
|
||||
or `extend_field` like concat('%', #{mobile}, '%')
|
||||
<if test="storeNum!=null and storeNum!=''">
|
||||
AND a.store_num = #{storeNum}
|
||||
</if>
|
||||
AND (b.signer1_mobile = #{mobile} OR b.signer2_mobile = #{mobile})
|
||||
</when>
|
||||
|
||||
<!-- 情况2:regionIdList为空,直接查询关联表 -->
|
||||
<otherwise>
|
||||
`extend_field` like concat('%', #{mobile}, '%')
|
||||
SELECT a.store_id as storeId, a.store_name as shopName, a.store_num as shopCode, a.store_address as detailAddress
|
||||
FROM store_${enterpriseId} a
|
||||
INNER JOIN store_master_signer_info_${enterpriseId} b ON a.store_id = b.store_id
|
||||
WHERE a.is_delete = 'effective' and a.store_status != 'closed'
|
||||
<if test="storeName!=null and storeName!=''">
|
||||
AND a.store_name LIKE CONCAT('%', #{storeName}, '%')
|
||||
</if>
|
||||
<if test="storeNum!=null and storeNum!=''">
|
||||
AND a.store_num = #{storeNum}
|
||||
</if>
|
||||
AND (b.signer1_mobile = #{mobile} OR b.signer2_mobile = #{mobile})
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
)
|
||||
</select>
|
||||
|
||||
|
||||
<select id="list" resultMap="BaseResultMap">
|
||||
select *
|
||||
from store_${enterpriseId} where is_delete = 'effective' order by id asc
|
||||
from store_${enterpriseId}
|
||||
where is_delete = 'effective'
|
||||
<if test="isIot != null">
|
||||
AND is_iot = #{isIot}
|
||||
</if>
|
||||
order by id asc
|
||||
</select>
|
||||
|
||||
<select id="getStoreAreaList" resultType="com.cool.store.dto.store.StoreAreaDTO">
|
||||
|
||||
@@ -208,7 +208,8 @@
|
||||
b.deadline as deadline,
|
||||
b.publisher_user_id as publishUserId,
|
||||
b.message_content as messageContent,
|
||||
b.process_type as processType
|
||||
b.process_type as processType,
|
||||
b.handle_keyword as handleKeyword
|
||||
from
|
||||
zxjp_store_message a
|
||||
left join zxjp_message_template b on a.message_template_id = b.id
|
||||
|
||||
@@ -397,7 +397,7 @@
|
||||
and eu.active = true
|
||||
-- and sr.source = 'create'
|
||||
<if test="positionType != null and positionType != '' ">
|
||||
and sr.position_type = #{positionType}
|
||||
and (sr.position_type = #{positionType} or sr.id in (180000000,120000000,40000000))
|
||||
</if>
|
||||
and eu.user_status = '1'
|
||||
</select>
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="positionType!=null and positionType!=''">
|
||||
and b.position_type =#{positionType}
|
||||
and (b.position_type =#{positionType} or b.id in (180000000,120000000,40000000) )
|
||||
</if>
|
||||
<if test="notRoleAuth!=null and notRoleAuth!=''">
|
||||
and b.role_auth !=#{notRoleAuth}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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.store.StoreMasterSignerInfoMapper">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.store.StoreMasterSignerInfoDO">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="store_id" jdbcType="VARCHAR" property="storeId" />
|
||||
<result column="signer1_name" jdbcType="VARCHAR" property="signer1Name" />
|
||||
<result column="signer1_mobile" jdbcType="VARCHAR" property="signer1Mobile" />
|
||||
<result column="signer1_id_card_no" jdbcType="VARCHAR" property="signer1IdCardNo" />
|
||||
<result column="signer1_id_card_front" jdbcType="VARCHAR" property="signer1IdCardFront" />
|
||||
<result column="signer1_id_card_back" jdbcType="VARCHAR" property="signer1IdCardBack" />
|
||||
<result column="signer2_name" jdbcType="VARCHAR" property="signer2Name" />
|
||||
<result column="signer2_mobile" jdbcType="VARCHAR" property="signer2Mobile" />
|
||||
<result column="signer2_id_card_no" jdbcType="VARCHAR" property="signer2IdCardNo" />
|
||||
<result column="signer2_id_card_front" jdbcType="VARCHAR" property="signer2IdCardFront" />
|
||||
<result column="signer2_id_card_back" jdbcType="VARCHAR" property="signer2IdCardBack" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, store_id, signer1_name, signer1_mobile, signer1_id_card_no, signer1_id_card_front,
|
||||
signer1_id_card_back, signer2_name, signer2_mobile, signer2_id_card_no, signer2_id_card_front,
|
||||
signer2_id_card_back, create_time, update_time
|
||||
</sql>
|
||||
|
||||
<select id="selectByStoreIds" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from store_master_signer_info_${enterpriseId}
|
||||
where store_id in
|
||||
<foreach item="storeId" collection="storeIds" open="(" separator="," close=")">
|
||||
#{storeId}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -43,4 +43,17 @@ public class StoreDTO {
|
||||
private String longitude;
|
||||
|
||||
private String latitude;
|
||||
|
||||
@ApiModelProperty("订货人")
|
||||
private String addresseeName;
|
||||
@ApiModelProperty("手机号")
|
||||
private String addresseeMobile;
|
||||
@ApiModelProperty("收件省市区")
|
||||
private String addresseeArea;
|
||||
@ApiModelProperty("订货地址")
|
||||
private String addresseeAddress;
|
||||
@ApiModelProperty("管理督导-crm系统的regionId")
|
||||
private String managerSupervisionName;
|
||||
@ApiModelProperty("所属大区/分部")
|
||||
private String branchName;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.cool.store.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 门店名称DTO
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2025/9/16
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class StoreNameDTO {
|
||||
@ApiModelProperty("门店名称")
|
||||
private String storeName;
|
||||
|
||||
@ApiModelProperty("门店编码")
|
||||
private String storeNum;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.cool.store.dto.store;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
@@ -8,6 +9,7 @@ import lombok.Data;
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class StoreUserDTO {
|
||||
|
||||
private String userId;
|
||||
@@ -18,4 +20,8 @@ public class StoreUserDTO {
|
||||
|
||||
private String positionName;
|
||||
|
||||
public StoreUserDTO(String userName, String mobile) {
|
||||
this.userName = userName;
|
||||
this.mobile = mobile;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ public class StoreUserPositionDTO {
|
||||
|
||||
private String shopCode;
|
||||
|
||||
private String storeCode;
|
||||
|
||||
List<StoreUserDTO> userList;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.cool.store.dto.store;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2025/9/25 15:37
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class StoreUserUpdateDTO {
|
||||
|
||||
private String storeCode;
|
||||
|
||||
List<UserDTO> userList;
|
||||
|
||||
@Data
|
||||
class UserDTO {
|
||||
|
||||
private String userName;
|
||||
|
||||
private String mobile;
|
||||
|
||||
private String positionName;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.cool.store.dto.wx;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 小程序免登DTO
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2025/9/18
|
||||
*/
|
||||
@Data
|
||||
public class MiniProgramFreeLoginDTO {
|
||||
@ApiModelProperty("手机号")
|
||||
@NotBlank(message = "手机号不能为空")
|
||||
private String mobile;
|
||||
}
|
||||
@@ -238,5 +238,31 @@ public class StoreDO {
|
||||
|
||||
private String miniProgramOrderStoreName;
|
||||
|
||||
/**
|
||||
* 是否接入物联网
|
||||
*/
|
||||
private Integer isIot;
|
||||
|
||||
/**
|
||||
* 收件人
|
||||
*/
|
||||
private String addresseeName;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String addresseeMobile;
|
||||
|
||||
/**
|
||||
* 收件省市区
|
||||
*/
|
||||
private String addresseeArea;
|
||||
|
||||
/**
|
||||
* 收件详细地址
|
||||
*/
|
||||
private String addresseeAddress;
|
||||
|
||||
private Long branch;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.cool.store.entity.store;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Table;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author wangff
|
||||
* @date 2025-09-23 11:32
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class StoreMasterSignerInfoDO implements Serializable {
|
||||
@ApiModelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("门店ID")
|
||||
private String storeId;
|
||||
|
||||
@ApiModelProperty("签约人1姓名")
|
||||
private String signer1Name;
|
||||
|
||||
@ApiModelProperty("签约人1手机号")
|
||||
private String signer1Mobile;
|
||||
|
||||
@ApiModelProperty("签约人1身份证号()")
|
||||
private String signer1IdCardNo;
|
||||
|
||||
@ApiModelProperty("签约人1身份证正面图片路径")
|
||||
private String signer1IdCardFront;
|
||||
|
||||
@ApiModelProperty("签约人1身份证反面图片路径")
|
||||
private String signer1IdCardBack;
|
||||
|
||||
@ApiModelProperty("签约人2姓名")
|
||||
private String signer2Name;
|
||||
|
||||
@ApiModelProperty("签约人2手机号")
|
||||
private String signer2Mobile;
|
||||
|
||||
@ApiModelProperty("签约人2身份证号()")
|
||||
private String signer2IdCardNo;
|
||||
|
||||
@ApiModelProperty("签约人2身份证正面图片路径")
|
||||
private String signer2IdCardFront;
|
||||
|
||||
@ApiModelProperty("签约人2身份证反面图片路径")
|
||||
private String signer2IdCardBack;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -219,6 +219,8 @@ public class ZxjpApiRequest {
|
||||
|
||||
private Long shopId;
|
||||
|
||||
@ApiModelProperty("合同编号")
|
||||
private String contractCode;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.cool.store.response.caipin;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2025/9/25 15:05
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class StoreUserResponse {
|
||||
|
||||
private String msgDetail;
|
||||
|
||||
private String msgFront;
|
||||
|
||||
}
|
||||
@@ -39,5 +39,7 @@ public class MessageDetailVO {
|
||||
private Integer processStatus;
|
||||
|
||||
private Integer processType;
|
||||
@ApiModelProperty("第三方id")
|
||||
private String handleKeyword;
|
||||
|
||||
}
|
||||
|
||||
@@ -51,6 +51,8 @@ public class MessageTemplateDetailVO {
|
||||
private Integer totalNum;
|
||||
@ApiModelProperty("系统来源")
|
||||
private String systemSource;
|
||||
@ApiModelProperty("第三方id")
|
||||
private String handleKeyword;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.aliyun.openservices.ons.api.bean.Subscription;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.enums.RocketMqGroupEnum;
|
||||
import com.cool.store.mq.RocketMqConfig;
|
||||
import com.cool.store.mq.consumer.listener.StoreUserUpdateListener;
|
||||
import com.cool.store.mq.consumer.listener.XfsgTrainingPersonSyncListener;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -32,6 +33,8 @@ public class ConsumerClient {
|
||||
// private FeiShuEventListener feiShuEventListener;
|
||||
@Resource
|
||||
private XfsgTrainingPersonSyncListener xfsgTrainingPersonSyncListener;
|
||||
@Resource
|
||||
private StoreUserUpdateListener storeUserUpdateListener;
|
||||
|
||||
/**
|
||||
* 获取通用配置
|
||||
@@ -85,4 +88,17 @@ public class ConsumerClient {
|
||||
// }
|
||||
|
||||
|
||||
@Bean(initMethod = "start", destroyMethod = "shutdown")
|
||||
public ConsumerBean storeUserUpdate() {
|
||||
RocketMqGroupEnum groupEnum = RocketMqGroupEnum.STORE_USER_UPDATE;
|
||||
ConsumerBean consumerBean = new ConsumerBean();
|
||||
//配置文件
|
||||
Properties properties = getCommonProperties(groupEnum);
|
||||
consumerBean.setProperties(properties);
|
||||
Map<Subscription, MessageListener> commonSubscriptionTable = getCommonSubscriptionTable(groupEnum, storeUserUpdateListener);
|
||||
//订阅多个topic如上面设置
|
||||
consumerBean.setSubscriptionTable(commonSubscriptionTable);
|
||||
return consumerBean;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.cool.store.mq.consumer.listener;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aliyun.openservices.ons.api.Action;
|
||||
import com.aliyun.openservices.ons.api.ConsumeContext;
|
||||
import com.aliyun.openservices.ons.api.Message;
|
||||
import com.aliyun.openservices.ons.api.MessageListener;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.dto.store.StoreUserPositionDTO;
|
||||
import com.cool.store.dto.store.StoreUserUpdateDTO;
|
||||
import com.cool.store.service.PushService;
|
||||
import com.cool.store.service.StoreService;
|
||||
import com.cool.store.service.ThirdFoodService;
|
||||
import com.cool.store.utils.RedisUtilPool;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
* @Date 2025/9/25 14:49
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class StoreUserUpdateListener implements MessageListener {
|
||||
|
||||
@Autowired
|
||||
public RedisUtilPool redisUtilPool;
|
||||
@Autowired
|
||||
StoreService storeService;
|
||||
@Autowired
|
||||
ThirdFoodService thirdFoodService;
|
||||
|
||||
@Override
|
||||
public Action consume(Message message, ConsumeContext context) {
|
||||
String text = new String(message.getBody());
|
||||
if(StringUtils.isBlank(text)){
|
||||
log.info("消息体为空,tag:{},messageId:{}",message.getTag(),message.getMsgID());
|
||||
return Action.CommitMessage;
|
||||
}
|
||||
String lockKey = "StoreUserUpdateListener:" + message.getMsgID();
|
||||
boolean lock = redisUtilPool.setNxExpire(lockKey, message.getMsgID(), CommonConstants.NORMAL_LOCK_TIMES);
|
||||
if(lock){
|
||||
try {
|
||||
List<StoreUserPositionDTO> storeUser = storeService.getStoreUser(Arrays.asList(text));
|
||||
if (CollectionUtils.isNotEmpty(storeUser)){
|
||||
//转换 否则验签不通过
|
||||
List<StoreUserUpdateDTO> storeUserUpdateDTOS = JSONObject.parseArray(JSONObject.toJSONString(storeUser), StoreUserUpdateDTO.class);
|
||||
thirdFoodService.pushStoreUser(storeUserUpdateDTOS);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("StoreUserUpdateListener consume error",e);
|
||||
return Action.ReconsumeLater;
|
||||
}finally {
|
||||
redisUtilPool.delKey(lockKey);
|
||||
}
|
||||
log.info("消费成功,tag:{},messageId:{},reqBody={}",message.getTag(),message.getMsgID(),text);
|
||||
return Action.CommitMessage;
|
||||
}
|
||||
return Action.ReconsumeLater;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.cool.store.dto.StoreDTO;
|
||||
import com.cool.store.dto.StoreNameDTO;
|
||||
import com.cool.store.dto.store.AuthStoreUserDTO;
|
||||
import com.cool.store.dto.store.StoreUserPositionDTO;
|
||||
import com.cool.store.response.MiniShopsResponse;
|
||||
@@ -24,6 +25,11 @@ public interface StoreService {
|
||||
*/
|
||||
PageInfo<StoreDTO> getStoreExtendFieldInfo(Integer pageSize,Integer pageNum);
|
||||
|
||||
/**
|
||||
* 分页查询接入物联网的门店
|
||||
*/
|
||||
PageInfo<StoreNameDTO> getIotStoreList(Integer pageNum, Integer pageSize);
|
||||
|
||||
PageInfo<MiniShopsResponse> getStoreListByMobile(String mobile,Integer pageNum,Integer pageSize,String storeName,String storeNum);
|
||||
|
||||
List<StoreUserPositionDTO> getStoreUser(List<String> storeCodeList);
|
||||
|
||||
@@ -2,6 +2,11 @@ package com.cool.store.service;
|
||||
|
||||
import com.cool.store.dto.FoodTokenDTO;
|
||||
import com.cool.store.dto.GetAccessTokenDTO;
|
||||
import com.cool.store.dto.store.StoreUserPositionDTO;
|
||||
import com.cool.store.dto.store.StoreUserUpdateDTO;
|
||||
import com.cool.store.response.caipin.StoreUserResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 正新菜品市场api对接-埃林哲-对接人徐哲
|
||||
@@ -19,4 +24,11 @@ public interface ThirdFoodService {
|
||||
*/
|
||||
String getFoodToken(FoodTokenDTO dto);
|
||||
|
||||
/**
|
||||
* 推送门店人员信息
|
||||
* @param storeUserUpdateDTOList
|
||||
* @return
|
||||
*/
|
||||
StoreUserResponse pushStoreUser(List<StoreUserUpdateDTO> storeUserUpdateDTOList);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.cool.store.dto.wx.MiniAppUrlLinkReqDTO;
|
||||
import com.cool.store.dto.wx.MiniProgramFreeLoginDTO;
|
||||
import com.cool.store.dto.wx.MiniProgramLoginDTO;
|
||||
import com.cool.store.request.MobileUpdateRequest;
|
||||
import com.cool.store.vo.PartnerUserInfoVO;
|
||||
@@ -28,4 +29,18 @@ public interface WechatMiniAppService {
|
||||
String getMiniAppUrl();
|
||||
|
||||
String getMiniAppUrlLink(MiniAppUrlLinkReqDTO miniAppUrlLinkReqDTO);
|
||||
|
||||
/**
|
||||
* 通过手机号获取短期token
|
||||
* @param param 小程序免登DTO
|
||||
* @return Token
|
||||
*/
|
||||
String getShortTermTokenByMobile(MiniProgramFreeLoginDTO param);
|
||||
|
||||
/**
|
||||
* 通过短期token获取用户信息
|
||||
* @param token 短期token
|
||||
* @return 用户信息VO
|
||||
*/
|
||||
PartnerUserInfoVO getUserInfoByShortTermToken(String token);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.dao.*;
|
||||
import com.cool.store.entity.*;
|
||||
@@ -20,7 +21,7 @@ import com.cool.store.service.UserAuthMappingService;
|
||||
import com.cool.store.utils.RedisConstantUtil;
|
||||
import com.cool.store.utils.RedisUtilPool;
|
||||
import com.cool.store.utils.poi.StringUtils;
|
||||
import io.lettuce.core.ZAddArgs;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -38,6 +39,7 @@ import java.util.stream.Stream;
|
||||
* @createDate 2024-10-09 14:05:52
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BuildInformationServiceImpl implements BuildInformationService {
|
||||
@Resource
|
||||
private PlatformBuildDAO platformBuildDAO;
|
||||
@@ -73,6 +75,102 @@ public class BuildInformationServiceImpl implements BuildInformationService {
|
||||
private BigRegionDAO bigRegionDAO;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer submitOrUpdate(BuildInformationRequest request) {
|
||||
log.info("提交/修改建店资料开始,shopId:{}", JSONObject.toJSONString(request));
|
||||
String lockKey = redisConstantUtil.submitBuildKey(request.getShopId());
|
||||
String lockValue = UUID.randomUUID().toString();
|
||||
boolean acquired = false;
|
||||
try {
|
||||
acquired = redisUtilPool.setNxExpire(lockKey, lockValue, CommonConstants.TEN_SECONDS);
|
||||
if (Boolean.TRUE.equals(acquired)) {
|
||||
ShopInfoDO shopInfoDO = shopInfoDAO.getShopInfo(request.getShopId());
|
||||
// if (JoinModeEnum.FLAGSHIP_STORE.getCode()!=shopInfoDO.getJoinMode()){
|
||||
// log.info("FLAGSHIP_STORE:{},{},{},{},{},{},{}",request.getSettlerName(),request.getSettlerIdCardFront(),
|
||||
// request.getSettlerInHandFrontPicture(),request.getSettlerBankBackPhotoUrl(),
|
||||
// request.getSettlerBankNumber(),request.getSettlerBankMobile(),request.getSettlerBankName());
|
||||
// //校验结算人非空
|
||||
// if (StringUtils.isAnyBlank(request.getSettlerName(),request.getSettlerIdCardFront(),
|
||||
// request.getSettlerInHandFrontPicture(),request.getSettlerBankBackPhotoUrl(),
|
||||
// request.getSettlerBankNumber(),request.getSettlerBankMobile(),request.getSettlerBankName())) {
|
||||
// throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
|
||||
// }
|
||||
// }
|
||||
|
||||
BuildInformationDO informationDO = buildInformationDAO.selectOneByShopId(request.getShopId());
|
||||
BuildInformationDO buildInformationDO = request.toDO();
|
||||
OrderSysInfoDO orderSysInfoDO = getOrderSysInfoDO(request);
|
||||
OrderSysInfoDO orderSysInfoDO1 = orderSysInfoDAO.selectByShopId(request.getShopId());
|
||||
if (Objects.nonNull(orderSysInfoDO1)) {
|
||||
orderSysInfoDAO.updateByShopId(orderSysInfoDO);
|
||||
} else {
|
||||
orderSysInfoDAO.insertSelective(orderSysInfoDO);
|
||||
}
|
||||
LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(shopInfoDO.getLineId());
|
||||
QualificationsInfoDO qualificationsInfoDO = qualificationsInfoDAO.getByLineId(lineInfoDO.getId());
|
||||
if (request.getJuridicalIsSamePartner()) {
|
||||
buildInformationDO.setJuridicalName(lineInfoDO.getUsername());
|
||||
buildInformationDO.setJuridicalIdCardNo(qualificationsInfoDO.getIdCardNo());
|
||||
buildInformationDO.setJuridicalIdCardFront(qualificationsInfoDO.getFrontOfIdCard());
|
||||
buildInformationDO.setJuridicalIdCardReverse(qualificationsInfoDO.getBackOfIdCard());
|
||||
}
|
||||
if (request.getSettlerIsSamePartner()!=null&&request.getSettlerIsSamePartner()) {
|
||||
buildInformationDO.setSettlerIdCardNo(qualificationsInfoDO.getIdCardNo());
|
||||
buildInformationDO.setSettlerName(lineInfoDO.getUsername());
|
||||
buildInformationDO.setSettlerIdCardFront(qualificationsInfoDO.getFrontOfIdCard());
|
||||
buildInformationDO.setSettlerIdCardReverse(qualificationsInfoDO.getBackOfIdCard());
|
||||
}
|
||||
if (Objects.isNull(informationDO)) {
|
||||
buildInformationDO.setCreateTime(new Date());
|
||||
buildInformationDO.setUpdateTime(new Date());
|
||||
shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151);
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("partnerUsername", lineInfoDO.getUsername());
|
||||
map.put("partnerMobile", lineInfoDO.getMobile());
|
||||
map.put("storeName", shopInfoDO.getShopName());
|
||||
List<EnterpriseUserDO> logisticsList = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.LOGISTICS, shopInfoDO.getRegionId());
|
||||
List<String> logistics = new ArrayList<>();
|
||||
if (Objects.nonNull(logisticsList)) {
|
||||
logistics.addAll(logisticsList.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toList()));
|
||||
}
|
||||
commonService.sendQWMessage(logistics,
|
||||
MessageEnum.MESSAGE_52,
|
||||
map);
|
||||
return buildInformationDAO.insertSelective(buildInformationDO);
|
||||
} else {
|
||||
buildInformationDO.setUpdateTime(new Date());
|
||||
List<PlatformBuildDO> platformBuildDOS = platformBuildDAO.selectByShopId(request.getShopId());
|
||||
if (CollectionUtils.isNotEmpty(platformBuildDOS)){
|
||||
for (PlatformBuildDO platformBuildDO : platformBuildDOS){
|
||||
platformBuildDO.setSettlerName(buildInformationDO.getSettlerName());
|
||||
platformBuildDO.setSettlerIdCardFront(buildInformationDO.getSettlerIdCardFront());
|
||||
platformBuildDO.setSettlerIdCardReverse(buildInformationDO.getSettlerIdCardReverse());
|
||||
platformBuildDO.setSettlerInHandBackPicture(buildInformationDO.getSettlerInHandBackPicture());
|
||||
platformBuildDO.setSettlerInHandFrontPicture(buildInformationDO.getSettlerInHandFrontPicture());
|
||||
platformBuildDO.setSettlerIdCardNo(buildInformationDO.getSettlerIdCardNo());
|
||||
platformBuildDO.setSettlerBankPhotoUrl(buildInformationDO.getSettlerBankPhotoUrl());
|
||||
platformBuildDO.setSettlerBankNumber(buildInformationDO.getSettlerBankNumber());
|
||||
platformBuildDO.setSettlerBankMobile(buildInformationDO.getSettlerBankMobile());
|
||||
platformBuildDO.setSettlerBankName(buildInformationDO.getSettlerBankName());
|
||||
}
|
||||
}
|
||||
platformBuildDAO.batchUpdate(platformBuildDOS);
|
||||
return buildInformationDAO.updateByShopIdSelective(buildInformationDO);
|
||||
}
|
||||
}else{
|
||||
throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION);
|
||||
}
|
||||
} finally {
|
||||
if (Boolean.TRUE.equals(acquired)) {
|
||||
String currentValue = redisUtilPool.getString(lockKey);
|
||||
if (lockValue.equals(currentValue)) {
|
||||
redisUtilPool.delKey(lockKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuildInformationResponse getBuildInformation(Long shopId) {
|
||||
BuildInformationResponse response = new BuildInformationResponse();
|
||||
@@ -192,98 +290,6 @@ public class BuildInformationServiceImpl implements BuildInformationService {
|
||||
response.setJuridicalIsSamePartner(informationDO.getJuridicalIsSamePartner());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer submitOrUpdate(BuildInformationRequest request) {
|
||||
String lockKey = redisConstantUtil.submitBuildKey(request.getShopId());
|
||||
String lockValue = UUID.randomUUID().toString();
|
||||
boolean acquired = false;
|
||||
try {
|
||||
acquired = redisUtilPool.setNxExpire(lockKey, lockValue, CommonConstants.TEN_SECONDS);
|
||||
if (Boolean.TRUE.equals(acquired)) {
|
||||
ShopInfoDO shopInfoDO = shopInfoDAO.getShopInfo(request.getShopId());
|
||||
// if (JoinModeEnum.FLAGSHIP_STORE.getCode()!=shopInfoDO.getJoinMode()){
|
||||
// //校验结算人非空
|
||||
// if (StringUtils.isAnyBlank(request.getSettlerName(),request.getSettlerIdCardFront(),
|
||||
// request.getSettlerInHandFrontPicture(),request.getSettlerBankBackPhotoUrl(),
|
||||
// request.getSettlerBankNumber(),request.getSettlerBankMobile(),request.getSettlerBankName())) {
|
||||
// throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
|
||||
// }
|
||||
// }
|
||||
|
||||
BuildInformationDO informationDO = buildInformationDAO.selectOneByShopId(request.getShopId());
|
||||
BuildInformationDO buildInformationDO = request.toDO();
|
||||
OrderSysInfoDO orderSysInfoDO = getOrderSysInfoDO(request);
|
||||
OrderSysInfoDO orderSysInfoDO1 = orderSysInfoDAO.selectByShopId(request.getShopId());
|
||||
if (Objects.nonNull(orderSysInfoDO1)) {
|
||||
orderSysInfoDAO.updateByShopId(orderSysInfoDO);
|
||||
} else {
|
||||
orderSysInfoDAO.insertSelective(orderSysInfoDO);
|
||||
}
|
||||
LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(shopInfoDO.getLineId());
|
||||
QualificationsInfoDO qualificationsInfoDO = qualificationsInfoDAO.getByLineId(lineInfoDO.getId());
|
||||
if (request.getJuridicalIsSamePartner()) {
|
||||
buildInformationDO.setJuridicalName(lineInfoDO.getUsername());
|
||||
buildInformationDO.setJuridicalIdCardNo(qualificationsInfoDO.getIdCardNo());
|
||||
buildInformationDO.setJuridicalIdCardFront(qualificationsInfoDO.getFrontOfIdCard());
|
||||
buildInformationDO.setJuridicalIdCardReverse(qualificationsInfoDO.getBackOfIdCard());
|
||||
}
|
||||
if (request.getSettlerIsSamePartner()!=null&&request.getSettlerIsSamePartner()) {
|
||||
buildInformationDO.setSettlerIdCardNo(qualificationsInfoDO.getIdCardNo());
|
||||
buildInformationDO.setSettlerName(lineInfoDO.getUsername());
|
||||
buildInformationDO.setSettlerIdCardFront(qualificationsInfoDO.getFrontOfIdCard());
|
||||
buildInformationDO.setSettlerIdCardReverse(qualificationsInfoDO.getBackOfIdCard());
|
||||
}
|
||||
if (Objects.isNull(informationDO)) {
|
||||
buildInformationDO.setCreateTime(new Date());
|
||||
buildInformationDO.setUpdateTime(new Date());
|
||||
shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_151);
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("partnerUsername", lineInfoDO.getUsername());
|
||||
map.put("partnerMobile", lineInfoDO.getMobile());
|
||||
map.put("storeName", shopInfoDO.getShopName());
|
||||
List<EnterpriseUserDO> logisticsList = userAuthMappingService.getAllUserByRoleEnumAndRegionId(UserRoleEnum.LOGISTICS, shopInfoDO.getRegionId());
|
||||
List<String> logistics = new ArrayList<>();
|
||||
if (Objects.nonNull(logisticsList)) {
|
||||
logistics.addAll(logisticsList.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toList()));
|
||||
}
|
||||
commonService.sendQWMessage(logistics,
|
||||
MessageEnum.MESSAGE_52,
|
||||
map);
|
||||
return buildInformationDAO.insertSelective(buildInformationDO);
|
||||
} else {
|
||||
buildInformationDO.setUpdateTime(new Date());
|
||||
List<PlatformBuildDO> platformBuildDOS = platformBuildDAO.selectByShopId(request.getShopId());
|
||||
if (CollectionUtils.isNotEmpty(platformBuildDOS)){
|
||||
for (PlatformBuildDO platformBuildDO : platformBuildDOS){
|
||||
platformBuildDO.setSettlerName(buildInformationDO.getSettlerName());
|
||||
platformBuildDO.setSettlerIdCardFront(buildInformationDO.getSettlerIdCardFront());
|
||||
platformBuildDO.setSettlerIdCardReverse(buildInformationDO.getSettlerIdCardReverse());
|
||||
platformBuildDO.setSettlerInHandBackPicture(buildInformationDO.getSettlerInHandBackPicture());
|
||||
platformBuildDO.setSettlerInHandFrontPicture(buildInformationDO.getSettlerInHandFrontPicture());
|
||||
platformBuildDO.setSettlerIdCardNo(buildInformationDO.getSettlerIdCardNo());
|
||||
platformBuildDO.setSettlerBankPhotoUrl(buildInformationDO.getSettlerBankPhotoUrl());
|
||||
platformBuildDO.setSettlerBankNumber(buildInformationDO.getSettlerBankNumber());
|
||||
platformBuildDO.setSettlerBankMobile(buildInformationDO.getSettlerBankMobile());
|
||||
platformBuildDO.setSettlerBankName(buildInformationDO.getSettlerBankName());
|
||||
}
|
||||
}
|
||||
platformBuildDAO.batchUpdate(platformBuildDOS);
|
||||
return buildInformationDAO.updateByShopIdSelective(buildInformationDO);
|
||||
}
|
||||
}else{
|
||||
throw new ServiceException(ErrorCodeEnum.DUPLICATE_SUBMISSION);
|
||||
}
|
||||
} finally {
|
||||
if (Boolean.TRUE.equals(acquired)) {
|
||||
String currentValue = redisUtilPool.getString(lockKey);
|
||||
if (lockValue.equals(currentValue)) {
|
||||
redisUtilPool.delKey(lockKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static @NotNull OrderSysInfoDO getOrderSysInfoDO(BuildInformationRequest request) {
|
||||
OrderSysInfoDO orderSysInfoDO = new OrderSysInfoDO();
|
||||
orderSysInfoDO.setShopId(request.getShopId());
|
||||
|
||||
@@ -56,8 +56,12 @@ public class MatterConfigServiceImpl implements MatterConfigService {
|
||||
BeanUtils.copyProperties(request, matterConfigDO);
|
||||
matterConfigDO.setUpdateUserId(currentUser.getUserId());
|
||||
matterConfigDO.setUpdateTime(new Date());
|
||||
if (CollectionUtils.isNotEmpty(request.getStoreInfoList())){
|
||||
matterConfigDO.setDefaultStoreInfo(JSONObject.toJSONString(request.getStoreInfoList()));
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(request.getUserInfoList())){
|
||||
matterConfigDO.setDefaultHandlePersonInfo(JSONObject.toJSONString(request.getUserInfoList()));
|
||||
}
|
||||
return matterConfigDAO.updateForce(matterConfigDO);
|
||||
}
|
||||
|
||||
|
||||
@@ -81,8 +81,8 @@ public class MessageTemplateServiceImpl implements MessageTemplateService {
|
||||
|
||||
public String getMessageTemplateCode() {
|
||||
//当前日期
|
||||
String today = CoolDateUtils.getToday();
|
||||
return "16" + today + String.format("%04d", ThreadLocalRandom.current().nextInt(10000));
|
||||
String today = CoolDateUtils.getTodayMillis();
|
||||
return "16" + today + String.format("%04d", ThreadLocalRandom.current().nextInt(100));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.dao.EnterpriseUserDAO;
|
||||
import com.cool.store.dao.EnterpriseUserRoleDao;
|
||||
import com.cool.store.dao.StoreDao;
|
||||
import com.cool.store.dto.GetAccessTokenDTO;
|
||||
import com.cool.store.dto.HqtTokenDTO;
|
||||
import com.cool.store.dto.ModifyPasswordDTO;
|
||||
import com.cool.store.dto.XgjOrganizationDTO;
|
||||
import com.cool.store.entity.EnterpriseUserDO;
|
||||
import com.cool.store.entity.StoreDO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.enums.UserRoleEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.request.ZxjpApiRequest;
|
||||
import com.cool.store.request.xgj.PushFranchiseFeeRequest;
|
||||
@@ -167,6 +173,10 @@ public class PushServiceImpl implements PushService {
|
||||
|
||||
@Override
|
||||
public String getYlsToken(GetAccessTokenDTO dto) {
|
||||
String yls = redisUtilPool.getString("yls");
|
||||
if (StringUtils.isNotBlank(yls)) {
|
||||
throw new ServiceException(ErrorCodeEnum.THIRD_API_ERROR,"云流水系统修复中");
|
||||
}
|
||||
String apiUrl = ylsUrl + "/Store.axd?action=getToken";
|
||||
return executeApiCall(apiUrl, dto, String.class, ylsUsername, ylsSecret);
|
||||
}
|
||||
@@ -178,8 +188,28 @@ public class PushServiceImpl implements PushService {
|
||||
return executeApiCall(apiUrl, dto, String.class, "", "");
|
||||
}
|
||||
|
||||
@Resource
|
||||
EnterpriseUserDAO enterpriseUserDAO;
|
||||
@Resource
|
||||
EnterpriseUserRoleDao enterpriseUserRoleDao;
|
||||
@Resource
|
||||
StoreDao storeDao;
|
||||
|
||||
@Override
|
||||
public String getPosToken(GetAccessTokenDTO dto) {
|
||||
EnterpriseUserDO enterpriseUserDO = enterpriseUserDAO.selectByMobile(dto.getMobile());
|
||||
if (enterpriseUserDO != null){
|
||||
List<Long> userRoleIds = enterpriseUserRoleDao.getUserRoleIds(enterpriseUserDO.getUserId());
|
||||
//如果userRoleIds包含督导。大区总。分部负责人任何一个 使用当前门店的手机号
|
||||
if (userRoleIds.contains(UserRoleEnum.SUPERVISION.getCode()) ||
|
||||
userRoleIds.contains(UserRoleEnum.HEAD_OF_DIVISION.getCode()) ||
|
||||
userRoleIds.contains(UserRoleEnum.REGION_MANAGER.getCode())) {
|
||||
StoreDO store = storeDao.getByStoreNum(dto.getShopCode());
|
||||
if (store != null&&store.getTelephone()!=null){
|
||||
dto.setMobile(store.getTelephone());
|
||||
}
|
||||
}
|
||||
}
|
||||
String apiUrl = url + "/dzgV1/zxcrm/business_user/generateToken";
|
||||
return executeApiCall(apiUrl, dto, String.class, username, secret);
|
||||
}
|
||||
|
||||
@@ -244,30 +244,16 @@ public class ShopAccountServiceImpl implements ShopAccountService {
|
||||
}
|
||||
List<ShopAccountDO> accountDOS = shopAccountDAO.selectByShopId(shopId);
|
||||
if (CollectionUtils.isEmpty(accountDOS)) {
|
||||
throw new ServiceException(ErrorCodeEnum.SYSTEM_DATA_ERROR);
|
||||
return "ZXA8_"+shopInfo.getShopCode();
|
||||
}
|
||||
Map<String, ShopAccountDO> map = accountDOS.stream().collect(Collectors.toMap(ShopAccountDO::getSystemName, data -> data));
|
||||
ShopAccountDO shopAccountDO = map.get(ShopAccountEnum.YLS.getSystemName());
|
||||
if (Objects.isNull(shopAccountDO)) {
|
||||
throw new ServiceException(ErrorCodeEnum.SYSTEM_DATA_ERROR);
|
||||
return "ZXA8_"+shopInfo.getShopCode();
|
||||
}
|
||||
return StringUtil.isEmpty(shopAccountDO.getAccount()) ? shopInfo.getShopCode() : shopAccountDO.getAccount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String shopCodeToYlsCode(String shopCode) {
|
||||
ShopInfoDO shopInfoDO = shopInfoDAO.selectByStoreCode(shopCode);
|
||||
if (!Objects.isNull(shopInfoDO)) {
|
||||
return this.shopIdToYlsCode(shopInfoDO.getId());
|
||||
}
|
||||
//查询老店关联表数据
|
||||
OldShopDO oldShopDO = oldShopDAO.getByCode(shopCode);
|
||||
if (Objects.isNull(oldShopDO)) {
|
||||
throw new ServiceException(ErrorCodeEnum.GET_YLS_CODE_FAIL);
|
||||
}
|
||||
return oldShopDO.getYlsShopCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean handleOldData() {
|
||||
@@ -316,6 +302,20 @@ public class ShopAccountServiceImpl implements ShopAccountService {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String shopCodeToYlsCode(String shopCode) {
|
||||
ShopInfoDO shopInfoDO = shopInfoDAO.selectByStoreCode(shopCode);
|
||||
if (!Objects.isNull(shopInfoDO)) {
|
||||
return this.shopIdToYlsCode(shopInfoDO.getId());
|
||||
}
|
||||
//查询老店关联表数据
|
||||
OldShopDO oldShopDO = oldShopDAO.getByCode(shopCode);
|
||||
if (Objects.isNull(oldShopDO)) {
|
||||
throw new ServiceException(ErrorCodeEnum.GET_YLS_CODE_FAIL);
|
||||
}
|
||||
return oldShopDO.getYlsShopCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean handleAccountPassword() {
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollStreamUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.dto.StoreNameDTO;
|
||||
import com.cool.store.dao.store.StoreMasterSignerInfoDAO;
|
||||
import com.cool.store.dto.store.AuthStoreUserDTO;
|
||||
import com.cool.store.dao.EnterpriseUserDAO;
|
||||
import com.cool.store.dao.EnterpriseUserRoleDao;
|
||||
@@ -12,10 +16,8 @@ import com.cool.store.dto.StoreDTO;
|
||||
import com.cool.store.dto.store.StoreAreaDTO;
|
||||
import com.cool.store.dto.store.StoreUserDTO;
|
||||
import com.cool.store.dto.store.StoreUserPositionDTO;
|
||||
import com.cool.store.entity.EnterpriseUserDO;
|
||||
import com.cool.store.entity.StoreDO;
|
||||
import com.cool.store.entity.SysRoleDO;
|
||||
import com.cool.store.entity.UserAuthMappingDO;
|
||||
import com.cool.store.entity.*;
|
||||
import com.cool.store.entity.store.StoreMasterSignerInfoDO;
|
||||
import com.cool.store.enums.*;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.mapper.*;
|
||||
@@ -38,6 +40,7 @@ import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @Author suzhuhong
|
||||
@@ -70,6 +73,8 @@ public class StoreServiceImpl implements StoreService {
|
||||
EnterpriseUserMapper enterpriseUserMapper;
|
||||
@Resource
|
||||
EnterpriseUserGroupMappingMapper enterpriseUserGroupMappingMapper;
|
||||
@Resource
|
||||
StoreMasterSignerInfoDAO storeMasterSignerInfoDAO;
|
||||
|
||||
@Override
|
||||
public PageInfo<StoreDTO> getStoreExtendFieldInfo(Integer pageSize, Integer pageNum) {
|
||||
@@ -77,16 +82,42 @@ public class StoreServiceImpl implements StoreService {
|
||||
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE,"单次最多获取200条门店数据");
|
||||
}
|
||||
PageHelper.startPage(pageNum,pageSize);
|
||||
List<StoreDO> list = storeDao.list();
|
||||
List<StoreDO> list = storeDao.list(null);
|
||||
PageInfo info = new PageInfo<>(list);
|
||||
if (CollectionUtils.isEmpty(list)){
|
||||
return info;
|
||||
}
|
||||
List<StoreDTO> storeDTOS = processStores(list);
|
||||
//使用regionId与branch 合并的集合
|
||||
Set<Long> regionIds = list.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.flatMap(store -> Stream.of(store.getBranch(), store.getRegionId()))
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
List<RegionDO> regionList = regionMapper.getByIds(new ArrayList<>(regionIds));
|
||||
Map<Long, String> regionNameMap = regionList.stream().collect(Collectors.toMap(RegionDO::getId, RegionDO::getName));
|
||||
|
||||
List<StoreDTO> storeDTOS = processStores(list, regionNameMap);
|
||||
info.setList(storeDTOS);
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<StoreNameDTO> getIotStoreList(Integer pageNum, Integer pageSize) {
|
||||
if (pageSize > 200) {
|
||||
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, "单次最多获取200条门店数据");
|
||||
}
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
List<StoreDO> list = storeDao.list(1);
|
||||
PageInfo info = new PageInfo<>(list);
|
||||
if (CollectionUtils.isEmpty(list)){
|
||||
return info;
|
||||
}
|
||||
List<StoreNameDTO> result = list.stream().map(v -> new StoreNameDTO(v.getStoreName(), v.getStoreNum())).collect(Collectors.toList());
|
||||
info.setList(result);
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<MiniShopsResponse> getStoreListByMobile(String mobile,Integer pageNum,Integer pageSize,String storeName,String storeNum) {
|
||||
//根据手机号查询 标品userId
|
||||
@@ -97,7 +128,10 @@ public class StoreServiceImpl implements StoreService {
|
||||
List<Long> userRoleIds = enterpriseUserRoleDao.getUserRoleIds(enterpriseUserDO.getUserId());
|
||||
//查询职位详情,筛选掉店外职位
|
||||
List<SysRoleDO> roleIds = sysRoleDao.selectRoleByRoleIds(userRoleIds);
|
||||
List<SysRoleDO> sysRoleDOS = roleIds.stream().filter(role -> "store_inside".equals(role.getPositionType())).collect(Collectors.toList());
|
||||
List<SysRoleDO> sysRoleDOS = roleIds.stream().filter(role -> "store_inside".equals(role.getPositionType())
|
||||
||UserRoleEnum.SUPERVISION.getCode().equals(role.getId())
|
||||
||UserRoleEnum.HEAD_OF_DIVISION.getCode().equals(role.getId())
|
||||
||UserRoleEnum.REGION_MANAGER.getCode().equals(role.getId())).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(sysRoleDOS)){
|
||||
//获取用户管辖区域
|
||||
List<UserAuthMappingDO> userAuthMapping = userAuthMappingService.listUserAuthMappingByUserId(enterpriseUserDO.getUserId());
|
||||
@@ -120,6 +154,8 @@ public class StoreServiceImpl implements StoreService {
|
||||
if (CollectionUtils.isEmpty(list)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<String> storeIds = CollStreamUtil.toList(list, StoreDO::getStoreId);
|
||||
Map<String, StoreMasterSignerInfoDO> signerMap = storeMasterSignerInfoDAO.getSignerMapByStoreIds(storeIds);
|
||||
List<StoreUserPositionDTO> result = new ArrayList<>();
|
||||
list.forEach(x->{
|
||||
StoreUserPositionDTO storeUserPositionDTO = new StoreUserPositionDTO();
|
||||
@@ -128,6 +164,7 @@ public class StoreServiceImpl implements StoreService {
|
||||
storeUserPositionDTO.setStoreId(x.getStoreId());
|
||||
storeUserPositionDTO.setStoreName(x.getStoreName());
|
||||
storeUserPositionDTO.setShopCode(x.getStoreNum());
|
||||
storeUserPositionDTO.setStoreCode(x.getStoreNum());
|
||||
List<StoreUserDTO> userList = Lists.newArrayList();
|
||||
for (String userId : storeUserDTOMap.keySet()) {
|
||||
List<StoreUserDTO> singleUserDTOList = storeUserDTOMap.get(userId);
|
||||
@@ -140,6 +177,16 @@ public class StoreServiceImpl implements StoreService {
|
||||
storeUserDTO.setPositionName(String.join(Constants.COMMA, positionNameList));
|
||||
userList.add(storeUserDTO);
|
||||
}
|
||||
StoreMasterSignerInfoDO signerInfoDO = signerMap.get(x.getStoreId());
|
||||
if (Objects.nonNull(signerInfoDO)) {
|
||||
Set<String> mobiles = CollStreamUtil.toSet(userList, StoreUserDTO::getMobile);
|
||||
if (StringUtils.isNotBlank(signerInfoDO.getSigner1Mobile()) && mobiles.add(signerInfoDO.getSigner1Mobile())) {
|
||||
userList.add(new StoreUserDTO(signerInfoDO.getSigner1Name(), signerInfoDO.getSigner1Mobile()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(signerInfoDO.getSigner2Mobile()) && mobiles.add(signerInfoDO.getSigner2Mobile())) {
|
||||
userList.add(new StoreUserDTO(signerInfoDO.getSigner2Name(), signerInfoDO.getSigner2Mobile()));
|
||||
}
|
||||
}
|
||||
storeUserPositionDTO.setUserList(userList);
|
||||
result.add(storeUserPositionDTO);
|
||||
});
|
||||
@@ -342,25 +389,22 @@ public class StoreServiceImpl implements StoreService {
|
||||
}
|
||||
|
||||
|
||||
public static List<StoreDTO> processStores(List<StoreDO> stores) {
|
||||
public static List<StoreDTO> processStores(List<StoreDO> stores,Map<Long, String> regionMap) {
|
||||
// 处理每个门店
|
||||
return stores.stream().map(store -> {
|
||||
StoreDTO dto = new StoreDTO();
|
||||
dto.setStoreName(store.getStoreName());
|
||||
StoreDTO dto = BeanUtil.toBean(store, StoreDTO.class);
|
||||
dto.setStoreCode(store.getStoreNum());
|
||||
dto.setStoreAddress(store.getStoreAddress());
|
||||
dto.setStoreAvatar(store.getAvatar());
|
||||
dto.setTelephone(store.getTelephone());
|
||||
dto.setMonthlyRent(store.getMonthlyRent());
|
||||
dto.setMonthlyPersonnelSalary(store.getMonthlyPersonnelSalary());
|
||||
dto.setMonthlyOtherExpenses(store.getMonthlyOtherExpenses());
|
||||
dto.setUnifiedManagement(store.getUnifiedManagement());
|
||||
dto.setStoreType(StoreTypeEnum.getMessage(store.getStoreType()));
|
||||
dto.setJoinMode(JoinModeEnum.getByCode(store.getJoinModel()));
|
||||
dto.setBrand(FranchiseBrandEnum.getDescByCode(store.getJoinBrand()));
|
||||
dto.setOrderMiniProgramName(store.getMiniProgramOrderStoreName());
|
||||
dto.setLongitude(store.getLongitude());
|
||||
dto.setLatitude(store.getLatitude());
|
||||
if (store.getRegionId() != null){
|
||||
dto.setManagerSupervisionName(regionMap.get(store.getRegionId()));
|
||||
}
|
||||
if (store.getBranch()!=null){
|
||||
dto.setBranchName(regionMap.get(store.getBranch()));
|
||||
}
|
||||
return dto;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -119,6 +119,7 @@ public class SyncDataServiceImpl implements SyncDataService {
|
||||
}
|
||||
request.setPartnershipSignatory(partnershipSignatory);
|
||||
request.setBusinessModel(signFranchiseDO.getBusinessModel());
|
||||
request.setContractCode(signFranchiseDO.getContractCode());
|
||||
}
|
||||
request.setPartnerMobile(lineInfoDO.getMobile());
|
||||
request.setShopCode(shopInfo.getShopCode());
|
||||
|
||||
@@ -4,11 +4,15 @@ import cn.hutool.core.util.RandomUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.dto.FoodTokenDTO;
|
||||
import com.cool.store.dto.GetAccessTokenDTO;
|
||||
import com.cool.store.dto.store.StoreUserPositionDTO;
|
||||
import com.cool.store.dto.store.StoreUserUpdateDTO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.response.caipin.StoreUserResponse;
|
||||
import com.cool.store.response.oppty.OpportunityApiResponse;
|
||||
import com.cool.store.service.ThirdFoodService;
|
||||
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;
|
||||
@@ -21,6 +25,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -45,10 +50,16 @@ public class ThirdFoodServiceImpl implements ThirdFoodService {
|
||||
@Override
|
||||
public String getFoodToken(FoodTokenDTO dto) {
|
||||
// 1. 发送POST请求
|
||||
String url = apiUrl + "/interface/v1/user/getToken";
|
||||
String url = "/v1/user/getToken";
|
||||
return executeApiCall(url, dto, String.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StoreUserResponse pushStoreUser(List<StoreUserUpdateDTO> dto) {
|
||||
String url = "/v1/store/updateStoreUser";
|
||||
return executeApiCall(url, dto, StoreUserResponse.class);
|
||||
}
|
||||
|
||||
|
||||
private <T> T executeApiCall(String url, Object requestBody, Class<T> responseType) {
|
||||
// 1. 打印请求前日志
|
||||
@@ -62,7 +73,7 @@ public class ThirdFoodServiceImpl implements ThirdFoodService {
|
||||
String responseBody = response.body().string();
|
||||
|
||||
// 3. 打印响应日志
|
||||
logResponse(url, response.code(), responseBody);
|
||||
logResponse(apiUrl+ url, response.code(), responseBody);
|
||||
|
||||
if (!response.isSuccessful()) {
|
||||
throw new ServiceException(ErrorCodeEnum.THIRD_API_ERROR,
|
||||
@@ -94,20 +105,24 @@ public class ThirdFoodServiceImpl implements ThirdFoodService {
|
||||
String random = RandomUtil.randomString(20);
|
||||
|
||||
String signString = null;
|
||||
String reqBody = null;
|
||||
try {
|
||||
signString = SignatureUtils.sign("POST","/v1/user/getToken", objectMapper.writeValueAsString(requestBody),timestamp,random);
|
||||
reqBody = objectMapper.writeValueAsString(requestBody);
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
signString = SignatureUtils.sign("POST",url, reqBody,timestamp,random);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(ErrorCodeEnum.THIRD_API_SIGN_ERROR,"加密失败");
|
||||
}
|
||||
|
||||
log.info("签名生成 - 签名结果: {}", signString);
|
||||
|
||||
RequestBody body = RequestBody.create(okhttp3.MediaType.parse("application/json"),
|
||||
JSONObject.toJSONString(requestBody)
|
||||
);
|
||||
RequestBody body = RequestBody.create(okhttp3.MediaType.parse("application/json"), reqBody);
|
||||
|
||||
return new Request.Builder()
|
||||
.url(url)
|
||||
.url(apiUrl + url)
|
||||
.post(body)
|
||||
.addHeader("X-ZhengXin-Sign", signString)
|
||||
.addHeader("X-ZhengXin-SignTime", timestamp)
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.cool.store.utils.UUIDUtils;
|
||||
import com.cool.store.vo.PartnerUserInfoVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.crypto.SecureRandomNumberGenerator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -252,4 +253,30 @@ public class WechatMiniAppServiceImpl implements WechatMiniAppService {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortTermTokenByMobile(MiniProgramFreeLoginDTO param) {
|
||||
HyPartnerUserInfoDO hyPartnerUserInfoDO = hyPartnerUserInfoDAO.selectByMobile(param.getMobile());
|
||||
if (Objects.isNull(hyPartnerUserInfoDO)) {
|
||||
return "";
|
||||
}
|
||||
PartnerUserInfoVO userInfoVO = BeanUtil.toBean(hyPartnerUserInfoDO, PartnerUserInfoVO.class);
|
||||
fillLineInfo(userInfoVO, hyPartnerUserInfoDO.getPartnerId());
|
||||
String token = new SecureRandomNumberGenerator().nextBytes().toHex();
|
||||
String key = MessageFormat.format(CommonConstants.ZXJP_MIN_PROGRAM_SHORT_TERM_LOGIN_FLAG, token);
|
||||
redisUtilPool.setString(key, JSONObject.toJSONString(userInfoVO), CommonConstants.SHORT_TERM_TOKEN_EXPIRE);
|
||||
return token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PartnerUserInfoVO getUserInfoByShortTermToken(String token) {
|
||||
String key = MessageFormat.format(CommonConstants.ZXJP_MIN_PROGRAM_SHORT_TERM_LOGIN_FLAG, token);
|
||||
String userStr = redisUtilPool.getString(key);
|
||||
if (StringUtils.isNotBlank(userStr)) {
|
||||
PartnerUserInfoVO userInfoVO = JSONObject.parseObject(userStr, PartnerUserInfoVO.class);
|
||||
redisUtilPool.delKey(key);
|
||||
return userInfoVO;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ public class SignValidateFilter implements Filter {
|
||||
"/zxjp/**/api/audit/result",
|
||||
"/zxjp/**/api/license",
|
||||
"/zxjp/mini/line/getRegionPayPic",
|
||||
"/zxjp/mini/miniProgram/getUserInfoByToken",
|
||||
"/zxjp/ws/**"
|
||||
|
||||
);
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.context.PartnerUserHolder;
|
||||
import com.cool.store.dto.*;
|
||||
import com.cool.store.dto.store.StoreUserPositionDTO;
|
||||
import com.cool.store.dto.wx.MiniProgramFreeLoginDTO;
|
||||
import com.cool.store.request.OpenApiStoreRequest;
|
||||
import com.cool.store.request.StoreCodeDTO;
|
||||
import com.cool.store.request.*;
|
||||
@@ -49,6 +50,8 @@ public class OpenApiController {
|
||||
StoreService storeService;
|
||||
@Resource
|
||||
MessageTemplateService messageTemplateService;
|
||||
@Resource
|
||||
WechatMiniAppService wechatMiniAppService;
|
||||
|
||||
@PostMapping("/statusRefresh")
|
||||
public ApiResponse<Boolean> statusRefresh(@RequestBody StatusRefreshDTO statusRefreshDTO){
|
||||
@@ -68,6 +71,13 @@ public class OpenApiController {
|
||||
public ApiResponse<PageInfo<StoreDTO>> getStoreList(@RequestBody @Validated OpenApiStoreRequest dto) {
|
||||
return ApiResponse.success(storeService.getStoreExtendFieldInfo(dto.getPageSize(),dto.getPageNum()));
|
||||
}
|
||||
|
||||
@ApiOperation("获取接入物联网门店信息")
|
||||
@PostMapping("/getIoTStoreList")
|
||||
public ApiResponse<PageInfo<StoreNameDTO>> getIotStoreList(@RequestBody @Validated OpenApiStoreRequest dto) {
|
||||
return ApiResponse.success(storeService.getIotStoreList(dto.getPageNum(), dto.getPageSize()));
|
||||
}
|
||||
|
||||
@ApiOperation("新管家回调 刷新收款单状态")
|
||||
@PostMapping("/changeReceiptStatus")
|
||||
public ApiResponse<Boolean> changeReceiptStatus(@RequestBody @Validated ReceiptCallBackRequest request){
|
||||
@@ -169,4 +179,10 @@ public class OpenApiController {
|
||||
public ApiResponse<Boolean> handleMessage(@RequestBody @Validated ThirdHandleMessageRequest request) {
|
||||
return messageTemplateService.thirdHandleMessage(request);
|
||||
}
|
||||
|
||||
@ApiOperation("根据手机号获取短期token")
|
||||
@PostMapping("/getShortTermToken")
|
||||
public ApiResponse<String> getTokenByMobile(@RequestBody @Validated MiniProgramFreeLoginDTO param) {
|
||||
return ApiResponse.success(wechatMiniAppService.getShortTermTokenByMobile(param));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.WechatMiniAppService;
|
||||
import com.cool.store.vo.PartnerUserInfoVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -65,4 +66,11 @@ public class MiniProgramAppController {
|
||||
PartnerUserInfoVO userInfoVO = PartnerUserHolder.getUser();
|
||||
return ResponseResult.success(userInfoVO);
|
||||
}
|
||||
|
||||
@ApiOperation("根据短期token获取用户信息")
|
||||
@ApiImplicitParam(name = "token", value = "短期token", required = true, dataType = "String", paramType = "query")
|
||||
@GetMapping("/getUserInfoByToken")
|
||||
public ResponseResult<PartnerUserInfoVO> getUserInfoByToken(String token) {
|
||||
return ResponseResult.success(wechatMiniAppService.getUserInfoByShortTermToken(token));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.dao.*;
|
||||
import com.cool.store.dto.OpenCityDTO;
|
||||
import com.cool.store.dto.ocr.InvoiceDTO;
|
||||
import com.cool.store.dto.store.StoreUserPositionDTO;
|
||||
import com.cool.store.dto.store.StoreUserUpdateDTO;
|
||||
import com.cool.store.entity.*;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.enums.IDCardSideEnum;
|
||||
@@ -20,6 +22,7 @@ import com.cool.store.request.ShopListSuccessOpenRequest;
|
||||
import com.cool.store.request.xfsgFirstOrderListRequest;
|
||||
import com.cool.store.response.MiniShopsResponse;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.response.caipin.StoreUserResponse;
|
||||
import com.cool.store.response.xfsgFirstOderListResponse;
|
||||
import com.cool.store.service.*;
|
||||
import com.cool.store.utils.poi.ExcelUtil;
|
||||
@@ -29,6 +32,7 @@ import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -77,6 +81,10 @@ public class TestController {
|
||||
|
||||
@Resource
|
||||
ShopStageInfoDAO shopStageInfoDAO;
|
||||
@Resource
|
||||
ThirdFoodService thirdFoodService;
|
||||
@Autowired
|
||||
StoreService storeService;
|
||||
|
||||
@PostMapping("/getFirstOrders")
|
||||
public ResponseResult<xfsgFirstOderListResponse> getFirstOrders(@RequestBody xfsgFirstOrderListRequest storeCodeList) {
|
||||
@@ -354,4 +362,11 @@ public class TestController {
|
||||
public void initTallyBook() {
|
||||
xxlJobHandler.initTallyBook();
|
||||
}
|
||||
|
||||
@GetMapping("/pushStoreUser")
|
||||
public void pushStoreUser(String storeCode){
|
||||
List<StoreUserPositionDTO> storeUser = storeService.getStoreUser(Arrays.asList(storeCode));
|
||||
List<StoreUserUpdateDTO> storeUserUpdateDTOS = JSONObject.parseArray(JSONObject.toJSONString(storeUser), StoreUserUpdateDTO.class);
|
||||
StoreUserResponse storeUserResponse = thirdFoodService.pushStoreUser(storeUserUpdateDTOS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ yls.api.auth.secret=3b56198f096d4009072c927c96fbc8b6
|
||||
#新掌柜账号
|
||||
xzg.api.auth.url=http://webapi.zhengxinfood.com
|
||||
|
||||
zx.food.url=https://datacenter.zhengxinfood.com
|
||||
zx.food.url=https://datacenter.zhengxinfood.com/interface
|
||||
|
||||
cool.api.appKey=k8J7fG2qR5tY9vX3
|
||||
cool.api.secret=wP4sN6dL8zK2xM9c
|
||||
|
||||
@@ -127,7 +127,7 @@ yls.api.auth.secret=3b56198f096d4009072c927c96fbc8b6
|
||||
#新掌柜账号
|
||||
xzg.api.auth.url=http://webapi.zhengxinfood.com
|
||||
|
||||
zx.food.url=https://datacenter.zhengxinfood.com
|
||||
zx.food.url=https://datacenter.zhengxinfood.com/interface
|
||||
|
||||
cool.api.appKey=k8J7fG2qR5tY9vX3
|
||||
cool.api.secret=wP4sN6dL8zK2xM9c
|
||||
|
||||
@@ -125,7 +125,7 @@ zx.big.data.appSecret=35b8b9a400b4430fa022190be0913cd6
|
||||
xzg.api.auth.url=http://webapi.zhengxinfood.com
|
||||
|
||||
|
||||
zx.food.url=https://datacenter.zhengxinshipin.com
|
||||
zx.food.url=https://datacenter.zhengxinshipin.com/interface
|
||||
|
||||
cool.api.appKey=k8J7fG2qR5tY9vX3
|
||||
cool.api.secret=wP4sN6dL8zK2xM9c
|
||||
|
||||
@@ -128,7 +128,7 @@ yls.api.auth.secret=3b56198f096d4009072c927c96fbc8b6
|
||||
#新掌柜账号
|
||||
xzg.api.auth.url=http://webapi.zhengxinfood.com
|
||||
|
||||
zx.food.url=https://datacenter.zhengxinfood.com
|
||||
zx.food.url=https://datacenter.zhengxinfood.com/interface
|
||||
|
||||
cool.api.appKey=k8J7fG2qR5tY9vX3
|
||||
cool.api.secret=wP4sN6dL8zK2xM9c
|
||||
|
||||
Reference in New Issue
Block a user