Merge #119 into master from cc_20260508_open_store_req
门店新开店需求7&主数据需求2
* cc_20260508_open_store_req: (4 commits squashed)
- fix:未开业门店试营业日期
- fix:开业日期报备不同步门店状态
- fix:修改门店开业日期判断条件修改
- Merge branch 'master' into cc_20260508_open_store_req
# Conflicts:
#	coolstore-partner-web/src/main/java/com/cool/store/job/XxlJobHandler.java
Signed-off-by: 王非凡 <accounts_67eba0c5fee9c49c80c8e2b4@mail.teambition.com>
Merged-by: 正新 <accounts_6964c7bcd2a2c377c5bbd01b@mail.teambition.com>
CR-link: https://codeup.aliyun.com/692ea314dec569489f6f167c/hangzhou/java/custom_zxjp/change/119
This commit is contained in:
@@ -2,6 +2,7 @@ package com.cool.store.dao;
|
||||
|
||||
import cn.hutool.core.collection.CollStreamUtil;
|
||||
import com.cool.store.dto.store.StoreAddressDTO;
|
||||
import com.cool.store.dto.store.StoreExtendSoftOpenDTO;
|
||||
import com.cool.store.dto.store.StoreOrderTimeDTO;
|
||||
import com.cool.store.entity.StoreDO;
|
||||
import com.cool.store.enums.StoreStatusEnum;
|
||||
@@ -120,6 +121,13 @@ public class StoreDao {
|
||||
return storeMapper.getAllStoreIdAndNum(storeStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询拥有门店编码的门店id及编码
|
||||
*/
|
||||
public List<StoreDO> getExistStoreNumStore(List<String> storeStatus) {
|
||||
return storeMapper.getExistStoreNumStore(storeStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询门店积分
|
||||
* @param storeId 门店id
|
||||
@@ -176,6 +184,14 @@ public class StoreDao {
|
||||
if (Objects.isNull(storeId)||Objects.isNull(storeStatus)||Objects.isNull(actualOpenDate))
|
||||
storeMapper.updateStoreStatus(storeId,storeStatus,actualOpenDate);
|
||||
}
|
||||
/**
|
||||
* 修改门店开业日期
|
||||
* @param storeId 门店id
|
||||
* @param actualOpenDate 开业日期
|
||||
*/
|
||||
public void updateStoreOpenDate(String storeId, Date actualOpenDate) {
|
||||
storeMapper.updateStoreOpenDate(storeId, actualOpenDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂停营业
|
||||
@@ -275,4 +291,21 @@ public class StoreDao {
|
||||
public String getPrivateSphereQrCode(String storeId){
|
||||
return storeMapper.getPrivateSphereQrCode(storeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量新增或编辑开始试营业日期
|
||||
*/
|
||||
public void insertOrUpdateSoftOpenDate(List<StoreExtendSoftOpenDTO> list) {
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
storeMapper.insertOrUpdateSoftOpenDate(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改门店状态
|
||||
*/
|
||||
public void updateStatusBatch(List<String> storeIds, String storeStatus) {
|
||||
storeMapper.updateStatusBatch(storeIds, storeStatus);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.cool.store.mapper;
|
||||
|
||||
import com.cool.store.dto.store.StoreAddressDTO;
|
||||
import com.cool.store.dto.store.StoreAreaDTO;
|
||||
import com.cool.store.dto.store.StoreExtendSoftOpenDTO;
|
||||
import com.cool.store.dto.store.StoreOrderTimeDTO;
|
||||
import com.cool.store.entity.StoreDO;
|
||||
import com.cool.store.response.MiniShopsResponse;
|
||||
@@ -69,6 +70,11 @@ public interface StoreMapper {
|
||||
*/
|
||||
List<StoreDO> getAllStoreIdAndNum(@Param("storeStatus") List<String> storeStatus);
|
||||
|
||||
/**
|
||||
* 查询拥有门店编码的门店id及编码
|
||||
*/
|
||||
List<StoreDO> getExistStoreNumStore(@Param("storeStatus") List<String> storeStatus);
|
||||
|
||||
/**
|
||||
* 查询门店积分
|
||||
* @param storeId 门店id
|
||||
@@ -97,6 +103,13 @@ public interface StoreMapper {
|
||||
void updateStoreStatus(@Param("storeId") String storeId,
|
||||
@Param("storeStatus") String storeStatus,
|
||||
@Param("actualOpenDate") Date actualOpenDate);
|
||||
/**
|
||||
* 修改门店开业日期
|
||||
* @param storeId 门店id
|
||||
* @param actualOpenDate 开业日期
|
||||
*/
|
||||
void updateStoreOpenDate(@Param("storeId") String storeId,
|
||||
@Param("actualOpenDate") Date actualOpenDate);
|
||||
|
||||
int updateStatus(@Param("storeId") String storeId,
|
||||
@Param("storeStatus") String storeStatus);
|
||||
@@ -160,4 +173,14 @@ public interface StoreMapper {
|
||||
int batchUpdateAddress(@Param("list") List<StoreDO> storeList);
|
||||
|
||||
String getPrivateSphereQrCode(@Param("storeId") String storeId);
|
||||
|
||||
/**
|
||||
* 批量新增或编辑开始试营业日期
|
||||
*/
|
||||
void insertOrUpdateSoftOpenDate(@Param("list") List<StoreExtendSoftOpenDTO> list);
|
||||
|
||||
/**
|
||||
* 批量修改门店状态
|
||||
*/
|
||||
void updateStatusBatch(@Param("storeIds") List<String> storeIds, @Param("storeStatus") String storeStatus);
|
||||
}
|
||||
|
||||
@@ -276,6 +276,18 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getExistStoreNumStore" resultType="com.cool.store.entity.StoreDO">
|
||||
SELECT store_id, store_num
|
||||
FROM store_${enterpriseId}
|
||||
WHERE is_delete = 'effective' AND store_num IS NOT NULL AND store_num != ''
|
||||
<if test="storeStatus != null and !storeStatus.isEmpty()">
|
||||
AND store_status IN
|
||||
<foreach item="item" collection="storeStatus" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getStoreScore" resultType="java.math.BigDecimal">
|
||||
SELECT score FROM store_extend_info_${enterpriseId}
|
||||
WHERE store_id = #{storeId}
|
||||
@@ -298,7 +310,13 @@
|
||||
<update id="updateStoreStatus">
|
||||
UPDATE store_${enterpriseId}
|
||||
SET store_status = #{storeStatus},
|
||||
actual_open_date = #{actualOpenDate}
|
||||
open_date = #{actualOpenDate}
|
||||
WHERE store_id = #{storeId} AND is_delete = 'effective'
|
||||
</update>
|
||||
|
||||
<update id="updateStoreOpenDate">
|
||||
UPDATE store_${enterpriseId}
|
||||
SET open_date = #{actualOpenDate}
|
||||
WHERE store_id = #{storeId} AND is_delete = 'effective'
|
||||
</update>
|
||||
|
||||
@@ -438,4 +456,23 @@
|
||||
SELECT private_sphere_qr FROM store_extend_info_${enterpriseId}
|
||||
WHERE store_id = #{storeId}
|
||||
</select>
|
||||
|
||||
<insert id="insertOrUpdateSoftOpenDate">
|
||||
INSERT INTO store_extend_info_${enterpriseId}(store_id, soft_open_date)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.storeId}, #{item.softOpenDate})
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
soft_open_date = VALUES(soft_open_date)
|
||||
</insert>
|
||||
|
||||
<update id="updateStatusBatch">
|
||||
UPDATE store_${enterpriseId}
|
||||
SET store_status = #{storeStatus}
|
||||
WHERE store_id IN
|
||||
<foreach item="item" collection="storeIds" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.cool.store.dto.store;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 门店试营业日期DTO
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/5/8
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class StoreExtendSoftOpenDTO {
|
||||
@ApiModelProperty("门店id")
|
||||
private String storeId;
|
||||
|
||||
@ApiModelProperty("开始试营业日期")
|
||||
private Date softOpenDate;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.cool.store.request.storeopen;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 门店未开通缺失日表请求
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/5/8
|
||||
*/
|
||||
@Data
|
||||
public class StoreDailyNonOpenMissingRequest {
|
||||
@ApiModelProperty("单日查询,格式 yyyy-MM-dd")
|
||||
private String date;
|
||||
|
||||
@ApiModelProperty("范围开始日期,格式 yyyy-MM-dd")
|
||||
private String startDate;
|
||||
|
||||
@ApiModelProperty("范围结束日期,格式 yyyy-MM-dd")
|
||||
private String endDate;
|
||||
|
||||
@ApiModelProperty("单个门店编码")
|
||||
private String shopSn;
|
||||
|
||||
@ApiModelProperty("多个门店编码")
|
||||
private List<String> shopSns;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.cool.store.response.storeopen;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 门店未开通缺失日表响应
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/5/8
|
||||
*/
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class StoreDailyNonOpenMissingResponse {
|
||||
/**
|
||||
* 数据日期,格式 yyyy-MM-dd
|
||||
*/
|
||||
private String date;
|
||||
|
||||
/**
|
||||
* 门店编码
|
||||
*/
|
||||
private String shopSn;
|
||||
|
||||
/**
|
||||
* CRM 门店状态
|
||||
*/
|
||||
private String crmStoreStatus;
|
||||
|
||||
/**
|
||||
* 当日金额
|
||||
*/
|
||||
private BigDecimal dailyAmount;
|
||||
|
||||
/**
|
||||
* 创建时间,格式 yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
private String createdAt;
|
||||
|
||||
/**
|
||||
* 更新时间,格式 yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
private String updatedAt;
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.cool.store.request.storeopen.StoreDailyNonOpenMissingRequest;
|
||||
import com.cool.store.request.storeopen.StoreMonthRevenueRequest;
|
||||
import com.cool.store.request.storeopen.StoreRecipeDailySalesRequest;
|
||||
import com.cool.store.request.storeopen.StoreRecipesRequest;
|
||||
import com.cool.store.response.storeopen.StoreDailyNonOpenMissingResponse;
|
||||
import com.cool.store.response.storeopen.StoreMonthRevenueResponse;
|
||||
import com.cool.store.response.storeopen.StoreRecipeDailySalesResponse;
|
||||
import com.cool.store.response.storeopen.StoreRecipesResponse;
|
||||
@@ -40,4 +42,12 @@ public interface ThirdStoreOpenDataService {
|
||||
* @return 菜品种类列表
|
||||
*/
|
||||
List<StoreRecipesResponse> getRecipes(StoreRecipesRequest request);
|
||||
|
||||
/**
|
||||
* 查询门店未开通缺失日表数据
|
||||
*
|
||||
* @param request 请求参数
|
||||
* @return 缺失日表数据列表
|
||||
*/
|
||||
List<StoreDailyNonOpenMissingResponse> getDailyNonOpenMissing(StoreDailyNonOpenMissingRequest request);
|
||||
}
|
||||
@@ -1151,7 +1151,7 @@ public class ShopServiceImpl implements ShopService {
|
||||
//更新门店为开业状态 且使用开业日期
|
||||
StoreDO store = storeDao.getByStoreNum(shopInfo.getShopCode());
|
||||
if (store!=null){
|
||||
storeDao.updateStoreStatus(store.getStoreId(),"open",request.getOpenDate());
|
||||
storeDao.updateStoreOpenDate(store.getStoreId(), request.getOpenDate());
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@@ -6,10 +6,12 @@ import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.request.storeopen.StoreMonthRevenueRequest;
|
||||
import com.cool.store.request.storeopen.StoreRecipeDailySalesRequest;
|
||||
import com.cool.store.request.storeopen.StoreRecipesRequest;
|
||||
import com.cool.store.request.storeopen.StoreDailyNonOpenMissingRequest;
|
||||
import com.cool.store.response.storeopen.StoreMonthRevenueResponse;
|
||||
import com.cool.store.response.storeopen.StoreOpenApiResponse;
|
||||
import com.cool.store.response.storeopen.StoreRecipeDailySalesResponse;
|
||||
import com.cool.store.response.storeopen.StoreRecipesResponse;
|
||||
import com.cool.store.response.storeopen.StoreDailyNonOpenMissingResponse;
|
||||
import com.cool.store.service.ThirdStoreOpenDataService;
|
||||
import com.cool.store.utils.StoreOpenSigner;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
@@ -74,6 +76,13 @@ public class ThirdStoreOpenDataServiceImpl implements ThirdStoreOpenDataService
|
||||
return executeApiCall(url, path, request, StoreRecipesResponse.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StoreDailyNonOpenMissingResponse> getDailyNonOpenMissing(StoreDailyNonOpenMissingRequest request) {
|
||||
String path = "/open/v1/store/dailyNonOpenMissing";
|
||||
String url = apiUrl + path;
|
||||
return executeApiCall(url, path, request, StoreDailyNonOpenMissingResponse.class);
|
||||
}
|
||||
|
||||
private <T> List<T> executeApiCall(String url, String path, Object request, Class<T> responseType) {
|
||||
logRequest(url, request);
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ import com.cool.store.dao.bonus.BonusDistributionRuleDAO;
|
||||
import com.cool.store.dao.tp.TpApplyFormDAO;
|
||||
import com.cool.store.dao.wallet.WalletTradeDAO;
|
||||
import com.cool.store.dto.*;
|
||||
import com.cool.store.dto.store.StoreExtendSoftOpenDTO;
|
||||
import com.cool.store.dto.store.StoreMasterIssueDTO;
|
||||
import com.cool.store.dto.store.StoreOrderTimeDTO;
|
||||
import com.cool.store.entity.*;
|
||||
import com.cool.store.entity.bonus.BonusDistributionRuleDO;
|
||||
@@ -27,9 +29,11 @@ import com.cool.store.mq.producer.SimpleMessageService;
|
||||
import com.cool.store.mq.util.HttpRestTemplateService;
|
||||
import com.cool.store.request.ZxjpApiRequest;
|
||||
import com.cool.store.request.bigdata.LatestOrderDateRequest;
|
||||
import com.cool.store.request.storeopen.StoreDailyNonOpenMissingRequest;
|
||||
import com.cool.store.request.tp.TpApplyQueryRequest;
|
||||
import com.cool.store.request.close.store.CloseStoreApplyRequest;
|
||||
import com.cool.store.response.bigdata.LatestOrderDateResponse;
|
||||
import com.cool.store.response.storeopen.StoreDailyNonOpenMissingResponse;
|
||||
import com.cool.store.service.*;
|
||||
import com.cool.store.service.bonus.BonusService;
|
||||
import com.cool.store.service.close.CloseStoreRefundService;
|
||||
@@ -151,6 +155,8 @@ public class XxlJobHandler {
|
||||
BonusService bonusService;
|
||||
@Resource
|
||||
CloseStoreInfoDAO closeStoreInfoDAO;
|
||||
@Resource
|
||||
ThirdStoreOpenDataService thirdStoreOpenDataService;
|
||||
|
||||
private static final DateTimeFormatter MONTH_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM");
|
||||
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
@@ -869,4 +875,58 @@ public class XxlJobHandler {
|
||||
XxlJobHelper.handleFail("执行失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 未开业门店
|
||||
*/
|
||||
@XxlJob("softOpenDate")
|
||||
public void softOpenDate() {
|
||||
MDCUtils.put(CommonConstants.REQUEST_ID, UUID.randomUUID().toString());
|
||||
log.info("------start softOpenDate------");
|
||||
try {
|
||||
int pageNum = 1, pageSize = CommonConstants.BATCH_SIZE;
|
||||
boolean hasNext = true;
|
||||
List<StoreExtendSoftOpenDTO> updateList = new ArrayList<>();
|
||||
while (hasNext) {
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
List<StoreDO> storeList = storeDao.getExistStoreNumStore(Collections.singletonList(StoreStatusEnum.NOT_OPEN.getValue()));
|
||||
if (CollectionUtils.isEmpty(storeList)) {
|
||||
break;
|
||||
}
|
||||
hasNext = storeList.size() >= pageSize;
|
||||
Map<String, String> storeMap = CollStreamUtil.toMap(storeList, StoreDO::getStoreNum, StoreDO::getStoreId);
|
||||
StoreDailyNonOpenMissingRequest request = new StoreDailyNonOpenMissingRequest();
|
||||
request.setShopSns(new ArrayList<>(storeMap.keySet()));
|
||||
List<StoreDailyNonOpenMissingResponse> responses = thirdStoreOpenDataService.getDailyNonOpenMissing(request);
|
||||
if (CollectionUtils.isNotEmpty(responses)) {
|
||||
List<StoreExtendSoftOpenDTO> list = CollStreamUtil.toList(responses, v -> {
|
||||
try {
|
||||
return new StoreExtendSoftOpenDTO(storeMap.get(v.getShopSn()), DateUtils.parseDate(v.getDate(), "yyyy-MM-dd"));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
updateList.addAll(list);
|
||||
}
|
||||
pageNum++;
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(updateList)) {
|
||||
storeDao.insertOrUpdateSoftOpenDate(updateList);
|
||||
List<String> storeIds = CollStreamUtil.toList(updateList, StoreExtendSoftOpenDTO::getStoreId);
|
||||
// 修改门店状态
|
||||
storeDao.updateStatusBatch(storeIds, StoreStatusEnum.OPEN.getValue());
|
||||
// 主数据下发
|
||||
try {
|
||||
StoreMasterIssueDTO storeMasterIssueDTO = new StoreMasterIssueDTO(eid, storeIds);
|
||||
simpleMessageService.send(JSONObject.toJSONString(storeMasterIssueDTO), RocketMqTagEnum.STORE_MASTER_ISSUE);
|
||||
} catch (Exception e) {
|
||||
log.error("mq通知主应用下发门店主数据失败");
|
||||
}
|
||||
}
|
||||
log.info("------end softOpenDate------");
|
||||
} catch (Exception e) {
|
||||
log.error("softOpenDate执行失败", e);
|
||||
XxlJobHelper.handleFail("执行失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user