|
|
@@ -1,171 +0,0 @@
|
|
|
-package shop.alien.storeplatform.controller;
|
|
|
-
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import io.swagger.annotations.*;
|
|
|
-import lombok.RequiredArgsConstructor;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
-import shop.alien.entity.result.R;
|
|
|
-import shop.alien.entity.store.StoreLicenseHistory;
|
|
|
-import shop.alien.entity.store.dto.StoreLicenseHistoryDTO;
|
|
|
-import shop.alien.entity.store.vo.StoreLicenseHistoryVO;
|
|
|
-import shop.alien.storeplatform.service.StoreLicenseHistoryService;
|
|
|
-
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-/**
|
|
|
- * 商户证照历史记录 Controller
|
|
|
- *
|
|
|
- * @author system
|
|
|
- * @since 2025-11-24
|
|
|
- */
|
|
|
-@Slf4j
|
|
|
-@Api(tags = {"商家端-证照历史管理"})
|
|
|
-@ApiSort(5)
|
|
|
-@CrossOrigin
|
|
|
-@RestController
|
|
|
-@RequestMapping("/storeLicenseHistory")
|
|
|
-@RequiredArgsConstructor
|
|
|
-public class StoreLicenseHistoryController {
|
|
|
-
|
|
|
- private final StoreLicenseHistoryService storeLicenseHistoryService;
|
|
|
-
|
|
|
- @ApiOperation("创建证照历史记录")
|
|
|
- @ApiOperationSupport(order = 1)
|
|
|
- @PostMapping("/create")
|
|
|
- public R<StoreLicenseHistory> createLicenseHistory(@RequestBody @Validated StoreLicenseHistoryDTO dto) {
|
|
|
- log.info("StoreLicenseHistoryController.createLicenseHistory: dto={}", dto);
|
|
|
- try {
|
|
|
- StoreLicenseHistory result = storeLicenseHistoryService.createLicenseHistory(dto);
|
|
|
- return R.data(result, "创建成功");
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("StoreLicenseHistoryController.createLicenseHistory ERROR: {}", e.getMessage(), e);
|
|
|
- return R.fail(e.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("更新证照历史记录")
|
|
|
- @ApiOperationSupport(order = 2)
|
|
|
- @PutMapping("/update")
|
|
|
- public R<Boolean> updateLicenseHistory(@RequestBody @Validated StoreLicenseHistoryDTO dto) {
|
|
|
- log.info("StoreLicenseHistoryController.updateLicenseHistory: dto={}", dto);
|
|
|
- try {
|
|
|
- boolean result = storeLicenseHistoryService.updateLicenseHistory(dto);
|
|
|
- if (result) {
|
|
|
- return R.data(true, "更新成功");
|
|
|
- }
|
|
|
- return R.fail("更新失败");
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("StoreLicenseHistoryController.updateLicenseHistory ERROR: {}", e.getMessage(), e);
|
|
|
- return R.fail(e.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("删除证照历史记录")
|
|
|
- @ApiOperationSupport(order = 3)
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "id", value = "记录ID", dataType = "Integer", paramType = "query", required = true)
|
|
|
- })
|
|
|
- @DeleteMapping("/delete")
|
|
|
- public R<Boolean> deleteLicenseHistory(@RequestParam("id") Integer id) {
|
|
|
- log.info("StoreLicenseHistoryController.deleteLicenseHistory: id={}", id);
|
|
|
- try {
|
|
|
- boolean result = storeLicenseHistoryService.deleteLicenseHistory(id);
|
|
|
- if (result) {
|
|
|
- return R.data(true, "删除成功");
|
|
|
- }
|
|
|
- return R.fail("删除失败");
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("StoreLicenseHistoryController.deleteLicenseHistory ERROR: {}", e.getMessage(), e);
|
|
|
- return R.fail(e.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("根据ID获取证照历史记录详情")
|
|
|
- @ApiOperationSupport(order = 4)
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "id", value = "记录ID", dataType = "Integer", paramType = "query", required = true)
|
|
|
- })
|
|
|
- @GetMapping("/getById")
|
|
|
- public R<StoreLicenseHistoryVO> getLicenseHistoryById(@RequestParam("id") Integer id) {
|
|
|
- log.info("StoreLicenseHistoryController.getLicenseHistoryById: id={}", id);
|
|
|
- try {
|
|
|
- StoreLicenseHistoryVO result = storeLicenseHistoryService.getLicenseHistoryById(id);
|
|
|
- if (result != null) {
|
|
|
- return R.data(result);
|
|
|
- }
|
|
|
- return R.fail("记录不存在");
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("StoreLicenseHistoryController.getLicenseHistoryById ERROR: {}", e.getMessage(), e);
|
|
|
- return R.fail(e.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("根据商户ID获取证照历史记录列表")
|
|
|
- @ApiOperationSupport(order = 5)
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "storeId", value = "商户ID", dataType = "Integer", paramType = "query", required = true)
|
|
|
- })
|
|
|
- @GetMapping("/listByStoreId")
|
|
|
- public R<List<StoreLicenseHistoryVO>> getLicenseHistoryListByStoreId(@RequestParam("storeId") Integer storeId) {
|
|
|
- log.info("StoreLicenseHistoryController.getLicenseHistoryListByStoreId: storeId={}", storeId);
|
|
|
- try {
|
|
|
- List<StoreLicenseHistoryVO> result = storeLicenseHistoryService.getLicenseHistoryListByStoreId(storeId);
|
|
|
- return R.data(result);
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("StoreLicenseHistoryController.getLicenseHistoryListByStoreId ERROR: {}", e.getMessage(), e);
|
|
|
- return R.fail(e.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("根据商户ID和证照类型获取证照历史记录列表")
|
|
|
- @ApiOperationSupport(order = 6)
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "storeId", value = "商户ID", dataType = "Integer", paramType = "query", required = true),
|
|
|
- @ApiImplicitParam(name = "licenseStatus", value = "证照类型: 1-合同管理, 2-食品经营许可证", dataType = "Integer", paramType = "query", required = true)
|
|
|
- })
|
|
|
- @GetMapping("/listByStoreIdAndType")
|
|
|
- public R<List<StoreLicenseHistoryVO>> getLicenseHistoryListByStoreIdAndType(
|
|
|
- @RequestParam("storeId") Integer storeId,
|
|
|
- @RequestParam("licenseStatus") Integer licenseStatus) {
|
|
|
- log.info("StoreLicenseHistoryController.getLicenseHistoryListByStoreIdAndType: storeId={}, licenseStatus={}",
|
|
|
- storeId, licenseStatus);
|
|
|
- try {
|
|
|
- List<StoreLicenseHistoryVO> result = storeLicenseHistoryService.getLicenseHistoryListByStoreIdAndType(storeId, licenseStatus);
|
|
|
- return R.data(result);
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("StoreLicenseHistoryController.getLicenseHistoryListByStoreIdAndType ERROR: {}", e.getMessage(), e);
|
|
|
- return R.fail(e.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation("分页查询证照历史记录")
|
|
|
- @ApiOperationSupport(order = 7)
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "current", value = "当前页", dataType = "Long", paramType = "query", required = true, defaultValue = "1"),
|
|
|
- @ApiImplicitParam(name = "size", value = "每页大小", dataType = "Long", paramType = "query", required = true, defaultValue = "10"),
|
|
|
- @ApiImplicitParam(name = "storeId", value = "商户ID(可选)", dataType = "Integer", paramType = "query", required = false),
|
|
|
- @ApiImplicitParam(name = "licenseStatus", value = "证照类型(可选): 1-合同管理, 2-食品经营许可证", dataType = "Integer", paramType = "query", required = false),
|
|
|
- @ApiImplicitParam(name = "licenseExecuteStatus", value = "审核状态(可选): 1-审核中, 2-审核拒绝, 3-审核通过", dataType = "Integer", paramType = "query", required = false)
|
|
|
- })
|
|
|
- @GetMapping("/page")
|
|
|
- public R<Page<StoreLicenseHistoryVO>> getLicenseHistoryPage(
|
|
|
- @RequestParam(value = "current", defaultValue = "1") Long current,
|
|
|
- @RequestParam(value = "size", defaultValue = "10") Long size,
|
|
|
- @RequestParam(value = "storeId", required = false) Integer storeId,
|
|
|
- @RequestParam(value = "licenseStatus", required = false) Integer licenseStatus,
|
|
|
- @RequestParam(value = "licenseExecuteStatus", required = false) Integer licenseExecuteStatus) {
|
|
|
- log.info("StoreLicenseHistoryController.getLicenseHistoryPage: current={}, size={}, storeId={}, licenseStatus={}, licenseExecuteStatus={}",
|
|
|
- current, size, storeId, licenseStatus, licenseExecuteStatus);
|
|
|
- try {
|
|
|
- Page<StoreLicenseHistory> page = new Page<>(current, size);
|
|
|
- Page<StoreLicenseHistoryVO> result = storeLicenseHistoryService.getLicenseHistoryPage(page, storeId, licenseStatus, licenseExecuteStatus);
|
|
|
- return R.data(result);
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("StoreLicenseHistoryController.getLicenseHistoryPage ERROR: {}", e.getMessage(), e);
|
|
|
- return R.fail(e.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|