springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsEvaluateVO.java
@@ -31,7 +31,7 @@ private String photos; @ApiModelProperty("评价时间") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date createdAt; @ApiModelProperty("用户") springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsGameVO.java
@@ -52,7 +52,7 @@ private String lon; @ApiModelProperty("失效时间") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date expireAt; @ApiModelProperty("封面") @@ -71,7 +71,7 @@ private Boolean isPopular; @ApiModelProperty("发布时间") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date publishAt; @ApiModelProperty("所属商家") springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsInformationVO.java
@@ -43,7 +43,7 @@ private Integer status; @ApiModelProperty("发布时间") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date publishAt; @ApiModelProperty("所属商家") springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsLabelVO.java
New file @@ -0,0 +1,26 @@ package com.panzhihua.common.model.vos.community.microCommercialStreet; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** * @title: McsLabelVO * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 * @description: 产品标签信息 * @author: hans * @date: 2022/01/05 14:54 */ @Data @ApiModel("产品标签信息") public class McsLabelVO { @ApiModelProperty("标签id") private Long id; @ApiModelProperty("标签名称") private String name; @ApiModelProperty("说明") private String introduction; } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsMerchantVO.java
@@ -40,7 +40,7 @@ private Integer publishLimit; @ApiModelProperty("到期时间") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date expireAt; @ApiModelProperty("商家地址") @@ -56,9 +56,12 @@ private String introduction; @ApiModelProperty("首次点亮时间") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date firstLitAt; @ApiModelProperty("剩余点亮天数") private Integer surplusLitDays; @ApiModelProperty("账号状态(1.启用 2.禁用)") private Integer accountStatus; springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/TopStatisticsVO.java
@@ -20,9 +20,12 @@ public class TopStatisticsVO { @ApiModelProperty("到期时间") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date expireAt; @ApiModelProperty("剩余点亮天数") private Integer surplusLitDays; @ApiModelProperty("领取人数") private Integer appliedTotal; springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -17,6 +17,7 @@ import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForInfoDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForProductDTO; import com.panzhihua.common.model.vos.LoginUserInfoVO; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsConfigVO; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.scheduling.annotation.Async; @@ -7982,4 +7983,20 @@ */ @PostMapping("/microcommercialstreet/product/page") R pageMcsProduct(@RequestBody PageMcsProductDTO pageMcsProductDTO); /** * 获取产品标签列表 * @param userId * @return */ @GetMapping("/microcommercialstreet/label/list") R getMcsLabelList(@RequestParam("userId") Long userId); /** * check商家/店铺是否有效 * @param userId * @return */ @GetMapping("/shop/checkStoreIsValid") R checkStoreIsValid(@RequestParam("userId") Long userId); } springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/user/UserService.java
@@ -1109,4 +1109,13 @@ */ @PutMapping("putMcsMerchantUser") R putMcsMerchantUser(@RequestBody McsMerchantDTO mcsMerchantDTO); /** * 检查用户是否有效 * @param userId * @param type * @return */ @PutMapping("checkUserIsValid") Boolean checkUserIsValid(@RequestParam("userId") Long userId, @RequestParam("type") Integer type); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/MicroCommercialStreetApi.java
@@ -1,10 +1,22 @@ package com.panzhihua.service_community.api; import java.util.List; import javax.annotation.Resource; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.panzhihua.common.model.dtos.community.microCommercialStreet.DisableOrEnableMcsMerchantDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsInfoDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsMerchantDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsProductDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsEvaluateDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsGameDTO; @@ -15,33 +27,15 @@ import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForGameDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForInfoDTO; import com.panzhihua.common.model.dtos.community.microCommercialStreet.SetShelfForProductDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsConfigVO; import com.panzhihua.service_community.service.McsConfigService; import com.panzhihua.service_community.service.McsEvaluateService; import com.panzhihua.service_community.service.McsGameService; import com.panzhihua.service_community.service.McsInformationService; import com.panzhihua.service_community.service.McsLabelService; import com.panzhihua.service_community.service.McsMerchantService; import com.panzhihua.service_community.service.McsProductService; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.panzhihua.common.controller.BaseController; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsMerchantDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.service.community.CommunityService; import com.panzhihua.common.validated.AddGroup; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import java.util.List; /** * @title: MicroCommercialStreetApi @@ -66,6 +60,8 @@ private McsEvaluateService mcsEvaluateService; @Resource private McsProductService mcsProductService; @Resource private McsLabelService mcsLabelService; /** * 新增数字商业街商家 @@ -391,4 +387,14 @@ public R pageMcsProduct(@RequestBody PageMcsProductDTO pageMcsProductDTO) { return mcsProductService.pageMcsProduct(pageMcsProductDTO); } /** * 获取产品标签列表 * @param userId * @return */ @GetMapping("/label/list") public R getMcsLabelList(@RequestParam("userId") Long userId) { return mcsLabelService.getMcsLabelList(userId); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ShopApi.java
@@ -6,18 +6,52 @@ import org.springframework.beans.BeanUtils; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.panzhihua.common.model.dtos.PageDTO; import com.panzhihua.common.model.dtos.shop.*; import com.panzhihua.common.model.dtos.shop.ComShopAddressDTO; import com.panzhihua.common.model.dtos.shop.ComShopCartDTO; import com.panzhihua.common.model.dtos.shop.ComShopEditNubCartDTO; import com.panzhihua.common.model.dtos.shop.ComShopFundsExportDTO; import com.panzhihua.common.model.dtos.shop.ComShopGoodsDTO; import com.panzhihua.common.model.dtos.shop.ComShopOrderCreateDTO; import com.panzhihua.common.model.dtos.shop.ComShopOrderDeliverDTO; import com.panzhihua.common.model.dtos.shop.ComShopOrderExportDTO; import com.panzhihua.common.model.dtos.shop.ComShopOrderPreviewDTO; import com.panzhihua.common.model.dtos.shop.ComShopOrderQueryDTO; import com.panzhihua.common.model.dtos.shop.ComShopOrderShipDTO; import com.panzhihua.common.model.dtos.shop.ComShopSysConfDTO; import com.panzhihua.common.model.dtos.shop.OrderPayDTO; import com.panzhihua.common.model.dtos.shop.PageComOrderListDTO; import com.panzhihua.common.model.dtos.shop.PageComShopAddressDTO; import com.panzhihua.common.model.dtos.shop.PageComShopFundsSearchDTO; import com.panzhihua.common.model.dtos.shop.PageComShopGoodsDTO; import com.panzhihua.common.model.dtos.shop.PageComShopOrderSearchDTO; import com.panzhihua.common.model.dtos.shop.PageComShopStoreDTO; import com.panzhihua.common.model.dtos.shop.PageComShopSysConfDTO; import com.panzhihua.common.model.dtos.shop.WxPayNotifyOrderDTO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.shop.AddShopGoodsVO; import com.panzhihua.common.model.vos.shop.ComShopSysConfVO; import com.panzhihua.common.model.vos.shop.ShopOperLogVO; import com.panzhihua.common.model.vos.shop.ShopStoreVO; import com.panzhihua.common.service.user.UserService; import com.panzhihua.service_community.model.dos.ComShopSysConfDO; import com.panzhihua.service_community.service.*; import com.panzhihua.service_community.service.ComShopCartService; import com.panzhihua.service_community.service.ComShopGoodsService; import com.panzhihua.service_community.service.ComShopOperLogService; import com.panzhihua.service_community.service.ComShopOrderService; import com.panzhihua.service_community.service.ComShopStoreService; import com.panzhihua.service_community.service.ComShopSysConfService; import com.panzhihua.service_community.service.ComShopUserAddressService; import com.panzhihua.service_community.service.ConvenientMerchantService; import lombok.extern.slf4j.Slf4j; @@ -40,6 +74,10 @@ private ComShopUserAddressService comShopUserAddressService; @Resource private ComShopSysConfService comShopSysConfService; @Resource private ConvenientMerchantService convenientMerchantService; @Resource private UserService userService; /** * 店铺列表-分页查询 @@ -636,4 +674,17 @@ } return R.ok(); } /** * check商家/店铺是否有效 * @param userId * @return */ @GetMapping("/checkStoreIsValid") public R checkStoreIsValid(@RequestParam("userId") Long userId) { Boolean isShopValid = comShopStoreService.checkStoreIsValid(userId); Boolean isConvenientValid = convenientMerchantService.checkStoreIsValid(userId); Boolean isMcsValid = userService.checkUserIsValid(userId, 11); return R.ok(isShopValid || isConvenientValid || isMcsValid); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/McsLabelDAO.java
@@ -3,6 +3,7 @@ import java.util.List; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsLabelVO; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Mapper; import com.panzhihua.service_community.entity.McsLabel; @@ -36,4 +37,10 @@ */ int insertOrUpdateBatch(@Param("entities") List<McsLabel> entities); /** * 获取产品标签列表 * @param userId * @return */ List<McsLabelVO> selectVOList(@Param("userId") Long userId); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/entity/McsConfig.java
@@ -1,5 +1,6 @@ package com.panzhihua.service_community.entity; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @@ -26,6 +27,7 @@ /** * 配置项 */ @TableField("`key`") private String key; /** * 配置内容 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/entity/McsMerchant.java
@@ -1,11 +1,12 @@ package com.panzhihua.service_community.entity; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.io.Serializable; import java.util.Date; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; /** * (McsMerchant)表实体类 * springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComShopStoreService.java
@@ -91,4 +91,11 @@ * @return */ R getUserStoreInfo(String account); /** * check商家/店铺是否有效 * @param userId * @return */ Boolean checkStoreIsValid(Long userId); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ConvenientMerchantService.java
@@ -139,4 +139,11 @@ * @return */ R timedTaskWriteDataToMerchantJobHandler(); /** * check商家/店铺是否有效 * @param userId * @return */ Boolean checkStoreIsValid(Long userId); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/McsLabelService.java
@@ -1,6 +1,7 @@ package com.panzhihua.service_community.service; import com.baomidou.mybatisplus.extension.service.IService; import com.panzhihua.common.model.vos.R; import com.panzhihua.service_community.entity.McsLabel; /** @@ -11,4 +12,10 @@ */ public interface McsLabelService extends IService<McsLabel> { /** * 获取产品标签列表 * @param userId * @return */ R getMcsLabelList(Long userId); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopStoreServiceImpl.java
@@ -1,5 +1,7 @@ package com.panzhihua.service_community.service.impl; import static com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isNull; import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -305,4 +307,19 @@ return R.fail(); } } /** * check商家/店铺是否有效 * @param userId * @return */ @Override public Boolean checkStoreIsValid(Long userId) { ComShopStoreDO comShopStoreDO = this.baseMapper.selectOne(new LambdaQueryWrapper<ComShopStoreDO>() .eq(ComShopStoreDO::getDeleteStatus, 1).eq(ComShopStoreDO::getSysUserId, userId)); if (isNull(comShopStoreDO) || comShopStoreDO.getStatus() != 1) { return false; } return true; } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ConvenientMerchantServiceImpl.java
@@ -432,4 +432,20 @@ this.baseMapper.batchUpdateMerchantViewNum(viewVOList); return R.ok(); } /** * check商家/店铺是否有效 * @param userId * @return */ @Override public Boolean checkStoreIsValid(Long userId) { R<LoginUserInfoVO> loginUserInfo = userService.getUserInfoByUserId(userId.toString()); LoginUserInfoVO loginUserInfoVO = JSONObject.parseObject(JSONObject.toJSONString(loginUserInfo.getData()), LoginUserInfoVO.class); if (isNull(loginUserInfoVO) || !loginUserInfoVO.getType().equals(10) || loginUserInfoVO.getStatus() != 1) { return false; } return true; } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsGameServiceImpl.java
@@ -1,10 +1,12 @@ package com.panzhihua.service_community.service.impl; import static java.util.Objects.isNull; import static java.util.Objects.nonNull; import javax.annotation.Resource; import com.panzhihua.common.model.vos.community.microCommercialStreet.TopStatisticsVO; import com.panzhihua.common.utlis.DateUtils; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; @@ -299,6 +301,10 @@ } TopStatisticsVO topStatisticsVO = new TopStatisticsVO(); topStatisticsVO.setExpireAt(mcsMerchant.getExpireAt()); if (nonNull(mcsMerchant.getExpireAt())) { int surplusLitDays = DateUtils.differentDays(new Date(), mcsMerchant.getExpireAt()); topStatisticsVO.setSurplusLitDays(surplusLitDays > 0 ? surplusLitDays : 0); } Integer appliedCount = this.baseMapper.selectAppliedCount(mcsMerchant.getId()); topStatisticsVO.setAppliedTotal(appliedCount); Integer verifiedCount = this.baseMapper.selectVerifiedCount(mcsMerchant.getId()); springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsInformationServiceImpl.java
@@ -1,10 +1,12 @@ package com.panzhihua.service_community.service.impl; import static java.util.Objects.isNull; import static java.util.Objects.nonNull; import javax.annotation.Resource; import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsInfoDTO; import com.panzhihua.common.utlis.DateUtils; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; @@ -124,6 +126,10 @@ } TopStatisticsVO topStatisticsVO = new TopStatisticsVO(); topStatisticsVO.setExpireAt(mcsMerchant.getExpireAt()); if (nonNull(mcsMerchant.getExpireAt())) { int surplusLitDays = DateUtils.differentDays(new Date(), mcsMerchant.getExpireAt()); topStatisticsVO.setSurplusLitDays(surplusLitDays > 0 ? surplusLitDays : 0); } Integer publishLimit = mcsMerchant.getPublishLimit(); Integer publishCount = mcsGameDAO.selectPublishCount(mcsMerchant.getId()); springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsLabelServiceImpl.java
@@ -1,10 +1,12 @@ package com.panzhihua.service_community.service.impl; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.panzhihua.common.model.vos.R; import com.panzhihua.service_community.dao.McsLabelDAO; import com.panzhihua.service_community.entity.McsLabel; import com.panzhihua.service_community.service.McsLabelService; import org.springframework.stereotype.Service; /** * (McsLabel)表服务实现类 @@ -15,4 +17,13 @@ @Service("mcsLabelService") public class McsLabelServiceImpl extends ServiceImpl<McsLabelDAO, McsLabel> implements McsLabelService { /** * 获取产品标签列表 * @param userId * @return */ @Override public R getMcsLabelList(Long userId) { return R.ok(this.baseMapper.selectVOList(userId)); } } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsMerchantServiceImpl.java
@@ -5,6 +5,7 @@ import java.util.Arrays; import java.util.Date; import java.util.List; import javax.annotation.Resource; @@ -67,6 +68,7 @@ return R.fail("临时商家未设置点亮天数"); } mcsMerchant.setExpireAt(DateUtils.addDay(new Date(), litDays)); mcsMerchant.setFirstLitAt(new Date()); } McsConfig publishLimitConfig = mcsConfigDAO.selectOne(new QueryWrapper<McsConfig>().lambda().eq(McsConfig::getKey, MERCHANT_PUBLISH_LIMIT_KEY)); mcsMerchant.setPublishLimit(nonNull(publishLimitConfig) ? Integer.parseInt(publishLimitConfig.getValue()) : DEFAULT_PUBLISH_LIMIT); @@ -96,6 +98,7 @@ @Transactional(rollbackFor = Exception.class) public R putMcsMerchant(McsMerchantDTO mcsMerchantDTO) { McsMerchant mcsMerchant = this.baseMapper.selectById(mcsMerchantDTO.getId()); Long userId = mcsMerchant.getUserId(); if (isNull(mcsMerchant)) { return R.fail("商家不存在"); } @@ -109,7 +112,7 @@ int result = this.baseMapper.updateById(mcsMerchant); if (result > 0) { //修改商家绑定账户号 mcsMerchantDTO.setUserId(mcsMerchant.getUserId()); mcsMerchantDTO.setUserId(userId); R putResult = userService.putMcsMerchantUser(mcsMerchantDTO); if (!R.isOk(putResult)) { throw new ServiceException("406", putResult.getMsg()); @@ -132,6 +135,10 @@ Integer publishCount = mcsGameDAO.selectPublishCount(merchantVO.getId()); Integer idleTotal = publishLimit - publishCount; merchantVO.setIdleTotal(idleTotal > 0 ? idleTotal : 0); if (nonNull(merchantVO.getExpireAt())) { int surplusLitDays = DateUtils.differentDays(new Date(), merchantVO.getExpireAt()); merchantVO.setSurplusLitDays(surplusLitDays > 0 ? surplusLitDays : 0); } } return R.ok(merchantVO); } @@ -164,6 +171,16 @@ page.setSize(pageMcsMerchantDTO.getPageSize()); page.setCurrent(pageMcsMerchantDTO.getPageNum()); IPage<McsMerchantVO> mcsMerchants = this.baseMapper.pageMcsMerchant(page, pageMcsMerchantDTO); List<McsMerchantVO> records = mcsMerchants.getRecords(); if (nonNull(records) && !records.isEmpty()) { Date nowDate = new Date(); records.forEach(e -> { if (nonNull(e.getExpireAt())) { int surplusLitDays = DateUtils.differentDays(nowDate, e.getExpireAt()); e.setSurplusLitDays(surplusLitDays > 0 ? surplusLitDays : 0); } }); } return R.ok(mcsMerchants); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsLabelMapper.xml
@@ -38,6 +38,10 @@ values(merchant_id) , created_at = values(created_at) , created_by = values(created_by) , updated_at = values(updated_at) , updated_by = values(updated_by) </insert> <select id="selectVOList" resultType="com.panzhihua.common.model.vos.community.microCommercialStreet.McsLabelVO"> SELECT id, `name`, introduction FROM mcs_label WHERE is_del = 0 </select> </mapper> springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsMerchantMapper.xml
@@ -64,7 +64,7 @@ </select> <select id="pageMcsMerchant" resultType="com.panzhihua.common.model.vos.community.microCommercialStreet.McsMerchantVO"> SELECT t1.id, t1.`name`, t1.phone, t1.account, t1.`level`, t1.expire_at, t2.`status` AS accountStatus SELECT t1.id, t1.`name`, t1.phone, t1.account, t1.`level`, t1.expire_at, t1.first_lit_at, t2.`status` AS accountStatus FROM mcs_merchant t1 LEFT JOIN sys_user t2 ON t1.user_id = t2.user_id WHERE t1.is_del = 0 springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/api/UserApi.java
@@ -1257,4 +1257,15 @@ public R putMcsMerchantUser(@RequestBody McsMerchantDTO mcsMerchantDTO) { return userService.putMcsMerchantUser(mcsMerchantDTO); } /** * 检查用户是否有效 * @param userId * @param type * @return */ @PutMapping("checkUserIsValid") public Boolean checkUserIsValid(@RequestParam("userId") Long userId, @RequestParam("type") Integer type) { return userService.checkUserIsValid(userId, type); } } springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/UserService.java
@@ -771,4 +771,12 @@ * @return */ R putMcsMerchantUser(McsMerchantDTO mcsMerchantDTO); /** * 检查用户是否有效 * @param userId * @param type * @return */ Boolean checkUserIsValid(Long userId, Integer type); } springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
@@ -2877,4 +2877,19 @@ } return R.ok(); } /** * 检查用户是否有效 * @param userId * @param type * @return */ @Override public Boolean checkUserIsValid(Long userId, Integer type) { SysUserDO sysUserDO = userDao.selectById(userId); if (isNull(sysUserDO) || sysUserDO.getStatus() != 1 || !sysUserDO.getType().equals(type)) { return false; } return true; } } springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/api/MicroCommercialStreetApi.java
@@ -3,6 +3,7 @@ import javax.annotation.Resource; import javax.validation.Valid; import com.panzhihua.common.model.vos.community.microCommercialStreet.McsLabelVO; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; @@ -205,6 +206,12 @@ return communityService.pageMcsProduct(pageMcsProductDTO); } @ApiOperation(value = "获取产品标签列表", response = McsLabelVO.class) @GetMapping("/label/list") public R getMcsLabelList() { return communityService.getMcsLabelList(this.getUserId()); } @ApiOperation(value = "分页查询评价记录", response = McsEvaluateVO.class) @PostMapping("/evaluate/page") public R pageMcsEvaluate(@RequestBody @Valid PageMcsEvaluateDTO pageMcsEvaluateDTO) { springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/filter/StoreValidFilter.java
@@ -51,72 +51,39 @@ String uri = request.getRequestURI(); boolean isDoc = uri.contains("doc.html") || uri.contains("-docs"); boolean convenientLogin = "/convenient/login".equals(uri); boolean isConvenientReq = uri.contains("/convenient"); boolean mcsLogin = "/microcommercialstreet/login".equals(uri); boolean storeLogin = "/login".equals(uri); boolean isUpload = "/convenient/upload/file".equals(uri); if (isDoc || isUpload) { if (isDoc || isUpload || storeLogin || convenientLogin || mcsLogin) { //放过swagger请求 } else { if (!storeLogin && !isConvenientReq) { String userInfo = request.getHeader(TokenConstant.TOKEN_USERINFO); boolean empty = ObjectUtils.isEmpty(userInfo); if (empty) { log.error("获取登录用户信息失败【{}】", request); ResultUtil.responseJson(response, R.fail(HttpStatus.UNAUTHORIZED, "token过期")); return; } byte[] bytes = AES.parseHexStr2Byte(userInfo); byte[] decrypt = AES.decrypt(bytes, Constants.AES_KEY); userInfo = new String(decrypt); LoginUserInfoVO loginUserInfoVO = JSONObject.parseObject(userInfo, LoginUserInfoVO.class); String userInfo = request.getHeader(TokenConstant.TOKEN_USERINFO); boolean empty = ObjectUtils.isEmpty(userInfo); if (empty) { log.error("获取登录用户信息失败【{}】", request); ResultUtil.responseJson(response, R.fail(HttpStatus.UNAUTHORIZED, "token过期")); return; } byte[] bytes = AES.parseHexStr2Byte(userInfo); byte[] decrypt = AES.decrypt(bytes, Constants.AES_KEY); userInfo = new String(decrypt); LoginUserInfoVO loginUserInfoVO = JSONObject.parseObject(userInfo, LoginUserInfoVO.class); R r = communityService.getUserStoreInfo(loginUserInfoVO.getUserId()); boolean shopStoreValid = false; if (R.isOk(r) && r.getData() != null) { ShopStoreVO shopStoreVO = JSONObject.parseObject(JSONObject.toJSONString(r.getData()), ShopStoreVO.class); shopStoreValid = shopStoreVO.getStatus() == 1; } if (!shopStoreValid) { // 返回请求被拒绝响应 response.setContentType("application/json"); response.setCharacterEncoding("UTF-8"); response.getWriter().write(JSONObject.toJSONString(R.fail(403))); response.flushBuffer(); return; } } else if (!convenientLogin && isConvenientReq) { String userInfo = request.getHeader(TokenConstant.TOKEN_USERINFO); boolean empty = ObjectUtils.isEmpty(userInfo); if (empty) { log.error("获取登录用户信息失败【{}】", request); ResultUtil.responseJson(response, R.fail(HttpStatus.UNAUTHORIZED, "token过期")); return; } byte[] bytes = AES.parseHexStr2Byte(userInfo); byte[] decrypt = AES.decrypt(bytes, Constants.AES_KEY); userInfo = new String(decrypt); LoginUserInfoVO loginUserInfoVO = JSONObject.parseObject(userInfo, LoginUserInfoVO.class); R r = communityService.getUserMerchantInfoByAccount(loginUserInfoVO.getAccount()); boolean merchantValid = false; if (R.isOk(r) && r.getData() != null) { ConvenientMerchantVO merchantVO = JSONObject.parseObject(JSONObject.toJSONString(r.getData()), ConvenientMerchantVO.class); merchantValid = merchantVO.getAccountStatus() == 1; } if (!merchantValid) { // 返回请求被拒绝响应 response.setContentType("application/json"); response.setCharacterEncoding("UTF-8"); response.getWriter().write(JSONObject.toJSONString(R.fail(403))); response.flushBuffer(); return; } R r = communityService.checkStoreIsValid(loginUserInfoVO.getUserId()); Boolean isValid = false; if (R.isOk(r) && r.getData() != null) { isValid = JSONObject.parseObject(JSONObject.toJSONString(r.getData()), Boolean.class); } if (!isValid) { // 返回请求被拒绝响应 response.setContentType("application/json"); response.setCharacterEncoding("UTF-8"); response.getWriter().write(JSONObject.toJSONString(R.fail(403))); response.flushBuffer(); return; } } filterChain.doFilter(servletRequest, servletResponse); } }