diff --git a/suimangAdmin/src/main/java/com/iformall/controller/basic/WxMapController.java b/suimangAdmin/src/main/java/com/iformall/controller/basic/WxMapController.java deleted file mode 100644 index 9b3755d..0000000 --- a/suimangAdmin/src/main/java/com/iformall/controller/basic/WxMapController.java +++ /dev/null @@ -1,210 +0,0 @@ -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.BusinessCircleBase; -import com.iformall.domain.po.WxCouponOrder; -import com.iformall.domain.po.WxCreditHistory; -import com.iformall.domain.vo.WxCardSpendVo; -import com.iformall.enums.EnumShopStatus; -import com.iformall.service.*; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -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 - */ -@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("/findShopBySid") - @ApiImplicitParam(name = "sid", value = "id", dataType = "Long", paramType = "query", required = true) - @SystemControllerLog(description = "店铺管理-id查询") - public ResultData findShopBySid(String sid) { - logger.debug("[" + getIpAddr() + "] WxMapController::findShopBySid"); - Map resultObject = new HashMap<>(); - Map wxShopObject = wxShopService.detailBySid(getTenantInfo(), sid); - Map wxMerchantObject = new HashMap<>(); - Map wxRentContractObject = new HashMap<>(); - if(wxShopObject != null && !wxShopObject.isEmpty() - && EnumShopStatus.RENT.getCode().toString().equals(wxShopObject.get("status").toString())){ - //已出租 - long shopId = Long.parseLong(wxShopObject.get("id").toString()); - String shopNumber = wxShopObject.get("shopNumber").toString(); - wxMerchantObject = wxMerchantService.detailByShopId(getTenantInfo(), shopId); - if(wxMerchantObject != null && !wxMerchantObject.isEmpty()){ - long merchantId = Long.parseLong(wxMerchantObject.get("id").toString()); - wxRentContractObject = wxRentContractService.currentValidByMerchantId(getTenantInfo(),merchantId,shopNumber); - } - } - resultObject.put("wxShop",wxShopObject); - resultObject.put("wxMerchant",wxMerchantObject); - resultObject.put("wxRentContract",wxRentContractObject); - return new ResultData(Result.SUCCESS, "查询成功", resultObject); - } - - @ApiOperation("根据id查询接口") - @GetMapping("/findStatisticsBySid") - @ApiImplicitParam(name = "sid", value = "sid", dataType = "Long", paramType = "query", required = true) - @SystemControllerLog(description = "店铺管理-id查询") - public ResultData findStatisticsBySid(String sid, Date startDate, Date endDate) { - logger.debug("[" + getIpAddr() + "] WxMapController::findStatisticsBySid"); - Map resultMap = new HashMap<>(); - Map wxShopObject = wxShopService.detailBySid(getTenantInfo(), sid); - if(wxShopObject != null && !wxShopObject.isEmpty() - && EnumShopStatus.RENT.getCode().toString().equals(wxShopObject.get("status").toString())){ - //已出租 - long shopId = Long.parseLong(wxShopObject.get("id").toString()); - Map wxMerchantObject = wxMerchantService.detailByShopId(getTenantInfo(), shopId); - if(wxMerchantObject != null && !wxMerchantObject.isEmpty()){ - long merchantId = Long.parseLong(wxMerchantObject.get("id").toString()); - WxCouponOrder wxCouponOrder = new WxCouponOrder(); - wxCouponOrder.updateTenantInfo(getTenantInfo()); - wxCouponOrder.setMerchantId(merchantId); - wxCouponOrder.setStartTime(startDate); - wxCouponOrder.setEndTime(endDate); - wxCouponOrderService.statisticsWriteOff(wxCouponOrder,resultMap); - - WxCardSpendVo wxCardSpend = new WxCardSpendVo(); - wxCardSpend.updateTenantInfo(getTenantInfo()); - wxCardSpend.setMerchantId(merchantId); - wxCardSpend.setStartdate(startDate); - wxCardSpend.setEnddate(endDate); - resultMap.put("sumRealPayment",wxCardSpendService.sumRealPayment(wxCardSpend)); - - BusinessCircleBase businessCircle = new BusinessCircleBase(); - businessCircle.updateTenantInfo(getTenantInfo()); - businessCircle.setMerchantId(merchantId); - businessCircle.setStartTime(startDate); - businessCircle.setEndTime(endDate); - Integer wxCircleSumPayment = wxBusinessCircleOrderService.sumCirclePayment(businessCircle); - Integer aliCircleSumPayment = aliBusinessCircleOrderService.sumCirclePayment(businessCircle); - resultMap.put("sumCirclePayment",wxCircleSumPayment + aliCircleSumPayment); - - WxCreditHistory wxCreditHistory = new WxCreditHistory(); - wxCreditHistory.setTenantId(getTenantInfo().getFinalTenantId()); - wxCreditHistory.setMerchantId(merchantId); - wxCreditHistory.setStartTime(startDate); - wxCreditHistory.setEndTime(endDate); - resultMap.put("sumCreditAmount",wxCreditHistoryService.getIncrementCreditAmount(wxCreditHistory)); - } - } - - return new ResultData(Result.SUCCESS, "查询成功", resultMap); - } - - - @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(this.getTenantInfo(),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 resultMap = new HashMap<>(); - Map merchantByShop = wxMerchantService.findMerchantByShop(shopId); - if(merchantByShop != null && merchantByShop.get("id") != null){ - String tenantId = merchantByShop.get("tenant_id").toString(); - String parentTenantId = ""; - if(merchantByShop.get("parent_tenant_id") != null){ - parentTenantId = merchantByShop.get("parent_tenant_id").toString(); - } - - Long merchantId = Long.parseLong(merchantByShop.get("id").toString()); - WxCouponOrder wxCouponOrder = new WxCouponOrder(); - wxCouponOrder.updateTenantInfo(getTenantInfo()); - wxCouponOrder.setMerchantId(merchantId); - wxCouponOrder.setStartTime(startDate); - wxCouponOrder.setEndTime(endDate); - wxCouponOrderService.statisticsWriteOff(wxCouponOrder,resultMap); - - WxCardSpendVo wxCardSpend = new WxCardSpendVo(); - wxCardSpend.updateTenantInfo(getTenantInfo()); - wxCardSpend.setMerchantId(merchantId); - wxCardSpend.setStartdate(startDate); - wxCardSpend.setEnddate(endDate); - resultMap.put("sumRealPayment",wxCardSpendService.sumRealPayment(wxCardSpend)); - - BusinessCircleBase businessCircle = new BusinessCircleBase(); - businessCircle.updateTenantInfo(getTenantInfo()); - businessCircle.setMerchantId(merchantId); - businessCircle.setStartTime(startDate); - businessCircle.setEndTime(endDate); - Integer wxCircleSumPayment = wxBusinessCircleOrderService.sumCirclePayment(businessCircle); - Integer aliCircleSumPayment = aliBusinessCircleOrderService.sumCirclePayment(businessCircle); - resultMap.put("sumCirclePayment",wxCircleSumPayment + aliCircleSumPayment); - - WxCreditHistory wxCreditHistory = new WxCreditHistory(); - wxCreditHistory.setTenantId(getTenantInfo().getFinalTenantId()); - wxCreditHistory.setMerchantId(merchantId); - wxCreditHistory.setStartTime(startDate); - wxCreditHistory.setEndTime(endDate); - resultMap.put("sumCreditAmount",wxCreditHistoryService.getIncrementCreditAmount(wxCreditHistory)); - } - return new ResultData(Result.SUCCESS, "查询成功", resultMap); - } - -} diff --git a/suimangAdmin/src/main/java/com/iformall/controller/market/AliBusinessCircleOrderController.java b/suimangAdmin/src/main/java/com/iformall/controller/market/AliBusinessCircleOrderController.java deleted file mode 100644 index cf9b22e..0000000 --- a/suimangAdmin/src/main/java/com/iformall/controller/market/AliBusinessCircleOrderController.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.iformall.controller.market; - -import com.github.pagehelper.PageInfo; -import com.iformall.annotation.SystemControllerLog; -import com.iformall.common.ErrorCode; -import com.iformall.common.ResultData; -import com.iformall.controller.base.BaseController; -import com.iformall.domain.po.AliBusinessCircleOrder; -import com.iformall.domain.po.WxBusinessCircleOrder; -import com.iformall.domain.po.base.BaseEntity; -import com.iformall.service.AliBusinessCircleOrderService; -import com.iformall.utils.Constant; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -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.GetMapping; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.HashMap; -import java.util.Map; - -@RestController -@RequestMapping("aliCircle") -@Api(description = "订单相关接口") -public class AliBusinessCircleOrderController extends BaseController { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - private AliBusinessCircleOrderService aliBusinessCircleOrderService; - - @ApiOperation("分页列表接口") - @GetMapping("list") - @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), - @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), - }) - @SystemControllerLog(description = "-列表") - public ResultData list(@ModelAttribute AliBusinessCircleOrder circleOrder, Integer pageNum, Integer pageSize) { - logger.debug("[" + getIpAddr() + "] AliBusinessCircleOrderController::list"); - if (null == circleOrder) { - circleOrder = new AliBusinessCircleOrder(); - } - circleOrder.updateTenantInfo(getTenantInfo()); - circleOrder.setSortColumns(BaseEntity.SortField.CreateTime_DESC,BaseEntity.SortField.Id_DESC); - final PageInfo page = aliBusinessCircleOrderService.listAsPage(circleOrder, pageNum, pageSize); - return new ResultData(page); - } - - @ApiOperation("统计接口") - @GetMapping("statistics") - @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), - @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), - }) - @SystemControllerLog(description = "-统计") - public ResultData statistics(@ModelAttribute AliBusinessCircleOrder circleOrder) { - logger.debug("[" + getIpAddr() + "] AliBusinessCircleOrderController::statistics"); - if (null == circleOrder) { - circleOrder = new AliBusinessCircleOrder(); - } - circleOrder.updateTenantInfo(getTenantInfo()); - Integer sumPayAmount = aliBusinessCircleOrderService.sumCirclePayment(circleOrder); - Integer sumRefundAmount = aliBusinessCircleOrderService.sumCircleRefundAmount(circleOrder); - Map resultMap = new HashMap(); - resultMap.put("sumPayAmount",sumPayAmount); - resultMap.put("sumRefundAmount",sumRefundAmount); - return new ResultData(resultMap); - } - - @ApiOperation("详情接口") - @GetMapping("detail") - @ApiImplicitParams({ - @ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true) - }) - public ResultData detail(String orderId) { - if (StringUtils.isBlank(orderId) || orderId.equalsIgnoreCase(Constant.UNDEFINED)) { - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); - } - Long id; - try { - id = Long.valueOf(orderId); - } catch (NumberFormatException e) { - logger.error(e.getMessage()); - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "orderId: " + orderId + ", e: " + e.getMessage()); - } - - AliBusinessCircleOrder order = aliBusinessCircleOrderService.detail(id,getTenantInfo()); - return new ResultData(order); - } - - @GetMapping("exportData") - @SystemControllerLog(description = "券订单数据-导出数据") - public void exportData(@ModelAttribute AliBusinessCircleOrder circleOrder, HttpServletRequest request, HttpServletResponse response) { - logger.debug("[" + getIpAddr() + "] AliBusinessCircleOrderController::exportData"); - if (null == circleOrder) { - circleOrder = new AliBusinessCircleOrder(); - } - circleOrder.updateTenantInfo(getTenantInfo()); - circleOrder.setSortColumns(BaseEntity.SortField.CreateTime_DESC,BaseEntity.SortField.Id_DESC); - aliBusinessCircleOrderService.exportData(circleOrder, request, response); - } - - -} diff --git a/suimangAdmin/src/main/java/com/iformall/controller/market/WxBusinessCircleOrderController.java b/suimangAdmin/src/main/java/com/iformall/controller/market/WxBusinessCircleOrderController.java deleted file mode 100644 index 6e2f385..0000000 --- a/suimangAdmin/src/main/java/com/iformall/controller/market/WxBusinessCircleOrderController.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.iformall.controller.market; - -import com.github.pagehelper.PageInfo; -import com.iformall.annotation.SystemControllerLog; -import com.iformall.common.ErrorCode; -import com.iformall.common.ResultData; -import com.iformall.controller.base.BaseController; -import com.iformall.domain.po.*; -import com.iformall.domain.po.base.BaseEntity; -import com.iformall.service.*; -import com.iformall.utils.Constant; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -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 javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.HashMap; -import java.util.Map; - -@RestController -@RequestMapping("wxCircle") -@Api(description = "订单相关接口") -public class WxBusinessCircleOrderController extends BaseController { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - private WxBusinessCircleOrderService wxBusinessCircleOrderService; - - @ApiOperation("分页列表接口") - @GetMapping("list") - @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), - @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), - }) - @SystemControllerLog(description = "-列表") - public ResultData list(@ModelAttribute WxBusinessCircleOrder circleOrder, Integer pageNum, Integer pageSize) { - logger.debug("[" + getIpAddr() + "] WxBusinessCircleOrderController::list"); - if (null == circleOrder) { - circleOrder = new WxBusinessCircleOrder(); - } - circleOrder.updateTenantInfo(getTenantInfo()); - circleOrder.setSortColumns(BaseEntity.SortField.CreateTime_DESC,BaseEntity.SortField.Id_DESC); - final PageInfo page = wxBusinessCircleOrderService.listAsPage(circleOrder, pageNum, pageSize); - return new ResultData(page); - } - - @ApiOperation("统计接口") - @GetMapping("statistics") - @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), - @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), - }) - @SystemControllerLog(description = "-统计") - public ResultData statistics(@ModelAttribute WxBusinessCircleOrder circleOrder) { - logger.debug("[" + getIpAddr() + "] AliBusinessCircleOrderController::statistics"); - if (null == circleOrder) { - circleOrder = new WxBusinessCircleOrder(); - } - circleOrder.updateTenantInfo(getTenantInfo()); - Integer sumPayAmount = wxBusinessCircleOrderService.sumCirclePayment(circleOrder); - Integer sumRefundAmount = wxBusinessCircleOrderService.sumCircleRefundAmount(circleOrder); - Map resultMap = new HashMap(); - resultMap.put("sumPayAmount",sumPayAmount); - resultMap.put("sumRefundAmount",sumRefundAmount); - return new ResultData(resultMap); - } - - @ApiOperation("详情接口") - @GetMapping("detail") - @ApiImplicitParams({ - @ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true) - }) - public ResultData detail(String orderId) { - if (StringUtils.isBlank(orderId) || orderId.equalsIgnoreCase(Constant.UNDEFINED)) { - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); - } - Long id; - try { - id = Long.valueOf(orderId); - } catch (NumberFormatException e) { - logger.error(e.getMessage()); - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "orderId: " + orderId + ", e: " + e.getMessage()); - } - - WxBusinessCircleOrder order = wxBusinessCircleOrderService.detail(id,getTenantInfo()); - return new ResultData(order); - } - - @GetMapping("exportData") - @SystemControllerLog(description = "券订单数据-导出数据") - public void exportData(@ModelAttribute WxBusinessCircleOrder circleOrder, HttpServletRequest request, HttpServletResponse response) { - logger.debug("[" + getIpAddr() + "] WxBusinessCircleOrderController::exportData"); - if (null == circleOrder) { - circleOrder = new WxBusinessCircleOrder(); - } - circleOrder.updateTenantInfo(getTenantInfo()); - circleOrder.setSortColumns(BaseEntity.SortField.CreateTime_DESC,BaseEntity.SortField.Id_DESC); - wxBusinessCircleOrderService.exportData(circleOrder, request, response); - } - - -} diff --git a/suimangAdmin/src/main/java/com/iformall/controller/market/WxPressBatchController.java b/suimangAdmin/src/main/java/com/iformall/controller/market/WxPressBatchController.java index 2a5331c..715fd0f 100644 --- a/suimangAdmin/src/main/java/com/iformall/controller/market/WxPressBatchController.java +++ b/suimangAdmin/src/main/java/com/iformall/controller/market/WxPressBatchController.java @@ -6,8 +6,6 @@ import com.iformall.common.ErrorCode; import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.controller.base.BaseController; -import com.iformall.domain.po.AliBusinessCircleOrder; -import com.iformall.domain.po.WxBusinessCircleOrder; import com.iformall.domain.po.WxCoupon; import com.iformall.domain.po.WxCouponChannel; import com.iformall.domain.po.WxPressBatch; @@ -19,8 +17,6 @@ import com.iformall.enums.EnumCouponChannelType; import com.iformall.enums.EnumCouponContentType; import com.iformall.enums.EnumCouponSourceType; import com.iformall.enums.EnumCouponType; -import com.iformall.enums.EnumRentContractAppStatus; -import com.iformall.service.AliBusinessCircleOrderService; import com.iformall.service.WxCouponChannelService; import com.iformall.service.WxCouponService; import com.iformall.service.WxPressBatchService; diff --git a/suimangAdmin/src/main/java/com/iformall/controller/market/WxThirdPartyOrdersController.java b/suimangAdmin/src/main/java/com/iformall/controller/market/WxThirdPartyOrdersController.java deleted file mode 100644 index d13a179..0000000 --- a/suimangAdmin/src/main/java/com/iformall/controller/market/WxThirdPartyOrdersController.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.iformall.controller.market; - -import com.github.pagehelper.PageInfo; -import com.iformall.annotation.SystemControllerLog; -import com.iformall.common.ErrorCode; -import com.iformall.common.ResultData; -import com.iformall.controller.base.BaseController; -import com.iformall.domain.po.WxThirdPartyOrders; -import com.iformall.domain.po.base.BaseEntity; -import com.iformall.enums.EnumThirdOrderType; -import com.iformall.service.WxThirdPartyOrdersService; -import com.iformall.utils.Constant; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -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.GetMapping; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.HashMap; -import java.util.Map; - -@RestController -@RequestMapping("thirdCircle") -@Api(description = "订单相关接口") -public class WxThirdPartyOrdersController extends BaseController { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - private WxThirdPartyOrdersService wxThirdPartyOrdersOrderService; - - @ApiOperation("分页列表接口") - @GetMapping("list") - @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), - @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), - }) - @SystemControllerLog(description = "-列表") - public ResultData list(@ModelAttribute WxThirdPartyOrders circleOrder, Integer pageNum, Integer pageSize) { - logger.debug("[" + getIpAddr() + "] WxThirdPartyOrdersController::list"); - if (null == circleOrder) { - circleOrder = new WxThirdPartyOrders(); - } - circleOrder.updateTenantInfo(getTenantInfo()); - circleOrder.setSortColumns(BaseEntity.SortField.CreateTime_DESC,BaseEntity.SortField.Id_DESC); - final PageInfo page = wxThirdPartyOrdersOrderService.listAsPage(circleOrder, pageNum, pageSize); - return new ResultData(page); - } - - @ApiOperation("统计接口") - @GetMapping("statistics") - @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), - @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), - }) - @SystemControllerLog(description = "-统计") - public ResultData statistics(@ModelAttribute WxThirdPartyOrders circleOrder) { - logger.debug("[" + getIpAddr() + "] AliBusinessCircleOrderController::statistics"); - if (null == circleOrder) { - circleOrder = new WxThirdPartyOrders(); - } - circleOrder.updateTenantInfo(getTenantInfo()); - Integer sumPayAmount = wxThirdPartyOrdersOrderService.sumCirclePayment(circleOrder); - Integer sumRefundAmount = wxThirdPartyOrdersOrderService.sumCircleRefundAmount(circleOrder); - Map resultMap = new HashMap(); - resultMap.put("sumPayAmount",sumPayAmount); - resultMap.put("sumRefundAmount",sumRefundAmount); - return new ResultData(resultMap); - } - - @ApiOperation("详情接口") - @GetMapping("detail") - @ApiImplicitParams({ - @ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true) - }) - public ResultData detail(String orderId) { - if (StringUtils.isBlank(orderId) || orderId.equalsIgnoreCase(Constant.UNDEFINED)) { - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); - } - Long id; - try { - id = Long.valueOf(orderId); - } catch (NumberFormatException e) { - logger.error(e.getMessage()); - return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "orderId: " + orderId + ", e: " + e.getMessage()); - } - - WxThirdPartyOrders order = wxThirdPartyOrdersOrderService.detail(id,getTenantInfo()); - return new ResultData(order); - } - - @GetMapping("exportData") - @SystemControllerLog(description = "券订单数据-导出数据") - public void exportData(@ModelAttribute WxThirdPartyOrders circleOrder, HttpServletRequest request, HttpServletResponse response) { - logger.debug("[" + getIpAddr() + "] WxThirdPartyOrdersController::exportData"); - if (null == circleOrder) { - circleOrder = new WxThirdPartyOrders(); - } - circleOrder.updateTenantInfo(getTenantInfo()); - circleOrder.setSortColumns(BaseEntity.SortField.CreateTime_DESC,BaseEntity.SortField.Id_DESC); - circleOrder.setSourceType(EnumThirdOrderType.RMB_PAY.getCode()); - wxThirdPartyOrdersOrderService.exportData(circleOrder, request, response); - } - - @GetMapping("exportDataVo") - @SystemControllerLog(description = "券订单数据-导出数据") - public void exportDataVo(@ModelAttribute WxThirdPartyOrders circleOrder, HttpServletRequest request, HttpServletResponse response) { - logger.debug("[" + getIpAddr() + "] WxThirdPartyOrdersController::exportDataVo"); - if (null == circleOrder) { - circleOrder = new WxThirdPartyOrders(); - } - circleOrder.updateTenantInfo(getTenantInfo()); - circleOrder.setSortColumns(BaseEntity.SortField.CreateTime_DESC,BaseEntity.SortField.Id_DESC); - circleOrder.setSourceType(EnumThirdOrderType.CREDIT_PAY.getCode()); - wxThirdPartyOrdersOrderService.exportDataVo(circleOrder, request, response); - } - -} diff --git a/suimangService/src/main/java/com/iformall/config/BaseMyBatisConfiguration.java b/suimangService/src/main/java/com/iformall/config/BaseMyBatisConfiguration.java index fbae1c5..7a26f7c 100644 --- a/suimangService/src/main/java/com/iformall/config/BaseMyBatisConfiguration.java +++ b/suimangService/src/main/java/com/iformall/config/BaseMyBatisConfiguration.java @@ -138,27 +138,6 @@ public class BaseMyBatisConfiguration { wxCUserFromSharding.setRule(EnumShardingRule.HASH.getCode()); shardingList.add(wxCUserFromSharding); - ShardingSphere wxBusinessCircleOrderSharding = new ShardingSphere(); - wxBusinessCircleOrderSharding.setColumn("tenant_id"); - wxBusinessCircleOrderSharding.setTableName("wx_business_circle_order"); - wxBusinessCircleOrderSharding.setCount(100); - wxBusinessCircleOrderSharding.setRule(EnumShardingRule.HASH.getCode()); - shardingList.add(wxBusinessCircleOrderSharding); - - ShardingSphere aliBusinessCircleOrderSharding = new ShardingSphere(); - aliBusinessCircleOrderSharding.setColumn("tenant_id"); - aliBusinessCircleOrderSharding.setTableName("ali_business_circle_order"); - aliBusinessCircleOrderSharding.setCount(100); - aliBusinessCircleOrderSharding.setRule(EnumShardingRule.HASH.getCode()); - shardingList.add(aliBusinessCircleOrderSharding); - - ShardingSphere wxThirdPartyOrdersSharding = new ShardingSphere(); - wxThirdPartyOrdersSharding.setColumn("tenant_id"); - wxThirdPartyOrdersSharding.setTableName("wx_third_party_orders"); - wxThirdPartyOrdersSharding.setCount(100); - wxThirdPartyOrdersSharding.setRule(EnumShardingRule.HASH.getCode()); - shardingList.add(wxThirdPartyOrdersSharding); - ShardingSphere wxOrderSharding = new ShardingSphere(); wxOrderSharding.setColumn("tenant_id"); wxOrderSharding.setTableName("wx_order"); diff --git a/suimangService/src/main/java/com/iformall/domain/po/AliBusinessCircleOrder.java b/suimangService/src/main/java/com/iformall/domain/po/AliBusinessCircleOrder.java deleted file mode 100644 index d67086f..0000000 --- a/suimangService/src/main/java/com/iformall/domain/po/AliBusinessCircleOrder.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.iformall.domain.po; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -@TableName(value = "ali_business_circle_order") -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -public class AliBusinessCircleOrder extends BusinessCircleBase { - - @io.swagger.annotations.ApiModelProperty(value="发生交易的商圈(非商圈组)的商圈唯一标识号",name="mallId") - private String mallId; - - @io.swagger.annotations.ApiModelProperty(value="发生交易的商圈(非商圈组)的名称",name="mallName") - private String mallName; - - @Excel(name = "门店编码", width = 20, orderNum = "1") - @io.swagger.annotations.ApiModelProperty(value="门店编号,商户侧系统内编号",name="mallStoreId") - private String mallStoreId; - - @io.swagger.annotations.ApiModelProperty(value="支付宝用户Id",name="buyerId") - private String buyerId; - -} diff --git a/suimangService/src/main/java/com/iformall/domain/po/BusinessCircleBase.java b/suimangService/src/main/java/com/iformall/domain/po/BusinessCircleBase.java deleted file mode 100644 index a0f3efe..0000000 --- a/suimangService/src/main/java/com/iformall/domain/po/BusinessCircleBase.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.iformall.domain.po; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.iformall.domain.po.base.TenantEntity; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -import java.math.BigDecimal; -import java.util.Date; - -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -public class BusinessCircleBase extends TenantEntity { - - protected Long id; - - @io.swagger.annotations.ApiModelProperty(value="商圈支付结果通知Id",name="noticeId") - private String noticeId; - - @io.swagger.annotations.ApiModelProperty(value="商圈支付结果通知创建时间",name="noticeCreateTime") - private Date noticeCreateTime; - - @io.swagger.annotations.ApiModelProperty(value="商圈支付结果通知类型:MALL_TRANSACTION.SUCCESS",name="noticeEventType") - private String noticeEventType; - - @Excel(name = "通知时间", width = 20, orderNum = "12") - @io.swagger.annotations.ApiModelProperty(value="商圈支付结果通知回调摘要",name="summary") - private String summary; - - @Excel(name = "交易时间", width = 20, orderNum = "4", format = "yyyy-MM-dd HH:mm:ss") - @io.swagger.annotations.ApiModelProperty(value="交易完成时间",name="timeEnd") - private Date timeEnd; - - @io.swagger.annotations.ApiModelProperty(value="用户实际消费金额,单位(分)",name="amount") - private Integer amount; - - @TableField(exist = false) - @io.swagger.annotations.ApiModelProperty(value="用户实际消费金额,单位(元)",name="amountStr") - private String amountStr; - - public String getAmountStr() { - return amount != null ? new BigDecimal(amount).divide(new BigDecimal(100)).toPlainString(): amountStr; - } - - @io.swagger.annotations.ApiModelProperty(value="用户实际付款金额,单位(分)",name="payAmount") - private Integer payAmount; - - @Excel(name = "付款金额(元)", width = 20, orderNum = "5") - @TableField(exist = false) - @io.swagger.annotations.ApiModelProperty(value="用户实际付款金额,单位(元)",name="payAmountStr") - private String payAmountStr; - - public String getPayAmountStr() { - return payAmount != null ? new BigDecimal(payAmount).divide(new BigDecimal(100)).toPlainString(): payAmountStr; - } - - @Excel(name = "支付订单号", width = 20, orderNum = "3") - @io.swagger.annotations.ApiModelProperty(value="支付订单号",name="transactionId") - private String transactionId; - - @Excel(name = "通知时间", width = 20, orderNum = "11", format = "yyyy-MM-dd HH:mm:ss") - @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") - private Date createTime; - - @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateTime") - private Date updateTime; - - @io.swagger.annotations.ApiModelProperty(value="门店Id,与第三方对齐",name="merchantId") - private Long merchantId; - @Excel(name = "门店名称", width = 20, orderNum = "2") - private String merchantName; - @TableField(exist = false) - private WxMerchant merchant; - - @Excel(name = "会员ID", width = 20, orderNum = "9") - @TableField(exist = false) - private String userIdStr; - public String getUserIdStr(){ - return cUserId == null?"":Long.toString(cUserId); - } - @io.swagger.annotations.ApiModelProperty(value="c端会员id,与第三方对齐",name="cUserId") - private Long cUserId; - private String cUserNickName; - @Excel(name = "会员手机号", width = 20, orderNum = "10") - @TableField(exist = false) - private String userPhoneStr; - public String getUserPhoneStr(){ - return cUserPhone; - } - private String cUserPhone; - @TableField(exist = false) - private WxCUserBasicInfo basicInfo; - - @Excel(name = "积分是否变动", width = 20, orderNum = "13", replace = {"是_1", "否_0"}) - @io.swagger.annotations.ApiModelProperty(value="是否获得积分(1:是,0:否)",name="earnPoints") - private Integer earnPoints; - - @Excel(name = "积分变动值", width = 20, orderNum = "14") - @io.swagger.annotations.ApiModelProperty(value="订单更新积分值",name="increasedPoints") - private Integer increasedPoints; - - @Excel(name = "积分更新时间", width = 20, orderNum = "15", format = "yyyy-MM-dd HH:mm:ss") - @io.swagger.annotations.ApiModelProperty(value="积分更新时间(新增)",name="pointsUpdateTime") - private Date pointsUpdateTime; - - @Excel(name = "是否退款", width = 20, orderNum = "6", replace = {"退款订单_1", "付款订单_0"}) - @io.swagger.annotations.ApiModelProperty(value="是否退款(1:是,0:否)",name="isRefund") - private Integer isRefund; - - @io.swagger.annotations.ApiModelProperty(value="正常订单状态(is_refund=0时)1:部分退款2:订单关闭",name="orderStatus") - private Integer orderStatus; - - @Excel(name = "退款订单号", width = 20, orderNum = "7") - @io.swagger.annotations.ApiModelProperty(value="微信支付退款单号",name="refundId") - private String refundId; - - @TableField(exist = false) - @io.swagger.annotations.ApiModelProperty(value="查询-开始时间",name="startdate") - private Date startTime; - - @TableField(exist = false) - @io.swagger.annotations.ApiModelProperty(value="查询-结束时间",name="enddate") - private Date endTime; - - @io.swagger.annotations.ApiModelProperty(value="用户退款金额,单位(分)",name="refundAmount") - private Integer refundAmount; - - @Excel(name = "退款金额(元)", width = 20, orderNum = "8") - @TableField(exist = false) - @io.swagger.annotations.ApiModelProperty(value="用户退款金额,单位(元)",name="refundAmountStr") - private String refundAmountStr; - - public String getRefundAmountStr() { - return refundAmount != null ? new BigDecimal(refundAmount).divide(new BigDecimal(100)).toPlainString(): refundAmountStr; - } - -} diff --git a/suimangService/src/main/java/com/iformall/domain/po/WxBusinessCircleOrder.java b/suimangService/src/main/java/com/iformall/domain/po/WxBusinessCircleOrder.java deleted file mode 100644 index 7139a91..0000000 --- a/suimangService/src/main/java/com/iformall/domain/po/WxBusinessCircleOrder.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.iformall.domain.po; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -@TableName(value = "wx_business_circle_order") -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -public class WxBusinessCircleOrder extends BusinessCircleBase { - - @io.swagger.annotations.ApiModelProperty(value="微信支付分配的商户号",name="wxMchid") - private String wxMchid; - - @io.swagger.annotations.ApiModelProperty(value="商圈商户名称",name="wxMerchantName") - private String wxMerchantName; - - @io.swagger.annotations.ApiModelProperty(value="门店名称,商圈在商圈小程序上圈店时填写的门店名称",name="wxShopName") - private String wxShopName; - - @Excel(name = "门店编码", width = 20, orderNum = "1") - @io.swagger.annotations.ApiModelProperty(value="门店编号,商圈在商圈小程序上圈店时填写的门店编号,用于跟商圈自身已有的商户识别码对齐",name="wxShopNumber") - private String wxShopNumber; - - @io.swagger.annotations.ApiModelProperty(value="小程序appid",name="appid") - private String appid; - - @io.swagger.annotations.ApiModelProperty(value="openid",name="openid") - private String openid; - - @io.swagger.annotations.ApiModelProperty(value="手动提交积分标记,自动提交时无该字段,用于区分用户手动申请后推送的积分",name="commitTag") - private String commitTag; - - @io.swagger.annotations.ApiModelProperty(value="是否积分同步(1:是,0:否)",name="isPointsNotify") - private Integer isPointsNotify; - -} diff --git a/suimangService/src/main/java/com/iformall/domain/po/WxThirdPartyOrders.java b/suimangService/src/main/java/com/iformall/domain/po/WxThirdPartyOrders.java deleted file mode 100644 index 500da03..0000000 --- a/suimangService/src/main/java/com/iformall/domain/po/WxThirdPartyOrders.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.iformall.domain.po; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - - -@TableName(value = "wx_third_party_orders") -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -public class WxThirdPartyOrders extends BusinessCircleBase { - - @io.swagger.annotations.ApiModelProperty(value="来源(wx_third_party_api)",name="sourceAppId") - private String sourceAppId; - @TableField(exist = false) - @io.swagger.annotations.ApiModelProperty(value="来源(wx_third_party_api)",name="sourceAppName") - private String sourceAppName; - - @io.swagger.annotations.ApiModelProperty(value="1:RMB订单;2:积分订单",name="sourceType") - private Integer sourceType; - - @io.swagger.annotations.ApiModelProperty(value="门店名称",name="shopName") - private String shopName; - - @Excel(name = "门店编码", width = 20, orderNum = "1") - @io.swagger.annotations.ApiModelProperty(value="门店编号",name="shopNumber") - private String shopNumber; - - @io.swagger.annotations.ApiModelProperty(value="顾客手机号",name="userPhone") - private String userPhone; - - @io.swagger.annotations.ApiModelProperty(value="顾客编号",name="userNumber") - private String userNumber; - -} diff --git a/suimangService/src/main/java/com/iformall/domain/po/msg/AfterBusinessCreditMsg.java b/suimangService/src/main/java/com/iformall/domain/po/msg/AfterBusinessCreditMsg.java deleted file mode 100644 index 0e2bbd0..0000000 --- a/suimangService/src/main/java/com/iformall/domain/po/msg/AfterBusinessCreditMsg.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.iformall.domain.po.msg; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -/** - * - */ -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -public class AfterBusinessCreditMsg extends BaseMsg { - - private static final long serialVersionUID = -1l; - - @io.swagger.annotations.ApiModelProperty(value="商圈订单ID",name="businessCircleOrderId") - private Long businessCircleOrderId; - -} diff --git a/suimangService/src/main/java/com/iformall/domain/po/msg/FmInsideThirdPartyOrdersMsg.java b/suimangService/src/main/java/com/iformall/domain/po/msg/FmInsideThirdPartyOrdersMsg.java deleted file mode 100644 index 8cd7b85..0000000 --- a/suimangService/src/main/java/com/iformall/domain/po/msg/FmInsideThirdPartyOrdersMsg.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.iformall.domain.po.msg; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -public class FmInsideThirdPartyOrdersMsg extends BaseMsg{ - private static final long serialVersionUID = 1L; - - @io.swagger.annotations.ApiModelProperty(value="第三方交易状态",name="eventType") - private String eventType; - - @io.swagger.annotations.ApiModelProperty(value="商圈订单Id",name="businessCircleOrderId") - private Long businessCircleOrderId; - - @io.swagger.annotations.ApiModelProperty(value="门店Id",name="merchantId") - private Long merchantId; - - @io.swagger.annotations.ApiModelProperty(value="c端会员id",name="cUserId") - private Long cUserId; - - @io.swagger.annotations.ApiModelProperty(value="门店名称,商圈在商圈小程序上圈店时填写的门店名称",name="wxShopName") - private String wxShopName; - - @io.swagger.annotations.ApiModelProperty(value="用户实际消费金额,单位(分)",name="amount") - private Integer amount; - - -} diff --git a/suimangService/src/main/java/com/iformall/domain/vo/WxThirdPartyOrdersVo.java b/suimangService/src/main/java/com/iformall/domain/vo/WxThirdPartyOrdersVo.java deleted file mode 100644 index 87bc111..0000000 --- a/suimangService/src/main/java/com/iformall/domain/vo/WxThirdPartyOrdersVo.java +++ /dev/null @@ -1,162 +0,0 @@ -package com.iformall.domain.vo; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.iformall.domain.po.BusinessCircleBase; -import com.iformall.domain.po.WxCUserBasicInfo; -import com.iformall.domain.po.WxMerchant; -import com.iformall.domain.po.base.TenantEntity; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -import java.math.BigDecimal; -import java.util.Date; - - -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = true) -public class WxThirdPartyOrdersVo extends TenantEntity { - - protected Long id; - - @io.swagger.annotations.ApiModelProperty(value="商圈支付结果通知Id",name="noticeId") - private String noticeId; - - @io.swagger.annotations.ApiModelProperty(value="商圈支付结果通知创建时间",name="noticeCreateTime") - private Date noticeCreateTime; - - @io.swagger.annotations.ApiModelProperty(value="商圈支付结果通知类型:MALL_TRANSACTION.SUCCESS",name="noticeEventType") - private String noticeEventType; - - @Excel(name = "摘要", width = 20, orderNum = "10") - @io.swagger.annotations.ApiModelProperty(value="商圈支付结果通知回调摘要",name="summary") - private String summary; - - @Excel(name = "抵扣/退款时间", width = 20, orderNum = "6", format = "yyyy-MM-dd HH:mm:ss") - @io.swagger.annotations.ApiModelProperty(value="交易完成时间",name="timeEnd") - private Date timeEnd; - - @io.swagger.annotations.ApiModelProperty(value="用户实际消费金额,单位(分)",name="amount") - private Integer amount; - - @TableField(exist = false) - @io.swagger.annotations.ApiModelProperty(value="用户实际消费金额,单位(元)",name="amountStr") - private String amountStr; - - public String getAmountStr() { - return amount != null ? new BigDecimal(amount).divide(new BigDecimal(100)).toPlainString(): amountStr; - } - - @Excel(name = "积分数量", width = 20, orderNum = "7") - @io.swagger.annotations.ApiModelProperty(value="用户实际付款金额,单位(分)",name="payAmount") - private Integer payAmount; - - @TableField(exist = false) - @io.swagger.annotations.ApiModelProperty(value="用户实际付款金额,单位(元)",name="payAmountStr") - private String payAmountStr; - - public String getPayAmountStr() { - return payAmount != null ? new BigDecimal(payAmount).divide(new BigDecimal(100)).toPlainString(): payAmountStr; - } - - @Excel(name = "付款订单编号", width = 20, orderNum = "3") - @io.swagger.annotations.ApiModelProperty(value="支付订单号",name="transactionId") - private String transactionId; - - @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") - private Date createTime; - - @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateTime") - private Date updateTime; - - @io.swagger.annotations.ApiModelProperty(value="门店Id,与第三方对齐",name="merchantId") - private Long merchantId; - @Excel(name = "门店名称", width = 20, orderNum = "2") - private String merchantName; - @TableField(exist = false) - private WxMerchant merchant; - - @Excel(name = "会员ID", width = 20, orderNum = "8") - @TableField(exist = false) - private String userIdStr; - public String getUserIdStr(){ - return cUserId == null?"":Long.toString(cUserId); - } - @io.swagger.annotations.ApiModelProperty(value="c端会员id,与第三方对齐",name="cUserId") - private Long cUserId; - private String cUserNickName; - @Excel(name = "会员手机号", width = 20, orderNum = "9") - @TableField(exist = false) - private String userPhoneStr; - public String getUserPhoneStr(){ - return cUserPhone; - } - private String cUserPhone; - @TableField(exist = false) - private WxCUserBasicInfo basicInfo; - - @io.swagger.annotations.ApiModelProperty(value="是否获得积分(1:是,0:否)",name="earnPoints") - private Integer earnPoints; - - @io.swagger.annotations.ApiModelProperty(value="订单更新积分值",name="increasedPoints") - private Integer increasedPoints; - - @io.swagger.annotations.ApiModelProperty(value="积分更新时间(新增)",name="increasedPoints") - private Date pointsUpdateTime; - - @Excel(name = "是否退款", width = 20, orderNum = "4", replace = {"退款订单_1", "付款订单_0"}) - @io.swagger.annotations.ApiModelProperty(value="是否退款(1:是,0:否)",name="isRefund") - private Integer isRefund; - - @io.swagger.annotations.ApiModelProperty(value="正常订单状态(is_refund=0时)1:部分退款2:订单关闭",name="orderStatus") - private Integer orderStatus; - - @Excel(name = "退款订单编号", width = 20, orderNum = "5") - @io.swagger.annotations.ApiModelProperty(value="微信支付退款单号",name="refundId") - private String refundId; - - @TableField(exist = false) - @io.swagger.annotations.ApiModelProperty(value="查询-开始时间",name="startdate") - private Date startTime; - - @TableField(exist = false) - @io.swagger.annotations.ApiModelProperty(value="查询-结束时间",name="enddate") - private Date endTime; - - @io.swagger.annotations.ApiModelProperty(value="用户退款金额,单位(分)",name="refundAmount") - private Integer refundAmount; - - @TableField(exist = false) - @io.swagger.annotations.ApiModelProperty(value="用户退款金额,单位(元)",name="refundAmountStr") - private String refundAmountStr; - - public String getRefundAmountStr() { - return refundAmount != null ? new BigDecimal(refundAmount).divide(new BigDecimal(100)).toPlainString(): refundAmountStr; - } - - @io.swagger.annotations.ApiModelProperty(value="来源(wx_third_party_api)",name="sourceAppId") - private String sourceAppId; - @TableField(exist = false) - @io.swagger.annotations.ApiModelProperty(value="来源(wx_third_party_api)",name="sourceAppName") - private String sourceAppName; - - @io.swagger.annotations.ApiModelProperty(value="1:RMB订单;2:积分订单",name="sourceType") - private Integer sourceType; - - @io.swagger.annotations.ApiModelProperty(value="门店名称",name="shopName") - private String shopName; - - @Excel(name = "门店编码", width = 20, orderNum = "1") - @io.swagger.annotations.ApiModelProperty(value="门店编号",name="shopNumber") - private String shopNumber; - - @io.swagger.annotations.ApiModelProperty(value="顾客手机号",name="userPhone") - private String userPhone; - - @io.swagger.annotations.ApiModelProperty(value="顾客编号",name="userNumber") - private String userNumber; - -} diff --git a/suimangService/src/main/java/com/iformall/enums/EnumBusinessCircleAuthorizeState.java b/suimangService/src/main/java/com/iformall/enums/EnumBusinessCircleAuthorizeState.java deleted file mode 100644 index b262c7b..0000000 --- a/suimangService/src/main/java/com/iformall/enums/EnumBusinessCircleAuthorizeState.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.iformall.enums; - -/** - * . - */ -public enum EnumBusinessCircleAuthorizeState { - - //UNAUTHORIZED:未授权 - //AUTHORIZED:已授权 - //DEAUTHORIZED:已取消授权 - UNAUTHORIZED(0, "UNAUTHORIZED"), - AUTHORIZED(1, "AUTHORIZED"), - DEAUTHORIZED(2, "DEAUTHORIZED"), - ; - - public static EnumBusinessCircleAuthorizeState getEnum(Integer code) { - for (EnumBusinessCircleAuthorizeState value : values()) { - if (value.getCode().equals(code)) { - return value; - } - } - return null; - } - public static EnumBusinessCircleAuthorizeState getEnum(String message) { - for (EnumBusinessCircleAuthorizeState value : values()) { - if (value.getMessage().equals(message)) { - return value; - } - } - return null; - } - - private Integer code; - private String message; - - EnumBusinessCircleAuthorizeState(Integer code, String message) { - this.code = code; - this.message = message; - } - - public Integer getCode() { - return code; - } - - public String getMessage() { - return message; - } -} diff --git a/suimangService/src/main/java/com/iformall/mapper/AliBusinessCircleOrderMapper.java b/suimangService/src/main/java/com/iformall/mapper/AliBusinessCircleOrderMapper.java deleted file mode 100644 index c28c106..0000000 --- a/suimangService/src/main/java/com/iformall/mapper/AliBusinessCircleOrderMapper.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.iformall.mapper; - - -import com.iformall.common.CommonMapper; -import com.iformall.domain.po.AliBusinessCircleOrder; -import com.iformall.domain.po.BusinessCircleBase; -import org.apache.ibatis.annotations.Param; - -import java.util.Date; -import java.util.List; - - -public interface AliBusinessCircleOrderMapper extends CommonMapper { - - List findList(AliBusinessCircleOrder record); - - AliBusinessCircleOrder getById(AliBusinessCircleOrder record); - - AliBusinessCircleOrder getOrderByTransactionId(AliBusinessCircleOrder record); - AliBusinessCircleOrder getRefundOrderByRefundId(AliBusinessCircleOrder record); - List getRefundOrderByTransactionId(AliBusinessCircleOrder record); - - /** - * 成功通知新建 - * @param record - */ - void insertNoticeOrder(AliBusinessCircleOrder record); - - /** - * 加积分 - * @param record - */ - void updatePoints(AliBusinessCircleOrder record); - - /** - * 退款 - * @param record - */ - void insertRefundNoticeOrder(AliBusinessCircleOrder record); - - /** - * 修改正常订单状态 - * @param record - */ - void updateOrderStatus(AliBusinessCircleOrder record); - - Integer sumCirclePayment(BusinessCircleBase record); - - Integer sumCircleRefundAmount(BusinessCircleBase circleOrder); -} diff --git a/suimangService/src/main/java/com/iformall/mapper/InviteCodeMapper.java b/suimangService/src/main/java/com/iformall/mapper/InviteCodeMapper.java index 69e6ed7..541cdb2 100644 --- a/suimangService/src/main/java/com/iformall/mapper/InviteCodeMapper.java +++ b/suimangService/src/main/java/com/iformall/mapper/InviteCodeMapper.java @@ -1,12 +1,8 @@ package com.iformall.mapper; import com.iformall.common.CommonMapper; -import com.iformall.domain.po.AliBusinessCircleOrder; import com.iformall.domain.po.sm.InviteCode; -import com.iformall.service.sm.InviteCodeService; import org.apache.ibatis.annotations.Param; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; public interface InviteCodeMapper extends CommonMapper { diff --git a/suimangService/src/main/java/com/iformall/mapper/WxBusinessCircleOrderMapper.java b/suimangService/src/main/java/com/iformall/mapper/WxBusinessCircleOrderMapper.java deleted file mode 100644 index c35fa6d..0000000 --- a/suimangService/src/main/java/com/iformall/mapper/WxBusinessCircleOrderMapper.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.iformall.mapper; - -import com.iformall.common.CommonMapper; -import com.iformall.domain.po.BusinessCircleBase; -import com.iformall.domain.po.WxBusinessCircleOrder; -import org.apache.ibatis.annotations.Param; - -import java.util.Date; -import java.util.List; - -public interface WxBusinessCircleOrderMapper extends CommonMapper { - - List findList(WxBusinessCircleOrder record); - - WxBusinessCircleOrder getById(WxBusinessCircleOrder record); - - WxBusinessCircleOrder getOrderByTransactionId(WxBusinessCircleOrder record); - WxBusinessCircleOrder getRefundOrderByRefundId(WxBusinessCircleOrder record); - List getRefundOrderByTransactionId(WxBusinessCircleOrder record); - - /** - * 成功通知新建 - * @param record - */ - void insertNoticeOrder(WxBusinessCircleOrder record); - - /** - * 加积分 - * @param record - */ - void updatePoints(WxBusinessCircleOrder record); - - /** - * 积分同步状态修改 - */ - void updateIsPointsNotify(WxBusinessCircleOrder record); - - /** - * 退款通知新建 - * @param record - */ - void insertRefundNoticeOrder(WxBusinessCircleOrder record); - - /** - * 修改正常订单状态 - * @param record - */ - void updateOrderStatus(WxBusinessCircleOrder record); - - Integer sumCirclePayment(BusinessCircleBase record); - - Integer sumCircleRefundAmount(BusinessCircleBase circleOrder); -} diff --git a/suimangService/src/main/java/com/iformall/mapper/WxThirdPartyOrdersMapper.java b/suimangService/src/main/java/com/iformall/mapper/WxThirdPartyOrdersMapper.java deleted file mode 100644 index db3d9d9..0000000 --- a/suimangService/src/main/java/com/iformall/mapper/WxThirdPartyOrdersMapper.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.iformall.mapper; - - -import com.iformall.common.CommonMapper; -import com.iformall.domain.po.BusinessCircleBase; -import com.iformall.domain.po.WxThirdPartyOrders; -import com.iformall.domain.vo.WxThirdPartyOrdersVo; - -import java.util.List; - - -public interface WxThirdPartyOrdersMapper extends CommonMapper { - - List findList(WxThirdPartyOrders record); - List findListVo(WxThirdPartyOrders circleOrder); - - WxThirdPartyOrders getById(WxThirdPartyOrders record); - - WxThirdPartyOrders getOrderByTransactionId(WxThirdPartyOrders record); - WxThirdPartyOrders getRefundOrderByRefundId(WxThirdPartyOrders record); - List getRefundOrderByTransactionId(WxThirdPartyOrders record); - - /** - * 成功通知新建 - * @param record - */ - void insertNoticeOrder(WxThirdPartyOrders record); - - /** - * 加积分 - * @param record - */ - void updatePoints(WxThirdPartyOrders record); - - /** - * 退款 - * @param record - */ - void insertRefundNoticeOrder(WxThirdPartyOrders record); - - /** - * 修改正常订单状态 - * @param record - */ - void updateOrderStatus(WxThirdPartyOrders record); - - Integer sumCirclePayment(BusinessCircleBase record); - - Integer sumCircleRefundAmount(BusinessCircleBase circleOrder); - -} diff --git a/suimangService/src/main/java/com/iformall/service/AliBusinessCircleOrderService.java b/suimangService/src/main/java/com/iformall/service/AliBusinessCircleOrderService.java deleted file mode 100644 index b52fcce..0000000 --- a/suimangService/src/main/java/com/iformall/service/AliBusinessCircleOrderService.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.iformall.service; - -import com.github.pagehelper.PageInfo; -import com.iformall.common.ResultData; -import com.iformall.domain.po.AliBusinessCircleOrder; -import com.iformall.domain.po.BusinessCircleBase; -import com.iformall.domain.po.WxMerchant; -import com.iformall.domain.po.base.TenantEntity; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.List; - -public interface AliBusinessCircleOrderService { - - - /** - * 根据实体查询分页列表 - * - * @param record - * @param pageIndex - * @param pageSize - * @return - */ - PageInfo listAsPage(AliBusinessCircleOrder record, Integer pageIndex, Integer pageSize); - - /** - * id+tenantId - * @param - * @return - */ - AliBusinessCircleOrder getById(Long id, String tenantId); - AliBusinessCircleOrder detail(Long id, TenantEntity tenantInfo); - - /** - * transactionId+tenantId - * @param - * @return - */ - AliBusinessCircleOrder getOrderByTransactionId(String transactionId, String tenantId); - AliBusinessCircleOrder getRefundOrderByRefundId(String refundId, String tenantId); - List getRefundOrderByTransactionId(String transactionId, String tenantId); - - - ResultData createOrder(WxMerchant wxMerchant, AliBusinessCircleOrder record); - - ResultData insertRefundNoticeOrder(WxMerchant wxMerchant, AliBusinessCircleOrder record); - - /** - * 积分 - * @param record - */ - void updatePoints(AliBusinessCircleOrder record); - - void exportData(AliBusinessCircleOrder circleOrder, HttpServletRequest request, HttpServletResponse response); - - Integer sumCirclePayment(BusinessCircleBase circleOrder); - - Integer sumCircleRefundAmount(BusinessCircleBase circleOrder); -} diff --git a/suimangService/src/main/java/com/iformall/service/WxBusinessCircleOrderService.java b/suimangService/src/main/java/com/iformall/service/WxBusinessCircleOrderService.java deleted file mode 100644 index cec38d6..0000000 --- a/suimangService/src/main/java/com/iformall/service/WxBusinessCircleOrderService.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.iformall.service; - -import com.github.pagehelper.PageInfo; -import com.iformall.common.ResultData; -import com.iformall.domain.po.BusinessCircleBase; -import com.iformall.domain.po.WxBusinessCircleOrder; -import com.iformall.domain.po.base.TenantEntity; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.Date; -import java.util.List; - -public interface WxBusinessCircleOrderService { - - - /** - * 根据实体查询分页列表 - * - * @param record - * @param pageIndex - * @param pageSize - * @return - */ - PageInfo listAsPage(WxBusinessCircleOrder record, Integer pageIndex, Integer pageSize); - - /** - * id+tenantId - * @param - * @return - */ - WxBusinessCircleOrder getById(Long id, String tenantId); - WxBusinessCircleOrder detail(Long id, TenantEntity tenantInfo); - - /** - * transactionId+tenantId - * @param - * @return - */ - WxBusinessCircleOrder getOrderByTransactionId(String transactionId, String tenantId); - WxBusinessCircleOrder getRefundOrderByRefundId(String refundId, String tenantId); - List getRefundOrderByTransactionId(String transactionId, String tenantId); - - ResultData createOrder(WxBusinessCircleOrder record); - - ResultData insertRefundNoticeOrder(WxBusinessCircleOrder record); - - /** - * 更新积分 - * @param record - */ - void updatePoints(WxBusinessCircleOrder record); - - /** - * 同步积分状态 - * @param record - */ - void notifyPoints(WxBusinessCircleOrder record); - - /** - * 积分同步状态修改 - */ - void updateIsPointsNotify(WxBusinessCircleOrder record); - void sendsyncNotifyPointsMsg(TenantEntity tenantEntity, Long businessCircleOrderId); - - void exportData(WxBusinessCircleOrder circleOrder, HttpServletRequest request, HttpServletResponse response); - - Integer sumCirclePayment(BusinessCircleBase circleOrder); - - Integer sumCircleRefundAmount(BusinessCircleBase circleOrder); - - /** - * 同步授权快速积分 - */ - ResultData syncauthorizeState(TenantEntity tenantEntity,String openid); - - /** - * 查询待积分状态 - */ - ResultData getPointsCommitStatus(TenantEntity tenantEntity,String openId); - - /** - * 商圈同步停车状态 - * state - * IN:入场,用户开车进入商圈 - * OUT:离场,用户开车离开商圈 - */ - ResultData syncParkings(TenantEntity tenantEntity,String openId,String plate_number,String state,Date time); - - void sendSyncParkingsMsg(TenantEntity tenantEntity,Long carCmdLogId); - -} diff --git a/suimangService/src/main/java/com/iformall/service/WxMemberCardService.java b/suimangService/src/main/java/com/iformall/service/WxMemberCardService.java deleted file mode 100644 index ff654b3..0000000 --- a/suimangService/src/main/java/com/iformall/service/WxMemberCardService.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.iformall.service; - -import com.github.pagehelper.PageInfo; -import com.iformall.common.ResultData; -import com.iformall.domain.po.WxMemberCard; -import com.iformall.domain.po.base.TenantEntity; - -public interface WxMemberCardService { - - /** - * 根据实体查询分页列表 - * - * @param record - * @param pageIndex - * @param pageSize - * @return - */ - PageInfo listAsPage(WxMemberCard record, Integer pageIndex, Integer pageSize); - - ResultData saveorupdate(WxMemberCard record); - - ResultData saveorupdateByCode(WxMemberCard record); - - ResultData delUserCardStatusByCode(WxMemberCard record); - - /** - * 同步会员卡卡信息 - */ - ResultData syncMemberCard(TenantEntity tenantEntity,String card_id,String code); - - void sendSyncMemberCardMsg(TenantEntity tenantEntity,String card_id,String code); - - /** - * 同步会员卡等级 - * need_inform_level 是否发送等级变更通知 - */ - ResultData syncMemberCardLevel(TenantEntity tenantEntity,String card_id,String code,String markid, - String level,Boolean need_inform_level); - - void sendsyncMemberCardLevelMsg(TenantEntity tenantEntity,Long baseUserId,Long scoreHistoryId); - - /** - * 更新会员卡积分 - */ - ResultData syncMemberCardBonus(TenantEntity tenantEntity,String card_id,String code,String markid, - int before_bonus_value,int bonus_value,Boolean need_inform_bonus); - - void sendsyncMemberCardBonusMsg(TenantEntity tenantEntity,Long cuserId,Long baseUserId,Long creditHistoryId); - -} diff --git a/suimangService/src/main/java/com/iformall/service/WxThirdPartyOrdersService.java b/suimangService/src/main/java/com/iformall/service/WxThirdPartyOrdersService.java deleted file mode 100644 index c8e251d..0000000 --- a/suimangService/src/main/java/com/iformall/service/WxThirdPartyOrdersService.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.iformall.service; - -import com.github.pagehelper.PageInfo; -import com.iformall.common.ResultData; -import com.iformall.domain.po.BusinessCircleBase; -import com.iformall.domain.po.WxThirdPartyOrders; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.enums.EnumThirdOrderType; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.List; - -public interface WxThirdPartyOrdersService { - - - /** - * 根据实体查询分页列表 - * - * @param record - * @param pageIndex - * @param pageSize - * @return - */ - PageInfo listAsPage(WxThirdPartyOrders record, Integer pageIndex, Integer pageSize); - - /** - * id+tenantId - * @param - * @return - */ - WxThirdPartyOrders getById(Long id, String tenantId); - WxThirdPartyOrders detail(Long id, TenantEntity tenantInfo); - - /** - * transactionId+tenantId - * @param - * @return - */ - WxThirdPartyOrders getOrderByTransactionId(EnumThirdOrderType orderType, String transactionId, String tenantId); - WxThirdPartyOrders getRefundOrderByRefundId(EnumThirdOrderType orderType,String refundId, String tenantId); - List getRefundOrderByTransactionId(EnumThirdOrderType orderType, String transactionId, String tenantId); - - - ResultData createOrder(WxThirdPartyOrders record); - - ResultData insertRefundNoticeOrder(WxThirdPartyOrders record); - - /** - * 积分 - * @param record - */ - void updatePoints(WxThirdPartyOrders record); - - /** - * 积分抵扣 - * @param record - */ - void pointDeduction(WxThirdPartyOrders record); - - void pointRefund(WxThirdPartyOrders thirdPartyOrders); - - void pointChange(WxThirdPartyOrders record); - - void exportData(WxThirdPartyOrders circleOrder, HttpServletRequest request, HttpServletResponse response); - - void exportDataVo(WxThirdPartyOrders circleOrder, HttpServletRequest request, HttpServletResponse response); - - Integer sumCirclePayment(BusinessCircleBase circleOrder); - - Integer sumCircleRefundAmount(BusinessCircleBase circleOrder); - - -} diff --git a/suimangService/src/main/java/com/iformall/service/impl/AliBusinessCircleOrderServiceImpl.java b/suimangService/src/main/java/com/iformall/service/impl/AliBusinessCircleOrderServiceImpl.java deleted file mode 100644 index e0a3815..0000000 --- a/suimangService/src/main/java/com/iformall/service/impl/AliBusinessCircleOrderServiceImpl.java +++ /dev/null @@ -1,381 +0,0 @@ -package com.iformall.service.impl; - -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.iformall.common.ErrorCode; -import com.iformall.common.IdWorker; -import com.iformall.common.ResultData; -import com.iformall.domain.po.*; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.enums.*; -import com.iformall.exception.MallinkException; -import com.iformall.mapper.AliBusinessCircleOrderMapper; -import com.iformall.service.*; -import com.iformall.utils.RedisLock; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.Date; -import java.util.List; - -@Service -public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrderService { - - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - private static final String ALI_CIRCLE_KEY = "CIRCLE:ALI:"; - - @Autowired - ExcelService excelService; - - @Autowired - RedisLock redisLock; - - @Autowired - AliBusinessCircleOrderMapper aliBusinessCircleOrderMapper; - - @Autowired - WxMerchantService wxMerchantService; - - @Autowired - AliPayCUserService aliPayCUserService; - - @Autowired - WxCUserBasicInfoService wxCUserBasicInfoService; - - @Autowired - WxCreditHistoryService creditHistoryService; - - @Autowired - WxCouponSendService wxCouponSendService; - - - @Override - public PageInfo listAsPage(AliBusinessCircleOrder record, Integer pageIndex, Integer pageSize) { - return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> aliBusinessCircleOrderMapper.findList(record)); - } - - @Override - public AliBusinessCircleOrder getById(Long id, String tenantId) { - AliBusinessCircleOrder recordQ = new AliBusinessCircleOrder(); - recordQ.setId(id); - recordQ.setTenantId(tenantId); - return aliBusinessCircleOrderMapper.getById(recordQ); - } - - @Override - public AliBusinessCircleOrder detail(Long id, TenantEntity tenantInfo) { - AliBusinessCircleOrder order = this.getById(id, tenantInfo.getTenantId()); - if(order.getMerchantId() != null){ - order.setMerchant(wxMerchantService.selectById(order.getMerchantId())); - } - if(order.getCUserId() != null){ - order.setBasicInfo(wxCUserBasicInfoService.getById(id,tenantInfo.getFinalTenantId())); - } -// if(order.getIsRefund() != null && order.getIsRefund().equals(EnumYesOrNo.YES.getCode())){ -// -// } - return order; - } - - @Override - public AliBusinessCircleOrder getOrderByTransactionId(String transactionId, String tenantId) { - AliBusinessCircleOrder recordQ = new AliBusinessCircleOrder(); - recordQ.setTransactionId(transactionId); - recordQ.setTenantId(tenantId); - return aliBusinessCircleOrderMapper.getOrderByTransactionId(recordQ); - } - - @Override - public AliBusinessCircleOrder getRefundOrderByRefundId(String refundId, String tenantId) { - AliBusinessCircleOrder recordQ = new AliBusinessCircleOrder(); - recordQ.setRefundId(refundId); - recordQ.setTenantId(tenantId); - return aliBusinessCircleOrderMapper.getRefundOrderByRefundId(recordQ); - } - - @Override - public List getRefundOrderByTransactionId(String transactionId, String tenantId) { - AliBusinessCircleOrder recordQ = new AliBusinessCircleOrder(); - recordQ.setTransactionId(transactionId); - recordQ.setTenantId(tenantId); - return aliBusinessCircleOrderMapper.getRefundOrderByTransactionId(recordQ); - } - - @Override - @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) - public ResultData createOrder(WxMerchant wxMerchant, AliBusinessCircleOrder record) { - String lockKey = StringUtils.join(ALI_CIRCLE_KEY,record.getTransactionId(), ":",EnumYesOrNo.NO.getCode(),":","lock"); - long time = System.currentTimeMillis() + 2000; - String timeStr = String.valueOf(time); - if (redisLock.lock2(lockKey, timeStr)) { - AliBusinessCircleOrder byTransactionId = this.getOrderByTransactionId(record.getTransactionId(),record.getTenantId()); - if(byTransactionId != null){ - logger.error("--Ali商圈付款--订单消息已存在---byTransactionId="+byTransactionId.getTransactionId()); - redisLock.unlock(lockKey, timeStr); - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "订单数据已存在"); - }else{ - Date now = new Date(); - final IdWorker idWorker = IdWorker.get(); - record.setId(idWorker.nextId()); - record.setCreateTime(now); - record.setUpdateTime(now); - - if(wxMerchant == null && StringUtils.isNotBlank(record.getMallStoreId())){ - wxMerchant = wxMerchantService.getMerchantByEncode(record.getMallStoreId()); - } - if(wxMerchant != null){ - record.setMerchantId(wxMerchant.getId()); - record.setMerchantName(wxMerchant.getName()); - }else{ - logger.error("--Ali商圈付款通知消息未找到门店--mallStoreId="+record.getMallStoreId()); - record.setMerchantName("未知门店"); - } - - if(record.getCUserId() != null){ - WxCUserBasicInfo byId = wxCUserBasicInfoService.getById(record.getCUserId(), record.getFinalTenantId()); - if(byId != null){ - record.setCUserNickName(byId.getNickName()); - record.setCUserPhone(byId.getPhone()); - }else{ - record.setCUserId(null); - } - - }else if(record.getCUserPhone() != null) { - WxCUserBasicInfo byPhone = wxCUserBasicInfoService.registerByPhone(record, record.getCUserPhone(), null,null, null, null); - if (byPhone != null) { - record.setCUserId(byPhone.getId()); - record.setCUserNickName(byPhone.getNickName()); - record.setCUserPhone(byPhone.getPhone()); - } - }else{ - AliPayCUser userQ = new AliPayCUser(); - userQ.updateTenantInfo(record); - userQ.setAlipayUserId(record.getBuyerId()); - AliPayCUser aliUser = aliPayCUserService.getByAliPayUserId(userQ); - if(aliUser != null){ - // WxCUserBasicInfo infoByPhone = wxCUserBasicInfoService.findInfoByPhone(aliUser, aliUser.getPhone()); - WxCUserBasicInfo infoByPhone = wxCUserBasicInfoService.registerByPhone(aliUser, aliUser.getPhone(),aliUser.getName(),null,null,null); - if(infoByPhone != null ){ - record.setCUserId(infoByPhone.getId()); - record.setCUserNickName(infoByPhone.getNickName()); - record.setCUserPhone(infoByPhone.getPhone()); - }else{ - logger.error("--Ali商圈付款通知消息未找到会员--aliUserId="+record.getBuyerId()); - } - }else{ - logger.error("--Ali商圈付款通知消息未找到会员--aliUserId="+record.getBuyerId()); - } - } - - aliBusinessCircleOrderMapper.insertNoticeOrder(record); - - if(record.getCUserId() == null){ - redisLock.unlock(lockKey, timeStr); - return new ResultData(0); - } - - try { - wxCouponSendService.sendCouponToUser(EnumCouponSendSendType.B_MICROPAY, record,EnumPayWay.PAY_WAY_NOT_UNPAY_B_MA,EnumPayVersion.NO_VERSION); - } catch (Exception e) { - logger.error("支付发券: " + e.getMessage()); - } - - Integer businessId = EnumBusiness.BUSINESS_ID6.getCode(); - if(wxMerchant != null){ - businessId = wxMerchant.getBusinessId(); - } - WxCreditHistory creditHistory = new WxCreditHistory(); - creditHistory.setTenantId(record.getFinalTenantId()); - creditHistory.setOperatorType(EnumUserType.ALI_CIRCLE.getCode()); - creditHistory.setOperatorId(record.getCUserId()); - creditHistory.setCUserId(record.getCUserId()); - creditHistory.setCreateDate(now); - creditHistory.setCouponId(record.getId()); - creditHistory.setBusinessId(businessId); - creditHistory.setMerchantId(record.getMerchantId()); - creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); - creditHistory.setSpend(record.getPayAmount()); - creditHistory.setChangePurpose("支付宝商圈消费:商户["+record.getMerchantName()+"] ("+record.getPayAmountStr()+"元) "); - creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); - Integer creditNum = 0; - if (creditHistory.getCreditNum() != null) { - creditNum = creditHistory.getCreditNum(); - } - if(creditNum == 0){ - redisLock.unlock(lockKey, timeStr); - return new ResultData(0); - } - record.setIncreasedPoints(creditNum); - record.setPointsUpdateTime(creditHistory.getCreateDate()); - this.updatePoints(record); - - redisLock.unlock(lockKey, timeStr); - return new ResultData(creditNum); - } - - }else{ - logger.debug("CacheAspect 读库等待中, key:{}: " + lockKey); - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - e.printStackTrace(); - }finally { - redisLock.unlock(lockKey, timeStr); - } - return new ResultData(ErrorCode.SYS_REPEAT_SUBMIT_EXCEPTION); - } - - } - - @Override - @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) - public ResultData insertRefundNoticeOrder(WxMerchant wxMerchant, AliBusinessCircleOrder record) { - AliBusinessCircleOrder order = this.getOrderByTransactionId(record.getTransactionId(),record.getTenantId()); - if(order == null){ - logger.error("--Ali商圈退款--付款消息未找到--transactionId="+record.getTransactionId()); - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "付款消息未找到"); - }else{ - String lockKey = StringUtils.join(ALI_CIRCLE_KEY,record.getTransactionId(), ":",EnumYesOrNo.YES.getCode(),":","lock"); - long time = System.currentTimeMillis() + 2000; - String timeStr = String.valueOf(time); - if (redisLock.lock2(lockKey, timeStr)) { - List refundOrders = this.getRefundOrderByTransactionId(record.getTransactionId(),record.getTenantId()); - if(refundOrders != null && refundOrders.size() > 0){ - logger.error("--Ali商圈退款--已经退款--transactionId="+record.getTransactionId()); - redisLock.unlock(lockKey, timeStr); - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "退款数据已存在"); - } - -// AliBusinessCircleOrder refundOrder = this.getRefundOrderByRefundId(record.getRefundId(),record.getTenantId()); -// if(refundOrder != null){ -// logger.error("--Ali商圈退款--退款消息已存在---RefundId="+record.getRefundId()); -// }else{ -// List refundOrders = this.getRefundOrderByTransactionId(record.getTransactionId(),record.getTenantId()); -// Integer amount = order.getPayAmount(); -// Integer increasedPoints = order.getIncreasedPoints(); -// Integer refundAmount = 0; -// Integer refundIncreasedPoints = 0; -// -// if(refundOrders != null && refundOrders.size()>0){ -// for (AliBusinessCircleOrder ro:refundOrders) { -// refundAmount += ro.getRefundAmount(); -// refundIncreasedPoints += ro.getIncreasedPoints(); -// } -// } -// if(refundAmount >= amount){ -// logger.error("--Ali商圈退款--已经退款--transactionId="+record.getTransactionId()); -// }else if((refundAmount + record.getRefundAmount()) > amount ){ -// logger.error("--Ali商圈退款--退款金额超限--transactionId="+record.getTransactionId()); -// } - else{ - Date now = new Date(); - final IdWorker idWorker = IdWorker.get(); - record.setId(idWorker.nextId()); - record.setCreateTime(now); - record.setUpdateTime(now); - - record.setAmount(order.getAmount()); - record.setPayAmount(order.getPayAmount()); - if(record.getRefundAmount() == null){ - record.setRefundAmount(order.getPayAmount()); - } - - record.setCUserId(order.getCUserId()); - record.setCUserNickName(order.getCUserNickName()); - record.setCUserPhone(order.getCUserPhone()); - record.setMerchantId(order.getMerchantId()); - record.setMerchantName(order.getMerchantName()); - aliBusinessCircleOrderMapper.insertRefundNoticeOrder(record); - - order.setOrderStatus(2);//全额退款 订单关闭 - order.setUpdateTime(now); - aliBusinessCircleOrderMapper.updateOrderStatus(order); - - int creditNum = 0; - if(order.getEarnPoints().equals(EnumYesOrNo.YES.getCode())){ - WxCreditHistory creditHistory = new WxCreditHistory(); - creditHistory.setTenantId(record.getFinalTenantId()); - creditHistory.setOperatorType(EnumUserType.ALI_CIRCLE.getCode()); - creditHistory.setOperatorId(record.getCUserId()); - creditHistory.setCUserId(record.getCUserId()); - creditHistory.setCreateDate(new Date()); - creditHistory.setCouponId(record.getId()); - creditHistory.setMerchantId(order.getMerchantId()); - creditHistory.setCreditType(EnumScoreType.REFUND_CONSUMPTION.getCode()); -// int points = 0; -// if((refundAmount + record.getRefundAmount()) == amount){ -// points = increasedPoints - refundIncreasedPoints; -// }else{ -// points = new BigDecimal(order.getIncreasedPoints()) -// .divide(new BigDecimal(order.getPayAmount()),2,BigDecimal.ROUND_HALF_UP) -// .multiply(new BigDecimal(record.getRefundAmount())) -// .intValue(); -// } - int points = order.getIncreasedPoints(); - creditHistory.setCreditNum(points); - creditHistory.setSpend(0-record.getRefundAmount()); - creditHistory.setChangePurpose("支付宝商圈退款:商户["+record.getMerchantName()+"] ("+record.getRefundAmountStr()+"元) "); - creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); - - if (creditHistory.getCreditNum() != null) { - creditNum = creditHistory.getCreditNum(); - } - if(creditNum != 0){ - record.setIncreasedPoints(creditNum); - record.setPointsUpdateTime(creditHistory.getCreateDate()); - this.updatePoints(record); - } - } - redisLock.unlock(lockKey, timeStr); - return new ResultData(creditNum); - } -// } - }else{ - logger.debug("CacheAspect 读库等待中, key:{}: " + lockKey); - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - e.printStackTrace(); - }finally { - redisLock.unlock(lockKey, timeStr); - } - return new ResultData(ErrorCode.SYS_REPEAT_SUBMIT_EXCEPTION); - } - } - } - - - @Override - public void updatePoints(AliBusinessCircleOrder record) { - record.setUpdateTime(new Date()); - aliBusinessCircleOrderMapper.updatePoints(record); - } - - @Override - public void exportData(AliBusinessCircleOrder circleOrder, HttpServletRequest request, HttpServletResponse response) { - List list = aliBusinessCircleOrderMapper.findList(circleOrder); - excelService.exportExcel(list, null, "支付宝商圈交易", AliBusinessCircleOrder.class, "支付宝商圈交易.xlsx", response, false); - - } - - @Override - public Integer sumCirclePayment(BusinessCircleBase circleOrder) { - Integer sumCirclePayment = aliBusinessCircleOrderMapper.sumCirclePayment(circleOrder); - return sumCirclePayment==null?0:sumCirclePayment; - } - - @Override - public Integer sumCircleRefundAmount(BusinessCircleBase circleOrder) { - Integer sumCircleRefundAmount = aliBusinessCircleOrderMapper.sumCircleRefundAmount(circleOrder); - return sumCircleRefundAmount==null?0:sumCircleRefundAmount; - } - -} diff --git a/suimangService/src/main/java/com/iformall/service/impl/WxBusinessCircleOrderServiceImpl.java b/suimangService/src/main/java/com/iformall/service/impl/WxBusinessCircleOrderServiceImpl.java deleted file mode 100644 index b5ff15c..0000000 --- a/suimangService/src/main/java/com/iformall/service/impl/WxBusinessCircleOrderServiceImpl.java +++ /dev/null @@ -1,556 +0,0 @@ -package com.iformall.service.impl; - -import com.github.binarywang.wxpay.bean.businesscircle.MemberCardAuthorizeResult; -import com.github.binarywang.wxpay.bean.businesscircle.ParkingNotifyRequest; -import com.github.binarywang.wxpay.bean.businesscircle.PointsCommitStatusResult; -import com.github.binarywang.wxpay.bean.businesscircle.PointsNotifyRequest; -import com.github.binarywang.wxpay.exception.WxPayException; -import com.github.binarywang.wxpay.service.WxPayService; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.iformall.common.ErrorCode; -import com.iformall.common.IdWorker; -import com.iformall.common.ResultData; -import com.iformall.domain.po.*; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.domain.po.msg.AfterBusinessCreditMsg; -import com.iformall.enums.*; -import com.iformall.exception.MallinkException; -import com.iformall.mapper.WxBusinessCircleOrderMapper; -import com.iformall.mq.MqBaseProducer; -import com.iformall.service.*; -import com.iformall.utils.DateUtils; -import com.iformall.utils.MaUtil; -import com.iformall.utils.RedisLock; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.math.BigDecimal; -import java.util.Date; -import java.util.List; - -@Service -public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderService { - - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - private final String WX_CIRCLE_KEY = "CIRCLE:WX:"; - - @Autowired - ExcelService excelService; - - @Autowired - RedisLock redisLock; - - @Autowired - WxBusinessCircleOrderMapper wxBusinessCircleOrderMapper; - - @Autowired - WxMerchantService wxMerchantService; - - @Autowired - WxCUserService wxCUserService; - - @Autowired - WxCUserBasicInfoService wxCUserBasicInfoService; - - @Autowired - WxCreditHistoryService creditHistoryService; - - @Autowired - WxCouponSendService wxCouponSendService; - - @Autowired - WxAppinfoService wxAppinfoService; - - @Autowired - WxPayAccountService wxPayAccountService; - - @Autowired - MqBaseProducer mqBaseProducer; - - @Autowired - MaUtil maUtil; - - - @Override - public PageInfo listAsPage(WxBusinessCircleOrder record, Integer pageIndex, Integer pageSize) { - return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxBusinessCircleOrderMapper.findList(record)); - } - - @Override - public WxBusinessCircleOrder getById(Long id, String tenantId) { - WxBusinessCircleOrder recordQ = new WxBusinessCircleOrder(); - recordQ.setId(id); - recordQ.setTenantId(tenantId); - return wxBusinessCircleOrderMapper.getById(recordQ); - } - - @Override - public WxBusinessCircleOrder detail(Long id, TenantEntity tenantInfo) { - WxBusinessCircleOrder order = this.getById(id, tenantInfo.getTenantId()); - if(order.getMerchantId() != null){ - order.setMerchant(wxMerchantService.selectById(order.getMerchantId())); - } - if(order.getCUserId() != null){ - order.setBasicInfo(wxCUserBasicInfoService.getById(id,tenantInfo.getFinalTenantId())); - } -// if(order.getIsRefund() != null && order.getIsRefund().equals(EnumYesOrNo.YES.getCode())){ -// -// } - return order; - } - - @Override - public WxBusinessCircleOrder getOrderByTransactionId(String transactionId, String tenantId) { - WxBusinessCircleOrder recordQ = new WxBusinessCircleOrder(); - recordQ.setTransactionId(transactionId); - recordQ.setTenantId(tenantId); - return wxBusinessCircleOrderMapper.getOrderByTransactionId(recordQ); - } - - @Override - public WxBusinessCircleOrder getRefundOrderByRefundId(String refundId, String tenantId) { - WxBusinessCircleOrder recordQ = new WxBusinessCircleOrder(); - recordQ.setRefundId(refundId); - recordQ.setTenantId(tenantId); - return wxBusinessCircleOrderMapper.getRefundOrderByRefundId(recordQ); - } - - @Override - public List getRefundOrderByTransactionId(String transactionId, String tenantId) { - WxBusinessCircleOrder recordQ = new WxBusinessCircleOrder(); - recordQ.setTransactionId(transactionId); - recordQ.setTenantId(tenantId); - return wxBusinessCircleOrderMapper.getRefundOrderByTransactionId(recordQ); - } - - @Override - @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) - public ResultData createOrder(WxBusinessCircleOrder record) { - String lockKey = StringUtils.join(WX_CIRCLE_KEY,record.getTransactionId(), ":",EnumYesOrNo.NO.getCode(),":", "lock"); - long time = System.currentTimeMillis() + 2000; - String timeStr = String.valueOf(time); - if (redisLock.lock2(lockKey, timeStr)) { - - WxBusinessCircleOrder byTransactionId = this.getOrderByTransactionId(record.getTransactionId(),record.getTenantId()); - if(byTransactionId != null){ - logger.error("--Wx商圈付款--订单消息已存在---byTransactionId="+byTransactionId.getTransactionId()); - //同步积分状态 - this.sendsyncNotifyPointsMsg(record,byTransactionId.getId()); - redisLock.unlock(lockKey, timeStr); - return new ResultData(); -// throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "订单数据已存在"); - }else { - Date now = new Date(); - final IdWorker idWorker = IdWorker.get(); - record.setId(idWorker.nextId()); - record.setCreateTime(now); - record.setUpdateTime(now); - - //TODO 第三方获取门店(标识可能发生变化) -// WxMerchant wxMerchant = wxMerchantService.getById(Long.parseLong(record.getWxShopNumber())); - WxMerchant wxMerchant = wxMerchantService.getMerchantByEncode(record.getWxShopNumber()); - if (wxMerchant != null) { - record.setMerchantId(wxMerchant.getId()); - record.setMerchantName(wxMerchant.getName()); - } else { - record.setMerchantName("未知门店"); - logger.error("--wx商圈付款通知消息未找到门店--shopName=" + record.getWxShopName() + "&shopNumber=" + record.getWxShopNumber()); - } - - if(StringUtils.isNotBlank(record.getOpenid()) && StringUtils.isNotBlank(record.getAppid())){ - WxCUser userQ = new WxCUser(); - userQ.updateTenantInfo(record); - userQ.setOpenId(record.getOpenid()); - userQ.setAppId(record.getAppid()); - WxCUser user = wxCUserService.getByOpenId(userQ); - if (user != null && user.getUserId() != null) { - record.setCUserId(user.getUserId()); - } - } - if(record.getCUserId() == null){ - WxCUserBasicInfo byPhone = wxCUserBasicInfoService.registerByPhone(record, record.getCUserPhone(),null,null,null,null); - if(byPhone != null){ - record.setCUserNickName(byPhone.getNickName()); - record.setCUserPhone(byPhone.getPhone()); - }else{ - logger.error("--微信商圈付款通知消息未找到会员--1"); - } - }else{ - WxCUserBasicInfo byId = wxCUserBasicInfoService.getById(record.getCUserId(), record.getFinalTenantId()); - if(byId != null){ - record.setCUserNickName(byId.getNickName()); - record.setCUserPhone(byId.getPhone()); - }else{ - record.setCUserId(null); - logger.error("--微信商圈付款通知消息未找到会员--2"); - } - } - - wxBusinessCircleOrderMapper.insertNoticeOrder(record); - - Integer creditNum = 0; - if(record.getCUserId() != null){ - - try { - wxCouponSendService.sendCouponToUser(EnumCouponSendSendType.B_MICROPAY, record,EnumPayWay.PAY_WAY_NOT_UNPAY_B_MA,EnumPayVersion.NO_VERSION); - } catch (Exception e) { - logger.error("支付发券: " + e.getMessage()); - } - - Integer businessId = EnumBusiness.BUSINESS_ID6.getCode(); - if(wxMerchant != null){ - businessId = wxMerchant.getBusinessId(); - } - WxCreditHistory creditHistory = new WxCreditHistory(); - creditHistory.setTenantId(record.getFinalTenantId()); - creditHistory.setOperatorType(EnumUserType.BUSINESS_CIRCLE.getCode()); - creditHistory.setOperatorId(record.getCUserId()); - creditHistory.setCUserId(record.getCUserId()); - creditHistory.setCreateDate(now); - creditHistory.setCouponId(record.getId()); - creditHistory.setBusinessId(businessId); - creditHistory.setMerchantId(record.getMerchantId()); - creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); - creditHistory.setSpend(record.getPayAmount()); - creditHistory.setChangePurpose("微信商圈消费:商户["+record.getMerchantName()+"] ("+record.getPayAmountStr()+"元) "); - creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); - - if (creditHistory.getCreditNum() != null) { - creditNum = creditHistory.getCreditNum(); - } - if(creditNum == 0){ - redisLock.unlock(lockKey, timeStr); - return new ResultData(0); - } - record.setIncreasedPoints(creditNum); - record.setPointsUpdateTime(creditHistory.getCreateDate()); - this.updatePoints(record); - - //同步积分 - this.sendsyncNotifyPointsMsg(record,record.getId()); - } - redisLock.unlock(lockKey, timeStr); - return new ResultData(creditNum); - } - - }else { - logger.debug("CacheAspect 读库等待中, key:{}: " + lockKey); - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - e.printStackTrace(); - }finally { - redisLock.unlock(lockKey, timeStr); - } - return new ResultData(ErrorCode.SYS_REPEAT_SUBMIT_EXCEPTION); - } - - } - - @Override - @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) - public ResultData insertRefundNoticeOrder(WxBusinessCircleOrder record) { - WxBusinessCircleOrder order = this.getOrderByTransactionId(record.getTransactionId(),record.getTenantId()); - if(order == null){ - logger.error("--Wx商圈退款--付款消息未找到--transactionId="+record.getTransactionId()); - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "付款消息未找到"); - }else{ - String lockKey = StringUtils.join(WX_CIRCLE_KEY,record.getRefundId(), ":",EnumYesOrNo.YES.getCode(),":", "lock"); - long time = System.currentTimeMillis() + 2000; - String timeStr = String.valueOf(time); - if (redisLock.lock2(lockKey, timeStr)) { - WxBusinessCircleOrder refundOrder = this.getRefundOrderByRefundId(record.getRefundId(),record.getTenantId()); - if(refundOrder != null){ - logger.error("--Ali商圈退款--退款消息已存在---RefundId="+record.getRefundId()); - redisLock.unlock(lockKey, timeStr); - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "退款数据已存在"); - }else{ - List refundOrders = this.getRefundOrderByTransactionId(record.getTransactionId(),record.getTenantId()); - Integer amount = order.getPayAmount(); - Integer increasedPoints = order.getIncreasedPoints(); - Integer refundAmount = 0; - Integer refundIncreasedPoints = 0; - - if(refundOrders != null && refundOrders.size()>0){ - for (WxBusinessCircleOrder ro:refundOrders) { - refundAmount += ro.getRefundAmount(); - refundIncreasedPoints += ro.getIncreasedPoints(); - } - } - if(record.getRefundAmount() == null){ - record.setRefundAmount(order.getPayAmount()-refundAmount); - } - if(refundAmount >= amount){ - logger.error("--Wx商圈退款--已经退款--transactionId="+record.getTransactionId()); - redisLock.unlock(lockKey, timeStr); - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "已经退款"); - }else if((refundAmount + record.getRefundAmount()) > amount ){ - logger.error("--Wx商圈退款--退款金额超限--transactionId="+record.getTransactionId()); - redisLock.unlock(lockKey, timeStr); - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "退款金额超限"); - }else{ - Date now = new Date(); - final IdWorker idWorker = IdWorker.get(); - record.setId(idWorker.nextId()); - record.setCreateTime(now); - record.setUpdateTime(now); - - if(record.getAmount() == null){ - record.setAmount(order.getAmount()); - } - if(record.getPayAmount() == null){ - record.setPayAmount(order.getPayAmount()); - } - - record.setCUserId(order.getCUserId()); - record.setCUserNickName(order.getCUserNickName()); - record.setCUserPhone(order.getCUserPhone()); - record.setMerchantId(order.getMerchantId()); - record.setMerchantName(order.getMerchantName()); - wxBusinessCircleOrderMapper.insertRefundNoticeOrder(record); - - if((refundAmount + record.getRefundAmount()) == amount){ - order.setOrderStatus(2);//全额退款 - }else{ - order.setOrderStatus(1);//部分退款 - } - order.setUpdateTime(now); - wxBusinessCircleOrderMapper.updateOrderStatus(order); - int creditNum = 0; - if(order.getEarnPoints().equals(EnumYesOrNo.YES.getCode())){ - WxCreditHistory creditHistory = new WxCreditHistory(); - creditHistory.setTenantId(record.getFinalTenantId()); - creditHistory.setOperatorType(EnumUserType.BUSINESS_CIRCLE.getCode()); - creditHistory.setOperatorId(record.getCUserId()); - creditHistory.setCUserId(record.getCUserId()); - creditHistory.setCreateDate(new Date()); - creditHistory.setCouponId(record.getId()); - creditHistory.setMerchantId(record.getMerchantId()); - creditHistory.setCreditType(EnumScoreType.REFUND_CONSUMPTION.getCode()); - int points = 0; - if((refundAmount + record.getRefundAmount()) == amount){ - points = increasedPoints - refundIncreasedPoints; - }else{ - points = new BigDecimal(order.getIncreasedPoints()) - .divide(new BigDecimal(order.getPayAmount()),2,BigDecimal.ROUND_HALF_UP) - .multiply(new BigDecimal(record.getRefundAmount())) - .intValue(); - } - - creditHistory.setCreditNum(points); - creditHistory.setSpend(0-record.getRefundAmount()); - creditHistory.setChangePurpose("微信商圈退款:商户["+record.getMerchantName()+"] ("+record.getRefundAmountStr()+"元) "); - creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); - - if (creditHistory.getCreditNum() != null) { - creditNum = creditHistory.getCreditNum(); - } - if(creditNum != 0){ - record.setIncreasedPoints(creditNum); - record.setPointsUpdateTime(creditHistory.getCreateDate()); - this.updatePoints(record); - } - } - redisLock.unlock(lockKey, timeStr); - return new ResultData(creditNum); - } - } - }else { - logger.debug("CacheAspect 读库等待中, key:{}: " + lockKey); - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - e.printStackTrace(); - }finally { - redisLock.unlock(lockKey, timeStr); - } - return new ResultData(ErrorCode.SYS_REPEAT_SUBMIT_EXCEPTION); - } - - } - } - - - @Override - public void updatePoints(WxBusinessCircleOrder record) { - record.setUpdateTime(new Date()); - wxBusinessCircleOrderMapper.updatePoints(record); - } - - @Override - public void notifyPoints(WxBusinessCircleOrder record){ - if(EnumYesOrNo.YES.getCode().equals(record.getIsPointsNotify())){ - logger.info("该商圈订单已同步积分"+record.getId()); - return; - } - - WxPayService wxPayService = wxPayAccountService.getWxPayService(record.getTenantId()); - - PointsNotifyRequest request = new PointsNotifyRequest(); - request.setSubMchid(wxPayService.getConfig().getSubMchId()); - request.setTransactionId(record.getTransactionId()); - request.setAppid(wxPayService.getConfig().getAppId()); - request.setOpenid(record.getOpenid()); - - if(record.getIncreasedPoints() != null && record.getIncreasedPoints() > 0 ){ - request.setEarnPoints(true); - request.setIncreasedPoints(record.getIncreasedPoints()); - - request.setPointsUpdateTime(DateUtils.toRfc3339Str(record.getPointsUpdateTime())); - }else{ - request.setEarnPoints(false); - request.setIncreasedPoints(0); - request.setPointsUpdateTime(DateUtils.toRfc3339Str(new Date())); - request.setNoPointsRemarks("该订单不参与积分活动"); - } - try { - String result = wxPayService.getBusinessCircleService().notifyPoints(request); - logger.info("微信商圈同步积分请求结果----"+result); - record.setUpdateTime(new Date()); - this.updateIsPointsNotify(record); - } catch (WxPayException e) { - e.printStackTrace(); - } - } - - @Override - public void sendsyncNotifyPointsMsg(TenantEntity tenantEntity, Long businessCircleOrderId) { - AfterBusinessCreditMsg msg = new AfterBusinessCreditMsg(); - msg.updateTenantInfo(tenantEntity); - msg.setMsgType(EnumMsgRecordType.AFTER_BUSINESS_CREDIT.getCode()); - msg.setBusinessCircleOrderId(businessCircleOrderId); - mqBaseProducer.sendMessage(msg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); - } - - @Override - public void updateIsPointsNotify(WxBusinessCircleOrder record) { - record.setUpdateTime(new Date()); - wxBusinessCircleOrderMapper.updateIsPointsNotify(record); - } - - @Override - public void exportData(WxBusinessCircleOrder circleOrder, HttpServletRequest request, HttpServletResponse response) { - List list = wxBusinessCircleOrderMapper.findList(circleOrder); - excelService.exportExcel(list, null, "微信商圈交易", WxBusinessCircleOrder.class, "微信商圈交易.xlsx", response, false); - } - - @Override - public Integer sumCirclePayment(BusinessCircleBase circleOrder) { - Integer sumCirclePayment = wxBusinessCircleOrderMapper.sumCirclePayment(circleOrder); - return sumCirclePayment==null?0:sumCirclePayment; - } - - @Override - public Integer sumCircleRefundAmount(BusinessCircleBase circleOrder) { - Integer sumCircleRefundAmount = wxBusinessCircleOrderMapper.sumCircleRefundAmount(circleOrder); - return sumCircleRefundAmount==null?0:sumCircleRefundAmount; - } - - @Override - public ResultData syncauthorizeState(TenantEntity tenantEntity, String openid) { - WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(tenantEntity.getTenantId(), EnumAppPlat.WX); - if(cAppInfo == null){ - return new ResultData(ErrorCode.APP_ID_NOT_FOUND); - } - WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); - if(payAccount == null){ - return new ResultData(ErrorCode.API_KEY_NOT_FOUND); - } - if(!EnumBusinessType.BUSINESS_3.getCode().equals(payAccount.getBusinessType())){ - return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"未开通商圈或不支持此项操作"); - } - try { - WxPayService wxPayService = maUtil.getWxPayService(cAppInfo, payAccount); - MemberCardAuthorizeResult authorizations = wxPayService.getBusinessCircleService().getAuthorizations(openid); - EnumBusinessCircleAuthorizeState authorizeState = EnumBusinessCircleAuthorizeState.getEnum(authorizations.getAuthorizeState()); - if(!EnumBusinessCircleAuthorizeState.UNAUTHORIZED.equals(authorizeState)){ - WxCUser updCuser = new WxCUser(); - updCuser.updateTenantInfo(tenantEntity); - updCuser.setOpenId(authorizations.getOpenid()); - updCuser.setAuthorizeState(authorizeState.getCode()); - updCuser.setAuthorizeTime(DateUtils.rfc3339Formatter(authorizations.getAuthorizeTime())); - updCuser.setDeauthorizeTime(DateUtils.rfc3339Formatter(authorizations.getDeauthorizeTime())); - wxCUserService.updateAuthorizeStateByOpenId(updCuser); - } - return new ResultData(authorizeState); - } catch (WxPayException e) { - e.printStackTrace(); - return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); - } - } - - @Override - public ResultData getPointsCommitStatus(TenantEntity tenantEntity, String openId) { - WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(tenantEntity.getTenantId(), EnumAppPlat.WX); - if(cAppInfo == null){ - return new ResultData(ErrorCode.APP_ID_NOT_FOUND); - } - WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); - if(payAccount == null){ - return new ResultData(ErrorCode.API_KEY_NOT_FOUND); - } - if(!EnumBusinessType.BUSINESS_3.getCode().equals(payAccount.getBusinessType())){ - return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"未开通商圈或不支持此项操作"); - } - try { - WxPayService wxPayService = maUtil.getWxPayService(cAppInfo, payAccount); - PointsCommitStatusResult pointsCommitStatus = wxPayService.getBusinessCircleService().getPointsCommitStatus(payAccount.getBrandid(), openId); - return new ResultData(pointsCommitStatus); - } catch (WxPayException e) { - e.printStackTrace(); - return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); - } - } - - @Override - public ResultData syncParkings(TenantEntity tenantEntity, String openId, String plate_number, String state, Date time) { - - WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(tenantEntity.getTenantId(), EnumAppPlat.WX); - if(cAppInfo == null){ - return new ResultData(ErrorCode.APP_ID_NOT_FOUND); - } - WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); - if(payAccount == null){ - return new ResultData(ErrorCode.API_KEY_NOT_FOUND); - } - if(!EnumBusinessType.BUSINESS_3.getCode().equals(payAccount.getBusinessType())){ - return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"未开通商圈或不支持此项操作"); - } - try { - WxPayService wxPayService = maUtil.getWxPayService(cAppInfo, payAccount); - ParkingNotifyRequest request = new ParkingNotifyRequest(); - request.setBrandid(payAccount.getBrandid()); - request.setOpenid(openId); - request.setPlateNumber(plate_number); - request.setState(state); - request.setTime(DateUtils.toRfc3339Str(time)); - - wxPayService.getBusinessCircleService().notifyParkings(request); - return new ResultData(); - } catch (WxPayException e) { - e.printStackTrace(); - return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); - } - } - - @Override - public void sendSyncParkingsMsg(TenantEntity tenantEntity, Long carCmdLogId) { - //停车出入场通知 todo -// AfterCarInOutMsg msg = new AfterCarInOutMsg(); -// msg.updateTenantInfo(tenantEntity); -// msg.setMsgType(EnumMsgRecordType.AFTER_ADD_CREDIT.getCode()); -// msg.setCarCmdLogId(carCmdLogId); -// mqBaseProducer.sendMessage(msg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); - } - - -} diff --git a/suimangService/src/main/java/com/iformall/service/impl/WxCarCmdLogServiceImpl.java b/suimangService/src/main/java/com/iformall/service/impl/WxCarCmdLogServiceImpl.java index 82baf1d..2afe4ad 100644 --- a/suimangService/src/main/java/com/iformall/service/impl/WxCarCmdLogServiceImpl.java +++ b/suimangService/src/main/java/com/iformall/service/impl/WxCarCmdLogServiceImpl.java @@ -7,7 +7,6 @@ import com.iformall.domain.po.base.TenantEntity; import com.iformall.enums.EnumCarCmd; import com.iformall.mapper.WxCarCmdLogMapper; import com.iformall.mapper.WxMallMapper; -import com.iformall.service.WxBusinessCircleOrderService; import com.iformall.service.WxCarCmdLogService; import com.iformall.service.WxMallService; import org.apache.commons.lang3.StringUtils; @@ -33,9 +32,6 @@ public class WxCarCmdLogServiceImpl implements WxCarCmdLogService { @Autowired WxMallService wxMallService; - @Autowired - WxBusinessCircleOrderService wxBusinessCircleOrderService; - @Override public PageInfo listAsPage(WxCarCmdLog record, Integer pageIndex, Integer pageSize) { @@ -54,22 +50,11 @@ public class WxCarCmdLogServiceImpl implements WxCarCmdLogService { final IdWorker idWorker = IdWorker.get(); record.setId(idWorker.nextId()); wxCarCmdLogMapper.insert(record); - this.afterCarInOrOut(record); } else { wxCarCmdLogMapper.updateById(record); } } - private void afterCarInOrOut(WxCarCmdLog record){ - if(StringUtils.isBlank(record.getPlateNumber())){ - return; - } - if(EnumCarCmd.getCarIn().contains(record.getCmdType()) - || EnumCarCmd.getCarOut().contains(record.getCmdType())){ - wxBusinessCircleOrderService.sendSyncParkingsMsg(record,record.getId()); - } - } - @Override public void deleteById(Long id,String tenantId) { wxCarCmdLogMapper.deleteById(id,tenantId); diff --git a/suimangService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java b/suimangService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java index 0a4d39c..91949a4 100644 --- a/suimangService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java +++ b/suimangService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java @@ -423,26 +423,6 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { } catch (Exception e) { logger.error("收银台发券条件判断错误:ID=" + wxCouponSend.getId() + e.getMessage()); } - }else if(param instanceof BusinessCircleBase){ - BusinessCircleBase circleBase = (BusinessCircleBase) param; - - try { - JSONObject jo = JSONObject.parseObject(wxCouponSend.getConditions()); - Long sendId = jo.getLong("id"); - int miniPayment = jo.getIntValue("miniPayment")*100; - if(sendId == null && circleBase.getPayAmount().intValue() >= miniPayment){ - return true; - } - - if (sendId != null && circleBase.getMerchantId() != null - && circleBase.getMerchantId().equals(sendId) - && circleBase.getPayAmount().intValue() >= miniPayment) { - return true; - } - logger.info("商圈收银发券条件判断--不满足{}"+circleBase.getId()); - } catch (Exception e) { - logger.error("商圈收银条件判断错误:ID=" + wxCouponSend.getId() + e.getMessage()); - } } return false; @@ -489,11 +469,6 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { cUserId = order.getCUserId(); tenantEntity = order; break; - }else if(param instanceof BusinessCircleBase){ - BusinessCircleBase circleBase = (BusinessCircleBase) param; - cUserId = circleBase.getCUserId(); - tenantEntity = circleBase; - break; }else{ return false; } diff --git a/suimangService/src/main/java/com/iformall/service/impl/WxMemberCardServiceImpl.java b/suimangService/src/main/java/com/iformall/service/impl/WxMemberCardServiceImpl.java deleted file mode 100644 index 69de046..0000000 --- a/suimangService/src/main/java/com/iformall/service/impl/WxMemberCardServiceImpl.java +++ /dev/null @@ -1,317 +0,0 @@ -package com.iformall.service.impl; - -import com.alibaba.fastjson.JSON; -import com.github.binarywang.wxpay.bean.businesscircle.MemberCardAuthorizeResult; -import com.github.binarywang.wxpay.bean.membercard.MemberCardResult; -import com.github.binarywang.wxpay.bean.membercard.MemberCardRightsRequest; -import com.github.binarywang.wxpay.bean.membercard.MemberCardUpdRequest; -import com.github.binarywang.wxpay.exception.WxPayException; -import com.github.binarywang.wxpay.service.WxPayService; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.iformall.common.ErrorCode; -import com.iformall.common.IdWorker; -import com.iformall.common.ResultData; -import com.iformall.domain.po.*; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.domain.po.msg.AfterAddCreditMsg; -import com.iformall.domain.po.msg.AfterAddScoreMsg; -import com.iformall.domain.po.msg.FmInsideCLoginMsg; -import com.iformall.domain.po.msg.SyncMemberCardMsg; -import com.iformall.enums.*; -import com.iformall.mapper.WxMemberCardMapper; -import com.iformall.mq.MqBaseProducer; -import com.iformall.service.*; -import com.iformall.utils.DateUtils; -import com.iformall.utils.MaUtil; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.Date; -import java.util.List; - -@Service -public class WxMemberCardServiceImpl implements WxMemberCardService { - - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - WxMemberCardMapper wxMemberCardMapper; - - @Autowired - WxAppinfoService wxAppinfoService; - - @Autowired - WxPayAccountService wxPayAccountService; - - @Autowired - WxCUserBasicInfoService wxCUserBasicInfoService; - - @Autowired - private MqBaseProducer mqBaseProducer; - - @Autowired - MaUtil maUtil; - - @Override - public PageInfo listAsPage(WxMemberCard record, Integer pageIndex, Integer pageSize) { - return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMemberCardMapper.findList(record)); - } - - @Override - public ResultData saveorupdate(WxMemberCard record) { - Date now = new Date(); - if(record.getId() == null){ - final IdWorker idWorker = IdWorker.get(); - record.setId(idWorker.nextId()); - record.setCreateDate(now); - record.setUpdateDate(now); - wxMemberCardMapper.insert(record); - }else{ - record.setUpdateDate(now); - wxMemberCardMapper.updateById(record); - } - return new ResultData(); - } - - @Override - public ResultData saveorupdateByCode(WxMemberCard record) { - Long id = wxMemberCardMapper.getIdByCode(record); - Date now = new Date(); - if(id == null){ - final IdWorker idWorker = IdWorker.get(); - id = idWorker.nextId(); - record.setId(id); - if(record.getCreateDate() == null){ - record.setCreateDate(now); - } - record.setUpdateDate(record.getCreateDate()); - wxMemberCardMapper.insert(record); - - if(record.getCuserId() != null){ - TenantEntity tenantEntity = new TenantEntity(); - tenantEntity.setTenantId(record.getTenantId()); - tenantEntity.setParentTenantId(record.getParentTenantId()); - this.sendsyncMemberCardBonusMsg(tenantEntity,record.getCuserId(),null,null); - } - }else{ - record.setId(id); - if(record.getUpdateDate() == null){ - record.setUpdateDate(now); - } - wxMemberCardMapper.updateById(record); - } - return new ResultData(); - } - - @Override - public ResultData delUserCardStatusByCode(WxMemberCard record) { - record.setUserCardStatus(EnumMemberCardStatus.DELETE.getCode()); - if(record.getUpdateDate() == null){ - record.setUpdateDate(new Date()); - } - wxMemberCardMapper.deleteByCode(record); - return new ResultData(); - } - - @Override - public ResultData syncMemberCard(TenantEntity tenantEntity, String card_id, String code) { - WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(tenantEntity.getTenantId(), EnumAppPlat.WX); - if(cAppInfo == null){ - return new ResultData(ErrorCode.APP_ID_NOT_FOUND); - } - WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); - if(payAccount == null){ - return new ResultData(ErrorCode.API_KEY_NOT_FOUND); - } - if(!EnumBusinessType.BUSINESS_3.getCode().equals(payAccount.getBusinessType())){ - return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"未开通商圈或不支持此项操作"); - } - try { - WxPayService wxPayService = maUtil.getWxPayServiceBySelfModel(cAppInfo, payAccount); - MemberCardResult memberCard = wxPayService.getMemberCardService().getMemberCard(card_id, code); - WxMemberCard record = new WxMemberCard(); - record.setTenantId(tenantEntity.getTenantId()); - record.setParentTenantId(tenantEntity.getParentTenantId()); - record.updateFinalTenantId(tenantEntity); - record.setCardId(card_id); - record.setCardCode(code); - record.setOpenId(memberCard.getOpenid()); - record.setMembershipNumber(memberCard.getMembershipNumber()); - record.setLevel(memberCard.getLevel()); - record.setNickname(memberCard.getNickname()); - record.setHeadImageUrl(memberCard.getHeadImageUrl()); - record.setBackgroundPictureUrl(memberCard.getBackgroundPictureUrl()); - record.setBalance(memberCard.getBalance()); - EnumMemberCardStatus enumMemberCardStatus = EnumMemberCardStatus.getEnum(memberCard.getUserCardStatus()); - if(enumMemberCardStatus != null){ - record.setUserCardStatus(enumMemberCardStatus.getCode()); - } - record.setUserInformation(JSON.toJSONString(memberCard.getUserInformation())); - - record.setBonusValue(memberCard.getBonusValue()); - if(memberCard.getServiceModules() != null){ - record.setServiceModules(JSON.toJSONString(memberCard.getServiceModules())); - } - record.setMemberPriceWord(memberCard.getMemberPriceWord()); - record.setFapiaoJumpWord(memberCard.getFapiaoJumpWord()); - if(memberCard.getGuide() != null){ - record.setGuide(JSON.toJSONString(memberCard.getGuide())); - } - -// MemberCardResult.UserInformation userInformation = memberCard.getUserInformation(); -// List commonFieldList = userInformation.getCommonFieldList(); -// String phone = null, name = null, avatarUrl = null; -// Integer sex = null; -// for (MemberCardResult.CommonField commonField:commonFieldList) { -// /** -// * 平台提供了一些通用的开卡字段供开发者选用 -// * USER_FORM_FLAG_MOBILE:手机号 -// * USER_FORM_FLAG_SEX:性别 -// * USER_FORM_FLAG_NAME:姓名 -// * USER_FORM_FLAG_BIRTHDAY:生日 -// * USER_FORM_FLAG_ADDRESS:地址 -// * USER_FORM_FLAG_EMAIL:邮箱 -// * USER_FORM_FLAG_CITY:城市 -// */ -// if("USER_FORM_FLAG_MOBILE".equals(commonField.getName())){ -// phone = commonField.getValue(); -// }else if("USER_FORM_FLAG_SEX".equals(commonField.getName())){ -// if("男".equals(commonField.getValue())){ -// sex = 1; -// }else if("女".equals(commonField.getValue())){ -// sex = 2; -// }else{ -// sex = 0; -// } -// }else if("USER_FORM_FLAG_NAME".equals(commonField.getName())){ -// name = commonField.getValue(); -// } -// } - -// WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.registerByPhone(tenantEntity, phone, null,name, sex, avatarUrl); - - WxMemberCard old = wxMemberCardMapper.getByCode(record); - if(old != null){ - record.setId(old.getId()); - } -// if(basicInfo != null && (old == null || !basicInfo.getId().equals(old.getUserId()))){ -// record.setUserId(basicInfo.getId()); -// } - - this.saveorupdate(record); -// if(record.getUserId() != null){ -// this.sendsyncMemberCardBonusMsg(tenantEntity,record.getUserId(),null); -//// this.sendsyncMemberCardLevelMsg(tenantEntity,record.getUserId(),null); -// } - return new ResultData(); - } catch (WxPayException e) { - e.printStackTrace(); - return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); - } - } - - @Override - public void sendSyncMemberCardMsg(TenantEntity tenantEntity, String card_id, String code) { - SyncMemberCardMsg msg = new SyncMemberCardMsg(); - msg.updateTenantInfo(tenantEntity); - msg.setMsgType(EnumMsgRecordType.SYNC_MEMBER_CARD.getCode()); - msg.setCardId(card_id); - msg.setCode(code); - mqBaseProducer.sendMessage(msg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); - } - - @Override - public ResultData syncMemberCardLevel(TenantEntity tenantEntity, String card_id, String code,String markid, - String level, Boolean need_inform_level) { - WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(tenantEntity.getTenantId(), EnumAppPlat.WX); - if(cAppInfo == null){ - return new ResultData(ErrorCode.APP_ID_NOT_FOUND); - } - WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); - if(payAccount == null){ - return new ResultData(ErrorCode.API_KEY_NOT_FOUND); - } - if(!EnumBusinessType.BUSINESS_3.getCode().equals(payAccount.getBusinessType())){ - return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"未开通商圈或不支持此项操作"); - } - try { - WxPayService wxPayService = maUtil.getWxPayServiceBySelfModel(cAppInfo, payAccount); - MemberCardUpdRequest request = new MemberCardUpdRequest(); - request.setLevel(level); - request.setOutRequestNo(markid); - request.setNeedInformLevel(need_inform_level); - - wxPayService.getMemberCardService().updMemberCard(card_id,code,request); - - this.sendSyncMemberCardMsg(tenantEntity,card_id,code); - return new ResultData(); - } catch (WxPayException e) { - e.printStackTrace(); - return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); - } - } - - @Override - public void sendsyncMemberCardLevelMsg(TenantEntity tenantEntity, Long baseUserId, Long scoreHistoryId) { - //todo 暂不推送等级给商圈 -// AfterAddScoreMsg msg = new AfterAddScoreMsg(); -// msg.updateTenantInfo(tenantEntity); -// msg.setMsgType(EnumMsgRecordType.AFTER_ADD_SCORE.getCode()); -// msg.setBasicUserId(baseUserId); -// msg.setScoreHistoryId(scoreHistoryId); -// mqBaseProducer.sendMessage(msg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); - } - - @Override - public ResultData syncMemberCardBonus(TenantEntity tenantEntity, String card_id, String code,String markid, - int before_bonus_value,int bonus_value, Boolean need_inform_bonus) { - WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(tenantEntity.getTenantId(), EnumAppPlat.WX); - if(cAppInfo == null){ - return new ResultData(ErrorCode.APP_ID_NOT_FOUND); - } - WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); - if(payAccount == null){ - return new ResultData(ErrorCode.API_KEY_NOT_FOUND); - } - if(!EnumBusinessType.BUSINESS_3.getCode().equals(payAccount.getBusinessType())){ - return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"未开通商圈或不支持此项操作"); - } - try { - WxPayService wxPayService = maUtil.getWxPayServiceBySelfModel(cAppInfo, payAccount); - MemberCardRightsRequest request = new MemberCardRightsRequest(); - request.setBeforeBonusValue(before_bonus_value); - request.setBonusValue(bonus_value); - request.setAddBonusValue(bonus_value - before_bonus_value); - request.setOutRequestNo(markid); - request.setNeedInformBonus(need_inform_bonus); - wxPayService.getMemberCardService().setMemberCardRights(card_id,code,request); - - this.sendSyncMemberCardMsg(tenantEntity,card_id,code); - return new ResultData(); - } catch (WxPayException e) { - e.printStackTrace(); - return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); - } - } - - @Override - public void sendsyncMemberCardBonusMsg(TenantEntity tenantEntity, Long cuserId, Long baseUserId, Long creditHistoryId) { - AfterAddCreditMsg msg = new AfterAddCreditMsg(); - msg.updateTenantInfo(tenantEntity); - msg.setMsgType(EnumMsgRecordType.AFTER_ADD_CREDIT.getCode()); - if(cuserId != null){ - msg.setCuserId(cuserId); - }else if(baseUserId != null){ - msg.setBasicUserId(baseUserId); - }else { - logger.error("商圈会员积分同步消息发送失败"); - } - msg.setCreditHistoryId(creditHistoryId); - mqBaseProducer.sendMessage(msg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); - } - -} diff --git a/suimangService/src/main/java/com/iformall/service/impl/WxThirdPartyOrdersServiceImpl.java b/suimangService/src/main/java/com/iformall/service/impl/WxThirdPartyOrdersServiceImpl.java deleted file mode 100644 index 6a31010..0000000 --- a/suimangService/src/main/java/com/iformall/service/impl/WxThirdPartyOrdersServiceImpl.java +++ /dev/null @@ -1,655 +0,0 @@ -package com.iformall.service.impl; - -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.iformall.common.ErrorCode; -import com.iformall.common.IdWorker; -import com.iformall.common.ResultData; -import com.iformall.domain.po.*; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.domain.vo.WxThirdPartyOrdersVo; -import com.iformall.enums.*; -import com.iformall.exception.MallinkException; -import com.iformall.mapper.WxThirdPartyOrdersMapper; -import com.iformall.service.*; -import com.iformall.utils.RedisLock; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.math.BigDecimal; -import java.util.Date; -import java.util.List; -import java.util.Map; - -@Service -public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService { - - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - private static final String THIRD_CIRCLE_KEY = "CIRCLE:TH:"; - - @Autowired - ExcelService excelService; - - @Autowired - RedisLock redisLock; - - @Autowired - WxThirdPartyOrdersMapper wxThirdPartyOrdersMapper; - - @Autowired - WxMerchantService wxMerchantService; - - @Autowired - WxCUserService wxCUserService; - - @Autowired - WxCUserBasicInfoService wxCUserBasicInfoService; - - @Autowired - WxCreditHistoryService wxCreditHistoryService; - - @Autowired - WxCouponSendService wxCouponSendService; - - - @Override - public PageInfo listAsPage(WxThirdPartyOrders record, Integer pageIndex, Integer pageSize) { - return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxThirdPartyOrdersMapper.findList(record)); - } - - @Override - public WxThirdPartyOrders getById(Long id, String tenantId) { - WxThirdPartyOrders recordQ = new WxThirdPartyOrders(); - recordQ.setId(id); - recordQ.setTenantId(tenantId); - return wxThirdPartyOrdersMapper.getById(recordQ); - } - - @Override - public WxThirdPartyOrders detail(Long id, TenantEntity tenantInfo) { - WxThirdPartyOrders order = this.getById(id, tenantInfo.getTenantId()); - if(order.getMerchantId() != null){ - order.setMerchant(wxMerchantService.selectById(order.getMerchantId())); - } - if(order.getCUserId() != null){ - order.setBasicInfo(wxCUserBasicInfoService.getById(id,tenantInfo.getFinalTenantId())); - } -// if(order.getIsRefund() != null && order.getIsRefund().equals(EnumYesOrNo.YES.getCode())){ -// -// } - return order; - } - - @Override - public WxThirdPartyOrders getOrderByTransactionId(EnumThirdOrderType orderType, String transactionId, String tenantId) { - WxThirdPartyOrders recordQ = new WxThirdPartyOrders(); - recordQ.setSourceType(orderType.getCode()); - recordQ.setTransactionId(transactionId); - recordQ.setTenantId(tenantId); - return wxThirdPartyOrdersMapper.getOrderByTransactionId(recordQ); - } - - @Override - public WxThirdPartyOrders getRefundOrderByRefundId(EnumThirdOrderType orderType,String refundId, String tenantId) { - WxThirdPartyOrders recordQ = new WxThirdPartyOrders(); - recordQ.setSourceType(orderType.getCode()); - recordQ.setRefundId(refundId); - recordQ.setTenantId(tenantId); - return wxThirdPartyOrdersMapper.getRefundOrderByRefundId(recordQ); - } - - @Override - public List getRefundOrderByTransactionId(EnumThirdOrderType orderType, String transactionId, String tenantId) { - WxThirdPartyOrders recordQ = new WxThirdPartyOrders(); - recordQ.setSourceType(orderType.getCode()); - recordQ.setTransactionId(transactionId); - recordQ.setTenantId(tenantId); - return wxThirdPartyOrdersMapper.getRefundOrderByTransactionId(recordQ); - } - - @Override - @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) - public ResultData createOrder(WxThirdPartyOrders record) { - String lockKey = StringUtils.join(THIRD_CIRCLE_KEY,record.getTransactionId(), ":",EnumYesOrNo.NO.getCode(),":", "lock"); - long time = System.currentTimeMillis() + 2000; - String timeStr = String.valueOf(time); - if (redisLock.lock2(lockKey, timeStr)) { - WxThirdPartyOrders byTransactionId = this.getOrderByTransactionId(EnumThirdOrderType.RMB_PAY,record.getTransactionId(),record.getTenantId()); - if(byTransactionId != null){ - logger.error("--第三方付款--通知消息已存在---byTransactionId="+byTransactionId.getTransactionId()); - redisLock.unlock(lockKey, timeStr); - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "订单数据已存在"); - }else{ - Date now = new Date(); - final IdWorker idWorker = IdWorker.get(); - record.setId(idWorker.nextId()); - record.setCreateTime(now); - record.setUpdateTime(now); - - record.setSourceType(EnumThirdOrderType.RMB_PAY.getCode()); - - //TODO 第三方获取门店(标识可能发生变化) -// WxMerchant wxMerchant = wxMerchantService.getById(Long.parseLong(record.getShopNumber())); - WxMerchant wxMerchant = wxMerchantService.getMerchantByEncode(record.getShopNumber()); - if(wxMerchant != null){ - record.setMerchantId(wxMerchant.getId()); - record.setMerchantName(wxMerchant.getName()); -// record.setShopName(wxMerchant.getName()); - }else{ - if(StringUtils.isBlank(record.getShopName())){ -// record.setShopName("第三方门店"); - record.setMerchantName("未知门店"); - } - logger.info("--第三方付款通知消息未找到门店--shopName="+record.getShopName()+"&shopNumber="+record.getShopNumber()); - } - - WxCUserBasicInfo basicInfo = null; - Long userId = null; - try { - userId = Long.parseLong(record.getUserNumber()); - } catch (NumberFormatException e) {} - if(userId != null){ - basicInfo = wxCUserBasicInfoService.getById(userId, record.getFinalTenantId()); - } - if(basicInfo == null && StringUtils.isNotBlank(record.getUserPhone())){ - basicInfo = wxCUserBasicInfoService.registerByPhone(record, record.getUserPhone(),null,null,null,null); - } - - if(basicInfo != null){ - record.setCUserId(basicInfo.getId()); - record.setCUserNickName(basicInfo.getNickName()); - record.setCUserPhone(basicInfo.getPhone()); - }else{ - logger.error("--第三方付款通知消息未找到会员--userPhone="+record.getUserPhone()+"$userNumer="+record.getId()); - } - wxThirdPartyOrdersMapper.insertNoticeOrder(record); - - if(record.getCUserId() == null){ - redisLock.unlock(lockKey, timeStr); - return new ResultData(0); - } - - try { - wxCouponSendService.sendCouponToUser(EnumCouponSendSendType.B_MICROPAY, record,EnumPayWay.PAY_WAY_NOT_UNPAY_B_MA,EnumPayVersion.NO_VERSION); - } catch (Exception e) { - logger.error("支付发券: " + e.getMessage()); - } - - Integer businessId = EnumBusiness.BUSINESS_ID6.getCode(); - if(wxMerchant != null){ - businessId = wxMerchant.getBusinessId(); - } - WxCreditHistory creditHistory = new WxCreditHistory(); - creditHistory.setTenantId(record.getFinalTenantId()); - creditHistory.setOperatorType(EnumUserType.THIRD_CIRCLE.getCode()); - creditHistory.setOperatorId(record.getCUserId()); - creditHistory.setCUserId(record.getCUserId()); - creditHistory.setCreateDate(now); - creditHistory.setCouponId(record.getId()); - creditHistory.setBusinessId(businessId); - creditHistory.setMerchantId(record.getMerchantId()); - creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); - creditHistory.setSpend(record.getPayAmount()); - creditHistory.setChangePurpose(record.getSourceAppName()+"·消费:商户["+record.getMerchantName()+"] ("+record.getPayAmountStr()+"元) "); - creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); - Integer creditNum = 0; - if (creditHistory.getCreditNum() != null) { - creditNum = creditHistory.getCreditNum(); - } - if(creditNum == 0){ - redisLock.unlock(lockKey, timeStr); - return new ResultData(0); - } - record.setIncreasedPoints(creditNum); - record.setPointsUpdateTime(creditHistory.getCreateDate()); - this.updatePoints(record); - - redisLock.unlock(lockKey, timeStr); - return new ResultData(creditNum); - } - - }else { - logger.debug("CacheAspect 读库等待中, key:{}: " + lockKey); - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - e.printStackTrace(); - }finally { - redisLock.unlock(lockKey, timeStr); - } - return new ResultData(ErrorCode.SYS_REPEAT_SUBMIT_EXCEPTION); - } - - } - - - @Override - @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) - public ResultData insertRefundNoticeOrder(WxThirdPartyOrders record) { - WxThirdPartyOrders order = this.getOrderByTransactionId(EnumThirdOrderType.RMB_PAY,record.getTransactionId(),record.getTenantId()); - if(order == null){ - logger.error("--第三方退款--付款消息未找到--transactionId="+record.getTransactionId()); - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "付款消息未找到"); - }else{ - String lockKey = StringUtils.join(THIRD_CIRCLE_KEY,record.getRefundId(), ":",EnumYesOrNo.YES.getCode(),":", "lock"); - long time = System.currentTimeMillis() + 2000; - String timeStr = String.valueOf(time); - if (redisLock.lock2(lockKey, timeStr)) { - WxThirdPartyOrders refundOrder = this.getRefundOrderByRefundId(EnumThirdOrderType.RMB_PAY,record.getRefundId(),record.getTenantId()); - if(refundOrder != null){ - logger.error("--第三方退款--退款消息已存在---RefundId="+record.getRefundId()); - redisLock.unlock(lockKey, timeStr); - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "退款数据已存在"); - }else{ - List refundOrders = this.getRefundOrderByTransactionId(EnumThirdOrderType.RMB_PAY,record.getTransactionId(),record.getTenantId()); - Integer amount = order.getPayAmount(); - Integer increasedPoints = order.getIncreasedPoints(); - Integer refundAmount = 0; - Integer refundIncreasedPoints = 0; - - if(refundOrders != null && refundOrders.size()>0){ - for (WxThirdPartyOrders ro:refundOrders) { - refundAmount += ro.getRefundAmount(); - refundIncreasedPoints += ro.getIncreasedPoints(); - } - } - if(record.getRefundAmount() == null){ - record.setRefundAmount(order.getPayAmount()-refundAmount); - } - if(refundAmount >= amount){ - logger.error("--第三方退款--已经退款--transactionId="+record.getTransactionId()); - redisLock.unlock(lockKey, timeStr); - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "已经退款"); - }else if((refundAmount + record.getRefundAmount()) > amount ){ - logger.error("--第三方退款--退款金额超限--transactionId="+record.getTransactionId()); - redisLock.unlock(lockKey, timeStr); - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "退款金额超限"); - }else{ - - Date now = new Date(); - final IdWorker idWorker = IdWorker.get(); - record.setId(idWorker.nextId()); - record.setCreateTime(now); - record.setUpdateTime(now); - - record.setSourceType(EnumThirdOrderType.RMB_PAY.getCode()); - - record.setShopName(order.getShopName()); - record.setShopNumber(order.getShopNumber()); - record.setUserPhone(order.getUserPhone()); - record.setUserNumber(order.getUserNumber()); - record.setAmount(order.getAmount()); - record.setPayAmount(order.getPayAmount()); - record.setCUserId(order.getCUserId()); - record.setCUserNickName(order.getCUserNickName()); - record.setCUserPhone(order.getCUserPhone()); - record.setMerchantId(order.getMerchantId()); - record.setMerchantName(order.getMerchantName()); - wxThirdPartyOrdersMapper.insertRefundNoticeOrder(record); - - if((refundAmount + record.getRefundAmount()) == amount){ - order.setOrderStatus(2);//全额退款 - }else{ - order.setOrderStatus(1);//部分退款 - } - order.setUpdateTime(now); - wxThirdPartyOrdersMapper.updateOrderStatus(order); - - int creditNum = 0; - if(order.getEarnPoints().equals(EnumYesOrNo.YES.getCode())){ - WxCreditHistory creditHistory = new WxCreditHistory(); - creditHistory.setTenantId(record.getFinalTenantId()); - creditHistory.setOperatorType(EnumUserType.THIRD_CIRCLE.getCode()); - creditHistory.setOperatorId(record.getCUserId()); - creditHistory.setCUserId(record.getCUserId()); - creditHistory.setCreateDate(new Date()); - creditHistory.setCouponId(record.getId()); - creditHistory.setMerchantId(record.getMerchantId()); - creditHistory.setCreditType(EnumScoreType.REFUND_CONSUMPTION.getCode()); - int points = 0; - if((refundAmount + record.getRefundAmount()) == amount){ - points = increasedPoints - refundIncreasedPoints; - }else{ - points = new BigDecimal(order.getIncreasedPoints()) - .divide(new BigDecimal(order.getPayAmount()),2,BigDecimal.ROUND_HALF_UP) - .multiply(new BigDecimal(record.getRefundAmount())) - .intValue(); - } - - creditHistory.setCreditNum(points); - creditHistory.setSpend(0-record.getRefundAmount()); - creditHistory.setChangePurpose(record.getSourceAppName()+"·消费退款:商户["+record.getMerchantName()+"] ("+record.getRefundAmountStr()+"元) "); - creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); - - if (creditHistory.getCreditNum() != null) { - creditNum = creditHistory.getCreditNum(); - } - if(creditNum != 0){ - record.setIncreasedPoints(creditNum); - record.setPointsUpdateTime(creditHistory.getCreateDate()); - this.updatePoints(record); - } - } - redisLock.unlock(lockKey, timeStr); - return new ResultData(creditNum); - } - - } - }else { - logger.debug("CacheAspect 读库等待中, key:{}: " + lockKey); - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - e.printStackTrace(); - }finally { - redisLock.unlock(lockKey, timeStr); - } - return new ResultData(ErrorCode.SYS_REPEAT_SUBMIT_EXCEPTION); - } - } - - } - - @Override - public void updatePoints(WxThirdPartyOrders record) { - record.setUpdateTime(new Date()); - wxThirdPartyOrdersMapper.updatePoints(record); - } - - @Override - @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) - public void pointDeduction(WxThirdPartyOrders record) { - - WxCUserBasicInfo basicInfo = null; - Long userId = null; - try { - userId = Long.parseLong(record.getUserNumber()); - } catch (NumberFormatException e) {} - if(userId != null){ - basicInfo = wxCUserBasicInfoService.getById(userId, record.getFinalTenantId()); - } - if(basicInfo == null){ - basicInfo = wxCUserBasicInfoService.registerByPhone(record, record.getUserPhone(),null,null,null,null); - } - if(basicInfo == null){ - logger.error("--第三方积分订单--未找到用户---userId="+record.getUserNumber()); - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未找到用户"); - } - - record.setCUserId(basicInfo.getId()); - record.setCUserNickName(basicInfo.getNickName()); - record.setCUserPhone(basicInfo.getPhone()); - - String lockKey = StringUtils.join(THIRD_CIRCLE_KEY,record.getTransactionId(), ":CP:", "lock"); - long time = System.currentTimeMillis() + 2000; - String timeStr = String.valueOf(time); - if (redisLock.lock2(lockKey, timeStr)) { - WxThirdPartyOrders byTransactionId = this.getOrderByTransactionId(EnumThirdOrderType.CREDIT_PAY,record.getTransactionId(),record.getTenantId()); - if(byTransactionId != null){ - logger.error("--第三方积分订单--数据已存在---byTransactionId="+byTransactionId.getTransactionId()); - redisLock.unlock(lockKey, timeStr); - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "订单数据已存在"); - }else{ - Date now = new Date(); - final IdWorker idWorker = IdWorker.get(); - record.setId(idWorker.nextId()); - record.setCreateTime(now); - record.setUpdateTime(now); - - record.setSourceType(EnumThirdOrderType.CREDIT_PAY.getCode()); - - //TODO 第三方获取门店(标识可能发生变化) -// WxMerchant wxMerchant = wxMerchantService.getById(Long.parseLong(record.getShopNumber())); - WxMerchant wxMerchant = wxMerchantService.getMerchantByEncode(record.getShopNumber()); - if(wxMerchant != null){ - record.setMerchantId(wxMerchant.getId()); - record.setMerchantName(wxMerchant.getName()); -// record.setShopName(wxMerchant.getName()); - }else{ - if(StringUtils.isBlank(record.getShopName())){ -// record.setShopName("第三方门店"); - record.setMerchantName("未知门店"); - } - logger.info("--第三方积分抵扣未找到门店--shopName="+record.getShopName()+"&shopNumber="+record.getShopNumber()); - } - - WxCreditHistory creditHistory = new WxCreditHistory(); - creditHistory.setTenantId(record.getFinalTenantId()); - creditHistory.setCUserId(basicInfo.getId()); - creditHistory.setOperatorId(basicInfo.getId()); - creditHistory.setOperatorType(EnumUserType.THIRD_CIRCLE.getCode()); - creditHistory.setCreditNum(record.getPayAmount()); - creditHistory.setCreditType(EnumScoreType.CHANGE_CREDIT.getCode()); - creditHistory.setChangePurpose(record.getSourceAppName()+"·积分抵扣-"+record.getPayAmount()+"("+record.getSummary()+")"); - creditHistory.setCouponId(record.getId()); - creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory, record.getTenantId()); - Integer creditNum = 0; - if (creditHistory.getCreditNum() != null) { - creditNum = creditHistory.getCreditNum(); - } - if(creditNum == 0){ - redisLock.unlock(lockKey, timeStr); - throw new MallinkException(ErrorCode.CREDIT_ZERO.getCode(), "本次扣减积分为0"); - } - wxThirdPartyOrdersMapper.insertNoticeOrder(record); - } - redisLock.unlock(lockKey, timeStr); - }else{ - logger.debug("CacheAspect 读库等待中, key:{}: " + lockKey); - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - e.printStackTrace(); - }finally { - redisLock.unlock(lockKey, timeStr); - } - } - } - - @Override - @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) - public void pointRefund(WxThirdPartyOrders record) { - WxThirdPartyOrders order = this.getOrderByTransactionId(EnumThirdOrderType.CREDIT_PAY,record.getTransactionId(),record.getTenantId()); - if(order == null){ - logger.error("--第三方积分退款--积分付款消息未找到--transactionId="+record.getTransactionId()); - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "积分抵扣订单未找到"); - }else{ - String lockKey = StringUtils.join(THIRD_CIRCLE_KEY,record.getRefundId(), ":CPR:", "lock"); - long time = System.currentTimeMillis() + 2000; - String timeStr = String.valueOf(time); - if (redisLock.lock2(lockKey, timeStr)) { -// WxThirdPartyOrders refundOrder = this.getRefundOrderByRefundId(EnumThirdOrderType.CREDIT_PAY,record.getRefundId(),record.getTenantId()); -// if(refundOrder != null){ -// logger.error("--第三方积分退款--退款消息已存在---RefundId="+record.getRefundId()); -// redisLock.unlock(lockKey, timeStr); -// throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "退款数据已存在"); -// }else{ - List refundOrders = this.getRefundOrderByTransactionId(EnumThirdOrderType.CREDIT_PAY,record.getTransactionId(),record.getTenantId()); - - if(refundOrders != null && refundOrders.size()>0){ - logger.error("--第三方积分退款--已经退款--transactionId="+record.getTransactionId()); - redisLock.unlock(lockKey, timeStr); - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "已退款"); - }else{ - - Date now = new Date(); - final IdWorker idWorker = IdWorker.get(); - record.setId(idWorker.nextId()); - record.setCreateTime(now); - record.setUpdateTime(now); - - record.setSourceType(EnumThirdOrderType.CREDIT_PAY.getCode()); - record.setRefundAmount(order.getPayAmount()); - - record.setShopName(order.getShopName()); - record.setShopNumber(order.getShopNumber()); - record.setUserPhone(order.getUserPhone()); - record.setUserNumber(order.getUserNumber()); - record.setAmount(order.getAmount()); - record.setPayAmount(order.getPayAmount()); - record.setCUserId(order.getCUserId()); - record.setCUserNickName(order.getCUserNickName()); - record.setCUserPhone(order.getCUserPhone()); - record.setMerchantId(order.getMerchantId()); - record.setMerchantName(order.getMerchantName()); - wxThirdPartyOrdersMapper.insertRefundNoticeOrder(record); - - order.setOrderStatus(2);//全额退款 - order.setUpdateTime(now); - wxThirdPartyOrdersMapper.updateOrderStatus(order); - - int creditNum = 0; -// if(order.getEarnPoints().equals(EnumYesOrNo.YES.getCode())){ - WxCreditHistory creditHistory = new WxCreditHistory(); - creditHistory.setTenantId(record.getFinalTenantId()); - creditHistory.setOperatorType(EnumUserType.THIRD_CIRCLE.getCode()); - creditHistory.setOperatorId(record.getCUserId()); - creditHistory.setCUserId(record.getCUserId()); - creditHistory.setCreateDate(new Date()); - creditHistory.setCouponId(record.getId()); - creditHistory.setMerchantId(record.getMerchantId()); - creditHistory.setCreditType(EnumScoreType.REFUND_REDUCE_CREDIT.getCode()); - creditHistory.setCreditNum(record.getRefundAmount()); - creditHistory.setSpend(0-record.getRefundAmount()); - creditHistory.setChangePurpose(record.getSourceAppName()+"·积分抵扣退款:商户["+record.getMerchantName()+"] (-"+record.getRefundAmount()+") "); - creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); - - if (creditHistory.getCreditNum() != null) { - creditNum = creditHistory.getCreditNum(); - } - if(creditNum != 0){ - record.setIncreasedPoints(creditNum); - record.setPointsUpdateTime(creditHistory.getCreateDate()); - this.updatePoints(record); - } -// } - redisLock.unlock(lockKey, timeStr); -// return new ResultData(creditNum); - } - -// } - }else { - logger.debug("CacheAspect 读库等待中, key:{}: " + lockKey); - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - e.printStackTrace(); - }finally { - redisLock.unlock(lockKey, timeStr); - } -// return new ResultData(ErrorCode.SYS_REPEAT_SUBMIT_EXCEPTION); - } - } - } - - @Override - @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) - public void pointChange(WxThirdPartyOrders record) { - WxCUserBasicInfo basicInfo = null; - Long userId = null; - try { - userId = Long.parseLong(record.getUserNumber()); - } catch (NumberFormatException e) {} - if(userId != null){ - basicInfo = wxCUserBasicInfoService.getById(userId, record.getFinalTenantId()); - } - if(basicInfo == null){ - basicInfo = wxCUserBasicInfoService.registerByPhone(record, record.getUserPhone(),null,null,null,null); - } - if(basicInfo == null){ - logger.error("--第三方积分变动--未找到用户---userId="+record.getUserNumber()); - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未找到用户"); - } - - record.setCUserId(basicInfo.getId()); - record.setCUserNickName(basicInfo.getNickName()); - record.setCUserPhone(basicInfo.getPhone()); - - String lockKey = StringUtils.join(THIRD_CIRCLE_KEY,record.getTransactionId(), ":PACC:", "lock"); - long time = System.currentTimeMillis() + 2000; - String timeStr = String.valueOf(time); - if (redisLock.lock2(lockKey, timeStr)) { - WxThirdPartyOrders byTransactionId = this.getOrderByTransactionId(EnumThirdOrderType.CREDIT_CHANGE,record.getTransactionId(),record.getTenantId()); - if(byTransactionId != null){ - logger.error("--第三方积分变动--数据已存在---byTransactionId="+byTransactionId.getTransactionId()); - redisLock.unlock(lockKey, timeStr); - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "订单数据已存在"); - }else{ - Date now = new Date(); - final IdWorker idWorker = IdWorker.get(); - record.setId(idWorker.nextId()); - record.setCreateTime(now); - record.setUpdateTime(now); - - record.setSourceType(EnumThirdOrderType.CREDIT_CHANGE.getCode()); - - WxCreditHistory creditHistory = new WxCreditHistory(); - creditHistory.setTenantId(record.getFinalTenantId()); - creditHistory.setCUserId(basicInfo.getId()); - creditHistory.setOperatorId(basicInfo.getId()); - creditHistory.setOperatorType(EnumUserType.THIRD_CIRCLE.getCode()); - creditHistory.setCreditNum(record.getPayAmount()); - creditHistory.setCreditType(EnumScoreType.POINT_CHANGE.getCode()); - if(creditHistory.getCreditNum() > 0){ - creditHistory.setChangePurpose(record.getSourceAppName()+"·积分新增"+record.getPayAmount()+"("+record.getSummary()+")"); - }else if(creditHistory.getCreditNum() < 0){ - creditHistory.setChangePurpose(record.getSourceAppName()+"·积分扣减"+record.getPayAmount()+"("+record.getSummary()+")"); - } - - creditHistory.setCouponId(record.getId()); - creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory, record.getTenantId()); - Integer creditNum = 0; - if (creditHistory.getCreditNum() != null) { - creditNum = creditHistory.getCreditNum(); - } - if(creditNum == 0){ - redisLock.unlock(lockKey, timeStr); - throw new MallinkException(ErrorCode.CREDIT_ZERO.getCode(), "本次扣减积分为0"); - } - wxThirdPartyOrdersMapper.insertNoticeOrder(record); - } - redisLock.unlock(lockKey, timeStr); - }else{ - logger.debug("CacheAspect 读库等待中, key:{}: " + lockKey); - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - e.printStackTrace(); - }finally { - redisLock.unlock(lockKey, timeStr); - } - } - } - - @Override - public void exportData(WxThirdPartyOrders circleOrder, HttpServletRequest request, HttpServletResponse response) { - List list = wxThirdPartyOrdersMapper.findList(circleOrder); - excelService.exportExcel(list, null, "第三方订单交易", WxThirdPartyOrders.class, "第三方订单交易.xlsx", response, false); - } - - @Override - public void exportDataVo(WxThirdPartyOrders circleOrder, HttpServletRequest request, HttpServletResponse response) { - List list = wxThirdPartyOrdersMapper.findListVo(circleOrder); - excelService.exportExcel(list, null, "第三方积分抵扣", WxThirdPartyOrdersVo.class, "第三方积分抵扣.xlsx", response, false); - } - - @Override - public Integer sumCirclePayment(BusinessCircleBase circleOrder) { - Integer sumCirclePayment = wxThirdPartyOrdersMapper.sumCirclePayment(circleOrder); - return sumCirclePayment==null?0:sumCirclePayment; - } - - @Override - public Integer sumCircleRefundAmount(BusinessCircleBase circleOrder) { - Integer sumCircleRefundAmount = wxThirdPartyOrdersMapper.sumCircleRefundAmount(circleOrder); - return sumCircleRefundAmount==null?0:sumCircleRefundAmount; - } -} diff --git a/suimangService/src/main/java/com/iformall/service/msg/impl/AfterBusinessCreditMsgServiceImpl.java b/suimangService/src/main/java/com/iformall/service/msg/impl/AfterBusinessCreditMsgServiceImpl.java deleted file mode 100644 index 71fa955..0000000 --- a/suimangService/src/main/java/com/iformall/service/msg/impl/AfterBusinessCreditMsgServiceImpl.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.iformall.service.msg.impl; - -import com.iformall.common.ResultData; -import com.iformall.domain.po.*; -import com.iformall.domain.po.base.TenantEntity; -import com.iformall.domain.po.msg.AfterBusinessCreditMsg; -import com.iformall.domain.po.msg.AfterCarInOutMsg; -import com.iformall.domain.po.msg.BaseMsg; -import com.iformall.enums.EnumAppPlat; -import com.iformall.enums.EnumBusinessType; -import com.iformall.enums.EnumCarCmd; -import com.iformall.mapper.WxCUserMapper; -import com.iformall.mapper.WxCarCmdLogMapper; -import com.iformall.pay.WxPayConstant; -import com.iformall.service.WxAppinfoService; -import com.iformall.service.WxBusinessCircleOrderService; -import com.iformall.service.WxCUserCarService; -import com.iformall.service.WxPayAccountService; -import com.iformall.service.msg.MsgSendService; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - * - */ -@Service -public class AfterBusinessCreditMsgServiceImpl implements MsgSendService { - - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - private WxBusinessCircleOrderService wxBusinessCircleOrderService; - - - @Override - public void send(BaseMsg baseMsg) throws Exception{ - AfterBusinessCreditMsg msg = (AfterBusinessCreditMsg)baseMsg; - - TenantEntity tenantEntity = new TenantEntity(); - tenantEntity.setTenantId(msg.getTenantId()); - tenantEntity.setParentTenantId(msg.getParentTenantId()); - - try { - Thread.currentThread().sleep(3000); - } catch (Exception e) { - logger.error("sleep error: " + e.getMessage()); - } - - WxBusinessCircleOrder circleOrder = wxBusinessCircleOrderService.getById(msg.getBusinessCircleOrderId(), tenantEntity.getTenantId()); - if(circleOrder != null){ - wxBusinessCircleOrderService.notifyPoints(circleOrder); - } - - } -} diff --git a/suimangService/src/main/java/com/iformall/service/msg/impl/AfterCarInOutMsgServiceImpl.java b/suimangService/src/main/java/com/iformall/service/msg/impl/AfterCarInOutMsgServiceImpl.java index a70a7a7..b60736e 100644 --- a/suimangService/src/main/java/com/iformall/service/msg/impl/AfterCarInOutMsgServiceImpl.java +++ b/suimangService/src/main/java/com/iformall/service/msg/impl/AfterCarInOutMsgServiceImpl.java @@ -35,9 +35,6 @@ public class AfterCarInOutMsgServiceImpl implements MsgSendService { @Autowired private WxPayAccountService wxPayAccountService; - @Autowired - private WxBusinessCircleOrderService wxBusinessCircleOrderService; - @Autowired private WxCUserCarService wxCUserCarService; @@ -102,9 +99,6 @@ public class AfterCarInOutMsgServiceImpl implements MsgSendService { logger.error("车牌未找到用户{}"+plateNumber); return; } - ResultData resultData = wxBusinessCircleOrderService.syncParkings(tenantEntity, openId, plateNumber, state, wxCarCmdLog.getCreateDate()); - - logger.info(tenantEntity.getTenantId()+"--"+plateNumber+"--微信商圈同步停车记录{}"+resultData.message); } } diff --git a/suimangService/src/main/resources/mapper/AliBusinessCircleOrderMapper.xml b/suimangService/src/main/resources/mapper/AliBusinessCircleOrderMapper.xml deleted file mode 100644 index 1e0fcf8..0000000 --- a/suimangService/src/main/resources/mapper/AliBusinessCircleOrderMapper.xml +++ /dev/null @@ -1,232 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - `id`, `tenant_id`, `parent_tenant_id`, `notice_id`, `notice_create_time`, `notice_event_type`, - `summary`,`mall_id`, `mall_name`, `mall_store_id`, `buyer_id`, - `time_end`, `amount`, `pay_amount`, `transaction_id`, `create_time`, `update_time`, - `merchant_id`,`merchant_name`, `c_user_id`, `c_user_nick_name`, `c_user_phone`, - `earn_points`, `increased_points`, `points_update_time`, - `is_refund`, `order_status`, `refund_id`, `refund_amount` - - - - where 1 = 1 - - - and `id` = #{id} - - - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - - - - and `mall_store_id` = #{mallStoreId} - - - - and `buyer_id` = #{buyerId} - - - - and `notice_id` = #{noticeId} - - - - and `time_end` >= #{startTime} - - - and `time_end` < #{endTime} - - - - and `transaction_id` = #{transactionId} - - - - and `merchant_id` = #{merchantId} - - - and `merchant_name` like concat('%', #{merchantName},'%') - - - and `c_user_id` = #{cUserId} - - - and `c_user_nick_name` like concat('%', #{cUserNickName},'%') - - - and `c_user_phone` like concat('%', #{cUserPhone},'%') - - - - and `earn_points` = #{earnPoints} - - - - and `is_refund` = #{isRefund} - - - - and `order_status` = #{orderStatus} - - - - and `refund_id` = #{refundId} - - - - and `id` in - - #{idItem} - - - - - - - - - - - - - - - - - INSERT INTO ali_business_circle_order ( - `id`, `tenant_id`, `parent_tenant_id`, `notice_id`, `notice_create_time`, `notice_event_type`, - `summary`, `mall_id`, `mall_name`, `mall_store_id`, `buyer_id`,`time_end`, `amount`, `pay_amount`, `transaction_id`, `create_time`, `update_time`, - `merchant_id`,`merchant_name`, `c_user_id`, `c_user_nick_name`, `c_user_phone`, `earn_points`, `is_refund` - ) - VALUES( - #{id},#{tenantId},#{parentTenantId},#{noticeId},#{noticeCreateTime},#{noticeEventType}, - #{summary},#{mallId},#{mallName},#{mallStoreId},#{buyerId},#{timeEnd},#{amount},#{payAmount},#{transactionId},#{createTime},#{updateTime}, - #{merchantId},#{merchantName},#{cUserId},#{cUserNickName},#{cUserPhone},0,0 - ); - - - - update ali_business_circle_order set - `earn_points` = 1, `increased_points` = #{increasedPoints}, `points_update_time` = #{pointsUpdateTime}, - `update_time` = #{updateTime} - where `id` = #{id} and `tenant_id` = #{tenantId} - - - - INSERT INTO ali_business_circle_order ( - `id`, `tenant_id`, `parent_tenant_id`,`notice_id`, `notice_create_time`, `notice_event_type`, - `summary`,`mall_id`, `mall_name`, `mall_store_id`, `buyer_id`, `time_end`, `amount`,`pay_amount`, `transaction_id`, `create_time`, `update_time`, - `merchant_id`,`merchant_name`, `c_user_id`, `c_user_nick_name`, `c_user_phone`, `earn_points`, `is_refund`, `refund_id`, `refund_amount` - ) - VALUES( - #{id},#{tenantId},#{parentTenantId},#{noticeId},#{noticeCreateTime},#{noticeEventType}, - #{summary},#{mallId},#{mallName},#{mallStoreId},#{buyerId},#{timeEnd},#{amount},#{payAmount},#{transactionId},#{createTime},#{updateTime}, - #{merchantId},#{merchantName},#{cUserId},#{cUserNickName},#{cUserPhone},0,1,#{refundId},#{refundAmount} - ); - - - - update ali_business_circle_order set - `order_status` = #{orderStatus}, - `update_time` = #{updateTime} - where `id` = #{id} and `tenant_id` = #{tenantId} - - - - - - - diff --git a/suimangService/src/main/resources/mapper/WxBusinessCircleOrderMapper.xml b/suimangService/src/main/resources/mapper/WxBusinessCircleOrderMapper.xml deleted file mode 100644 index 3fe1cc8..0000000 --- a/suimangService/src/main/resources/mapper/WxBusinessCircleOrderMapper.xml +++ /dev/null @@ -1,264 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - `id`, `tenant_id`, `parent_tenant_id`, `notice_id`, `notice_create_time`, `notice_event_type`, - `summary`, `wx_mchid`, `wx_merchant_name`, `wx_shop_name`, `wx_shop_number`, - `appid`, `openid`, `time_end`, `amount`, `pay_amount`, `transaction_id`, `commit_tag`, `create_time`, `update_time`, - `merchant_id`,`merchant_name`, `c_user_id`, `c_user_nick_name`, `c_user_phone`, - `earn_points`, `increased_points`, `points_update_time`, `is_points_notify`, - `is_refund`, `order_status`, `refund_id`, `refund_amount` - - - - where 1 = 1 - - - and `id` = #{id} - - - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - - - - and `notice_id` = #{noticeId} - - - - and `wx_mchid` = #{wxMchid} - - - - and `wx_merchant_name` like concat('%', #{wxMerchantName},'%') - - - - and `wx_shop_name` like concat('%', #{wxShopName},'%') - - - - and `wx_shop_number` = #{wxShopNumber} - - - - and `appid` = #{appid} - - - - and `openid` = #{openid} - - - - and `time_end` >= #{startTime} - - - and `time_end` < #{endTime} - - - - and `transaction_id` = #{transactionId} - - - - and `merchant_id` = #{merchantId} - - - and `merchant_name` like concat('%', #{merchantName},'%') - - - and `c_user_id` = #{cUserId} - - - and `c_user_nick_name` like concat('%', #{cUserNickName},'%') - - - and `c_user_phone` like concat('%', #{cUserPhone},'%') - - - - and `earn_points` = #{earnPoints} - - - - and `is_points_notify` = #{isPointsNotify} - - - - and `is_refund` = #{isRefund} - - - - and `order_status` = #{orderStatus} - - - - and `refund_id` = #{refundId} - - - - and `id` in - - #{idItem} - - - - - - - - - - - - - - - - - INSERT INTO wx_business_circle_order ( - `id`, `tenant_id`, `parent_tenant_id`, `notice_id`, `notice_create_time`, `notice_event_type`, - `summary`, `wx_mchid`, `wx_merchant_name`, `wx_shop_name`, `wx_shop_number`, - `appid`, `openid`, `time_end`, `amount`, `pay_amount`, `transaction_id`, `commit_tag`, `create_time`, `update_time`, - `merchant_id`,`merchant_name`, `c_user_id`, `c_user_nick_name`, `c_user_phone`, `earn_points`, `is_points_notify`, `is_refund` - ) - VALUES( - #{id},#{tenantId},#{parentTenantId},#{noticeId},#{noticeCreateTime},#{noticeEventType}, - #{summary},#{wxMchid},#{wxMerchantName},#{wxShopName},#{wxShopNumber}, - #{appid},#{openid},#{timeEnd},#{amount},#{payAmount},#{transactionId},#{commitTag},#{createTime},#{updateTime}, - #{merchantId},#{merchantName},#{cUserId},#{cUserNickName},#{cUserPhone},0,0,0 - ); - - - - update wx_business_circle_order set - `earn_points` = 1, `increased_points` = #{increasedPoints}, `points_update_time` = #{pointsUpdateTime}, - `update_time` = #{updateTime} - where `id` = #{id} and `tenant_id` = #{tenantId} - - - - update wx_business_circle_order set - `is_points_notify` = 1, `update_time` = #{updateTime} - where `id` = #{id} and `tenant_id` = #{tenantId} - - - - - INSERT INTO wx_business_circle_order ( - `id`, `tenant_id`, `parent_tenant_id`, `notice_id`, `notice_create_time`, `notice_event_type`, - `summary`, `wx_mchid`, `wx_merchant_name`, `wx_shop_name`, `wx_shop_number`, - `appid`, `openid`, `time_end`, `amount`,`pay_amount`, `transaction_id`, `commit_tag`, `create_time`, `update_time`, - `merchant_id`,`merchant_name`, `c_user_id`, `c_user_nick_name`, `c_user_phone`, `earn_points`, `is_refund`, `refund_id`, `refund_amount` - ) - VALUES( - #{id},#{tenantId},#{parentTenantId},#{noticeId},#{noticeCreateTime},#{noticeEventType}, - #{summary},#{wxMchid},#{wxMerchantName},#{wxShopName},#{wxShopNumber}, - #{appid},#{openid},#{timeEnd},#{amount},#{payAmount},#{transactionId},#{commitTag},#{createTime},#{updateTime}, - #{merchantId},#{merchantName},#{cUserId},#{cUserNickName},#{cUserPhone},0,1,#{refundId},#{refundAmount} - ); - - - - update wx_business_circle_order set - `order_status` = #{orderStatus}, - `update_time` = #{updateTime} - where `id` = #{id} and `tenant_id` = #{tenantId} - - - - - - - diff --git a/suimangService/src/main/resources/mapper/WxThirdPartyOrdersMapper.xml b/suimangService/src/main/resources/mapper/WxThirdPartyOrdersMapper.xml deleted file mode 100644 index 9e10e89..0000000 --- a/suimangService/src/main/resources/mapper/WxThirdPartyOrdersMapper.xml +++ /dev/null @@ -1,262 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - `id`, `tenant_id`, `parent_tenant_id`, `source_app_id`, `source_type`,`notice_id`, `notice_create_time`, `notice_event_type`, - `summary`,`shop_name`, `shop_number`, `user_phone`, `user_number`, - `time_end`, `amount`, `pay_amount`, `transaction_id`, `create_time`, `update_time`, - `merchant_id`,`merchant_name`, `c_user_id`, `c_user_nick_name`, `c_user_phone`, - `earn_points`, `increased_points`, `points_update_time`, - `is_refund`, `order_status`, `refund_id`, `refund_amount` - - - - where 1 = 1 - - - and `id` = #{id} - - - - and `tenant_id` = #{tenantId} - - - and `parent_tenant_id` = #{parentTenantId} - - - - and `source_app_id` = #{sourceAppId} - - - - and `source_type` = #{sourceType} - - - - and `shop_name` like concat('%', #{shopName},'%') - - - - and `shop_number` = #{shopNumber} - - - - and `user_phone` = #{userPhone} - - - - and `user_number` = #{userNumber} - - - - and `notice_id` = #{noticeId} - - - - and `time_end` >= #{startTime} - - - and `time_end` < #{endTime} - - - - and `transaction_id` = #{transactionId} - - - - and `merchant_id` = #{merchantId} - - - and `merchant_name` like concat('%', #{merchantName},'%') - - - and `c_user_id` = #{cUserId} - - - and `c_user_nick_name` like concat('%', #{cUserNickName},'%') - - - and `c_user_phone` like concat('%', #{cUserPhone},'%') - - - - and `earn_points` = #{earnPoints} - - - - and `is_refund` = #{isRefund} - - - - and `order_status` = #{orderStatus} - - - - and `refund_id` = #{refundId} - - - - and `id` in - - #{idItem} - - - - - - - - - - - - - - - - - - - INSERT INTO wx_third_party_orders ( - `id`, `tenant_id`, `parent_tenant_id`,`source_app_id`, `source_type`, `notice_id`, `notice_create_time`, `notice_event_type`, - `summary`, `shop_name`, `shop_number`, `user_phone`, `user_number`,`time_end`, `amount`, `pay_amount`, `transaction_id`, `create_time`, `update_time`, - `merchant_id`,`merchant_name`, `c_user_id`, `c_user_nick_name`, `c_user_phone`, `earn_points`, `is_refund` - ) - VALUES( - #{id},#{tenantId},#{parentTenantId},#{sourceAppId},#{sourceType},#{noticeId},#{noticeCreateTime},#{noticeEventType}, - #{summary},#{shopName},#{shopNumber},#{userPhone},#{userNumber},#{timeEnd},#{amount},#{payAmount},#{transactionId},#{createTime},#{updateTime}, - #{merchantId},#{merchantName},#{cUserId},#{cUserNickName},#{cUserPhone},0,0 - ); - - - - update wx_third_party_orders set - `earn_points` = 1, `increased_points` = #{increasedPoints}, `points_update_time` = #{pointsUpdateTime}, - `update_time` = #{updateTime} - where `id` = #{id} and `tenant_id` = #{tenantId} - - - - INSERT INTO wx_third_party_orders ( - `id`, `tenant_id`, `parent_tenant_id`,`source_app_id`, `source_type`, `notice_id`, `notice_create_time`, `notice_event_type`, - `summary`,`shop_name`, `shop_number`, `user_phone`, `user_number`, `time_end`, `amount`,`pay_amount`, `transaction_id`, `create_time`, `update_time`, - `merchant_id`,`merchant_name`, `c_user_id`, `c_user_nick_name`, `c_user_phone`, `earn_points`, `is_refund`, `refund_id`, `refund_amount` - ) - VALUES( - #{id},#{tenantId},#{parentTenantId},#{sourceAppId},#{sourceType},#{noticeId},#{noticeCreateTime},#{noticeEventType}, - #{summary},#{shopName},#{shopNumber},#{userPhone},#{userNumber},#{timeEnd},#{amount},#{payAmount},#{transactionId},#{createTime},#{updateTime}, - #{merchantId},#{merchantName},#{cUserId},#{cUserNickName},#{cUserPhone},0,1,#{refundId},#{refundAmount} - ); - - - - update wx_third_party_orders set - `order_status` = #{orderStatus}, - `update_time` = #{updateTime} - where `id` = #{id} and `tenant_id` = #{tenantId} - - - - - - -