Merge remote-tracking branch 'origin/feature/mall_product' into feature/mall_product

pull/2/head
axzsd 2023-05-17 14:39:30 +08:00
commit 1c26c9142b
41 changed files with 671 additions and 119 deletions

View File

@ -43,7 +43,7 @@ public class OrderContentRequest implements Serializable {
private static final long serialVersionUID = -4967251473044468810L;
@Schema(description = "订单id")
@NotNull(message = "挡位id不能为空")
private Integer gearId;
private String gearId;
@Schema(description = "档位名称")
@NotEmpty(message = "挡位名称不能为空")

View File

@ -22,9 +22,12 @@ import java.util.List;
public class InitOrderResponse implements Serializable {
private static final long serialVersionUID = 6894715033655337607L;
@Schema(description = "h5_url")
@Schema(description = "微信返回参数h5_url")
private String h5Url;
@Schema(description ="二维码链接")
@Schema(description ="微信返回参数二维码链接")
private String codeUrl;
@Schema(description ="支付宝返回参数")
private String body;
}

View File

@ -66,10 +66,10 @@ public class BannerController {
return success(BannerConvert.INSTANCE.convert(banner));
}
@GetMapping("/page")
@PostMapping("/page")
@Operation(summary = "获得 Banner 分页")
@PreAuthorize("@ss.hasPermission('market:banner:query')")
public CommonResult<PageResult<BannerRespVO>> getBannerPage(@Valid BannerPageReqVO pageVO) {
public CommonResult<PageResult<BannerRespVO>> getBannerPage(@RequestBody@Valid BannerPageReqVO pageVO) {
PageResult<BannerDO> pageResult = bannerService.getBannerPage(pageVO);
return success(BannerConvert.INSTANCE.convertPage(pageResult));
}

View File

@ -25,6 +25,11 @@ public class BannerPageReqVO extends PageParam {
@Schema(description = "标题")
private String title;
/**
*
*/
@Schema(description = "多租户编号")
private Long tenantId;
@Schema(description = "状态")
@InEnum(CommonStatusEnum.class)

View File

@ -29,12 +29,12 @@ public class AliPayNotifyController {
private StoreOrderService storeOrderService;
@PostMapping("pay_notify")
public CommonResult<Object> payNotify(HttpServletRequest request, @RequestBody Map<String, String> params) {
return CommonResult.success(storeOrderService.aliNotify(request, params));
public Object payNotify(HttpServletRequest request, @RequestBody Map<String, String> params) {
return storeOrderService.aliNotify(request, params);
}
@PostMapping("refund_notify")
public CommonResult<Object> refundNotify(HttpServletRequest request, @RequestBody Map<String, String> params) {
return CommonResult.success(storeOrderService.refundNotify(request, params));
public Object refundNotify(HttpServletRequest request, @RequestBody Map<String, String> params) {
return storeOrderService.refundNotify(request, params);
}
}

View File

@ -9,6 +9,7 @@ import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyV3Result;
import com.github.binarywang.wxpay.service.WxPayService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -63,13 +64,20 @@ public class WxPayNotifyController {
v3Result = wxPayService.parseOrderNotifyV3Result(jsonData, this.getRequestHeader(request));
WxPayOrderNotifyV3Result.DecryptNotifyResult result = v3Result.getResult();
log.info("支付通知=" + JSONUtil.toJsonPrettyStr(result));
if (StringUtils.equals("SUCCESS",result.getTradeType())) {
log.info("微信支付回调成功");
// 验证相关参数-金额
// 修改订单状态
// 写入
response.setStatus(HttpServletResponse.SC_OK);
return "success";
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
// 通知应答码HTTP应答状态码需返回5XX或4XX同时需返回应答报文
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return "";
return "failure";
}
/**
@ -115,13 +123,21 @@ public class WxPayNotifyController {
WxPayRefundNotifyV3Result.DecryptNotifyResult result = v3Result.getResult();
log.info("退款通知=" + JSONUtil.toJsonPrettyStr(result));
//退款状态
if (StringUtils.equals("SUCCESS",result.getRefundId())) {
log.info("微信退款回调成功");
// 验证相关参数-金额
// 修改订单状态
// 写入
response.setStatus(HttpServletResponse.SC_OK);
return "success";
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
// 通知应答码HTTP应答状态码需返回5XX或4XX同时需返回应答报文
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return "";
return "failure";
}
}

View File

@ -0,0 +1,56 @@
package cn.iocoder.yudao.module.shop.controller.app.member;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.RechargeGearRespVO;
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.RechargeOrderRespVO;
import cn.iocoder.yudao.module.shop.convert.recharge.RechargeGearConvert;
import cn.iocoder.yudao.module.shop.convert.recharge.RechargeOrderConvert;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeGearDO;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO;
import cn.iocoder.yudao.module.shop.service.recharge.RechargeGearService;
import cn.iocoder.yudao.module.shop.service.recharge.RechargeOrderService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @Title:MemberController
* @Description:
* @author: tangqian
* @date: 2023/5/17 10:13
* @version: V1.0.0
*/
@Slf4j
@RestController
@RequestMapping("api/order/member")
@Tag(name = "用户 APP - 会员相关信息")
public class MemberController {
@Autowired
private RechargeGearService rechargeGearService;
@Autowired
private RechargeOrderService rechargeOrderService;
// 会员档次信息列表
@Operation(summary = "会员档次信息")
@RequestMapping(value = "/memberGradeInfo", method = RequestMethod.GET)
public CommonResult<List<RechargeGearRespVO>> memberGradeInfo() {
List<RechargeGearDO> gradeInfo = rechargeGearService.getGradeInfo();
return CommonResult.success(RechargeGearConvert.INSTANCE.convertList(gradeInfo));
}
// 充值列表记录
@Operation(summary = "获取当前登录账号的充值记录")
@RequestMapping(value = "/memberOrderInfo", method = RequestMethod.GET)
public CommonResult<List<RechargeOrderRespVO>> memberOrderInfo() {
List<RechargeOrderDO> orderDOS = rechargeOrderService.memberOrderInfo();
return CommonResult.success(RechargeOrderConvert.INSTANCE.convertList(orderDOS));
}
}

View File

@ -9,7 +9,6 @@ import cn.iocoder.yudao.framework.common.exception.ServiceException;
import cn.iocoder.yudao.framework.common.pojo.DateLimitUtilVo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.framework.pay.config.WxPayOneAutoConfiguration;
import cn.iocoder.yudao.framework.pay.properties.AliPayProperties;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
@ -52,6 +51,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -80,6 +80,7 @@ import java.util.stream.Collectors;
* | Author: CRMEB Team <admin@crmeb.com>
* +----------------------------------------------------------------------
*/
@Slf4j
@Service
public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOrder> implements StoreOrderService {
@ -1150,14 +1151,25 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
} catch (AlipayApiException e) {
e.printStackTrace();
}
if (verifyResult) {
log.info("支付宝支付回调成功");
String orderId = params.get("out_trade_no");
RechargeOrderDO orderDO = rechargeOrderMapper.selectOne(Wrappers.<RechargeOrderDO>lambdaQuery().eq(RechargeOrderDO::getOrderId, orderId));
String amount = params.get("refund_amount");
String total_amount = params.get("total_amount");
log.info("orderId:{}",orderId);
log.info("amount:{}",amount);
log.info("amount:{}",total_amount);
// 处理相关逻辑
// 验证相关参数-金额
// 修改订单状态
// 写入
RechargeOrderDO orderDO = rechargeOrderMapper.selectOne(Wrappers.<RechargeOrderDO>lambdaQuery().eq(RechargeOrderDO::getOrderId, orderId));
orderDO.setPaid((byte) 1);
rechargeOrderMapper.updateById(orderDO);
return "success";
} else {
return "failure";
}
return null;
}
@Override
@ -1170,31 +1182,36 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
}
@Override
public Object refundNotify(HttpServletRequest request, Map<String, String> params1) {
// 解析支付宝回调参数
Map<String, String> params = new HashMap<>();
Map<String, String[]> requestParams = request.getParameterMap();
for (Map.Entry<String, String[]> entry : requestParams.entrySet()) {
String name = entry.getKey();
String[] values = entry.getValue();
StringBuilder sb = new StringBuilder();
for (String value : values) {
sb.append(value);
}
params.put(name, sb.toString());
}
public Object refundNotify(HttpServletRequest request, Map<String, String> params) {
String tradeNo = params.get("trade_no"); // 支付宝交易号
String outTradeNo = params.get("out_trade_no"); // 商户订单号
String refundAmount = params.get("refund_amount"); // 退款金额
String tradeStatus = params.get("trade_status");
log.info("tradeStatus:{}",tradeStatus);
log.info("tradeNo:{}",tradeNo);
log.info("outTradeNo:{}",outTradeNo);
log.info("refundAmount:{}",refundAmount);
// 2. 验证回调签名
Map<String, String> paramMap = new HashMap<>(params);
paramMap.remove("sign_type"); // 移除sign_type参数
// 验证签名
boolean isSignatureValid = false;
try {
isSignatureValid = AlipaySignature.rsaCheckV1(params, aliPayProperties.getAlipayPublicKey(), "UTF-8", "RSA2");
isSignatureValid = AlipaySignature.rsaCheckV1(paramMap, aliPayProperties.getAlipayPublicKey(), "UTF-8", "RSA2");
} catch (AlipayApiException e) {
e.printStackTrace();
}
log.info("支付宝退款回调验证结果{}",isSignatureValid);
if (isSignatureValid) {
// 验证通过,处理退款结果
String tradeStatus = params.get("trade_status");
log.info("支付宝退款回调成功");
// 验证通过
// 处理相关逻辑
// 验证相关参数-金额
// 修改订单状态
// 写入
if ("TRADE_SUCCESS".equals(tradeStatus)) {
// 退款成功逻辑
} else {
// 退款失败逻辑
}
@ -1229,12 +1246,12 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
orderInfos.forEach(info -> {
RechargeOrderInfoDO infoDO = new RechargeOrderInfoDO();
infoDO.setRechargeOrderId(orderDO.getId());
infoDO.setGiveIntegral(info.getGearId());
infoDO.setOrderNo(code);
infoDO.setProductName(info.getName());
infoDO.setPrice(new BigDecimal(info.getGearAmount()));
infoDO.setPayNum(1);
infoDO.setGiveIntegral(info.getGearAmount());
infoDO.setVipPrice(new BigDecimal(info.getGearAmount()));
infoDOS.add(infoDO);
});
rechargeOrderInfoMapper.insertBatch(infoDOS);

View File

@ -67,4 +67,5 @@ public interface RechargeGearService {
*/
List<RechargeGearDO> getRechargeGearList(RechargeGearExportReqVO exportReqVO);
List<RechargeGearDO> getGradeInfo();
}

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.shop.service.recharge;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@ -79,4 +80,10 @@ public class RechargeGearServiceImpl implements RechargeGearService {
return rechargeGearMapper.selectList(exportReqVO);
}
@Override
public List<RechargeGearDO> getGradeInfo() {
return rechargeGearMapper.selectList(Wrappers.<RechargeGearDO>lambdaQuery()
.eq(RechargeGearDO::getDeleted, 0));
}
}

View File

@ -67,4 +67,6 @@ public interface RechargeOrderService {
*/
List<RechargeOrderDO> getRechargeOrderList(RechargeOrderExportReqVO exportReqVO);
List<RechargeOrderDO> memberOrderInfo();
}

View File

@ -1,7 +1,12 @@
package cn.iocoder.yudao.module.shop.service.recharge;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.util.Assert;
import org.springframework.validation.annotation.Validated;
import java.util.*;
@ -79,4 +84,11 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
return rechargeOrderMapper.selectList(exportReqVO);
}
@Override
public List<RechargeOrderDO> memberOrderInfo() {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
Assert.notNull(loginUser, "登录失效,请重新登录!");
return rechargeOrderMapper.selectList(Wrappers.<RechargeOrderDO>lambdaQuery().eq(RechargeOrderDO::getUid,loginUser.getId()));
}
}

View File

@ -36,6 +36,7 @@ public class AliPayStrategy implements IPayStrategy {
@Override
public InitOrderResponse pay(RechargeOrderDO orderDO, HttpServletRequest servletRequest, String openId) {
InitOrderResponse orderResponse = new InitOrderResponse();
AlipayClient alipayClient = aliPayConfig.alipayClient();
Assert.notNull(alipayClient, "获取支付宝支付配置失败!");
AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest();
@ -56,13 +57,11 @@ public class AliPayStrategy implements IPayStrategy {
AlipayTradeWapPayResponse response = null;
try {
response = alipayClient.pageExecute(request);
orderResponse.setBody(response.getBody());
} catch (AlipayApiException e) {
e.printStackTrace();
}
if (response.isSuccess()) {
return new InitOrderResponse();
}
return null;
return orderResponse;
}
@Override

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.member.controller.admin.promoter;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.module.system.enums.common.SexEnum;
import com.github.pagehelper.PageInfo;
import io.swagger.v3.oas.annotations.Parameters;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -87,8 +88,8 @@ public class PromoterController {
@Operation(summary = "获得推广员分页")
@PreAuthorize("@ss.hasPermission('member:promoter:query')")
public CommonResult<PageResult<PromoterRespVO>> getPromoterPage(@Valid PromoterPageReqVO pageVO) {
PageResult<PromoterDO> pageResult = promoterService.getPromoterPage(pageVO);
return success(PromoterConvert.INSTANCE.convertPage(pageResult));
PageResult<PromoterRespVO> pageResult = promoterService.getPromoterPage(pageVO);
return success(pageResult);
}
@GetMapping("/export-excel")

View File

@ -21,7 +21,7 @@ public class PromoterBaseVO {
@Schema(description = "推广员名称", required = true, example = "5841")
@NotEmpty(message = "推广员名称不能为空")
@Size(max = 10,message = "推广员名称最长不能超过{max}")
private String nickName;
private String nickname;
@Schema(description = "推广员手机号", example = "15601691300")

View File

@ -11,5 +11,8 @@ public class PromoterRespVO extends PromoterBaseVO {
@Schema(description = "编号", required = true, example = "3051")
private Long id;
@Schema(description = "组织名称", required = true, example = "18443")
private String orgName;
@Schema(description = "组织名称", required = true, example = "18443")
private String userId;
}

View File

@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.member.controller.admin.user.dto.AdminUserQueryDTO;
import cn.iocoder.yudao.module.member.controller.admin.user.vo.AdminUserInfoRespVO;
import cn.iocoder.yudao.module.member.controller.admin.user.vo.MemberUpdateStatusReqVO;
import cn.iocoder.yudao.module.member.convert.user.UserConvert;
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
@ -20,6 +21,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
@ -58,7 +60,13 @@ public class AdminUserController {
String avatar = userService.updateUserAvatar(getLoginUserId(), file.getInputStream());
return success(avatar);
}
@PutMapping("/update-status")
@Operation(summary = "修改用户状态")
@PreAuthorize("@ss.hasPermission('system:user:update')")
public CommonResult<Boolean> updateUserStatus(@Valid @RequestBody MemberUpdateStatusReqVO reqVO) {
userService.updateUserStatus(reqVO.getId(), reqVO.getStatus());
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得基本信息")
@PreAuthorize("@ss.hasPermission('member:user:query')")

View File

@ -0,0 +1,21 @@
package cn.iocoder.yudao.module.member.controller.admin.user.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - 用户更新状态 Request VO")
@Data
public class MemberUpdateStatusReqVO {
@Schema(description = "用户编号", required = true, example = "1024")
@NotNull(message = "角色编号不能为空")
private Long id;
@Schema(description = "状态,见 CommonStatusEnum 枚举", required = true, example = "1")
@NotNull(message = "状态不能为空")
// @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
private Integer status;
}

View File

@ -6,8 +6,10 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.member.dal.dataobject.promoter.PromoterDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.member.controller.admin.promoter.vo.*;
import org.apache.ibatis.annotations.Param;
/**
* 广 Mapper
@ -23,7 +25,7 @@ public interface PromoterMapper extends BaseMapperX<PromoterDO> {
.eqIfPresent(PromoterDO::getUserId, reqVO.getUserId())
.orderByDesc(PromoterDO::getId));
}
IPage<PromoterRespVO> findListPage(IPage<PromoterRespVO> page, @Param("data") PromoterPageReqVO data);
default List<PromoterDO> selectList(PromoterExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<PromoterDO>()
.eqIfPresent(PromoterDO::getOrgId, reqVO.getOrgId())

View File

@ -5,6 +5,7 @@ import javax.validation.*;
import cn.iocoder.yudao.module.member.controller.admin.promoter.vo.*;
import cn.iocoder.yudao.module.member.dal.dataobject.promoter.PromoterDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import com.github.pagehelper.PageInfo;
/**
* 广 Service
@ -57,7 +58,7 @@ public interface PromoterService {
* @param pageReqVO
* @return 广
*/
PageResult<PromoterDO> getPromoterPage(PromoterPageReqVO pageReqVO);
PageResult<PromoterRespVO> getPromoterPage(PromoterPageReqVO pageReqVO);
/**
* 广, Excel

View File

@ -9,6 +9,9 @@ import cn.iocoder.yudao.module.member.service.user.MemberUserService;
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -58,11 +61,11 @@ public class PromoterServiceImpl implements PromoterService {
if(memberUserDO==null){
//创建用户
memberUserDO = new MemberUserDO();
memberUserDO.setNickname(createReqVO.getNickName());
memberUserDO.setNickname(createReqVO.getNickname());
memberUserDO.setMobile(createReqVO.getMobile());
memberUserDO.setStatus(createReqVO.getStatus());
memberUserDO.setPassword(createReqVO.getMobile().substring(createReqVO.getMobile().length()-6));
memberUserService.createUserIfAbsent(createReqVO.getMobile(),createReqVO.getNickName(),getClientIP());
memberUserService.createUserIfAbsent(createReqVO.getMobile(),createReqVO.getNickname(),getClientIP());
}
// 插入
PromoterDO promoter = PromoterConvert.INSTANCE.convert(createReqVO);
@ -111,8 +114,10 @@ public class PromoterServiceImpl implements PromoterService {
}
@Override
public PageResult<PromoterDO> getPromoterPage(PromoterPageReqVO pageReqVO) {
return promoterMapper.selectPage(pageReqVO);
public PageResult<PromoterRespVO> getPromoterPage(PromoterPageReqVO pageReqVO) {
Page<PromoterRespVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
promoterMapper.findListPage(page,pageReqVO);
return new PageResult<>(page.getRecords(), page.getTotal());
}
@Override

View File

@ -82,6 +82,8 @@ public interface MemberUserService {
*/
String updateUserAvatar(Long userId, InputStream inputStream) throws Exception;
void updateUserStatus(Long id, Integer status) ;
/**
*
* @param userId id

View File

@ -123,7 +123,16 @@ public class MemberUserServiceImpl implements MemberUserService {
memberUserMapper.updateById(MemberUserDO.builder().id(userId).avatar(avatar).build());
return avatar;
}
@Override
public void updateUserStatus(Long id, Integer status) {
// 校验用户存在
this.checkUserExists(id);
// 更新状态
MemberUserDO updateObj = new MemberUserDO();
updateObj.setId(id);
updateObj.setStatus(status);
memberUserMapper.updateById(updateObj);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateUserMobile(Long userId, AppUserUpdateMobileReqVO reqVO) {

View File

@ -9,4 +9,10 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="findListPage" resultType="cn.iocoder.yudao.module.member.controller.admin.promoter.vo.PromoterRespVO">
select a.id,a.user_id,a.org_id,b.nickname,b.status,b.mobile,c.parent_organization_name as 'orgName' from member_promoter a
left join member_user b on a.user_id = b.id
left join system_dept c on c.id=a.org_id
</select>
</mapper>

View File

@ -165,4 +165,6 @@ public interface ErrorCodeConstants {
// ========== 站内信发送 1002028000 ==========
ErrorCode NOTIFY_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1002025000, "模板参数({})缺失");
}

View File

@ -102,5 +102,14 @@ public class TenantBaseVO {
@Length( max =200, message = "logo长度为 {max}位")
private String logo;
/**
*
*/
private Integer goodsCommission;
/**
*
*/
private Integer memberCommission;
}

View File

@ -21,12 +21,12 @@ public class TenantCommissionUpdateReqVO {
*
*/
@NotNull(message = "商品提成不能为空")
@Size(min = 0,max = 100,message ="商品提成{min}{max}之间" )
// @Size(min = 0,max = 100,message ="商品提成{min}{max}之间" )
private Integer goodsCommission;
/**
*
*/
@NotNull(message = "会员充值提成不能为空")
@Size(min = 0,max = 100,message ="会员充值提成{min}{max}之间" )
// @Size(min = 0,max = 100,message ="会员充值提成{min}{max}之间" )
private Integer memberCommission;
}

View File

@ -0,0 +1,52 @@
package cn.iocoder.yudao.module.system.controller.app.tenant;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.*;
import cn.iocoder.yudao.module.system.convert.tenant.TenantConvert;
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO;
import cn.iocoder.yudao.module.system.service.tenant.TenantService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.annotation.security.PermitAll;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - 租户")
@RestController
@RequestMapping("/system/tenant")
public class AppTenantController {
@Resource
private TenantService tenantService;
@GetMapping("/get")
@Operation(summary = "获得租户")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('system:tenant:query')")
public CommonResult<TenantRespVO> getTenant(@RequestParam("id") Long id) {
TenantDO tenant = tenantService.getTenant(id);
return success(TenantConvert.INSTANCE.convert(tenant));
}
}

View File

@ -0,0 +1,25 @@
package cn.iocoder.yudao.module.system.controller.app.tenant.vo;
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.TenantBaseVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 租户 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class TenantRespVO extends TenantBaseVO {
@Schema(description = "租户编号", required = true, example = "1024")
private Long id;
@Schema(description = "租户名", required = true, example = "芋道")
@NotNull(message = "租户名不能为空")
private String name;
}

View File

@ -97,10 +97,10 @@ public class SmsCodeServiceImpl implements SmsCodeService {
throw exception(SMS_CODE_NOT_FOUND);
}
// 超过时间
if (LocalDateTimeUtil.between(lastSmsCode.getCreateTime(), LocalDateTime.now()).toMillis()
>= smsCodeProperties.getExpireTimes().toMillis()) { // 验证码已过期
throw exception(SMS_CODE_EXPIRED);
}
// if (LocalDateTimeUtil.between(lastSmsCode.getCreateTime(), LocalDateTime.now()).toMillis()
// >= smsCodeProperties.getExpireTimes().toMillis()) { // 验证码已过期
// throw exception(SMS_CODE_EXPIRED);
// }
// 判断验证码是否已被使用
if (Boolean.TRUE.equals(lastSmsCode.getUsed())) {
throw exception(SMS_CODE_USED);

View File

@ -159,7 +159,7 @@ public class TenantServiceImpl implements TenantService {
// 校验租户名称是否重复
validTenantNameDuplicate(updateReqVO.getName(), updateReqVO.getId());
// 校验套餐被禁用
TenantPackageDO tenantPackage = tenantPackageService.validTenantPackage(updateReqVO.getPackageId());
TenantPackageDO tenantPackage = tenantPackageService.validTenantPackage(tenant.getPackageId());
// 更新租户
TenantDO updateObj = TenantConvert.INSTANCE.convert(updateReqVO);

View File

@ -38,8 +38,8 @@ export function getBanner(id) {
export function getBannerPage(query) {
return request({
url: '/market/banner/page',
method: 'get',
params: query
method: 'post',
data: query
})
}

View File

@ -52,3 +52,15 @@ export function exportUserExcel(query) {
responseType: 'blob'
})
}
// 用户状态修改
export function changeUserStatus(id, status) {
const data = {
id,
status
}
return request({
url: '/member/user/update-status',
method: 'put',
data: data
})
}

View File

@ -63,3 +63,12 @@ export function exportTenantExcel(query) {
responseType: 'blob'
})
}
// 创建租户
export function setCommission(data) {
return request({
url: '/system/tenant/update-commission',
method: 'put',
data: data
})
}

View File

@ -1,22 +1,10 @@
<template>
<div class="app-container">
<doc-alert title="功能开启" url="https://doc.iocoder.cn/mall/build/" />
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="标题" prop="title">
<el-input v-model="queryParams.title" placeholder="请输入标题" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" @click="resetQuery"></el-button>
@ -27,7 +15,7 @@
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['market:banner:create']">新增
v-hasPermi="['system:banner:create']">新增
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
@ -43,13 +31,6 @@
</template>
</el-table-column>
<el-table-column label="跳转链接" align="center" prop="url"/>
<el-table-column label="排序" align="center" prop="sort"/>
<el-table-column label="描述" align="center" prop="memo"/>
<el-table-column label="状态" align="center" prop="status">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template v-slot="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
@ -58,10 +39,10 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['market:banner:update']">修改
v-hasPermi="['system:banner:update']">修改
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['market:banner:delete']">删除
v-hasPermi="['system:banner:delete']">删除
</el-button>
</template>
</el-table-column>
@ -77,24 +58,11 @@
<el-input v-model="form.title" placeholder="请输入标题"/>
</el-form-item>
<el-form-item label="缩略图" prop="picUrl">
<imageUpload v-model="form.picUrl" :limit="1"/>
<imageUpload v-model="form.picUrl" :limit="5"/>
</el-form-item>
<el-form-item label="跳转链接" prop="url">
<el-input v-model="form.url" placeholder="请输入跳转链接"/>
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input v-model="form.sort" placeholder="请输入排序"/>
</el-form-item>
<el-form-item label="描述" prop="memo">
<el-input v-model="form.memo" type="textarea" placeholder="请输入描述"/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)"
:key="dict.value" :label="parseInt(dict.value)">{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
@ -139,8 +107,8 @@ export default {
queryParams: {
pageNo: 1,
pageSize: 10,
title: null,
status: null,
title: '',
id: '',
createTime: []
},
//
@ -151,9 +119,7 @@ export default {
rules: {
title: [{required: true, message: "标题不能不空", trigger: "blur"}],
picUrl: [{required: true, message: "图片地址不能为空", trigger: "blur"}],
url: [{required: true, message: "跳转地址不能为空", trigger: "blur"}],
sort: [{required: true, message: "排序不能为空", trigger: "blur"}],
status: [{required: true, message: "状态不能为空", trigger: "change"}],
url: [{required: true, message: "跳转地址不能为空", trigger: "blur"}]
}
};
},
@ -165,6 +131,7 @@ export default {
getList() {
this.loading = true;
//
this.queryParams.id = this.$route.query.id
getBannerPage(this.queryParams).then(response => {
this.list = response.data.list;
this.total = response.data.total;
@ -178,15 +145,7 @@ export default {
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
title: undefined,
link: undefined,
imgUrl: undefined,
sort: undefined,
memo: undefined,
status: undefined,
};
this.form = {}
this.resetForm("form");
},
/** 搜索按钮操作 */
@ -231,6 +190,7 @@ export default {
return;
}
//
this.form.tenantId = this.$route.query.id
createBanner(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;

View File

@ -35,14 +35,22 @@
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="编号" align="center" prop="id" />
<el-table-column label="组织id" align="center" prop="orgId" />
<el-table-column label="会员id" align="center" prop="userId" />
<el-table-column label="推广员名称" align="center" prop="nickname" />
<el-table-column label="手机号" align="center" prop="mobile" />
<el-table-column label="所属组织" align="center" prop="orgName" />
<el-table-column label="启用状态" align="center" prop="status" >
<template v-slot="scope">
<el-switch v-model="scope.row.status" :active-value="0" :inactive-value="1" @change="handleStatusChange(scope.row)" />
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['member:promoter:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['member:promoter:delete']">删除</el-button>
v-hasPermi="['member:promoter:delete']">修改密码</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleStatusChange(scope.row)"
v-hasPermi="['member:promoter:delete']">禁用</el-button>
</template>
</el-table-column>
</el-table>
@ -90,9 +98,19 @@
<script>
import { createPromoter, updatePromoter, deletePromoter, getPromoter, getPromoterPage, importTemplate,exportPromoterExcel } from "@/api/member/promoter";
import {
changeUserStatus
} from "@/api/member/user";
import {getBaseHeader} from "@/utils/request";
import {CommonStatusEnum} from "@/utils/constants";
import {DICT_TYPE} from "@/utils/dict";
export default {
name: "Promoter",
computed: {
DICT_TYPE() {
return DICT_TYPE
}
},
components: {
},
data() {
@ -229,6 +247,18 @@ export default {
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
//
handleStatusChange(row) {
let text = row.status === CommonStatusEnum.ENABLE ? "启用" : "禁用";
this.$modal.confirm('您确认要"' + text + '""' + row.nickname + '"推广员吗?').then(function() {
return changeUserStatus(row.user_id, row.status);
}).then(() => {
this.$modal.msgSuccess(text + "成功");
}).catch(function() {
row.status = row.status === CommonStatusEnum.ENABLE ? CommonStatusEnum.DISABLE
: CommonStatusEnum.ENABLE;
});
},
/** 导出按钮操作 */
handleExport() {
//

View File

@ -0,0 +1,13 @@
<template>
</template>
<script>
export default {
name: 'bannerSetting'
}
</script>
<style scoped lang="scss">
</style>

View File

@ -0,0 +1,117 @@
<template>
<el-dialog title="提成设置" :visible.sync="show" width="500px" append-to-body @close="cancel">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row>
<el-col :span="24">
<el-form-item label="充值提成" prop="memberCommission">
<el-input v-model="form.memberCommission" placeholder="请输入">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="商品提成" prop="goodsCommission">
<el-input v-model="form.goodsCommission" placeholder="请输入">
<template slot="append">%</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" :loading="loading" :disable="loading"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</template>
<script>
import {setCommission} from '@/api/system/tenant';
export default {
name: 'commissionSetting',
props: {
show: {
type: Boolean,
default: false
},
data: {
type: Object,
default: () => {
}
}
},
data() {
const numberCheck = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入值'));
return false
}
if (!/(^[0-9]\d*$)/.test(value)) {
callback(new Error('值只能为正整数'));
return false
}
if (value < 0 || value > 100) {
callback(new Error('值范围在0~100之间'));
return false
}
callback()
}
return {
form: this.data,
loading: false,
rules: {
goodsCommission: [{
required: true,
validator: numberCheck,
trigger: 'blur'
}],
memberCommission: [{
required: true,
validator: numberCheck,
trigger: 'blur'
}]
}
}
},
watch: {
show: function (newVal) {
if (newVal) {
this.form = this.data
}
}
},
methods: {
submitForm() {
this.$refs['form'].validate(valid => {
if (valid) {
const {
id,
goodsCommission,
memberCommission
} = this.form
this.loading = true
setCommission({
id,
goodsCommission: parseInt(goodsCommission),
memberCommission: parseInt(memberCommission)
}).then(response => {
this.$emit('refersh')
this.$modal.msgSuccess('设置成功');
this.cancel()
}).finally(() => {
this.loading = false
})
}
})
},
cancel() {
this.form = {}
this.$emit('update:show', false)
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@ -55,7 +55,7 @@
<el-table-column label="编号" align="center" prop="id"/>
<el-table-column label="店铺LOGO" align="center" prop="logo">
<template v-slot="scope">
<img :src="scope.row.logo" width="50" height="50" />
<img :src="scope.row.logo" width="50" height="50"/>
</template>
</el-table-column>
<el-table-column label="店铺名称" align="center" prop="name"/>
@ -79,6 +79,15 @@
<el-button size="mini" type="text" @click="handleDelete(scope.row)"
v-hasPermi="['system:tenant:delete']">禁用
</el-button>
<el-button size="mini" type="text" @click="handleCommission(scope.row)"
v-hasPermi="['system:tenant:delete']">提成设置
</el-button>
<el-button size="mini" type="text" @click="handleNotice(scope.row)"
v-hasPermi="['system:tenant:delete']">通知公告
</el-button>
<el-button size="mini" type="text" @click="handleBanner(scope.row)"
v-hasPermi="['system:tenant:delete']">轮播图
</el-button>
</template>
</el-table-column>
</el-table>
@ -128,7 +137,8 @@
<el-row>
<el-col :span="12">
<el-form-item label="店铺LOGO图片" prop="logo">
<el-input v-model="form.logo" placeholder="请输入"/>
<ImageUpload v-model="form.logo" :limit="1" :isShowTip="false"
class="upload-image"/>
</el-form-item>
</el-col>
<el-col :span="12">
@ -164,6 +174,10 @@
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 提成设置 -->
<CommissionSetting :show.sync="commissionSetting.show" :data="commissionSetting.data" @refersh="getList"/>
<!-- 通知公告 -->
<NoticeSetting :show.sync="noticeSetting.show" :data="noticeSetting.data" @refersh="getList"/>
</div>
</template>
@ -178,10 +192,17 @@ import {
} from '@/api/system/tenant';
import {CommonStatusEnum} from '@/utils/constants'
import {getTenantPackageList} from '@/api/system/tenantPackage';
import ImageUpload from '@/components/ImageUpload/index.vue';
import CommissionSetting from '@/views/system/tenant/commissionSetting.vue';
import NoticeSetting from '@/views/system/tenant/noticeSetting.vue';
export default {
name: 'SystemTenant',
components: {},
components: {
NoticeSetting,
CommissionSetting,
ImageUpload
},
data() {
return {
//
@ -200,6 +221,21 @@ export default {
title: '',
//
open: false,
commissionSetting: {
show: false,
data: {
id: '',
goodsCommission: '',
memberCommission: ''
}
},
noticeSetting: {
show: false,
data: {
id: '',
notice: ''
}
},
//
queryParams: {
pageNo: 1,
@ -292,7 +328,23 @@ export default {
this.resetForm('queryForm');
this.handleQuery();
},
handleLook(row){
handleCommission(row) {
Object.assign(this.commissionSetting.data, row)
this.commissionSetting.show = true
},
handleNotice(row) {
Object.assign(this.noticeSetting.data, row)
this.noticeSetting.show = true
},
handleBanner(row) {
this.$router.push({
path: '/system/tenant/banner',
query: {
id: row.id
}
})
},
handleLook(row) {
this.form = row
this.open = true
this.isLook = true
@ -370,3 +422,17 @@ export default {
}
};
</script>
<style lang="scss" scoped>
.upload-image {
:deep(.el-upload--picture-card) {
width: 80px;
height: 80px;
line-height: 90px;
}
:deep(.el-upload-list__item) {
width: 80px;
height: 80px;
}
}
</style>

View File

@ -0,0 +1,81 @@
<template>
<el-dialog title="通知公告" :visible.sync="show" width="500px" append-to-body @close="cancel">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row>
<el-col :span="24">
<el-form-item label="通知公告" prop="notice">
<el-input v-model="form.notice" type="textarea"
:rows="2" placeholder="请输入">
</el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" :loading="loading" :disable="loading"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</template>
<script>
import {updateTenant} from '@/api/system/tenant';
export default {
name: 'noticeSetting',
props: {
show: {
type: Boolean,
default: false
},
data: {
type: Object,
default: () => {
}
}
},
data() {
return {
form: this.data,
loading: false,
rules: {
notice: [{
required: true,
message: '请输入通知公告',
trigger: 'blur'
}]
}
}
},
watch: {
show: function (newVal) {
if (newVal) {
this.form = this.data
}
}
},
methods: {
submitForm() {
this.$refs['form'].validate(valid => {
if (valid) {
this.loading = true
updateTenant(this.form).then(response => {
this.$emit('refersh')
this.$modal.msgSuccess('设置成功');
this.cancel()
}).finally(() => {
this.loading = false
})
}
})
},
cancel() {
this.form = {}
this.$emit('update:show', false)
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@ -108,9 +108,9 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="归属部门" prop="deptId">
<el-form-item label="归属组织" prop="deptId">
<treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" :clearable="false"
placeholder="请选择归属部门" :normalizer="normalizer"/>
placeholder="请选择归属组织" :normalizer="normalizer"/>
</el-form-item>
</el-col>
</el-row>