公众号小程序账号打通,充值增加了充值方案,增加电员核销check等
This commit is contained in:
@ -239,12 +239,11 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<YxStoreOrderMapper,
|
|||||||
//模板消息通知
|
//模板消息通知
|
||||||
YxWechatUserQueryVo wechatUser = wechatUserService.getYxWechatUserById(orderQueryVo.getUid());
|
YxWechatUserQueryVo wechatUser = wechatUserService.getYxWechatUserById(orderQueryVo.getUid());
|
||||||
if(ObjectUtil.isNotNull(wechatUser)){
|
if(ObjectUtil.isNotNull(wechatUser)){
|
||||||
|
//公众号与小程序打通统一公众号模板通知
|
||||||
if(StrUtil.isNotBlank(wechatUser.getOpenid())){
|
if(StrUtil.isNotBlank(wechatUser.getOpenid())){
|
||||||
templateService.refundSuccessNotice(orderQueryVo.getOrderId(),
|
templateService.refundSuccessNotice(orderQueryVo.getOrderId(),
|
||||||
orderQueryVo.getPayPrice().toString(),wechatUser.getOpenid(),
|
orderQueryVo.getPayPrice().toString(),wechatUser.getOpenid(),
|
||||||
OrderUtil.stampToDate(orderQueryVo.getAddTime().toString()));
|
OrderUtil.stampToDate(orderQueryVo.getAddTime().toString()));
|
||||||
}else if(StrUtil.isNotBlank(wechatUser.getRoutineOpenid())){
|
|
||||||
//todo 小程序通知
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -287,11 +286,10 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<YxStoreOrderMapper,
|
|||||||
//模板消息通知
|
//模板消息通知
|
||||||
YxWechatUserQueryVo wechatUser = wechatUserService.getYxWechatUserById(orderQueryVo.getUid());
|
YxWechatUserQueryVo wechatUser = wechatUserService.getYxWechatUserById(orderQueryVo.getUid());
|
||||||
if(ObjectUtil.isNotNull(wechatUser)){
|
if(ObjectUtil.isNotNull(wechatUser)){
|
||||||
|
////公众号与小程序打通统一公众号模板通知
|
||||||
if(StrUtil.isNotBlank(wechatUser.getOpenid())){
|
if(StrUtil.isNotBlank(wechatUser.getOpenid())){
|
||||||
templateService.deliverySuccessNotice(storeOrder.getOrderId(),
|
templateService.deliverySuccessNotice(storeOrder.getOrderId(),
|
||||||
expressQueryVo.getName(),param.getDeliveryId(),wechatUser.getOpenid());
|
expressQueryVo.getName(),param.getDeliveryId(),wechatUser.getOpenid());
|
||||||
}else if(StrUtil.isNotBlank(wechatUser.getRoutineOpenid())){
|
|
||||||
//todo 小程序通知
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -973,13 +971,10 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<YxStoreOrderMapper,
|
|||||||
//模板消息推送
|
//模板消息推送
|
||||||
YxWechatUserQueryVo wechatUser = wechatUserService.getYxWechatUserById(orderInfo.getUid());
|
YxWechatUserQueryVo wechatUser = wechatUserService.getYxWechatUserById(orderInfo.getUid());
|
||||||
if(ObjectUtil.isNotNull(wechatUser)){
|
if(ObjectUtil.isNotNull(wechatUser)){
|
||||||
//公众号模板通知
|
////公众号与小程序打通统一公众号模板通知
|
||||||
if(StrUtil.isNotBlank(wechatUser.getOpenid())){
|
if(StrUtil.isNotBlank(wechatUser.getOpenid())){
|
||||||
templateService.paySuccessNotice(orderInfo.getOrderId(),
|
templateService.paySuccessNotice(orderInfo.getOrderId(),
|
||||||
orderInfo.getPayPrice().toString(),wechatUser.getOpenid());
|
orderInfo.getPayPrice().toString(),wechatUser.getOpenid());
|
||||||
}else if(StrUtil.isNotBlank(wechatUser.getRoutineOpenid())){
|
|
||||||
//todo 小程序模板通知
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ import java.util.Map;
|
|||||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||||
public class AuthController {
|
public class AuthController {
|
||||||
|
|
||||||
@Value("${single.login:false}")
|
@Value("${single.login:true}")
|
||||||
private Boolean singleLogin;
|
private Boolean singleLogin;
|
||||||
@Value("${yshop.notify.sms.enable}")
|
@Value("${yshop.notify.sms.enable}")
|
||||||
private Boolean enableSms;
|
private Boolean enableSms;
|
||||||
@ -157,6 +157,10 @@ public class AuthController {
|
|||||||
WxMpUser wxMpUser = wxService.oauth2getUserInfo(wxMpOAuth2AccessToken, null);
|
WxMpUser wxMpUser = wxService.oauth2getUserInfo(wxMpOAuth2AccessToken, null);
|
||||||
String openid = wxMpUser.getOpenId();
|
String openid = wxMpUser.getOpenId();
|
||||||
|
|
||||||
|
//如果开启了UnionId
|
||||||
|
if (StrUtil.isNotBlank(wxMpUser.getUnionId())) {
|
||||||
|
openid = wxMpUser.getUnionId();
|
||||||
|
}
|
||||||
YxUser yxUser = userService.findByName(openid);
|
YxUser yxUser = userService.findByName(openid);
|
||||||
|
|
||||||
JwtUser jwtUser = null;
|
JwtUser jwtUser = null;
|
||||||
@ -164,19 +168,18 @@ public class AuthController {
|
|||||||
jwtUser = (JwtUser) userDetailsService.loadUserByUsername(openid);
|
jwtUser = (JwtUser) userDetailsService.loadUserByUsername(openid);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
//如果后台删除了用户
|
|
||||||
YxWechatUser wechatUser = wechatUserService.getUserInfo(openid);
|
|
||||||
if(wechatUser != null){
|
|
||||||
wechatUserService.removeById(wechatUser.getUid());
|
|
||||||
}
|
|
||||||
|
|
||||||
//过滤掉表情
|
//过滤掉表情
|
||||||
String nickname = EmojiParser.removeAllEmojis(wxMpUser.getNickname());
|
String nickname = EmojiParser.removeAllEmojis(wxMpUser.getNickname());
|
||||||
log.info("昵称:{}", nickname);
|
log.info("昵称:{}", nickname);
|
||||||
//用户保存
|
//用户保存
|
||||||
YxUser user = new YxUser();
|
YxUser user = new YxUser();
|
||||||
user.setAccount(nickname);
|
user.setAccount(nickname);
|
||||||
user.setUsername(wxMpUser.getOpenId());
|
//如果开启了UnionId
|
||||||
|
if (StrUtil.isNotBlank(wxMpUser.getUnionId())) {
|
||||||
|
user.setUsername(wxMpUser.getUnionId());
|
||||||
|
}else{
|
||||||
|
user.setUsername(wxMpUser.getOpenId());
|
||||||
|
}
|
||||||
user.setPassword(passwordEncoder.encode(ShopConstants.YSHOP_DEFAULT_PWD));
|
user.setPassword(passwordEncoder.encode(ShopConstants.YSHOP_DEFAULT_PWD));
|
||||||
user.setPwd(passwordEncoder.encode(ShopConstants.YSHOP_DEFAULT_PWD));
|
user.setPwd(passwordEncoder.encode(ShopConstants.YSHOP_DEFAULT_PWD));
|
||||||
user.setPhone("");
|
user.setPhone("");
|
||||||
@ -209,7 +212,7 @@ public class AuthController {
|
|||||||
if (ObjectUtil.isNotNull(wxMpUser.getSubscribeTime())) {
|
if (ObjectUtil.isNotNull(wxMpUser.getSubscribeTime())) {
|
||||||
yxWechatUser.setSubscribeTime(wxMpUser.getSubscribeTime().intValue());
|
yxWechatUser.setSubscribeTime(wxMpUser.getSubscribeTime().intValue());
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotEmpty(wxMpUser.getUnionId())) {
|
if (StrUtil.isNotBlank(wxMpUser.getUnionId())) {
|
||||||
yxWechatUser.setUnionid(wxMpUser.getUnionId());
|
yxWechatUser.setUnionid(wxMpUser.getUnionId());
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotEmpty(wxMpUser.getRemark())) {
|
if (StrUtil.isNotEmpty(wxMpUser.getRemark())) {
|
||||||
@ -227,11 +230,6 @@ public class AuthController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//设置推广关系
|
|
||||||
if (StrUtil.isNotEmpty(spread) && !spread.equals("NaN")) {
|
|
||||||
userService.setSpread(Integer.valueOf(spread),
|
|
||||||
jwtUser.getId().intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
UsernamePasswordAuthenticationToken authenticationToken =
|
UsernamePasswordAuthenticationToken authenticationToken =
|
||||||
new UsernamePasswordAuthenticationToken(jwtUser.getUsername(),
|
new UsernamePasswordAuthenticationToken(jwtUser.getUsername(),
|
||||||
@ -252,6 +250,17 @@ public class AuthController {
|
|||||||
map.put("token", token);
|
map.put("token", token);
|
||||||
map.put("expires_time", expiresTimeStr);
|
map.put("expires_time", expiresTimeStr);
|
||||||
|
|
||||||
|
if (singleLogin) {
|
||||||
|
//踢掉之前已经登录的token
|
||||||
|
onlineUserService.checkLoginOnUser(jwtUserT.getUsername(), token);
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置推广关系
|
||||||
|
if (StrUtil.isNotEmpty(spread) && !spread.equals("NaN")) {
|
||||||
|
userService.setSpread(Integer.valueOf(spread),
|
||||||
|
jwtUser.getId().intValue());
|
||||||
|
}
|
||||||
|
|
||||||
// 返回 token
|
// 返回 token
|
||||||
return ApiResult.ok(map);
|
return ApiResult.ok(map);
|
||||||
} catch (WxErrorException e) {
|
} catch (WxErrorException e) {
|
||||||
@ -289,6 +298,10 @@ public class AuthController {
|
|||||||
wxMaService.setWxMaConfig(wxMaConfig);
|
wxMaService.setWxMaConfig(wxMaConfig);
|
||||||
WxMaJscode2SessionResult session = wxMaService.getUserService().getSessionInfo(code);
|
WxMaJscode2SessionResult session = wxMaService.getUserService().getSessionInfo(code);
|
||||||
String openid = session.getOpenid();
|
String openid = session.getOpenid();
|
||||||
|
//如果开启了UnionId
|
||||||
|
if (StrUtil.isNotBlank(session.getUnionid())) {
|
||||||
|
openid = session.getUnionid();
|
||||||
|
}
|
||||||
|
|
||||||
YxUser yxUser = userService.findByName(openid);
|
YxUser yxUser = userService.findByName(openid);
|
||||||
JwtUser jwtUser = null;
|
JwtUser jwtUser = null;
|
||||||
@ -296,12 +309,6 @@ public class AuthController {
|
|||||||
jwtUser = (JwtUser) userDetailsService.loadUserByUsername(openid);
|
jwtUser = (JwtUser) userDetailsService.loadUserByUsername(openid);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
//如果后台删除了用户
|
|
||||||
YxWechatUser wechatUser = wechatUserService.getUserAppInfo(openid);
|
|
||||||
if(wechatUser != null){
|
|
||||||
wechatUserService.removeById(wechatUser.getUid());
|
|
||||||
}
|
|
||||||
|
|
||||||
WxMaUserInfo wxMpUser = wxMaService.getUserService()
|
WxMaUserInfo wxMpUser = wxMaService.getUserService()
|
||||||
.getUserInfo(session.getSessionKey(), encryptedData, iv);
|
.getUserInfo(session.getSessionKey(), encryptedData, iv);
|
||||||
//过滤掉表情
|
//过滤掉表情
|
||||||
@ -309,7 +316,13 @@ public class AuthController {
|
|||||||
//用户保存
|
//用户保存
|
||||||
YxUser user = new YxUser();
|
YxUser user = new YxUser();
|
||||||
user.setAccount(nickname);
|
user.setAccount(nickname);
|
||||||
user.setUsername(wxMpUser.getOpenId());
|
|
||||||
|
//如果开启了UnionId
|
||||||
|
if (StrUtil.isNotBlank(wxMpUser.getUnionId())) {
|
||||||
|
user.setUsername(wxMpUser.getUnionId());
|
||||||
|
}else{
|
||||||
|
user.setUsername(wxMpUser.getOpenId());
|
||||||
|
}
|
||||||
user.setPassword(passwordEncoder.encode(ShopConstants.YSHOP_DEFAULT_PWD));
|
user.setPassword(passwordEncoder.encode(ShopConstants.YSHOP_DEFAULT_PWD));
|
||||||
user.setPwd(passwordEncoder.encode(ShopConstants.YSHOP_DEFAULT_PWD));
|
user.setPwd(passwordEncoder.encode(ShopConstants.YSHOP_DEFAULT_PWD));
|
||||||
user.setPhone("");
|
user.setPhone("");
|
||||||
@ -339,7 +352,7 @@ public class AuthController {
|
|||||||
yxWechatUser.setProvince(wxMpUser.getProvince());
|
yxWechatUser.setProvince(wxMpUser.getProvince());
|
||||||
yxWechatUser.setCountry(wxMpUser.getCountry());
|
yxWechatUser.setCountry(wxMpUser.getCountry());
|
||||||
yxWechatUser.setHeadimgurl(wxMpUser.getAvatarUrl());
|
yxWechatUser.setHeadimgurl(wxMpUser.getAvatarUrl());
|
||||||
if (StrUtil.isNotEmpty(wxMpUser.getUnionId())) {
|
if (StrUtil.isNotBlank(wxMpUser.getUnionId())) {
|
||||||
yxWechatUser.setUnionid(wxMpUser.getUnionId());
|
yxWechatUser.setUnionid(wxMpUser.getUnionId());
|
||||||
}
|
}
|
||||||
yxWechatUser.setUid(user.getUid());
|
yxWechatUser.setUid(user.getUid());
|
||||||
@ -351,11 +364,6 @@ public class AuthController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//设置推广关系
|
|
||||||
if (StrUtil.isNotEmpty(spread)) {
|
|
||||||
userService.setSpread(Integer.valueOf(spread),
|
|
||||||
jwtUser.getId().intValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
UsernamePasswordAuthenticationToken authenticationToken =
|
UsernamePasswordAuthenticationToken authenticationToken =
|
||||||
new UsernamePasswordAuthenticationToken(jwtUser.getUsername(),
|
new UsernamePasswordAuthenticationToken(jwtUser.getUsername(),
|
||||||
@ -377,6 +385,17 @@ public class AuthController {
|
|||||||
map.put("token", token);
|
map.put("token", token);
|
||||||
map.put("expires_time", expiresTimeStr);
|
map.put("expires_time", expiresTimeStr);
|
||||||
|
|
||||||
|
if (singleLogin) {
|
||||||
|
//踢掉之前已经登录的token
|
||||||
|
onlineUserService.checkLoginOnUser(jwtUserT.getUsername(), token);
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置推广关系
|
||||||
|
if (StrUtil.isNotEmpty(spread)) {
|
||||||
|
userService.setSpread(Integer.valueOf(spread),
|
||||||
|
jwtUser.getId().intValue());
|
||||||
|
}
|
||||||
|
|
||||||
// 返回 token
|
// 返回 token
|
||||||
return ApiResult.ok(map);
|
return ApiResult.ok(map);
|
||||||
} catch (WxErrorException e) {
|
} catch (WxErrorException e) {
|
||||||
|
@ -0,0 +1,59 @@
|
|||||||
|
package co.yixiang.modules.shop.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import co.yixiang.common.entity.BaseEntity;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 门店店员表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author hupeng
|
||||||
|
* @since 2020-03-23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ApiModel(value = "YxSystemStoreStaff对象", description = "门店店员表")
|
||||||
|
public class YxSystemStoreStaff extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "微信用户id")
|
||||||
|
private Integer uid;
|
||||||
|
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "店员头像")
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "门店id")
|
||||||
|
private Integer storeId;
|
||||||
|
|
||||||
|
private String storeName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "店员名称")
|
||||||
|
private String staffName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "手机号码")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "核销开关")
|
||||||
|
private Integer verifyStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "添加时间")
|
||||||
|
private Integer addTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
package co.yixiang.modules.shop.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import co.yixiang.modules.shop.entity.YxSystemStoreStaff;
|
||||||
|
import co.yixiang.modules.shop.web.param.YxSystemStoreStaffQueryParam;
|
||||||
|
import co.yixiang.modules.shop.web.vo.YxSystemStoreStaffQueryVo;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 门店店员表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author hupeng
|
||||||
|
* @since 2020-03-23
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public interface YxSystemStoreStaffMapper extends BaseMapper<YxSystemStoreStaff> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID获取查询对象
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
YxSystemStoreStaffQueryVo getYxSystemStoreStaffById(Serializable id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取分页对象
|
||||||
|
* @param page
|
||||||
|
* @param yxSystemStoreStaffQueryParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
IPage<YxSystemStoreStaffQueryVo> getYxSystemStoreStaffPageList(@Param("page") Page page, @Param("param") YxSystemStoreStaffQueryParam yxSystemStoreStaffQueryParam);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package co.yixiang.modules.shop.service;
|
||||||
|
|
||||||
|
import co.yixiang.modules.shop.entity.YxSystemStoreStaff;
|
||||||
|
import co.yixiang.common.service.BaseService;
|
||||||
|
import co.yixiang.modules.shop.web.param.YxSystemStoreStaffQueryParam;
|
||||||
|
import co.yixiang.modules.shop.web.vo.YxSystemStoreStaffQueryVo;
|
||||||
|
import co.yixiang.common.web.vo.Paging;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 门店店员表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author hupeng
|
||||||
|
* @since 2020-03-23
|
||||||
|
*/
|
||||||
|
public interface YxSystemStoreStaffService extends BaseService<YxSystemStoreStaff> {
|
||||||
|
|
||||||
|
boolean checkStatus(int uid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID获取查询对象
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
YxSystemStoreStaffQueryVo getYxSystemStoreStaffById(Serializable id) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取分页对象
|
||||||
|
* @param yxSystemStoreStaffQueryParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Paging<YxSystemStoreStaffQueryVo> getYxSystemStoreStaffPageList(YxSystemStoreStaffQueryParam yxSystemStoreStaffQueryParam) throws Exception;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package co.yixiang.modules.shop.service.impl;
|
||||||
|
|
||||||
|
import co.yixiang.modules.shop.entity.YxSystemStoreStaff;
|
||||||
|
import co.yixiang.modules.shop.mapper.YxSystemStoreStaffMapper;
|
||||||
|
import co.yixiang.modules.shop.service.YxSystemStoreStaffService;
|
||||||
|
import co.yixiang.modules.shop.web.param.YxSystemStoreStaffQueryParam;
|
||||||
|
import co.yixiang.modules.shop.web.vo.YxSystemStoreStaffQueryVo;
|
||||||
|
import co.yixiang.common.service.impl.BaseServiceImpl;
|
||||||
|
import co.yixiang.common.web.vo.Paging;
|
||||||
|
import co.yixiang.modules.user.entity.YxUserRecharge;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 门店店员表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author hupeng
|
||||||
|
* @since 2020-03-23
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public class YxSystemStoreStaffServiceImpl extends BaseServiceImpl<YxSystemStoreStaffMapper, YxSystemStoreStaff> implements YxSystemStoreStaffService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private YxSystemStoreStaffMapper yxSystemStoreStaffMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkStatus(int uid) {
|
||||||
|
YxSystemStoreStaff storeStaff = new YxSystemStoreStaff();
|
||||||
|
storeStaff.setUid(uid);
|
||||||
|
return yxSystemStoreStaffMapper.selectCount(Wrappers.query(storeStaff)) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public YxSystemStoreStaffQueryVo getYxSystemStoreStaffById(Serializable id) throws Exception{
|
||||||
|
return yxSystemStoreStaffMapper.getYxSystemStoreStaffById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Paging<YxSystemStoreStaffQueryVo> getYxSystemStoreStaffPageList(YxSystemStoreStaffQueryParam yxSystemStoreStaffQueryParam) throws Exception{
|
||||||
|
Page page = setPageParam(yxSystemStoreStaffQueryParam,OrderItem.desc("create_time"));
|
||||||
|
IPage<YxSystemStoreStaffQueryVo> iPage = yxSystemStoreStaffMapper.getYxSystemStoreStaffPageList(page,yxSystemStoreStaffQueryParam);
|
||||||
|
return new Paging(iPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package co.yixiang.modules.shop.web.param;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import co.yixiang.common.web.param.QueryParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 门店店员表 查询参数对象
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author hupeng
|
||||||
|
* @date 2020-03-23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ApiModel(value="YxSystemStoreStaffQueryParam对象", description="门店店员表查询参数")
|
||||||
|
public class YxSystemStoreStaffQueryParam extends QueryParam {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
package co.yixiang.modules.shop.web.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 门店店员表 查询结果对象
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author hupeng
|
||||||
|
* @date 2020-03-23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "YxSystemStoreStaffQueryVo对象", description = "门店店员表查询参数")
|
||||||
|
public class YxSystemStoreStaffQueryVo implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "微信用户id")
|
||||||
|
private Integer uid;
|
||||||
|
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "店员头像")
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "门店id")
|
||||||
|
private Integer storeId;
|
||||||
|
|
||||||
|
private String storeName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "店员名称")
|
||||||
|
private String staffName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "手机号码")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "核销开关")
|
||||||
|
private Integer verifyStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "添加时间")
|
||||||
|
private Integer addTime;
|
||||||
|
|
||||||
|
}
|
@ -40,6 +40,8 @@ public class YxUserRecharge extends BaseEntity {
|
|||||||
@ApiModelProperty(value = "充值金额")
|
@ApiModelProperty(value = "充值金额")
|
||||||
private BigDecimal price;
|
private BigDecimal price;
|
||||||
|
|
||||||
|
private BigDecimal givePrice;
|
||||||
|
|
||||||
@ApiModelProperty(value = "充值类型")
|
@ApiModelProperty(value = "充值类型")
|
||||||
private String rechargeType;
|
private String rechargeType;
|
||||||
|
|
||||||
|
@ -71,6 +71,9 @@ public class YxUserRechargeServiceImpl extends BaseServiceImpl<YxUserRechargeMap
|
|||||||
userRecharge.setPayTime(OrderUtil.getSecondTimestampTwo());
|
userRecharge.setPayTime(OrderUtil.getSecondTimestampTwo());
|
||||||
yxUserRechargeMapper.updateById(userRecharge);
|
yxUserRechargeMapper.updateById(userRecharge);
|
||||||
|
|
||||||
|
//最终充值金额
|
||||||
|
BigDecimal newPrice = NumberUtil.add(userRecharge.getPrice(),user.getNowMoney());
|
||||||
|
newPrice = NumberUtil.add(userRecharge.getGivePrice(),newPrice);
|
||||||
//增加流水
|
//增加流水
|
||||||
YxUserBill userBill = new YxUserBill();
|
YxUserBill userBill = new YxUserBill();
|
||||||
userBill.setUid(userRecharge.getUid());
|
userBill.setUid(userRecharge.getUid());
|
||||||
@ -79,7 +82,7 @@ public class YxUserRechargeServiceImpl extends BaseServiceImpl<YxUserRechargeMap
|
|||||||
userBill.setCategory(BillDetailEnum.CATEGORY_1.getValue());
|
userBill.setCategory(BillDetailEnum.CATEGORY_1.getValue());
|
||||||
userBill.setType(BillDetailEnum.TYPE_1.getValue());
|
userBill.setType(BillDetailEnum.TYPE_1.getValue());
|
||||||
userBill.setNumber(userRecharge.getPrice());
|
userBill.setNumber(userRecharge.getPrice());
|
||||||
userBill.setBalance(NumberUtil.add(userRecharge.getPrice(),user.getNowMoney()));
|
userBill.setBalance(newPrice);
|
||||||
userBill.setMark("成功充值余额"+userRecharge.getPrice());
|
userBill.setMark("成功充值余额"+userRecharge.getPrice());
|
||||||
userBill.setStatus(BillEnum.STATUS_1.getValue());
|
userBill.setStatus(BillEnum.STATUS_1.getValue());
|
||||||
userBill.setPm(BillEnum.PM_1.getValue());
|
userBill.setPm(BillEnum.PM_1.getValue());
|
||||||
@ -87,19 +90,16 @@ public class YxUserRechargeServiceImpl extends BaseServiceImpl<YxUserRechargeMap
|
|||||||
billService.save(userBill);
|
billService.save(userBill);
|
||||||
|
|
||||||
//update 余额
|
//update 余额
|
||||||
user.setNowMoney(NumberUtil.add(userRecharge.getPrice(),user.getNowMoney()));
|
user.setNowMoney(newPrice);
|
||||||
yxUserMapper.updateById(user);
|
yxUserMapper.updateById(user);
|
||||||
|
|
||||||
//模板消息推送
|
//模板消息推送
|
||||||
YxWechatUserQueryVo wechatUser = wechatUserService.getYxWechatUserById(userRecharge.getUid());
|
YxWechatUserQueryVo wechatUser = wechatUserService.getYxWechatUserById(userRecharge.getUid());
|
||||||
if(ObjectUtil.isNotNull(wechatUser)){
|
if(ObjectUtil.isNotNull(wechatUser)){
|
||||||
//公众号模板通知
|
//公众号与小程序打通统一公众号模板通知
|
||||||
if(StrUtil.isNotBlank(wechatUser.getOpenid())){
|
if(StrUtil.isNotBlank(wechatUser.getOpenid())){
|
||||||
templateService.rechargeSuccessNotice(OrderUtil.stampToDate(userRecharge.getPayTime().toString()),
|
templateService.rechargeSuccessNotice(OrderUtil.stampToDate(userRecharge.getPayTime().toString()),
|
||||||
userRecharge.getPrice().toString(),wechatUser.getOpenid());
|
userRecharge.getPrice().toString(),wechatUser.getOpenid());
|
||||||
}else if(StrUtil.isNotBlank(wechatUser.getRoutineOpenid())){
|
|
||||||
//todo 小程序模板通知
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,6 +126,7 @@ public class YxUserRechargeServiceImpl extends BaseServiceImpl<YxUserRechargeMap
|
|||||||
yxUserRecharge.setOrderId(param.getOrderSn());
|
yxUserRecharge.setOrderId(param.getOrderSn());
|
||||||
yxUserRecharge.setUid(uid);
|
yxUserRecharge.setUid(uid);
|
||||||
yxUserRecharge.setPrice(BigDecimal.valueOf(param.getPrice()));
|
yxUserRecharge.setPrice(BigDecimal.valueOf(param.getPrice()));
|
||||||
|
yxUserRecharge.setGivePrice(BigDecimal.valueOf(param.getPaidPrice()));
|
||||||
yxUserRecharge.setRechargeType(PayTypeEnum.WEIXIN.getValue());
|
yxUserRecharge.setRechargeType(PayTypeEnum.WEIXIN.getValue());
|
||||||
yxUserRecharge.setPaid(OrderInfoEnum.PAY_STATUS_0.getValue());
|
yxUserRecharge.setPaid(OrderInfoEnum.PAY_STATUS_0.getValue());
|
||||||
yxUserRecharge.setAddTime(OrderUtil.getSecondTimestampTwo());
|
yxUserRecharge.setAddTime(OrderUtil.getSecondTimestampTwo());
|
||||||
|
@ -18,6 +18,7 @@ import co.yixiang.modules.order.service.YxStoreOrderService;
|
|||||||
import co.yixiang.modules.order.web.vo.YxStoreOrderQueryVo;
|
import co.yixiang.modules.order.web.vo.YxStoreOrderQueryVo;
|
||||||
import co.yixiang.modules.shop.service.YxStoreCouponUserService;
|
import co.yixiang.modules.shop.service.YxStoreCouponUserService;
|
||||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||||
|
import co.yixiang.modules.shop.service.YxSystemStoreStaffService;
|
||||||
import co.yixiang.modules.user.entity.YxUser;
|
import co.yixiang.modules.user.entity.YxUser;
|
||||||
import co.yixiang.modules.user.entity.YxUserBill;
|
import co.yixiang.modules.user.entity.YxUserBill;
|
||||||
import co.yixiang.modules.user.entity.YxUserLevel;
|
import co.yixiang.modules.user.entity.YxUserLevel;
|
||||||
@ -72,6 +73,8 @@ public class YxUserServiceImpl extends BaseServiceImpl<YxUserMapper, YxUser> imp
|
|||||||
private YxUserLevelService userLevelService;
|
private YxUserLevelService userLevelService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private YxStoreCouponUserService storeCouponUserService;
|
private YxStoreCouponUserService storeCouponUserService;
|
||||||
|
@Autowired
|
||||||
|
private YxSystemStoreStaffService systemStoreStaffService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -442,8 +445,10 @@ public class YxUserServiceImpl extends BaseServiceImpl<YxUserMapper, YxUser> imp
|
|||||||
}else{
|
}else{
|
||||||
userQueryVo.setStatu(0);
|
userQueryVo.setStatu(0);
|
||||||
}
|
}
|
||||||
//todo 测试环境设置所有人是管理员,生成环境记得去掉
|
|
||||||
//userQueryVo.setAdminid(1);
|
//获取核销权限
|
||||||
|
userQueryVo.setCheckStatus(systemStoreStaffService.checkStatus((int)id));
|
||||||
|
|
||||||
return userQueryVo;
|
return userQueryVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ public class UserExtractController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/extract/cash")
|
@PostMapping("/extract/cash")
|
||||||
@ApiOperation(value = "用户提现",notes = "用户提现")
|
@ApiOperation(value = "用户提现",notes = "用户提现")
|
||||||
public ApiResult<Boolean> addYxUserExtract(@Valid @RequestBody UserExtParam param) throws Exception{
|
public ApiResult<String> addYxUserExtract(@Valid @RequestBody UserExtParam param) throws Exception{
|
||||||
int uid = SecurityUtils.getUserId().intValue();
|
int uid = SecurityUtils.getUserId().intValue();
|
||||||
userExtractService.userExtract(uid,param);
|
userExtractService.userExtract(uid,param);
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ import co.yixiang.common.web.controller.BaseController;
|
|||||||
import co.yixiang.enums.BillDetailEnum;
|
import co.yixiang.enums.BillDetailEnum;
|
||||||
import co.yixiang.exception.ErrorRequestException;
|
import co.yixiang.exception.ErrorRequestException;
|
||||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||||
|
import co.yixiang.modules.shop.service.YxSystemGroupDataService;
|
||||||
import co.yixiang.modules.user.entity.YxUser;
|
import co.yixiang.modules.user.entity.YxUser;
|
||||||
import co.yixiang.modules.user.entity.YxWechatUser;
|
import co.yixiang.modules.user.entity.YxWechatUser;
|
||||||
import co.yixiang.modules.user.service.YxUserRechargeService;
|
import co.yixiang.modules.user.service.YxUserRechargeService;
|
||||||
@ -33,6 +34,7 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@ -61,6 +63,18 @@ public class UserRechargeController extends BaseController {
|
|||||||
private final YxSystemConfigService systemConfigService;
|
private final YxSystemConfigService systemConfigService;
|
||||||
private final YxPayService payService;
|
private final YxPayService payService;
|
||||||
private final YxWechatUserService wechatUserService;
|
private final YxWechatUserService wechatUserService;
|
||||||
|
private final YxSystemGroupDataService systemGroupDataService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值方案
|
||||||
|
*/
|
||||||
|
@GetMapping("/recharge/index")
|
||||||
|
@ApiOperation(value = "充值方案",notes = "充值方案",response = ApiResult.class)
|
||||||
|
public ApiResult<Object> getWays(){
|
||||||
|
Map<String,Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("recharge_price_ways",systemGroupDataService.getDatas("recharge_price_ways"));
|
||||||
|
return ApiResult.ok(map);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公众号充值/H5充值
|
* 公众号充值/H5充值
|
||||||
|
@ -19,5 +19,7 @@ public class RechargeParam implements Serializable {
|
|||||||
@Min(value = 1,message = "充值金额不能低于1")
|
@Min(value = 1,message = "充值金额不能低于1")
|
||||||
private Double price;
|
private Double price;
|
||||||
|
|
||||||
|
private Double paidPrice = 0d;
|
||||||
|
|
||||||
private String orderSn;
|
private String orderSn;
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,8 @@ public class YxUserQueryVo implements Serializable {
|
|||||||
|
|
||||||
private Boolean isYesterDaySign;
|
private Boolean isYesterDaySign;
|
||||||
|
|
||||||
|
private Boolean checkStatus;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// @ApiModelProperty(value = "用户密码(跟pwd)")
|
// @ApiModelProperty(value = "用户密码(跟pwd)")
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="co.yixiang.modules.shop.mapper.YxSystemStoreStaffMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询结果列 -->
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, uid, nickname, avatar, store_id, store_name, staff_name, phone, verify_status, status, add_time
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="getYxSystemStoreStaffById" resultType="co.yixiang.modules.shop.web.vo.YxSystemStoreStaffQueryVo">
|
||||||
|
select <include refid="Base_Column_List"/> from yx_system_store_staff where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getYxSystemStoreStaffPageList" resultType="co.yixiang.modules.shop.web.vo.YxSystemStoreStaffQueryVo">
|
||||||
|
select <include refid="Base_Column_List"/> from yx_system_store_staff
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
@ -47,7 +47,7 @@ public class CodeGenerator {
|
|||||||
// 作者
|
// 作者
|
||||||
private static final String AUTHOR = "hupeng";
|
private static final String AUTHOR = "hupeng";
|
||||||
// 生成的表名称
|
// 生成的表名称
|
||||||
private static final String TABLE_NAME = "yx_system_store"; // 主键数据库列名称
|
private static final String TABLE_NAME = "yx_system_store_staff"; // 主键数据库列名称
|
||||||
private static final String PK_ID_COLUMN_NAME = "id";
|
private static final String PK_ID_COLUMN_NAME = "id";
|
||||||
// 代码生成策略 true:All/false:SIMPLE
|
// 代码生成策略 true:All/false:SIMPLE
|
||||||
private static final boolean GENERATOR_STRATEGY = true;
|
private static final boolean GENERATOR_STRATEGY = true;
|
||||||
|
@ -206,11 +206,10 @@ public class StoreOrderController {
|
|||||||
try {
|
try {
|
||||||
YxWechatUserDTO wechatUser = wechatUserService.findById(resources.getUid());
|
YxWechatUserDTO wechatUser = wechatUserService.findById(resources.getUid());
|
||||||
if (ObjectUtil.isNotNull(wechatUser)) {
|
if (ObjectUtil.isNotNull(wechatUser)) {
|
||||||
|
//公众号与小程序打通统一公众号模板通知
|
||||||
if (StrUtil.isNotBlank(wechatUser.getOpenid())) {
|
if (StrUtil.isNotBlank(wechatUser.getOpenid())) {
|
||||||
templateService.deliverySuccessNotice(resources.getOrderId(),
|
templateService.deliverySuccessNotice(resources.getOrderId(),
|
||||||
expressDTO.getName(),resources.getDeliveryId(),wechatUser.getOpenid());
|
expressDTO.getName(),resources.getDeliveryId(),wechatUser.getOpenid());
|
||||||
} else if (StrUtil.isNotBlank(wechatUser.getRoutineOpenid())) {
|
|
||||||
//todo 小程序通知
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -266,12 +265,11 @@ public class StoreOrderController {
|
|||||||
try {
|
try {
|
||||||
YxWechatUserDTO wechatUser = wechatUserService.findById(resources.getUid());
|
YxWechatUserDTO wechatUser = wechatUserService.findById(resources.getUid());
|
||||||
if (ObjectUtil.isNotNull(wechatUser)) {
|
if (ObjectUtil.isNotNull(wechatUser)) {
|
||||||
|
//公众号与小程序打通统一公众号模板通知
|
||||||
if (StrUtil.isNotBlank(wechatUser.getOpenid())) {
|
if (StrUtil.isNotBlank(wechatUser.getOpenid())) {
|
||||||
templateService.refundSuccessNotice(resources.getOrderId(),
|
templateService.refundSuccessNotice(resources.getOrderId(),
|
||||||
resources.getPayPrice().toString(),wechatUser.getOpenid(),
|
resources.getPayPrice().toString(),wechatUser.getOpenid(),
|
||||||
OrderUtil.stampToDate(resources.getAddTime().toString()));
|
OrderUtil.stampToDate(resources.getAddTime().toString()));
|
||||||
} else if (StrUtil.isNotBlank(wechatUser.getRoutineOpenid())) {
|
|
||||||
//todo 小程序通知
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Reference in New Issue
Block a user