记得上下班打卡 | git大法好,push需谨慎

Commit 7ff5cb17 authored by zhengfuxin's avatar zhengfuxin

添加活动。

parent 8f98f383
...@@ -13,4 +13,7 @@ import com.liquidnet.service.kylin.dao.KylinAcitve; ...@@ -13,4 +13,7 @@ import com.liquidnet.service.kylin.dao.KylinAcitve;
*/ */
public interface IKylinAcitveService extends IService<KylinAcitve> { public interface IKylinAcitveService extends IService<KylinAcitve> {
boolean addKylinAcitve(KylinAcitve kylinAcitve);
} }
package com.liquidnet.client.admin.zhengzai.kylin.service.impl; package com.liquidnet.client.admin.zhengzai.kylin.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.kylin.dao.KylinAcitve; import com.liquidnet.service.kylin.dao.KylinAcitve;
import com.liquidnet.service.kylin.dao.KylinTicketActive;
import com.liquidnet.service.kylin.mapper.KylinAcitveMapper; import com.liquidnet.service.kylin.mapper.KylinAcitveMapper;
import com.liquidnet.service.kylin.mapper.KylinTicketActiveMapper;
import com.liquidnet.service.kylin.service.IKylinAcitveService; import com.liquidnet.service.kylin.service.IKylinAcitveService;
import com.liquidnet.service.kylin.service.IKylinTicketActiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
/** /**
* <p> * <p>
...@@ -16,5 +26,35 @@ import org.springframework.stereotype.Service; ...@@ -16,5 +26,35 @@ import org.springframework.stereotype.Service;
*/ */
@Service @Service
public class KylinAcitveServiceImpl extends ServiceImpl<KylinAcitveMapper, KylinAcitve> implements IKylinAcitveService { public class KylinAcitveServiceImpl extends ServiceImpl<KylinAcitveMapper, KylinAcitve> implements IKylinAcitveService {
@Autowired
private KylinAcitveMapper kylinAcitveMapper;
@Autowired
private KylinTicketActiveMapper kylinTicketActiveMapper;
@Autowired
private IKylinTicketActiveService iKylinTicketActiveService;
@Override
@Transactional
public boolean addKylinAcitve(KylinAcitve kylinAcitve) {
//kylinAcitve.setActiveId();
//保存活动
kylinAcitveMapper.insert(kylinAcitve);
//创建券
iKylinTicketActiveService.saveBatch(getKylinTicketActive(kylinAcitve.getNumber(),kylinAcitve.getActiveId()));
return true;
}
public List<KylinTicketActive> getKylinTicketActive(int number,String activeId){
List<KylinTicketActive> list = new ArrayList<>();
if(number>0){
KylinTicketActive kylinTicketActive=new KylinTicketActive();
kylinTicketActive.setActivityId(activeId);
kylinTicketActive.setCode(IDGenerator.createCode(3, 4, true));
kylinTicketActive.setState(1);
kylinTicketActive.setCreatedAt(LocalDateTime.now());
kylinTicketActive.setUpdatedAt(LocalDateTime.now());
list.add(kylinTicketActive);
}
return null;
}
} }
...@@ -40,7 +40,7 @@ public class KylinAcitve implements Serializable { ...@@ -40,7 +40,7 @@ public class KylinAcitve implements Serializable {
/** /**
* activeId * activeId
*/ */
private Integer activeId; private String activeId;
/** /**
* 创建时间 * 创建时间
......
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