Commit ff44f604 authored by jiaorz's avatar jiaorz

Merge branch 'base-modify' of http://113.105.137.151:22280/youjj/cloud-platform into base-modify

parents d60de735 d721e71e
......@@ -95,7 +95,7 @@ public class ActivityList implements Serializable {
*/
@Column(name = "picture")
@ApiModelProperty(value = "活动图片")
private Integer picture;
private String picture;
/**
* 活动类型
......@@ -109,7 +109,7 @@ public class ActivityList implements Serializable {
*/
@Column(name = "url")
@ApiModelProperty(value = "活动页面链接")
private Integer url;
private String url;
}
......@@ -75,7 +75,7 @@ public class ActivityManagement {
*/
@Column(name = "picture")
@ApiModelProperty(value = "活动图片")
private Integer picture;
private String picture;
/**
* 活动类型
......@@ -89,5 +89,5 @@ public class ActivityManagement {
*/
@Column(name = "url")
@ApiModelProperty(value = "活动页面链接")
private Integer url;
private String url;
}
......@@ -5,6 +5,11 @@ import org.springframework.stereotype.Service;
import com.xxfc.platform.activity.entity.ActivityList;
import com.xxfc.platform.activity.mapper.ActivityListMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.weekend.WeekendSqls;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
/**
* 活动(活动列表)
......@@ -15,4 +20,15 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
*/
@Service
public class ActivityListBiz extends BaseBiz<ActivityListMapper,ActivityList> {
public List<ActivityList> activities () throws InvocationTargetException, IllegalAccessException {
long currentTime = System.currentTimeMillis();
Example exa=Example.builder(ActivityList.class).where(WeekendSqls.<ActivityList>custom()
.andGreaterThanOrEqualTo(ActivityList::getEndTime,currentTime)
.andLessThanOrEqualTo(ActivityList::getStartTime,currentTime)
.andEqualTo(ActivityList::getStatus,1)
).orderByAsc("sort").build();
List<ActivityList> activityLists = selectByExample(exa);
return activityLists;
}
}
\ No newline at end of file
......@@ -34,18 +34,12 @@ public class ActivityManagementBiz extends BaseBiz<ActivityManagementMapper, Act
* @throws IllegalAccessException
*/
public List<ActivityList> selectedActivityManagement() throws InvocationTargetException, IllegalAccessException {
long currentTime = System.currentTimeMillis();
Example exa=Example.builder(ActivityList.class).where(WeekendSqls.<ActivityList>custom()
.andGreaterThanOrEqualTo(ActivityList::getEndTime,currentTime)
.andLessThanOrEqualTo(ActivityList::getStartTime,currentTime)
).orderByAsc("sort").build();
activityListBiz.selectByExample(exa);
List<ActivityList> activityLists = activityListBiz.selectListAll();
return activityLists;
}
/**
* 根据活动id获取活动详情
* @param activityId
......
......@@ -42,6 +42,7 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity
log.error("----活动已超过参与人数----number==="+number);
return;
}
rule.setJoinNumber(joinNumber+1);
Integer activityId=rule.getId();
ActivityUserJoin userJoin=new ActivityUserJoin();
userJoin.setActivityId(activityId);
......@@ -52,6 +53,7 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity
return;
}
insertSelective(userJoin);
ruleBiz.updateById(rule);
}
//领取优惠卷
......
......@@ -96,6 +96,8 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
userCoupon.setStartTime(startTime);
userCoupon.setExpireTime(expireTime);
insertSelective(userCoupon);
coupon.setTakeCount(coupon.getTakeCount()+1);
couponBiz.updateSelectiveById(coupon);
return ticker_no;
}
......@@ -119,22 +121,23 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
}
Long time=System.currentTimeMillis();
List<UserCouponVo> list=mapper.getUserCouponsByType(userId,type,time,channel);
if(amout.compareTo(new BigDecimal("0.00"))>0&&list.size()>0){
if(list.size()>0){
for (UserCouponVo couponVo:list){
Integer status=2;
if(couponVo.getType()==1){
if (amout.compareTo(couponVo.getWithAmount())>=0){
if (amout.compareTo(new BigDecimal("0.00"))>0){
if(couponVo.getType()==1){
if (amout.compareTo(couponVo.getWithAmount())>=0){
status=1;
}
}else if (couponVo.getType()==3){
status=1;
}
}else if (couponVo.getType()==3){
status=1;
}
couponVo.setStatus(status);
}
list.sort(Comparator.comparing(UserCouponVo::getStatus));
}
list.sort(Comparator.comparing(UserCouponVo::getStatus));
return ObjectRestResponse.succ(list);
}
......@@ -170,13 +173,16 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
log.error(userId+"----该优惠卷已使用--tickerNo==");
continue;
}
Integer couponId=userCoupon.getCouponId();
if (type==1){
userCoupon.setIsUse(1);
userCoupon.setOrderNo(orderNo);
userCoupon.setUseTime(System.currentTimeMillis());
updateSelectiveById(userCoupon);
mapper.upUsedCount(couponId,1);
}
couponAmout=couponAmout.add(getCouponAmout(userCoupon.getCouponId(),channel,amout));
couponAmout=couponAmout.add(getCouponAmout(couponId,channel,amout));
}
return couponAmout;
}
......@@ -184,7 +190,7 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
public BigDecimal getCouponAmout(Integer couponId,Integer channel,BigDecimal amout) {
BigDecimal couponAmout = new BigDecimal("0.00");
Coupon coupon = couponBiz.selectById(couponId);
if (coupon != null && coupon.getChannel() == channel) {
if (coupon != null && (coupon.getChannel() == channel||coupon.getChannel()==0)) {
Integer type = coupon.getType();
if (type != null) {
BigDecimal useAmout = coupon.getUsedAmount();
......@@ -208,6 +214,7 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
log.error("----参数不能为空");
return;
}
TickerNo=TickerNo.trim();
Example example=new Example(UserCoupon.class);
example.createCriteria().andEqualTo("tickerNo",TickerNo).andEqualTo("isDel",0);
List<UserCoupon> list=selectByExample(example);
......@@ -224,6 +231,7 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
userCoupon.setOrderNo("");
userCoupon.setUseTime(0L);
updateSelectiveById(userCoupon);
mapper.upUsedCount(userCoupon.getCouponId(),-1);
}
......
......@@ -3,6 +3,7 @@ package com.xxfc.platform.activity.mapper;
import com.xxfc.platform.activity.entity.UserCoupon;
import com.xxfc.platform.activity.vo.UserCouponVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
......@@ -21,5 +22,9 @@ public interface UserCouponMapper extends Mapper<UserCoupon> {
//单个优惠卷
public UserCouponVo getUserCoupon(@Param("tickerNo")String tickerNo);
//已使用的优惠券数量数量加减
@Update("update coupon set used_count=used_count+#{count} where `id`=#{id}")
int upUsedCount(@Param("id")Integer id,@Param("count")Integer count);
}
\ No newline at end of file
package com.xxfc.platform.activity.rest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.activity.biz.ActivityListBiz;
import com.xxfc.platform.activity.entity.ActivityList;
import com.xxfc.platform.activity.entity.ActivityManagement;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
@RestController
@RequestMapping("activityList")
public class ActivityListController extends BaseController<ActivityListBiz,ActivityList> {
/**
* 精彩活动列表
* @return
* @throws InvocationTargetException
* @throws IllegalAccessException
*/
@GetMapping("/app/unauth/activity/findAll")
public ObjectRestResponse<List<ActivityList>> appFindAll() throws InvocationTargetException, IllegalAccessException {
List<ActivityList> list= baseBiz.activities();
return ObjectRestResponse.succ(list);
}
}
\ No newline at end of file
......@@ -15,7 +15,7 @@ import java.util.List;
* @author Administrator
*/
@RestController
@RequestMapping("Management")
@RequestMapping("management")
public class ActivityManagementController extends BaseController<ActivityManagementBiz, ActivityManagement> {
/**
......@@ -31,17 +31,6 @@ public class ActivityManagementController extends BaseController<ActivityManagem
return ObjectRestResponse.succ(list);
}
/**
* 精彩活动列表
* @return
* @throws InvocationTargetException
* @throws IllegalAccessException
*/
@RequestMapping("/app/unauth/activity/findAll")
public ObjectRestResponse<List<ActivityManagement>> appFindAll() throws InvocationTargetException, IllegalAccessException {
List<ActivityList> list= baseBiz.selectedActivityManagement();
return ObjectRestResponse.succ(list);
}
/**
* 查找一条
......
......@@ -206,13 +206,4 @@ public class ActivityPopularizeController extends BaseController<ActivityPopular
return finishUserVO;
}).collect(Collectors.toList()));
}
// public static void main(String[] args) {
// Map<String, String> map = new HashMap<String, String>(){{
//// put("1", null);
//// put("2", null);
// }};
// List<String> list = map.entrySet().stream().map(k -> k.getKey()).collect(Collectors.toList());
// System.out.println(list);
// }
}
\ No newline at end of file
......@@ -7,16 +7,15 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication(scanBasePackages = {
"com.xxfc.platform",
// "com.xxfc.platform.vehicle",
// "com.xxfc.platform.vehicle.biz",
// "com.xxfc.platform.vehicle.rest",
"com.github.wxiaoqi.security.common.handler",
"com.github.wxiaoqi.security.common.log"
})
//@ComponentScan(basePackages={"com.xxfc.platform.vehicle.rest"})
@EnableDiscoveryClient
@EnableScheduling
@EnableAceAuthClient
......
......@@ -234,8 +234,6 @@
<!-- </foreach>-->
<!-- </trim>-->
)
)
)
</if>
<if test="mRangeDateEnd !=null">
and v.maintenance_date &lt;= #{mRangeDateEnd}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment