Parcourir la source

feat(license): 新增娱乐经营许可证相关功能

- 新增娱乐经营许可证图片信息查询接口
- 新增娱乐经营许可证上传接口
- 新增娱乐经营许可证历史记录查询接口
- 新增娱乐经营许可证状态查询接口
- 修改合同和食品经营许可证返回数据结构为StoreImgDTO
- 增加StoreImgDTO类用于封装图片及过期时间信息
- 在StoreInfo实体中增加娱乐经营许可证相关字段
- 更新登录服务中的过期时间检查逻辑以支持娱乐经营许可证
zjy il y a 1 semaine
Parent
commit
e32afdfc12

+ 23 - 0
alien-entity/src/main/java/shop/alien/entity/second/vo/StoreImgDTO.java

@@ -0,0 +1,23 @@
+package shop.alien.entity.second.vo;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import shop.alien.entity.store.StoreImg;
+
+import java.util.Date;
+
+/**
+ * 上传图片vo
+ *
+ * @author ssk
+ * @version 1.0
+ * @date 2025/1/13 10:35
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+@JsonInclude
+public class StoreImgDTO extends StoreImg {
+
+    Date expirationTime;
+}

+ 16 - 0
alien-entity/src/main/java/shop/alien/entity/store/StoreInfo.java

@@ -247,5 +247,21 @@ public class StoreInfo {
     @TableField("meal_provided")
     private Integer mealProvided;
 
+    @ApiModelProperty(value = "娱乐经营许可证状态 字典 foodLicenceStatus")
+    @TableField("entertainment_licence_status")
+    private Integer entertainmentLicenceStatus;
 
+    @ApiModelProperty(value = "娱乐经营许可证失败原因")
+    @TableField("entertainment_licence_reason")
+    private String entertainmentLicenceReason;
+
+    @ApiModelProperty(value = "娱乐经营许可证到期时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField("entertainment_licence__expiration_time")
+    private Date entertainmentLicenceExpirationTime;
+
+    @ApiModelProperty(value = "变更娱乐经营许可证提交时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField("update_entertainment_licence_time")
+    private Date updateEntertainmentLicenceTime;
 }

+ 63 - 4
alien-store-platform/src/main/java/shop/alien/storeplatform/controller/LicenseController.java

@@ -5,8 +5,10 @@ import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
 import shop.alien.entity.result.R;
+import shop.alien.entity.second.vo.StoreImgDTO;
 import shop.alien.entity.store.StoreImg;
 import shop.alien.entity.store.WebAudit;
+import shop.alien.entity.store.vo.StoreImgVo;
 import shop.alien.entity.storePlatform.vo.StoreLicenseHistoryDto;
 import shop.alien.entity.storePlatform.vo.StoreLicenseHistoryVO;
 import shop.alien.mapper.WebAuditMapper;
@@ -49,9 +51,9 @@ public class LicenseController {
             @ApiImplicitParam(name = "id", value = "城市", dataType = "Integer", paramType = "query", required = false)
     })
     @GetMapping("/queryContractList")
-    public R<List<StoreImg>> queryContractList(Integer id) {
+    public R<List<StoreImgDTO>> queryContractList(Integer id) {
         log.info("LicenseController.queryContractList?id={}", id);
-        List<StoreImg> result = licenseService.getContractList(id);
+        List<StoreImgDTO> result = licenseService.getContractList(id);
         return R.data(result);
     }
 
@@ -61,9 +63,9 @@ public class LicenseController {
             @ApiImplicitParam(name = "id", value = "城市", dataType = "Integer", paramType = "query", required = false)
     })
     @GetMapping("/queryFoodLicenceList")
-    public R<List<StoreImg>> queryFoodLicenceList(Integer id) {
+    public R<List<StoreImgDTO>> queryFoodLicenceList(Integer id) {
         log.info("LicenseController.queryFoodLicenceList?id={}", id);
-        List<StoreImg> result = licenseService.getFoodLicenceList(id);
+        List<StoreImgDTO> result = licenseService.getFoodLicenceList(id);
         return R.data(result);
     }
 
@@ -145,6 +147,63 @@ public class LicenseController {
             return R.fail(e.getMessage());
         }
     }
+
+    @ApiOperation("获取娱乐经营许可证图片信息")
+    @ApiOperationSupport(order = 1)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "Integer", value = "城市", dataType = "String", paramType = "query", required = false)
+    })
+    @GetMapping("/queryEntertainmentLicenseList")
+    public R<List<StoreImgDTO>> queryEntertainmentLicenseList(Integer id) {
+        log.info("LicenseController.queryEntertainmentLicenseList?id={}", id);
+        List<StoreImgDTO> result = licenseService.getEntertainmentLicenseList(id);
+        return R.data(result);
+    }
+
+
+    @ApiOperation(value = "门店装修-修改娱乐经营许可证")
+    @PostMapping("/uploadEntertainmentLicence")
+    public R<String> uploadEntertainmentLicence(@RequestBody StoreImg storeImg) {
+        log.info("StoreInfoController.uploadEntertainmentLicence?storeImg={}", storeImg);
+        int num = licenseService.uploadEntertainmentLicence(storeImg);
+        if (num > 0) {
+            WebAudit webAudit = new WebAudit();
+            webAudit.setStoreInfoId(storeImg.getStoreId().toString());
+            webAudit.setType("8");
+            webAudit.setStatus("0");
+            webAudit.setContent("娱乐经营许可证");
+            webAuditMapper.insert(webAudit);
+            return R.success("娱乐经营许可证图片添加成功");
+        }
+        return R.fail("娱乐经营许可证图片添加失败");
+    }
+
+    @ApiOperation("根据商户ID获取经营许可证历史记录")
+    @ApiOperationSupport(order = 3)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "storeId", value = "商户ID", dataType = "Integer", paramType = "query", required = true)
+    })
+    @GetMapping("/queryEntertainmentByStatusList")
+    public R<List<StoreLicenseHistoryDto>> queryEntertainmentByStatusList(@RequestParam("storeId") Integer storeId) {
+        log.info("LicenseController.queryLicenceByStatusList: storeId={}", storeId);
+        try {
+            List<StoreLicenseHistoryDto> result = licenseService.queryEntertainmentByStatusList(storeId);
+            return R.data(result);
+        } catch (Exception e) {
+            log.error("LicenseController.queryLicenceByStatusList ERROR: {}", e.getMessage(), e);
+            return R.fail(e.getMessage());
+        }
+    }
+
+    @ApiOperation(value = "门店装修-娱乐经营许可证状态")
+    @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "门店id", dataType = "int", paramType = "query", required = true)})
+    @GetMapping("/queryStoreEntertainmentStatus")
+    public R<Map<String, Object>> queryStoreEntertainmentStatus(int id) {
+        log.info("StoreInfoController.getStoreFoodLicenceStatus?id={}", id);
+        return R.data(licenseService.getStoreEntertainmentStatus(id));
+    }
+
+
 }
 
 

+ 23 - 2
alien-store-platform/src/main/java/shop/alien/storeplatform/service/LicenseService.java

@@ -1,7 +1,9 @@
 package shop.alien.storeplatform.service;
 
 
+import shop.alien.entity.second.vo.StoreImgDTO;
 import shop.alien.entity.store.StoreImg;
+import shop.alien.entity.store.vo.StoreImgVo;
 import shop.alien.entity.storePlatform.vo.StoreLicenseHistoryDto;
 import shop.alien.entity.storePlatform.vo.StoreLicenseHistoryVO;
 
@@ -15,9 +17,11 @@ public interface LicenseService {
 
     List<StoreImg> getbusinessLicenseList (Integer id);
 
-    List<StoreImg> getContractList (Integer id);
+    List<StoreImgDTO> getEntertainmentLicenseList (Integer id);
 
-    List<StoreImg> getFoodLicenceList (Integer id);
+    List<StoreImgDTO> getContractList (Integer id);
+
+    List<StoreImgDTO> getFoodLicenceList (Integer id);
 
     /**
      * 根据商户ID查询证照历史记录列表(带格式化日期)
@@ -61,6 +65,23 @@ public interface LicenseService {
      * @return 按时间分组且已排序的证照历史记录列表
      */
     List<StoreLicenseHistoryDto> queryContractByStatusList (Integer storeId);
+
+    int uploadEntertainmentLicence(StoreImg storeImg);
+
+    /**
+     * 根据商户ID查询证照历史记录列表(带格式化日期)
+     *
+     * @param storeId 商户ID
+     * @return 证照历史记录VO列表
+     */
+    List<StoreLicenseHistoryDto> queryEntertainmentByStatusList (Integer storeId);
+
+    /**
+     * 获取店铺食品经营许可证状态以及店铺状态为审核中合同图片list
+     * @param id
+     * @return
+     */
+    Map<String,Object> getStoreEntertainmentStatus(int id);
 }
 
 

+ 170 - 5
alien-store-platform/src/main/java/shop/alien/storeplatform/service/impl/LicenseServiceImpl.java

@@ -6,7 +6,9 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
+import shop.alien.entity.second.vo.StoreImgDTO;
 import shop.alien.entity.store.*;
+import shop.alien.entity.store.vo.StoreImgVo;
 import shop.alien.entity.storePlatform.vo.StoreLicenseHistoryDto;
 import shop.alien.entity.storePlatform.vo.StoreLicenseHistoryVO;
 import shop.alien.entity.storePlatform.StoreLicenseHistory;
@@ -95,11 +97,29 @@ public class LicenseServiceImpl implements LicenseService {
      * @return 合同图片列表
      */
     @Override
-    public List<StoreImg> getContractList (Integer id) {
-        // 查询图片类型为15(合同)的图片列表
-        return storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>()
+    public List<StoreImgDTO> getContractList (Integer id) {
+
+
+        StoreInfo storeInfo = storeInfoMapper.selectOne(new LambdaQueryWrapper<StoreInfo>().eq(StoreInfo::getId, id));
+        
+
+        log.info("getEntertainmentLicenseList - 查询商户ID为 {} 的娱乐经营许可证图片列表", id);
+        List<StoreImg> storeImgList = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>()
                 .eq(StoreImg::getImgType, 15)
                 .eq(StoreImg::getStoreId, id));
+
+        List<StoreImgDTO> storeImgVoList = new ArrayList<>();
+        for (StoreImg storeImg : storeImgList) {
+            StoreImgDTO storeImgVo = new StoreImgDTO();
+            BeanUtils.copyProperties(storeImg, storeImgVo);
+            if (storeInfo != null) {
+                storeImgVo.setExpirationTime(storeInfo.getExpirationTime());
+            }
+            storeImgVoList.add(storeImgVo);
+        }
+
+        // 查询图片类型为15(合同)的图片列表
+        return storeImgVoList;
     }
 
     /**
@@ -112,11 +132,28 @@ public class LicenseServiceImpl implements LicenseService {
      * @return 食品经营许可证图片列表
      */
     @Override
-    public List<StoreImg> getFoodLicenceList (Integer id) {
+    public List<StoreImgDTO> getFoodLicenceList (Integer id) {
+         log.info("getEntertainmentLicenseList - 查询商户ID为 {} 的娱乐经营许可证图片列表", id);
+        
+        StoreInfo storeInfo = storeInfoMapper.selectOne(new LambdaQueryWrapper<StoreInfo>().eq(StoreInfo::getId, id));
+        
         // 查询图片类型为25(食品经营许可证)的图片列表
-        return storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>()
+        List<StoreImg> storeImgList = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>()
                 .eq(StoreImg::getImgType, 25)
                 .eq(StoreImg::getStoreId, id));
+
+        List<StoreImgDTO> storeImgVoList = new ArrayList<>();
+        for (StoreImg storeImg : storeImgList) {
+            StoreImgDTO storeImgVo = new StoreImgDTO();
+            BeanUtils.copyProperties(storeImg, storeImgVo);
+            if (storeInfo != null) {
+                storeImgVo.setExpirationTime(storeInfo.getFoodLicenceExpirationTime());
+            }
+            storeImgVoList.add(storeImgVo);
+        }
+
+        // 查询图片类型为15(合同)的图片列表
+        return storeImgVoList;
     }
 
     /**
@@ -383,5 +420,133 @@ public class LicenseServiceImpl implements LicenseService {
 
         return resultList;
     }
+
+    /**
+     * 获取营业执照图片列表
+     * <p>
+     * 查询指定商户的营业执照图片信息(图片类型为14)
+     * </p>
+     *
+     * @param id 商户ID
+     * @return 营业执照图片列表
+     */
+    @Override
+    public List<StoreImgDTO> getEntertainmentLicenseList (Integer id) {
+
+        StoreInfo storeInfo = storeInfoMapper.selectOne(new LambdaQueryWrapper<StoreInfo>().eq(StoreInfo::getId, id));
+        
+        log.info("getEntertainmentLicenseList - 查询商户ID为 {} 的娱乐经营许可证图片列表", id);
+        List<StoreImg> storeImgList = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>()
+                .eq(StoreImg::getImgType, 31)
+                .eq(StoreImg::getStoreId, id));
+
+        List<StoreImgDTO> storeImgVoList = new ArrayList<>();
+        for (StoreImg storeImg : storeImgList) {
+            StoreImgDTO storeImgVo = new StoreImgDTO();
+            BeanUtils.copyProperties(storeImg, storeImgVo);
+            if (storeInfo != null) {
+                storeImgVo.setExpirationTime(storeInfo.getEntertainmentLicenceExpirationTime());
+            }
+            storeImgVoList.add(storeImgVo);
+        }
+        return storeImgVoList;
+    }
+
+    @Override
+    public int uploadEntertainmentLicence(StoreImg storeImg) {
+        storeImgMapper.delete(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getImgType,32).eq(StoreImg::getStoreId,storeImg.getStoreId()));
+        storeImg.setImgType(32);
+        storeImg.setImgDescription("经营许可证审核通过前图片");
+        storeImgMapper.insert(storeImg);
+
+
+        // 经营许可证历史表插入
+        StoreLicenseHistory licenseHistory = new StoreLicenseHistory();
+        licenseHistory.setStoreId(storeImg.getStoreId());
+        licenseHistory.setLicenseStatus(3);
+        licenseHistory.setLicenseExecuteStatus(2);
+        licenseHistory.setImgUrl(storeImg.getImgUrl());
+        licenseHistory.setDeleteFlag(0);
+        licenseHistoryMapper.insert(licenseHistory);
+
+        //更新店铺
+        StoreInfo storeInfo = new StoreInfo();
+        storeInfo.setEntertainmentLicenceStatus(2);
+        storeInfo.setId(storeImg.getStoreId());
+        storeInfo.setUpdateEntertainmentLicenceTime(new Date());
+        return storeInfoMapper.updateById(storeInfo);
+    }
+
+    /**
+     * 根据商户ID查询证照历史记录列表(带格式化日期)
+     * <p>
+     * 查询指定商户的证照历史记录,将创建时间格式化为 yyyy-MM-dd 格式,
+     * 并转换为 VO 对象返回
+     * </p>
+     *
+     * @param storeId 商户ID
+     * @return 证照历史记录VO列表
+     */
+    @Override
+    public List<StoreLicenseHistoryDto> queryEntertainmentByStatusList (Integer storeId) {
+
+        List<StoreLicenseHistory> licenseList = licenseHistoryMapper.queryLicenceByStatusList(storeId, 3, 1);
+
+        // 创建日期格式化对象,格式为 yyyy-MM-dd
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+
+        // 创建返回的 VO 列表
+        List<StoreLicenseHistoryDto> voList = new java.util.ArrayList<>();
+
+        for (StoreLicenseHistory license : licenseList) {
+            // 创建 VO 对象
+            StoreLicenseHistoryDto vo = new StoreLicenseHistoryDto();
+
+            // 将实体对象属性复制到 VO 对象
+            BeanUtils.copyProperties(license, vo);
+
+            // 将创建时间格式化为 yyyy-MM-dd 格式,去除时分秒
+            if (license.getCreatedTime() != null) {
+                String dateStr = sdf.format(license.getCreatedTime());
+                vo.setCreatedDateFormat(dateStr);
+            }
+
+            // 设置审核状态名称
+            if (license.getLicenseExecuteStatus() != null) {
+                switch (license.getLicenseExecuteStatus()) {
+                    case 1:
+                        vo.setLicenseExecuteName("审核通过");
+                        break;
+                    case 2:
+                        vo.setLicenseExecuteName("审核中");
+                        break;
+                    case 3:
+                        vo.setLicenseExecuteName("审核失败");
+                        break;
+                    default:
+                        vo.setLicenseExecuteName("未知");
+                        break;
+                }
+            }
+
+            voList.add(vo);
+        }
+
+        return voList;
+    }
+
+
+    @Override
+    public Map<String, Object> getStoreEntertainmentStatus(int id) {
+        Map<String, Object> map = new HashMap<>();
+        StoreInfo storeInfo = storeInfoMapper.selectOne(new LambdaQueryWrapper<StoreInfo>().eq(StoreInfo::getId, id));
+        //审核通过给前台反显未提交
+        if (storeInfo.getEntertainmentLicenceStatus() != null && storeInfo.getEntertainmentLicenceStatus() == 1) {
+            map.put("entertainmentStatus", 0);
+        } else {
+            map.put("entertainmentStatus", storeInfo.getEntertainmentLicenceStatus());
+        }
+        return map;
+    }
 }
 

+ 4 - 0
alien-store-platform/src/main/java/shop/alien/storeplatform/service/impl/StorePlatformLoginServiceImpl.java

@@ -209,6 +209,7 @@ public class StorePlatformLoginServiceImpl extends ServiceImpl<StoreUserMapper,
             JSONObject jsonObject = new JSONObject();
             jsonObject.put("expirationTime", 1);
             jsonObject.put("foodLicenceExpirationTime", 1);
+            jsonObject.put("entertainmentLicenceExpirationTime", 1);
 
             StoreInfo storeInfo = storeInfoMapper.selectById(storeId);
             if (storeInfo != null) {
@@ -218,6 +219,9 @@ public class StorePlatformLoginServiceImpl extends ServiceImpl<StoreUserMapper,
                 if (storeInfo.getFoodLicenceExpirationTime().compareTo(new Date()) < 0) {
                     jsonObject.put("foodLicenceExpirationTime", 0);
                 }
+                if (storeInfo.getEntertainmentLicenceExpirationTime() != null && storeInfo.getEntertainmentLicenceExpirationTime().compareTo(new Date()) < 0) {
+                    jsonObject.put("entertainmentLicenceExpirationTime", 0);
+                }
             }
             return jsonObject;
         } catch (Exception e) {