|
|
|
@@ -0,0 +1,134 @@ |
|
|
|
package com.iformall.controller.basic; |
|
|
|
|
|
|
|
import com.iformall.annotation.SystemControllerLog; |
|
|
|
import com.iformall.common.Result; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.controller.base.BaseController; |
|
|
|
import com.iformall.domain.po.WxCouponOrder; |
|
|
|
import com.iformall.domain.po.WxCreditHistory; |
|
|
|
import com.iformall.domain.vo.WxCardSpendVo; |
|
|
|
import com.iformall.enums.EnumCouponType; |
|
|
|
import com.iformall.service.*; |
|
|
|
import io.swagger.annotations.ApiImplicitParam; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
/** |
|
|
|
* @author gongbiao |
|
|
|
*/ |
|
|
|
@RestController |
|
|
|
@RequestMapping("map") |
|
|
|
public class WxMapController extends BaseController { |
|
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass()); |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxShopService wxShopService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxMerchantService wxMerchantService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxRentContractService wxRentContractService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxCouponOrderService wxCouponOrderService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxCardSpendService wxCardSpendService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxBusinessCircleOrderService wxBusinessCircleOrderService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private AliBusinessCircleOrderService aliBusinessCircleOrderService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxCreditHistoryService wxCreditHistoryService; |
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("根据id查询接口") |
|
|
|
@GetMapping("/findShopById") |
|
|
|
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) |
|
|
|
@SystemControllerLog(description = "店铺管理-id查询") |
|
|
|
public ResultData findShopById(Long id) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxMapController::findShopById"); |
|
|
|
return new ResultData(Result.SUCCESS, "查询成功", wxShopService.detailById(id)); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("根据id查询接口") |
|
|
|
@GetMapping("/findMerchantByShop") |
|
|
|
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) |
|
|
|
@SystemControllerLog(description = "店铺管理-id查询") |
|
|
|
public ResultData findMerchantByShop(Long shopId) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxMapController::findMerchantByShop"); |
|
|
|
return new ResultData(Result.SUCCESS, "查询成功", wxMerchantService.findMerchantByShop(shopId)); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("根据id查询接口") |
|
|
|
@GetMapping("/findRentByShop") |
|
|
|
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) |
|
|
|
@SystemControllerLog(description = "店铺管理-id查询") |
|
|
|
public ResultData findRentByShop(Long shopId) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxMapController::findRentByShop"); |
|
|
|
return new ResultData(Result.SUCCESS, "查询成功", wxRentContractService.findRentByShop(shopId)); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("根据id查询接口") |
|
|
|
@GetMapping("/findStatisticsByShop") |
|
|
|
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) |
|
|
|
@SystemControllerLog(description = "店铺管理-id查询") |
|
|
|
public ResultData findStatisticsByShop(Long shopId, Date startDate, Date endDate) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxMapController::findStatisticsByShop"); |
|
|
|
Map<String, Object> resultMap = new HashMap<>(); |
|
|
|
Map<String, Object> merchantByShop = wxMerchantService.findMerchantByShop(shopId); |
|
|
|
if(merchantByShop != null && merchantByShop.get("id") != null){ |
|
|
|
String tenantId = merchantByShop.get("tenantId").toString(); |
|
|
|
String parentTenantId = ""; |
|
|
|
if(merchantByShop.get("parentTenantId") != null){ |
|
|
|
parentTenantId = merchantByShop.get("parentTenantId").toString(); |
|
|
|
} |
|
|
|
|
|
|
|
Long mercherId = Long.parseLong(merchantByShop.get("id").toString()); |
|
|
|
wxCouponOrderService.statisticsWriteOff(tenantId,mercherId,startDate,endDate,resultMap); |
|
|
|
|
|
|
|
WxCardSpendVo wxCardSpend = new WxCardSpendVo(); |
|
|
|
wxCardSpend.setTenantId(tenantId); |
|
|
|
wxCardSpend.setMerchantId(mercherId); |
|
|
|
wxCardSpend.setStartdate(startDate); |
|
|
|
wxCardSpend.setEnddate(endDate); |
|
|
|
resultMap.put("sumRealPayment",wxCardSpendService.sumRealPayment(wxCardSpend)); |
|
|
|
|
|
|
|
Integer wxCircleSumPayment = wxBusinessCircleOrderService.sumCirclePayment(tenantId,mercherId,startDate,endDate); |
|
|
|
Integer aliCircleSumPayment = aliBusinessCircleOrderService.sumCirclePayment(tenantId,mercherId,startDate,endDate); |
|
|
|
resultMap.put("sumCirclePayment",wxCircleSumPayment + aliCircleSumPayment); |
|
|
|
|
|
|
|
WxCouponOrder wxCouponOrder = new WxCouponOrder(); |
|
|
|
wxCouponOrder.setTenantId(tenantId); |
|
|
|
wxCouponOrder.setSendMerchantId(mercherId); |
|
|
|
wxCouponOrder.setStartTime(startDate); |
|
|
|
wxCouponOrder.setEndTime(endDate); |
|
|
|
wxCouponOrder.setCouponType(EnumCouponType.COUPON_TINGCHE.getCode()); |
|
|
|
resultMap.put("countTingche",wxCouponOrderService.findCount(wxCouponOrder)); |
|
|
|
|
|
|
|
WxCreditHistory wxCreditHistory = new WxCreditHistory(); |
|
|
|
wxCreditHistory.setTenantId(tenantId); |
|
|
|
if(StringUtils.isNotBlank(parentTenantId)){ |
|
|
|
wxCreditHistory.setTenantId(parentTenantId); |
|
|
|
} |
|
|
|
wxCreditHistory.setMerchantId(mercherId); |
|
|
|
wxCreditHistory.setStartTime(startDate); |
|
|
|
wxCreditHistory.setEndTime(endDate); |
|
|
|
resultMap.put("sumCreditAmount",wxCreditHistoryService.getIncrementCreditAmount(wxCreditHistory)); |
|
|
|
} |
|
|
|
return new ResultData(Result.SUCCESS, "查询成功", resultMap); |
|
|
|
} |
|
|
|
|
|
|
|
} |