瀏覽代碼

消耗预警

yumeng 5 年之前
父節點
當前提交
d75aed403d

+ 0 - 248
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MailLogController.java

@@ -1,248 +0,0 @@
-package org.jeecg.modules.ctop.controller;
-
-import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.aspect.annotation.AutoLog;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecg.modules.ctop.entity.MailLog;
-import org.jeecg.modules.ctop.service.IMailLogService;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 邮箱记录表
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2019-12-08
- */
-@Slf4j
-@Api(tags = "邮箱记录表")
-@RestController
-@RequestMapping("/top/mailLog")
-public class MailLogController {
-    @Autowired
-    private IMailLogService mailLogService;
-
-    /**
-     * 分页列表查询
-     *
-     * @param mailLog
-     * @param pageNo
-     * @param pageSize
-     * @param req
-     * @return
-     */
-    @AutoLog(value = "邮箱记录表-分页列表查询")
-    @ApiOperation(value = "邮箱记录表-分页列表查询", notes = "邮箱记录表-分页列表查询")
-    @GetMapping(value = "/list")
-    public Result<IPage<MailLog>> queryPageList(MailLog mailLog,
-                                                @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-                                                @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
-                                                HttpServletRequest req) {
-        Result<IPage<MailLog>> result = new Result<IPage<MailLog>>();
-        QueryWrapper<MailLog> queryWrapper = QueryGenerator.initQueryWrapper(mailLog, req.getParameterMap());
-        Page<MailLog> page = new Page<MailLog>(pageNo, pageSize);
-        IPage<MailLog> pageList = mailLogService.page(page, queryWrapper);
-        result.setSuccess(true);
-        result.setResult(pageList);
-        return result;
-    }
-
-    /**
-     * 添加
-     *
-     * @param mailLog
-     * @return
-     */
-    @AutoLog(value = "邮箱记录表-添加")
-    @ApiOperation(value = "邮箱记录表-添加", notes = "邮箱记录表-添加")
-    @PostMapping(value = "/add")
-    public Result<MailLog> add(@RequestBody MailLog mailLog) {
-        Result<MailLog> result = new Result<MailLog>();
-        try {
-            mailLogService.save(mailLog);
-            result.success("添加成功!");
-        } catch (Exception e) {
-            log.error(e.getMessage(), e);
-            result.error500("操作失败");
-        }
-        return result;
-    }
-
-    /**
-     * 编辑
-     *
-     * @param mailLog
-     * @return
-     */
-    @AutoLog(value = "邮箱记录表-编辑")
-    @ApiOperation(value = "邮箱记录表-编辑", notes = "邮箱记录表-编辑")
-    @PutMapping(value = "/edit")
-    public Result<MailLog> edit(@RequestBody MailLog mailLog) {
-        Result<MailLog> result = new Result<MailLog>();
-        MailLog mailLogEntity = mailLogService.getById(mailLog.getId());
-        if (mailLogEntity == null) {
-            result.error500("未找到对应实体");
-        } else {
-            boolean ok = mailLogService.updateById(mailLog);
-            if (ok) {
-                result.success("修改成功!");
-            }
-        }
-
-        return result;
-    }
-
-    /**
-     * 通过id删除
-     *
-     * @param id
-     * @return
-     */
-    @AutoLog(value = "邮箱记录表-通过id删除")
-    @ApiOperation(value = "邮箱记录表-通过id删除", notes = "邮箱记录表-通过id删除")
-    @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
-        try {
-            mailLogService.removeById(id);
-        } catch (Exception e) {
-            log.error("删除失败", e.getMessage());
-            return Result.error("删除失败!");
-        }
-        return Result.ok("删除成功!");
-    }
-
-    /**
-     * 批量删除
-     *
-     * @param ids
-     * @return
-     */
-    @AutoLog(value = "邮箱记录表-批量删除")
-    @ApiOperation(value = "邮箱记录表-批量删除", notes = "邮箱记录表-批量删除")
-    @DeleteMapping(value = "/deleteBatch")
-    public Result<MailLog> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<MailLog> result = new Result<MailLog>();
-        if (ids == null || "".equals(ids.trim())) {
-            result.error500("参数不识别!");
-        } else {
-            this.mailLogService.removeByIds(Arrays.asList(ids.split(",")));
-            result.success("删除成功!");
-        }
-        return result;
-    }
-
-    /**
-     * 通过id查询
-     *
-     * @param id
-     * @return
-     */
-    @AutoLog(value = "邮箱记录表-通过id查询")
-    @ApiOperation(value = "邮箱记录表-通过id查询", notes = "邮箱记录表-通过id查询")
-    @GetMapping(value = "/queryById")
-    public Result<MailLog> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<MailLog> result = new Result<MailLog>();
-        MailLog mailLog = mailLogService.getById(id);
-        if (mailLog == null) {
-            result.error500("未找到对应实体");
-        } else {
-            result.setResult(mailLog);
-            result.setSuccess(true);
-        }
-        return result;
-    }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<MailLog> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                MailLog mailLog = JSON.parseObject(deString, MailLog.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(mailLog, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<MailLog> pageList = mailLogService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "邮箱记录表列表");
-        mv.addObject(NormalExcelConstants.CLASS, MailLog.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("邮箱记录表列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<MailLog> listMailLogs = ExcelImportUtil.importExcel(file.getInputStream(), MailLog.class, params);
-                mailLogService.saveBatch(listMailLogs);
-                return Result.ok("文件导入成功!数据行数:" + listMailLogs.size());
-            } catch (Exception e) {
-                log.error(e.getMessage(), e);
-                return Result.error("文件导入失败:" + e.getMessage());
-            } finally {
-                try {
-                    file.getInputStream().close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        return Result.ok("文件导入失败!");
-    }
-
-}

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BidWarningServiceImpl.java

@@ -1,6 +1,8 @@
 package org.jeecg.modules.ctop.service.impl;
 package org.jeecg.modules.ctop.service.impl;
 
 
+import cn.com.ctop.common.module.entity.MailLog;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.mapper.MailLogMapper;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CorpWexinUtils;
 import cn.com.ctop.common.module.utils.CorpWexinUtils;
@@ -10,9 +12,7 @@ import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.DateUtils;
-import org.jeecg.modules.ctop.entity.MailLog;
 import org.jeecg.modules.ctop.entity.Project;
 import org.jeecg.modules.ctop.entity.Project;
-import org.jeecg.modules.ctop.mapper.MailLogMapper;
 import org.jeecg.modules.ctop.mapper.ProjectMapper;
 import org.jeecg.modules.ctop.mapper.ProjectMapper;
 import org.jeecg.modules.ctop.service.IBidWarningService;
 import org.jeecg.modules.ctop.service.IBidWarningService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/MailLog.java

@@ -1,4 +1,4 @@
-package org.jeecg.modules.ctop.entity;
+package cn.com.ctop.common.module.entity;
 
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableId;

+ 13 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/UserAllocation.java

@@ -12,6 +12,7 @@ import lombok.experimental.Accessors;
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.format.annotation.DateTimeFormat;
 
 
+import java.math.BigDecimal;
 import java.util.Date;
 import java.util.Date;
 
 
 /**
 /**
@@ -81,6 +82,18 @@ public class UserAllocation {
     @Excel(name = "输入账号  --登陆", width = 15)
     @Excel(name = "输入账号  --登陆", width = 15)
     @ApiModelProperty(value = "输入账号  --登陆")
     @ApiModelProperty(value = "输入账号  --登陆")
     private String accountName;
     private String accountName;
+
+
+    /**
+     * 预警 金额
+     */
+    private BigDecimal warningAmount;
+
+    /**
+     * 预警 比例
+     */
+    private BigDecimal warningProportion;
+
     /**
     /**
      * 创建时间
      * 创建时间
      */
      */

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/MailLogMapper.java

@@ -1,8 +1,8 @@
-package org.jeecg.modules.ctop.mapper;
+package cn.com.ctop.common.module.mapper;
 
 
+import cn.com.ctop.common.module.entity.MailLog;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
-import org.jeecg.modules.ctop.entity.MailLog;
 
 
 import java.util.List;
 import java.util.List;
 
 

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/MailLogMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="org.jeecg.modules.ctop.mapper.MailLogMapper">
+<mapper namespace="cn.com.ctop.common.module.mapper.MailLogMapper">
 
 
 
 
     <select id="selectCountByAccountIdAndDate" resultType="java.lang.Integer">
     <select id="selectCountByAccountIdAndDate" resultType="java.lang.Integer">

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IMailLogService.java

@@ -1,7 +1,7 @@
-package org.jeecg.modules.ctop.service;
+package cn.com.ctop.common.module.service;
 
 
+import cn.com.ctop.common.module.entity.MailLog;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
-import org.jeecg.modules.ctop.entity.MailLog;
 
 
 /**
 /**
  * 邮箱记录表
  * 邮箱记录表

+ 4 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/MailLogServiceImpl.java

@@ -1,9 +1,9 @@
-package org.jeecg.modules.ctop.service.impl;
+package cn.com.ctop.common.module.service.impl;
 
 
+import cn.com.ctop.common.module.entity.MailLog;
+import cn.com.ctop.common.module.mapper.MailLogMapper;
+import cn.com.ctop.common.module.service.IMailLogService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.jeecg.modules.ctop.entity.MailLog;
-import org.jeecg.modules.ctop.mapper.MailLogMapper;
-import org.jeecg.modules.ctop.service.IMailLogService;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 /**
 /**

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IAccountWarningService.java

@@ -0,0 +1,5 @@
+package cn.com.ctop.kuaishou.modules.batch.service;
+
+public interface IAccountWarningService {
+    void accountWarning(Long account);
+}

+ 120 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/AccountWarningServiceImpl.java

@@ -0,0 +1,120 @@
+package cn.com.ctop.kuaishou.modules.batch.service.impl;
+
+import cn.com.ctop.common.module.entity.MailLog;
+import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.mapper.MailLogMapper;
+import cn.com.ctop.common.module.mapper.UserAllocationMapper;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.CorpWexinUtils;
+import cn.com.ctop.common.module.utils.SendMailUtil;
+import cn.com.ctop.kuaishou.modules.batch.service.IAccountWarningService;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportHourlyAccountMapper;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.List;
+
+@Service
+public class AccountWarningServiceImpl implements IAccountWarningService {
+    @Autowired
+    private KuaishouReportHourlyAccountMapper hourlyAccountMapper;
+    @Autowired
+    private UserAllocationMapper userAllocationMapper;
+    @Autowired
+    private MailLogMapper mailLogMapper;
+
+
+    /**
+     * 账户 出价预警
+     *
+     * @param accountId
+     */
+    @Override
+    public void accountWarning(Long accountId) {
+        try {
+            String statDate = DateUtils.getDate("yyyy-MM-dd");
+
+            Integer maxHour = hourlyAccountMapper.selectMaxHour(accountId, statDate);
+            if (Check.isNull(maxHour) || maxHour == 0) {
+                return;
+            }
+
+            BigDecimal nowCost = hourlyAccountMapper.getNowCost(accountId, maxHour, statDate);
+            if (!Check.isNull(nowCost) && nowCost.compareTo(new BigDecimal(0)) != 0) {
+                BigDecimal lastHourCost = hourlyAccountMapper.getNowCost(accountId, maxHour - 1, statDate);
+
+                if (!Check.isNull(lastHourCost) && lastHourCost.compareTo(new BigDecimal(0)) != 0) {
+                    QueryWrapper<UserAllocation> userAllocationQueryWrapper = new QueryWrapper<>();
+                    userAllocationQueryWrapper.eq("account_id", accountId);
+                    userAllocationQueryWrapper.orderByDesc("create_time");
+                    userAllocationQueryWrapper.last("limit 1");
+                    UserAllocation userAllocation = userAllocationMapper.selectOne(userAllocationQueryWrapper);
+                    if (!Check.isNull(userAllocation)) {
+                        BigDecimal warningAmount = userAllocation.getWarningAmount();
+                        BigDecimal warningProportion = userAllocation.getWarningProportion();
+
+                        BigDecimal subtract = nowCost.subtract(lastHourCost);
+                        BigDecimal divide = nowCost.divide(lastHourCost, 2, RoundingMode.HALF_UP);
+                        if (subtract.compareTo(warningAmount) > -1 && divide.compareTo(warningProportion) > -1) {
+
+                        }
+
+
+                    }
+
+                }
+
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+
+    }
+
+
+    private void sendMessage(Long accountId, Long projectId, String projectName, String authName, List<String> unitWarning, Long maxBid) {
+
+        String createTime = DateUtils.getNowDate("yyyy-MM-dd");
+        Integer count = mailLogMapper.selectCountByAccountIdAndDate(accountId, createTime);
+        StringBuilder text = new StringBuilder();
+
+
+        String s = "";
+        for (int i = 0; i < unitWarning.size(); i++) {
+            s += unitWarning.get(i) + "," + "<br/>";
+
+        }
+        text.append("您的项目:").append(projectName + ",").append("<br/>")
+                .append("授权名称为:" + authName + " 下的,").append("<br/>").append(s)
+                .append("大于项目设置的最高出价:").append(maxBid / 1000).append(" 元! 请您及时调整。");
+        if (count < 3) {
+            List<String> mailList = mailLogMapper.selectMailList(projectId);
+            String subject = "广告组出价预警";
+            try {
+                SendMailUtil.sendMail(mailList, subject, text.toString());
+                MailLog mailLog = new MailLog();
+                mailLog.setAccountId(accountId);
+                mailLog.setContent(text.toString());
+                mailLog.setSendEmil(JSON.toJSONString(mailList));
+                mailLog.setSubject(subject);
+                mailLogMapper.insert(mailLog);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+
+        List<String> wexinIds = mailLogMapper.selectWeiXinIdList(projectId);
+        CorpWexinUtils.sendMessage(wexinIds, text.toString());
+
+
+    }
+
+
+}

+ 6 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -104,6 +104,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     @Autowired
     @Autowired
     private KuaiShouAdvertiserBaseInfoMapper advertiserBaseInfoMapper;
     private KuaiShouAdvertiserBaseInfoMapper advertiserBaseInfoMapper;
 
 
+    @Autowired
+    private IAccountWarningService accountWarningService;
+
     @Override
     @Override
     public void getAdvertiserReportHourly(CtopOauthToken token, Date startDate, Date endDate) {
     public void getAdvertiserReportHourly(CtopOauthToken token, Date startDate, Date endDate) {
         getAdvertiserReportHourlyByPage(token, startDate, endDate, 1);
         getAdvertiserReportHourlyByPage(token, startDate, endDate, 1);
@@ -147,6 +150,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             kuaishouReportHourlyAccount.setUpdateTime(new Date());
             kuaishouReportHourlyAccount.setUpdateTime(new Date());
             hourlyAccountService.saveOrUpdate(kuaishouReportHourlyAccount);
             hourlyAccountService.saveOrUpdate(kuaishouReportHourlyAccount);
         }
         }
+
+        accountWarningService.accountWarning(token.getAccountId());
+
     }
     }
 
 
     /**
     /**

+ 6 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportHourlyAccountMapper.java

@@ -2,6 +2,12 @@ package cn.com.ctop.kuaishou.modules.report.mapper;
 
 
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyAccount;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyAccount;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
 
 
 public interface KuaishouReportHourlyAccountMapper extends BaseMapper<KuaishouReportHourlyAccount> {
 public interface KuaishouReportHourlyAccountMapper extends BaseMapper<KuaishouReportHourlyAccount> {
+    Integer selectMaxHour(@Param("accountId") Long accountId, @Param("statDate") String statDate);
+
+    BigDecimal getNowCost(@Param("accountId") Long accountId, @Param("statHour") Integer statHour, @Param("statDate") String statDate);
 }
 }

+ 20 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportHourlyAccountMapper.xml

@@ -2,4 +2,24 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportHourlyAccountMapper">
 <mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportHourlyAccountMapper">
 
 
+    <select id="selectMaxHour" resultType="java.lang.Integer">
+        select max(stat_hour)
+        from
+        ctop_kuaishou_report_hourly_account
+        where accountId = #{accounId}
+        and stat_date = #{statDate}
+
+    </select>
+
+    <select id="getNowCost" resultType="java.math.BigDecimal">
+        select charge
+        from
+        ctop_kuaishou_report_hourly_account
+        where
+        account_id = #{accountId}
+        and stat_date = #{statDate}
+        and stat_hour = #{statHour}
+
+    </select>
+
 </mapper>
 </mapper>