xx
This commit is contained in:
commit
e9ef973965
@ -378,6 +378,7 @@ public class DingTalkUtil {
|
||||
luckRecord.setStaffId(staffEntity.getId());
|
||||
luckRecord.setLuckId(luckId);
|
||||
luckRecord.setName(staffEntity.getName());
|
||||
luckRecord.setMobile(staffEntity.getMobile());
|
||||
luckRecordService.insertLuckRecord(luckRecord);
|
||||
}
|
||||
|
||||
|
||||
@ -65,6 +65,9 @@ public class ShiroConfig {
|
||||
filterMap.put("/dtlg/login", "anon");
|
||||
filterMap.put("/dtlg/luck", "anon");
|
||||
filterMap.put("/dtlg/look", "anon");
|
||||
filterMap.put("/luck/getLuckById", "anon");
|
||||
filterMap.put("/thirdAppConfig/syn", "anon");
|
||||
filterMap.put("/luck/updateLuck", "anon");
|
||||
filterMap.put("/**", "oauth2");
|
||||
shiroFilter.setFilterChainDefinitionMap(filterMap);
|
||||
|
||||
|
||||
@ -1,18 +1,21 @@
|
||||
package com.lz.modules.luck.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.luck.entity.Luck;
|
||||
import com.lz.modules.luck.entity.*;
|
||||
import com.lz.modules.luck.service.LuckGoodsService;
|
||||
import com.lz.modules.luck.service.LuckRecordService;
|
||||
import com.lz.modules.luck.service.LuckService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@ -23,6 +26,12 @@ public class LuckController {
|
||||
@Autowired
|
||||
private LuckService luckService;
|
||||
|
||||
@Autowired
|
||||
private LuckGoodsService luckGoodsService;
|
||||
|
||||
@Autowired
|
||||
private LuckRecordService luckRecordService;
|
||||
|
||||
|
||||
@RequestMapping("/list")
|
||||
public R list(@RequestBody String body) {
|
||||
@ -37,8 +46,111 @@ public class LuckController {
|
||||
return R.ok().put("luck",luck);
|
||||
}
|
||||
|
||||
@GetMapping("/getLuckById")
|
||||
public R getLuckById(@RequestParam Long luckId) {
|
||||
return getLuck(luckId);
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
private R getLuck(Long luckId){
|
||||
Luck luck = luckService.selectLuckById(luckId);
|
||||
if(luck != null){
|
||||
LuckDetailInfoReq luckDetailInfoReq = new LuckDetailInfoReq();
|
||||
if(luck.getFinish().intValue() == 0){//活动未结束
|
||||
luckDetailInfoReq.setId(luckId);
|
||||
luckDetailInfoReq.setName(luck.getName());
|
||||
List<LuckGoods> luckGoods = luckGoodsService.getByLuckId(luckId);
|
||||
if(luckGoods.size() > 0){
|
||||
List<LuckGoodsReq> luckGoodsReqs = new ArrayList<>();
|
||||
for (LuckGoods luckGood:luckGoods
|
||||
) {
|
||||
LuckGoodsReq luckGoodsReq = new LuckGoodsReq();
|
||||
luckGoodsReq.setCounts(luckGood.getCounts());
|
||||
luckGoodsReq.setId(luckGood.getId());
|
||||
luckGoodsReq.setName(luckGood.getName());
|
||||
luckGoodsReq.setWeight(luckGood.getWeight());
|
||||
luckGoodsReqs.add(luckGoodsReq);
|
||||
}
|
||||
luckDetailInfoReq.setLuckGoodsReqs(luckGoodsReqs);
|
||||
List<LuckRecord> luckRecords = luckRecordService.selectLuckRecordByLuckId(String.valueOf(luckId));
|
||||
if(luckRecords.size() > 0){
|
||||
List<LuckRecordReq> luckRecordReqList = new ArrayList<>();
|
||||
for (LuckRecord luckRecord:luckRecords
|
||||
) {
|
||||
LuckRecordReq luckRecordReq = new LuckRecordReq();
|
||||
luckRecordReq.setName(luckRecord.getName());
|
||||
luckRecordReq.setId(luckRecord.getId());
|
||||
luckRecordReq.setGoodsId(luckRecord.getGoodsId());
|
||||
luckRecordReq.setGoodsName(luckRecord.getGoodsName());
|
||||
luckRecordReq.setIsLuck(luckRecord.getIsLuck());
|
||||
luckRecordReq.setWeight(luckRecord.getWeight());
|
||||
luckRecordReq.setMobile(luckRecord.getMobile());
|
||||
luckRecordReqList.add(luckRecordReq);
|
||||
}
|
||||
luckDetailInfoReq.setLuckRecordReqs(luckRecordReqList);
|
||||
return R.ok().put("luck",luckDetailInfoReq);
|
||||
}
|
||||
return R.error("活动暂无人员报名");
|
||||
}
|
||||
return R.error("活动无相关奖品信息");
|
||||
}else{
|
||||
//获取获奖人员信息
|
||||
luckDetailInfoReq.setIsFinish(1);
|
||||
luckDetailInfoReq.setId(luckId);
|
||||
luckDetailInfoReq.setName(luck.getName());
|
||||
List<LuckRecord> luckRecords = luckRecordService.selectGoodLuckRecordByLuckId(String.valueOf(luckId));
|
||||
if(luckRecords.size() > 0) {
|
||||
List<LuckRecordReq> luckRecordReqList = new ArrayList<>();
|
||||
for (LuckRecord luckRecord : luckRecords
|
||||
) {
|
||||
LuckRecordReq luckRecordReq = new LuckRecordReq();
|
||||
luckRecordReq.setName(luckRecord.getName());
|
||||
luckRecordReq.setId(luckRecord.getId());
|
||||
luckRecordReq.setGoodsId(luckRecord.getGoodsId());
|
||||
luckRecordReq.setGoodsName(luckRecord.getGoodsName());
|
||||
luckRecordReq.setIsLuck(luckRecord.getIsLuck());
|
||||
luckRecordReq.setWeight(luckRecord.getWeight());
|
||||
luckRecordReq.setMobile(luckRecord.getMobile());
|
||||
luckRecordReqList.add(luckRecordReq);
|
||||
}
|
||||
luckDetailInfoReq.setLuckRecordReqs(luckRecordReqList);
|
||||
return R.ok().put("luck", luckDetailInfoReq);
|
||||
}
|
||||
}
|
||||
}
|
||||
return R.error("无相关活动");
|
||||
}
|
||||
|
||||
@PostMapping("/updateLuck")
|
||||
public R updateLuck(@RequestBody String body) {
|
||||
JSONArray jsonArray = JSONObject.parseArray(body);
|
||||
Long luckId = 0L;
|
||||
for(int i = 0; i < jsonArray.size(); i++){
|
||||
JSONObject json = jsonArray.getJSONObject(i);
|
||||
LuckRecordReq luckRecordReq = json.toJavaObject(LuckRecordReq.class);
|
||||
luckId = luckRecordReq.getLuckId();
|
||||
luckRecordService.updateLuckRecordByReqWithId(luckRecordReq);
|
||||
}
|
||||
int count = luckRecordService.selectCountGoodLuckRecordByLuckId(luckId);
|
||||
|
||||
int count1 = luckGoodsService.selectNumGoodLuckRecordByLuckId(luckId);
|
||||
if(count < count1){
|
||||
//获取未中奖人列表
|
||||
return getLuck(luckId);
|
||||
}else{
|
||||
//设置中将结束
|
||||
luckService.setLuckFinishById(luckId);
|
||||
Luck luck = luckService.selectLuckById(luckId);
|
||||
LuckDetailInfoReq luckDetailInfoReq = new LuckDetailInfoReq();
|
||||
luckDetailInfoReq.setIsFinish(1);
|
||||
luckDetailInfoReq.setName(luck.getName());
|
||||
luckDetailInfoReq.setId(luck.getId());
|
||||
return R.ok().put("luck", luckDetailInfoReq);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping("/update")
|
||||
public R update(@RequestBody Luck luck) {
|
||||
luckService.updateLuckById(luck);
|
||||
return R.ok();
|
||||
|
||||
@ -11,6 +11,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lz.modules.luck.entity.LuckGoods;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface LuckGoodsMapper extends BaseMapper<LuckGoods> {
|
||||
|
||||
@ -30,4 +33,7 @@ public interface LuckGoodsMapper extends BaseMapper<LuckGoods> {
|
||||
int deleteLuckGoodsById(@Param("id")Long id);
|
||||
|
||||
|
||||
List<LuckGoods> getByLuckId(@Param("luckId") Long luckId);
|
||||
|
||||
int selectNumGoodLuckRecordByLuckId(@Param("luckId") Long luckId);
|
||||
}
|
||||
@ -30,4 +30,5 @@ public interface LuckMapper extends BaseMapper<Luck> {
|
||||
int deleteLuckById(@Param("id")Long id);
|
||||
|
||||
|
||||
void setLuckFinishById(Long luckId);
|
||||
}
|
||||
@ -9,6 +9,7 @@ package com.lz.modules.luck.dao;
|
||||
*/
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lz.modules.luck.entity.LuckRecord;
|
||||
import com.lz.modules.luck.entity.LuckRecordReq;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -36,4 +37,10 @@ public interface LuckRecordMapper extends BaseMapper<LuckRecord> {
|
||||
LuckRecord selectLuckRecordByLuckIdAndStaffId(@Param("luckId") Long luckId, @Param("id") Long id);
|
||||
|
||||
List<LuckRecord> selectLuckRecordByLuckId(@Param("luckId") String luckId);
|
||||
|
||||
void updateLuckRecordByReqWithId(LuckRecordReq luckRecordReq);
|
||||
|
||||
List<LuckRecord> selectGoodLuckRecordByLuckId(String luckId);
|
||||
|
||||
int selectCountGoodLuckRecordByLuckId(@Param("luckId") Long luckId);
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.lz.modules.luck.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
@Data
|
||||
public class LuckDetailInfoReq {
|
||||
private String name;//活动名称
|
||||
private Long Id;//活动名称
|
||||
private int isFinish;//活动是否结束
|
||||
private List<LuckGoodsReq> luckGoodsReqs;//奖品列表
|
||||
private List<LuckRecordReq> luckRecordReqs;//参与抽奖人员列表
|
||||
}
|
||||
@ -28,7 +28,7 @@ public class LuckGoods implements java.io.Serializable {
|
||||
private Long luckId;
|
||||
//奖品名称
|
||||
private String name;
|
||||
//权重
|
||||
//权重权重,抽奖顺序
|
||||
private Integer weight;
|
||||
//备注
|
||||
private String remark;
|
||||
@ -125,14 +125,14 @@ public class LuckGoods implements java.io.Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* 权重
|
||||
* 权重 权重,抽奖顺序
|
||||
* @return
|
||||
*/
|
||||
public Integer getWeight() {
|
||||
return weight;
|
||||
}
|
||||
/**
|
||||
* 权重
|
||||
* 权重 权重,抽奖顺序
|
||||
* @param weight
|
||||
*/
|
||||
public void setWeight(Integer weight) {
|
||||
|
||||
@ -13,26 +13,13 @@ import java.util.Date;
|
||||
@Data
|
||||
public class LuckGoodsReq implements java.io.Serializable {
|
||||
|
||||
private int page = 1;
|
||||
private int rows = 10;
|
||||
private String sort;
|
||||
private String order;
|
||||
//
|
||||
|
||||
private Long id;
|
||||
//
|
||||
private Integer isDelete;
|
||||
//
|
||||
private Date gmtCreate;
|
||||
//
|
||||
private Date gmtModified;
|
||||
//活动ID
|
||||
private Long luckId;
|
||||
|
||||
//奖品名称
|
||||
private String name;
|
||||
//权重
|
||||
private Integer weight;
|
||||
//备注
|
||||
private String remark;
|
||||
//数量
|
||||
private Integer counts;
|
||||
/**
|
||||
@ -50,65 +37,7 @@ public class LuckGoodsReq implements java.io.Serializable {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Integer getIsDelete() {
|
||||
return isDelete;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param isDelete
|
||||
*/
|
||||
public void setIsDelete(Integer isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Date getGmtCreate() {
|
||||
return gmtCreate;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param gmtCreate
|
||||
*/
|
||||
public void setGmtCreate(Date gmtCreate) {
|
||||
this.gmtCreate = gmtCreate;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Date getGmtModified() {
|
||||
return gmtModified;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param gmtModified
|
||||
*/
|
||||
public void setGmtModified(Date gmtModified) {
|
||||
this.gmtModified = gmtModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动ID
|
||||
* @return
|
||||
*/
|
||||
public Long getLuckId() {
|
||||
return luckId;
|
||||
}
|
||||
/**
|
||||
* 活动ID
|
||||
* @param luckId
|
||||
*/
|
||||
public void setLuckId(Long luckId) {
|
||||
this.luckId = luckId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 奖品名称
|
||||
@ -140,20 +69,7 @@ public class LuckGoodsReq implements java.io.Serializable {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
/**
|
||||
* 备注
|
||||
* @return
|
||||
*/
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
/**
|
||||
* 备注
|
||||
* @param remark
|
||||
*/
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 数量
|
||||
@ -174,13 +90,8 @@ public class LuckGoodsReq implements java.io.Serializable {
|
||||
public String toString() {
|
||||
return "LuckGoods{" +
|
||||
",id=" + id +
|
||||
",isDelete=" + isDelete +
|
||||
",gmtCreate=" + gmtCreate +
|
||||
",gmtModified=" + gmtModified +
|
||||
",luckId=" + luckId +
|
||||
",name=" + name +
|
||||
",weight=" + weight +
|
||||
",remark=" + remark +
|
||||
",counts=" + counts +
|
||||
"}";
|
||||
}
|
||||
|
||||
@ -28,7 +28,9 @@ public class LuckRecord implements java.io.Serializable {
|
||||
private Long staffId;
|
||||
//姓名
|
||||
private String name;
|
||||
//是否中将 0为中将 1中将
|
||||
//手机号
|
||||
private String mobile;
|
||||
//是否中将 0为中将 是否中将 0为中将 1 特等奖或者一等奖,以此类推
|
||||
private Integer isLuck;
|
||||
//权重,或者排序
|
||||
private Integer weight;
|
||||
|
||||
@ -13,22 +13,11 @@ import java.util.Date;
|
||||
@Data
|
||||
public class LuckRecordReq implements java.io.Serializable {
|
||||
|
||||
private int page = 1;
|
||||
private int rows = 10;
|
||||
private String sort;
|
||||
private String order;
|
||||
//
|
||||
|
||||
private Long id;
|
||||
//是否删除 0未删除 1删除
|
||||
private Integer isDelete;
|
||||
//
|
||||
private Date gmtCreate;
|
||||
//
|
||||
private Date gmtModified;
|
||||
//员工staff_id
|
||||
private Long staffId;
|
||||
//姓名
|
||||
private String name;
|
||||
private String mobile;
|
||||
//是否中将 0为中将 1中将
|
||||
private Integer isLuck;
|
||||
//权重,或者排序
|
||||
@ -39,8 +28,6 @@ public class LuckRecordReq implements java.io.Serializable {
|
||||
private String goodsName;
|
||||
//奖品ID,目前不设置ID了
|
||||
private Long goodsId;
|
||||
//备注
|
||||
private String remark;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
@ -56,66 +43,6 @@ public class LuckRecordReq implements java.io.Serializable {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否删除 0未删除 1删除
|
||||
* @return
|
||||
*/
|
||||
public Integer getIsDelete() {
|
||||
return isDelete;
|
||||
}
|
||||
/**
|
||||
* 是否删除 0未删除 1删除
|
||||
* @param isDelete
|
||||
*/
|
||||
public void setIsDelete(Integer isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Date getGmtCreate() {
|
||||
return gmtCreate;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param gmtCreate
|
||||
*/
|
||||
public void setGmtCreate(Date gmtCreate) {
|
||||
this.gmtCreate = gmtCreate;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Date getGmtModified() {
|
||||
return gmtModified;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param gmtModified
|
||||
*/
|
||||
public void setGmtModified(Date gmtModified) {
|
||||
this.gmtModified = gmtModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工staff_id
|
||||
* @return
|
||||
*/
|
||||
public Long getStaffId() {
|
||||
return staffId;
|
||||
}
|
||||
/**
|
||||
* 员工staff_id
|
||||
* @param staffId
|
||||
*/
|
||||
public void setStaffId(Long staffId) {
|
||||
this.staffId = staffId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
* @return
|
||||
@ -206,36 +133,18 @@ public class LuckRecordReq implements java.io.Serializable {
|
||||
this.goodsId = goodsId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 备注
|
||||
* @return
|
||||
*/
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
/**
|
||||
* 备注
|
||||
* @param remark
|
||||
*/
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LuckRecord{" +
|
||||
",id=" + id +
|
||||
",isDelete=" + isDelete +
|
||||
",gmtCreate=" + gmtCreate +
|
||||
",gmtModified=" + gmtModified +
|
||||
",staffId=" + staffId +
|
||||
",name=" + name +
|
||||
",isLuck=" + isLuck +
|
||||
",weight=" + weight +
|
||||
",luckId=" + luckId +
|
||||
",goodsName=" + goodsName +
|
||||
",goodsId=" + goodsId +
|
||||
",remark=" + remark +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,8 @@ package com.lz.modules.luck.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.lz.modules.luck.entity.LuckGoods;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 奖品表 服务类
|
||||
@ -30,4 +32,8 @@ public interface LuckGoodsService extends IService<LuckGoods> {
|
||||
int deleteLuckGoodsById(Long id);
|
||||
|
||||
|
||||
List<LuckGoods> getByLuckId(Long luckId);
|
||||
|
||||
//获取奖品总数
|
||||
int selectNumGoodLuckRecordByLuckId(Long luckId);
|
||||
}
|
||||
@ -2,6 +2,7 @@ package com.lz.modules.luck.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.lz.modules.luck.entity.LuckRecord;
|
||||
import com.lz.modules.luck.entity.LuckRecordReq;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -35,4 +36,10 @@ public interface LuckRecordService extends IService<LuckRecord> {
|
||||
LuckRecord selectLuckRecordByLuckIdAndStaffId(Long luckId, Long id);
|
||||
|
||||
List<LuckRecord> selectLuckRecordByLuckId(String luckId);
|
||||
|
||||
void updateLuckRecordByReqWithId(LuckRecordReq luckRecordReq);
|
||||
|
||||
List<LuckRecord> selectGoodLuckRecordByLuckId(String valueOf);
|
||||
//获取中奖人数
|
||||
int selectCountGoodLuckRecordByLuckId(Long luckId);
|
||||
}
|
||||
@ -30,4 +30,5 @@ public interface LuckService extends IService<Luck> {
|
||||
int deleteLuckById(Long id);
|
||||
|
||||
|
||||
void setLuckFinishById(Long luckId);
|
||||
}
|
||||
@ -7,6 +7,8 @@ import com.lz.modules.luck.service.LuckGoodsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 奖品表 服务类
|
||||
@ -58,6 +60,14 @@ public class LuckGoodsServiceImpl extends ServiceImpl<LuckGoodsMapper, LuckGoods
|
||||
return luckGoodsMapper.deleteLuckGoodsById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LuckGoods> getByLuckId(Long luckId){
|
||||
return luckGoodsMapper.getByLuckId(luckId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int selectNumGoodLuckRecordByLuckId(Long luckId){
|
||||
return luckGoodsMapper.selectNumGoodLuckRecordByLuckId(luckId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.lz.modules.luck.service.impl;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.lz.modules.luck.dao.LuckRecordMapper;
|
||||
import com.lz.modules.luck.entity.LuckRecord;
|
||||
import com.lz.modules.luck.entity.LuckRecordReq;
|
||||
import com.lz.modules.luck.service.LuckRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -70,4 +71,20 @@ public class LuckRecordServiceImpl extends ServiceImpl<LuckRecordMapper, LuckRec
|
||||
return luckRecordMapper.selectLuckRecordByLuckId(luckId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLuckRecordByReqWithId(LuckRecordReq luckRecordReq){
|
||||
luckRecordMapper.updateLuckRecordByReqWithId(luckRecordReq);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LuckRecord> selectGoodLuckRecordByLuckId(String luckId){
|
||||
return luckRecordMapper.selectGoodLuckRecordByLuckId(luckId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int selectCountGoodLuckRecordByLuckId(Long luckId){
|
||||
return luckRecordMapper.selectCountGoodLuckRecordByLuckId(luckId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -58,6 +58,11 @@ public class LuckServiceImpl extends ServiceImpl<LuckMapper, Luck> implements Lu
|
||||
return luckMapper.deleteLuckById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLuckFinishById(Long luckId){
|
||||
luckMapper.setLuckFinishById(luckId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import com.lz.modules.luck.entity.Luck;
|
||||
import com.lz.modules.luck.entity.LuckRecord;
|
||||
import com.lz.modules.luck.service.LuckRecordService;
|
||||
import com.lz.modules.luck.service.LuckService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -17,6 +18,7 @@ import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/dtlg")
|
||||
@Slf4j
|
||||
public class DingTalkLoginController {
|
||||
@Autowired
|
||||
DingtalkBusiness dingtalkBusiness;
|
||||
@ -27,6 +29,7 @@ public class DingTalkLoginController {
|
||||
static String appid = "855818566";
|
||||
@PostMapping("/login")
|
||||
public R login(@RequestBody String body){
|
||||
log.info("钉钉免登录luck{}", body);
|
||||
JSONObject json = JSONObject.parseObject(body);
|
||||
return dingtalkBusiness.login(json.getString("code"), appid);
|
||||
|
||||
@ -34,6 +37,7 @@ public class DingTalkLoginController {
|
||||
|
||||
@PostMapping("/luck")
|
||||
public R luck(@RequestBody String body){
|
||||
log.info("luck{}", body);
|
||||
JSONObject json = JSONObject.parseObject(body);
|
||||
Luck luck = luckService.selectLuckById(1L);//默认第一个活动
|
||||
if(luck.getStopTime().getTime() > System.currentTimeMillis()){
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
<!--<include resource="org/springframework/boot/logging/logback/base.xml"/>-->
|
||||
<!-- 定义log文件的目录 -->
|
||||
<property name="LOG_HOME" value="d:\log"></property>
|
||||
<property name="LOG_HOME" value="log"></property>
|
||||
|
||||
|
||||
<conversionRule conversionWord="sampleClass" converterClass="com.lz.common.layouts.SampleClassConverter" />
|
||||
|
||||
120
src/main/resources/logback-prod.xml
Normal file
120
src/main/resources/logback-prod.xml
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
|
||||
<!--<include resource="org/springframework/boot/logging/logback/base.xml"/>-->
|
||||
<!-- 定义log文件的目录 -->
|
||||
<property name="LOG_HOME" value="log"></property>
|
||||
|
||||
|
||||
<conversionRule conversionWord="sampleClass" converterClass="com.lz.common.layouts.SampleClassConverter" />
|
||||
<conversionRule conversionWord="sampleLine" converterClass="com.lz.common.layouts.SampleLineConverter" />
|
||||
|
||||
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<!-- %.-1level 只显示信息级别的首字母,%-5level 左对齐显示信息级别全称 -->
|
||||
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} 【%p】 [%sampleClass:%sampleLine] %m%n</Pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>INFO</level>
|
||||
</filter>
|
||||
</appender>
|
||||
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_HOME}/info.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_HOME}/logs/info.%d{yyyy-MM-dd-HH }.%i.log</fileNamePattern>
|
||||
<!--单文件日志最大的大小-->
|
||||
<maxFileSize>500MB</maxFileSize>
|
||||
|
||||
<!-- <maxHistory>180</maxHistory>-->
|
||||
<!--总文件日志最大的大小-->
|
||||
<!--<totalSizeCap>100GB</totalSizeCap>-->
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} 【%p】 [%sampleClass:%sampleLine] %m%n</Pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>INFO</level>
|
||||
</filter>
|
||||
</appender>
|
||||
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_HOME}/warn.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_HOME}/logs/warn.%d{yyyy-MM-dd-HH }.%i.log</fileNamePattern>
|
||||
<maxFileSize>500MB</maxFileSize>
|
||||
<!-- <maxHistory>180</maxHistory>-->
|
||||
<!--<totalSizeCap>100GB</totalSizeCap>-->
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} 【%p】 [%sampleClass:%sampleLine] %m%n</Pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>WARN</level>
|
||||
</filter>
|
||||
</appender>
|
||||
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_HOME}/error.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_HOME}/logs/error.%d{yyyy-MM-dd-HH }.%i.log</fileNamePattern>
|
||||
<maxFileSize>500MB</maxFileSize>
|
||||
<!-- <maxHistory>180</maxHistory>-->
|
||||
<!--<totalSizeCap>100GB</totalSizeCap>-->
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} 【%p】 [%sampleClass:%sampleLine] %m%n</Pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>ERROR</level>
|
||||
</filter>
|
||||
</appender>
|
||||
<appender name="ALL_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_HOME}/all.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
|
||||
<fileNamePattern>${LOG_HOME}/logs/all.%i.log.gz</fileNamePattern>
|
||||
<minIndex>0</minIndex>
|
||||
<maxIndex>0</maxIndex>
|
||||
</rollingPolicy>
|
||||
<triggeringPolicy
|
||||
class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
|
||||
<maxFileSize>1GB</maxFileSize>
|
||||
</triggeringPolicy>
|
||||
<encoder>
|
||||
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} 【%p】 [%sampleClass:%sampleLine] %m%n</Pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>INFO</level>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="PL_BI_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${LOG_HOME}/bi.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${LOG_HOME}/logs/bi.%d{yyyy-MM-dd-HH }.%i.log</fileNamePattern>
|
||||
<!--单文件日志最大的大小-->
|
||||
<maxFileSize>500MB</maxFileSize>
|
||||
|
||||
<!-- <maxHistory>180</maxHistory>-->
|
||||
<!--总文件日志最大的大小-->
|
||||
<!--<totalSizeCap>100GB</totalSizeCap>-->
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} 【%p】 [%sampleClass:%sampleLine] %m%n</Pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>INFO</level>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<logger name="PL_BI" level="INFO">
|
||||
<appender-ref ref="PL_BI_FILE"/>
|
||||
</logger>
|
||||
|
||||
<root level="INFO">
|
||||
<!--<appender-ref ref="INFO_FILE" />-->
|
||||
<!--<appender-ref ref="WARN_FILE" />-->
|
||||
<!--<appender-ref ref="ERROR_FILE" />-->
|
||||
<!--<appender-ref ref="ALL_FILE" />-->
|
||||
<appender-ref ref="STDOUT"/>
|
||||
</root>
|
||||
</configuration>
|
||||
@ -89,5 +89,12 @@
|
||||
update luck_goods set is_delete = 1 where id=#{id} limit 1
|
||||
</update>
|
||||
|
||||
<select id="getByLuckId" resultType="LuckGoods" >
|
||||
select * from luck_goods where luck_id=#{luckId} and is_delete = 0 order by weight desc
|
||||
</select>
|
||||
|
||||
<select id="selectNumGoodLuckRecordByLuckId" parameterType="java.lang.Long" resultType="integer">
|
||||
select sum(counts) from luck_goods where luck_id=#{luckId} and is_delete = 0
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
||||
@ -91,7 +91,11 @@
|
||||
|
||||
|
||||
<update id="deleteLuckById" parameterType="java.lang.Long">
|
||||
update luck set is_delete = 1 where id=#{id} limit 1
|
||||
update luck set is_delete = 1, gmt_modified=now() where id=#{id} limit 1
|
||||
</update>
|
||||
|
||||
<update id="setLuckFinishById" parameterType="java.lang.Long">
|
||||
update luck set finish = 1, gmt_modified=now() where id=#{luckId} limit 1
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
<result column="gmt_modified" property="gmtModified"/>
|
||||
<result column="staff_id" property="staffId"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="mobile" property="mobile"/>
|
||||
<result column="is_luck" property="isLuck"/>
|
||||
<result column="weight" property="weight"/>
|
||||
<result column="luck_id" property="luckId"/>
|
||||
@ -21,7 +22,7 @@
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, staff_id AS staffId, name AS name, is_luck AS isLuck, weight AS weight, luck_id AS luckId, goods_name AS goodsName, goods_id AS goodsId, remark AS remark
|
||||
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, staff_id AS staffId, name AS name, mobile AS mobile, is_luck AS isLuck, weight AS weight, luck_id AS luckId, goods_name AS goodsName, goods_id AS goodsId, remark AS remark
|
||||
</sql>
|
||||
|
||||
|
||||
@ -36,6 +37,7 @@
|
||||
insert into luck_record(
|
||||
<if test="staffId != null">staff_id, </if>
|
||||
<if test="name != null">name, </if>
|
||||
<if test="moblie != null">name, </if>
|
||||
<if test="isLuck != null">is_luck, </if>
|
||||
<if test="weight != null">weight, </if>
|
||||
<if test="luckId != null">luck_id, </if>
|
||||
@ -48,6 +50,7 @@
|
||||
)values(
|
||||
<if test="staffId != null">#{ staffId}, </if>
|
||||
<if test="name != null">#{ name}, </if>
|
||||
<if test="mobile != null">#{ mobile}, </if>
|
||||
<if test="isLuck != null">#{ isLuck}, </if>
|
||||
<if test="weight != null">#{ weight}, </if>
|
||||
<if test="luckId != null">#{ luckId}, </if>
|
||||
@ -69,6 +72,7 @@
|
||||
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
|
||||
<if test="staffId != null">staff_id = #{staffId},</if>
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="mobile != null">mobile = #{mobile},</if>
|
||||
<if test="isLuck != null">is_luck = #{isLuck},</if>
|
||||
<if test="weight != null">weight = #{weight},</if>
|
||||
<if test="luckId != null">luck_id = #{luckId},</if>
|
||||
@ -89,6 +93,7 @@
|
||||
gmt_create = #{gmtCreate},
|
||||
staff_id = #{staffId},
|
||||
name = #{name},
|
||||
mobile = #{mobile},
|
||||
is_luck = #{isLuck},
|
||||
weight = #{weight},
|
||||
luck_id = #{luckId},
|
||||
@ -109,7 +114,27 @@
|
||||
</select>
|
||||
|
||||
<select id="selectLuckRecordByLuckId" resultType="LuckRecord" >
|
||||
select * from luck_record where luck_id=#{luckId}and is_delete = 0
|
||||
select * from luck_record where luck_id=#{luckId}and is_delete = 0 order by is_luck desc
|
||||
</select>
|
||||
|
||||
<update id="updateLuckRecordByReqWithId" parameterType="LuckRecordReq" >
|
||||
update
|
||||
luck_record
|
||||
set
|
||||
is_luck = #{isLuck},
|
||||
luck_id = #{luckId},
|
||||
goods_name = #{goodsName},
|
||||
goods_id = #{goodsId}
|
||||
,gmt_modified = now()
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="selectGoodLuckRecordByLuckId" resultType="LuckRecord" >
|
||||
select * from luck_record where luck_id=#{luckId}and is_delete = 0 and is_luck=1 order by goods_id asc
|
||||
</select>
|
||||
|
||||
<select id="selectCountGoodLuckRecordByLuckId" parameterType="java.lang.Long" resultType="integer">
|
||||
select count(1) from luck_record where luck_id=#{luckId} and is_delete = 0 and is_luck=1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user