Authored by Zhang

<SRS> add api.

package com.yoho.unions.channel.restapi;
import com.yoho.service.model.union.request.AddGDTActualCostRequestVO;
import com.yoho.unions.common.ApiResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* Created by yoho on 2017/4/27.
*/
@Controller
@RequestMapping("/channel")
public class ChannelReportFormRest {
static Logger logger = LoggerFactory.getLogger(ChannelBlackListRest.class);
@RequestMapping("/addActualCostForGDT")
@ResponseBody
public ApiResponse addActualCostForGDT(AddGDTActualCostRequestVO requestVO){
logger.info("enter queryBlackList. param channelBlackListRequestBO={}", channelBlackListRequestBO);
try {
channelBlackListService.queryBlackList(channelBlackListRequestBO);
return new ApiResponse.ApiResponseBuilder().code(200).message("成功").data(pageBlackListRspBO).build();
} catch (Exception e) {
logger.warn("queryBlackList occurs Exception e {}",e.getMessage());
return new ApiResponse.ApiResponseBuilder().code(500).message("失败").build();
}
}
}
... ...
package com.yoho.unions.channel.service;
import com.yoho.service.model.union.request.AddGDTActualCostRequestVO;
import com.yoho.unions.dal.IChannelReportFormDAO;
import com.yoho.unions.dal.model.ChannelReportForm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Created by yoho on 2017/4/27.
*/
@Service
public class ChannelReportFormServiceImpl implements IChannelReportFormService {
static Logger logger = LoggerFactory.getLogger(ChannelReportFormServiceImpl.class);
@Autowired
private IChannelReportFormDAO channelReportFormDAO;
@Override
public void addGDTActualCost(AddGDTActualCostRequestVO requestVO) {
ChannelReportForm channelReportForm = new ChannelReportForm();
}
}
... ...
package com.yoho.unions.channel.service;
import com.yoho.service.model.union.request.AddGDTActualCostRequestVO;
/**
* Created by yoho on 2017/4/27.
*/
public interface IChannelReportFormService {
void addGDTActualCost(AddGDTActualCostRequestVO requestVO);
}
... ...
package com.yoho.unions.dal;
import com.yoho.service.model.union.request.AddGDTActualCostRequestVO;
/**
* Created by yoho on 2017/4/27.
*/
public interface IChannelReportFormDAO {
void insertSelective(AddGDTActualCostRequestVO requestVO);
}
... ...
package com.yoho.unions.dal.model;
import lombok.Data;
import lombok.ToString;
import java.math.BigDecimal;
/**
* Created by yoho on 2017/4/27.
*/
@Data
@ToString
public class ChannelReportForm {
private Integer id;
//设备类型 1.ios 2.Android
private Integer appKey;
//实际费用
private BigDecimal actualCost;
//费用开始时间
private Integer beginTime;
//费用结束时间
private Integer endTime;
//用户ID
private Integer uid;
}
... ...
<?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" >
<mapper namespace="com.yoho.unions.dal.IChannelReportFormDAO" >
<insert id="insert" parameterType="com.yoho.unions.dal.model.ChannelReportForm" keyProperty="id" useGeneratedKeys="true" >
insert into channel_report_form (id, uid, app_key, channel_code,channel_name,channel_cost,create_time, update_time,
begin_cost_time, end_cost_time
)
values (#{id,jdbcType=INTEGER}, #{uid,jdbcType=INTEGER}, #{appKey,jdbcType=VARCHAR}, #{channelCode,jdbcType=INTEGER}, #{channelName,jdbcTpye=VARCHAR}, #{actualCost,jdbcType=DECIMAL}, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, #{beginTime,jdbcType=INTEGER},#{endTime,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.yoho.unions.dal.model.ChannelReportForm" keyProperty="id" useGeneratedKeys="true">
insert into channel_report_form
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="uid != null" >
uid,
</if>
<if test="appKey != null" >
app_key,
</if>
<if test="channelCode != null" >
channel_code,
</if>
<if test="channelName != null" >
channel_name,
</if>
<if test="actualCost != null" >
channel_cost,
</if>
<if test="beginTime != null" >
begin_cost_time,
</if>
<if test="endTime != null" >
end_cost_time,
</if>
create_time,
update_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="uid != null" >
#{uid,jdbcType=VARCHAR},
</if>
<if test="appKey != null" >
#{appKey,jdbcType=VARCHAR},
</if>
<if test="channelCode != null" >
#{channelCode,jdbcType=INTEGER},
</if>
<if test="channelName != null" >
#{channelName,jdbcType=INTEGER},
</if>
<if test="actualCost != null" >
#{actualCost,jdbcType=INTEGER},
</if>
<!--<if test="createTime != null" >-->
<!--#{createTime,jdbcType=INTEGER},-->
<!--</if>-->
<!--<if test="updateTime != null" >-->
<!--#{updateTime,jdbcType=INTEGER},-->
<!--</if>-->
<if test="beginTime != null">
#{beginTime,jdbcType=INTEGER},
</if>
<if test="endTime != null">
#{endTime,jdbcType=INTEGER},
</if>
CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP
</trim>
</insert>
</mapper>
... ...