diff --git a/coolstore-partner-dao/src/main/java/com/cool/store/dao/store/StoreMaterialBlacklistDAO.java b/coolstore-partner-dao/src/main/java/com/cool/store/dao/store/StoreMaterialBlacklistDAO.java new file mode 100644 index 000000000..a48e71c03 --- /dev/null +++ b/coolstore-partner-dao/src/main/java/com/cool/store/dao/store/StoreMaterialBlacklistDAO.java @@ -0,0 +1,31 @@ +package com.cool.store.dao.store; + +import com.cool.store.entity.store.StoreMaterialBlacklistDO; +import com.cool.store.mapper.store.StoreMaterialBlacklistMapper; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Repository; +import tk.mybatis.mapper.entity.Example; + +import java.util.List; + +/** + *

+ * 门店物料黑名单 + *

+ * + * @author wangff + * @since 2026/3/31 + */ +@Repository +@RequiredArgsConstructor +public class StoreMaterialBlacklistDAO { + private final StoreMaterialBlacklistMapper storeMaterialBlacklistMapper; + + public List getByStoreId(String storeId) { + Example example = new Example(StoreMaterialBlacklistDO.class); + example.createCriteria() + .andEqualTo("storeId", storeId); + example.setOrderByClause("create_time DESC"); + return storeMaterialBlacklistMapper.selectByExample(example); + } +} diff --git a/coolstore-partner-dao/src/main/java/com/cool/store/mapper/store/StoreMaterialBlacklistMapper.java b/coolstore-partner-dao/src/main/java/com/cool/store/mapper/store/StoreMaterialBlacklistMapper.java new file mode 100644 index 000000000..d4b422c59 --- /dev/null +++ b/coolstore-partner-dao/src/main/java/com/cool/store/mapper/store/StoreMaterialBlacklistMapper.java @@ -0,0 +1,11 @@ +package com.cool.store.mapper.store; + +import com.cool.store.entity.store.StoreMaterialBlacklistDO; +import tk.mybatis.mapper.common.Mapper; + +/** + * @author zhangchenbiao + * @date 2026-03-30 09:31 + */ +public interface StoreMaterialBlacklistMapper extends Mapper { +} \ No newline at end of file diff --git a/coolstore-partner-model/src/main/java/com/cool/store/entity/store/StoreMaterialBlacklistDO.java b/coolstore-partner-model/src/main/java/com/cool/store/entity/store/StoreMaterialBlacklistDO.java new file mode 100644 index 000000000..8f2b92b6f --- /dev/null +++ b/coolstore-partner-model/src/main/java/com/cool/store/entity/store/StoreMaterialBlacklistDO.java @@ -0,0 +1,44 @@ +package com.cool.store.entity.store; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.persistence.Table; +import java.io.Serializable; +import java.util.Date; + +/** + * 门店物料黑名单 + * @author wangff + * @date 2026-03-30 09:31 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Table(name = "store_material_blacklist_${enterpriseId}") +public class StoreMaterialBlacklistDO implements Serializable { + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("门店id") + private String storeId; + + @ApiModelProperty("限制物料") + private String material; + + @ApiModelProperty("限制原因") + private String reason; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("创建人id") + private String createUserId; + + @ApiModelProperty("创建时间") + private Date createTime; +} \ No newline at end of file diff --git a/coolstore-partner-model/src/main/java/com/cool/store/request/store/StoreMaterialBlacklistQueryRequest.java b/coolstore-partner-model/src/main/java/com/cool/store/request/store/StoreMaterialBlacklistQueryRequest.java new file mode 100644 index 000000000..35d446bff --- /dev/null +++ b/coolstore-partner-model/src/main/java/com/cool/store/request/store/StoreMaterialBlacklistQueryRequest.java @@ -0,0 +1,16 @@ +package com.cool.store.request.store; + +import com.cool.store.common.PageBasicInfo; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 门店物料黑名单查询请求 + * @author wangff + * @date 2026-03-30 + */ +@Data +public class StoreMaterialBlacklistQueryRequest extends PageBasicInfo { + @ApiModelProperty("门店id") + private String storeId; +} \ No newline at end of file diff --git a/coolstore-partner-model/src/main/java/com/cool/store/vo/store/StoreMaterialBlacklistVO.java b/coolstore-partner-model/src/main/java/com/cool/store/vo/store/StoreMaterialBlacklistVO.java new file mode 100644 index 000000000..9cb31d36b --- /dev/null +++ b/coolstore-partner-model/src/main/java/com/cool/store/vo/store/StoreMaterialBlacklistVO.java @@ -0,0 +1,47 @@ +package com.cool.store.vo.store; + +import com.cool.store.annotation.DictField; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * 门店物料黑名单VO + * @author wangff + * @date 2026-03-30 + */ +@Data +public class StoreMaterialBlacklistVO implements Serializable { + @ApiModelProperty("id") + private Long id; + + @ApiModelProperty("门店id") + private String storeId; + + @ApiModelProperty("门店编码") + private String storeNum; + + @ApiModelProperty("门店名称") + private String storeName; + + @ApiModelProperty("所属大区名称") + private String branchName; + + @ApiModelProperty("限制物料") + private String material; + + @ApiModelProperty("限制物料名称") + @DictField + private String materialName; + + @ApiModelProperty("限制原因") + private String reason; + + @ApiModelProperty("限制原因名称") + @DictField + private String reasonName; + + @ApiModelProperty("备注") + private String remark; +} \ No newline at end of file diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/store/StoreMaterialBlacklistService.java b/coolstore-partner-service/src/main/java/com/cool/store/service/store/StoreMaterialBlacklistService.java new file mode 100644 index 000000000..f293780a3 --- /dev/null +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/store/StoreMaterialBlacklistService.java @@ -0,0 +1,20 @@ +package com.cool.store.service.store; + +import com.cool.store.request.store.StoreMaterialBlacklistQueryRequest; +import com.cool.store.vo.store.StoreMaterialBlacklistVO; +import com.github.pagehelper.PageInfo; + +/** + * 门店物料黑名单服务 + * @author wangff + * @date 2026-03-30 + */ +public interface StoreMaterialBlacklistService { + + /** + * 分页查询 + * @param request 查询请求 + * @return 分页结果 + */ + PageInfo pageByStoreId(StoreMaterialBlacklistQueryRequest request); +} \ No newline at end of file diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/store/impl/StoreMaterialBlacklistServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/store/impl/StoreMaterialBlacklistServiceImpl.java new file mode 100644 index 000000000..cbe3b8c63 --- /dev/null +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/store/impl/StoreMaterialBlacklistServiceImpl.java @@ -0,0 +1,62 @@ +package com.cool.store.service.store.impl; + +import com.cool.store.dao.RegionDao; +import com.cool.store.dao.StoreDao; +import com.cool.store.dao.store.StoreMaterialBlacklistDAO; +import com.cool.store.entity.RegionDO; +import com.cool.store.entity.StoreDO; +import com.cool.store.entity.store.StoreMaterialBlacklistDO; +import com.cool.store.enums.ErrorCodeEnum; +import com.cool.store.exception.ServiceException; +import com.cool.store.request.store.StoreMaterialBlacklistQueryRequest; +import com.cool.store.service.dict.impl.DictService; +import com.cool.store.service.store.StoreMaterialBlacklistService; +import com.cool.store.utils.BeanUtil; +import com.cool.store.vo.store.StoreMaterialBlacklistVO; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.util.*; + +/** + * 门店物料黑名单服务实现 + * @author wangff + * @date 2026-03-30 + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class StoreMaterialBlacklistServiceImpl implements StoreMaterialBlacklistService { + + private final StoreMaterialBlacklistDAO storeMaterialBlacklistDAO; + private final StoreDao storeDao; + private final RegionDao regionDao; + private final DictService dictService; + + + @Override + public PageInfo pageByStoreId(StoreMaterialBlacklistQueryRequest request) { + StoreDO storeDO = storeDao.getByStoreId(request.getStoreId()); + if (Objects.isNull(storeDO)) { + throw new ServiceException(ErrorCodeEnum.STORE_NOT_FIND); + } + PageHelper.startPage(request.getPageNum(), request.getPageSize()); + List list = storeMaterialBlacklistDAO.getByStoreId(request.getStoreId()); + PageInfo page = new PageInfo<>(list); + + PageInfo result = BeanUtil.toPage(page, StoreMaterialBlacklistVO.class); + RegionDO branch = regionDao.getRegionById(storeDO.getBranch()); + for (StoreMaterialBlacklistVO vo : result.getList()) { + vo.setStoreNum(storeDO.getStoreNum()); + vo.setStoreName(storeDO.getStoreName()); + if (Objects.nonNull(branch)) { + vo.setBranchName(branch.getName()); + } + } + dictService.fillDictField(result.getList()); + return result; + } +} \ No newline at end of file diff --git a/coolstore-partner-web/src/main/java/com/cool/store/controller/webc/MiniStoreMaterialBlacklistController.java b/coolstore-partner-web/src/main/java/com/cool/store/controller/webc/MiniStoreMaterialBlacklistController.java new file mode 100644 index 000000000..4f422c031 --- /dev/null +++ b/coolstore-partner-web/src/main/java/com/cool/store/controller/webc/MiniStoreMaterialBlacklistController.java @@ -0,0 +1,35 @@ +package com.cool.store.controller.webc; + +import com.cool.store.request.store.StoreMaterialBlacklistQueryRequest; +import com.cool.store.response.ResponseResult; +import com.cool.store.service.store.StoreMaterialBlacklistService; +import com.cool.store.vo.store.StoreMaterialBlacklistVO; +import com.github.pagehelper.PageInfo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 门店物料黑名单 前端控制器 + *

+ * + * @author wangff + * @since 2026/3/31 + */ +@Api(tags = "Mini门店物料黑名单") +@RestController +@RequestMapping("/mini/material/blacklist") +@RequiredArgsConstructor +public class MiniStoreMaterialBlacklistController { + private final StoreMaterialBlacklistService storeMaterialBlacklistService; + + @ApiOperation("根据门店查询黑名单") + @GetMapping("/page") + public ResponseResult> page(StoreMaterialBlacklistQueryRequest request) { + return ResponseResult.success(storeMaterialBlacklistService.pageByStoreId(request)); + } +}