Explorar o código

食品经营许可证

qxy hai 3 meses
pai
achega
31c310e1af

+ 1 - 1
alien-entity/src/main/java/shop/alien/entity/store/StoreImg.java

@@ -30,7 +30,7 @@ public class StoreImg extends Model<StoreImg> {
     @TableField("store_id")
     private Integer storeId;
 
-    @ApiModelProperty(value = "图片类型, 0:其他, 1:入口图, 2:相册, 3:菜品, 4:环境, 5:价目表, 6:推荐菜, 7:菜单, 8:用户评论, 9:商家申诉,10:商家头像,11:店铺轮播图,12:联名卡图片,13:动态折扣, 14:套餐图片,15:合同照片,17:打卡广场小人图片 18: 商品发布图片 19:二手商品与用户举报图片,20头图单图模式,21头图多图模式 , 22续签合同")
+    @ApiModelProperty(value = "图片类型, 0:其他, 1:入口图, 2:相册, 3:菜品, 4:环境, 5:价目表, 6:推荐菜, 7:菜单, 8:用户评论, 9:商家申诉,10:商家头像,11:店铺轮播图,12:联名卡图片,13:动态折扣, 14:套餐图片,15:合同照片,17:打卡广场小人图片 18: 商品发布图片 19:二手商品与用户举报图片,20头图单图模式,21头图多图模式 , 22续签合同,23,二手商品记录图片类型, 24 食品经营许可证审核前状态 25.食品经营许可证审核后状态")
     @TableField("img_type")
     private Integer imgType;
 

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

@@ -211,4 +211,27 @@ public class StoreInfo {
     @ApiModelProperty(value = "评分")
     @TableField("score_avg")
     private Double scoreAvg;
+
+    @ApiModelProperty(value = "食品经营许可证状态")
+    @TableField("food_licence_status")
+    private Integer foodLicenceStatus;
+
+    @ApiModelProperty(value = "食品经营许可证失败原因")
+    @TableField("food_licence_reason")
+    private String foodLicenceReason;
+
+    @ApiModelProperty(value = "经营许可证到期时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField("food_licence_expiration_time")
+    private Date  foodLicenceExpirationTime;
+
+    @ApiModelProperty(value = "变更经营许可证提交时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField("update_food_licence_time")
+    private Date  updateFoodLicenceTime;
+
+    @ApiModelProperty(value = "变更续签合同提交时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField("update_renew_contract_time")
+    private Date  updateRenewContractTime;
 }

+ 4 - 0
alien-entity/src/main/java/shop/alien/entity/store/StoreInfoDraft.java

@@ -183,6 +183,10 @@ public class StoreInfoDraft extends Model<StoreInfoDraft> {
     @TableField("contract_url")
     private String contractUrl;
 
+    @ApiModelProperty(value = "经营许可证地址")
+    @TableField("food_licence_url")
+    private String foodLicenceUrl;
+
 
     @Override
     protected Serializable pkVal() {

+ 14 - 0
alien-entity/src/main/java/shop/alien/entity/store/dto/StoreInfoDto.java

@@ -132,6 +132,9 @@ public class StoreInfoDto {
     @ApiModelProperty(value = "合同图片地址")
     private List<String> contractImageList;
 
+    @ApiModelProperty(value = "经营许可证图片地址")
+    private String foodLicenceUrl;
+
     @ApiModelProperty(value = "查询经纬度时查询地点存储")
     private String queryAddress;
 
@@ -165,4 +168,15 @@ public class StoreInfoDto {
 
     @ApiModelProperty(value = "审核续签合同状态")
     private Integer renewContractStatus;
+
+    @ApiModelProperty(value = "食品经营许可证原因")
+    private String foodLicenceReason;
+
+    @ApiModelProperty(value = "审核食品经营许可证状态")
+    private Integer foodLicenceStatus;
+
+    @ApiModelProperty(value = "经营许可证到期时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date foodLicenceExpirationTime;
 }

+ 30 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/StoreInfoVo.java

@@ -1,5 +1,7 @@
 package shop.alien.entity.store.vo;
 
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -11,6 +13,7 @@ import shop.alien.entity.store.StoreBusinessInfo;
 import shop.alien.entity.store.StoreInfo;
 import shop.alien.entity.store.StoreStaffConfig;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -103,6 +106,12 @@ public class StoreInfoVo extends StoreInfo {
     @ApiModelProperty(value = "续签合同图片地址")
     private List<String> renewContractImageList;
 
+    @ApiModelProperty(value = "经营许可证审核通过图片地址")
+    private List<String> foodLicenceImageList;
+
+    @ApiModelProperty(value = "经营许可证审核未通过图片地址")
+    private List<String> notPassFoodLicenceImageList;
+
     @ApiModelProperty(value = "过期天数")
     private Long daysToExpire;
 
@@ -174,6 +183,27 @@ public class StoreInfoVo extends StoreInfo {
     @ApiModelProperty(value = "验证码")
     private String verificationCode;
 
+    @ApiModelProperty(value = "经营许可证到期时间")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date foodLicenceExpirationTime;
+
+    @ApiModelProperty(value = "变更经营许可证提交时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date  updateFoodLicenceTime;
+
+    @ApiModelProperty(value = "变更续签合同提交时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date  updateRenewContractTime;
+
+    @ApiModelProperty(value = "商户姓名")
+    private String storeUserName;
+
+    @ApiModelProperty(value = "经营许可证剩余天数")
+    private String foodLicenceRemainingDays;
+
+    @ApiModelProperty(value = "经营许可证是否到期状态 已到期 未到期 即将到期")
+    private String foodLicenceExpireStatus;
+
     private List<Map<String, Object>> quanMapList;
 
     private String storeClockInCount;

+ 10 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/StoreMainInfoVo.java

@@ -1,5 +1,7 @@
 package shop.alien.entity.store.vo;
 
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -8,6 +10,7 @@ import shop.alien.entity.store.StoreImg;
 import shop.alien.entity.store.StoreInfo;
 import shop.alien.entity.store.StoreLabel;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -71,6 +74,9 @@ public class StoreMainInfoVo extends StoreInfo {
     @ApiModelProperty(value = "合同照片")
     private List<StoreImg> contractList;
 
+    @ApiModelProperty(value = "经营许可证照片")
+    private List<StoreImg> foodLicenceList;
+
     @ApiModelProperty(value = "是否连锁转义")
     private String isChainStr;
 
@@ -83,4 +89,8 @@ public class StoreMainInfoVo extends StoreInfo {
     @ApiModelProperty(value = "门店注销中倒计时时间毫秒")
     private long countdown;
 
+    @ApiModelProperty(value = "经营许可证到期时间")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date foodLicenceExpirationTime;
+
 }

+ 59 - 5
alien-store/src/main/java/shop/alien/store/controller/StoreInfoController.java

@@ -6,6 +6,7 @@ import io.swagger.annotations.*;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.http.ResponseEntity;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartRequest;
 import shop.alien.entity.result.R;
@@ -215,7 +216,9 @@ public class StoreInfoController {
             @ApiImplicitParam(name = "storeApplicationStatus", value = "门店审核状态", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "jingdu", value = "jingdu", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "weidu", value = "weidu", dataType = "String", paramType = "query"),
-            @ApiImplicitParam(name = "renewContractStatus", value = "门店续签合同状态", dataType = "String", paramType = "query")
+            @ApiImplicitParam(name = "renewContractStatus", value = "门店续签合同状态", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "foodLicenceStatus", value = "门店经营许可证状态", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "foodLicenceWhetherExpiredStatus", value = "门店经营许可证是否过期状态", dataType = "String", paramType = "query")
     })
     @GetMapping("/getStorePage")
     public R<IPage<StoreInfoVo>> getStoresPage(
@@ -232,10 +235,13 @@ public class StoreInfoController {
             @RequestParam(required = false) String storeStatus,
             @RequestParam(required = false) String jingdu,
             @RequestParam(required = false) String weidu,
-            @RequestParam(required = false) String renewContractStatus) {
-        log.info("StoreInfoController.getStoresPage?pageNum={},pageSize={},storeName={},storeContact={},id={},storePhone={},storeType={},expiredState={},storeApplicationStatus={},storeStatus={},businessSection={},jingdu={},weidu={},renewContractStatus={}",
-                pageNum, pageSize, storeName, storeContact, id, storePhone, storeType, expiredState, storeApplicationStatus, storeStatus, businessSection, jingdu, weidu, renewContractStatus);
-        return R.data(storeInfoService.getStorePage(pageNum, pageSize, storeName, storeContact, id, storePhone, storeType, expiredState, storeApplicationStatus, storeStatus, businessSection, jingdu, weidu, renewContractStatus));
+            @RequestParam(required = false) String renewContractStatus,
+            @RequestParam(required = false) String foodLicenceStatus,
+            @RequestParam(required = false) String foodLicenceWhetherExpiredStatus)
+    {
+        log.info("StoreInfoController.getStoresPage?pageNum={},pageSize={},storeName={},storeContact={},id={},storePhone={},storeType={},expiredState={},storeApplicationStatus={},storeStatus={},businessSection={},jingdu={},weidu={},renewContractStatus={},foodLicenceStatus={},foodLicenceWhetherExpiredStatus={}",
+                pageNum, pageSize, storeName, storeContact, id, storePhone, storeType, expiredState, storeApplicationStatus, storeStatus, businessSection, jingdu, weidu, renewContractStatus, foodLicenceStatus, foodLicenceWhetherExpiredStatus);
+        return R.data(storeInfoService.getStorePage(pageNum, pageSize, storeName, storeContact, id, storePhone, storeType, expiredState, storeApplicationStatus, storeStatus, businessSection, jingdu, weidu, renewContractStatus, foodLicenceStatus, foodLicenceWhetherExpiredStatus));
     }
 
     /**
@@ -644,4 +650,52 @@ public class StoreInfoController {
         return R.fail("审核失败 店铺不存在");
     }
 
+    @ApiOperation(value = "门店装修-食品经营许可证")
+    @PostMapping("/uploadfoodLicence")
+    public R<String> uploadfoodLicence(@RequestBody StoreImg storeImg) {
+        log.info("StoreInfoController.uploadfoodLicence?storeImg={}", storeImg);
+        int num = storeInfoService.uploadfoodLicence(storeImg);
+        if (num > 0) {
+            return R.success("食品经营许可证图片添加成功");
+        }
+        return R.fail("食品经营许可证图片添加失败");
+    }
+
+    @ApiOperation(value = "门店装修-食品经营许可证状态及合同图片")
+    @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "门店id", dataType = "int", paramType = "query", required = true)})
+    @GetMapping("/getStoreFoodLicenceStatus")
+    public R<Map<String, Object>> getStoreFoodLicenceStatus(int id) {
+        log.info("StoreInfoController.getStoreFoodLicenceStatus?id={}", id);
+        return R.data(storeInfoService.getStoreFoodLicenceStatus(id));
+    }
+
+    @ApiOperation(value = "门店装修-审核食品经营许可证状态")
+    @PostMapping("/updatefoodLicenceImageStatus")
+    public R<String> updatefoodLicenceImageStatus(@RequestBody StoreInfoDto storeInfoDto) {
+        log.info("StoreInfoController.updatefoodLicenceImageStatus?storeInfoDto={}", storeInfoDto);
+        StoreInfo storeInfo = storeInfoService.getOne(new LambdaQueryWrapper<StoreInfo>().eq(StoreInfo::getId, storeInfoDto.getId()));
+        if (storeInfo != null) {
+            if (storeInfoDto.getFoodLicenceStatus() == 3) {
+                storeInfo.setFoodLicenceReason(storeInfoDto.getFoodLicenceReason());
+                storeInfo.setFoodLicenceStatus(storeInfoDto.getFoodLicenceStatus());
+                boolean flag = storeInfoService.updateById(storeInfo);
+                if (flag) {
+                    return R.success("拒绝审核成功");
+                } else {
+                    return R.fail("拒绝审核失败");
+                }
+            }
+            storeInfo.setFoodLicenceReason(storeInfoDto.getFoodLicenceReason());
+            storeInfo.setFoodLicenceStatus(storeInfoDto.getFoodLicenceStatus());
+            boolean flag = storeInfoService.updateById(storeInfo);
+            if (flag) {
+                storeInfoService.foodLicenceType(storeInfoDto.getId());
+                return R.success("审核通过成功");
+            }else{
+                return R.fail("审核失败");
+            }
+        }
+        return R.fail("审核失败 店铺不存在");
+    }
+
 }

+ 22 - 1
alien-store/src/main/java/shop/alien/store/service/StoreInfoService.java

@@ -66,7 +66,7 @@ public interface StoreInfoService extends IService<StoreInfo> {
      * @param storeType    门店类型
      * @return IPage<StoreInfoVo>
      */
-    IPage<StoreInfoVo> getStorePage(int page, int size, String storeName, String storeContact, String id, String storePhone, String storeType, String expiredState, String storeApplicationStatus, String storeStatus, String businessSection, String jingdu, String weidu, String renewContractStatus);
+    IPage<StoreInfoVo> getStorePage(int page, int size, String storeName, String storeContact, String id, String storePhone, String storeType, String expiredState, String storeApplicationStatus, String storeStatus, String businessSection, String jingdu, String weidu, String renewContractStatus, String foodLicenceStatus, String foodLicenceWhetherExpiredStatus);
 
     /**
      * web-重置门店密码
@@ -250,10 +250,25 @@ public interface StoreInfoService extends IService<StoreInfo> {
     int uploadRenewalContract(List<StoreImg> storeImgList);
 
     /**
+     * 店铺食品经营许可证
+     * @param storeImg
+     * @return
+     */
+    int uploadfoodLicence(StoreImg storeImg);
+
+    /**
      * 获取店铺续签合同状态以及店铺状态为审核中合同图片list
      *
      */
     Map<String,Object> getStoreContractStatus(int id);
+
+    /**
+     * 获取店铺食品经营许可证状态以及店铺状态为审核中合同图片list
+     * @param id
+     * @return
+     */
+    Map<String,Object> getStoreFoodLicenceStatus(int id);
+
     int updateStoreImgModeInfo(StoreImgInfoVo storeImgInfoVo);
 
 
@@ -262,4 +277,10 @@ public interface StoreInfoService extends IService<StoreInfo> {
      *
      */
     int conversionContract(int id);
+
+    /**
+     * 经营许可证审核通过后 图片类型变为审核通过后 img_type25
+     *
+     */
+    int foodLicenceType(int id);
 }

+ 188 - 25
alien-store/src/main/java/shop/alien/store/service/impl/StoreInfoServiceImpl.java

@@ -40,6 +40,7 @@ import shop.alien.store.service.NearMeService;
 import shop.alien.store.service.StoreClockInService;
 import shop.alien.store.service.StoreCommentService;
 import shop.alien.store.service.StoreInfoService;
+import shop.alien.store.util.CommonConstant;
 import shop.alien.store.util.FileUploadUtil;
 import shop.alien.store.util.GroupConstant;
 import shop.alien.util.ali.AliOSSUtil;
@@ -239,9 +240,12 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
         storeMainInfoVo.setBusinessLicenseList(storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getImgType, 14).eq(StoreImg::getStoreId, id)));
         //合同照片
         storeMainInfoVo.setContractList(storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getImgType, 15).eq(StoreImg::getStoreId, id)));
+        //经营许可证图片照片
+        storeMainInfoVo.setFoodLicenceList(storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getImgType, 25).eq(StoreImg::getStoreId, id)));
         //是否连锁
         String isChain = (storeInfo.getIsChain() == 0) ? "否" : "是";
         storeMainInfoVo.setIsChainStr(isChain);
+        storeMainInfoVo.setFoodLicenceExpirationTime(storeInfo.getFoodLicenceExpirationTime());
         return storeMainInfoVo;
     }
 
@@ -287,11 +291,11 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
      * @return IPage<StoreInfoVo>
      */
     @Override
-    public IPage<StoreInfoVo> getStorePage(int page, int size, String storeName, String storeContact, String id, String storePhone, String storeType, String expiredState, String storeApplicationStatus, String storeStatus, String businessSection, String jingdu, String weidu, String renewContractStatus) {
+    public IPage<StoreInfoVo> getStorePage(int page, int size, String storeName, String storeContact, String id, String storePhone, String storeType, String expiredState, String storeApplicationStatus, String storeStatus, String businessSection, String jingdu, String weidu, String renewContractStatus, String foodLicenceStatus, String foodLicenceWhetherExpiredStatus) {
         checkAndUpdateExpiredRecords();
         IPage<StoreInfoVo> iPage = new Page<>(page, size);
         QueryWrapper<StoreInfoVo> queryWrapper = new QueryWrapper<>();
-        queryWrapper.like(storeName != null && !storeName.isEmpty(), "a.store_name", storeName).like(storeContact != null && !storeContact.isEmpty(), "b.name", storeContact).like(storePhone != null && !storePhone.isEmpty(), "b.phone", storePhone).like(storeType != null && !storeType.isEmpty(), "a.store_type", storeType).eq(StringUtils.isNotEmpty(storeApplicationStatus), "a.store_application_status", storeApplicationStatus).eq(StringUtils.isNotEmpty(businessSection), "a.business_section", businessSection).eq(StringUtils.isNotEmpty(storeStatus), "a.store_status", storeStatus).eq(StringUtils.isNotEmpty(renewContractStatus), "a.renew_contract_status", renewContractStatus).like(StringUtils.isNotEmpty(id), "a.id", id).eq("a.delete_flag", 0).eq("b.delete_flag", 0).orderByDesc("a.created_time");
+        queryWrapper.like(storeName != null && !storeName.isEmpty(), "a.store_name", storeName).like(storeContact != null && !storeContact.isEmpty(), "b.name", storeContact).like(storePhone != null && !storePhone.isEmpty(), "b.phone", storePhone).like(storeType != null && !storeType.isEmpty(), "a.store_type", storeType).eq(StringUtils.isNotEmpty(storeApplicationStatus), "a.store_application_status", storeApplicationStatus).eq(StringUtils.isNotEmpty(businessSection), "a.business_section", businessSection).eq(StringUtils.isNotEmpty(storeStatus), "a.store_status", storeStatus).eq(StringUtils.isNotEmpty(renewContractStatus), "a.renew_contract_status", renewContractStatus).eq(StringUtils.isNotEmpty(foodLicenceStatus), "a.food_licence_status", foodLicenceStatus).like(StringUtils.isNotEmpty(id), "a.id", id).eq("a.delete_flag", 0).eq("b.delete_flag", 0).orderByDesc("a.created_time");
         //如果查询未过期
         // 获取当前时刻
         Date currentDate = new Date();
@@ -314,6 +318,16 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
         } else if ("2".equals(expiredState)) {
             queryWrapper.lt("a.expiration_time", currentDate);
         }
+        // 获取当前时间
+        LocalDate nowDay = LocalDate.now();
+        if(CommonConstant.FOOD_LICENCE_EXPIRE_STATUS.equals(foodLicenceWhetherExpiredStatus)){
+            queryWrapper.lt("a.food_licence_expiration_time",nowDay);
+        } else if(CommonConstant.FOOD_LICENCE_ABOUT_TO_EXPIRE_STATUS.equals(foodLicenceWhetherExpiredStatus)){
+            queryWrapper.lt("a.food_licence_expiration_time",nowDay.plusDays(31))
+                    .ge("a.food_licence_expiration_time",nowDay);
+        }else if(CommonConstant.FOOD_LICENCE_NOT_EXPIRED_STATUS.equals(foodLicenceWhetherExpiredStatus)){
+            queryWrapper.gt("a.food_licence_expiration_time",nowDay.plusDays(31));
+        }
         IPage<StoreInfoVo> storeInfoVoPage = storeInfoMapper.getStoreInfoVoPage(iPage, queryWrapper);
         List<StoreInfoVo> records = storeInfoVoPage.getRecords();
         if (!records.isEmpty()) {
@@ -371,6 +385,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
                     } else {
                         record.setExpiredState("2");
                     }
+
                     // 获取当前时间
                     LocalDate nowLocal = LocalDate.now();
                     // 将 expirationTime 转换为 LocalDate
@@ -379,6 +394,28 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
                     long daysToExpire = ChronoUnit.DAYS.between(nowLocal, expDate);
                     record.setDaysToExpire(daysToExpire);
                 }
+                // 处理经营许可证到期时间回显状态
+                Date foodDate = record.getFoodLicenceExpirationTime();
+                if(foodDate != null){
+                    // 获取当前时间
+                    LocalDate nowLocal = LocalDate.now();
+                    LocalDate localDate = foodDate.toInstant()  // Date -> Instant(UTC时间戳)
+                            .atZone(ZoneId.systemDefault())  // Instant -> ZonedDateTime(系统默认时区)
+                            .toLocalDate();
+                    long remainingDays = ChronoUnit.DAYS.between(nowLocal, localDate);
+                    if(remainingDays == -1){
+                        record.setFoodLicenceRemainingDays("0天");
+                        record.setFoodLicenceExpireStatus("已到期");
+                    }else if(remainingDays >= 0 && remainingDays <= 30){
+                        record.setFoodLicenceRemainingDays(remainingDays + "天");
+                        record.setFoodLicenceExpireStatus("即将到期");
+                    }else if(remainingDays > 30){
+                        record.setFoodLicenceRemainingDays(remainingDays + "天");
+                        record.setFoodLicenceExpireStatus("未到期");
+                    }
+                }
+
+
                 // 处理状态
                 if (record.getLogoutFlag() == 1) {
                     record.setStoreStatusStr("已注销");
@@ -590,15 +627,30 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
             storeImgMapper.insert(storeImg);
         }
         //存入店铺合同图片
-        List<String> contractImageList = storeInfoDto.getContractImageList();
-        for (String licenseAddress : contractImageList) {
-            StoreImg storeImg = new StoreImg();
-            storeImg.setStoreId(storeInfo.getId());
-            storeImg.setImgType(15);
-            storeImg.setImgSort(0);
-            storeImg.setImgDescription("合同图片");
-            storeImg.setImgUrl(licenseAddress);
-            storeImgMapper.insert(storeImg);
+        if(!CollectionUtils.isEmpty(storeInfoDto.getContractImageList())){
+            List<String> contractImageList = storeInfoDto.getContractImageList();
+            //先移除此前数据
+            storeImgMapper.delete(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, storeInfo.getId()).eq(StoreImg::getImgType, 15));
+            for (String licenseAddress : contractImageList) {
+                StoreImg storeImg = new StoreImg();
+                storeImg.setStoreId(storeInfo.getId());
+                storeImg.setImgType(15);
+                storeImg.setImgSort(0);
+                storeImg.setImgDescription("合同图片");
+                storeImg.setImgUrl(licenseAddress);
+                storeImgMapper.insert(storeImg);
+            }
+        }
+
+        //存入店铺经营许可证图片
+        if(StringUtils.isNotEmpty(storeInfoDto.getFoodLicenceUrl())){
+                StoreImg storeImg = new StoreImg();
+                storeImg.setStoreId(storeInfo.getId());
+                storeImg.setImgType(25);
+                storeImg.setImgSort(0);
+                storeImg.setImgDescription("经营许可证审核通过图片");
+                storeImg.setImgUrl(storeInfoDto.getFoodLicenceUrl());
+                storeImgMapper.insert(storeImg);
         }
 
         // 发送通知
@@ -659,6 +711,10 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
         if (storeInfoDraft.getContractUrl().isEmpty()) {
             storeInfoDraft.setContractUrl(null);
         }
+
+        if (storeInfoDraft.getFoodLicenceUrl().isEmpty()) {
+            storeInfoDraft.setFoodLicenceUrl(null);
+        }
         return storeInfoDraftMapper.insert(storeInfoDraft);
     }
 
@@ -738,20 +794,25 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
         storeUserMapper.updateById(storeUser);
         BeanUtils.copyProperties(storeInfoDto, result);
         //存入店铺营业执照图片
-        List<String> businessLicenseAddress = storeInfoDto.getBusinessLicenseAddress();
-        //先移除此前数据
-        storeImgMapper.delete(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, storeInfo.getId()).eq(StoreImg::getImgType, 14));
-        for (String licenseAddress : businessLicenseAddress) {
-            StoreImg storeImg = new StoreImg();
-            storeImg.setStoreId(storeInfo.getId());
-            storeImg.setImgType(14);
-            storeImg.setImgDescription("营业执照");
-            storeImg.setImgSort(0);
-            storeImg.setImgUrl(licenseAddress);
-            storeImgMapper.insert(storeImg);
+        if(!CollectionUtils.isEmpty(storeInfoDto.getBusinessLicenseAddress())){
+            List<String> businessLicenseAddress = storeInfoDto.getBusinessLicenseAddress();
+            //先移除此前数据
+            storeImgMapper.delete(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, storeInfo.getId()).eq(StoreImg::getImgType, 14));
+            for (String licenseAddress : businessLicenseAddress) {
+                StoreImg storeImg = new StoreImg();
+                storeImg.setStoreId(storeInfo.getId());
+                storeImg.setImgType(14);
+                storeImg.setImgDescription("营业执照");
+                storeImg.setImgSort(0);
+                storeImg.setImgUrl(licenseAddress);
+                storeImgMapper.insert(storeImg);
+            }
         }
+
         //存入店铺合同图片
         List<String> contractImageList = storeInfoDto.getContractImageList();
+        //先移除此前数据
+        storeImgMapper.delete(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, storeInfo.getId()).eq(StoreImg::getImgType, 15));
         for (String licenseAddress : contractImageList) {
             StoreImg storeImg = new StoreImg();
             storeImg.setStoreId(storeInfo.getId());
@@ -761,6 +822,22 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
             storeImg.setImgUrl(licenseAddress);
             storeImgMapper.insert(storeImg);
         }
+        //存入店铺经营许可证图片
+        if(StringUtils.isNotEmpty(storeInfoDto.getFoodLicenceUrl())){
+            //先移除此前数据 type:25 审核通过后的图片
+            storeImgMapper.delete(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, storeInfo.getId()).eq(StoreImg::getImgType, 25));
+            //先移除此前数据 type:24 审核前的或者审核拒绝的图片
+            storeImgMapper.delete(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, storeInfo.getId()).eq(StoreImg::getImgType, 24));
+            StoreImg storeImg = new StoreImg();
+            storeImg.setStoreId(storeInfo.getId());
+            //type:25 审核通过的类型
+            storeImg.setImgType(25);
+            storeImg.setImgSort(0);
+            storeImg.setImgDescription("经营许可证审核通过图片");
+            storeImg.setImgUrl(storeInfoDto.getFoodLicenceUrl());
+            storeImgMapper.insert(storeImg);
+        }
+
         return result;
     }
 
@@ -897,6 +974,8 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
         if (storeUser != null) {
             result.setUserAccount(storeUser.getId().toString());
             result.setStorePhone(storeUser.getPhone());
+            result.setStoreUserName(storeUser.getName());
+            result.setIdCard(storeUser.getIdCard());
         }
         //存入执照图片地址
         List<StoreImg> storeImgs = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, storeId).eq(StoreImg::getImgType, 14));
@@ -919,6 +998,20 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
             renewContractImagePathImgs.add(storeImg.getImgUrl());
         }
         result.setRenewContractImageList(renewContractImagePathImgs);
+        //存入经营许可证通过地址
+        List<StoreImg> foodLicenceImgs = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, storeId).eq(StoreImg::getImgType, 25));
+        List<String> foodLicenceImgsPathImgs = new ArrayList<>();
+        for (StoreImg storeImg : foodLicenceImgs) {
+            foodLicenceImgsPathImgs.add(storeImg.getImgUrl());
+        }
+        result.setFoodLicenceImageList(foodLicenceImgsPathImgs);
+        //存入经营许可证未通过地址
+        List<StoreImg> notPassFoodLicenceImgs = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, storeId).eq(StoreImg::getImgType, 24));
+        List<String> notPassFoodLicenceList = new ArrayList<>();
+        for (StoreImg storeImg : notPassFoodLicenceImgs) {
+            notPassFoodLicenceList.add(storeImg.getImgUrl());
+        }
+        result.setNotPassFoodLicenceImageList(notPassFoodLicenceList);
         // 存放商家入口图
         List<StoreImg> storeEntranceImageImgs = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, storeId).eq(StoreImg::getImgType, 1));
         if (!storeEntranceImageImgs.isEmpty()) {
@@ -933,6 +1026,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
         } else {
             result.setImgUrl("null");
         }
+
         // 设置经纬度
         result.setStorePositionLongitude(result.getStorePosition().split(",")[0]);
         result.setStorePositionLatitude(result.getStorePosition().split(",")[1]);
@@ -1866,7 +1960,12 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
 
     @Override
     public int uploadRenewalContract(List<StoreImg> storeImgList) {
+        //取出集合中门店id
+        Optional<Integer> storeId = storeImgList.stream().map(StoreImg::getStoreId).findFirst();
+        int value = storeId.orElse(0);
         int num = 0;
+        //先清除数据
+        storeImgMapper.delete(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getImgType,22).eq(StoreImg::getStoreId,value));
         for (StoreImg renewContract : storeImgList) {
             StoreImg storeImg = new StoreImg();
             storeImg.setStoreId(renewContract.getStoreId());
@@ -1878,10 +1977,9 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
             num = storeImgMapper.insert(storeImg);
         }
         if (num > 0) {
-            Optional<Integer> storeId = storeImgList.stream().map(StoreImg::getStoreId).findFirst();
-            int value = storeId.orElse(0);
             StoreInfo storeInfo = new StoreInfo();
             storeInfo.setRenewContractStatus(2);
+            storeInfo.setUpdateRenewContractTime(new Date());
             storeInfo.setId(value);
             storeInfoMapper.updateById(storeInfo);
         }
@@ -1889,6 +1987,20 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
     }
 
     @Override
+    public int uploadfoodLicence(StoreImg storeImg) {
+            storeImgMapper.delete(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getImgType,24).eq(StoreImg::getStoreId,storeImg.getStoreId()));
+            storeImg.setImgType(24);
+            storeImg.setImgDescription("经营许可证审核通过前图片");
+            storeImgMapper.insert(storeImg);
+            //更新店铺
+            StoreInfo storeInfo = new StoreInfo();
+            storeInfo.setFoodLicenceStatus(2);
+            storeInfo.setId(storeImg.getStoreId());
+            storeInfo.setUpdateFoodLicenceTime(new Date());
+        return storeInfoMapper.updateById(storeInfo);
+    }
+
+    @Override
     public Map<String, Object> getStoreContractStatus(int id) {
         Map<String, Object> map = new HashMap<>();
         StoreInfo storeInfo = storeInfoMapper.selectOne(new LambdaQueryWrapper<StoreInfo>().eq(StoreInfo::getId, id));
@@ -1914,6 +2026,40 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
     }
 
     @Override
+    public Map<String, Object> getStoreFoodLicenceStatus(int id) {
+        Map<String, Object> map = new HashMap<>();
+        StoreInfo storeInfo = storeInfoMapper.selectOne(new LambdaQueryWrapper<StoreInfo>().eq(StoreInfo::getId, id));
+        //审核通过给前台反显未提交
+        if (storeInfo.getFoodLicenceStatus() == 1) {
+            map.put("foodLicenceStatus", 0);
+        } else {
+            map.put("foodLicenceStatus", storeInfo.getFoodLicenceStatus());
+        }
+        //食品经营许可证照片列表
+        if(storeInfo.getFoodLicenceStatus()==2||storeInfo.getFoodLicenceStatus()==3){
+            List<StoreImg> storeImgList = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getImgType, 24).eq(StoreImg::getStoreId, id));
+            if (!CollectionUtils.isEmpty(storeImgList)) {
+                map.put("foodLicenceImgList", storeImgList);
+            } else {
+                map.put("foodLicenceImgList", "");
+            }
+        }else if(storeInfo.getFoodLicenceStatus()==1){
+            List<StoreImg> storeImgList = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getImgType, 25).eq(StoreImg::getStoreId, id));
+            if (!CollectionUtils.isEmpty(storeImgList)) {
+                map.put("foodLicenceImgList", storeImgList);
+            } else {
+                map.put("foodLicenceImgList", "");
+            }
+        }
+        if (storeInfo.getFoodLicenceReason() != null) {
+            map.put("foodLicenceReason", storeInfo.getFoodLicenceReason());
+        } else {
+            map.put("foodLicenceReason", "");
+        }
+        return map;
+    }
+
+    @Override
     public int conversionContract(int id) {
         //删除原合同照片
         LambdaQueryWrapper<StoreImg> lambdaQueryWrapper = new LambdaQueryWrapper<>();
@@ -1924,11 +2070,28 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
         List<StoreImg> storeImgList = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, id).eq(StoreImg::getImgType, 22));
         List<Integer> imgList = storeImgList.stream().map(StoreImg::getId).collect(Collectors.toList());
         LambdaUpdateWrapper<StoreImg> lambdaUpdateWrapper = new LambdaUpdateWrapper();
-        lambdaUpdateWrapper.in(StoreImg::getId, imgList).set(StoreImg::getImgType, 15);
+        lambdaUpdateWrapper.in(StoreImg::getId, imgList).set(StoreImg::getImgType, 15).set(StoreImg::getImgDescription,"合同图片");
         int num = storeImgMapper.update(null, lambdaUpdateWrapper);
         return num;
     }
 
+    @Override
+    public int foodLicenceType(int id) {
+        //删除原合同照片
+        LambdaUpdateWrapper<StoreImg> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
+        lambdaUpdateWrapper.eq(StoreImg::getStoreId, id);
+        lambdaUpdateWrapper.eq(StoreImg::getImgType, 25);
+        lambdaUpdateWrapper.set(StoreImg::getDeleteFlag,1);
+        storeImgMapper.update(null,lambdaUpdateWrapper);
+        //修改续签合同类型为合同类型
+        List<StoreImg> storeImgList = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>().eq(StoreImg::getStoreId, id).eq(StoreImg::getImgType, 24));
+        List<Integer> imgList = storeImgList.stream().map(StoreImg::getId).collect(Collectors.toList());
+        LambdaUpdateWrapper<StoreImg> imgLambdaUpdateWrapper = new LambdaUpdateWrapper();
+        imgLambdaUpdateWrapper.in(StoreImg::getId, imgList).set(StoreImg::getImgType, 25).set(StoreImg::getImgDescription,"经营许可证审核通过图片");
+        int num = storeImgMapper.update(null, imgLambdaUpdateWrapper);
+        return num;
+    }
+
     void verificationStoreInfoStatus(StoreInfoDto storeInfo) {
         //营业状态 0:正常营业, 1:暂停营业, 2:筹建中, 99:永久关门
         if (storeInfo.getBusinessStatus() == 99) {

+ 7 - 0
alien-store/src/main/java/shop/alien/store/util/CommonConstant.java

@@ -48,4 +48,11 @@ public class CommonConstant {
     public static final Integer STORE_IMG_ALBUM = 2;
 
     public static final String STORE_DICT_TYPENAME = "storeArea,businessStatus,week,specialDate,business_section,fine_food";
+
+    /**
+     * 门店经营许可证到期状态管理 0:已到期 1:即将到期 2:未到期
+     */
+    public static final String FOOD_LICENCE_EXPIRE_STATUS = "0";
+    public static final String FOOD_LICENCE_ABOUT_TO_EXPIRE_STATUS = "1";
+    public static final String FOOD_LICENCE_NOT_EXPIRED_STATUS = "2";
 }