Authored by csgyoho

渠道号资源功能实现

... ... @@ -2,6 +2,9 @@ package com.yoho.unions.dal;
import com.yoho.unions.dal.model.MktMarketingUrl;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface IMktMarketingUrlDAO {
int deleteByPrimaryKey(Long unionType);
... ... @@ -10,4 +13,5 @@ public interface IMktMarketingUrlDAO {
MktMarketingUrl selectByName(String name);
List<Long> listUnionTypes(@Param("unionType")String unionType,@Param("name")String name,@Param("channelType")String channelType);
}
\ No newline at end of file
... ...
... ... @@ -35,7 +35,7 @@ public interface IUserOrdersDAO {
*/
List<UserOrders> getExistOrderCodes(@Param("list") Set<String> list);
int selectCount(@Param("beginTime") int beginTime,@Param("endTime") int endTime,@Param("orderCode") String orderCode,@Param("unionId") String unionId,@Param("idList") List<String> idList);
int selectCount(@Param("beginTime") int beginTime,@Param("endTime") int endTime,@Param("orderCode") String orderCode,@Param("unionIds") List<Long> unionIds,@Param("idList") List<String> idList);
List<UserOrders> selectUserOrderList(@Param("beginTime") int beginTime,@Param("endTime") int endTime,@Param("orderCode") String orderCode,@Param("unionId") String unionId,@Param("idList") List<String> idList,@Param("startIndex") int startIndex, @Param("pageSize") int pageSize);
List<UserOrders> selectUserOrderList(@Param("beginTime") int beginTime,@Param("endTime") int endTime,@Param("orderCode") String orderCode,@Param("unionIds") List<Long> unionIds,@Param("idList") List<String> idList,@Param("startIndex") int startIndex, @Param("pageSize") int pageSize);
}
\ No newline at end of file
... ...
... ... @@ -29,6 +29,16 @@ public class MktMarketingUrl {
private String landingPageUrl;
private Integer channelType;
public Integer getChannelType() {
return channelType;
}
public void setChannelType(Integer channelType) {
this.channelType = channelType;
}
public String getMktActivityCode() {
return mktActivityCode;
}
... ...
... ... @@ -13,6 +13,16 @@ public class UserOrderDatailBO extends BaseBO {
private String unionName;
private Integer channelType;
public Integer getChannelType() {
return channelType;
}
public void setChannelType(Integer channelType) {
this.channelType = channelType;
}
public Long getOrderCode() {
return orderCode;
}
... ...
... ... @@ -16,10 +16,11 @@
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="mkt_activity_code" property="mktActivityCode" jdbcType="VARCHAR" />
<result column="landing_page_url" property="landingPageUrl" jdbcType="VARCHAR" />
<result column="channel_type" property="channelType" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
union_type, division_code, class_code, channel_code, device_code, dept_id, create_id,
name, src_url, dest_url, status, create_time,mkt_activity_code,landing_page_url
name, src_url, dest_url, status, create_time,mkt_activity_code,landing_page_url,channel_type
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
... ... @@ -37,5 +38,17 @@
delete from mkt_marketing_url
where union_type = #{unionType,jdbcType=BIGINT}
</delete>
<select id="listUnionTypes" resultType="long">
select union_type from mkt_marketing_url where
1=1
<if test="unionType!=null">
and union_type=#{unionType}
</if>
<if test="name!=null">
and name=#{name}
</if>
<if test="channelType!=null">
and channel_type=#{channelType}
</if>
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -352,8 +352,11 @@
<if test="orderCode != 0" >
and order_code = #{orderCode}
</if>
<if test="unionId != null" >
and uid = #{unionId}
<if test="unionIds != null and unionIds.size>0" >
and uid in
<foreach item="item" index="index" collection="unionIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="beginTime != 0" >
and create_time &gt; #{beginTime}
... ... @@ -377,8 +380,11 @@
<if test="orderCode != 0" >
and order_code = #{orderCode}
</if>
<if test="unionId != null" >
and uid = #{unionId}
<if test="unionIds != null and unionIds.size>0" >
and uid in
<foreach item="item" index="index" collection="unionIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="beginTime != 0" >
and create_time &gt; #{beginTime}
... ...
... ... @@ -5,9 +5,6 @@ import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Function;
import com.google.common.collect.Maps;
import com.yoho.error.exception.ServiceException;
import com.yoho.service.model.response.PageResponseBO;
import com.yoho.service.model.union.request.ChannelUserBO;
import com.yoho.service.model.union.request.ChannelUserRequest;
import com.yoho.service.model.union.request.UnionOrderReqBO;
import com.yoho.service.model.union.response.PageUnionOrderRspBO;
import com.yoho.service.model.union.response.UnionOrderRspBO;
... ... @@ -20,13 +17,10 @@ import com.yoho.unions.common.utils.DateUtil;
import com.yoho.unions.dal.*;
import com.yoho.unions.dal.model.*;
import com.yoho.unions.server.service.IUserOrdersService;
import com.yoho.unions.vo.OrderInfo;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -69,26 +63,21 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport
long orderCode = StringUtils.isBlank(reqBO.getOrderCode()) ? 0 : Long.valueOf(reqBO.getOrderCode());
String unionId = StringUtils.isBlank(reqBO.getUnionId()) ? null : reqBO.getUnionId();
String unionType = StringUtils.isBlank(reqBO.getUnionType()) ? null : reqBO.getUnionType();
String channelType=StringUtils.isBlank(reqBO.getChannelType()) ? null : reqBO.getChannelType();
List<String> idList = new ArrayList<>();
if (StringUtils.isNotBlank(reqBO.getIds())) {
String[] ids = StringUtils.isBlank(reqBO.getIds()) ? null : reqBO.getIds().split(",");
idList = Arrays.asList(ids);
}
if (StringUtils.isNotEmpty(unionType)) {
MktMarketingUrl mktMarketingUrl = mktMarketingUrlDAO.selectByName(unionType);
if (null != mktMarketingUrl) {
String mktMarkeringUnionId = String.valueOf(mktMarketingUrl.getUnionType());
if (StringUtils.isEmpty(unionId)) {
unionId = mktMarkeringUnionId;
}
if (StringUtils.isNotEmpty(unionId) && !unionId.equals(mktMarkeringUnionId)) {
return null;
}
List<Long> unionTypes=null;
if(unionId!=null||unionType!=null||channelType!=null){
unionTypes=this.mktMarketingUrlDAO.listUnionTypes(unionId,unionType,channelType);
if (unionTypes.isEmpty()) {
return null;
}
}
//查询总数
int count = userOrdersDAO.selectCount(beginTime, endTime, String.valueOf(orderCode), unionId, idList);
int count = userOrdersDAO.selectCount(beginTime, endTime, String.valueOf(orderCode), unionTypes, idList);
logger.info("userOrdersDAO.selectCount: size is {}", count);
List<UserOrders> userOrdersList = new ArrayList<>();
List<UnionOrderRspBO> unionOrderRspBOList = new ArrayList<>();
... ... @@ -96,7 +85,7 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport
return null;
}
if (count > 0) {
userOrdersList = userOrdersDAO.selectUserOrderList(beginTime, endTime, String.valueOf(orderCode), unionId, idList, reqBO.getStart(), reqBO.getSize());
userOrdersList = userOrdersDAO.selectUserOrderList(beginTime, endTime, String.valueOf(orderCode), unionTypes, idList, reqBO.getStart(), reqBO.getSize());
}
List<OrdersDetailBO> ordersDetailBOList = new ArrayList<>();
List<Long> orderCodeList = new ArrayList<>();
... ... @@ -112,6 +101,7 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport
}
if (mktMarketingUrl != null) {
userOrderDatailBO.setUnionName(mktMarketingUrl.getName());
userOrderDatailBO.setChannelType(mktMarketingUrl.getChannelType());
}
userOrderDatailBO.setOrderCode(Long.valueOf(userOrders.getOrderCode()));
userOrderDatailBOList.add(userOrderDatailBO);
... ... @@ -218,6 +208,7 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport
UserOrderDatailBO userOrderDatailBO = userOrderDatailBOMap.get(orders.getParentOrderCode());
orderRspBO.setUnionId(userOrderDatailBO.getUnionId());
orderRspBO.setUnionType(userOrderDatailBO.getUnionName());
orderRspBO.setChannelType(userOrderDatailBO.getChannelType());
unionOrderRspBOList.add(orderRspBO);
}
PageUnionOrderRspBO pageUnionOrderRspBO = new PageUnionOrderRspBO();
... ...
... ... @@ -33,6 +33,11 @@
<label>渠道:</label>
<input class="easyui-textbox" id="unionType" name="unionType">
</input>
<label>渠道号类型:</label>
<input class="easyui-combobox" id="channelType" name="channelType">
</input>
<a id="searchBtn" style="margin-left: 20px" class="easyui-linkbutton btn-primary" data-options="iconCls:'icon-more'">查询</a>
<a id="exportButton" style="margin-left: 20px" class="easyui-linkbutton btn-primary" data-options="iconCls:'icon-more'">导出</a>
<a id="exportAllButton" style="margin-left: 20px" class="easyui-linkbutton btn-primary" data-options="iconCls:'icon-more'">全部导出</a>
... ... @@ -109,7 +114,7 @@
}, {
title: "运费",
field: "shipmentAmount",
width: 170,
width: 90,
align: "center"
}, {
title: "实付金额",
... ... @@ -127,9 +132,17 @@
width: 170,
align: "center"
}, {
title: "渠道号类型",
field: "channelType",
width: 120,
align: "center",
formatter: function (value, rowData, rowIndex) {
return value==null?"":value==0?"机构":"个人";
}
}, {
title: "附加信息",
field: "exetInfmoation",
width: 170,
width: 140,
align: "center"
}, {
title: "支付方式",
... ... @@ -160,6 +173,12 @@
});
}
});
$("#channelType").combobox({
valueField : "channelType",
textField : "channelTypeDesc",
data:[{channelTypeDesc:"个人",channelType:"1"},{channelTypeDesc:"机构",channelType:"0"}]
});
$("#channelType").combobox("clear");
function getParam(table) {
var paramsArray = $("#"+table+"").serializeArray();
... ... @@ -185,6 +204,7 @@
param.orderCode = $("#orderCode").val(),
param.unionId = $("#unionId").val(),
param.unionType=$("#unionType").val(),
param.channelType=$("#channelType").combobox("getValue"),
$("#userOrdersTable").myDatagrid("load", param);
}
});
... ...