feat:门店最近订货时间定时任务

This commit is contained in:
wangff
2025-10-27 13:32:23 +08:00
parent 4063cdcfee
commit b2076cc6c5
11 changed files with 277 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
package com.cool.store.dao;
import com.cool.store.dto.store.StoreOrderTimeDTO;
import com.cool.store.entity.StoreDO;
import com.cool.store.mapper.StoreMapper;
import com.cool.store.response.MiniShopsResponse;
@@ -83,4 +84,22 @@ public class StoreDao {
return storeMapper.getStoreNumByStoreCodes(storeCodeIds);
}
/**
* 新增或编辑最新订货时间
* @param dtoList 门店最新订货时间DTO列表
* @return int
*/
public void batchInsertOrUpdateOrderTime(List<StoreOrderTimeDTO> dtoList) {
if (CollectionUtils.isEmpty(dtoList)) {
return ;
}
storeMapper.batchInsertOrUpdateOrderTime(dtoList);
}
/**
* 查询所有门店id和门店编码
*/
public List<StoreDO> getAllStoreIdAndNum() {
return storeMapper.getAllStoreIdAndNum();
}
}

View File

@@ -1,6 +1,7 @@
package com.cool.store.mapper;
import com.cool.store.dto.store.StoreAreaDTO;
import com.cool.store.dto.store.StoreOrderTimeDTO;
import com.cool.store.entity.StoreDO;
import com.cool.store.response.MiniShopsResponse;
import org.apache.ibatis.annotations.Mapper;
@@ -47,4 +48,15 @@ public interface StoreMapper {
List<StoreAreaDTO> listStoreByRegionPathList(@Param("regionPathList") List<String> regionPathList);
/**
* 批量新增或编辑最新订货时间
* @param dtoList 门店最新订货时间DTO列表
* @return int
*/
int batchInsertOrUpdateOrderTime(@Param("dtoList") List<StoreOrderTimeDTO> dtoList);
/**
* 查询所有门店id和门店编码
*/
List<StoreDO> getAllStoreIdAndNum();
}

View File

@@ -222,4 +222,31 @@
</foreach>
</if>
</select>
<insert id="batchInsertOrUpdateOrderTime">
INSERT INTO store_extend_info_${enterpriseId}
<trim prefix="(" suffix=")" suffixOverrides=",">
store_id,
latest_order_time
</trim>
VALUES
<foreach collection="dtoList" item="dto" separator=",">
<trim prefix="(" suffix=")" suffixOverrides=",">
#{dto.storeId},
#{dto.latestOrderTime}
</trim>
</foreach>
ON DUPLICATE KEY UPDATE
<trim suffixOverrides=",">
store_id = VALUES(store_id),
latest_order_time = VALUES(latest_order_time),
update_time = now(),
</trim>
</insert>
<select id="getAllStoreIdAndNum" resultType="com.cool.store.entity.StoreDO">
SELECT store_id, store_num
FROM store_${enterpriseId}
WHERE is_delete = 'effective'
</select>
</mapper>