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{
if(!checkSaveOrUpdateCouponParam(req)){
return new ApiResponse.ApiResponseBuilder().code(500).message("参数有误").build();
}
//TODO 每次更新必须更新该字段,否则我怎么判断是否更新该字段呢?productLimitType为1时,是否一定要设置该关联对象?
//TODO 若productLimitType=1时关联对象必填,则可用:req.getId()!=null && (req.getProductLimitType == 2 || req.getProductLimitValue()!=null)
if(req.getId() != null){
LOGGER.info("before saveOrUpdateCoupon#deleteByCouponId,couponId is {}",req.getId());
couponProductLimitMapper.deleteByCouponId(req.getId());
... ... @@ -239,7 +241,7 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{
for(Coupon coupon : coupons){
String useTime = com.yoho.ufo.util.DateUtil.int2DateStr(coupon.getStartTime(),"yyyy-MM-dd HH:mm:ss")+"至"+
com.yoho.ufo.util.DateUtil.int2DateStr(coupon.getEndTime(),"yyyy-MM-dd HH:mm:ss");
CouponQueryResp resp = new CouponQueryResp(coupon.getId(),coupon.getCouponName(),coupon.getCouponAmount(),
CouponQueryResp resp = new CouponQueryResp(coupon.getId(),coupon.getCouponName(),coupon.getCouponNum(),
useTime,coupon.getRemark(), Coupon.CouponStatusEnum.getKey(coupon.getStatus()),coupon.getStatus());
resps.add(resp);
}
... ...
... ... @@ -12,7 +12,7 @@ public class UserCoupon implements Serializable {
private Integer couponType;
private String couponCode;
private Integer status;
private Integer orderCode;
private Long orderCode;
private Integer useTime;
private Integer startTime;
private Integer endTime;
... ... @@ -103,11 +103,11 @@ public class UserCoupon implements Serializable {
this.status = status;
}
public Integer getOrderCode() {
public Long getOrderCode() {
return orderCode;
}
public void setOrderCode(Integer orderCode) {
public void setOrderCode(Long orderCode) {
this.orderCode = orderCode;
}
... ...
... ... @@ -21,7 +21,7 @@ public class CouponQueryResp {
@BatchExportField(
name = "数量"
)
private Float amount;
private Integer couponNum;
@BatchExportField(
name = "使用期限"
)
... ... @@ -35,10 +35,10 @@ public class CouponQueryResp {
)
private String status;
private Integer statusValue;
public CouponQueryResp(Integer id, String name, Float amount, String useTime, String remark, String status, Integer statusValue) {
public CouponQueryResp(Integer id, String name, Integer couponNum, String useTime, String remark, String status, Integer statusValue) {
this.id = id;
this.name = name;
this.amount = amount;
this.couponNum = couponNum;
this.useTime = useTime;
this.remark = remark;
this.status = status;
... ...
... ... @@ -24,6 +24,6 @@
delete from coupon_product_limit where coupon_id=#{id}
</delete>
<select id="selectByCouponId" resultType="com.yoho.ufo.model.coupon.CouponProductLimit">
select <include refid="Base_Column_List" /> from coupon_product_limit where coupon_id=#{id}
select <include refid="Base_Column_List" /> from coupon_product_limit where coupon_id=#{id} order by id desc
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -21,10 +21,11 @@
</sql>
<select id="selectResourcesByPage" resultType="com.yoho.ufo.model.resource.Resources">
select <include refid="Base_Column_List" /> from resources
order by id asc
limit #{start},#{size}
</select>
<select id="selectById" resultType="com.yoho.ufo.model.resource.Resources">
select <include refid="Base_Column_List" /> from resources
where id=#{id}
where id=#{id} limit 1
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -8,7 +8,7 @@
<result column="coupon_type" property="couponType" jdbcType="INTEGER" />
<result column="coupon_code" property="couponCode" jdbcType="VARCHAR" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="order_code" property="orderCode" jdbcType="INTEGER" />
<result column="order_code" property="orderCode" jdbcType="BIGINT" />
<result column="use_time" property="useTime" jdbcType="INTEGER" />
<result column="start_time" property="startTime" jdbcType="INTEGER" />
<result column="end_time" property="endTime" jdbcType="INTEGER" />
... ...
... ... @@ -36,6 +36,7 @@ public class ResourceController {
if(req == null){
req = new PageRequestBO();
}
//TODO 暂时不查询total,数据量还不是很大
List<ResourceGetBo> result = this.resourceService.getResources(req);
return new ApiResponse.ApiResponseBuilder().code(200).data(result).build();
}
... ...
... ... @@ -61,6 +61,10 @@ public class ResourceServiceImpl implements IResourceService{
public JSONObject getResourceInfo(Integer id) {
LOGGER.info("enter getResourceInfo,id is {}",id);
Resources resources = resourcesMapper.selectById(id);
if(null == resources){
LOGGER.info("resources is empty,id is {}",id);
return null;
}
List<ResourcesContent> contentList = resourcesContentMapper.selectByResourceId(id);
if(CollectionUtils.isEmpty(contentList)){
LOGGER.info("resourcesContent is empty,id is {}",id);
... ... @@ -97,6 +101,9 @@ public class ResourceServiceImpl implements IResourceService{
private List<ResourceInfoGetBo> initResourceInfoGetBoList(List<ResourcesContent> contentList, List<ResourcesContentData> contentDataList) {
LOGGER.info("enter initResourceInfoGetBoList,contentList is {},contentDataList is {}",contentList,contentDataList);
List<ResourceInfoGetBo> resInfoList = new ArrayList<>();
if(CollectionUtils.isEmpty(contentDataList)){
return resInfoList;
}
for(ResourcesContent resContent : contentList){
List<ResourcesContentData> curContentDatas = contentDataList.stream()
.filter(contentData->resContent.getId().equals(contentData.getResourceContentId()))
... ...