From d0876216ccce4c09dd170b7b89d033d948ae6a11 Mon Sep 17 00:00:00 2001 From: wulin Date: Fri, 21 Aug 2020 17:30:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=92=89=E9=92=89=E5=85=8D?= =?UTF-8?q?=E7=99=BB=EF=BC=8C=E6=8A=BD=E5=A5=96=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/lz/common/utils/DingTalkUtil.java | 41 +++ src/main/java/com/lz/config/ShiroConfig.java | 2 + .../job/business/DingtalkBusiness.java | 8 + .../luck/controller/LuckController.java | 60 +++++ .../luck/controller/LuckGoodsController.java | 59 +++++ .../luck/controller/LuckRecordController.java | 59 +++++ .../lz/modules/luck/dao/LuckGoodsMapper.java | 33 +++ .../com/lz/modules/luck/dao/LuckMapper.java | 33 +++ .../lz/modules/luck/dao/LuckRecordMapper.java | 39 +++ .../java/com/lz/modules/luck/entity/Luck.java | 204 +++++++++++++++ .../com/lz/modules/luck/entity/LuckGoods.java | 186 ++++++++++++++ .../lz/modules/luck/entity/LuckGoodsReq.java | 187 ++++++++++++++ .../lz/modules/luck/entity/LuckRecord.java | 240 +++++++++++++++++ .../lz/modules/luck/entity/LuckRecordReq.java | 241 ++++++++++++++++++ .../com/lz/modules/luck/entity/LuckReq.java | 169 ++++++++++++ .../luck/service/LuckGoodsService.java | 33 +++ .../luck/service/LuckRecordService.java | 38 +++ .../lz/modules/luck/service/LuckService.java | 33 +++ .../service/impl/LuckGoodsServiceImpl.java | 63 +++++ .../service/impl/LuckRecordServiceImpl.java | 73 ++++++ .../luck/service/impl/LuckServiceImpl.java | 63 +++++ .../controller/DingTalkLoginController.java | 49 +++- .../resources/mapper/luck/LuckGoodsMapper.xml | 93 +++++++ src/main/resources/mapper/luck/LuckMapper.xml | 98 +++++++ .../mapper/luck/LuckRecordMapper.xml | 116 +++++++++ src/test/java/com/lz/mysql/MysqlMain.java | 2 +- 26 files changed, 2217 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/lz/modules/luck/controller/LuckController.java create mode 100644 src/main/java/com/lz/modules/luck/controller/LuckGoodsController.java create mode 100644 src/main/java/com/lz/modules/luck/controller/LuckRecordController.java create mode 100644 src/main/java/com/lz/modules/luck/dao/LuckGoodsMapper.java create mode 100644 src/main/java/com/lz/modules/luck/dao/LuckMapper.java create mode 100644 src/main/java/com/lz/modules/luck/dao/LuckRecordMapper.java create mode 100644 src/main/java/com/lz/modules/luck/entity/Luck.java create mode 100644 src/main/java/com/lz/modules/luck/entity/LuckGoods.java create mode 100644 src/main/java/com/lz/modules/luck/entity/LuckGoodsReq.java create mode 100644 src/main/java/com/lz/modules/luck/entity/LuckRecord.java create mode 100644 src/main/java/com/lz/modules/luck/entity/LuckRecordReq.java create mode 100644 src/main/java/com/lz/modules/luck/entity/LuckReq.java create mode 100644 src/main/java/com/lz/modules/luck/service/LuckGoodsService.java create mode 100644 src/main/java/com/lz/modules/luck/service/LuckRecordService.java create mode 100644 src/main/java/com/lz/modules/luck/service/LuckService.java create mode 100644 src/main/java/com/lz/modules/luck/service/impl/LuckGoodsServiceImpl.java create mode 100644 src/main/java/com/lz/modules/luck/service/impl/LuckRecordServiceImpl.java create mode 100644 src/main/java/com/lz/modules/luck/service/impl/LuckServiceImpl.java create mode 100644 src/main/resources/mapper/luck/LuckGoodsMapper.xml create mode 100644 src/main/resources/mapper/luck/LuckMapper.xml create mode 100644 src/main/resources/mapper/luck/LuckRecordMapper.xml diff --git a/src/main/java/com/lz/common/utils/DingTalkUtil.java b/src/main/java/com/lz/common/utils/DingTalkUtil.java index 9e8e32df..008c3c1a 100644 --- a/src/main/java/com/lz/common/utils/DingTalkUtil.java +++ b/src/main/java/com/lz/common/utils/DingTalkUtil.java @@ -11,6 +11,8 @@ import com.lz.modules.app.entity.StaffEntity; import com.lz.modules.app.service.StaffService; import com.lz.modules.job.model.responseBo.DepartmentInfosBo; import com.lz.modules.job.model.responseBo.DepartmentStaffBo; +import com.lz.modules.luck.entity.LuckRecord; +import com.lz.modules.luck.service.LuckRecordService; import com.lz.modules.sys.entity.SysUserEntity; import com.lz.modules.sys.service.SysUserTokenService; import com.lz.modules.third.entity.ThirdAppConfig; @@ -69,6 +71,9 @@ public class DingTalkUtil { @Autowired StaffService staffService; + @Autowired + LuckRecordService luckRecordService; + @Autowired private SysUserTokenService sysUserTokenService; @@ -354,4 +359,40 @@ public class DingTalkUtil { } } + + public R luck(String code, String token, Long luckId) { + try { + DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/user/getuserinfo"); + OapiUserGetuserinfoRequest req = new OapiUserGetuserinfoRequest(); + req.setCode(code); + req.setHttpMethod("GET"); + OapiUserGetuserinfoResponse rsp = client.execute(req, token); + JSONObject json = JSONObject.parseObject(rsp.getBody()); + if(json.getIntValue("errcode") == 0){ + String employeeId = json.getString("userid"); + StaffEntity staffEntity = staffService.selectStaffByEmployeeId(employeeId); + if(staffEntity != null){ + LuckRecord luckRecord = luckRecordService.selectLuckRecordByLuckIdAndStaffId(luckId, staffEntity.getId()); + if(luckRecord == null){//插入抽奖记录 + luckRecord = new LuckRecord(); + luckRecord.setStaffId(staffEntity.getId()); + luckRecord.setLuckId(luckId); + luckRecord.setName(staffEntity.getName()); + luckRecordService.insertLuckRecord(luckRecord); + } + + //登录操作 + + return R.ok(); + } + return R.error("用户不存在"); + } + return R.error("请求钉钉异常:" + json.getString("errmsg")); + + } catch (ApiException e) { + e.printStackTrace(); + return R.error(e.getErrMsg()); + } + + } } diff --git a/src/main/java/com/lz/config/ShiroConfig.java b/src/main/java/com/lz/config/ShiroConfig.java index 0216c28c..19a8dd28 100644 --- a/src/main/java/com/lz/config/ShiroConfig.java +++ b/src/main/java/com/lz/config/ShiroConfig.java @@ -63,6 +63,8 @@ public class ShiroConfig { filterMap.put("/captcha.jpg", "anon"); filterMap.put("/aaa.txt", "anon"); filterMap.put("/dtlg/login", "anon"); + filterMap.put("/dtlg/luck", "anon"); + filterMap.put("/dtlg/look", "anon"); filterMap.put("/**", "oauth2"); shiroFilter.setFilterChainDefinitionMap(filterMap); diff --git a/src/main/java/com/lz/modules/job/business/DingtalkBusiness.java b/src/main/java/com/lz/modules/job/business/DingtalkBusiness.java index ad00a43d..d344a3fd 100644 --- a/src/main/java/com/lz/modules/job/business/DingtalkBusiness.java +++ b/src/main/java/com/lz/modules/job/business/DingtalkBusiness.java @@ -204,4 +204,12 @@ public class DingtalkBusiness { } return R.error("授权失败,未授权"); } + + public R luck(String code, String appid, Long luckId) { + String token = dingTalkUtil.getAccessToken(appid); + if(token != null && token.length() > 0){ + return dingTalkUtil.luck(code, token, luckId); + } + return R.error("授权失败,未授权"); + } } diff --git a/src/main/java/com/lz/modules/luck/controller/LuckController.java b/src/main/java/com/lz/modules/luck/controller/LuckController.java new file mode 100644 index 00000000..aec0be48 --- /dev/null +++ b/src/main/java/com/lz/modules/luck/controller/LuckController.java @@ -0,0 +1,60 @@ +package com.lz.modules.luck.controller; + + +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.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 java.util.HashMap; +import java.util.Map; + +@RestController +@RequestMapping("/luck") +public class LuckController { + + + @Autowired + private LuckService luckService; + + + @RequestMapping("/list") + public R list(@RequestBody String body) { + + return R.ok(); + } + + + @RequestMapping("/getById") + public R getById(@RequestBody Luck luck) { + luck = luckService.selectLuckById(luck.getId()); + return R.ok().put("luck",luck); + } + + + @RequestMapping("/update") + public R update(@RequestBody Luck luck) { + luckService.updateLuckById(luck); + return R.ok(); + } + + + @RequestMapping("/save") + public R save(@RequestBody Luck luck) { + luckService.insertLuck(luck); + return R.ok(); + } + + + @RequestMapping("/delete") + public R list(@RequestBody Long id) { + luckService.deleteLuckById(id); + return R.ok(); + } +} diff --git a/src/main/java/com/lz/modules/luck/controller/LuckGoodsController.java b/src/main/java/com/lz/modules/luck/controller/LuckGoodsController.java new file mode 100644 index 00000000..737c4d26 --- /dev/null +++ b/src/main/java/com/lz/modules/luck/controller/LuckGoodsController.java @@ -0,0 +1,59 @@ +package com.lz.modules.luck.controller; + + +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.LuckGoods; +import com.lz.modules.luck.service.LuckGoodsService; +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 java.util.HashMap; +import java.util.Map; + +@RestController +@RequestMapping("/luckGoods") +public class LuckGoodsController { + + + @Autowired + private LuckGoodsService luckGoodsService; + + + @RequestMapping("/list") + public R list(@RequestBody String body) { + return R.ok(); + } + + + @RequestMapping("/getById") + public R getById(@RequestBody LuckGoods luckGoods) { + luckGoods = luckGoodsService.selectLuckGoodsById(luckGoods.getId()); + return R.ok().put("luckGoods",luckGoods); + } + + + @RequestMapping("/update") + public R update(@RequestBody LuckGoods luckGoods) { + luckGoodsService.updateLuckGoodsById(luckGoods); + return R.ok(); + } + + + @RequestMapping("/save") + public R save(@RequestBody LuckGoods luckGoods) { + luckGoodsService.insertLuckGoods(luckGoods); + return R.ok(); + } + + + @RequestMapping("/delete") + public R list(@RequestBody Long id) { + luckGoodsService.deleteLuckGoodsById(id); + return R.ok(); + } +} diff --git a/src/main/java/com/lz/modules/luck/controller/LuckRecordController.java b/src/main/java/com/lz/modules/luck/controller/LuckRecordController.java new file mode 100644 index 00000000..162f61ef --- /dev/null +++ b/src/main/java/com/lz/modules/luck/controller/LuckRecordController.java @@ -0,0 +1,59 @@ +package com.lz.modules.luck.controller; + + +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.LuckRecord; +import com.lz.modules.luck.service.LuckRecordService; +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 java.util.HashMap; +import java.util.Map; + +@RestController +@RequestMapping("/luckRecord") +public class LuckRecordController { + + + @Autowired + private LuckRecordService luckRecordService; + + + @RequestMapping("/list") + public R list(@RequestBody String body) { + return R.ok(); + } + + + @RequestMapping("/getById") + public R getById(@RequestBody LuckRecord luckRecord) { + luckRecord = luckRecordService.selectLuckRecordById(luckRecord.getId()); + return R.ok().put("luckRecord",luckRecord); + } + + + @RequestMapping("/update") + public R update(@RequestBody LuckRecord luckRecord) { + luckRecordService.updateLuckRecordById(luckRecord); + return R.ok(); + } + + + @RequestMapping("/save") + public R save(@RequestBody LuckRecord luckRecord) { + luckRecordService.insertLuckRecord(luckRecord); + return R.ok(); + } + + + @RequestMapping("/delete") + public R list(@RequestBody Long id) { + luckRecordService.deleteLuckRecordById(id); + return R.ok(); + } +} diff --git a/src/main/java/com/lz/modules/luck/dao/LuckGoodsMapper.java b/src/main/java/com/lz/modules/luck/dao/LuckGoodsMapper.java new file mode 100644 index 00000000..918b10a7 --- /dev/null +++ b/src/main/java/com/lz/modules/luck/dao/LuckGoodsMapper.java @@ -0,0 +1,33 @@ +package com.lz.modules.luck.dao; +/** +*

+* 奖品表 服务类 +*

+* +* @author quyixiao +* @since 2020-08-21 +*/ +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; +@Mapper +public interface LuckGoodsMapper extends BaseMapper { + + + LuckGoods selectLuckGoodsById(@Param("id")Long id); + + + Long insertLuckGoods(LuckGoods luckGoods); + + + int updateLuckGoodsById(LuckGoods luckGoods); + + + int updateCoverLuckGoodsById(LuckGoods luckGoods); + + + int deleteLuckGoodsById(@Param("id")Long id); + + +} \ No newline at end of file diff --git a/src/main/java/com/lz/modules/luck/dao/LuckMapper.java b/src/main/java/com/lz/modules/luck/dao/LuckMapper.java new file mode 100644 index 00000000..4ab84b1c --- /dev/null +++ b/src/main/java/com/lz/modules/luck/dao/LuckMapper.java @@ -0,0 +1,33 @@ +package com.lz.modules.luck.dao; +/** +*

+* 活动名称表 服务类 +*

+* +* @author quyixiao +* @since 2020-08-21 +*/ +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.lz.modules.luck.entity.Luck; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +@Mapper +public interface LuckMapper extends BaseMapper { + + + Luck selectLuckById(@Param("id")Long id); + + + Long insertLuck(Luck luck); + + + int updateLuckById(Luck luck); + + + int updateCoverLuckById(Luck luck); + + + int deleteLuckById(@Param("id")Long id); + + +} \ No newline at end of file diff --git a/src/main/java/com/lz/modules/luck/dao/LuckRecordMapper.java b/src/main/java/com/lz/modules/luck/dao/LuckRecordMapper.java new file mode 100644 index 00000000..ffc62a79 --- /dev/null +++ b/src/main/java/com/lz/modules/luck/dao/LuckRecordMapper.java @@ -0,0 +1,39 @@ +package com.lz.modules.luck.dao; +/** +*

+* 中奖记录 服务类 +*

+* +* @author quyixiao +* @since 2020-08-21 +*/ +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.lz.modules.luck.entity.LuckRecord; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface LuckRecordMapper extends BaseMapper { + + + LuckRecord selectLuckRecordById(@Param("id")Long id); + + + Long insertLuckRecord(LuckRecord luckRecord); + + + int updateLuckRecordById(LuckRecord luckRecord); + + + int updateCoverLuckRecordById(LuckRecord luckRecord); + + + int deleteLuckRecordById(@Param("id")Long id); + + + LuckRecord selectLuckRecordByLuckIdAndStaffId(@Param("luckId") Long luckId, @Param("id") Long id); + + List selectLuckRecordByLuckId(@Param("luckId") String luckId); +} \ No newline at end of file diff --git a/src/main/java/com/lz/modules/luck/entity/Luck.java b/src/main/java/com/lz/modules/luck/entity/Luck.java new file mode 100644 index 00000000..f425846b --- /dev/null +++ b/src/main/java/com/lz/modules/luck/entity/Luck.java @@ -0,0 +1,204 @@ +package com.lz.modules.luck.entity; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import java.util.Date; +/** +*

+* 菜单权限表 +*

*活动名称表 +* @author quyixiao +* @since 2020-08-21 +*/ + +@Data +@TableName("luck") +public class Luck implements java.io.Serializable { + //活动ID + @TableId(value = "id", type = IdType.AUTO) + private Long id; + //是否删除 + private Integer isDelete; + // + private Date gmtCreate; + // + private Date gmtModified; + //活动名称 + private String name; + //奖品数量 + private Integer goodsCount; + //备注 + private String remark; + //是否结束0为结束 1结束(抽完奖设置为结束) + private Integer finish; + //结束时间 + private Date stopTime; + //开始时间 + private Date startTime; + /** + * 活动ID + * @return + */ + public Long getId() { + return id; + } + /** + * 活动ID + * @param id + */ + public void setId(Long id) { + 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; + } + + /** + * 活动名称 + * @return + */ + public String getName() { + return name; + } + /** + * 活动名称 + * @param name + */ + public void setName(String name) { + this.name = name; + } + + /** + * 奖品数量 + * @return + */ + public Integer getGoodsCount() { + return goodsCount; + } + /** + * 奖品数量 + * @param goodsCount + */ + public void setGoodsCount(Integer goodsCount) { + this.goodsCount = goodsCount; + } + + /** + * 备注 + * @return + */ + public String getRemark() { + return remark; + } + /** + * 备注 + * @param remark + */ + public void setRemark(String remark) { + this.remark = remark; + } + + /** + * 是否结束0为结束 1结束(抽完奖设置为结束) + * @return + */ + public Integer getFinish() { + return finish; + } + /** + * 是否结束0为结束 1结束(抽完奖设置为结束) + * @param finish + */ + public void setFinish(Integer finish) { + this.finish = finish; + } + + /** + * 结束时间 + * @return + */ + public Date getStopTime() { + return stopTime; + } + /** + * 结束时间 + * @param stopTime + */ + public void setStopTime(Date stopTime) { + this.stopTime = stopTime; + } + + /** + * 开始时间 + * @return + */ + public Date getStartTime() { + return startTime; + } + /** + * 开始时间 + * @param startTime + */ + public void setStartTime(Date startTime) { + this.startTime = startTime; + } + + @Override + public String toString() { + return "Luck{" + + ",id=" + id + + ",isDelete=" + isDelete + + ",gmtCreate=" + gmtCreate + + ",gmtModified=" + gmtModified + + ",name=" + name + + ",goodsCount=" + goodsCount + + ",remark=" + remark + + ",finish=" + finish + + ",stopTime=" + stopTime + + ",startTime=" + startTime + + "}"; + } +} \ No newline at end of file diff --git a/src/main/java/com/lz/modules/luck/entity/LuckGoods.java b/src/main/java/com/lz/modules/luck/entity/LuckGoods.java new file mode 100644 index 00000000..26399e8d --- /dev/null +++ b/src/main/java/com/lz/modules/luck/entity/LuckGoods.java @@ -0,0 +1,186 @@ +package com.lz.modules.luck.entity; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import java.util.Date; +/** +*

+* 菜单权限表 +*

*奖品表 +* @author quyixiao +* @since 2020-08-21 +*/ + +@Data +@TableName("luck_goods") +public class LuckGoods implements java.io.Serializable { + // + @TableId(value = "id", type = IdType.AUTO) + 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; + /** + * + * @return + */ + public Long getId() { + return id; + } + /** + * + * @param id + */ + public void setId(Long id) { + 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; + } + + /** + * 奖品名称 + * @return + */ + public String getName() { + return name; + } + /** + * 奖品名称 + * @param name + */ + public void setName(String name) { + this.name = name; + } + + /** + * 权重 + * @return + */ + public Integer getWeight() { + return weight; + } + /** + * 权重 + * @param weight + */ + public void setWeight(Integer weight) { + this.weight = weight; + } + + /** + * 备注 + * @return + */ + public String getRemark() { + return remark; + } + /** + * 备注 + * @param remark + */ + public void setRemark(String remark) { + this.remark = remark; + } + + /** + * 数量 + * @return + */ + public Integer getCounts() { + return counts; + } + /** + * 数量 + * @param counts + */ + public void setCounts(Integer counts) { + this.counts = counts; + } + + @Override + public String toString() { + return "LuckGoods{" + + ",id=" + id + + ",isDelete=" + isDelete + + ",gmtCreate=" + gmtCreate + + ",gmtModified=" + gmtModified + + ",luckId=" + luckId + + ",name=" + name + + ",weight=" + weight + + ",remark=" + remark + + ",counts=" + counts + + "}"; + } +} \ No newline at end of file diff --git a/src/main/java/com/lz/modules/luck/entity/LuckGoodsReq.java b/src/main/java/com/lz/modules/luck/entity/LuckGoodsReq.java new file mode 100644 index 00000000..108e95bd --- /dev/null +++ b/src/main/java/com/lz/modules/luck/entity/LuckGoodsReq.java @@ -0,0 +1,187 @@ +package com.lz.modules.luck.entity; +import lombok.Data; +import java.util.Date; +/** +*

+* 菜单权限表 +*

*奖品表 +* @author quyixiao +* @since 2020-08-21 +*/ + + +@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; + /** + * + * @return + */ + public Long getId() { + return id; + } + /** + * + * @param id + */ + public void setId(Long id) { + 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; + } + + /** + * 奖品名称 + * @return + */ + public String getName() { + return name; + } + /** + * 奖品名称 + * @param name + */ + public void setName(String name) { + this.name = name; + } + + /** + * 权重 + * @return + */ + public Integer getWeight() { + return weight; + } + /** + * 权重 + * @param weight + */ + public void setWeight(Integer weight) { + this.weight = weight; + } + + /** + * 备注 + * @return + */ + public String getRemark() { + return remark; + } + /** + * 备注 + * @param remark + */ + public void setRemark(String remark) { + this.remark = remark; + } + + /** + * 数量 + * @return + */ + public Integer getCounts() { + return counts; + } + /** + * 数量 + * @param counts + */ + public void setCounts(Integer counts) { + this.counts = counts; + } + + @Override + public String toString() { + return "LuckGoods{" + + ",id=" + id + + ",isDelete=" + isDelete + + ",gmtCreate=" + gmtCreate + + ",gmtModified=" + gmtModified + + ",luckId=" + luckId + + ",name=" + name + + ",weight=" + weight + + ",remark=" + remark + + ",counts=" + counts + + "}"; + } +} \ No newline at end of file diff --git a/src/main/java/com/lz/modules/luck/entity/LuckRecord.java b/src/main/java/com/lz/modules/luck/entity/LuckRecord.java new file mode 100644 index 00000000..040451bb --- /dev/null +++ b/src/main/java/com/lz/modules/luck/entity/LuckRecord.java @@ -0,0 +1,240 @@ +package com.lz.modules.luck.entity; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import java.util.Date; +/** +*

+* 菜单权限表 +*

*中奖记录 +* @author quyixiao +* @since 2020-08-21 +*/ + +@Data +@TableName("luck_record") +public class LuckRecord implements java.io.Serializable { + // + @TableId(value = "id", type = IdType.AUTO) + private Long id; + //是否删除 0未删除 1删除 + private Integer isDelete; + // + private Date gmtCreate; + // + private Date gmtModified; + //员工staff_id + private Long staffId; + //姓名 + private String name; + //是否中将 0为中将 1中将 + private Integer isLuck; + //权重,或者排序 + private Integer weight; + //活动类型 + private Long luckId; + //奖品名称 + private String goodsName; + //奖品ID,目前不设置ID了 + private Long goodsId; + //备注 + private String remark; + /** + * + * @return + */ + public Long getId() { + return id; + } + /** + * + * @param id + */ + public void setId(Long id) { + 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 + */ + public String getName() { + return name; + } + /** + * 姓名 + * @param name + */ + public void setName(String name) { + this.name = name; + } + + /** + * 是否中将 0为中将 1中将 + * @return + */ + public Integer getIsLuck() { + return isLuck; + } + /** + * 是否中将 0为中将 1中将 + * @param isLuck + */ + public void setIsLuck(Integer isLuck) { + this.isLuck = isLuck; + } + + /** + * 权重,或者排序 + * @return + */ + public Integer getWeight() { + return weight; + } + /** + * 权重,或者排序 + * @param weight + */ + public void setWeight(Integer weight) { + this.weight = weight; + } + + /** + * 活动类型 + * @return + */ + public Long getLuckId() { + return luckId; + } + /** + * 活动类型 + * @param luckId + */ + public void setLuckId(Long luckId) { + this.luckId = luckId; + } + + /** + * 奖品名称 + * @return + */ + public String getGoodsName() { + return goodsName; + } + /** + * 奖品名称 + * @param goodsName + */ + public void setGoodsName(String goodsName) { + this.goodsName = goodsName; + } + + /** + * 奖品ID,目前不设置ID了 + * @return + */ + public Long getGoodsId() { + return goodsId; + } + /** + * 奖品ID,目前不设置ID了 + * @param goodsId + */ + public void setGoodsId(Long goodsId) { + 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 + + "}"; + } +} \ No newline at end of file diff --git a/src/main/java/com/lz/modules/luck/entity/LuckRecordReq.java b/src/main/java/com/lz/modules/luck/entity/LuckRecordReq.java new file mode 100644 index 00000000..28c26bf0 --- /dev/null +++ b/src/main/java/com/lz/modules/luck/entity/LuckRecordReq.java @@ -0,0 +1,241 @@ +package com.lz.modules.luck.entity; +import lombok.Data; +import java.util.Date; +/** +*

+* 菜单权限表 +*

*中奖记录 +* @author quyixiao +* @since 2020-08-21 +*/ + + +@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; + //是否中将 0为中将 1中将 + private Integer isLuck; + //权重,或者排序 + private Integer weight; + //活动类型 + private Long luckId; + //奖品名称 + private String goodsName; + //奖品ID,目前不设置ID了 + private Long goodsId; + //备注 + private String remark; + /** + * + * @return + */ + public Long getId() { + return id; + } + /** + * + * @param id + */ + public void setId(Long id) { + 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 + */ + public String getName() { + return name; + } + /** + * 姓名 + * @param name + */ + public void setName(String name) { + this.name = name; + } + + /** + * 是否中将 0为中将 1中将 + * @return + */ + public Integer getIsLuck() { + return isLuck; + } + /** + * 是否中将 0为中将 1中将 + * @param isLuck + */ + public void setIsLuck(Integer isLuck) { + this.isLuck = isLuck; + } + + /** + * 权重,或者排序 + * @return + */ + public Integer getWeight() { + return weight; + } + /** + * 权重,或者排序 + * @param weight + */ + public void setWeight(Integer weight) { + this.weight = weight; + } + + /** + * 活动类型 + * @return + */ + public Long getLuckId() { + return luckId; + } + /** + * 活动类型 + * @param luckId + */ + public void setLuckId(Long luckId) { + this.luckId = luckId; + } + + /** + * 奖品名称 + * @return + */ + public String getGoodsName() { + return goodsName; + } + /** + * 奖品名称 + * @param goodsName + */ + public void setGoodsName(String goodsName) { + this.goodsName = goodsName; + } + + /** + * 奖品ID,目前不设置ID了 + * @return + */ + public Long getGoodsId() { + return goodsId; + } + /** + * 奖品ID,目前不设置ID了 + * @param goodsId + */ + public void setGoodsId(Long goodsId) { + 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 + + "}"; + } +} \ No newline at end of file diff --git a/src/main/java/com/lz/modules/luck/entity/LuckReq.java b/src/main/java/com/lz/modules/luck/entity/LuckReq.java new file mode 100644 index 00000000..7f5f4392 --- /dev/null +++ b/src/main/java/com/lz/modules/luck/entity/LuckReq.java @@ -0,0 +1,169 @@ +package com.lz.modules.luck.entity; +import lombok.Data; +import java.util.Date; +/** +*

+* 菜单权限表 +*

*活动名称表 +* @author quyixiao +* @since 2020-08-21 +*/ + + +@Data +public class LuckReq implements java.io.Serializable { + + private int page = 1; + private int rows = 10; + private String sort; + private String order; + //活动ID + private Long id; + //是否删除 + private Integer isDelete; + // + private Date gmtCreate; + // + private Date gmtModified; + //活动名称 + private String name; + //奖品数量 + private Integer goodsCount; + //备注 + private String remark; + //是否结束0为结束 1结束(抽完奖设置为结束) + private Integer finish; + /** + * 活动ID + * @return + */ + public Long getId() { + return id; + } + /** + * 活动ID + * @param id + */ + public void setId(Long id) { + 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; + } + + /** + * 活动名称 + * @return + */ + public String getName() { + return name; + } + /** + * 活动名称 + * @param name + */ + public void setName(String name) { + this.name = name; + } + + /** + * 奖品数量 + * @return + */ + public Integer getGoodsCount() { + return goodsCount; + } + /** + * 奖品数量 + * @param goodsCount + */ + public void setGoodsCount(Integer goodsCount) { + this.goodsCount = goodsCount; + } + + /** + * 备注 + * @return + */ + public String getRemark() { + return remark; + } + /** + * 备注 + * @param remark + */ + public void setRemark(String remark) { + this.remark = remark; + } + + /** + * 是否结束0为结束 1结束(抽完奖设置为结束) + * @return + */ + public Integer getFinish() { + return finish; + } + /** + * 是否结束0为结束 1结束(抽完奖设置为结束) + * @param finish + */ + public void setFinish(Integer finish) { + this.finish = finish; + } + + @Override + public String toString() { + return "Luck{" + + ",id=" + id + + ",isDelete=" + isDelete + + ",gmtCreate=" + gmtCreate + + ",gmtModified=" + gmtModified + + ",name=" + name + + ",goodsCount=" + goodsCount + + ",remark=" + remark + + ",finish=" + finish + + "}"; + } +} \ No newline at end of file diff --git a/src/main/java/com/lz/modules/luck/service/LuckGoodsService.java b/src/main/java/com/lz/modules/luck/service/LuckGoodsService.java new file mode 100644 index 00000000..ecf0a83b --- /dev/null +++ b/src/main/java/com/lz/modules/luck/service/LuckGoodsService.java @@ -0,0 +1,33 @@ +package com.lz.modules.luck.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.lz.modules.luck.entity.LuckGoods; + +/** +*

+* 奖品表 服务类 +*

+* +* @author quyixiao +* @since 2020-08-21 +*/ +public interface LuckGoodsService extends IService { + + + + LuckGoods selectLuckGoodsById(Long id); + + + Long insertLuckGoods(LuckGoods luckGoods); + + + int updateLuckGoodsById(LuckGoods luckGoods); + + + int updateCoverLuckGoodsById(LuckGoods luckGoods); + + + int deleteLuckGoodsById(Long id); + + +} \ No newline at end of file diff --git a/src/main/java/com/lz/modules/luck/service/LuckRecordService.java b/src/main/java/com/lz/modules/luck/service/LuckRecordService.java new file mode 100644 index 00000000..c19e362e --- /dev/null +++ b/src/main/java/com/lz/modules/luck/service/LuckRecordService.java @@ -0,0 +1,38 @@ +package com.lz.modules.luck.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.lz.modules.luck.entity.LuckRecord; + +import java.util.List; + +/** +*

+* 中奖记录 服务类 +*

+* +* @author quyixiao +* @since 2020-08-21 +*/ +public interface LuckRecordService extends IService { + + + + LuckRecord selectLuckRecordById(Long id); + + + Long insertLuckRecord(LuckRecord luckRecord); + + + int updateLuckRecordById(LuckRecord luckRecord); + + + int updateCoverLuckRecordById(LuckRecord luckRecord); + + + int deleteLuckRecordById(Long id); + + + LuckRecord selectLuckRecordByLuckIdAndStaffId(Long luckId, Long id); + + List selectLuckRecordByLuckId(String luckId); +} \ No newline at end of file diff --git a/src/main/java/com/lz/modules/luck/service/LuckService.java b/src/main/java/com/lz/modules/luck/service/LuckService.java new file mode 100644 index 00000000..9807716b --- /dev/null +++ b/src/main/java/com/lz/modules/luck/service/LuckService.java @@ -0,0 +1,33 @@ +package com.lz.modules.luck.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.lz.modules.luck.entity.Luck; + +/** +*

+* 活动名称表 服务类 +*

+* +* @author quyixiao +* @since 2020-08-21 +*/ +public interface LuckService extends IService { + + + + Luck selectLuckById(Long id); + + + Long insertLuck(Luck luck); + + + int updateLuckById(Luck luck); + + + int updateCoverLuckById(Luck luck); + + + int deleteLuckById(Long id); + + +} \ No newline at end of file diff --git a/src/main/java/com/lz/modules/luck/service/impl/LuckGoodsServiceImpl.java b/src/main/java/com/lz/modules/luck/service/impl/LuckGoodsServiceImpl.java new file mode 100644 index 00000000..28ed79eb --- /dev/null +++ b/src/main/java/com/lz/modules/luck/service/impl/LuckGoodsServiceImpl.java @@ -0,0 +1,63 @@ +package com.lz.modules.luck.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.lz.modules.luck.dao.LuckGoodsMapper; +import com.lz.modules.luck.entity.LuckGoods; +import com.lz.modules.luck.service.LuckGoodsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** +*

+* 奖品表 服务类 +*

+* +* @author quyixiao +* @since 2020-08-21 +*/ + +@Service +public class LuckGoodsServiceImpl extends ServiceImpl implements LuckGoodsService { + + + @Autowired + private LuckGoodsMapper luckGoodsMapper; + + + + @Override + public LuckGoods selectLuckGoodsById(Long id){ + return luckGoodsMapper.selectLuckGoodsById(id); + } + + + + @Override + public Long insertLuckGoods(LuckGoods luckGoods){ + return luckGoodsMapper.insertLuckGoods(luckGoods); + } + + + + @Override + public int updateLuckGoodsById(LuckGoods luckGoods){ + return luckGoodsMapper.updateLuckGoodsById(luckGoods); + } + + + + @Override + public int updateCoverLuckGoodsById(LuckGoods luckGoods){ + return luckGoodsMapper.updateCoverLuckGoodsById(luckGoods); + } + + + + @Override + public int deleteLuckGoodsById(Long id){ + return luckGoodsMapper.deleteLuckGoodsById(id); + } + + + +} diff --git a/src/main/java/com/lz/modules/luck/service/impl/LuckRecordServiceImpl.java b/src/main/java/com/lz/modules/luck/service/impl/LuckRecordServiceImpl.java new file mode 100644 index 00000000..fb5c4813 --- /dev/null +++ b/src/main/java/com/lz/modules/luck/service/impl/LuckRecordServiceImpl.java @@ -0,0 +1,73 @@ +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.service.LuckRecordService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** +*

+* 中奖记录 服务类 +*

+* +* @author quyixiao +* @since 2020-08-21 +*/ + +@Service +public class LuckRecordServiceImpl extends ServiceImpl implements LuckRecordService { + + + @Autowired + private LuckRecordMapper luckRecordMapper; + + + + @Override + public LuckRecord selectLuckRecordById(Long id){ + return luckRecordMapper.selectLuckRecordById(id); + } + + + + @Override + public Long insertLuckRecord(LuckRecord luckRecord){ + return luckRecordMapper.insertLuckRecord(luckRecord); + } + + + + @Override + public int updateLuckRecordById(LuckRecord luckRecord){ + return luckRecordMapper.updateLuckRecordById(luckRecord); + } + + + + @Override + public int updateCoverLuckRecordById(LuckRecord luckRecord){ + return luckRecordMapper.updateCoverLuckRecordById(luckRecord); + } + + + + @Override + public int deleteLuckRecordById(Long id){ + return luckRecordMapper.deleteLuckRecordById(id); + } + + @Override + public LuckRecord selectLuckRecordByLuckIdAndStaffId(Long luckId, Long id){ + return luckRecordMapper.selectLuckRecordByLuckIdAndStaffId(luckId, id); + } + + @Override + public List selectLuckRecordByLuckId(String luckId){ + return luckRecordMapper.selectLuckRecordByLuckId(luckId); + } + +} diff --git a/src/main/java/com/lz/modules/luck/service/impl/LuckServiceImpl.java b/src/main/java/com/lz/modules/luck/service/impl/LuckServiceImpl.java new file mode 100644 index 00000000..7826e001 --- /dev/null +++ b/src/main/java/com/lz/modules/luck/service/impl/LuckServiceImpl.java @@ -0,0 +1,63 @@ +package com.lz.modules.luck.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.lz.modules.luck.dao.LuckMapper; +import com.lz.modules.luck.entity.Luck; +import com.lz.modules.luck.service.LuckService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** +*

+* 活动名称表 服务类 +*

+* +* @author quyixiao +* @since 2020-08-21 +*/ + +@Service +public class LuckServiceImpl extends ServiceImpl implements LuckService { + + + @Autowired + private LuckMapper luckMapper; + + + + @Override + public Luck selectLuckById(Long id){ + return luckMapper.selectLuckById(id); + } + + + + @Override + public Long insertLuck(Luck luck){ + return luckMapper.insertLuck(luck); + } + + + + @Override + public int updateLuckById(Luck luck){ + return luckMapper.updateLuckById(luck); + } + + + + @Override + public int updateCoverLuckById(Luck luck){ + return luckMapper.updateCoverLuckById(luck); + } + + + + @Override + public int deleteLuckById(Long id){ + return luckMapper.deleteLuckById(id); + } + + + +} diff --git a/src/main/java/com/lz/modules/third/controller/DingTalkLoginController.java b/src/main/java/com/lz/modules/third/controller/DingTalkLoginController.java index 1e5ebbab..1a028098 100644 --- a/src/main/java/com/lz/modules/third/controller/DingTalkLoginController.java +++ b/src/main/java/com/lz/modules/third/controller/DingTalkLoginController.java @@ -4,18 +4,26 @@ import com.alibaba.fastjson.JSONObject; import com.lz.common.utils.DingTalkUtil; import com.lz.common.utils.R; import com.lz.modules.job.business.DingtalkBusiness; +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 org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PostMapping; -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.Date; +import java.util.List; @RestController @RequestMapping("/dtlg") public class DingTalkLoginController { @Autowired DingtalkBusiness dingtalkBusiness; + @Autowired + LuckService luckService; + @Autowired + LuckRecordService luckRecordService; static String appid = "855818566"; @PostMapping("/login") public R login(@RequestBody String body){ @@ -23,4 +31,37 @@ public class DingTalkLoginController { return dingtalkBusiness.login(json.getString("code"), appid); } + + @PostMapping("/luck") + public R luck(@RequestBody String body){ + JSONObject json = JSONObject.parseObject(body); + Luck luck = luckService.selectLuckById(1L);//默认第一个活动 + if(luck.getStopTime().getTime() > System.currentTimeMillis()){ + return dingtalkBusiness.luck(json.getString("code"), appid, luck.getId()); + } + return R.error("活动已经停止"); + + } + + @GetMapping("/look") + public String look(@RequestParam String luckId){ + List luckRecords = luckRecordService.selectLuckRecordByLuckId(luckId); + String value = "暂无人员报名"; + if(luckRecords.size() > 0){ + /* +

+ 姓名:吴林 是否中将:中将 +

*/ + value = ""; + for (int i = 0; i < luckRecords.size(); i++){ + LuckRecord luckRecord = luckRecords.get(i); + value += "

" + (i + 1) + ":姓名:" + luckRecord.getName() + + " 是否中将:未中将" : "\"color:#E53333;\">中将") + + "

"; + } + } + return value; + + } } diff --git a/src/main/resources/mapper/luck/LuckGoodsMapper.xml b/src/main/resources/mapper/luck/LuckGoodsMapper.xml new file mode 100644 index 00000000..30bb1ed1 --- /dev/null +++ b/src/main/resources/mapper/luck/LuckGoodsMapper.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, luck_id AS luckId, name AS name, weight AS weight, remark AS remark, counts AS counts + + + + + + + + + + insert into luck_goods( + luck_id, + name, + weight, + remark, + counts, + is_delete, + gmt_create, + gmt_modified + )values( + #{ luckId}, + #{ name}, + #{ weight}, + #{ remark}, + #{ counts}, + 0, + now(), + now() + ) + + + + + update + luck_goods + + is_delete = #{isDelete}, + gmt_create = #{gmtCreate}, + luck_id = #{luckId}, + name = #{name}, + weight = #{weight}, + remark = #{remark}, + counts = #{counts} + + ,gmt_modified = now() + where id = #{id} + + + + + update + luck_goods + set + is_delete = #{isDelete}, + gmt_create = #{gmtCreate}, + luck_id = #{luckId}, + name = #{name}, + weight = #{weight}, + remark = #{remark}, + counts = #{counts} + ,gmt_modified = now() + where id = #{id} + + + + + update luck_goods set is_delete = 1 where id=#{id} limit 1 + + + + diff --git a/src/main/resources/mapper/luck/LuckMapper.xml b/src/main/resources/mapper/luck/LuckMapper.xml new file mode 100644 index 00000000..cd598df1 --- /dev/null +++ b/src/main/resources/mapper/luck/LuckMapper.xml @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, name AS name, goods_count AS goodsCount, remark AS remark, finish AS finish, stop_time AS stopTime, start_time AS startTime + + + + + + + + + + insert into luck( + name, + goods_count, + remark, + finish, + stop_time, + start_time, + is_delete, + gmt_create, + gmt_modified + )values( + #{ name}, + #{ goodsCount}, + #{ remark}, + #{ finish}, + #{ stopTime}, + #{ startTime}, + 0, + now(), + now() + ) + + + + + update + luck + + is_delete = #{isDelete}, + gmt_create = #{gmtCreate}, + name = #{name}, + goods_count = #{goodsCount}, + remark = #{remark}, + finish = #{finish}, + stop_time = #{stopTime}, + start_time = #{startTime} + + ,gmt_modified = now() + where id = #{id} + + + + + update + luck + set + is_delete = #{isDelete}, + gmt_create = #{gmtCreate}, + name = #{name}, + goods_count = #{goodsCount}, + remark = #{remark}, + finish = #{finish}, + stop_time = #{stopTime}, + start_time = #{startTime} + ,gmt_modified = now() + where id = #{id} + + + + + update luck set is_delete = 1 where id=#{id} limit 1 + + + + diff --git a/src/main/resources/mapper/luck/LuckRecordMapper.xml b/src/main/resources/mapper/luck/LuckRecordMapper.xml new file mode 100644 index 00000000..8c1ce33a --- /dev/null +++ b/src/main/resources/mapper/luck/LuckRecordMapper.xml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + + + insert into luck_record( + staff_id, + name, + is_luck, + weight, + luck_id, + goods_name, + goods_id, + remark, + is_delete, + gmt_create, + gmt_modified + )values( + #{ staffId}, + #{ name}, + #{ isLuck}, + #{ weight}, + #{ luckId}, + #{ goodsName}, + #{ goodsId}, + #{ remark}, + 0, + now(), + now() + ) + + + + + update + luck_record + + is_delete = #{isDelete}, + gmt_create = #{gmtCreate}, + staff_id = #{staffId}, + name = #{name}, + is_luck = #{isLuck}, + weight = #{weight}, + luck_id = #{luckId}, + goods_name = #{goodsName}, + goods_id = #{goodsId}, + remark = #{remark} + + ,gmt_modified = now() + where id = #{id} + + + + + update + luck_record + set + is_delete = #{isDelete}, + gmt_create = #{gmtCreate}, + staff_id = #{staffId}, + name = #{name}, + is_luck = #{isLuck}, + weight = #{weight}, + luck_id = #{luckId}, + goods_name = #{goodsName}, + goods_id = #{goodsId}, + remark = #{remark} + ,gmt_modified = now() + where id = #{id} + + + + + update luck_record set is_delete = 1 where id=#{id} limit 1 + + + + + + + + diff --git a/src/test/java/com/lz/mysql/MysqlMain.java b/src/test/java/com/lz/mysql/MysqlMain.java index ef20a3ab..cd4ffc28 100644 --- a/src/test/java/com/lz/mysql/MysqlMain.java +++ b/src/test/java/com/lz/mysql/MysqlMain.java @@ -62,7 +62,7 @@ public class MysqlMain { List list = new ArrayList(); - list.add(new TablesBean("lz_flow_record")); + list.add(new TablesBean("luck")); List list2 = new ArrayList();