Authored by mali

Merge branch 'test6.8.2' of http://git.yoho.cn/ufo/ufo-platform into test6.8.2

@@ -119,6 +119,8 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{ @@ -119,6 +119,8 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{
119 if(!checkSaveOrUpdateCouponParam(req)){ 119 if(!checkSaveOrUpdateCouponParam(req)){
120 return new ApiResponse.ApiResponseBuilder().code(500).message("参数有误").build(); 120 return new ApiResponse.ApiResponseBuilder().code(500).message("参数有误").build();
121 } 121 }
  122 + //TODO 每次更新必须更新该字段,否则我怎么判断是否更新该字段呢?productLimitType为1时,是否一定要设置该关联对象?
  123 + //TODO 若productLimitType=1时关联对象必填,则可用:req.getId()!=null && (req.getProductLimitType == 2 || req.getProductLimitValue()!=null)
122 if(req.getId() != null){ 124 if(req.getId() != null){
123 LOGGER.info("before saveOrUpdateCoupon#deleteByCouponId,couponId is {}",req.getId()); 125 LOGGER.info("before saveOrUpdateCoupon#deleteByCouponId,couponId is {}",req.getId());
124 couponProductLimitMapper.deleteByCouponId(req.getId()); 126 couponProductLimitMapper.deleteByCouponId(req.getId());
@@ -239,7 +241,7 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{ @@ -239,7 +241,7 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{
239 for(Coupon coupon : coupons){ 241 for(Coupon coupon : coupons){
240 String useTime = com.yoho.ufo.util.DateUtil.int2DateStr(coupon.getStartTime(),"yyyy-MM-dd HH:mm:ss")+"至"+ 242 String useTime = com.yoho.ufo.util.DateUtil.int2DateStr(coupon.getStartTime(),"yyyy-MM-dd HH:mm:ss")+"至"+
241 com.yoho.ufo.util.DateUtil.int2DateStr(coupon.getEndTime(),"yyyy-MM-dd HH:mm:ss"); 243 com.yoho.ufo.util.DateUtil.int2DateStr(coupon.getEndTime(),"yyyy-MM-dd HH:mm:ss");
242 - CouponQueryResp resp = new CouponQueryResp(coupon.getId(),coupon.getCouponName(),coupon.getCouponAmount(), 244 + CouponQueryResp resp = new CouponQueryResp(coupon.getId(),coupon.getCouponName(),coupon.getCouponNum(),
243 useTime,coupon.getRemark(), Coupon.CouponStatusEnum.getKey(coupon.getStatus()),coupon.getStatus()); 245 useTime,coupon.getRemark(), Coupon.CouponStatusEnum.getKey(coupon.getStatus()),coupon.getStatus());
244 resps.add(resp); 246 resps.add(resp);
245 } 247 }
@@ -12,7 +12,7 @@ public class UserCoupon implements Serializable { @@ -12,7 +12,7 @@ public class UserCoupon implements Serializable {
12 private Integer couponType; 12 private Integer couponType;
13 private String couponCode; 13 private String couponCode;
14 private Integer status; 14 private Integer status;
15 - private Integer orderCode; 15 + private Long orderCode;
16 private Integer useTime; 16 private Integer useTime;
17 private Integer startTime; 17 private Integer startTime;
18 private Integer endTime; 18 private Integer endTime;
@@ -103,11 +103,11 @@ public class UserCoupon implements Serializable { @@ -103,11 +103,11 @@ public class UserCoupon implements Serializable {
103 this.status = status; 103 this.status = status;
104 } 104 }
105 105
106 - public Integer getOrderCode() { 106 + public Long getOrderCode() {
107 return orderCode; 107 return orderCode;
108 } 108 }
109 109
110 - public void setOrderCode(Integer orderCode) { 110 + public void setOrderCode(Long orderCode) {
111 this.orderCode = orderCode; 111 this.orderCode = orderCode;
112 } 112 }
113 113
@@ -21,7 +21,7 @@ public class CouponQueryResp { @@ -21,7 +21,7 @@ public class CouponQueryResp {
21 @BatchExportField( 21 @BatchExportField(
22 name = "数量" 22 name = "数量"
23 ) 23 )
24 - private Float amount; 24 + private Integer couponNum;
25 @BatchExportField( 25 @BatchExportField(
26 name = "使用期限" 26 name = "使用期限"
27 ) 27 )
@@ -35,10 +35,10 @@ public class CouponQueryResp { @@ -35,10 +35,10 @@ public class CouponQueryResp {
35 ) 35 )
36 private String status; 36 private String status;
37 private Integer statusValue; 37 private Integer statusValue;
38 - public CouponQueryResp(Integer id, String name, Float amount, String useTime, String remark, String status, Integer statusValue) { 38 + public CouponQueryResp(Integer id, String name, Integer couponNum, String useTime, String remark, String status, Integer statusValue) {
39 this.id = id; 39 this.id = id;
40 this.name = name; 40 this.name = name;
41 - this.amount = amount; 41 + this.couponNum = couponNum;
42 this.useTime = useTime; 42 this.useTime = useTime;
43 this.remark = remark; 43 this.remark = remark;
44 this.status = status; 44 this.status = status;
@@ -24,6 +24,6 @@ @@ -24,6 +24,6 @@
24 delete from coupon_product_limit where coupon_id=#{id} 24 delete from coupon_product_limit where coupon_id=#{id}
25 </delete> 25 </delete>
26 <select id="selectByCouponId" resultType="com.yoho.ufo.model.coupon.CouponProductLimit"> 26 <select id="selectByCouponId" resultType="com.yoho.ufo.model.coupon.CouponProductLimit">
27 - select <include refid="Base_Column_List" /> from coupon_product_limit where coupon_id=#{id} 27 + select <include refid="Base_Column_List" /> from coupon_product_limit where coupon_id=#{id} order by id desc
28 </select> 28 </select>
29 </mapper> 29 </mapper>
@@ -21,10 +21,11 @@ @@ -21,10 +21,11 @@
21 </sql> 21 </sql>
22 <select id="selectResourcesByPage" resultType="com.yoho.ufo.model.resource.Resources"> 22 <select id="selectResourcesByPage" resultType="com.yoho.ufo.model.resource.Resources">
23 select <include refid="Base_Column_List" /> from resources 23 select <include refid="Base_Column_List" /> from resources
  24 + order by id asc
24 limit #{start},#{size} 25 limit #{start},#{size}
25 </select> 26 </select>
26 <select id="selectById" resultType="com.yoho.ufo.model.resource.Resources"> 27 <select id="selectById" resultType="com.yoho.ufo.model.resource.Resources">
27 select <include refid="Base_Column_List" /> from resources 28 select <include refid="Base_Column_List" /> from resources
28 - where id=#{id} 29 + where id=#{id} limit 1
29 </select> 30 </select>
30 </mapper> 31 </mapper>
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 <result column="coupon_type" property="couponType" jdbcType="INTEGER" /> 8 <result column="coupon_type" property="couponType" jdbcType="INTEGER" />
9 <result column="coupon_code" property="couponCode" jdbcType="VARCHAR" /> 9 <result column="coupon_code" property="couponCode" jdbcType="VARCHAR" />
10 <result column="status" property="status" jdbcType="INTEGER" /> 10 <result column="status" property="status" jdbcType="INTEGER" />
11 - <result column="order_code" property="orderCode" jdbcType="INTEGER" /> 11 + <result column="order_code" property="orderCode" jdbcType="BIGINT" />
12 <result column="use_time" property="useTime" jdbcType="INTEGER" /> 12 <result column="use_time" property="useTime" jdbcType="INTEGER" />
13 <result column="start_time" property="startTime" jdbcType="INTEGER" /> 13 <result column="start_time" property="startTime" jdbcType="INTEGER" />
14 <result column="end_time" property="endTime" jdbcType="INTEGER" /> 14 <result column="end_time" property="endTime" jdbcType="INTEGER" />
@@ -36,6 +36,7 @@ public class ResourceController { @@ -36,6 +36,7 @@ public class ResourceController {
36 if(req == null){ 36 if(req == null){
37 req = new PageRequestBO(); 37 req = new PageRequestBO();
38 } 38 }
  39 + //TODO 暂时不查询total,数据量还不是很大
39 List<ResourceGetBo> result = this.resourceService.getResources(req); 40 List<ResourceGetBo> result = this.resourceService.getResources(req);
40 return new ApiResponse.ApiResponseBuilder().code(200).data(result).build(); 41 return new ApiResponse.ApiResponseBuilder().code(200).data(result).build();
41 } 42 }
@@ -61,6 +61,10 @@ public class ResourceServiceImpl implements IResourceService{ @@ -61,6 +61,10 @@ public class ResourceServiceImpl implements IResourceService{
61 public JSONObject getResourceInfo(Integer id) { 61 public JSONObject getResourceInfo(Integer id) {
62 LOGGER.info("enter getResourceInfo,id is {}",id); 62 LOGGER.info("enter getResourceInfo,id is {}",id);
63 Resources resources = resourcesMapper.selectById(id); 63 Resources resources = resourcesMapper.selectById(id);
  64 + if(null == resources){
  65 + LOGGER.info("resources is empty,id is {}",id);
  66 + return null;
  67 + }
64 List<ResourcesContent> contentList = resourcesContentMapper.selectByResourceId(id); 68 List<ResourcesContent> contentList = resourcesContentMapper.selectByResourceId(id);
65 if(CollectionUtils.isEmpty(contentList)){ 69 if(CollectionUtils.isEmpty(contentList)){
66 LOGGER.info("resourcesContent is empty,id is {}",id); 70 LOGGER.info("resourcesContent is empty,id is {}",id);
@@ -97,6 +101,9 @@ public class ResourceServiceImpl implements IResourceService{ @@ -97,6 +101,9 @@ public class ResourceServiceImpl implements IResourceService{
97 private List<ResourceInfoGetBo> initResourceInfoGetBoList(List<ResourcesContent> contentList, List<ResourcesContentData> contentDataList) { 101 private List<ResourceInfoGetBo> initResourceInfoGetBoList(List<ResourcesContent> contentList, List<ResourcesContentData> contentDataList) {
98 LOGGER.info("enter initResourceInfoGetBoList,contentList is {},contentDataList is {}",contentList,contentDataList); 102 LOGGER.info("enter initResourceInfoGetBoList,contentList is {},contentDataList is {}",contentList,contentDataList);
99 List<ResourceInfoGetBo> resInfoList = new ArrayList<>(); 103 List<ResourceInfoGetBo> resInfoList = new ArrayList<>();
  104 + if(CollectionUtils.isEmpty(contentDataList)){
  105 + return resInfoList;
  106 + }
100 for(ResourcesContent resContent : contentList){ 107 for(ResourcesContent resContent : contentList){
101 List<ResourcesContentData> curContentDatas = contentDataList.stream() 108 List<ResourcesContentData> curContentDatas = contentDataList.stream()
102 .filter(contentData->resContent.getId().equals(contentData.getResourceContentId())) 109 .filter(contentData->resContent.getId().equals(contentData.getResourceContentId()))