Authored by csgyoho

cps订单管理功能

@@ -19,10 +19,16 @@ public interface UnionShareOrdersMapper { @@ -19,10 +19,16 @@ public interface UnionShareOrdersMapper {
19 19
20 UnionShareOrders selectByCode(String orderCode); 20 UnionShareOrders selectByCode(String orderCode);
21 21
22 - int selectCountByUids(@Param("beginTime") int beginTime,@Param("endTime") int endTime,@Param("uids") List<Integer> uids); 22 + int selectCountByUids(@Param("beginTime") int beginTime,@Param("endTime") int endTime,@Param("uids") List<Integer> uids,@Param("orderCode")String orderCode);
23 23
24 @MapKey("orderCode") 24 @MapKey("orderCode")
25 - Map<String,UnionShareOrders> selectListByUids(@Param("beginTime") int beginTime,@Param("endTime") int endTime,@Param("uids") List<Integer> uids,@Param("startIndex") int startIndex, @Param("pageSize") int pageSize); 25 + Map<String,UnionShareOrders> selectListByUids(@Param("beginTime") int beginTime,@Param("endTime") int endTime,@Param("uids") List<Integer> uids,@Param("orderCode") String orderCode,@Param("startIndex") int startIndex, @Param("pageSize") int pageSize);
  26 +
  27 + @MapKey("orderCode")
  28 + Map<String,UnionShareOrders> selectListByIds(List<String> ids);
  29 +
  30 + @MapKey("orderCode")
  31 + Map<String,UnionShareOrders> selectAllListByUids(@Param("beginTime") int beginTime,@Param("endTime") int endTime,@Param("uids") List<Integer> uids,@Param("orderCode") String orderCode);
26 32
27 int selectCountByCondition(@Param("promoteUid")int promoteUid, @Param("status")String status); 33 int selectCountByCondition(@Param("promoteUid")int promoteUid, @Param("status")String status);
28 34
  1 +package com.yoho.unions.dal.model;
  2 +
  3 +/**
  4 + * Created by shengguo.cai on 2018/5/15.
  5 + */
  6 +public class ShareUserOrderDatailBO {
  7 +}
@@ -53,6 +53,15 @@ @@ -53,6 +53,15 @@
53 where promote_uid = #{promoteUid,jdbcType=INTEGER} and status = #{status,jdbcType=VARCHAR} 53 where promote_uid = #{promoteUid,jdbcType=INTEGER} and status = #{status,jdbcType=VARCHAR}
54 limit #{offset}, #{rows} 54 limit #{offset}, #{rows}
55 </select> 55 </select>
  56 + <select id="selectListByIds" resultMap="BaseResultMap" >
  57 + select
  58 + <include refid="Base_Column_List" />
  59 + from union_share_orders
  60 + where id in
  61 + <foreach collection="list" open="(" close=")" item="id" separator=",">
  62 + #{id}
  63 + </foreach>
  64 + </select>
56 <select id="selectOrderCodesByCondition" resultType="java.lang.String" > 65 <select id="selectOrderCodesByCondition" resultType="java.lang.String" >
57 select order_code from union_share_orders 66 select order_code from union_share_orders
58 where settlement_code = #{settlementCode,jdbcType=VARCHAR} 67 where settlement_code = #{settlementCode,jdbcType=VARCHAR}
@@ -189,12 +198,34 @@ @@ -189,12 +198,34 @@
189 #{uid} 198 #{uid}
190 </foreach> 199 </foreach>
191 </if> 200 </if>
  201 + <if test="orderCode != null" >
  202 + and order_code = #{orderCode}
  203 + </if>
  204 + <if test="beginTime != 0" >
  205 + and create_time &gt; #{beginTime}
  206 + </if>
  207 + <if test="endTime != 0" >
  208 + and create_time &lt;#{endTime}
  209 + </if>
  210 + </select>
  211 + <select id="selectAllListByUids" resultMap="BaseResultMap">
  212 + select <include refid="Base_Column_List" /> from union_share_orders where 1=1
  213 + <if test="uids!=null and uids.size()>0">
  214 + and promote_uid in
  215 + <foreach collection="uids" open="(" close=")" item="uid" separator=",">
  216 + #{uid}
  217 + </foreach>
  218 + </if>
  219 + <if test="orderCode != null" >
  220 + and order_code = #{orderCode}
  221 + </if>
192 <if test="beginTime != 0" > 222 <if test="beginTime != 0" >
193 and create_time &gt; #{beginTime} 223 and create_time &gt; #{beginTime}
194 </if> 224 </if>
195 <if test="endTime != 0" > 225 <if test="endTime != 0" >
196 and create_time &lt;#{endTime} 226 and create_time &lt;#{endTime}
197 </if> 227 </if>
  228 + order BY create_time desc
198 </select> 229 </select>
199 <select id="selectListByUids" resultMap="BaseResultMap"> 230 <select id="selectListByUids" resultMap="BaseResultMap">
200 select <include refid="Base_Column_List" /> from union_share_orders where 1=1 231 select <include refid="Base_Column_List" /> from union_share_orders where 1=1
@@ -204,6 +235,9 @@ @@ -204,6 +235,9 @@
204 #{uid} 235 #{uid}
205 </foreach> 236 </foreach>
206 </if> 237 </if>
  238 + <if test="orderCode != null" >
  239 + and order_code = #{orderCode}
  240 + </if>
207 <if test="beginTime != 0" > 241 <if test="beginTime != 0" >
208 and create_time &gt; #{beginTime} 242 and create_time &gt; #{beginTime}
209 </if> 243 </if>
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 <include refid="Base_Column_List" /> 41 <include refid="Base_Column_List" />
42 from union_share_user 42 from union_share_user
43 where uid in 43 where uid in
44 - <foreach collection="uids" open="(" close=")" item="uid" separator=","> 44 + <foreach collection="list" open="(" close=")" item="uid" separator=",">
45 #{uid} 45 #{uid}
46 </foreach> 46 </foreach>
47 </select> 47 </select>
@@ -91,9 +91,9 @@ @@ -91,9 +91,9 @@
91 </set> 91 </set>
92 where id = #{id,jdbcType=INTEGER} 92 where id = #{id,jdbcType=INTEGER}
93 </update> 93 </update>
94 - <select id="selectUids" parameterType="Long"> 94 + <select id="selectUids" parameterType="Long" resultType="Integer">
95 select uid from union_share_user where union_type in 95 select uid from union_share_user where union_type in
96 - <foreach collection="unionTypes" open="(" close=")" item="unionType" separator=","> 96 + <foreach collection="list" open="(" close=")" item="unionType" separator=",">
97 #{unionType} 97 #{unionType}
98 </foreach> 98 </foreach>
99 </select> 99 </select>
1 package com.yoho.unions.server.service.impl; 1 package com.yoho.unions.server.service.impl;
2 2
  3 +import com.alibaba.fastjson.JSONException;
  4 +import com.alibaba.fastjson.JSONObject;
3 import com.yoho.core.config.ConfigReader; 5 import com.yoho.core.config.ConfigReader;
4 import com.yoho.core.rabbitmq.YhProducer; 6 import com.yoho.core.rabbitmq.YhProducer;
  7 +import com.yoho.error.exception.ServiceException;
5 import com.yoho.service.model.union.bo.ShareOrderBo; 8 import com.yoho.service.model.union.bo.ShareOrderBo;
6 import com.yoho.service.model.union.bo.ShareSettlementBo; 9 import com.yoho.service.model.union.bo.ShareSettlementBo;
7 import com.yoho.service.model.union.bo.ShareUserSettlementInfoBo; 10 import com.yoho.service.model.union.bo.ShareUserSettlementInfoBo;
  11 +import com.yoho.service.model.union.bo.UnionShareOrderSearchBo;
  12 +import com.yoho.service.model.union.request.UnionOrderReqBO;
  13 +import com.yoho.service.model.union.request.UnionShareOrderReqBO;
8 import com.yoho.service.model.union.request.UnionShareOrderSearchReqBO; 14 import com.yoho.service.model.union.request.UnionShareOrderSearchReqBO;
9 import com.yoho.service.model.union.response.PageUnionShareOrderRspBO; 15 import com.yoho.service.model.union.response.PageUnionShareOrderRspBO;
10 import com.yoho.service.model.union.response.UnionShareOrderRspBO; 16 import com.yoho.service.model.union.response.UnionShareOrderRspBO;
@@ -13,6 +19,7 @@ import com.yoho.unions.common.enums.ShareOrdersKeyEnum; @@ -13,6 +19,7 @@ import com.yoho.unions.common.enums.ShareOrdersKeyEnum;
13 import com.yoho.unions.common.enums.ShareOrdersStatusEnum; 19 import com.yoho.unions.common.enums.ShareOrdersStatusEnum;
14 import com.yoho.unions.common.redis.RedisHashCache; 20 import com.yoho.unions.common.redis.RedisHashCache;
15 import com.yoho.unions.common.redis.RedisValueCache; 21 import com.yoho.unions.common.redis.RedisValueCache;
  22 +import com.yoho.unions.common.service.IBusinessExportService;
16 import com.yoho.unions.common.utils.DateUtil; 23 import com.yoho.unions.common.utils.DateUtil;
17 import com.yoho.unions.common.utils.RandomUtil; 24 import com.yoho.unions.common.utils.RandomUtil;
18 import com.yoho.unions.dal.*; 25 import com.yoho.unions.dal.*;
@@ -37,8 +44,7 @@ import java.util.concurrent.atomic.AtomicInteger; @@ -37,8 +44,7 @@ import java.util.concurrent.atomic.AtomicInteger;
37 * Created by mingdan.ge on 2018/5/10. 44 * Created by mingdan.ge on 2018/5/10.
38 */ 45 */
39 @Service 46 @Service
40 -public class UnionShareServiceImpl implements IUnionShareService {  
41 - 47 +public class UnionShareServiceImpl implements IUnionShareService,IBusinessExportService {
42 private Logger logger = LoggerFactory.getLogger(UnionShareServiceImpl.class); 48 private Logger logger = LoggerFactory.getLogger(UnionShareServiceImpl.class);
43 49
44 @Autowired 50 @Autowired
@@ -95,35 +101,22 @@ public class UnionShareServiceImpl implements IUnionShareService { @@ -95,35 +101,22 @@ public class UnionShareServiceImpl implements IUnionShareService {
95 @Override 101 @Override
96 public PageUnionShareOrderRspBO queryUnionShareOrders(UnionShareOrderSearchReqBO reqBO){ 102 public PageUnionShareOrderRspBO queryUnionShareOrders(UnionShareOrderSearchReqBO reqBO){
97 logger.info("queryUnionShareOrders param is {}", reqBO); 103 logger.info("queryUnionShareOrders param is {}", reqBO);
98 - int beginTime = StringUtils.isBlank(reqBO.getBeginTime()) ? 0 : Integer.parseInt(reqBO.getBeginTime());  
99 - int endTime = StringUtils.isBlank(reqBO.getEndTime()) ? 0 : Integer.parseInt(reqBO.getEndTime());  
100 - long orderCode = StringUtils.isBlank(reqBO.getOrderCode()) ? 0 : Long.parseLong(reqBO.getOrderCode());  
101 - Long unionType = StringUtils.isBlank(reqBO.getUnionId()) ? null :Long.valueOf( reqBO.getUnionId());  
102 - String unionName = StringUtils.isBlank(reqBO.getUnionType()) ? null : reqBO.getUnionType();  
103 - String channelType=reqBO.getChannelType();  
104 - List<String> idList = reqBO.getIdsList();  
105 - List<Long> unionTypes=null;  
106 - if(unionType!=null || unionName!=null || channelType!=null){  
107 - unionTypes=mktMarketingUrlDAO.selectUnionTypes(unionType, unionName, channelType);  
108 - if(unionTypes.isEmpty()){ 104 + UnionShareOrderSearchBo bo=initUnionShareOrderSearchBo(reqBO);
  105 + List<Integer> uids=null;
  106 + if(bo.getUnionType()!=null || bo.getUnionName()!=null || bo.getChannelType()!=null){
  107 + uids=queryUids(bo);
  108 + if(null==uids){
109 return null; 109 return null;
110 } 110 }
111 } 111 }
112 - List<Integer> uids=unionTypes==null?null:this.unionShareUserMapper.selectUids(unionTypes);  
113 //查询总数 112 //查询总数
114 - int count = unionShareOrdersMapper.selectCountByUids(beginTime, endTime, uids);  
115 - logger.info("userOrdersDAO.selectCount: size is {}", count); 113 + int count = unionShareOrdersMapper.selectCountByUids(bo.getBeginTime(), bo.getEndTime(), uids,bo.getOrderCode());
  114 + logger.info("unionShareOrdersMapper.selectCountByUids: size is {}", count);
116 if (count < 1) { 115 if (count < 1) {
117 return null; 116 return null;
118 } 117 }
119 - Map<String,UnionShareOrders> ordersDOMap=this.unionShareOrdersMapper.selectListByUids(beginTime, endTime, uids, reqBO.getStart(), reqBO.getSize());  
120 - Map<Long, UserOrderDatailBO> userOrderDatailBOMap = initUserShareOrderDatails(ordersDOMap);  
121 - List<UnionShareOrderRspBO> unionOrderRspBOList = new ArrayList<>(ordersDOMap.size());  
122 - for (UnionShareOrders orders : ordersDOMap.values()) {  
123 - UnionShareOrderRspBO bo=initShareUnionOrderRspBO(orders,userOrderDatailBOMap);  
124 - bo.setChannelType(Integer.valueOf(channelType));  
125 - unionOrderRspBOList.add(bo);  
126 - } 118 + Map<String,UnionShareOrders> ordersDOMap=this.unionShareOrdersMapper.selectListByUids(bo.getBeginTime(), bo.getEndTime(), uids,bo.getOrderCode(), reqBO.getStart(), reqBO.getSize());
  119 + List<UnionShareOrderRspBO> unionOrderRspBOList = queryUnionShareOrderRsp(ordersDOMap);
127 PageUnionShareOrderRspBO pageUnionOrderRspBO = new PageUnionShareOrderRspBO(); 120 PageUnionShareOrderRspBO pageUnionOrderRspBO = new PageUnionShareOrderRspBO();
128 pageUnionOrderRspBO.setList(unionOrderRspBOList); 121 pageUnionOrderRspBO.setList(unionOrderRspBOList);
129 pageUnionOrderRspBO.setTotal(count); 122 pageUnionOrderRspBO.setTotal(count);
@@ -131,19 +124,55 @@ public class UnionShareServiceImpl implements IUnionShareService { @@ -131,19 +124,55 @@ public class UnionShareServiceImpl implements IUnionShareService {
131 pageUnionOrderRspBO.setPage(reqBO.getPage()); 124 pageUnionOrderRspBO.setPage(reqBO.getPage());
132 return pageUnionOrderRspBO; 125 return pageUnionOrderRspBO;
133 } 126 }
134 - private UnionShareOrderRspBO initShareUnionOrderRspBO(UnionShareOrders orders,Map<Long, UserOrderDatailBO> userOrderDatailBOMap){ 127 +
  128 + private List<Integer> queryUids(UnionShareOrderSearchBo bo){
  129 + List<Integer> uids=null;
  130 + List<Long> unionTypes=mktMarketingUrlDAO.selectUnionTypes(bo.getUnionType(), bo.getUnionName(), bo.getChannelType());
  131 + if(unionTypes.isEmpty()){
  132 + return null;
  133 + }
  134 + uids=this.unionShareUserMapper.selectUids(unionTypes);
  135 + if(uids.isEmpty()){
  136 + return null;
  137 + }
  138 + return uids;
  139 + }
  140 + private UnionShareOrderSearchBo initUnionShareOrderSearchBo(UnionShareOrderSearchReqBO reqBO){
  141 + UnionShareOrderSearchBo bo=new UnionShareOrderSearchBo();
  142 + bo.setBeginTime(StringUtils.isBlank(reqBO.getBeginTime()) ? 0 : Integer.parseInt(reqBO.getBeginTime()));
  143 + bo.setEndTime(StringUtils.isBlank(reqBO.getEndTime()) ? 0 : Integer.parseInt(reqBO.getEndTime()));
  144 + bo.setOrderCode(StringUtils.isBlank(reqBO.getOrderCode()) ? null : reqBO.getOrderCode());
  145 + bo.setUnionType(StringUtils.isBlank(reqBO.getUnionId()) ? null :Long.valueOf( reqBO.getUnionId()));
  146 + bo.setUnionName(StringUtils.isBlank(reqBO.getUnionType()) ? null : reqBO.getUnionType());
  147 + bo.setChannelType(StringUtils.isBlank(reqBO.getChannelType())?null:reqBO.getChannelType());
  148 + bo.setIdList(reqBO.getIdsList());
  149 + return bo;
  150 + }
  151 +
  152 + private List<UnionShareOrderRspBO> queryUnionShareOrderRsp(Map<String,UnionShareOrders> ordersDOMap){
  153 + List<UnionShareOrderRspBO> unionOrderRspBOList = new ArrayList<>(ordersDOMap.size());
  154 + Map<String, ShareUserOrderDatailBO> userOrderDatailBOMap = initUserShareOrderDatails(ordersDOMap);
  155 + for (UnionShareOrders orders : ordersDOMap.values()) {
  156 + UnionShareOrderRspBO bo=initShareUnionOrderRspBO(orders,userOrderDatailBOMap);
  157 + unionOrderRspBOList.add(bo);
  158 + }
  159 + return unionOrderRspBOList;
  160 + }
  161 +
  162 + private UnionShareOrderRspBO initShareUnionOrderRspBO(UnionShareOrders orders,Map<String, ShareUserOrderDatailBO> userOrderDatailBOMap){
135 UnionShareOrderRspBO orderRspBO=new UnionShareOrderRspBO(); 163 UnionShareOrderRspBO orderRspBO=new UnionShareOrderRspBO();
136 orderRspBO.setOrderAmount(orders.getAmount()); 164 orderRspBO.setOrderAmount(orders.getAmount());
137 orderRspBO.setOrderStatus(OrderStatusEnum.getNameByCode(orders.getStatus())); 165 orderRspBO.setOrderStatus(OrderStatusEnum.getNameByCode(orders.getStatus()));
138 Byte isNew=orders.getIsNew(); 166 Byte isNew=orders.getIsNew();
139 orderRspBO.setIsNew(isNew==null||isNew.equals(2)?"N":"Y"); 167 orderRspBO.setIsNew(isNew==null||isNew.equals(2)?"N":"Y");
140 orderRspBO.setUid(orders.getPromoteUid()); 168 orderRspBO.setUid(orders.getPromoteUid());
141 - orderRspBO.setOrderCode(Long.parseLong(orders.getOrderCode())); 169 + orderRspBO.setOrderCode(orders.getOrderCode());
142 orderRspBO.setId(orders.getId()); 170 orderRspBO.setId(orders.getId());
143 orderRspBO.setOrderTime(DateUtil.long2DateStr(Long.valueOf(orders.getCreateTime()) * Long.valueOf(1000), "yyyy-MM-dd HH:mm:ss")); 171 orderRspBO.setOrderTime(DateUtil.long2DateStr(Long.valueOf(orders.getCreateTime()) * Long.valueOf(1000), "yyyy-MM-dd HH:mm:ss"));
144 - UserOrderDatailBO userOrderDatailBO = userOrderDatailBOMap.get(orders.getOrderCode());  
145 - orderRspBO.setUnionId(userOrderDatailBO.getUnionId()); 172 + ShareUserOrderDatailBO userOrderDatailBO = userOrderDatailBOMap.get(orders.getOrderCode());
  173 + orderRspBO.setUnionId(userOrderDatailBO.getUnionType());
146 orderRspBO.setUnionType(userOrderDatailBO.getUnionName()); 174 orderRspBO.setUnionType(userOrderDatailBO.getUnionName());
  175 + orderRspBO.setChannelType(userOrderDatailBO.getChannelType());
147 return orderRspBO; 176 return orderRspBO;
148 } 177 }
149 178
@@ -154,13 +183,13 @@ public class UnionShareServiceImpl implements IUnionShareService { @@ -154,13 +183,13 @@ public class UnionShareServiceImpl implements IUnionShareService {
154 } 183 }
155 return uids; 184 return uids;
156 } 185 }
157 - private Map<Long, UserOrderDatailBO> initUserShareOrderDatails( Map<String,UnionShareOrders> ordersDOMap){  
158 - Map<Long, UserOrderDatailBO> userOrderDatailBOMap = new HashMap<>(ordersDOMap.size()); 186 + private Map<String, ShareUserOrderDatailBO> initUserShareOrderDatails( Map<String,UnionShareOrders> ordersDOMap){
  187 + Map<String, ShareUserOrderDatailBO> userOrderDatailBOMap = new HashMap<>(ordersDOMap.size());
159 Map<Integer,UnionShareUser> userMap=unionShareUserMapper.selectByUids(getUids(ordersDOMap)); 188 Map<Integer,UnionShareUser> userMap=unionShareUserMapper.selectByUids(getUids(ordersDOMap));
160 for (UnionShareOrders userOrders : ordersDOMap.values()) { 189 for (UnionShareOrders userOrders : ordersDOMap.values()) {
161 String unionType=userMap.get(userOrders.getPromoteUid()).getUnionType(); 190 String unionType=userMap.get(userOrders.getPromoteUid()).getUnionType();
162 - UserOrderDatailBO userOrderDatailBO = new UserOrderDatailBO();  
163 - userOrderDatailBO.setUnionId(unionType); 191 + ShareUserOrderDatailBO userOrderDatailBO = new ShareUserOrderDatailBO();
  192 + userOrderDatailBO.setUnionType(unionType);
164 MktMarketingUrl mktMarketingUrl = redisValueCache.get("yh:union:uniontype:" + unionType, MktMarketingUrl.class); 193 MktMarketingUrl mktMarketingUrl = redisValueCache.get("yh:union:uniontype:" + unionType, MktMarketingUrl.class);
165 if (mktMarketingUrl == null) { 194 if (mktMarketingUrl == null) {
166 mktMarketingUrl = mktMarketingUrlDAO.selectByPrimaryKey(Long.valueOf(unionType)); 195 mktMarketingUrl = mktMarketingUrlDAO.selectByPrimaryKey(Long.valueOf(unionType));
@@ -168,8 +197,9 @@ public class UnionShareServiceImpl implements IUnionShareService { @@ -168,8 +197,9 @@ public class UnionShareServiceImpl implements IUnionShareService {
168 } 197 }
169 if (mktMarketingUrl != null) { 198 if (mktMarketingUrl != null) {
170 userOrderDatailBO.setUnionName(mktMarketingUrl.getName()); 199 userOrderDatailBO.setUnionName(mktMarketingUrl.getName());
  200 + userOrderDatailBO.setChannelType(mktMarketingUrl.getChannelType());
171 } 201 }
172 - userOrderDatailBO.setOrderCode(Long.valueOf(userOrders.getOrderCode())); 202 + userOrderDatailBO.setOrderCode(userOrders.getOrderCode());
173 userOrderDatailBOMap.put(userOrderDatailBO.getOrderCode(),userOrderDatailBO); 203 userOrderDatailBOMap.put(userOrderDatailBO.getOrderCode(),userOrderDatailBO);
174 } 204 }
175 return userOrderDatailBOMap; 205 return userOrderDatailBOMap;
@@ -517,4 +547,43 @@ public class UnionShareServiceImpl implements IUnionShareService { @@ -517,4 +547,43 @@ public class UnionShareServiceImpl implements IUnionShareService {
517 redisHashCache.delete(ShareOrdersKeyEnum.USER_SETTLEMENT.getPreKey(),uid); 547 redisHashCache.delete(ShareOrdersKeyEnum.USER_SETTLEMENT.getPreKey(),uid);
518 } 548 }
519 549
  550 + @Override
  551 + public Class getDataClass() {
  552 + return UnionShareOrderRspBO.class;
  553 + }
  554 +
  555 + @Override
  556 + public List<? extends Object> batchExport(String confStr) {
  557 + try {
  558 + UnionShareOrderSearchReqBO request = JSONObject.parseObject(confStr, UnionShareOrderSearchReqBO.class);
  559 + List<UnionShareOrderRspBO> unionOrderRspBOList = queryUnionShareOrderRspBOForExport(request);
  560 + if (CollectionUtils.isEmpty(unionOrderRspBOList)) {
  561 + throw new ServiceException(400, "没有要导出的数据");
  562 + }
  563 + return unionOrderRspBOList;
  564 + } catch (JSONException e) {
  565 + logger.warn("parse confStr error: confStr {}, e {}", confStr, e);
  566 + throw new ServiceException(400, "传入数据格式错误");
  567 + } catch (com.yoho.error.exception.ServiceException e) {
  568 + logger.warn("make url error params is confStr {}, e {}", confStr, e);
  569 + throw new ServiceException(e.getCode(), e.getErrorMessage());
  570 + }
  571 + }
  572 + private List<UnionShareOrderRspBO> queryUnionShareOrderRspBOForExport(UnionShareOrderSearchReqBO reqBO){
  573 + UnionShareOrderSearchBo bo=initUnionShareOrderSearchBo(reqBO);
  574 + Map<String,UnionShareOrders> ordersDOMap=null;
  575 + if(bo.getIdList()!=null&&!bo.getIdList().isEmpty()){
  576 + ordersDOMap= this.unionShareOrdersMapper.selectListByIds(bo.getIdList());
  577 + }else{
  578 + List<Integer> uids=null;
  579 + if(bo.getUnionType()!=null || bo.getUnionName()!=null || bo.getChannelType()!=null){
  580 + uids=queryUids(bo);
  581 + if(null==uids){
  582 + return null;
  583 + }
  584 + }
  585 + ordersDOMap=this.unionShareOrdersMapper.selectAllListByUids(bo.getBeginTime(), bo.getEndTime(), uids, bo.getOrderCode());
  586 + }
  587 + return ordersDOMap.isEmpty()?null:queryUnionShareOrderRsp(ordersDOMap);
  588 + }
520 } 589 }
@@ -118,6 +118,9 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport @@ -118,6 +118,9 @@ public class UserOrdersServiceImpl implements IUserOrdersService,IBusinessExport
118 return null; 118 return null;
119 } 119 }
120 List<UserOrders> userOrdersList = userOrdersDAO.selectUserOrderList(beginTime, endTime, String.valueOf(orderCode), null==unionType?null:unionType.toString(), idList, reqBO.getStart(), reqBO.getSize()); 120 List<UserOrders> userOrdersList = userOrdersDAO.selectUserOrderList(beginTime, endTime, String.valueOf(orderCode), null==unionType?null:unionType.toString(), idList, reqBO.getStart(), reqBO.getSize());
  121 + if(userOrdersList.isEmpty()){
  122 + return null;
  123 + }
121 List<UserOrderDatailBO> userOrderDatailBOList = initUserOrderDatails(userOrdersList); 124 List<UserOrderDatailBO> userOrderDatailBOList = initUserOrderDatails(userOrdersList);
122 Map<Long, UserOrderDatailBO> userOrderDatailBOMap = Maps.uniqueIndex(userOrderDatailBOList, new Function<UserOrderDatailBO, Long>() { 125 Map<Long, UserOrderDatailBO> userOrderDatailBOMap = Maps.uniqueIndex(userOrderDatailBOList, new Function<UserOrderDatailBO, Long>() {
123 @Override 126 @Override
@@ -118,8 +118,8 @@ @@ -118,8 +118,8 @@
118 value-type="com.yoho.unions.common.service.IBusinessExportService"> 118 value-type="com.yoho.unions.common.service.IBusinessExportService">
119 <entry key="channelUserServiceImpl" value-ref="channelUserServiceImpl"/> 119 <entry key="channelUserServiceImpl" value-ref="channelUserServiceImpl"/>
120 <entry key="userOrdersServiceImpl" value-ref="userOrdersServiceImpl"/> 120 <entry key="userOrdersServiceImpl" value-ref="userOrdersServiceImpl"/>
  121 + <entry key="unionShareServiceImpl" value-ref="unionShareServiceImpl"/>
121 <entry key="userRegisterBuyInfoserviceImpl" value-ref="userRegisterBuyInfoserviceImpl"/> 122 <entry key="userRegisterBuyInfoserviceImpl" value-ref="userRegisterBuyInfoserviceImpl"/>
122 -  
123 </util:map> 123 </util:map>
124 124
125 </beans> 125 </beans>
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 <body class="easyui-layout" fit="true"> 9 <body class="easyui-layout" fit="true">
10 <div region="north" style="padding-bottom: 35px; height: auto;"> 10 <div region="north" style="padding-bottom: 35px; height: auto;">
11 <script> 11 <script>
12 - document.write(addHead('市场报表管理', '联盟订单管理')); 12 + document.write(addHead('市场报表管理', 'CPS订单管理'));
13 </script> 13 </script>
14 <form id="searchForm" method="post" accept-charset="utf-8"> 14 <form id="searchForm" method="post" accept-charset="utf-8">
15 <div style="margin-left: 10px;margin-top: 10px"> 15 <div style="margin-left: 10px;margin-top: 10px">
@@ -73,86 +73,53 @@ @@ -73,86 +73,53 @@
73 title: "ID", 73 title: "ID",
74 field: "id", 74 field: "id",
75 idField:"id", 75 idField:"id",
76 - width: 170, 76 + width: 200,
77 align: "center", 77 align: "center",
78 checkbox: true 78 checkbox: true
79 }, { 79 }, {
80 title: "联盟用户ID", 80 title: "联盟用户ID",
81 field: "unionId", 81 field: "unionId",
82 - width: 170, 82 + width: 200,
83 align: "center" 83 align: "center"
84 }, { 84 }, {
85 title: "下单时间", 85 title: "下单时间",
86 field: "orderTime", 86 field: "orderTime",
87 - width: 170, 87 + width: 200,
88 align: "center" 88 align: "center"
89 }, { 89 }, {
90 title: "订单号", 90 title: "订单号",
91 field: "orderCode", 91 field: "orderCode",
92 - width: 170, 92 + width: 200,
93 align: "center" 93 align: "center"
94 }, { 94 }, {
95 title: "订单用户ID", 95 title: "订单用户ID",
96 field: "uid", 96 field: "uid",
97 - width: 170, 97 + width: 200,
98 align: "center" 98 align: "center"
99 }, { 99 }, {
100 title: "订单金额", 100 title: "订单金额",
101 field: "orderAmount", 101 field: "orderAmount",
102 - width: 170,  
103 - align: "center"  
104 - }, {  
105 - title: "优惠券金额",  
106 - field: "couponAmount",  
107 - width: 170,  
108 - align: "center"  
109 - }, {  
110 - title: "YOHO币",  
111 - field: "yohoCoinNum",  
112 - width: 170,  
113 - align: "center"  
114 - }, {  
115 - title: "运费",  
116 - field: "shipmentAmount",  
117 - width: 90,  
118 - align: "center"  
119 - }, {  
120 - title: "实付金额",  
121 - field: "realPayAmount",  
122 - width: 170, 102 + width: 200,
123 align: "center" 103 align: "center"
124 }, { 104 }, {
125 title: "订单状态", 105 title: "订单状态",
126 field: "orderStatus", 106 field: "orderStatus",
127 - width: 170, 107 + width: 200,
128 align: "center" 108 align: "center"
129 }, { 109 }, {
130 title: "渠道", 110 title: "渠道",
131 field: "unionType", 111 field: "unionType",
132 - width: 170, 112 + width: 200,
133 align: "center" 113 align: "center"
134 }, { 114 }, {
135 title: "渠道号类型", 115 title: "渠道号类型",
136 field: "channelType", 116 field: "channelType",
137 - width: 120,  
138 - align: "center",  
139 - formatter: function (value, rowData, rowIndex) {  
140 - return value==null?"":value==0?"机构":"个人";  
141 - }  
142 - }, {  
143 - title: "附加信息",  
144 - field: "exetInfmoation",  
145 - width: 140,  
146 - align: "center"  
147 - }, {  
148 - title: "支付方式",  
149 - field: "payChannel",  
150 - width: 170, 117 + width: 200,
151 align: "center" 118 align: "center"
152 }, { 119 }, {
153 title: "是否新客", 120 title: "是否新客",
154 field: "isNew", 121 field: "isNew",
155 - width: 170, 122 + width: 200,
156 align: "center" 123 align: "center"
157 } 124 }
158 ]], 125 ]],
@@ -164,13 +131,7 @@ @@ -164,13 +131,7 @@
164 singleSelect: false, 131 singleSelect: false,
165 checkOnSelect: false, 132 checkOnSelect: false,
166 onLoadSuccess: function (data) { 133 onLoadSuccess: function (data) {
167 -  
168 - $(this).myDatagrid("getPanel").find("a[role='delete']").linkbutton({  
169 - iconCls: "icon-more",  
170 - onClick: function () {  
171 - deleteBlack($(this).attr("dataId"));  
172 - }  
173 - }); 134 + resetSelectedCheckBox(data);
174 } 135 }
175 }); 136 });
176 $("#channelType").combobox({ 137 $("#channelType").combobox({
@@ -180,6 +141,17 @@ @@ -180,6 +141,17 @@
180 }); 141 });
181 $("#channelType").combobox("clear"); 142 $("#channelType").combobox("clear");
182 143
  144 + function resetSelectedCheckBox(data){
  145 + $("input[type='checkbox'][name='id']").each(function () {
  146 + var cb=$(this);
  147 + $.each(checkedItems,function(index,value){
  148 + if(value==cb.val()){
  149 + cb.attr("checked",true);
  150 + return false;
  151 + }
  152 + });
  153 + });
  154 + }
183 function getParam(table) { 155 function getParam(table) {
184 var paramsArray = $("#"+table+"").serializeArray(); 156 var paramsArray = $("#"+table+"").serializeArray();
185 var params = {}; 157 var params = {};
@@ -192,6 +164,7 @@ @@ -192,6 +164,7 @@
192 $("#searchBtn").linkbutton({ 164 $("#searchBtn").linkbutton({
193 iconCls : "icon-search", 165 iconCls : "icon-search",
194 onClick : function() { 166 onClick : function() {
  167 + checkedItems=[];
195 var param = {}; 168 var param = {};
196 if ($("#beginTime").datetimebox('getValue')!='') 169 if ($("#beginTime").datetimebox('getValue')!='')
197 { 170 {
@@ -265,13 +238,13 @@ @@ -265,13 +238,13 @@
265 return; 238 return;
266 } 239 }
267 var params = {"ids": checkedItems.toString() }; 240 var params = {"ids": checkedItems.toString() };
268 - window.open(contextPath + "/batch/export.do?type=userOrdersServiceImpl&queryConf=" + JSON.stringify(params)); 241 + window.open(contextPath + "/batch/export.do?type=unionShareServiceImpl&queryConf=" + JSON.stringify(params));
269 } 242 }
270 }); 243 });
271 244
272 $("#exportAllButton").linkbutton({ 245 $("#exportAllButton").linkbutton({
273 onClick : function() { 246 onClick : function() {
274 - window.open(contextPath + "/batch/export.do?type=userOrdersServiceImpl&queryConf=" + JSON.stringify(getParams())); 247 + window.open(contextPath + "/batch/export.do?type=unionShareServiceImpl&queryConf=" + JSON.stringify(getParams()));
275 } 248 }
276 }); 249 });
277 250