puhanshu
2022-01-06 9eb00a96c64fabfe1a17d49844602736456762fa
商业街商家后台登录&支付完成处理
14个文件已修改
1个文件已添加
359 ■■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/api/LoginApi.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/service/LoginService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/service/impl/LoginServiceImpl.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsLoginUserInfoVO.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/auth/TokenService.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/MicroCommercialStreetApi.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/McsMerchantDAO.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/McsMerchantService.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsMerchantServiceImpl.java 119 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsGameMapper.xml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsMerchantMapper.xml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/api/MicroCommercialStreetApi.java 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/filter/StoreValidFilter.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/api/LoginApi.java
@@ -239,4 +239,19 @@
        LoginReturnVO loginReturnVO = loginService.loginXQDP(account, password);
        return R.ok(loginReturnVO);
    }
    /**
     * 微商业街用户登录
     *
     * @param account
     *            账户
     * @param password
     *            密码
     * @return 登录结果
     */
    @PostMapping("/loginMcsUser")
    public R loginMcsUser(@RequestParam("account") String account, @RequestParam("password") String password) {
        LoginReturnVO loginReturnVO = loginService.loginMcsUser(account, password);
        return R.ok(loginReturnVO);
    }
}
springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/service/LoginService.java
@@ -130,4 +130,12 @@
     * @return  登录结果
     */
    LoginReturnVO loginXQDP(String account, String password);
    /**
     * 微商业街用户登录
     * @param account 账户
     * @param password 密码
     * @return 登录结果
     */
    LoginReturnVO loginMcsUser(String account, String password);
}
springcloud_k8s_panzhihuazhihuishequ/auth/src/main/java/com/panzhihua/auth/service/impl/LoginServiceImpl.java
@@ -274,4 +274,22 @@
        loginReturnVO.setRefreshToken(refeshToken);
        return loginReturnVO;
    }
    /**
     * 微商业街用户登录
     * @param account 账户
     * @param password 密码
     * @return 登录结果
     */
    @Override
    public LoginReturnVO loginMcsUser(String account, String password) {
        Authentication authentication = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(account + "_11", password));
        LoginUserInfoVO loginUser = (LoginUserInfoVO)authentication.getPrincipal();
        String token = JWTTokenUtil.generateToken(loginUser);
        String refeshToken = JWTTokenUtil.generateRefeshToken(loginUser);
        LoginReturnVO loginReturnVO = new LoginReturnVO();
        loginReturnVO.setToken(token);
        loginReturnVO.setRefreshToken(refeshToken);
        return loginReturnVO;
    }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/microCommercialStreet/McsLoginUserInfoVO.java
New file
@@ -0,0 +1,22 @@
package com.panzhihua.common.model.vos.community.microCommercialStreet;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientMerchantVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @title: McsLoginUserInfoVO
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 微商业街用户登录信息
 * @author: hans
 * @date: 2022/01/06 13:12
 */
@Data
@ApiModel(value = "微商业街用户登录信息")
public class McsLoginUserInfoVO extends LoginUserInfoVO {
    @ApiModelProperty("商家信息")
    private McsMerchantVO mcsMerchantVO;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/auth/TokenService.java
@@ -142,4 +142,16 @@
     */
    @PostMapping("/loginXQDP")
    R loginXQDP(@RequestParam("account") String account, @RequestParam("password") String password);
    /**
     * 微商业街用户登录
     *
     * @param account
     *            账户
     * @param password
     *            密码
     * @return 登录结果
     */
    @PostMapping("/loginMcsUser")
    R loginMcsUser(@RequestParam("account") String account, @RequestParam("password") String password);
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -7999,4 +7999,23 @@
     */
    @GetMapping("/shop/checkStoreIsValid")
    R checkStoreIsValid(@RequestParam("userId") Long userId);
    /**
     * 根据account查询微商业街商家信息
     * @param account
     * @return
     */
    @GetMapping("/microcommercialstreet/getMcsMerchantByAccount")
    R getMcsMerchantByAccount(@RequestParam("account") String account);
    /**
     * 完成订单更新/新增商家信息
     * @param merchantName
     * @param configId
     * @param userId
     * @return
     */
    @GetMapping("/microcommercialstreet/updateAfterOrder")
    R updateMcsMerchantAfterOrder(@RequestParam(value = "merchantName", required = false) String merchantName,
                                  @RequestParam("configId") Long configId, @RequestParam("userId") Long userId);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/MicroCommercialStreetApi.java
@@ -397,4 +397,28 @@
    public R getMcsLabelList(@RequestParam("userId") Long userId) {
        return mcsLabelService.getMcsLabelList(userId);
    }
    /**
     * 根据account查询微商业街商家信息
     * @param account
     * @return
     */
    @GetMapping("/getMcsMerchantByAccount")
    public R getMcsMerchantByAccount(@RequestParam("account") String account) {
        return mcsMerchantService.getMcsMerchantByAccount(account);
    }
    /**
     * 完成订单更新/新增商家信息
     * @param merchantName
     * @param configId
     * @param userId
     * @return
     */
    @GetMapping("/updateAfterOrder")
    public R updateMcsMerchantAfterOrder(@RequestParam(value = "merchantName", required = false) String merchantName,
                                         @RequestParam("configId") Long configId,
                                         @RequestParam("userId") Long userId) {
        return mcsMerchantService.updateOrAddMcsMerchantAfterOrder(merchantName, configId, userId);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/McsMerchantDAO.java
@@ -54,4 +54,11 @@
     * @return
     */
    IPage<McsMerchantVO> pageMcsMerchant(@Param("page") Page page, @Param("pageMcsMerchantDTO") PageMcsMerchantDTO pageMcsMerchantDTO);
    /**
     * 根据账号查询商家
     * @param account
     * @return
     */
    McsMerchantVO getMcsMerchantByAccount(@Param("account") String account);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/McsMerchantService.java
@@ -57,4 +57,21 @@
     * @return
     */
    R disableOrEnableMcsMerchant(DisableOrEnableMcsMerchantDTO disableOrEnableMcsMerchantDTO);
    /**
     * 根据account查询微商业街商家信息
     * @param account
     * @return
     */
    R getMcsMerchantByAccount(String account);
    /**
     * 完成订单更新/新增商家信息
     *
     * @param merchantName
     * @param configId
     * @param userId
     * @return
     */
    R updateOrAddMcsMerchantAfterOrder(String merchantName, Long configId, Long userId);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsMerchantServiceImpl.java
@@ -2,6 +2,7 @@
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
import static org.apache.commons.lang3.StringUtils.isBlank;
import java.util.Arrays;
import java.util.Date;
@@ -9,14 +10,12 @@
import javax.annotation.Resource;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.panzhihua.service_community.dao.McsConfigDAO;
import com.panzhihua.service_community.dao.McsGameDAO;
import com.panzhihua.service_community.entity.McsConfig;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -25,11 +24,15 @@
import com.panzhihua.common.model.dtos.community.microCommercialStreet.DisableOrEnableMcsMerchantDTO;
import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsMerchantDTO;
import com.panzhihua.common.model.dtos.community.microCommercialStreet.PageMcsMerchantDTO;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.microCommercialStreet.McsMerchantVO;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.common.utlis.DateUtils;
import com.panzhihua.service_community.dao.McsConfigDAO;
import com.panzhihua.service_community.dao.McsGameDAO;
import com.panzhihua.service_community.dao.McsMerchantDAO;
import com.panzhihua.service_community.entity.McsConfig;
import com.panzhihua.service_community.entity.McsMerchant;
import com.panzhihua.service_community.service.McsMerchantService;
@@ -131,14 +134,7 @@
    public R getMcsMerchant(Long merchantId) {
        McsMerchantVO merchantVO = this.baseMapper.getMcsMerchantById(merchantId);
        if (nonNull(merchantVO)) {
            Integer publishLimit = merchantVO.getPublishLimit();
            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);
            }
            retrieveMerchantSurplusLitDays(merchantVO);
        }
        return R.ok(merchantVO);
    }
@@ -173,13 +169,7 @@
        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);
                }
            });
            records.forEach(e -> retrieveMerchantSurplusLitDays(e));
        }
        return R.ok(mcsMerchants);
    }
@@ -207,4 +197,95 @@
            return R.fail("未知错误");
        }
    }
    /**
     * 根据account查询微商业街商家信息
     * @param account
     * @return
     */
    @Override
    public R getMcsMerchantByAccount(String account) {
        McsMerchantVO merchantVO = this.baseMapper.getMcsMerchantByAccount(account);
        if (isNull(merchantVO)) {
            return R.fail("账号不存在");
        }
        retrieveMerchantSurplusLitDays(merchantVO);
        return R.ok(merchantVO);
    }
    /**
     * 完成订单更新/新增商家信息
     *
     * @param merchantName
     * @param configId
     * @param userId
     * @return
     */
    @Override
    public R updateOrAddMcsMerchantAfterOrder(String merchantName, Long configId, Long userId) {
        McsMerchant mcsMerchant = this.baseMapper.selectOne(new QueryWrapper<McsMerchant>().lambda().eq(McsMerchant::getUserId, userId));
        McsConfig mcsConfig = mcsConfigDAO.selectById(configId);
        if (isNull(mcsConfig) || isBlank(mcsConfig.getValue())) {
            return R.fail("套餐配置不存在");
        }
        JSONObject packageObject = JSONObject.parseObject(mcsConfig.getValue());
        if (!packageObject.containsKey("day")) {
            return R.fail("配置有误");
        }
        Integer litDays = (Integer)packageObject.get("day");
        Date nowDate = new Date();
        int num;
        if (isNull(mcsMerchant)) {
            //新增商家
            R<LoginUserInfoVO> userInfoVOR = userService.getUserInfoByUserId(userId.toString());
            if (R.isOk(userInfoVOR) && nonNull(userInfoVOR.getData())) {
                LoginUserInfoVO loginUserInfoVO = JSONObject.parseObject(JSONObject.toJSONString(userInfoVOR.getData()), LoginUserInfoVO.class);
                mcsMerchant = new McsMerchant();
                mcsMerchant.setName(isBlank(merchantName) ? "默认名称" : merchantName);
                mcsMerchant.setPhone(loginUserInfoVO.getPhone());
                mcsMerchant.setAccount(loginUserInfoVO.getAccount());
                mcsMerchant.setLevel(1);
                mcsMerchant.setExpireAt(DateUtils.addDay(nowDate, litDays));
                mcsMerchant.setFirstLitAt(nowDate);
                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);
                mcsMerchant.setUserId(userId);
                mcsMerchant.setCreatedBy(userId);
                mcsMerchant.setUpdatedBy(userId);
                num = this.baseMapper.insert(mcsMerchant);
            } else {
                return R.fail("获取用户信息失败");
            }
        } else {
            //更新商家
            Date previousExpireAt = mcsMerchant.getExpireAt();
            Date nowExpireAt;
            if (isNull(previousExpireAt) || previousExpireAt.before(nowDate)) {
                nowExpireAt = DateUtils.addDay(nowDate, litDays);
            } else {
                nowExpireAt = DateUtils.addDay(previousExpireAt, litDays);
            }
            McsMerchant mcsMerchant1 = new McsMerchant();
            mcsMerchant1.setId(mcsMerchant.getId());
            mcsMerchant1.setExpireAt(nowExpireAt);
            mcsMerchant1.setUpdatedBy(userId);
            num = this.baseMapper.updateById(mcsMerchant1);
        }
        if (num > 0) {
            return R.ok();
        } else {
            return R.fail();
        }
    }
    private void retrieveMerchantSurplusLitDays(McsMerchantVO merchantVO) {
        Integer publishLimit = merchantVO.getPublishLimit();
        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);
        }
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/McsGameMapper.xml
@@ -68,7 +68,7 @@
    </insert>
    <select id="pageMcsGame"
            resultType="com.panzhihua.common.model.vos.community.microCommercialStreet.McsGameVO">
        SELECT t1.id, t1.`name`, t1.`type`, t1.coupons, t1.surplus_coupons,
        (SELECT t1.id, t1.`name`, t1.`type`, t1.coupons, t1.surplus_coupons,
        t1.publish_at, t1.`status`, t1.merchant_id, t2.`name` AS merchantName
        FROM mcs_game t1
        LEFT JOIN mcs_merchant t2 ON t1.merchant_id = t2.id
@@ -82,9 +82,9 @@
        <if test="pageMcsGameDTO.keyword != null and pageMcsGameDTO.keyword != &quot;&quot;">
            AND t1.`name` LIKE CONCAT(#{pageMcsGameDTO.keyword}, '%')
        </if>
        ORDER BY t1.created_at DESC
        ORDER BY t1.created_at DESC)
        UNION ALL
        SELECT t1.id, t1.`name`, t1.`type`, t1.coupons, t1.surplus_coupons,
        (SELECT t1.id, t1.`name`, t1.`type`, t1.coupons, t1.surplus_coupons,
        t1.publish_at, t1.`status`, t1.merchant_id, t2.`name` AS merchantName
        FROM mcs_game t1
        LEFT JOIN mcs_merchant t2 ON t1.merchant_id = t2.id
@@ -98,7 +98,7 @@
        <if test="pageMcsGameDTO.keyword != null and pageMcsGameDTO.keyword != &quot;&quot;">
            AND t1.`name` LIKE CONCAT(#{pageMcsGameDTO.keyword}, '%')
        </if>
        ORDER BY t1.created_at DESC
        ORDER BY t1.created_at DESC)
    </select>
    <select id="selectPublishCount" resultType="java.lang.Integer">
        SELECT SUM(publishCount) AS publishCount FROM
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, t1.first_lit_at, t2.`status` AS accountStatus
        SELECT t1.id, t1.`name`, t1.phone, t1.account, t1.`level`, t1.expire_at, t1.first_lit_at, t1.publish_limit, 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
@@ -82,6 +82,14 @@
        </if>
        ORDER BY t1.created_at DESC
    </select>
    <select id="getMcsMerchantByAccount"
            resultType="com.panzhihua.common.model.vos.community.microCommercialStreet.McsMerchantVO">
        SELECT t1.id, t1.`name`, t1.phone, t1.account, t1.`level`, t1.expire_at, t1.first_lit_at, t1.publish_limit,
        t1.logo, t1.address, t1.lat, t1.lon, t1.introduction, t2.`status` AS accountStatus
        FROM mcs_merchant t1
        LEFT JOIN sys_user t2 ON t1.user_id = t2.user_id
        WHERE t1.account = #{account} AND t1.is_del = 0
    </select>
</mapper>
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
@@ -2832,9 +2832,17 @@
            return R.ok(sysUserDO.getUserId());
        } catch (Exception e) {
            e.printStackTrace();
            log.error("新增后台用户报错【{}】", e.getMessage());
            log.error("修改数字商业街商家用户报错【{}】", e.getMessage());
            if (e.getMessage().contains("union_phone_type")) {
                return R.fail("手机号已存在");
            } else if (e.getMessage().contains("union_account_type")) {
                return R.fail("账户已经存在");
            }else if(e.getMessage().contains("23000")){
                return R.fail("手机号已存在");
            } else {
                return R.fail("账户或手机号已存在,请重新填写尝试");
            }
        }
        return R.fail("新增商户发生错误");
    }
    /**
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/api/MicroCommercialStreetApi.java
@@ -3,7 +3,7 @@
import javax.annotation.Resource;
import javax.validation.Valid;
import com.panzhihua.common.model.vos.community.microCommercialStreet.McsLabelVO;
import org.springframework.beans.BeanUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
@@ -14,6 +14,7 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsGameDTO;
import com.panzhihua.common.model.dtos.community.microCommercialStreet.McsInfoDTO;
@@ -26,19 +27,28 @@
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.LoginReturnVO;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.microCommercialStreet.McsEvaluateVO;
import com.panzhihua.common.model.vos.community.microCommercialStreet.McsGameVO;
import com.panzhihua.common.model.vos.community.microCommercialStreet.McsInformationVO;
import com.panzhihua.common.model.vos.community.microCommercialStreet.McsLabelVO;
import com.panzhihua.common.model.vos.community.microCommercialStreet.McsLoginUserInfoVO;
import com.panzhihua.common.model.vos.community.microCommercialStreet.McsMerchantVO;
import com.panzhihua.common.model.vos.community.microCommercialStreet.McsProductVO;
import com.panzhihua.common.model.vos.shop.LoginMerchantUserInfoVO;
import com.panzhihua.common.service.auth.TokenService;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.common.validated.AddGroup;
import com.panzhihua.common.validated.PutGroup;
import com.panzhihua.shop_backstage.model.vos.LoginBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
/**
 * @title: MicroCommercialStreetApi
@@ -50,10 +60,63 @@
@Api(tags = {"微商业街"})
@RestController
@RequestMapping("/microcommercialstreet")
@Slf4j
public class MicroCommercialStreetApi extends BaseController {
    @Resource
    private CommunityService communityService;
    @Resource
    private TokenService tokenService;
    @Resource
    private UserService userService;
    @ApiOperation(value = "微商业街商家后台登录", response = LoginReturnVO.class)
    @PostMapping("/merchant/login")
    public R login(@RequestBody @Valid LoginBody loginBody) {
        String account = loginBody.getAccount();
        log.info("登录用户信息【{}】", loginBody);
        try {
            R r = communityService.getMcsMerchantByAccount(account);
            Boolean isValid = false;
            if (R.isOk(r) && r.getData() != null) {
                McsMerchantVO merchantVO = JSONObject.parseObject(JSONObject.toJSONString(r.getData()), McsMerchantVO.class);
                isValid = merchantVO.getAccountStatus() == 1;
                if (isValid) {
                    R result = tokenService.loginMcsUser(account, loginBody.getPassword());
                    return result;
                } else {
                    return R.fail("账号被禁用");
                }
            }
            return R.fail(r.getMsg());
        } catch (Exception e) {
            return R.fail("登陆失败了");
        }
    }
    @ApiOperation(value = "当前登录用户信息", response = LoginMerchantUserInfoVO.class)
    @GetMapping("/userInfo")
    public R detailUser() {
        Long userId = this.getUserId();
        R<LoginUserInfoVO> loginUserInfoVOR = userService.detailUser(userId);
        try {
            LoginUserInfoVO loginUserInfoVO =
                    JSONObject.parseObject(JSONObject.toJSONString(loginUserInfoVOR.getData()), LoginUserInfoVO.class);
            loginUserInfoVO.setPassword("******");
            R<McsMerchantVO> mcsMerchantVOR = communityService.getMcsMerchantByAccount(loginUserInfoVO.getAccount());
            McsLoginUserInfoVO mcsLoginUserInfoVO = new McsLoginUserInfoVO();
            BeanUtils.copyProperties(loginUserInfoVO, mcsLoginUserInfoVO);
            if (R.isOk(mcsMerchantVOR) && mcsMerchantVOR.getData() != null) {
                McsMerchantVO mcsMerchantVO =
                        JSONObject.parseObject(JSONObject.toJSONString(mcsMerchantVOR.getData()), McsMerchantVO.class);
                mcsLoginUserInfoVO.setMcsMerchantVO(mcsMerchantVO);
            }
            return R.ok(mcsLoginUserInfoVO);
        } catch (Exception e) {
            e.printStackTrace();
            return R.fail("获取用户信息失败");
        }
    }
    @ApiOperation(value = "新增戳戳游戏")
    @PostMapping("/game/add")
springcloud_k8s_panzhihuazhihuishequ/shop_backstage/src/main/java/com/panzhihua/shop_backstage/filter/StoreValidFilter.java
@@ -52,10 +52,11 @@
        boolean isDoc = uri.contains("doc.html") || uri.contains("-docs");
        boolean convenientLogin = "/convenient/login".equals(uri);
        boolean mcsLogin = "/microcommercialstreet/login".equals(uri);
        boolean mcsMerchantLogin = "/microcommercialstreet/merchant/login".equals(uri);
        boolean storeLogin = "/login".equals(uri);
        boolean isUpload = "/convenient/upload/file".equals(uri);
        if (isDoc || isUpload || storeLogin || convenientLogin || mcsLogin) {
        if (isDoc || isUpload || storeLogin || convenientLogin || mcsLogin || mcsMerchantLogin) {
            //放过swagger请求
        } else {
            String userInfo = request.getHeader(TokenConstant.TOKEN_USERINFO);