| @@ -11,8 +11,6 @@ public interface WxMerchantTradeDailyMapper extends CommonMapper<WxMerchantTrade | |||||
| List<WxMerchantTradeDaily> findListOfWeek(WxMerchantTradeDaily wxMerchantTradeDaily); | List<WxMerchantTradeDaily> findListOfWeek(WxMerchantTradeDaily wxMerchantTradeDaily); | ||||
| List<WxMerchantTradeDailyVo> findVoList(WxMerchantTradeDaily wxMerchantTradeDaily); | |||||
| List<WxMerchantTradeDaily> findTotalListOfMonth(WxMerchantTradeDaily wxMerchantTradeDaily); | List<WxMerchantTradeDaily> findTotalListOfMonth(WxMerchantTradeDaily wxMerchantTradeDaily); | ||||
| String findSumMoney(WxMerchantTradeDaily wxMerchantTradeDaily); | String findSumMoney(WxMerchantTradeDaily wxMerchantTradeDaily); | ||||
| @@ -645,6 +645,8 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| } else { | } else { | ||||
| //wxCreditHistoryMapper.updateById(record); | //wxCreditHistoryMapper.updateById(record); | ||||
| } | } | ||||
| }else { | |||||
| record.setCreditNum(0); | |||||
| } | } | ||||
| return record; | return record; | ||||
| } | } | ||||
| @@ -827,6 +829,12 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| return infoAddCredit(record,tenantEntity); | return infoAddCredit(record,tenantEntity); | ||||
| } | } | ||||
| if (record.getCreditType() == EnumScoreType.SPEND_CREDIT.getCode()) { | if (record.getCreditType() == EnumScoreType.SPEND_CREDIT.getCode()) { | ||||
| WxMerchant wxMerchant = wxMerchantMapper.selectById(record.getMerchantId()); | |||||
| if(wxMerchant == null){ | |||||
| throw new MallinkException(ErrorCode.SHOP_IS_NOT_FOUND); | |||||
| } | |||||
| record.setCreditType(EnumScoreType.SPEND_CREDIT.getCode()); | |||||
| record.setBusinessId(wxMerchant.getBusinessId()); | |||||
| return payAddCredit(record,tenantEntity,wxCUserBasicInfo,hasBirthDateCredit); | return payAddCredit(record,tenantEntity,wxCUserBasicInfo,hasBirthDateCredit); | ||||
| } | } | ||||
| if (record.getCreditType() == EnumScoreType.CHANGE_CREDIT.getCode()) { | if (record.getCreditType() == EnumScoreType.CHANGE_CREDIT.getCode()) { | ||||
| @@ -14,6 +14,7 @@ import com.iformall.domain.po.WxMerchantBUser; | |||||
| import com.iformall.domain.po.WxMerchantTradeDaily; | import com.iformall.domain.po.WxMerchantTradeDaily; | ||||
| import com.iformall.domain.po.WxMerchantTradeDailyHistory; | import com.iformall.domain.po.WxMerchantTradeDailyHistory; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.WxCouponOrderBVo; | |||||
| import com.iformall.domain.vo.WxMerchantTradeDailyVo; | import com.iformall.domain.vo.WxMerchantTradeDailyVo; | ||||
| import com.iformall.enums.EnumTradeDailyDateType; | import com.iformall.enums.EnumTradeDailyDateType; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| @@ -145,7 +146,16 @@ public class WxMerchantTradeDailyServiceImpl implements WxMerchantTradeDailyServ | |||||
| @Override | @Override | ||||
| public PageInfo<WxMerchantTradeDailyVo> listAsPageVo(WxMerchantTradeDaily record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxMerchantTradeDailyVo> listAsPageVo(WxMerchantTradeDaily record, Integer pageIndex, Integer pageSize) { | ||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantTradeDailyMapper.findVoList(record)); | |||||
| // PageInfo<WxMerchantTradeDaily> tradeDailyPage = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantTradeDailyMapper.findList(record)); | |||||
| // PageInfo<WxCouponOrderBVo> retPageInfo = new PageInfo(); | |||||
| // retPageInfo.setPageNum(pageIndex); | |||||
| // retPageInfo.setPageSize(pageSize); | |||||
| // retPageInfo.setPages(pageInfo.getPages()); | |||||
| // retPageInfo.setTotal(pageInfo.getTotal()); | |||||
| // retPageInfo.setList(handleQueryResult(false,pageInfo.getList(), wxCouponOrderBVo)); | |||||
| // | |||||
| // return new ResultData(retPageInfo); | |||||
| return null; | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -273,22 +283,29 @@ public class WxMerchantTradeDailyServiceImpl implements WxMerchantTradeDailyServ | |||||
| @Override | @Override | ||||
| public void exportData(WxMerchantTradeDaily tradeDaily, HttpServletRequest request, HttpServletResponse response) { | public void exportData(WxMerchantTradeDaily tradeDaily, HttpServletRequest request, HttpServletResponse response) { | ||||
| //没有商户ID导出全部数据 | //没有商户ID导出全部数据 | ||||
| List<WxMerchantTradeDailyVo> list = wxMerchantTradeDailyMapper.findVoList(tradeDaily); | |||||
| list.stream().forEach(m -> { | |||||
| //商铺信息 | |||||
| m.setShopVos(wxShopService.findMerchantShopVoList(m,m.getMerchantId())); | |||||
| }); | |||||
| //商铺信息 | |||||
| PageInfo<WxMerchantTradeDailyVo> page = listAsPageVo(tradeDaily,1,10000); | |||||
| List<WxMerchantTradeDailyVo> list = new ArrayList<WxMerchantTradeDailyVo>(); | |||||
| if (null != page && null != page.getList()) { | |||||
| list = page.getList(); | |||||
| list.stream().forEach(m -> { | |||||
| //商铺信息 | |||||
| m.setShopVos(wxShopService.findMerchantShopVoList(m,m.getMerchantId())); | |||||
| }); | |||||
| //商铺信息 | |||||
| } | |||||
| excelService.exportExcel(list, "商户解单数据", "商户解单数据", WxMerchantTradeDailyVo.class, "商户解单数据.xlsx", response, false); | excelService.exportExcel(list, "商户解单数据", "商户解单数据", WxMerchantTradeDailyVo.class, "商户解单数据.xlsx", response, false); | ||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData summary(WxMerchantTradeDaily record) { | public ResultData summary(WxMerchantTradeDaily record) { | ||||
| List<WxMerchantTradeDailyVo> voList = wxMerchantTradeDailyMapper.findVoList(record); | |||||
| Integer tradeAmt = voList.stream().collect(Collectors.summingInt(WxMerchantTradeDailyVo::getTradeAmt)); | |||||
| Integer tradeCount = voList.stream().collect(Collectors.summingInt(WxMerchantTradeDailyVo::getTradeCount)); | |||||
| PageInfo<WxMerchantTradeDailyVo> page = listAsPageVo(record,1,10000); | |||||
| Integer tradeAmt = 0; | |||||
| Integer tradeCount = 0; | |||||
| if (null != page && null != page.getList()) { | |||||
| List<WxMerchantTradeDailyVo> voList = page.getList(); | |||||
| tradeAmt = voList.stream().collect(Collectors.summingInt(WxMerchantTradeDailyVo::getTradeAmt)); | |||||
| tradeCount = voList.stream().collect(Collectors.summingInt(WxMerchantTradeDailyVo::getTradeCount)); | |||||
| } | |||||
| Map<String, Object> data = new HashMap<>(); | Map<String, Object> data = new HashMap<>(); | ||||
| data.put("tradeAmt", tradeAmt); | data.put("tradeAmt", tradeAmt); | ||||
| data.put("tradeCount", tradeCount); | data.put("tradeCount", tradeCount); | ||||
| @@ -323,7 +340,11 @@ public class WxMerchantTradeDailyServiceImpl implements WxMerchantTradeDailyServ | |||||
| String endTime = DateUtils.getSystemTime("yyyy-MM-dd"); | String endTime = DateUtils.getSystemTime("yyyy-MM-dd"); | ||||
| wxMerchantTradeDaily.setStartTime(startTime); | wxMerchantTradeDaily.setStartTime(startTime); | ||||
| wxMerchantTradeDaily.setEndTime(endTime); | wxMerchantTradeDaily.setEndTime(endTime); | ||||
| List<WxMerchantTradeDailyVo> recordList = wxMerchantTradeDailyMapper.findVoList(wxMerchantTradeDaily); | |||||
| PageInfo<WxMerchantTradeDailyVo> page = listAsPageVo(wxMerchantTradeDaily,1,10000); | |||||
| List<WxMerchantTradeDailyVo> recordList = new ArrayList<WxMerchantTradeDailyVo>(); | |||||
| if (null != page && null != page.getList()) { | |||||
| recordList = page.getList(); | |||||
| } | |||||
| Map<String, WxMerchantTradeDailyVo> recordMap = recordList.stream().collect(Collectors.toMap(WxMerchantTradeDailyVo::getReportDate, r -> r)); | Map<String, WxMerchantTradeDailyVo> recordMap = recordList.stream().collect(Collectors.toMap(WxMerchantTradeDailyVo::getReportDate, r -> r)); | ||||
| List<WxMerchantTradeDailyVo> tradeList = new ArrayList<>(); | List<WxMerchantTradeDailyVo> tradeList = new ArrayList<>(); | ||||
| @@ -115,89 +115,6 @@ | |||||
| order by create_date desc LIMIT 7 | order by create_date desc LIMIT 7 | ||||
| </select> | </select> | ||||
| <resultMap id="BaseResultMapVo" type="com.iformall.domain.vo.WxMerchantTradeDailyVo"> | |||||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||||
| <result column="b_user_id" jdbcType="BIGINT" property="bUserId" /> | |||||
| <result column="trade_amt" jdbcType="DECIMAL" property="tradeAmt" /> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||||
| <result column="report_date" jdbcType="VARCHAR" property="reportDate" /> | |||||
| <result column="trade_count" property="tradeCount" /> | |||||
| <result column="proof" property="proof"/> | |||||
| <result column="merchant_name" jdbcType="VARCHAR" property="merchantName" /> | |||||
| <result column="business_id" jdbcType="VARCHAR" property="businessId" /> | |||||
| <result column="sub_business_id" jdbcType="VARCHAR" property="subBusinessId" /> | |||||
| <result column="b_user_name" jdbcType="VARCHAR" property="bUserName" /> | |||||
| <result column="b_user_phone" jdbcType="VARCHAR" property="bUserPhone"/> | |||||
| </resultMap> | |||||
| <sql id="allColumnsVo"> | |||||
| mtd.id as id, mtd.b_user_id as b_user_id, ifnull(mtd.trade_amt,0) as trade_amt, mtd.report_date, | |||||
| ifnull(mtd.trade_count,0) as trade_count, mtd.proof,mtd.create_date as create_date, mtd.update_date as update_date, | |||||
| m.tenant_id as tenant_id,m.parent_tenant_id as parent_tenant_id, | |||||
| m.id as merchant_id, m.name as merchant_name, m.business_id, m.sub_business_id, | |||||
| mbu.name as b_user_name, mbu.phone as b_user_phone | |||||
| </sql> | |||||
| <select id="findVoList" parameterType="com.iformall.domain.po.WxMerchantTradeDaily" resultMap="BaseResultMapVo"> | |||||
| select | |||||
| <include refid="allColumnsVo"/> | |||||
| from wx_merchant_trade_daily mtd | |||||
| inner join wx_merchant m on mtd.merchant_id = m.id | |||||
| left join wx_merchant_b_user mbu on mtd.b_user_id = mbu.id | |||||
| where 1 = 1 | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and mtd.`tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and mtd.`parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and mtd.merchant_id = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != merchantName and ''!=merchantName"> | |||||
| and m.name like concat('%', #{merchantName},'%') | |||||
| </if> | |||||
| <if test=" null != startTime and null != endTime"> | |||||
| and mtd.report_date >= date_format(#{startTime},'%Y-%m-%d') | |||||
| and mtd.report_date <= date_format(#{endTime},'%Y-%m-%d') | |||||
| </if> | |||||
| <if test="(null != floorForRule and '' != floorForRule) or (null != businessForRule and '' != businessForRule)"> | |||||
| and mtd.merchant_id in( | |||||
| select ms.merchant_id from (select merchant_id,shop_id from wx_merchant_shop where is_del=0) ms | |||||
| inner join wx_merchant m on ms.merchant_id = m.id | |||||
| inner join wx_shop s on s.id=ms.shop_id | |||||
| where s.is_del=0 | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and m.`tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and m.`parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != businessForRule and '' != businessForRule "> | |||||
| and m.business_id in (${businessForRule}) | |||||
| </if> | |||||
| <if test=" null != floorForRule and '' != floorForRule "> | |||||
| and s.`floor` in (${floorForRule}) | |||||
| </if> | |||||
| ) | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||||
| </select> | |||||
| <select id="findSumMoney" parameterType="com.iformall.domain.po.WxMerchantTradeDaily" resultType="String"> | <select id="findSumMoney" parameterType="com.iformall.domain.po.WxMerchantTradeDaily" resultType="String"> | ||||
| select IFNULL(sum(mtd.trade_amt),0) | select IFNULL(sum(mtd.trade_amt),0) | ||||
| from wx_merchant_trade_daily mtd | from wx_merchant_trade_daily mtd | ||||