Browse Source

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/java/org/springblade/ldt/activity/entity/Activity.java
#	src/main/java/org/springblade/ldt/activity/entity/JoinRecord.java
lianghanqiang 4 năm trước cách đây
mục cha
commit
7e5eaa75e9
19 tập tin đã thay đổi với 457 bổ sung29 xóa
  1. 9 0
      src/main/java/org/springblade/flow/shop/listener/ShopMallCompleteListener.java
  2. 5 8
      src/main/java/org/springblade/flow/shop/listener/ShopPlatformCompleteListener.java
  3. 3 0
      src/main/java/org/springblade/flow/shop/listener/ShopUserCompleteListener.java
  4. 24 1
      src/main/java/org/springblade/gateway/common_gateway/controller/AppAccountController.java
  5. 90 0
      src/main/java/org/springblade/gateway/common_gateway/controller/AppActivityController.java
  6. 69 0
      src/main/java/org/springblade/gateway/common_gateway/controller/AppJoinRecordController.java
  7. 42 0
      src/main/java/org/springblade/gateway/common_gateway/entity/vo/AppActivityVO.java
  8. 64 0
      src/main/java/org/springblade/gateway/common_gateway/wrapper/AppJoinRecordWrapper.java
  9. 48 0
      src/main/java/org/springblade/gateway/mall_gateway/controller/AppMallController.java
  10. 10 0
      src/main/java/org/springblade/gateway/mall_gateway/service/IAppMallService.java
  11. 13 1
      src/main/java/org/springblade/gateway/mall_gateway/service/impl/AppMallServiceImpl.java
  12. 38 7
      src/main/java/org/springblade/gateway/shop_gateway/controller/AppShopController.java
  13. 5 0
      src/main/java/org/springblade/gateway/shop_gateway/entity/dto/AppAccountDto.java
  14. 21 0
      src/main/java/org/springblade/gateway/shop_gateway/entity/vo/IndexVO.java
  15. 3 1
      src/main/java/org/springblade/gateway/shop_gateway/service/impl/AppShopServiceImpl.java
  16. 6 5
      src/main/java/org/springblade/ldt/activity/entity/Activity.java
  17. 5 5
      src/main/java/org/springblade/ldt/activity/entity/JoinRecord.java
  18. 1 0
      src/main/java/org/springblade/ldt/activity/mapper/JoinRecordMapper.xml
  19. 1 1
      src/main/java/org/springblade/payment/handle/handler/DiscountHandle.java

+ 9 - 0
src/main/java/org/springblade/flow/shop/listener/ShopMallCompleteListener.java

@@ -8,7 +8,9 @@ import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.tool.utils.SpringUtil;
 import org.springblade.flow.shop.entity.ShopEnum;
 import org.springblade.ldt.shop.entity.Audit;
+import org.springblade.ldt.shop.entity.Shop;
 import org.springblade.ldt.shop.service.IAuditService;
+import org.springblade.ldt.shop.service.IShopService;
 import org.springframework.util.Assert;
 
 /**
@@ -20,20 +22,27 @@ import org.springframework.util.Assert;
 public class ShopMallCompleteListener implements TaskListener {
 
 	private IAuditService auditService;
+	private IShopService shopService;
 
 	{
 		auditService = SpringUtil.getBean(IAuditService.class);
+		shopService = SpringUtil.getBean(IShopService.class);
 	}
+
 	@Override
 	public void notify(DelegateTask delegateTask) {
 
 		boolean isPass = Convert.toBool(delegateTask.getVariable("pass"));
+		Shop shop = shopService.getById( Convert.toLong(delegateTask.getVariable("shopId")));
+
 		Long auditId = Convert.toLong(delegateTask.getVariable("auditId"));
 		Audit audit = auditService.getById(auditId);
 
 		audit.setAuditStatus(isPass? ShopEnum.WAITING_PLATFORM.name():ShopEnum.FAIL.name());
+		shop.setAuditStatus(isPass? ShopEnum.WAITING_PLATFORM.name():ShopEnum.FAIL.name());
 
 		Assert.isTrue(auditService.saveOrUpdate(audit),()->{throw  new ServiceException("商户审核:商场审核完毕异常");});
+		Assert.isTrue(shopService.saveOrUpdate(shop),()->{throw  new ServiceException("商户审核:商场审核完毕异常");});
 
 	}
 }

+ 5 - 8
src/main/java/org/springblade/flow/shop/listener/ShopPlatformCompleteListener.java

@@ -36,16 +36,13 @@ public class ShopPlatformCompleteListener implements TaskListener {
 		Long auditId = Convert.toLong(delegateTask.getVariable("auditId"));
 		Long shopId = Convert.toLong(delegateTask.getVariable("shopId"));
 		Audit audit = auditService.getById(auditId);
+		Shop shop = shopService.getById(shopId);
+
+		shop.setAuditStatus(isPass? ShopEnum.PASS.name():ShopEnum.FAIL.name());
+		audit.setAuditStatus(isPass? ShopEnum.PASS.name():ShopEnum.FAIL.name());
 
-		if(isPass){
-			Shop shop = shopService.getById(shopId);
-			shop.setAuditStatus(ShopEnum.PASS.name());
-			audit.setAuditStatus(ShopEnum.PASS.name());
-			Assert.isTrue(shopService.saveOrUpdate(shop),()->{throw  new ServiceException("商户审核:平台审核完毕异常");});
-		}else{
-			audit.setAuditStatus(ShopEnum.FAIL.name());
-		}
 		Assert.isTrue(auditService.saveOrUpdate(audit),()->{throw  new ServiceException("商户审核:平台审核完毕异常");});
+		Assert.isTrue(shopService.saveOrUpdate(shop),()->{throw  new ServiceException("商户审核:平台审核完毕异常");});
 
 	}
 }

+ 3 - 0
src/main/java/org/springblade/flow/shop/listener/ShopUserCompleteListener.java

@@ -42,8 +42,11 @@ public class ShopUserCompleteListener implements TaskListener {
 		boolean toPlatform = Objects.isNull(shop.getMallId());
 
 		audit.setAuditStatus(toPlatform? ShopEnum.WAITING_PLATFORM.name(): ShopEnum.WAITING_MALL.name());
+		shop.setAuditStatus(toPlatform? ShopEnum.WAITING_PLATFORM.name(): ShopEnum.WAITING_MALL.name());
+
 
 		Assert.isTrue(auditService.saveOrUpdate(audit),()->{throw  new ServiceException("商户审核:用户处理完毕异常");});
+		Assert.isTrue(shopService.saveOrUpdate(shop),()->{throw  new ServiceException("商户审核:用户处理完毕异常");});
 
 	}
 }

+ 24 - 1
src/main/java/org/springblade/gateway/common_gateway/controller/AppAccountController.java

@@ -68,7 +68,9 @@ public class AppAccountController {
 	@SneakyThrows
 	public R register(@RequestBody @Valid AppAccountDto appAccountDto) {
 		Assert.notNull(appAccountDto.getSecret(), "密码不能为空");
-		Account isExit = accountService.getOne(Condition.getQueryWrapper(new Account()).lambda().eq(Account::getPhone, appAccountDto.getPhone()));
+		Account isExit = accountService.getOne(Condition.getQueryWrapper(new Account()).lambda()
+			.eq(Account::getPhone, appAccountDto.getPhone())
+			.eq(Account::getType, AppConstant.PLATFORM.SHOP.name()));
 		Assert.isNull(isExit, "该手机号已注册");
 
 		Assert.isTrue(SmsUtil.validateMessage(null, appAccountDto.getSmsId(), appAccountDto.getValue(), appAccountDto.getPhone()),
@@ -103,6 +105,27 @@ public class AppAccountController {
 		return R.data(accountService.updateById(account));
 	}
 
+	@PostMapping("updatePsw")
+	@ApiOperation(value = "修改密码")
+	@SneakyThrows
+	public R updatePsw(@RequestBody AppAccountDto appAccountDto) {
+		Assert.notNull(appAccountDto.getPhone(), "手机号不能为空");
+		Assert.notNull(appAccountDto.getSecret(), "新密码不能为空");
+		Assert.notNull(appAccountDto.getOldSecret(), "旧密码不能为空");
+		Assert.notNull(appAccountDto.getType(), "类型不能为空");
+
+		//通过旧密码获取账号
+		Account account = accountService.getOne(Condition.getQueryWrapper(new Account()).lambda()
+			.eq(Account::getSecret,DigestUtil.hex(appAccountDto.getOldSecret()) )
+			.eq(Account::getPhone, appAccountDto.getPhone())
+			.eq(Account::getType, appAccountDto.getType()));
+		Assert.notNull(account, () -> {
+			throw new ServiceException(ResCode.USER_PWS_ERROR);
+		});
+		account.setSecret(DigestUtil.hex(appAccountDto.getSecret()));
+		return R.status(accountService.updateById(account));
+	}
+
 	/**
 	 * 验证验证码
 	 *

+ 90 - 0
src/main/java/org/springblade/gateway/common_gateway/controller/AppActivityController.java

@@ -0,0 +1,90 @@
+package org.springblade.gateway.common_gateway.controller;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.lang.Assert;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springblade.common.enums.AppConstant;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.flow.activity.entity.ActivityEnum;
+import org.springblade.flow.activity.entity.ProcessActivity;
+import org.springblade.flow.activity.service.impl.AuditActivityService;
+import org.springblade.flow.shop.service.impl.AuditShopService;
+import org.springblade.ldt.activity.entity.Activity;
+import org.springblade.ldt.activity.entity.JoinRecord;
+import org.springblade.ldt.activity.service.IActivityService;
+import org.springblade.ldt.activity.service.IJoinRecordService;
+import org.springblade.ldt.activity.vo.ActivityVO;
+import org.springblade.ldt.activity.wrapper.ActivityWrapper;
+import org.springblade.ldt.shop.entity.Shop;
+import org.springblade.ldt.shop.vo.ShopVO;
+import org.springblade.ldt.shop.wrapper.ShopWrapper;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @author cy-computer
+ */
+@Api(tags = "活动模块")
+@RestController
+@RequestMapping("/common/activity")
+@AllArgsConstructor
+public class AppActivityController {
+	private AuditActivityService auditActivityService;
+	private IActivityService activityService;
+	private IJoinRecordService joinRecordService;
+
+	@PostMapping("publish")
+	public R publish(@RequestBody Activity activity) {
+		ProcessActivity processActivity = ProcessActivity.builder().activity(activity).build();
+		return R.status(auditActivityService.startProcess(processActivity));
+	}
+
+	/**
+	 * 分页
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入shop")
+	public R<IPage<ActivityVO>> list(@RequestParam Map<String, Object> activity, Query query) {
+		IPage<Activity> pages = activityService.page(Condition.getPage(query), Condition.getQueryWrapper(activity, Activity.class).lambda().orderByDesc(Activity::getCreateTime));
+		return R.data(ActivityWrapper.build().pageVO(pages));
+	}
+
+
+	/**
+	 * 获取可参加活动列表
+	 */
+	@GetMapping("getCanJoinActivity")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "getCanJoinActivity", notes = "传入shop")
+	public R<IPage<ActivityVO>> getCanJoinActivity(Activity activity, Query query) {
+		Assert.notNull(activity.getLaunchType(), "launchType不能为空");
+		Assert.notNull(activity.getLaunchId(), "launchId不能为空");
+		Assert.notNull(activity.getMallId(), "mallId不能为空");
+
+		//获取已参加的活动id
+		List<Long> joinListId = joinRecordService.list(Condition.getQueryWrapper(new JoinRecord()).lambda()
+			.eq(JoinRecord::getJoinType, activity.getLaunchType())
+			.eq(JoinRecord::getJoinId, activity.getLaunchId())).stream().map(JoinRecord::getActivityId).collect(Collectors.toList());
+		//筛选已参加的活动
+		IPage<Activity> pages = activityService.page(Condition.getPage(query), Condition.getQueryWrapper(new Activity()).lambda()
+			.eq(Activity::getMallId,activity.getMallId())
+			.eq(Activity::getAuditStatus, ActivityEnum.PASS.name())
+			.orderByDesc(Activity::getCreateTime)
+			.notIn(CollUtil.isNotEmpty(joinListId),Activity::getId, joinListId));
+		return R.data(ActivityWrapper.build().pageVO(pages));
+	}
+
+
+}

+ 69 - 0
src/main/java/org/springblade/gateway/common_gateway/controller/AppJoinRecordController.java

@@ -0,0 +1,69 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.gateway.common_gateway.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.flowable.spring.boot.app.App;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.gateway.common_gateway.entity.vo.AppActivityVO;
+import org.springblade.gateway.common_gateway.wrapper.AppJoinRecordWrapper;
+import org.springblade.ldt.activity.entity.JoinRecord;
+import org.springblade.ldt.activity.service.IActivityService;
+import org.springblade.ldt.activity.service.IJoinRecordService;
+import org.springblade.ldt.activity.vo.ActivityVO;
+import org.springblade.ldt.activity.vo.JoinRecordVO;
+import org.springblade.ldt.activity.wrapper.JoinRecordWrapper;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+
+/**
+ *  控制器
+ *
+ * @author BladeX
+ * @since 2021-09-03
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("common/joinrecord")
+@Api(value = "", tags = "参加活动模块")
+public class AppJoinRecordController extends BladeController {
+
+	private final IJoinRecordService joinRecordService;
+	private final IActivityService activityService;
+
+	/**
+	 * 分页
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页")
+	public R<IPage<AppActivityVO>> list(JoinRecord joinRecord, Query query) {
+		IPage<JoinRecord> pages = joinRecordService.page(Condition.getPage(query), Condition.getQueryWrapper(joinRecord).lambda().orderByAsc(JoinRecord::getDiscount));
+		return R.data(AppJoinRecordWrapper.build(activityService).pageVO(pages));
+	}
+
+}

+ 42 - 0
src/main/java/org/springblade/gateway/common_gateway/entity/vo/AppActivityVO.java

@@ -0,0 +1,42 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.gateway.common_gateway.entity.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.ldt.activity.entity.Activity;
+
+import java.math.BigDecimal;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2021-09-03
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "ActivityVO对象", description = "ActivityVO对象")
+public class AppActivityVO extends Activity {
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 查询已参加的活动时所需
+	 */
+	private Long joinRecordId;
+}

+ 64 - 0
src/main/java/org/springblade/gateway/common_gateway/wrapper/AppJoinRecordWrapper.java

@@ -0,0 +1,64 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.gateway.common_gateway.wrapper;
+
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.gateway.common_gateway.entity.vo.AppActivityVO;
+import org.springblade.ldt.activity.entity.Activity;
+import org.springblade.ldt.activity.entity.JoinRecord;
+import org.springblade.ldt.activity.service.IActivityService;
+import org.springblade.ldt.activity.vo.ActivityVO;
+import org.springblade.ldt.activity.vo.JoinRecordVO;
+import org.springblade.ldt.user.vo.UserBankVO;
+
+import java.math.BigDecimal;
+import java.util.Objects;
+import java.util.Optional;
+
+/**
+ * 包装类,返回视图层所需的字段
+ *
+ * @author BladeX
+ * @since 2021-09-03
+ */
+public class AppJoinRecordWrapper extends BaseEntityWrapper<JoinRecord, AppActivityVO>  {
+
+	private IActivityService activityService;
+
+	public AppJoinRecordWrapper(IActivityService activityService) {
+		this.activityService = activityService;
+	}
+
+	public static AppJoinRecordWrapper build(IActivityService activityService) {
+		return new AppJoinRecordWrapper(activityService);
+ 	}
+
+	@Override
+	public AppActivityVO entityVO(JoinRecord joinRecord) {
+		Long activityId = joinRecord.getActivityId();
+		Activity activity = activityService.getById(activityId);
+		AppActivityVO appActivityVO = Objects.requireNonNull(BeanUtil.copy(activity, AppActivityVO.class));
+		if (appActivityVO != null) {
+			appActivityVO.setJoinRecordId(joinRecord.getId());
+			BigDecimal discount = Optional.ofNullable(joinRecord.getDiscount()).orElseGet(activity::getDiscount);
+			appActivityVO.setDiscount(discount);
+		}
+		return appActivityVO;
+	}
+
+}

+ 48 - 0
src/main/java/org/springblade/gateway/mall_gateway/controller/AppMallController.java

@@ -1,12 +1,24 @@
 package org.springblade.gateway.mall_gateway.controller;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
 import org.springblade.core.tool.api.R;
 import org.springblade.gateway.mall_gateway.entity.vo.IndexStatisticVO;
 import org.springblade.gateway.mall_gateway.service.IAppMallService;
+import org.springblade.gateway.shop_gateway.entity.vo.MemberInfoVO;
 import org.springblade.ldt.mall.dto.MallDTO;
+import org.springblade.ldt.mall.entity.Mall;
+import org.springblade.ldt.mall.service.IMallService;
+import org.springblade.ldt.mall.vo.MallVO;
+import org.springblade.ldt.shop.entity.Shop;
+import org.springblade.ldt.user.entity.Member;
+import org.springblade.ldt.user.service.IMemberService;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
@@ -19,7 +31,10 @@ import javax.validation.Valid;
 @Api(tags = "商场控制层")
 @AllArgsConstructor
 public class AppMallController {
+
 	private IAppMallService appMallService;
+	private IMemberService memberService;
+	private IMallService mallService;
 
 	@PostMapping("submit")
 	@ApiOperation(value = "商户提交审核")
@@ -34,4 +49,37 @@ public class AppMallController {
 		return R.data(appMallService.statistic(mallId));
 	}
 
+	@GetMapping("memberInfo")
+	@ApiOperation(value = "会员中心数据")
+	public R memberInfo(@RequestParam(value = "mallId") Long mallId) {
+
+		//会员数量
+		int memberNum = memberService.count(Condition.getQueryWrapper(new Member()).lambda().eq(Member::getMallId, mallId));
+
+		Mall mall = mallService.getById(mallId);
+
+		return R.data(MemberInfoVO
+			.builder()
+			.totalPointValue(mall.getPoint())
+			.pointUnitValue(mall.getPointRate())
+			.sendPointUnit(mall.getSendPointUnnit())
+			.memberNum(memberNum)
+			.isOpenMember(mall.getUseMember())
+			.build());
+	}
+
+	/**
+	 * 大b端商场管理,列表
+	 */
+	@GetMapping("/shopManagementList")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "大b端商场管理", notes = "传入mall")
+	public R page(MallVO mall, Query query) {
+		appMallService.shopManagementList(Condition.getPage(query), mall);
+		return R.data(null);
+	}
+
+
+
+
 }

+ 10 - 0
src/main/java/org/springblade/gateway/mall_gateway/service/IAppMallService.java

@@ -16,10 +16,12 @@
  */
 package org.springblade.gateway.mall_gateway.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.springblade.gateway.mall_gateway.entity.vo.IndexStatisticVO;
 import org.springblade.ldt.mall.dto.MallDTO;
 import org.springblade.ldt.mall.entity.Mall;
+import org.springblade.ldt.mall.vo.MallVO;
 
 /**
  *  服务类
@@ -41,4 +43,12 @@ public interface IAppMallService extends IService<Mall> {
 	 * @return
 	 */
 	IndexStatisticVO statistic(String mallId);
+
+
+	/**
+	 * 商户管理列表
+	 * @param page
+	 * @param mall
+	 */
+	void shopManagementList(IPage<Object> page, MallVO mall);
 }

+ 13 - 1
src/main/java/org/springblade/gateway/mall_gateway/service/impl/AppMallServiceImpl.java

@@ -18,6 +18,7 @@ package org.springblade.gateway.mall_gateway.service.impl;
 
 import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springblade.common.enums.AppConstant;
 import org.springblade.flow.shop.entity.ShopEnum;
@@ -32,8 +33,10 @@ import org.springblade.ldt.bills.service.IBillsService;
 import org.springblade.ldt.mall.dto.MallDTO;
 import org.springblade.ldt.mall.entity.Mall;
 import org.springblade.ldt.mall.mapper.MallMapper;
+import org.springblade.ldt.mall.vo.MallVO;
 import org.springblade.ldt.shop.entity.Shop;
 import org.springblade.ldt.shop.service.IShopService;
+import org.springblade.ldt.shop.vo.AuditVO;
 import org.springblade.ldt.user.entity.Member;
 import org.springblade.ldt.user.service.IMemberService;
 import org.springframework.stereotype.Service;
@@ -99,12 +102,15 @@ public class AppMallServiceImpl extends ServiceImpl<MallMapper, Mall> implements
 			.le(Member::getCreateTime, DateUtil.endOfDay(new Date())));
 
 		//交易笔数
-		int transactionNum = billsService.count(Condition.getQueryWrapper(new Bills()).lambda().ge(Bills::getMallId, mallId));
+		int transactionNum = billsService.count(Condition.getQueryWrapper(new Bills()).lambda()
+			.eq(Bills::getMallId, mallId)
+			.eq(Bills::getPaystatus, AppConstant.BillPayStatus.付款成功.name()));
 
 		//今日营收
 		QueryWrapper<Bills> queryWrapper = Condition.getQueryWrapper(new Bills());
 		queryWrapper.select("IFNULL(sum(price), 0) as todayCharge").lambda()
 			.eq(Bills::getMallId, mallId)
+			.eq(Bills::getPaystatus, AppConstant.BillPayStatus.付款成功.name())
 			.ge(Bills::getCreateTime, DateUtil.beginOfDay(new Date()))
 			.le(Bills::getCreateTime, DateUtil.endOfDay(new Date()));
 
@@ -121,4 +127,10 @@ public class AppMallServiceImpl extends ServiceImpl<MallMapper, Mall> implements
 
 		return indexStatisticVO;
 	}
+
+	@Override
+	public void shopManagementList(IPage<Object> page, MallVO mall) {
+//		IPage<AuditVO> pages = page.setRecords(baseMapper.selectMallPage(page, mall));
+	}
+
 }

+ 38 - 7
src/main/java/org/springblade/gateway/shop_gateway/controller/AppShopController.java

@@ -1,10 +1,13 @@
 package org.springblade.gateway.shop_gateway.controller;
 
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.ApiOperation;
 import lombok.SneakyThrows;
+import org.springblade.common.enums.AppConstant;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.tool.api.R;
@@ -19,6 +22,8 @@ import org.springblade.ldt.bills.entity.Bills;
 import org.springblade.ldt.bills.service.IBillsService;
 import org.springblade.ldt.shop.entity.Shop;
 import org.springblade.ldt.shop.service.IShopService;
+import org.springblade.ldt.shop.vo.ShopVO;
+import org.springblade.ldt.shop.wrapper.ShopWrapper;
 import org.springblade.ldt.user.entity.Member;
 import org.springblade.ldt.user.service.IMemberService;
 import org.springframework.web.bind.annotation.*;
@@ -43,6 +48,17 @@ public class AppShopController {
 	private IBillsService billsService;
 
 
+	/**
+	 * 分页
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入shop")
+	public R<IPage<ShopVO>> list(@RequestParam Map<String,Object> shop, Query query) {
+		IPage<Shop> pages = shopService.page(Condition.getPage(query), Condition.getQueryWrapper(shop,Shop.class).lambda());
+		return R.data(ShopWrapper.build().pageVO(pages));
+	}
+
 	@PostMapping("submitAudit")
 	@ApiOperation(value = "商户提交审核")
 	public R submitAudit(@RequestBody ShopAuditDto shopAuditDto) {
@@ -58,7 +74,8 @@ public class AppShopController {
 		int newMembers = memberService.getBaseMapper().selectCount(new QueryWrapper<Member>()
 			.lambda()
 			.eq(Member::getShopId,shopId)
-			.lt(Member::getCreateTime, DateUtil.beginOfDay(new Date()))
+			.ge(Member::getCreateTime, DateUtil.beginOfDay(new Date()))
+			.le(Member::getCreateTime, DateUtil.beginOfDay(new Date()))
 		);
 		//店铺会员总数
 		int allMembers = getTotalMembers(shopId);
@@ -67,22 +84,36 @@ public class AppShopController {
 		Shop shop = shopService.getById(shopId);
 		BigDecimal totalValue = shop.getBalance().add(shop.getCharge());
 
+		//积分总价值
+		BigDecimal pointsTotalValue = shop.getTotalValue();
+
+
+		//交易笔数
+		int transactionNum = billsService.count(Condition.getQueryWrapper(new Bills()).lambda()
+			.eq(Bills::getReceiveId, shopId)
+			.eq(Bills::getPaystatus, AppConstant.BillPayStatus.付款成功.name()));
+
 		//今日营收
 		QueryWrapper<Bills> queryWrapper = new QueryWrapper<>();
 		queryWrapper.select("IFNULL(sum(price),0) as todayCharge")
 			.lambda()
 			.eq(Bills::getReceiveId, shopId)
-			.lt(Bills::getCreateTime, DateUtil.beginOfDay(new Date()));
+			.eq(Bills::getPaystatus, AppConstant.BillPayStatus.付款成功.name())
+			.ge(Bills::getCreateTime, DateUtil.beginOfDay(new Date()))
+			.le(Bills::getCreateTime, DateUtil.beginOfDay(new Date()));
+
 		Map<String, Object> map = billsService.getMap(queryWrapper);
 		BigDecimal todayCharge = (BigDecimal) map.get("todayCharge");
 
 		return R.data(
 			IndexVO.builder()
-			.totalValue(totalValue)
-			.todayCharge(todayCharge)
-			.allMembers(allMembers)
-			.newMember(newMembers)
-			.build()
+				.totalValue(totalValue)
+				.todayCharge(todayCharge)
+				.allMembers(allMembers)
+				.pointsTotalValue(pointsTotalValue)
+				.transactionNum(transactionNum)
+				.newMember(newMembers)
+				.build()
 		);
 	}
 

+ 5 - 0
src/main/java/org/springblade/gateway/shop_gateway/entity/dto/AppAccountDto.java

@@ -39,5 +39,10 @@ public class AppAccountDto {
 	 */
 	private String type;
 
+	/**
+	 * 旧密码,修改密码使用
+	 */
+	private String oldSecret;
+
 
 }

+ 21 - 0
src/main/java/org/springblade/gateway/shop_gateway/entity/vo/IndexVO.java

@@ -13,8 +13,29 @@ import java.math.BigDecimal;
 @Data
 @Builder
 public class IndexVO {
+	/**
+	 * 今日营收
+	 */
 	BigDecimal todayCharge;
+	/**
+	 *总资产
+	 */
 	BigDecimal totalValue;
+	/**
+	 * 今日新增会员
+	 */
 	Integer newMember;
+	/**
+	 * 会员总数
+	 */
 	Integer allMembers;
+	/**
+	 * 交易笔数
+	 */
+	Integer transactionNum;
+
+	/**
+	 * 积分总价值
+	 */
+	BigDecimal pointsTotalValue;
 }

+ 3 - 1
src/main/java/org/springblade/gateway/shop_gateway/service/impl/AppShopServiceImpl.java

@@ -33,6 +33,8 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.time.LocalDateTime;
+import java.util.Date;
 
 /**
  *  服务实现类
@@ -50,9 +52,9 @@ public class AppShopServiceImpl extends ServiceImpl<ShopMapper, Shop> implements
 	@Transactional(rollbackFor = Exception.class)
 	public void submitAudit(ShopAuditDto shopAuditDto) {
 		Shop shop = shopAuditDto.getShop();
+		shop.setCreateTime(new Date());
 		this.save(shop);
 		Audit audit = shopAuditDto.getAudit();
-		audit.setAuditStatus(ShopEnum.WAITING_MALL.name());
 		audit.setShopId(shop.getId());
 		ProcessAudit processAudit = ProcessAudit.builder()
 			.audit(audit)

+ 6 - 5
src/main/java/org/springblade/ldt/activity/entity/Activity.java

@@ -29,7 +29,7 @@ import io.swagger.annotations.ApiModelProperty;
  * 实体类
  *
  * @author BladeX
- * @since 2021-09-06
+ * @since 2021-09-03
  */
 @Data
 @TableName("ldt_activity")
@@ -75,10 +75,11 @@ public class Activity extends BaseEntity {
 		@ApiModelProperty(value = "活动描述")
 		private String intro;
 	/**
-	* 商场id
-	*/
-		@ApiModelProperty(value = "商场id")
-		private Long mallId;
+	 * 商场id,不管发起者是商户还是商场都要传
+	 * 方便小程序查询
+	 */
+	@ApiModelProperty(value = "商场id")
+	private Long mallId;
 	/**
 	* 发起账户
 	*/

+ 5 - 5
src/main/java/org/springblade/ldt/activity/entity/JoinRecord.java

@@ -28,7 +28,7 @@ import io.swagger.annotations.ApiModelProperty;
  * 实体类
  *
  * @author BladeX
- * @since 2021-09-06
+ * @since 2021-09-03
  */
 @Data
 @TableName("ldt_join_record")
@@ -49,10 +49,10 @@ public class JoinRecord extends BaseEntity {
 		@ApiModelProperty(value = "参与者ID")
 		private Long joinId;
 	/**
-	* MALL/SHOP
-	*/
-		@ApiModelProperty(value = "MALL/SHOP")
-		private String joinType;
+	 * 参与者类型,MALL/SHOP
+	 */
+	@ApiModelProperty(value = "joinType")
+	private String joinType;
 	/**
 	* 参与者标题
 	*/

+ 1 - 0
src/main/java/org/springblade/ldt/activity/mapper/JoinRecordMapper.xml

@@ -18,6 +18,7 @@
         <result column="join_name" property="joinName"/>
         <result column="discount" property="discount"/>
         <result column="join_logo" property="joinLogo"/>
+        <result column="join_type" property="joinType"/>
     </resultMap>
 
 

+ 1 - 1
src/main/java/org/springblade/payment/handle/handler/DiscountHandle.java

@@ -71,7 +71,7 @@ public class DiscountHandle implements BaseHandle {
 	private JoinRecord activityJoin(Long id) {
 		JoinRecord joinRecord = joinRecordService.getOne(new QueryWrapper<JoinRecord>()
 			.lambda()
-			.eq(JoinRecord::getJoinId, id).orderByDesc(JoinRecord::getDiscount)
+			.eq(JoinRecord::getJoinId, id).orderByAsc(JoinRecord::getDiscount)
 			.last("limit 1"));
 		return joinRecord;
 	}