This commit is contained in:
wangh 2023-12-05 13:44:15 +08:00
parent 49529cd230
commit abe9969d75
12 changed files with 57 additions and 13 deletions

View File

@ -2,6 +2,7 @@ package com.fuint.business.petrolStationManagement.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -35,8 +36,11 @@ public class OilNumberServiceImpl extends ServiceImpl<OilNumberMapper, OilNumber
@Override
public IPage<OilNumber> selectOilNumberList2(Page page, OilNumber oilNumber) {
if (ObjectUtil.isEmpty(oilNumber.getStoreId())) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
oilNumber.setStoreId(nowAccountInfo.getStoreId());
}
return baseMapper.selectOilNumberList2(page,oilNumber);
}

View File

@ -28,6 +28,12 @@ public class LJStoreController extends BaseController {
return getSuccessResult(store);
}
@GetMapping("storeInfoUni")
public ResponseObject storeInfoUni(Integer storeId){
LJStore store = storeService.selectStoreByIdUni(storeId);
return getSuccessResult(store);
}
/**
* 查询所有门店信息
* @return

View File

@ -74,8 +74,9 @@ public class LJUserController extends BaseController {
}
@GetMapping("/getByUniApp")
public ResponseObject getByUniApp(){
LJUserVo user = userService.getByUniApp();
public ResponseObject getByUniApp(Integer chainStoreId){
// todo wangh改为便利店id
LJUserVo user = userService.getByUniApp(chainStoreId);
return getSuccessResult(user);
}

View File

@ -35,6 +35,13 @@ public interface LJUserMapper extends BaseMapper<LJUser> {
*/
public LJUserVo selectUserById(@Param("id") Integer id);
/**
* uniapp使用
* @param id
* @return
*/
public LJUserVo selectUserByIdUni(@Param("id") Integer id,@Param("chainStoreId") Integer chainStoreId);
/**
* 根据手机号查询用户信息
* @param mobile

View File

@ -106,6 +106,15 @@
mu.id = #{id}
</where>
</select>
<select id="selectUserByIdUni" resultType="com.fuint.business.userManager.vo.LJUserVo"
parameterType="java.lang.Integer">
<include refid="selectUser"></include>
<where>
mu.id = #{id}
and mub.chain_store_id =#{chainStoreId}
</where>
</select>
<select id="queryUserList" resultType="com.fuint.business.userManager.vo.LJUserVo" parameterType="int">
<include refid="selectUser"></include>
<where>

View File

@ -40,7 +40,7 @@ public interface LJUserService extends IService<LJUser> {
public LJUserVo selectUserById(int id);
public LJUserVo getByUniApp();
public LJUserVo getByUniApp(Integer chainStoreId);
/**
* 根据手机号查询会员信息

View File

@ -40,6 +40,6 @@ public interface UserBalanceService extends IService<UserBalance> {
* @param userId
* @return
*/
public UserBalance selectUserBalance(int userId, int storeId);
public UserBalance selectUserBalance(int userId, int chainStoreId);
}

View File

@ -108,11 +108,11 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
}
@Override
public LJUserVo getByUniApp() {
public LJUserVo getByUniApp(Integer chainStoreId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
return baseMapper.selectUserById(nowAccountInfo.getId());
return baseMapper.selectUserByIdUni(nowAccountInfo.getId(),chainStoreId);
}
/**

View File

@ -40,10 +40,10 @@ public class UserBalanceServiceImpl extends ServiceImpl<UserBalanceMapper, UserB
}
@Override
public UserBalance selectUserBalance(int userId, int storeId) {
public UserBalance selectUserBalance(int userId, int chainStoreId) {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("mt_user_id",userId);
queryWrapper.eq("store_id",storeId);
queryWrapper.eq("chain_store_id",chainStoreId);
UserBalance balance = baseMapper.selectOne(queryWrapper);
return balance;
}

View File

@ -781,15 +781,21 @@ public class MemberServiceImpl extends ServiceImpl<MtUserMapper, MtUser> impleme
save(mtUser);
// 新增余额信息
if (ObjectUtil.isNotEmpty(storeId) && storeId !="") {
// 根据userid和stortId查询是否存在对应的余额信息
UserBalance userBalance = userBalanceService.selectUserBalance(mtUser.getId(), Integer.parseInt(storeId));
LJStore store = iljStoreService.selectStoreByStoreId(Integer.parseInt(storeId));
// 根据userid和连锁店id查询是否存在对应的余额信息
UserBalance userBalance = userBalanceService.selectUserBalance(mtUser.getId(), store.getChainStoreId());
if (ObjectUtil.isEmpty(userBalance)) {
// 新增余额信息
UserBalance userBalanceAdd = new UserBalance();
userBalanceAdd.setMtUserId(mtUser.getId());
userBalanceAdd.setStoreId(Integer.parseInt(storeId));
userBalanceAdd.setChainStoreId(store.getChainStoreId());
userBalanceAdd.setCardBalance(0.0);
userBalanceAdd.setPoints(0);
userBalanceAdd.setGrowthValue(0);
@ -801,7 +807,6 @@ public class MemberServiceImpl extends ServiceImpl<MtUserMapper, MtUser> impleme
// 新增会员余额信息
userBalanceService.insertUserBalance(userBalanceAdd);
}
LJStore store = iljStoreService.selectStoreByStoreId(Integer.parseInt(storeId));
// 查询关联表里面是否有信息
MtInvitation mtInvitation1 = mtInvitationMapper.queryByStoreId(Integer.parseInt(storeId), mtUser.getId());
if (ObjectUtil.isEmpty(mtInvitation1)) {

View File

@ -16,4 +16,5 @@ public class LoginResponse implements Serializable {
private Date tokenCreatedTime;
private Date tokenExpiryTime;
private String token;
private Integer chainStoreId;
}

View File

@ -3,6 +3,8 @@ package com.fuint.module.clientApi.controller;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.fuint.business.store.service.StoreService;
import com.fuint.business.storeInformation.entity.LJStore;
import com.fuint.business.storeInformation.service.ILJStoreService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.dto.TokenDto;
import com.fuint.common.dto.UserInfo;
@ -35,6 +37,8 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
@ -87,6 +91,9 @@ public class ClientSignController extends BaseController {
@Autowired
private StoreService storeService;
@Resource
ILJStoreService iljStoreService;
@Autowired
private Environment env;
@ -118,6 +125,9 @@ public class ClientSignController extends BaseController {
return getFailureResult(0, "用户状态异常");
}
// 根据storeId查找对应的连锁店id
LJStore ljStore = iljStoreService.selectStoreByIdUni(Integer.parseInt(storeId));
String userAgent = request.getHeader("user-agent");
AccountInfo accountInfo = new AccountInfo();
accountInfo.setId(mtUser.getId());
@ -130,6 +140,7 @@ public class ClientSignController extends BaseController {
TokenUtil.saveAccountToken(accountInfo);
LoginResponse response = new LoginResponse();
response.setLogin(true);
response.setChainStoreId(ljStore.getChainStoreId());
response.setToken(token);
response.setTokenCreatedTime(new Date());