Selaa lähdekoodia

Merge branch 'master' of http://192.168.1.218:3000/lianghanqiang/ldt

lianghanqiang 4 vuotta sitten
vanhempi
commit
6375c47520
28 muutettua tiedostoa jossa 440 lisäystä ja 35 poistoa
  1. 1 1
      src/main/java/org/springblade/flow/activity/service/impl/AuditActivityService.java
  2. 1 1
      src/main/java/org/springblade/gateway/client_gateway/controller/ClientTradeController.java
  3. 16 0
      src/main/java/org/springblade/gateway/common_gateway/controller/AppActivityController.java
  4. 62 0
      src/main/java/org/springblade/gateway/common_gateway/controller/AppBillsController.java
  5. 113 0
      src/main/java/org/springblade/gateway/common_gateway/controller/AppPointBillsController.java
  6. 36 0
      src/main/java/org/springblade/gateway/common_gateway/entity/dto/BillStatisticsDTO.java
  7. 39 0
      src/main/java/org/springblade/gateway/common_gateway/entity/vo/BillStatisticsVO.java
  8. 2 0
      src/main/java/org/springblade/gateway/common_gateway/wrapper/AppJoinRecordWrapper.java
  9. 16 0
      src/main/java/org/springblade/gateway/mall_gateway/controller/AppMallController.java
  10. 40 0
      src/main/java/org/springblade/gateway/mall_gateway/entity/vo/AppMallVO.java
  11. 2 2
      src/main/java/org/springblade/gateway/mall_gateway/service/impl/AppMallServiceImpl.java
  12. 60 0
      src/main/java/org/springblade/gateway/mall_gateway/wrapper/AppMallWrapper.java
  13. 9 5
      src/main/java/org/springblade/gateway/shop_gateway/controller/AppShopController.java
  14. 1 0
      src/main/java/org/springblade/gateway/shop_gateway/controller/ShopTradeController.java
  15. 3 0
      src/main/java/org/springblade/gateway/shop_gateway/entity/dto/BaseOrder.java
  16. 0 2
      src/main/java/org/springblade/gateway/shop_gateway/service/IAppShopService.java
  17. 12 7
      src/main/java/org/springblade/gateway/shop_gateway/service/impl/AppShopServiceImpl.java
  18. 1 1
      src/main/java/org/springblade/ldt/bills/entity/Bills.java
  19. 1 1
      src/main/java/org/springblade/ldt/bills/mapper/BillsMapper.xml
  20. 8 8
      src/main/java/org/springblade/ldt/mall/controller/MallController.java
  21. 1 0
      src/main/java/org/springblade/ldt/mall/wrapper/MallWrapper.java
  22. 5 0
      src/main/java/org/springblade/ldt/shop/entity/Shop.java
  23. 1 0
      src/main/java/org/springblade/ldt/shop/mapper/ShopMapper.xml
  24. 2 2
      src/main/java/org/springblade/payment/callback/AgentChargeCallback.java
  25. 2 2
      src/main/java/org/springblade/payment/callback/UserPayCallback.java
  26. 1 1
      src/main/java/org/springblade/payment/callback/WeChatPayCallback.java
  27. 2 1
      src/main/java/org/springblade/payment/handle/Trade.java
  28. 3 1
      src/main/java/org/springblade/payment/handle/entity/Order.java

+ 1 - 1
src/main/java/org/springblade/flow/activity/service/impl/AuditActivityService.java

@@ -66,7 +66,7 @@ public class AuditActivityService implements IAuditActivityService {
 			Kv variables = Kv.create()
 				.set("businessId",activity.getId())
 				.set("auditor", AuditCandidate.LDT_PLATFORM.name())
-				.set("mallTask", TaskUtil.getTaskUserForApp(Convert.toStr(activity.getLaunchId()),TaskUtil.APP_MALL))
+					.set("mallTask", TaskUtil.getTaskUserForApp(Convert.toStr(activity.getMallId()),TaskUtil.APP_MALL))
 				.set("toPlatform", toPlatform)
 				;
 

+ 1 - 1
src/main/java/org/springblade/gateway/client_gateway/controller/ClientTradeController.java

@@ -83,7 +83,7 @@ public class ClientTradeController {
 		bills.setReceiveId(clientTradeDto.getShopId());
 		bills.setTitle("微信扫码付款");
 		bills.setExTime(clientTradeDto.getExpireTime());
-		bills.setPaystatus(AppConstant.BillPayStatus.待付款.name());
+		bills.setPayStatus(AppConstant.BillPayStatus.待付款.name());
 		bills.setPayway(PaymentScene.SCAN_CODE.name());
 		bills.setCost(clientTradeDto.getMoney());
 		bills.setType(OrderType.WECHAT_PAY.name());

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

@@ -3,6 +3,9 @@ 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 cn.hutool.http.HttpUtil;
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
@@ -44,6 +47,9 @@ public class AppActivityController {
 	private IActivityService activityService;
 	private IJoinRecordService joinRecordService;
 
+	public final static String MAP_URL = "https://apis.map.qq.com/ws/geocoder/v1/?location=";
+	public final static String MAP_KEY = "WAGBZ-EFIKU-2W2VF-4UX5F-ATB3F-HKBFU";
+
 	@PostMapping("publish")
 	public R publish(@RequestBody Activity activity) {
 		ProcessActivity processActivity = ProcessActivity.builder().activity(activity).build();
@@ -86,5 +92,15 @@ public class AppActivityController {
 		return R.data(ActivityWrapper.build().pageVO(pages));
 	}
 
+	@GetMapping("/getLocation")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "", notes = "传入rule")
+	public R getLocationData(String latitude,String longitude) {
+		String request_url = MAP_URL +latitude+","+longitude + "&key=" + MAP_KEY;
+		String s = HttpUtil.get(request_url);
+		JSONObject jsonObject = JSONUtil.parseObj(s);
+		return R.data(jsonObject);
+	}
+
 
 }

+ 62 - 0
src/main/java/org/springblade/gateway/common_gateway/controller/AppBillsController.java

@@ -1,16 +1,24 @@
 package org.springblade.gateway.common_gateway.controller;
 
+import cn.hutool.core.convert.Convert;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.lang.Assert;
+import cn.hutool.core.map.MapUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+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.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.gateway.common_gateway.entity.vo.AppBillsVO;
 import org.springblade.gateway.common_gateway.wrapper.AppBillsWrapper;
+import org.springblade.gateway.common_gateway.entity.dto.BillStatisticsDTO;
+import org.springblade.gateway.common_gateway.entity.vo.BillStatisticsVO;
 import org.springblade.ldt.bills.entity.Bills;
 import org.springblade.ldt.bills.service.IBillsService;
 import org.springblade.ldt.user.service.ILoginUserService;
@@ -18,7 +26,12 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.validation.Valid;
 import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Collectors;
 
 /**
  * @author cy-computer
@@ -45,4 +58,53 @@ public class AppBillsController {
 			.like(format!=null,Bills::getCreateTime,format));
 		return R.data(AppBillsWrapper.build(loginUserService).pageVO(pages));
 	}
+
+
+
+	@GetMapping("/getBillStatistics")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "获取统计数据", notes = "传入billStatisticsDTO")
+	public R getBillStatistics(BillStatisticsDTO billStatisticsDTO) {
+
+		Assert.notNull(billStatisticsDTO.getQueryDate(), "查询日期不能为空");
+		String year = DateUtil.format(billStatisticsDTO.getQueryDate(), "YYYY");
+
+		//获取统计数据
+		int count = billsService.count(Condition.getQueryWrapper(new Bills()).lambda()
+			.eq(billStatisticsDTO.getPayId() != null, Bills::getPayId, billStatisticsDTO.getPayId())
+			.eq(billStatisticsDTO.getReceiveId() != null, Bills::getReceiveId, billStatisticsDTO.getReceiveId())
+			.between(Bills::getCreateTime, DateUtil.beginOfMonth(billStatisticsDTO.getQueryDate()), DateUtil.endOfMonth(billStatisticsDTO.getQueryDate())));
+
+		//获取合计多少元
+		QueryWrapper<Bills> billsQueryWrapper = Condition.getQueryWrapper(new Bills());
+		billsQueryWrapper.select("SUM(" + billStatisticsDTO.getQueryColumn() + ") as totalMoney")
+			.eq(billStatisticsDTO.getPayId() != null, "pay_id", billStatisticsDTO.getPayId())
+			.eq(billStatisticsDTO.getReceiveId() != null, "receive_id", billStatisticsDTO.getReceiveId())
+			.eq("pay_status", AppConstant.BillPayStatus.付款成功.name())
+			.between("create_time", DateUtil.beginOfMonth(billStatisticsDTO.getQueryDate()), DateUtil.endOfMonth(billStatisticsDTO.getQueryDate()));
+		Map<String, Object> map = billsService.getMap(billsQueryWrapper);
+		BigDecimal totalMoney = BigDecimal.ZERO;
+		if (MapUtil.isNotEmpty(map)) {
+			totalMoney = Convert.toBigDecimal(map.get("totalMoney"));
+		}
+		//获取图表数据
+		QueryWrapper<Bills> queryWrapper = Condition.getQueryWrapper(new Bills());
+		queryWrapper.select("DATE_FORMAT(create_time, '%c') as month, sum("+billStatisticsDTO.getQueryColumn()+") as money")
+			.eq("DATE_FORMAT(create_time, '%Y')", year)
+			.eq("pay_status", AppConstant.BillPayStatus.付款成功.name())
+			.eq(billStatisticsDTO.getPayId() != null, "pay_id", billStatisticsDTO.getPayId())
+			.eq(billStatisticsDTO.getReceiveId() != null, "receive_id", billStatisticsDTO.getReceiveId())
+			.groupBy("month");
+
+		List<Map<String, Object>> listMaps = billsService.listMaps(queryWrapper);
+		List<String> monthList = listMaps.stream().map(item -> Convert.toStr(item.get("month"))+"月").collect(Collectors.toList());
+		List<BigDecimal> dataList = listMaps.stream().map(item -> Convert.toBigDecimal(item.get("money"))).collect(Collectors.toList());
+
+		BillStatisticsVO statisticsVO = BillStatisticsVO.builder()
+			.payNum(count)
+			.totalMoney(totalMoney)
+			.monthList(monthList)
+			.dataList(dataList).build();
+		return R.data(statisticsVO);
+	}
 }

+ 113 - 0
src/main/java/org/springblade/gateway/common_gateway/controller/AppPointBillsController.java

@@ -0,0 +1,113 @@
+/*
+ *      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 cn.hutool.core.convert.Convert;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.lang.Assert;
+import cn.hutool.core.map.MapUtil;
+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 io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.common.enums.AppConstant;
+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.dto.BillStatisticsDTO;
+import org.springblade.gateway.common_gateway.entity.vo.BillStatisticsVO;
+import org.springblade.ldt.bills.entity.Bills;
+import org.springblade.ldt.bills.entity.PointBills;
+import org.springblade.ldt.bills.service.IPointBillsService;
+import org.springblade.ldt.bills.vo.PointBillsVO;
+import org.springblade.ldt.bills.wrapper.PointBillsWrapper;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ *  控制器
+ *
+ * @author BladeX
+ * @since 2021-09-06
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("common/pointbills")
+@Api(value = "", tags = "渠道积分接口")
+public class AppPointBillsController extends BladeController {
+
+	private final IPointBillsService pointBillsService;
+
+
+	@GetMapping("/getPointBillStatistics")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "获取渠道积分统计数据", notes = "传入billStatisticsDTO")
+	public R getPointBillStatistics(BillStatisticsDTO billStatisticsDTO) {
+
+		Assert.notNull(billStatisticsDTO.getQueryDate(), "查询日期不能为空");
+		String year = DateUtil.format(billStatisticsDTO.getQueryDate(), "YYYY");
+
+		//获取统计数据
+		int count = pointBillsService.count(Condition.getQueryWrapper(new PointBills()).lambda()
+			.eq(billStatisticsDTO.getPayId() != null, PointBills::getPayId, billStatisticsDTO.getPayId())
+			.eq(billStatisticsDTO.getReceiveId() != null, PointBills::getReceiveId, billStatisticsDTO.getReceiveId())
+			.between(PointBills::getCreateTime, DateUtil.beginOfMonth(billStatisticsDTO.getQueryDate()), DateUtil.endOfMonth(billStatisticsDTO.getQueryDate())));
+
+		//获取合计多少元
+		QueryWrapper<PointBills> pointBillsQueryWrapper = Condition.getQueryWrapper(new PointBills());
+		pointBillsQueryWrapper.select("SUM(" + billStatisticsDTO.getQueryColumn() + ") as totalMoney")
+			.eq(billStatisticsDTO.getPayId() != null, "pay_id", billStatisticsDTO.getPayId())
+			.eq(billStatisticsDTO.getReceiveId() != null, "receive_id", billStatisticsDTO.getReceiveId())
+			.eq("pay_status", AppConstant.BillPayStatus.付款成功.name())
+			.between("create_time", DateUtil.beginOfMonth(billStatisticsDTO.getQueryDate()), DateUtil.endOfMonth(billStatisticsDTO.getQueryDate()));
+		Map<String, Object> map = pointBillsService.getMap(pointBillsQueryWrapper);
+		BigDecimal totalMoney = BigDecimal.ZERO;
+		if (MapUtil.isNotEmpty(map)) {
+			totalMoney = Convert.toBigDecimal(map.get("totalMoney"));
+		}
+		//获取图表数据
+		QueryWrapper<PointBills> queryWrapper = Condition.getQueryWrapper(new PointBills());
+		queryWrapper.select("DATE_FORMAT(create_time, '%c') as month, sum("+billStatisticsDTO.getQueryColumn()+") as money")
+			.eq("DATE_FORMAT(create_time, '%Y')", year)
+			.eq("pay_status", AppConstant.BillPayStatus.付款成功.name())
+			.eq(billStatisticsDTO.getPayId() != null, "pay_id", billStatisticsDTO.getPayId())
+			.eq(billStatisticsDTO.getReceiveId() != null, "receive_id", billStatisticsDTO.getReceiveId())
+			.groupBy("month");
+
+		List<Map<String, Object>> listMaps = pointBillsService.listMaps(queryWrapper);
+		List<String> monthList = listMaps.stream().map(item -> Convert.toStr(item.get("month"))+"月").collect(Collectors.toList());
+		List<BigDecimal> dataList = listMaps.stream().map(item -> Convert.toBigDecimal(item.get("money"))).collect(Collectors.toList());
+
+		BillStatisticsVO statisticsVO = BillStatisticsVO.builder()
+			.payNum(count)
+			.totalMoney(totalMoney)
+			.monthList(monthList)
+			.dataList(dataList).build();
+		return R.data(statisticsVO);
+	}
+
+}

+ 36 - 0
src/main/java/org/springblade/gateway/common_gateway/entity/dto/BillStatisticsDTO.java

@@ -0,0 +1,36 @@
+package org.springblade.gateway.common_gateway.entity.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.util.Date;
+
+/**
+ * @author cy-computer
+ */
+@Data
+public class BillStatisticsDTO {
+
+	/**
+	 * 筛选的日期
+	 */
+	private Date queryDate;
+
+	/**
+	 * 收款方
+	 */
+	private Long receiveId;
+
+	/**
+	 * 付款方
+	 */
+	private Long payId;
+
+	/**
+	 * 查询的字段
+	 * c端积分余额的统计数据,查询的是 balance_num
+	 * 小b端账单的统计数据,查询的是price
+	 */
+	private String queryColumn;
+
+}

+ 39 - 0
src/main/java/org/springblade/gateway/common_gateway/entity/vo/BillStatisticsVO.java

@@ -0,0 +1,39 @@
+package org.springblade.gateway.common_gateway.entity.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * @author cy-computer
+ */
+@Data
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class BillStatisticsVO {
+
+	/**
+	 * 月份
+	 */
+	private List<String> monthList;
+
+	/**
+	 * 数据
+	 */
+	private List<BigDecimal> dataList;
+
+	/**
+	 * 支付笔数
+	 */
+	private Integer payNum;
+
+	/**
+	 * 合计多少
+	 */
+	private BigDecimal totalMoney;
+}

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

@@ -16,6 +16,7 @@
  */
 package org.springblade.gateway.common_gateway.wrapper;
 
+import cn.hutool.core.lang.Assert;
 import org.springblade.core.mp.support.BaseEntityWrapper;
 import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.gateway.common_gateway.entity.vo.AppActivityVO;
@@ -52,6 +53,7 @@ public class AppJoinRecordWrapper extends BaseEntityWrapper<JoinRecord, AppActiv
 	public AppActivityVO entityVO(JoinRecord joinRecord) {
 		Long activityId = joinRecord.getActivityId();
 		Activity activity = activityService.getById(activityId);
+		Assert.notNull(activity, "找不到参加的活动信息");
 		AppActivityVO appActivityVO = Objects.requireNonNull(BeanUtil.copy(activity, AppActivityVO.class));
 		if (appActivityVO != null) {
 			appActivityVO.setJoinRecordId(joinRecord.getId());

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

@@ -9,13 +9,17 @@ 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.AppMallVO;
 import org.springblade.gateway.mall_gateway.entity.vo.IndexStatisticVO;
 import org.springblade.gateway.mall_gateway.service.IAppMallService;
+import org.springblade.gateway.mall_gateway.wrapper.AppMallWrapper;
 import org.springblade.gateway.shop_gateway.entity.vo.MemberInfoVO;
+import org.springblade.ldt.activity.service.IActivityService;
 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.mall.wrapper.MallWrapper;
 import org.springblade.ldt.shop.entity.Shop;
 import org.springblade.ldt.user.entity.Member;
 import org.springblade.ldt.user.service.IMemberService;
@@ -35,6 +39,7 @@ public class AppMallController {
 	private IAppMallService appMallService;
 	private IMemberService memberService;
 	private IMallService mallService;
+	private IActivityService activityService;
 
 	@PostMapping("submit")
 	@ApiOperation(value = "商户提交审核")
@@ -43,6 +48,17 @@ public class AppMallController {
 		return R.status(true);
 	}
 
+	/**
+	 * 分页
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入mall")
+	public R<IPage<AppMallVO>> list(Mall mall, Query query) {
+		IPage<Mall> pages = mallService.page(Condition.getPage(query), Condition.getQueryWrapper(mall));
+		return R.data(AppMallWrapper.build(activityService).pageVO(pages));
+	}
+
 	@GetMapping("statistic")
 	@ApiOperation(value = "获取商场统计数据")
 	public R statistic(String mallId) {

+ 40 - 0
src/main/java/org/springblade/gateway/mall_gateway/entity/vo/AppMallVO.java

@@ -0,0 +1,40 @@
+/*
+ *      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.mall_gateway.entity.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.ldt.mall.entity.Mall;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2021-09-06
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "MallVO对象", description = "MallVO对象")
+public class AppMallVO extends Mall {
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 该商场的活动数量
+	 */
+	private Integer activityNums;
+}

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

@@ -104,13 +104,13 @@ public class AppMallServiceImpl extends ServiceImpl<MallMapper, Mall> implements
 		//交易笔数
 		int transactionNum = billsService.count(Condition.getQueryWrapper(new Bills()).lambda()
 			.eq(Bills::getMallId, mallId)
-			.eq(Bills::getPaystatus, AppConstant.BillPayStatus.付款成功.name()));
+			.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())
+			.eq(Bills::getPayStatus, AppConstant.BillPayStatus.付款成功.name())
 			.ge(Bills::getCreateTime, DateUtil.beginOfDay(new Date()))
 			.le(Bills::getCreateTime, DateUtil.endOfDay(new Date()));
 

+ 60 - 0
src/main/java/org/springblade/gateway/mall_gateway/wrapper/AppMallWrapper.java

@@ -0,0 +1,60 @@
+/*
+ *      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.mall_gateway.wrapper;
+
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.gateway.mall_gateway.entity.vo.AppMallVO;
+import org.springblade.ldt.activity.entity.Activity;
+import org.springblade.ldt.activity.service.IActivityService;
+import org.springblade.ldt.mall.entity.Mall;
+import org.springblade.ldt.mall.vo.MallVO;
+
+import java.util.Objects;
+
+/**
+ * 包装类,返回视图层所需的字段
+ *
+ * @author BladeX
+ * @since 2021-09-06
+ */
+public class AppMallWrapper extends BaseEntityWrapper<Mall, AppMallVO>  {
+
+	private IActivityService activityService;
+
+	public AppMallWrapper(IActivityService activityService) {
+		this.activityService = activityService;
+	}
+
+	public static AppMallWrapper build(IActivityService activityService) {
+		return new AppMallWrapper(activityService);
+ 	}
+
+	@Override
+	public AppMallVO entityVO(Mall mall) {
+		AppMallVO appMallVO = Objects.requireNonNull(BeanUtil.copy(mall, AppMallVO.class));
+
+		if (appMallVO!=null) {
+			int count = activityService.count(Condition.getQueryWrapper(new Activity()).lambda().eq(Activity::getMallId, appMallVO.getId()));
+			appMallVO.setActivityNums(count);
+		}
+
+		return appMallVO;
+	}
+
+}

+ 9 - 5
src/main/java/org/springblade/gateway/shop_gateway/controller/AppShopController.java

@@ -1,12 +1,11 @@
 package org.springblade.gateway.shop_gateway.controller;
 
+import cn.hutool.core.convert.Convert;
 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;
@@ -55,7 +54,11 @@ public class AppShopController {
 	@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());
+		String filter=(String) shop.get("filter");
+		shop.remove("filter");
+		IPage<Shop> pages = shopService.page(Condition.getPage(query), Condition.getQueryWrapper(shop, Shop.class).lambda()
+			.orderByDesc("score".equals(filter), Shop::getScore)
+			.orderByDesc("sales".equals(filter), Shop::getSales));
 		return R.data(ShopWrapper.build().pageVO(pages));
 	}
 
@@ -66,6 +69,7 @@ public class AppShopController {
 		return R.success("提交成功");
 	}
 
+
 	@GetMapping("indexInfo")
 	@ApiOperation(value = "首页数据")
 	public R indexInfo(@RequestParam(value = "shopId") Long shopId) {
@@ -91,14 +95,14 @@ public class AppShopController {
 		//交易笔数
 		int transactionNum = billsService.count(Condition.getQueryWrapper(new Bills()).lambda()
 			.eq(Bills::getReceiveId, shopId)
-			.eq(Bills::getPaystatus, AppConstant.BillPayStatus.付款成功.name()));
+			.eq(Bills::getPayStatus, AppConstant.BillPayStatus.付款成功.name()));
 
 		//今日营收
 		QueryWrapper<Bills> queryWrapper = new QueryWrapper<>();
 		queryWrapper.select("IFNULL(sum(price),0) as todayCharge")
 			.lambda()
 			.eq(Bills::getReceiveId, shopId)
-			.eq(Bills::getPaystatus, AppConstant.BillPayStatus.付款成功.name())
+			.eq(Bills::getPayStatus, AppConstant.BillPayStatus.付款成功.name())
 			.ge(Bills::getCreateTime, DateUtil.beginOfDay(new Date()))
 			.le(Bills::getCreateTime, DateUtil.beginOfDay(new Date()));
 

+ 1 - 0
src/main/java/org/springblade/gateway/shop_gateway/controller/ShopTradeController.java

@@ -56,6 +56,7 @@ public class ShopTradeController {
 			.money(codeOrder.getMoney())
 			.expireTime(codeOrder.getExpireTime())
 			.secret(codeOrder.getSecret())
+			.mallId(codeOrder.getMallId())
 			.shopId(codeOrder.getShopId())
 			.openId(codeOrder.getOpenId())
 			.build();

+ 3 - 0
src/main/java/org/springblade/gateway/shop_gateway/entity/dto/BaseOrder.java

@@ -19,6 +19,9 @@ import java.time.LocalDateTime;
 @AllArgsConstructor
 public class BaseOrder {
 
+	@ApiModelProperty("商场id")
+	private Long mallId;
+
 	@ApiModelProperty("商店id")
 	private Long shopId;
 

+ 0 - 2
src/main/java/org/springblade/gateway/shop_gateway/service/IAppShopService.java

@@ -16,11 +16,9 @@
  */
 package org.springblade.gateway.shop_gateway.service;
 
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.springblade.gateway.shop_gateway.entity.dto.ShopAuditDto;
 import org.springblade.ldt.shop.entity.Shop;
-import org.springblade.ldt.shop.vo.ShopVO;
 
 /**
  *  服务类

+ 12 - 7
src/main/java/org/springblade/gateway/shop_gateway/service/impl/AppShopServiceImpl.java

@@ -16,10 +16,8 @@
  */
 package org.springblade.gateway.shop_gateway.service.impl;
 
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springblade.flow.shop.entity.ProcessAudit;
-import org.springblade.flow.shop.entity.ShopEnum;
 import org.springblade.flow.shop.service.impl.AuditShopService;
 import org.springblade.gateway.shop_gateway.entity.dto.ShopAuditDto;
 import org.springblade.gateway.shop_gateway.service.IAppShopService;
@@ -27,17 +25,14 @@ import org.springblade.ldt.shop.entity.Audit;
 import org.springblade.ldt.shop.entity.Shop;
 import org.springblade.ldt.shop.mapper.ShopMapper;
 import org.springblade.ldt.shop.service.IAuditService;
-import org.springblade.ldt.shop.service.IShopService;
-import org.springblade.ldt.shop.vo.ShopVO;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
-import java.time.LocalDateTime;
 import java.util.Date;
 
 /**
- *  服务实现类
+ * 服务实现类
  *
  * @author BladeX
  * @since 2021-08-30
@@ -47,18 +42,28 @@ public class AppShopServiceImpl extends ServiceImpl<ShopMapper, Shop> implements
 
 	@Resource
 	private AuditShopService auditShopService;
+	@Resource
+	private IAuditService auditService;
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public void submitAudit(ShopAuditDto shopAuditDto) {
 		Shop shop = shopAuditDto.getShop();
+		boolean isEdit = shop.getId() != null;
 		shop.setCreateTime(new Date());
-		this.save(shop);
+		this.saveOrUpdate(shop);
 		Audit audit = shopAuditDto.getAudit();
+		if (isEdit) {
+			//修改资料时
+			auditService.updateById(audit);
+			return;
+		}
+		//新增的商户资料才开启审核流程
 		audit.setShopId(shop.getId());
 		ProcessAudit processAudit = ProcessAudit.builder()
 			.audit(audit)
 			.build();
 		auditShopService.startProcess(processAudit);
 	}
+
 }

+ 1 - 1
src/main/java/org/springblade/ldt/bills/entity/Bills.java

@@ -93,7 +93,7 @@ public class Bills extends BaseEntity {
 	* 待付款,付款成功,取消付款
 	*/
 		@ApiModelProperty(value = "待付款,付款成功,取消付款")
-		private String paystatus;
+		private String payStatus;
 	/**
 	* 订单标题
 	*/

+ 1 - 1
src/main/java/org/springblade/ldt/bills/mapper/BillsMapper.xml

@@ -22,7 +22,7 @@
         <result column="payway" property="payway"/>
         <result column="pay_plugin" property="payPlugin"/>
         <result column="channel_id" property="channelId"/>
-        <result column="paystatus" property="paystatus"/>
+        <result column="pay_status" property="payStatus"/>
         <result column="title" property="title"/>
         <result column="bill_desc" property="billDesc"/>
         <result column="ex_time" property="exTime"/>

+ 8 - 8
src/main/java/org/springblade/ldt/mall/controller/MallController.java

@@ -62,7 +62,7 @@ public class MallController extends BladeController {
 	}
 
 	/**
-	 * 分页 
+	 * 分页
 	 */
 	@GetMapping("/list")
 	@ApiOperationSupport(order = 2)
@@ -74,7 +74,7 @@ public class MallController extends BladeController {
 
 
 	/**
-	 * 自定义分页 
+	 * 自定义分页
 	 */
 	@GetMapping("/page")
 	@ApiOperationSupport(order = 3)
@@ -85,7 +85,7 @@ public class MallController extends BladeController {
 	}
 
 	/**
-	 * 新增 
+	 * 新增
 	 */
 	@PostMapping("/save")
 	@ApiOperationSupport(order = 4)
@@ -95,7 +95,7 @@ public class MallController extends BladeController {
 	}
 
 	/**
-	 * 修改 
+	 * 修改
 	 */
 	@PostMapping("/update")
 	@ApiOperationSupport(order = 5)
@@ -105,7 +105,7 @@ public class MallController extends BladeController {
 	}
 
 	/**
-	 * 新增或修改 
+	 * 新增或修改
 	 */
 	@PostMapping("/submit")
 	@ApiOperationSupport(order = 6)
@@ -114,9 +114,9 @@ public class MallController extends BladeController {
 		return R.status(mallService.saveOrUpdate(mall));
 	}
 
-	
+
 	/**
-	 * 删除 
+	 * 删除
 	 */
 	@PostMapping("/remove")
 	@ApiOperationSupport(order = 7)
@@ -125,5 +125,5 @@ public class MallController extends BladeController {
 		return R.status(mallService.deleteLogic(Func.toLongList(ids)));
 	}
 
-	
+
 }

+ 1 - 0
src/main/java/org/springblade/ldt/mall/wrapper/MallWrapper.java

@@ -18,6 +18,7 @@ package org.springblade.ldt.mall.wrapper;
 
 import org.springblade.core.mp.support.BaseEntityWrapper;
 import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.ldt.activity.service.IActivityService;
 import org.springblade.ldt.mall.entity.Mall;
 import org.springblade.ldt.mall.vo.MallVO;
 import java.util.Objects;

+ 5 - 0
src/main/java/org/springblade/ldt/shop/entity/Shop.java

@@ -198,6 +198,11 @@ public class Shop extends BaseEntity {
 	*/
 		@ApiModelProperty(value = "定义多少金额赠送积分")
 		private BigDecimal sendPointUnit;
+	/**
+	* 评分
+	*/
+		@ApiModelProperty(value = "评分")
+		private BigDecimal score;
 
 
 }

+ 1 - 0
src/main/java/org/springblade/ldt/shop/mapper/ShopMapper.xml

@@ -44,6 +44,7 @@
         <result column="address" property="address"/>
         <result column="activity_id" property="activityId"/>
         <result column="send_point_unit" property="sendPointUnit"/>
+        <result column="score" property="score"/>
     </resultMap>
 
 

+ 2 - 2
src/main/java/org/springblade/payment/callback/AgentChargeCallback.java

@@ -49,7 +49,7 @@ public class AgentChargeCallback {
 		bills.setChannelId(successParams.getThirdOrderId());
 
 		//判断订单状态,已付款订单处理 (单笔支付可能接收多笔回调)
-		if (Objects.equals(bills.getPaystatus(), AppConstant.BillPayStatus.付款成功.name())) {
+		if (Objects.equals(bills.getPayStatus(), AppConstant.BillPayStatus.付款成功.name())) {
 			billsService.updateById(bills);
 			return;
 		}
@@ -58,7 +58,7 @@ public class AgentChargeCallback {
 		String status = successParams.getStatus();
 		if (Objects.equals(status, SUCCESS_STATUS)) {
 			//支付成功
-			bills.setPaystatus(AppConstant.BillPayStatus.付款成功.name());
+			bills.setPayStatus(AppConstant.BillPayStatus.付款成功.name());
 			billsService.updateById(bills);
 			//代理状态改为激活状态
 			Long userId = bills.getPayId();

+ 2 - 2
src/main/java/org/springblade/payment/callback/UserPayCallback.java

@@ -77,7 +77,7 @@ public class UserPayCallback {
 				});
 			}
 
-			bills.setPaystatus(AppConstant.BillPayStatus.付款成功.name());
+			bills.setPayStatus(AppConstant.BillPayStatus.付款成功.name());
 
 			//更新订单信息
 			Assert.isTrue(billsService.saveOrUpdate(bills), () -> {
@@ -150,7 +150,7 @@ public class UserPayCallback {
 		if (!Objects.isNull(balanceBills)) {
 			bills.setBalanceNum(balanceBills.getPrice());
 		}
-		bills.setPaystatus(AppConstant.BillPayStatus.付款成功.name());
+		bills.setPayStatus(AppConstant.BillPayStatus.付款成功.name());
 		return billsService.saveOrUpdate(bills);
 	}
 

+ 1 - 1
src/main/java/org/springblade/payment/callback/WeChatPayCallback.java

@@ -34,7 +34,7 @@ public class WeChatPayCallback {
 
 		//修改订单状态
 		Bills bills = billsService.getById(successParams.getBills().getId());
-		bills.setPaystatus(AppConstant.BillPayStatus.付款成功.name());
+		bills.setPayStatus(AppConstant.BillPayStatus.付款成功.name());
 
 		//增加商户余额
 		Shop shop = shopService.getById(bills.getReceiveId());

+ 2 - 1
src/main/java/org/springblade/payment/handle/Trade.java

@@ -160,7 +160,7 @@ public class Trade {
 	 * */
 	private Bills initBill(Order order, long channelId){
 		Bills bills = new Bills();
-		bills.setPaystatus(AppConstant.BillPayStatus.待付款.name());
+		bills.setPayStatus(AppConstant.BillPayStatus.待付款.name());
 		bills.setAppid(order.getAppId());
 		bills.setCost(order.getMoney());
 		bills.setOpenid(order.getOpenId());
@@ -173,6 +173,7 @@ public class Trade {
 		bills.setTitle(order.getBillsTitle());
 		bills.setPayId(order.getLoginUser().getId());
 		bills.setReceiveId(order.getShopId());
+		bills.setMallId(order.getMallId());
 		return bills;
 	}
 

+ 3 - 1
src/main/java/org/springblade/payment/handle/entity/Order.java

@@ -17,6 +17,8 @@ import java.time.LocalDateTime;
 @Data
 @Builder
 public class Order {
+	//商场id
+	private Long mallId;
 	//商店ID
 	private Long shopId;
 	//付款用户
@@ -27,7 +29,7 @@ public class Order {
 	private String billsTitle;
 	//过期时间
 	private LocalDateTime expireTime;
-	//appid
+	//appId
 	private String appId;
 	//用户openid
 	private String openId;