| @@ -0,0 +1,134 @@ | |||||
| package com.iformall.controller.basic; | |||||
| import com.iformall.annotation.SystemControllerLog; | |||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.controller.base.BaseController; | |||||
| import com.iformall.domain.po.WxCouponOrder; | |||||
| import com.iformall.domain.po.WxCreditHistory; | |||||
| import com.iformall.domain.vo.WxCardSpendVo; | |||||
| import com.iformall.enums.EnumCouponType; | |||||
| import com.iformall.service.*; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import java.util.Date; | |||||
| import java.util.HashMap; | |||||
| import java.util.Map; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| @RestController | |||||
| @RequestMapping("map") | |||||
| public class WxMapController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private WxShopService wxShopService; | |||||
| @Autowired | |||||
| private WxMerchantService wxMerchantService; | |||||
| @Autowired | |||||
| private WxRentContractService wxRentContractService; | |||||
| @Autowired | |||||
| private WxCouponOrderService wxCouponOrderService; | |||||
| @Autowired | |||||
| private WxCardSpendService wxCardSpendService; | |||||
| @Autowired | |||||
| private WxBusinessCircleOrderService wxBusinessCircleOrderService; | |||||
| @Autowired | |||||
| private AliBusinessCircleOrderService aliBusinessCircleOrderService; | |||||
| @Autowired | |||||
| private WxCreditHistoryService wxCreditHistoryService; | |||||
| @ApiOperation("根据id查询接口") | |||||
| @GetMapping("/findShopById") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| @SystemControllerLog(description = "店铺管理-id查询") | |||||
| public ResultData findShopById(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMapController::findShopById"); | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxShopService.detailById(id)); | |||||
| } | |||||
| @ApiOperation("根据id查询接口") | |||||
| @GetMapping("/findMerchantByShop") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| @SystemControllerLog(description = "店铺管理-id查询") | |||||
| public ResultData findMerchantByShop(Long shopId) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMapController::findMerchantByShop"); | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxMerchantService.findMerchantByShop(shopId)); | |||||
| } | |||||
| @ApiOperation("根据id查询接口") | |||||
| @GetMapping("/findRentByShop") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| @SystemControllerLog(description = "店铺管理-id查询") | |||||
| public ResultData findRentByShop(Long shopId) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMapController::findRentByShop"); | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxRentContractService.findRentByShop(shopId)); | |||||
| } | |||||
| @ApiOperation("根据id查询接口") | |||||
| @GetMapping("/findStatisticsByShop") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| @SystemControllerLog(description = "店铺管理-id查询") | |||||
| public ResultData findStatisticsByShop(Long shopId, Date startDate, Date endDate) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMapController::findStatisticsByShop"); | |||||
| Map<String, Object> resultMap = new HashMap<>(); | |||||
| Map<String, Object> merchantByShop = wxMerchantService.findMerchantByShop(shopId); | |||||
| if(merchantByShop != null && merchantByShop.get("id") != null){ | |||||
| String tenantId = merchantByShop.get("tenantId").toString(); | |||||
| String parentTenantId = ""; | |||||
| if(merchantByShop.get("parentTenantId") != null){ | |||||
| parentTenantId = merchantByShop.get("parentTenantId").toString(); | |||||
| } | |||||
| Long mercherId = Long.parseLong(merchantByShop.get("id").toString()); | |||||
| wxCouponOrderService.statisticsWriteOff(tenantId,mercherId,startDate,endDate,resultMap); | |||||
| WxCardSpendVo wxCardSpend = new WxCardSpendVo(); | |||||
| wxCardSpend.setTenantId(tenantId); | |||||
| wxCardSpend.setMerchantId(mercherId); | |||||
| wxCardSpend.setStartdate(startDate); | |||||
| wxCardSpend.setEnddate(endDate); | |||||
| resultMap.put("sumRealPayment",wxCardSpendService.sumRealPayment(wxCardSpend)); | |||||
| Integer wxCircleSumPayment = wxBusinessCircleOrderService.sumCirclePayment(tenantId,mercherId,startDate,endDate); | |||||
| Integer aliCircleSumPayment = aliBusinessCircleOrderService.sumCirclePayment(tenantId,mercherId,startDate,endDate); | |||||
| resultMap.put("sumCirclePayment",wxCircleSumPayment + aliCircleSumPayment); | |||||
| WxCouponOrder wxCouponOrder = new WxCouponOrder(); | |||||
| wxCouponOrder.setTenantId(tenantId); | |||||
| wxCouponOrder.setSendMerchantId(mercherId); | |||||
| wxCouponOrder.setStartTime(startDate); | |||||
| wxCouponOrder.setEndTime(endDate); | |||||
| wxCouponOrder.setCouponType(EnumCouponType.COUPON_TINGCHE.getCode()); | |||||
| resultMap.put("countTingche",wxCouponOrderService.findCount(wxCouponOrder)); | |||||
| WxCreditHistory wxCreditHistory = new WxCreditHistory(); | |||||
| wxCreditHistory.setTenantId(tenantId); | |||||
| if(StringUtils.isNotBlank(parentTenantId)){ | |||||
| wxCreditHistory.setTenantId(parentTenantId); | |||||
| } | |||||
| wxCreditHistory.setMerchantId(mercherId); | |||||
| wxCreditHistory.setStartTime(startDate); | |||||
| wxCreditHistory.setEndTime(endDate); | |||||
| resultMap.put("sumCreditAmount",wxCreditHistoryService.getIncrementCreditAmount(wxCreditHistory)); | |||||
| } | |||||
| return new ResultData(Result.SUCCESS, "查询成功", resultMap); | |||||
| } | |||||
| } | |||||
| @@ -3,7 +3,9 @@ package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| import com.iformall.domain.po.AliBusinessCircleOrder; | import com.iformall.domain.po.AliBusinessCircleOrder; | ||||
| import org.apache.ibatis.annotations.Param; | |||||
| import java.util.Date; | |||||
| import java.util.List; | import java.util.List; | ||||
| @@ -41,4 +43,6 @@ public interface AliBusinessCircleOrderMapper extends CommonMapper<AliBusinessCi | |||||
| */ | */ | ||||
| void updateOrderStatus(AliBusinessCircleOrder record); | void updateOrderStatus(AliBusinessCircleOrder record); | ||||
| Integer sumCirclePayment(@Param("tenantId")String tenantId, @Param("mercherId")Long mercherId, | |||||
| @Param("startDate")Date startDate, @Param("endDate")Date endDate); | |||||
| } | } | ||||
| @@ -2,7 +2,9 @@ package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| import com.iformall.domain.po.WxBusinessCircleOrder; | import com.iformall.domain.po.WxBusinessCircleOrder; | ||||
| import org.apache.ibatis.annotations.Param; | |||||
| import java.util.Date; | |||||
| import java.util.List; | import java.util.List; | ||||
| public interface WxBusinessCircleOrderMapper extends CommonMapper<WxBusinessCircleOrder, Long> { | public interface WxBusinessCircleOrderMapper extends CommonMapper<WxBusinessCircleOrder, Long> { | ||||
| @@ -44,4 +46,6 @@ public interface WxBusinessCircleOrderMapper extends CommonMapper<WxBusinessCirc | |||||
| */ | */ | ||||
| void updateOrderStatus(WxBusinessCircleOrder record); | void updateOrderStatus(WxBusinessCircleOrder record); | ||||
| Integer sumCirclePayment(@Param("tenantId")String tenantId, @Param("mercherId")Long mercherId, | |||||
| @Param("startDate")Date startDate, @Param("endDate")Date endDate); | |||||
| } | } | ||||
| @@ -26,6 +26,7 @@ public interface WxCardSpendMapper extends CommonMapper<WxCardSpend, Long> { | |||||
| * POS | * POS | ||||
| */ | */ | ||||
| int deleteForPrevCancel(WxCardSpend record); | int deleteForPrevCancel(WxCardSpend record); | ||||
| Integer sumRealPayment(WxCardSpendVo wxCardSpend); | |||||
| } | } | ||||
| @@ -92,4 +92,8 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | |||||
| void cardDefer(@Param("couponId")Long couponId,@Param("tenantId")String tenantId,@Param("expireTime")Date expireTime); | void cardDefer(@Param("couponId")Long couponId,@Param("tenantId")String tenantId,@Param("expireTime")Date expireTime); | ||||
| //查询待延期的idList | //查询待延期的idList | ||||
| List<Long> cardDeferCouponOrderId(@Param("couponId")Long couponId,@Param("tenantId")String tenantId); | List<Long> cardDeferCouponOrderId(@Param("couponId")Long couponId,@Param("tenantId")String tenantId); | ||||
| Integer findWriteOffCount(@Param("tenantId")String tenantId, @Param("mercherId")Long mercherId, | |||||
| @Param("startDate")Date startDate, @Param("endDate")Date endDate, | |||||
| @Param("couponType")Integer couponType); | |||||
| } | } | ||||
| @@ -57,4 +57,6 @@ public interface WxMerchantMapper extends CommonMapper<WxMerchant, Long> { | |||||
| List<WxMerchant> findFollowList(WxMerchant record); | List<WxMerchant> findFollowList(WxMerchant record); | ||||
| int recordedAmount(WxMerchant record); | int recordedAmount(WxMerchant record); | ||||
| Map<String, Object> findMerchantByShop(@Param("shopId")Long shopId); | |||||
| } | } | ||||
| @@ -84,4 +84,6 @@ public interface WxRentContractMapper extends CommonMapper<WxRentContract, Long> | |||||
| Integer getCanApplyCount(@Param("id") Long id); | Integer getCanApplyCount(@Param("id") Long id); | ||||
| List<Long> getMerchantIdsByStatuss(WxRentContract wxRentContract); | List<Long> getMerchantIdsByStatuss(WxRentContract wxRentContract); | ||||
| List<Map<String, Object>> findRentByShop(@Param("shopId")Long shopId); | |||||
| } | } | ||||
| @@ -41,5 +41,7 @@ public interface WxShopMapper extends CommonMapper<WxShop, String> { | |||||
| void updateUnRentByIds(@Param("ids")List<Long> shopIds); | void updateUnRentByIds(@Param("ids")List<Long> shopIds); | ||||
| Map<String,Object> detailById(@Param("id") Long id); | |||||
| // List<WxShop> selectBatchByIds(@Param("ids")List<Long> ids); | // List<WxShop> selectBatchByIds(@Param("ids")List<Long> ids); | ||||
| } | } | ||||
| @@ -8,6 +8,7 @@ import com.iformall.domain.po.base.TenantEntity; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.util.Date; | |||||
| import java.util.List; | import java.util.List; | ||||
| public interface AliBusinessCircleOrderService { | public interface AliBusinessCircleOrderService { | ||||
| @@ -52,4 +53,6 @@ public interface AliBusinessCircleOrderService { | |||||
| void updatePoints(AliBusinessCircleOrder record); | void updatePoints(AliBusinessCircleOrder record); | ||||
| void exportData(AliBusinessCircleOrder circleOrder, HttpServletRequest request, HttpServletResponse response); | void exportData(AliBusinessCircleOrder circleOrder, HttpServletRequest request, HttpServletResponse response); | ||||
| Integer sumCirclePayment(String tenantId, Long mercherId, Date startDate, Date endDate); | |||||
| } | } | ||||
| @@ -7,6 +7,7 @@ import com.iformall.domain.po.base.TenantEntity; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.util.Date; | |||||
| import java.util.List; | import java.util.List; | ||||
| public interface WxBusinessCircleOrderService { | public interface WxBusinessCircleOrderService { | ||||
| @@ -55,4 +56,6 @@ public interface WxBusinessCircleOrderService { | |||||
| void updateIsPointsNotify(WxBusinessCircleOrder record); | void updateIsPointsNotify(WxBusinessCircleOrder record); | ||||
| void exportData(WxBusinessCircleOrder circleOrder, HttpServletRequest request, HttpServletResponse response); | void exportData(WxBusinessCircleOrder circleOrder, HttpServletRequest request, HttpServletResponse response); | ||||
| Integer sumCirclePayment(String tenantId, Long mercherId, Date startDate, Date endDate); | |||||
| } | } | ||||
| @@ -111,4 +111,6 @@ public interface WxCardSpendService { | |||||
| WxCardSpend cardSpendForPosPrePay(WxCardSpend record) throws MallinkException; | WxCardSpend cardSpendForPosPrePay(WxCardSpend record) throws MallinkException; | ||||
| WxCardInfo cardSpendForPosPrePayCancel(WxCardInfo cardInfo, WxCardSpend record) throws MallinkException; | WxCardInfo cardSpendForPosPrePayCancel(WxCardInfo cardInfo, WxCardSpend record) throws MallinkException; | ||||
| WxCardSpend cardSpendForPosPay(PromotionCalc scoreCreditCalc, WxCardSpend record, WxMerchant merchant, WxMerchantBUser buUser,Integer payWay) throws MallinkException; | WxCardSpend cardSpendForPosPay(PromotionCalc scoreCreditCalc, WxCardSpend record, WxMerchant merchant, WxMerchantBUser buUser,Integer payWay) throws MallinkException; | ||||
| Integer sumRealPayment(WxCardSpendVo wxCardSpend); | |||||
| } | } | ||||
| @@ -217,4 +217,7 @@ public interface WxCouponOrderService { | |||||
| int findCount(WxCouponOrder wxCouponOrder,List<TenantEntity> tenantEntitys); | int findCount(WxCouponOrder wxCouponOrder,List<TenantEntity> tenantEntitys); | ||||
| void statisticsWriteOff(String tenantId, Long mercherId, Date startDate, Date endDate, Map<String, Object> resultMap); | |||||
| Integer findCount(WxCouponOrder wxCouponOrder); | |||||
| } | } | ||||
| @@ -86,4 +86,5 @@ public interface WxCreditHistoryService { | |||||
| PageInfo<MerchantCreditRankingVo> listAsPageMcrv(WxCreditHistory record, Integer pageIndex, Integer pageSize); | PageInfo<MerchantCreditRankingVo> listAsPageMcrv(WxCreditHistory record, Integer pageIndex, Integer pageSize); | ||||
| long getIncrementCreditAmount(WxCreditHistory wxCreditHistory); | |||||
| } | } | ||||
| @@ -18,6 +18,7 @@ import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | |||||
| import java.util.Optional; | import java.util.Optional; | ||||
| /** | /** | ||||
| @@ -176,4 +177,6 @@ public interface WxMerchantService { | |||||
| ResultData ttdisable(Long id); | ResultData ttdisable(Long id); | ||||
| ResultData ttstartusing(Long id); | ResultData ttstartusing(Long id); | ||||
| Map<String,Object> findMerchantByShop(Long shopId); | |||||
| } | } | ||||
| @@ -125,4 +125,5 @@ public interface WxRentContractService { | |||||
| */ | */ | ||||
| boolean hasOtherValidContractShop(WxRentContract wxRentContract); | boolean hasOtherValidContractShop(WxRentContract wxRentContract); | ||||
| Map<String, Object> findRentByShop(Long shopId); | |||||
| } | } | ||||
| @@ -79,4 +79,6 @@ public interface WxShopService { | |||||
| * @param response | * @param response | ||||
| */ | */ | ||||
| void exportNotRentShop(WxShop wxShop, HttpServletRequest request, HttpServletResponse response); | void exportNotRentShop(WxShop wxShop, HttpServletRequest request, HttpServletResponse response); | ||||
| Map<String,Object> detailById(Long id); | |||||
| } | } | ||||
| @@ -359,4 +359,10 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||||
| } | } | ||||
| @Override | |||||
| public Integer sumCirclePayment(String tenantId, Long mercherId, Date startDate, Date endDate) { | |||||
| Integer sumCirclePayment = aliBusinessCircleOrderMapper.sumCirclePayment(tenantId,mercherId,startDate,endDate); | |||||
| return sumCirclePayment==null?0:sumCirclePayment; | |||||
| } | |||||
| } | } | ||||
| @@ -372,5 +372,11 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||||
| excelService.exportExcel(list, null, "微信商圈交易", WxBusinessCircleOrder.class, "微信商圈交易.xlsx", response, false); | excelService.exportExcel(list, null, "微信商圈交易", WxBusinessCircleOrder.class, "微信商圈交易.xlsx", response, false); | ||||
| } | } | ||||
| @Override | |||||
| public Integer sumCirclePayment(String tenantId, Long mercherId, Date startDate, Date endDate) { | |||||
| Integer sumCirclePayment = wxBusinessCircleOrderMapper.sumCirclePayment(tenantId,mercherId,startDate,endDate); | |||||
| return sumCirclePayment==null?0:sumCirclePayment; | |||||
| } | |||||
| } | } | ||||
| @@ -954,4 +954,9 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| } | } | ||||
| return record; | return record; | ||||
| } | } | ||||
| @Override | |||||
| public Integer sumRealPayment(WxCardSpendVo wxCardSpend) { | |||||
| return wxCardSpendMapper.sumRealPayment(wxCardSpend); | |||||
| } | |||||
| } | } | ||||
| @@ -1545,4 +1545,17 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| return count; | return count; | ||||
| } | } | ||||
| @Override | |||||
| public void statisticsWriteOff(String tenantId, Long mercherId, Date startDate, Date endDate, Map<String, Object> resultMap) { | |||||
| resultMap.put("couponWriteOff",wxCouponOrderMapper.findWriteOffCount(tenantId, mercherId, startDate, endDate, null)); | |||||
| resultMap.put("groupWriteOff",wxCouponOrderMapper.findWriteOffCount(tenantId, mercherId, startDate, endDate, EnumCouponType.COUPON_GROUP.getCode())); | |||||
| resultMap.put("pressWriteOff",wxCouponOrderMapper.findWriteOffCount(tenantId, mercherId, startDate, endDate, EnumCouponType.COUPON_PRESS.getCode())); | |||||
| } | |||||
| @Override | |||||
| public Integer findCount(WxCouponOrder wxCouponOrder) { | |||||
| return wxCouponOrderMapper.findCount(wxCouponOrder); | |||||
| } | |||||
| } | } | ||||
| @@ -156,6 +156,11 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCreditHistoryMapper.merchantCreditRanking(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCreditHistoryMapper.merchantCreditRanking(record)); | ||||
| } | } | ||||
| @Override | |||||
| public long getIncrementCreditAmount(WxCreditHistory wxCreditHistory) { | |||||
| return wxCreditHistoryMapper.getIncrementCreditAmount(wxCreditHistory); | |||||
| } | |||||
| @Override | @Override | ||||
| public PageInfo<WxCreditHistory> listAsPage(WxCreditHistory record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxCreditHistory> listAsPage(WxCreditHistory record, Integer pageIndex, Integer pageSize) { | ||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCreditHistoryMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCreditHistoryMapper.findList(record)); | ||||
| @@ -1140,4 +1140,9 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @Override | |||||
| public Map<String, Object> findMerchantByShop(Long shopId) { | |||||
| return wxMerchantMapper.findMerchantByShop(shopId); | |||||
| } | |||||
| } | } | ||||
| @@ -3183,6 +3183,15 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| return exists; | return exists; | ||||
| } | } | ||||
| @Override | |||||
| public Map<String, Object> findRentByShop(Long shopId) { | |||||
| List<Map<String, Object>> rentByShop = wxRentContractMapper.findRentByShop(shopId); | |||||
| if(rentByShop != null && rentByShop.size() > 0){ | |||||
| return rentByShop.get(0); | |||||
| } | |||||
| return null; | |||||
| } | |||||
| public static void main(String[] args) { | public static void main(String[] args) { | ||||
| String s = "{\"siteMoney\":\"2\",\"facilityMoney\":\"3\",\"administratorMoney\":\"4\"}"; | String s = "{\"siteMoney\":\"2\",\"facilityMoney\":\"3\",\"administratorMoney\":\"4\"}"; | ||||
| @@ -238,4 +238,9 @@ public class WxShopServiceImpl implements WxShopService { | |||||
| String name = "未出租商铺列表"; | String name = "未出租商铺列表"; | ||||
| excelService.exportExcel(notRentShopVoList, null, name, WxNotRentShopVo.class, name + ".xlsx", response, false); | excelService.exportExcel(notRentShopVoList, null, name, WxNotRentShopVo.class, name + ".xlsx", response, false); | ||||
| } | } | ||||
| @Override | |||||
| public Map<String,Object> detailById(Long id) { | |||||
| return wxShopMapper.detailById(id); | |||||
| } | |||||
| } | } | ||||
| @@ -212,4 +212,18 @@ | |||||
| where `id` = #{id} and `tenant_id` = #{tenantId} | where `id` = #{id} and `tenant_id` = #{tenantId} | ||||
| </update> | </update> | ||||
| <select id="sumCirclePayment" parameterType="java.util.HashMap" resultType="Integer"> | |||||
| select | |||||
| IFNULL(SUM(`pay_amount`),0) as sum_pay_amount | |||||
| from ali_business_circle_order | |||||
| where `tenant_id` = #{tenantId} | |||||
| and `merchant_id` = #{merchantId} | |||||
| <if test=" null != startDate "> | |||||
| AND `time_end` >= #{startDate} | |||||
| </if> | |||||
| <if test=" null != endDate "> | |||||
| AND `time_end` <= #{endDate} | |||||
| </if> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -244,4 +244,19 @@ | |||||
| where `id` = #{id} and `tenant_id` = #{tenantId} | where `id` = #{id} and `tenant_id` = #{tenantId} | ||||
| </update> | </update> | ||||
| <select id="sumCirclePayment" parameterType="java.util.HashMap" resultType="Integer"> | |||||
| select | |||||
| IFNULL(SUM(`pay_amount`),0) as sum_pay_amount | |||||
| from wx_business_circle_order | |||||
| where `tenant_id` = #{tenantId} | |||||
| and `merchant_id` = #{merchantId} | |||||
| <if test=" null != startDate "> | |||||
| AND `time_end` >= #{startDate} | |||||
| </if> | |||||
| <if test=" null != endDate "> | |||||
| AND `time_end` <= #{endDate} | |||||
| </if> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -372,12 +372,6 @@ | |||||
| <if test=" null != cardBeforeRealAmount "> | <if test=" null != cardBeforeRealAmount "> | ||||
| and cs.`card_before_real_amount` = #{cardBeforeRealAmount} | and cs.`card_before_real_amount` = #{cardBeforeRealAmount} | ||||
| </if> | </if> | ||||
| <if test=" null != createDate "> | |||||
| and cs.`create_date` = #{createDate} | |||||
| </if> | |||||
| <if test=" null != updateDate "> | |||||
| and cs.`update_date` = #{updateDate} | |||||
| </if> | |||||
| <if test=" null != payStatus "> | <if test=" null != payStatus "> | ||||
| and cs.`pay_status` = #{payStatus} | and cs.`pay_status` = #{payStatus} | ||||
| </if> | </if> | ||||
| @@ -464,5 +458,19 @@ | |||||
| group by cs.owner_id | group by cs.owner_id | ||||
| </select> | </select> | ||||
| <select id="sumRealPayment" parameterType="com.iformall.domain.vo.WxCardSpendVo" resultType="Integer"> | |||||
| select | |||||
| IFNULL(SUM(cs.`real_payment`),0) as sum_real_payment | |||||
| from wx_card_spend cs | |||||
| where cs.`tenant_id` = #{tenantId} | |||||
| and cs.`merchant_id` = #{merchantId} | |||||
| <if test=" null != startdate "> | |||||
| AND cs.`create_date` >= #{startdate} | |||||
| </if> | |||||
| <if test=" null != enddate "> | |||||
| AND cs.`create_date` <= #{enddate} | |||||
| </if> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -403,6 +403,10 @@ | |||||
| and co.coupon_type = #{couponType} | and co.coupon_type = #{couponType} | ||||
| </if> | </if> | ||||
| <if test=" null != sendMerchantId "> | |||||
| and co.send_merchant_id = #{sendMerchantId} | |||||
| </if> | |||||
| <if test=" 1 == couponOrderStatus"> | <if test=" 1 == couponOrderStatus"> | ||||
| <if test=" null != startTime"> | <if test=" null != startTime"> | ||||
| and co.update_date >= #{startTime} | and co.update_date >= #{startTime} | ||||
| @@ -1462,4 +1466,23 @@ | |||||
| select id from wx_coupon_order where coupon_id = #{couponId} and tenant_id = #{tenantId} and coupon_order_status in (4, 5) | select id from wx_coupon_order where coupon_id = #{couponId} and tenant_id = #{tenantId} and coupon_order_status in (4, 5) | ||||
| </select> | </select> | ||||
| <select id="findWriteOffCount" parameterType="java.util.HashMap" resultType="java.lang.Integer"> | |||||
| select count(co.id) | |||||
| from wx_coupon_order co | |||||
| left join wx_merchant_b_user mbu on co.b_user_id = mbu.id | |||||
| where co.tenant_id = #{tenantId} and co.coupon_order_status = 1 | |||||
| and mbu.merchant_id = #{mercherId} | |||||
| <if test=" null != startDate "> | |||||
| AND co.update_date >= #{startDate} | |||||
| </if> | |||||
| <if test=" null != endDate "> | |||||
| AND co.update_date <= #{endDate} | |||||
| </if> | |||||
| <if test=" null != couponType "> | |||||
| and co.`coupon_type` = #{couponType} | |||||
| </if> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -707,4 +707,20 @@ | |||||
| where id = #{id} | where id = #{id} | ||||
| </update> | </update> | ||||
| <select id="findMerchantByShop" parameterType="Long" resultType="hashmap"> | |||||
| select | |||||
| m.`id`,m.`tenant_id`,m.`parent_tenant_id`,m.`img_url`,m.`name`,m.`encode`,m.`link_phone`,m.`create_date`,m.`update_date`,m.`car_vendor_type`,m.`car_params`,m.`status`,m.`link_person`, | |||||
| m.`business_id`,m.`business_types`,m.`sub_business_id`,m.`shop_type`,m.`brand`,m.`type`,m.`is_public`,m.email,m.`title`,m.`cover_picture`,m.`is_admin`,m.`bill_setting`,m.`qr_code`, | |||||
| m.`introduction`,m.`action_desc`,m.`mark`,m.mark_time,m.`is_del`,m.`talk_user_main`,m.`talk_user_aux`,m.link_line_phone,m.credit_locked,m.credit_locked, | |||||
| b.name brandName,bu.title businessTitle,mc.corp_papers_register_number corpPapersRegisterNumber,mc.corp_papers_address corpPapersAddress | |||||
| from wx_shop s | |||||
| left join wx_merchant_shop ms on ms.shop_id=s.id and ms.is_del=0 | |||||
| left join wx_merchant m on ms.merchant_id=m.id | |||||
| left join wx_brand b on m.brand = b.id | |||||
| left join wx_business bu on m.business_id = bu.id | |||||
| left join wx_merchant_corp mc on mc.merchant_id = m.id | |||||
| where s.`id` = #{shopId} | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -766,7 +766,33 @@ | |||||
| <foreach collection="statuss" index="index" item="statusItem" open="(" separator="," close=")"> | <foreach collection="statuss" index="index" item="statusItem" open="(" separator="," close=")"> | ||||
| #{statusItem} | #{statusItem} | ||||
| </foreach> | </foreach> | ||||
| </select> | |||||
| </select> | |||||
| <select id="findRentByShop" parameterType="Long" resultType="hashmap"> | |||||
| select | |||||
| rc.`id`,rc.`merchant_id`, | |||||
| rc.`shop_type_sub`,rc.`lease_purpose`,rc.`contractual_rules`,rc.`delivery_date`,rc.`delivery_grace_period`,rc.`opening_date`,rc.`business_hours`,rc.`scope_metre`, | |||||
| rc.`price`,rc.`rental_start_date`,rc.`rental_end_date`,rc.`sign_date`,rc.`receive_period`, | |||||
| rc.`tenant_id`,rc.`parent_tenant_id`,rc.`filepath`,rc.`status`,rc.`contract_number`, | |||||
| rc.`first_party_bank_info`,rc.`second_party_bank_info`,rc.`second_party_tax_info`, | |||||
| rc.`property_name`,rc.`property_fee`,rc.`fee_cycle`,rc.`water_fee`,rc.`electricity_fees`, | |||||
| rc.`deposit`,rc.cashtype_content_lsit,rc.cashtype_lsit,rc.`pay_date`,rc.`is_del`,rc.`merchant_name`, | |||||
| rc.`brand`,rc.`business_id`,rc.`shop_type`,rc.`shop_type_str`,rc.`updatetime`,rc.`createtime`,rc.`link_person`,rc.`link_phone`,rc.`link_address`, | |||||
| rc.`pay_account`,rc.`filename`,rc.`lease`,rc.`type`,rc.`revenue`,rc.`adjust_ratio`,rc.`adjust_period`,rc.`pay_ratio`, | |||||
| rc.`start_date`,rc.`end_date`,rc.`shop_name`,rc.`from_id`, | |||||
| rc.`apply_status`,rc.`bank_name`,rc.`rent_shop_type`,rc.`fix_start_date`,rc.`fix_end_date`, | |||||
| rc.`business_type`,rc.`rent_info`, rc.`file_names`,rc.price_unit,rent_price,rc.other_rent_price_info,rc.`subject_name`,rc.rent_start_type, | |||||
| rc.`rent_input_way`,rc.`adjust_ratio_way`,rc.`operation_type`,rc.late_pay_ratio,rc.late_pay_day,rc.bus_discount_ratio,rc.bus_discount_time | |||||
| from wx_shop s | |||||
| left join wx_merchant_shop ms on ms.shop_id=s.id and ms.is_del=0 | |||||
| left join wx_merchant m on ms.merchant_id=m.id | |||||
| left join wx_rent_contract rc on rc.merchant_id = m.id and rc.is_del=0 | |||||
| where s.`id` = #{shopId} | |||||
| and rc.`status` in (2,3) | |||||
| and rc.`start_date` <= now() and end_date >= now() | |||||
| order by rc.`updatetime` desc; | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -659,4 +659,16 @@ | |||||
| #{idItem} | #{idItem} | ||||
| </foreach> | </foreach> | ||||
| </update> | </update> | ||||
| <select id="detailById" parameterType="Long" resultType="hashmap"> | |||||
| select s.id id, s.tenant_id tenantId, s.parent_tenant_id parentTenantId, s.shop_number shopNumber,CONVERT(s.build_area,DECIMAL(10,2)) buildArea, | |||||
| s.img_url imgUrl,CONVERT(s.operation_area,DECIMAL(10,2)) operationArea, | |||||
| s.status,b.building_name building,f.floor_name floor,s.manager,s.manager_phone managerPhone, | |||||
| s.type,s.point_type pointType,s.addr,DATEDIFF(now(),s.create_date) freeDay,rent,rent_unit,s.business_id as | |||||
| businessId,s.create_date create_date | |||||
| from wx_shop s | |||||
| left join wx_mall_building b on s.building=b.id | |||||
| left join wx_mall_floor f on s.floor=f.id | |||||
| where s.`id` = #{id} | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||