Merge branch 'cc_20250710_userRegion' into 'master'

Cc 20250710 user region

See merge request hangzhou/java/custom_zxjp!138
This commit is contained in:
苏竹红
2025-07-23 09:36:11 +00:00
9 changed files with 48 additions and 14 deletions

View File

@@ -28,6 +28,7 @@ public class OpenSignatureUtil {
.filter(e -> !"appKey".equals(e.getKey())) .filter(e -> !"appKey".equals(e.getKey()))
.filter(e -> !"timestamp".equals(e.getKey())) .filter(e -> !"timestamp".equals(e.getKey()))
.filter(e -> !"sign".equals(e.getKey())) .filter(e -> !"sign".equals(e.getKey()))
.filter(e -> e.getValue() != null && !e.getValue().isEmpty())
.collect(Collectors.toMap( .collect(Collectors.toMap(
Map.Entry::getKey, Map.Entry::getKey,
Map.Entry::getValue Map.Entry::getValue
@@ -45,7 +46,7 @@ public class OpenSignatureUtil {
// 3.2 添加固定参数(不参与排序) // 3.2 添加固定参数(不参与排序)
sb.append("appkey=").append(appKey) sb.append("appkey=").append(appKey)
.append("&timestamp=").append(timestamp); .append("&timestamp=").append(timestamp);
log.info("待签名字符串:{}", sb);
// 4. 生成签名 // 4. 生成签名
return hmacSha256(sb.toString(), appSecret); return hmacSha256(sb.toString(), appSecret);
} }

View File

@@ -76,5 +76,11 @@ public class StoreDao {
return storeMapper.list(); return storeMapper.list();
} }
public List<StoreDO> getStoreNumByStoreCodes(List<String> storeCodeIds) {
if(CollectionUtils.isEmpty(storeCodeIds)) {
return Lists.newArrayList();
}
return storeMapper.getStoreNumByStoreCodes(storeCodeIds);
}
} }

View File

@@ -43,4 +43,6 @@ public interface StoreMapper {
List<StoreAreaDTO> getStoreAreaList( @Param("storeIds") List<String> storeIds); List<StoreAreaDTO> getStoreAreaList( @Param("storeIds") List<String> storeIds);
List<StoreDO> getStoreNumByStoreCodes(@Param("storeCodeIds") List<String> storeCodeIds);
} }

View File

@@ -144,6 +144,15 @@
</where> </where>
</select> </select>
<select id="getStoreNumByStoreCodes" resultMap="BaseResultMap">
select *
from store_${enterpriseId}
where is_delete = 'effective'
<if test="storeCodeIds != null">
<foreach collection="storeCodeIds" item="item" separator="," open="and store_num in (" close=")">
#{item}
</foreach>
</if>
</select>
</mapper> </mapper>

View File

@@ -0,0 +1,15 @@
package com.cool.store.request;
import lombok.Data;
import java.util.List;
/**
* @Author suzhuhong
* @Date 2025/7/23 9:24
* @Version 1.0
*/
@Data
public class StoreCodeDTO {
private List<String> storeCodeList;
}

View File

@@ -5,6 +5,8 @@ import com.cool.store.dto.store.StoreUserPositionDTO;
import com.cool.store.response.MiniShopsResponse; import com.cool.store.response.MiniShopsResponse;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import java.util.List;
/** /**
* @Author suzhuhong * @Author suzhuhong
* @Date 2025/5/13 9:56 * @Date 2025/5/13 9:56
@@ -23,6 +25,6 @@ public interface StoreService {
PageInfo<MiniShopsResponse> getStoreListByMobile(String mobile,Integer pageNum,Integer pageSize,String storeName,String storeNum); PageInfo<MiniShopsResponse> getStoreListByMobile(String mobile,Integer pageNum,Integer pageSize,String storeName,String storeNum);
PageInfo<StoreUserPositionDTO> getStoreUser(Integer pageSize, Integer pageNum); List<StoreUserPositionDTO> getStoreUser(List<String> storeCodeList);
} }

View File

@@ -110,15 +110,13 @@ public class StoreServiceImpl implements StoreService {
} }
@Override @Override
public PageInfo<StoreUserPositionDTO> getStoreUser(Integer pageSize, Integer pageNum) { public List<StoreUserPositionDTO> getStoreUser(List<String> storeCodeList) {
if (pageSize>=100){ if (CollectionUtils.isNotEmpty(storeCodeList)&&storeCodeList.size()>=100){
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE,"单次最多获取100条门店数据"); throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE,"单次最多获取100条门店数据");
} }
PageHelper.startPage(pageNum,pageSize); List<StoreDO> list = storeDao.getStoreNumByStoreCodes(storeCodeList);
List<StoreDO> list = storeDao.list();
PageInfo info = new PageInfo<>(list);
if (CollectionUtils.isEmpty(list)){ if (CollectionUtils.isEmpty(list)){
return info; return new ArrayList<>();
} }
List<StoreUserPositionDTO> result = new ArrayList<>(); List<StoreUserPositionDTO> result = new ArrayList<>();
list.forEach(x->{ list.forEach(x->{
@@ -143,8 +141,7 @@ public class StoreServiceImpl implements StoreService {
storeUserPositionDTO.setUserList(userList); storeUserPositionDTO.setUserList(userList);
result.add(storeUserPositionDTO); result.add(storeUserPositionDTO);
}); });
info.setList(result); return result;
return info;
} }

View File

@@ -58,7 +58,7 @@ public class OpenApiValidateFilter implements Filter {
} }
MDC.put(CommonConstants.REQUEST_ID, UUIDUtils.get32UUID()); MDC.put(CommonConstants.REQUEST_ID, UUIDUtils.get32UUID());
//statusRefresh 放开不需要验签 //statusRefresh 放开不需要验签
if(uri.startsWith("/zxjp/open/v1")){ if(uri.startsWith("/zxjp/open/v1/statusRefresh")||uri.startsWith("/zxjp/open/v1/getStoreUser")){
filterChain.doFilter(servletRequest, response); filterChain.doFilter(servletRequest, response);
return; return;
} }

View File

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.cool.store.dto.*; import com.cool.store.dto.*;
import com.cool.store.dto.store.StoreUserPositionDTO; import com.cool.store.dto.store.StoreUserPositionDTO;
import com.cool.store.request.OpenApiStoreRequest; import com.cool.store.request.OpenApiStoreRequest;
import com.cool.store.request.StoreCodeDTO;
import com.cool.store.request.xgj.FranchiseFeeCallBackRequest; import com.cool.store.request.xgj.FranchiseFeeCallBackRequest;
import com.cool.store.request.xgj.ReceiptCallBackRequest; import com.cool.store.request.xgj.ReceiptCallBackRequest;
import com.cool.store.response.ResponseResult; import com.cool.store.response.ResponseResult;
@@ -20,6 +21,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
/** /**
* @Author suzhuhong * @Author suzhuhong
@@ -74,8 +76,8 @@ public class OpenApiController {
} }
@ApiOperation("获取门店人员信息") @ApiOperation("获取门店人员信息")
@PostMapping("/getStoreUser") @PostMapping("/getStoreUser")
public ApiResponse<PageInfo<StoreUserPositionDTO>> getStoreUser(@RequestBody @Validated OpenApiStoreRequest dto) { public ApiResponse<List<StoreUserPositionDTO>> getStoreUser(@RequestBody @Validated StoreCodeDTO dto) {
return ApiResponse.success(storeService.getStoreUser(dto.getPageSize(),dto.getPageNum())); return ApiResponse.success(storeService.getStoreUser(dto.getStoreCodeList()));
} }
} }