| @@ -50,16 +50,16 @@ public class WxMerchantMicroPayController extends BaseController { | |||||
| return new ResultData(markingDataReportService.listMicroPayOrderReportByDateAndMerchant(wxOrderReportDto)); | return new ResultData(markingDataReportService.listMicroPayOrderReportByDateAndMerchant(wxOrderReportDto)); | ||||
| } | } | ||||
| // @ApiOperation("获得昨日刷卡列表") | |||||
| // @GetMapping("/listYesterday") | |||||
| // @SystemControllerLog(description = "收银台-获得昨日刷卡列表") | |||||
| // public ResultData listYesterday(@ModelAttribute WxOrderReportDto wxOrderReportDto, Integer pageNum, Integer pageSize) { | |||||
| // logger.debug("[" + getIpAddr() + "] WxMerchantTradeDailyController::listYesterday"); | |||||
| // if (wxOrderReportDto == null) | |||||
| // wxOrderReportDto = new WxOrderReportDto(); | |||||
| // wxOrderReportDto.updateTenantInfo(getTenantInfo()); | |||||
| // final PageInfo<WxMerchantMicroPayVo> page = markingDataReportService.listMerchantMicroPayOrderReportByDate(wxOrderReportDto, pageNum, pageSize); | |||||
| // return new ResultData(page); | |||||
| // } | |||||
| @ApiOperation("获得昨日刷卡列表") | |||||
| @GetMapping("/listYesterday") | |||||
| @SystemControllerLog(description = "收银台-获得昨日刷卡列表") | |||||
| public ResultData listYesterday(@ModelAttribute WxOrderReportDto wxOrderReportDto, Integer pageNum, Integer pageSize) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMerchantTradeDailyController::listYesterday"); | |||||
| if (wxOrderReportDto == null) | |||||
| wxOrderReportDto = new WxOrderReportDto(); | |||||
| wxOrderReportDto.updateTenantInfo(getTenantInfo()); | |||||
| final PageInfo<WxMerchantMicroPayVo> page = markingDataReportService.listMerchantMicroPayOrderReportByDate(wxOrderReportDto, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| } | } | ||||
| @@ -6,6 +6,7 @@ import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | import lombok.ToString; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | |||||
| /** | /** | ||||
| * Created by syf on 2018/8/30. | * Created by syf on 2018/8/30. | ||||
| @@ -21,4 +22,6 @@ public class WxOrderReportDto extends TenantEntity { | |||||
| private Integer type; | private Integer type; | ||||
| private Integer orderStatus; | private Integer orderStatus; | ||||
| private List<Long> merchantIds; | |||||
| } | } | ||||
| @@ -43,7 +43,7 @@ public interface WxOrderMapper extends CommonMapper<WxOrder, Long> { | |||||
| List<WxOrderReportVo> listMicroPayOrderReportByDateAndMerchant(HashMap<String,Object> params); | List<WxOrderReportVo> listMicroPayOrderReportByDateAndMerchant(HashMap<String,Object> params); | ||||
| //List<WxMerchantMicroPayVo> findListOfMerchantMicroPayOrderByDate(@Param("wxOrderReportDto") WxOrderReportDto wxOrderReportDto, @Param("tenantEntitys")List<TenantEntity> tenantEntitys); | |||||
| List<WxMerchantMicroPayVo> findListOfMerchantMicroPayOrderByDate(WxOrderReportDto wxOrderReportDto); | |||||
| List<WxOrder> findListOrder(WxOrderQueryVo record); | List<WxOrder> findListOrder(WxOrderQueryVo record); | ||||
| @@ -35,7 +35,7 @@ public interface MarkingDataReportService { | |||||
| List<WxOrderReportVo> listMicroPayOrderReportByDateAndMerchant(WxOrderReportDto wxOrderReportDto); | List<WxOrderReportVo> listMicroPayOrderReportByDateAndMerchant(WxOrderReportDto wxOrderReportDto); | ||||
| //PageInfo<WxMerchantMicroPayVo> listMerchantMicroPayOrderReportByDate(WxOrderReportDto wxOrderReportDto,Integer pageNum, Integer pageSize); | |||||
| PageInfo<WxMerchantMicroPayVo> listMerchantMicroPayOrderReportByDate(WxOrderReportDto wxOrderReportDto,Integer pageNum, Integer pageSize); | |||||
| void exportTouchUsersData(HttpServletRequest request, HttpServletResponse response, MarkingCouponDataReportDto markingCouponDataReportDto); | void exportTouchUsersData(HttpServletRequest request, HttpServletResponse response, MarkingCouponDataReportDto markingCouponDataReportDto); | ||||
| @@ -7,13 +7,11 @@ import com.iformall.domain.dto.MarkingCouponDataReportDto; | |||||
| import com.iformall.domain.dto.WxOrderReportDto; | import com.iformall.domain.dto.WxOrderReportDto; | ||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.domain.po.WxCouponOrder; | import com.iformall.domain.po.WxCouponOrder; | ||||
| import com.iformall.domain.po.WxMerchant; | |||||
| import com.iformall.domain.po.WxMerchantBUser; | import com.iformall.domain.po.WxMerchantBUser; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.*; | import com.iformall.domain.vo.*; | ||||
| import com.iformall.enums.EnumCarCmd; | |||||
| import com.iformall.enums.EnumCouponSendSendType; | |||||
| import com.iformall.enums.EnumCouponType; | |||||
| import com.iformall.enums.EnumOrderType; | |||||
| import com.iformall.enums.*; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.ExcelService; | import com.iformall.service.ExcelService; | ||||
| @@ -31,6 +29,7 @@ import org.springframework.stereotype.Service; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.text.NumberFormat; | import java.text.NumberFormat; | ||||
| import java.text.SimpleDateFormat; | |||||
| import java.time.LocalDate; | import java.time.LocalDate; | ||||
| import java.util.*; | import java.util.*; | ||||
| import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
| @@ -62,6 +61,8 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||||
| @Autowired | @Autowired | ||||
| WxMerchantBUserMapper wxMerchantBUserMapper; | WxMerchantBUserMapper wxMerchantBUserMapper; | ||||
| @Autowired | |||||
| WxMerchantMapper wxMerchantMapper; | |||||
| @Lazy | @Lazy | ||||
| @Autowired | @Autowired | ||||
| @@ -744,24 +745,59 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||||
| return wxOrderReportVoList; | return wxOrderReportVoList; | ||||
| } | } | ||||
| // @Override | |||||
| // public PageInfo<WxMerchantMicroPayVo> listMerchantMicroPayOrderReportByDate(WxOrderReportDto wxOrderReportDto,Integer pageIndex, Integer pageSize) { | |||||
| /** | |||||
| * 查前一天收银记录(门店) | |||||
| * @param wxOrderReportDto | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | |||||
| */ | |||||
| @Override | |||||
| public PageInfo<WxMerchantMicroPayVo> listMerchantMicroPayOrderReportByDate(WxOrderReportDto wxOrderReportDto,Integer pageIndex, Integer pageSize) { | |||||
| // List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(wxOrderReportDto); | // List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(wxOrderReportDto); | ||||
| // if (wxOrderReportDto.getStartTime() != null) { | |||||
| // wxOrderReportDto.setStartTime(convertDateAndAdd(wxOrderReportDto.getStartTime(), 0)); | |||||
| // } else { | |||||
| // wxOrderReportDto.setStartTime(addDay(-1)); | |||||
| // } | |||||
| // if (wxOrderReportDto.getEndTime() != null) { | |||||
| // wxOrderReportDto.setEndTime(convertDateAndAdd(wxOrderReportDto.getStartTime(), 0)); | |||||
| // } else { | |||||
| // wxOrderReportDto.setEndTime(addDay(0)); | |||||
| // } | |||||
| // PageHelper.startPage(pageIndex, pageSize); | |||||
| // List<WxMerchantMicroPayVo> list = wxOrderMapper.findListOfMerchantMicroPayOrderByDate(wxOrderReportDto,tenantEntitys); | |||||
| // | |||||
| // return new PageInfo<>(list); | |||||
| // } | |||||
| WxMerchant merchantQ1 = new WxMerchant(); | |||||
| merchantQ1.updateTenantInfo(wxOrderReportDto); | |||||
| merchantQ1.setName(wxOrderReportDto.getMerchantName()); | |||||
| merchantQ1.setStatus(EnumMerchantStatus.VALID.getCode()); | |||||
| List<Long> merchantIdList = wxMerchantMapper.findIdList(merchantQ1); | |||||
| if (null == merchantIdList || merchantIdList.size() <= 0) { | |||||
| PageHelper.startPage(pageIndex, pageSize); | |||||
| return new PageInfo<>(new ArrayList<WxMerchantMicroPayVo>()); | |||||
| } | |||||
| wxOrderReportDto.setMerchantIds(merchantIdList); | |||||
| wxOrderReportDto.setStartTime(addDay(-1)); | |||||
| wxOrderReportDto.setEndTime(addDay(0)); | |||||
| PageHelper.startPage(pageIndex, pageSize); | |||||
| List<WxMerchantMicroPayVo> list = wxOrderMapper.findListOfMerchantMicroPayOrderByDate(wxOrderReportDto); | |||||
| if(list != null && list.size() > 0){ | |||||
| List<Long> merchantIds = list.stream().map(WxMerchantMicroPayVo::getId).collect(Collectors.toList()); | |||||
| WxMerchant merchantQ = new WxMerchant(); | |||||
| merchantQ.updateTenantInfo(wxOrderReportDto); | |||||
| merchantQ.setIds(merchantIds); | |||||
| List<WxMerchant> merchantList = wxMerchantMapper.findList(merchantQ); | |||||
| Map<Long,WxMerchant> merchantMap = new HashMap<Long,WxMerchant>(); | |||||
| if (null != merchantList) { | |||||
| for (int i = 0 ; i < merchantList.size() ; i++) { | |||||
| WxMerchant m = merchantList.get(i); | |||||
| if (null != m) { | |||||
| merchantMap.put(m.getId(), m); | |||||
| } | |||||
| } | |||||
| } | |||||
| String reportDate = new SimpleDateFormat("yyyy-MM-dd").format(wxOrderReportDto.getStartTime()); | |||||
| for (WxMerchantMicroPayVo vo:list) { | |||||
| WxMerchant merchant = merchantMap.get(vo.getId()); | |||||
| vo.setTenantId(merchant.getTenantId()); | |||||
| vo.setParentTenantId(merchant.getParentTenantId()); | |||||
| vo.setMerchantName(merchant.getName()); | |||||
| vo.setMerchantPhone(merchant.getLinkPhone()); | |||||
| vo.setReportDate(reportDate); | |||||
| } | |||||
| } | |||||
| return new PageInfo<>(list); | |||||
| } | |||||
| @Override | @Override | ||||
| public void exportTouchUsersData(HttpServletRequest request, HttpServletResponse response, MarkingCouponDataReportDto markingCouponDataReportDto) { | public void exportTouchUsersData(HttpServletRequest request, HttpServletResponse response, MarkingCouponDataReportDto markingCouponDataReportDto) { | ||||
| @@ -711,40 +711,26 @@ | |||||
| wm.link_phone as merchant_phone, | wm.link_phone as merchant_phone, | ||||
| mo.xTime as report_date, | mo.xTime as report_date, | ||||
| (case when mo.amount > 0 then mo.amount else 0 end) trade_amt | (case when mo.amount > 0 then mo.amount else 0 end) trade_amt | ||||
| </sql> | |||||
| </sql> --> | |||||
| <select id="findListOfMerchantMicroPayOrderByDate" parameterType="com.iformall.domain.dto.WxOrderReportDto" resultType="com.iformall.domain.vo.WxMerchantMicroPayVo"> | |||||
| select bu.merchant_id as id, IFNULL(sum(o.payment),0) tradeAmt | |||||
| from wx_order o, wx_merchant_b_user bu | |||||
| where bu.id = o.product_id | |||||
| and o.order_status = 1 | |||||
| and o.type = 1 | |||||
| AND o.create_date > #{startTime} | |||||
| AND o.create_date < #{endTime} | |||||
| <if test=" null != merchantIds "> | |||||
| and bu.merchant_id in | |||||
| <foreach collection="merchantIds" index="index" item="merchantIdItem" open="(" separator="," close=")"> | |||||
| #{merchantIdItem} | |||||
| </foreach> | |||||
| </if> | |||||
| group by id | |||||
| order by tradeAmt desc | |||||
| <select id="findListOfMerchantMicroPayOrderByDate" parameterType="com.iformall.domain.dto.WxOrderReportDto" resultMap="WxMerchantMicroPayVo"> | |||||
| select | |||||
| <include refid="WxMerchantMicroPayColumnsVo"/> | |||||
| from wx_merchant wm | |||||
| left join | |||||
| (select m.id as mid, IFNULL(sum(o.payment),0) amount,DATE_FORMAT(o.create_date,'%Y-%m-%d') xTime | |||||
| from wx_merchant m, | |||||
| (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||||
| SELECT * from wx_order${tenantEntity.shardTableSuffix} | |||||
| </foreach>) o, wx_merchant_b_user bu | |||||
| where bu.id = o.product_id | |||||
| and m.status = 1 | |||||
| and m.id = bu.merchant_id | |||||
| and o.order_status = '1' | |||||
| and o.type = 1 | |||||
| <if test="wxOrderReportDto.startTime != null"> | |||||
| AND o.create_date > #{wxOrderReportDto.startTime} | |||||
| </if> | |||||
| <if test="wxOrderReportDto.endTime != null"> | |||||
| AND o.create_date < #{wxOrderReportDto.endTime} | |||||
| </if> | |||||
| group by m.id,xTime) mo on mo.mid = wm.id | |||||
| where wm.status = 1 | |||||
| <if test=" null != wxOrderReportDto.merchantName"> | |||||
| <if test=" '' != wxOrderReportDto.merchantName"> | |||||
| and wm.name like concat('%', #{wxOrderReportDto.merchantName},'%') | |||||
| </if> | |||||
| </if> | |||||
| <if test=" null != wxOrderReportDto.sortColumns"> order by ${wxOrderReportDto.sortColumns} </if> | |||||
| <if test=" null == wxOrderReportDto.sortColumns"> order by wm.create_date desc </if> | |||||
| </select> --> | |||||
| </select> | |||||
| <resultMap id="orderMap" type="com.iformall.domain.po.WxOrder"> | <resultMap id="orderMap" type="com.iformall.domain.po.WxOrder"> | ||||
| <id column="id" jdbcType="BIGINT" property="id"/> | <id column="id" jdbcType="BIGINT" property="id"/> | ||||
| @@ -1129,13 +1115,15 @@ | |||||
| <select id="getComposeOrderIds" parameterType="com.iformall.domain.po.WxOrder" resultType="Long"> | <select id="getComposeOrderIds" parameterType="com.iformall.domain.po.WxOrder" resultType="Long"> | ||||
| select distinct compose_order_id from wx_order | select distinct compose_order_id from wx_order | ||||
| where parent_order_id = 0 | |||||
| where c_user_id = #{cUserId} | |||||
| and parent_order_id = 0 | |||||
| and (`type` = 0 or `type` = 4) | |||||
| and order_status in (0,1,2,3,4,5) | and order_status in (0,1,2,3,4,5) | ||||
| and `tenant_id` = #{tenantId} | and `tenant_id` = #{tenantId} | ||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | <if test=" null != parentTenantId and '' != parentTenantId"> | ||||
| and `parent_tenant_id` = #{parentTenantId} | and `parent_tenant_id` = #{parentTenantId} | ||||
| </if> | </if> | ||||
| and c_user_id = #{cUserId} | |||||
| <if test="orderStatus != null"> | <if test="orderStatus != null"> | ||||
| AND order_status = #{orderStatus} | AND order_status = #{orderStatus} | ||||
| </if> | </if> | ||||