12/26
This commit is contained in:
@@ -16,4 +16,5 @@ public class EmpCardQuery implements Query {
|
||||
private String number;
|
||||
private String sid;
|
||||
private String customerSid;
|
||||
private String serialNumber;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.yxt.yyth.api.empcard;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
* @date 2023/12/22 14:11
|
||||
*/
|
||||
@Data
|
||||
public class EmpCardStatisticsExportVo {
|
||||
@ColumnWidth(30)
|
||||
@ExcelProperty(value = "卡号",index = 1)
|
||||
private String code;
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "序列号",index = 0)
|
||||
private String serialNumber;
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "发行时间",index = 2)
|
||||
private String createTime;
|
||||
// @ColumnWidth(20)
|
||||
// @ExcelProperty(value = "卡片种类",index = 2)
|
||||
// private String cardType;
|
||||
// @ColumnWidth(20)
|
||||
// @ExcelProperty(value = "发行人",index = 3)
|
||||
// private String people;
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "状态",index = 3)
|
||||
private String stateValue;
|
||||
// @ColumnWidth(20)
|
||||
// @ExcelProperty(value = "是否过期",index = 5)
|
||||
// private String isExpire;
|
||||
// @ColumnWidth(20)
|
||||
// @ExcelProperty(value = "是否作废",index = 6)
|
||||
// private String isCancel;
|
||||
// @ColumnWidth(20)
|
||||
// @ExcelProperty(value = "绑定id",index = 7)
|
||||
// private String bind;
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "绑定时间",index = 4)
|
||||
private String bindDate;
|
||||
// @ColumnWidth(20)
|
||||
// @ExcelProperty(value = "提货卡商品",index = 9)
|
||||
// private String goodsName;
|
||||
// @ColumnWidth(20)
|
||||
// @ExcelProperty(value = "商品数量(份)",index = 10)
|
||||
// private String goodsNumber;
|
||||
// @ColumnWidth(20)
|
||||
// @ExcelProperty(value = "已提数量(份)",index = 11)
|
||||
// private String receiveNumber;
|
||||
// @ColumnWidth(20)
|
||||
// @ExcelProperty(value = "未提数量(份)",index = 12)
|
||||
// private String unclaimedNumber;
|
||||
@ExcelIgnore
|
||||
private String isEnable;
|
||||
}
|
||||
@@ -27,5 +27,9 @@ public class EmpCardVo implements Vo {
|
||||
private String customerMobile;
|
||||
private double goodsNumber;
|
||||
private String goodsSid;
|
||||
private String cardType;
|
||||
private String stateValue;
|
||||
private String bindDate;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class EmpCardGift {
|
||||
private String recordSid;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date bindDate;
|
||||
private String isItlnvalid;
|
||||
private String isItInvalid;
|
||||
private String isReservation;
|
||||
private String isShare;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class EmpCardGiftDto implements Dto {
|
||||
private String recordSid;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date bindDate;
|
||||
private String isItlnvalid;
|
||||
private String isItInvalid;
|
||||
private String iReservation;
|
||||
private List<GoodsVo> goodsVoList;
|
||||
private String count;
|
||||
|
||||
@@ -35,6 +35,6 @@ public class EmpCardGiftQuery implements Query {
|
||||
private String recordSid;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date bindDate;
|
||||
private String isItlnvalid;
|
||||
private String isItInvalid;
|
||||
private String iReservation;
|
||||
}
|
||||
|
||||
@@ -35,8 +35,9 @@ public class EmpCardGiftVo implements Vo {
|
||||
private String recordSid;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date bindDate;
|
||||
private String isItlnvalid;
|
||||
private String isItInvalid;
|
||||
private String iReservation;
|
||||
private String isShare;
|
||||
private double goodsNumber=0;
|
||||
private String qrCode;
|
||||
private String goods;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.yxt.yyth.api.lpkgiftcard;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import lombok.Data;
|
||||
@@ -10,44 +11,48 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class CardStatisticsExportVo {
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "卡号",index = 0)
|
||||
@ColumnWidth(30)
|
||||
@ExcelProperty(value = "卡号",index = 1)
|
||||
private String code;
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "发行时间",index = 1)
|
||||
@ExcelProperty(value = "序列号",index = 0)
|
||||
private String serialNumber;
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "发行时间",index = 2)
|
||||
private String createTime;
|
||||
// @ColumnWidth(20)
|
||||
// @ExcelProperty(value = "卡片种类",index = 2)
|
||||
// private String cardType;
|
||||
// @ColumnWidth(20)
|
||||
// @ExcelProperty(value = "发行人",index = 3)
|
||||
// private String people;
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "卡片种类",index = 2)
|
||||
private String cardType;
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "发行人",index = 3)
|
||||
private String people;
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "状态",index = 4)
|
||||
@ExcelProperty(value = "状态",index = 3)
|
||||
private String stateValue;
|
||||
// @ColumnWidth(20)
|
||||
// @ExcelProperty(value = "是否过期",index = 5)
|
||||
// private String isExpire;
|
||||
// @ColumnWidth(20)
|
||||
// @ExcelProperty(value = "是否作废",index = 6)
|
||||
// private String isCancel;
|
||||
// @ColumnWidth(20)
|
||||
// @ExcelProperty(value = "绑定id",index = 7)
|
||||
// private String bind;
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "是否过期",index = 5)
|
||||
private String isExpire;
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "是否作废",index = 6)
|
||||
private String isCancel;
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "绑定id",index = 7)
|
||||
private String bind;
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "绑定时间",index = 8)
|
||||
@ExcelProperty(value = "绑定时间",index = 4)
|
||||
private String bindDate;
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "提货卡商品(份)",index = 9)
|
||||
private String goodsName;
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "商品数量(份)",index = 10)
|
||||
private String goodsNumber;
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "已提数量(份)",index = 11)
|
||||
private String receiveNumber;
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "未提数量(份)",index = 12)
|
||||
private String unclaimedNumber;
|
||||
|
||||
// @ColumnWidth(20)
|
||||
// @ExcelProperty(value = "提货卡商品",index = 9)
|
||||
// private String goodsName;
|
||||
// @ColumnWidth(20)
|
||||
// @ExcelProperty(value = "商品数量(份)",index = 10)
|
||||
// private String goodsNumber;
|
||||
// @ColumnWidth(20)
|
||||
// @ExcelProperty(value = "已提数量(份)",index = 11)
|
||||
// private String receiveNumber;
|
||||
// @ColumnWidth(20)
|
||||
// @ExcelProperty(value = "未提数量(份)",index = 12)
|
||||
// private String unclaimedNumber;
|
||||
@ExcelIgnore
|
||||
private String isEnable;
|
||||
}
|
||||
|
||||
@@ -4,12 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.yxt.yyth.api.empcard.EmpAppletVo;
|
||||
import com.yxt.yyth.api.empcard.EmpCard;
|
||||
import com.yxt.yyth.api.empcard.EmpCardExport;
|
||||
import com.yxt.yyth.api.empcard.EmpCardVo;
|
||||
import com.yxt.yyth.api.lpkgiftcard.AppletVo;
|
||||
import com.yxt.yyth.api.lpkgiftcard.LpkGiftCard;
|
||||
import com.yxt.yyth.api.empcard.*;
|
||||
import com.yxt.yyth.api.lpkgiftcard.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
@@ -35,4 +31,7 @@ public interface EmpCardMapper extends BaseMapper<EmpCard> {
|
||||
IPage<EmpAppletVo> getEmpCardByCustomerSid(IPage<EmpCard> page, @Param(Constants.WRAPPER) QueryWrapper<EmpCard> qw);
|
||||
List<EmpCardVo> selEmpCardSid(@Param("empCardSid")String empCardSid);
|
||||
EmpCardVo getBagGoods(@Param("sid")String sid ,@Param("goodsSid")String goodsSid);
|
||||
|
||||
IPage<EmpCardVo> cardStatisticsList(IPage<EmpCardQuery> page, @Param(Constants.WRAPPER) QueryWrapper<EmpCardQuery> qw);
|
||||
List<EmpCardStatisticsExportVo> cardStatisticsListExport(@Param(Constants.WRAPPER) QueryWrapper<EmpCardQuery> qw);
|
||||
}
|
||||
|
||||
@@ -137,5 +137,69 @@
|
||||
left join lpk_giftbag_goods s on bag.sid = s.giftbagSid
|
||||
where card.sid = #{sid} and s.goodsSid=#{goodsSid}
|
||||
</select>
|
||||
<select id="cardStatisticsList" resultType="com.yxt.yyth.api.empcard.EmpCardVo">
|
||||
SELECT
|
||||
a.serialNumber AS serialNumber,
|
||||
a.CODE AS code,
|
||||
a.createTime AS createTime,
|
||||
a.isEnable AS isEnable,
|
||||
CASE
|
||||
WHEN a.CODE IS NOT NULL THEN
|
||||
'企业卡'
|
||||
END cardType,
|
||||
CASE
|
||||
a.state
|
||||
WHEN 1 THEN
|
||||
'未绑定'
|
||||
WHEN 2 THEN
|
||||
'已绑定'
|
||||
WHEN 3 THEN
|
||||
'已完成'
|
||||
END stateValue,
|
||||
a.customerSid AS bind,
|
||||
a.bindDate AS bindDate,
|
||||
d.NAME AS goodsName,
|
||||
c.goodsNumber AS goodsNumber
|
||||
FROM
|
||||
emp_card a
|
||||
LEFT JOIN lpk_giftbag b ON b.sid = a.giftbagSid
|
||||
LEFT JOIN lpk_giftbag_goods c ON c.giftbagSid = a.giftbagSid
|
||||
LEFT JOIN lpk_goods d ON d.sid = c.goodsSid
|
||||
<where>
|
||||
${ew.sqlSegment}
|
||||
</where>
|
||||
</select>
|
||||
<select id="cardStatisticsListExport" resultType="com.yxt.yyth.api.empcard.EmpCardStatisticsExportVo">
|
||||
SELECT
|
||||
a.serialNumber AS serialNumber,
|
||||
a.CODE AS code,
|
||||
a.createTime AS createTime,
|
||||
a.isEnable AS isEnable,
|
||||
CASE
|
||||
WHEN a.CODE IS NOT NULL THEN
|
||||
'企业卡'
|
||||
END cardType,
|
||||
CASE
|
||||
a.state
|
||||
WHEN 1 THEN
|
||||
'未绑定'
|
||||
WHEN 2 THEN
|
||||
'已绑定'
|
||||
WHEN 3 THEN
|
||||
'已完成'
|
||||
END stateValue,
|
||||
a.customerSid AS bind,
|
||||
a.bindDate AS bindDate,
|
||||
d.NAME AS goodsName,
|
||||
c.goodsNumber AS goodsNumber
|
||||
FROM
|
||||
emp_card a
|
||||
LEFT JOIN lpk_giftbag b ON b.sid = a.giftbagSid
|
||||
LEFT JOIN lpk_giftbag_goods c ON c.giftbagSid = a.giftbagSid
|
||||
LEFT JOIN lpk_goods d ON d.sid = c.goodsSid
|
||||
<where>
|
||||
${ew.sqlSegment}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -10,6 +10,7 @@ import com.yxt.yyth.api.lpkgiftcard.BindCardDto;
|
||||
import com.yxt.yyth.api.lpkgiftcard.LpkGiftCardListQuery;
|
||||
import com.yxt.yyth.api.lpkgiftcard.LpkGiftCardListVo;
|
||||
import com.yxt.yyth.api.lpkgiftcard.LpkGiftCardQuery;
|
||||
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderQuery;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -71,4 +72,14 @@ public class EmpCardRest {
|
||||
public ResultBean getEmpCardBySid(@PathVariable("sid") String sid) {
|
||||
return empCardService.getEmpCardBySid(sid);
|
||||
}
|
||||
@ApiOperation("企业卡信息列表")
|
||||
@PostMapping("/empCardStatisticsList")
|
||||
public ResultBean empCardStatisticsList(@RequestBody PagerQuery<EmpCardQuery> pq) {
|
||||
return empCardService.cardStatisticsList(pq);
|
||||
}
|
||||
@ApiOperation("企业卡信息导出")
|
||||
@PostMapping("/empCardStatisticsListExport")
|
||||
public void cardStatisticsListExport(@RequestBody EmpCardQuery pq) {
|
||||
empCardService.cardStatisticsListExport(pq);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.yxt.yyth.biz.empcard;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
|
||||
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.yxt.common.base.service.MybatisBaseService;
|
||||
@@ -19,18 +22,24 @@ import com.yxt.yyth.api.empcardgiftgoods.EmpCardGiftGoodsVo;
|
||||
import com.yxt.yyth.api.empcardgrantlog.EmpCardGrantLogVo;
|
||||
import com.yxt.yyth.api.lpkgiftbaggoods.LpkGiftBagGoodsVo;
|
||||
import com.yxt.yyth.api.lpkgiftcard.*;
|
||||
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderQuery;
|
||||
import com.yxt.yyth.biz.empcardbuildrecord.EmpCardBuildRecordService;
|
||||
import com.yxt.yyth.biz.empcardgift.EmpCardGiftService;
|
||||
import com.yxt.yyth.biz.empcardgiftgoods.EmpCardGiftGoodsService;
|
||||
import com.yxt.yyth.biz.empcardgrantlog.EmpCardGrantLogService;
|
||||
import com.yxt.yyth.biz.lpkgiftbaggoods.LpkGiftBagGoodsService;
|
||||
import com.yxt.yyth.biz.lpkgiftcard.generateRule.UniqueIdGenerator;
|
||||
import com.yxt.yyth.utils.StyleUtils;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@@ -349,4 +358,71 @@ public class EmpCardService extends MybatisBaseService<EmpCardMapper, EmpCard> {
|
||||
EmpCardVo card = baseMapper.getBagGoods(sid,goodsSid);
|
||||
return rb.success().setData(card);
|
||||
}
|
||||
|
||||
public void cardStatisticsListExport(EmpCardQuery query) {
|
||||
ResultBean rb=new ResultBean();
|
||||
QueryWrapper<EmpCardQuery> qw = new QueryWrapper<>();
|
||||
qw.eq("1", "1");
|
||||
if(StringUtils.isNotBlank(query.getSerialNumber())){
|
||||
qw.like("a.serialNumber",query.getSerialNumber());
|
||||
}
|
||||
qw.groupBy("a.sid");
|
||||
qw.orderByDesc("a.createTime");
|
||||
// qw.groupBy("c.goodsSid");
|
||||
List<EmpCardStatisticsExportVo> statisticsExportVos=baseMapper.cardStatisticsListExport(qw);
|
||||
// statisticsExportVos.forEach(s->{
|
||||
// if(s.getIsEnable().equals("2")){
|
||||
// s.setStateValue("已作废");
|
||||
// }
|
||||
// });
|
||||
String excelName = "提货卡信息.xlsx";
|
||||
String fileNameURL = "1";
|
||||
response.setContentType( "application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf8");
|
||||
response.setHeader("Content-disposition","attachment;filename="+ excelName );
|
||||
ServletOutputStream outputStream = null;
|
||||
try {
|
||||
WriteCellStyle headWriteCellStyle = new WriteCellStyle();
|
||||
//设置头居中
|
||||
headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
|
||||
//内容策略
|
||||
WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
|
||||
//设置 水平居中
|
||||
contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
|
||||
// HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(headWriteCellStyle,contentWriteCellStyle);
|
||||
HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(StyleUtils.getHeadStyle(), StyleUtils.getContentStyle());
|
||||
|
||||
EasyExcel//将数据映射到DownloadDTO实体类并响应到浏览器
|
||||
.write(new BufferedOutputStream(response.getOutputStream()), EmpCardStatisticsExportVo.class)
|
||||
//是否自动关闭输入流
|
||||
.autoCloseStream(Boolean.TRUE)
|
||||
// .registerWriteHandler(new MergeStrategy(exportList.size(),1,5))
|
||||
.registerWriteHandler(horizontalCellStyleStrategy)
|
||||
.sheet().doWrite(statisticsExportVos);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
public ResultBean cardStatisticsList(PagerQuery<EmpCardQuery> pq) {
|
||||
ResultBean rb=new ResultBean();
|
||||
EmpCardQuery query = pq.getParams();
|
||||
QueryWrapper<EmpCardQuery> qw = new QueryWrapper<>();
|
||||
qw.eq("1", "1");
|
||||
if(StringUtils.isNotBlank(query.getSerialNumber())){
|
||||
qw.like("a.serialNumber",query.getSerialNumber());
|
||||
}
|
||||
qw.groupBy("a.sid");
|
||||
qw.orderByDesc("a.createTime");
|
||||
// qw.groupBy("c.goodsSid");
|
||||
IPage<EmpCardQuery> page = PagerUtil.queryToPage(pq);
|
||||
IPage<EmpCardVo> pagging = baseMapper.cardStatisticsList(page, qw);
|
||||
// pagging.getRecords().forEach(s->{
|
||||
// if(s.getIsEnable().equals("2")){
|
||||
// s.setStateValue("已作废");
|
||||
// }
|
||||
// });
|
||||
return rb.success().setData(pagging);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,11 +39,14 @@ public interface EmpCardGiftMapper extends BaseMapper<EmpCardGift> {
|
||||
@Select("select count(id) from lpk_giftcard where recordSid=#{recordSid} and grantRecordSid is not null")
|
||||
Integer cardGrantCount(@Param("recordSid") String recordSid);
|
||||
|
||||
@Select("update lpk_giftcard set isItInvalid='1' where giftbagSid=#{giftbagSid} and state!=#{state} ")
|
||||
Integer updateIsItInvalid(@Param("giftbagSid") String giftbagSid, @Param("state") String state);
|
||||
|
||||
|
||||
Integer updateIsItInvalid(@Param("sids") List<String> sids, @Param("state") String state);
|
||||
|
||||
// List<EmpCardGiftWordVo> selGiftCard(@Param("serialNumbers") List<Integer> serialNumbers);
|
||||
IPage<EmpCardGiftWordVo> selGiftCard(IPage<EmpCardGift> page, @Param(Constants.WRAPPER) QueryWrapper<EmpCardGift> qw);
|
||||
EmpCardGiftVo getEmpCardGoods(@Param("empCardSid")String empCardSid,@Param("goodsSid")String goodsSid);
|
||||
List<EmpCardGiftVo> recordList(@Param("empCardSid")String empCardSid);
|
||||
|
||||
List<EmpCardGiftVo> getEmpCardGiftByGiftbagSid(@Param("giftbagSid")String giftbagSid,@Param("state") String state);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<where>
|
||||
${ew.sqlSegment}
|
||||
</where>
|
||||
ORDER BY gi.isItlnvalid desc,gi.bindDate desc
|
||||
ORDER BY gi.isItInvalid desc,gi.bindDate desc
|
||||
</select>
|
||||
<select id="getGifCardBySid" resultType="com.yxt.yyth.api.empcardgift.EmpGiftAppletVo">
|
||||
SELECT
|
||||
@@ -148,12 +148,14 @@
|
||||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
<!-- <select id="selGiftCard" resultType="com.yxt.yyth.api.lpkgiftcard.LpkGiftCardWordVo">-->
|
||||
<!-- select card.*,bag.name as bagName from lpk_giftcard card left join lpk_giftbag bag on bag.sid =card.giftbagSid where card.serialNumber in-->
|
||||
<!-- <foreach collection="serialNumbers" item="item" index="index" open="(" close=")" separator=",">-->
|
||||
<!-- #{item}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- </select>-->
|
||||
<update id="updateIsItInvalid" >
|
||||
update emp_card_gift set isItInvalid='1',state='5',isReservation='1' where empCardSid in
|
||||
<foreach collection="sids" item="item" index="index" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
and state!=#{state}
|
||||
</update>
|
||||
|
||||
<select id="selGiftCard" resultType="com.yxt.yyth.api.lpkgiftcard.LpkGiftCardWordVo">
|
||||
select card.*,bag.name as bagName from lpk_giftcard card left join lpk_giftbag bag on bag.sid =card.giftbagSid
|
||||
<where>
|
||||
@@ -177,4 +179,16 @@
|
||||
where gi.empCardSid=#{empCardSid}
|
||||
|
||||
</select>
|
||||
<select id="getEmpCardGiftByGiftbagSid" resultType="com.yxt.yyth.api.empcardgift.EmpCardGiftVo">
|
||||
SELECT
|
||||
gi.*
|
||||
FROM emp_card_gift gi
|
||||
left join emp_card c on c.sid =gi.empCardSid
|
||||
where c.giftbagSid=#{giftbagSid}
|
||||
<if test="state!='' and state != null">
|
||||
and gi.state !=#{state}
|
||||
GROUP BY c.sid
|
||||
</if>
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -190,29 +190,31 @@
|
||||
</select>
|
||||
<select id="cardStatisticsListExport" resultType="com.yxt.yyth.api.lpkgiftcard.CardStatisticsExportVo">
|
||||
SELECT
|
||||
a.CODE AS CODE,
|
||||
a.createTime AS createTime,
|
||||
CASE
|
||||
WHEN a.CODE IS NOT NULL THEN
|
||||
'提货卡'
|
||||
END cardType,
|
||||
CASE
|
||||
a.state
|
||||
WHEN 1 THEN
|
||||
'未绑卡'
|
||||
WHEN 2 THEN
|
||||
'未绑卡'
|
||||
WHEN 3 THEN
|
||||
'未预约'
|
||||
WHEN 4 THEN
|
||||
'已预约'
|
||||
WHEN 5 THEN
|
||||
'已完成'
|
||||
END stateValue,
|
||||
a.customerSid AS bind,
|
||||
a.bindDate AS bindDate,
|
||||
d.NAME AS goodsName,
|
||||
c.goodsNumber AS goodsNumber
|
||||
a.serialNumber as serialNumber,
|
||||
a.CODE AS code,
|
||||
a.createTime AS createTime,
|
||||
a.isEnable as isEnable,
|
||||
CASE
|
||||
WHEN a.CODE IS NOT NULL THEN
|
||||
'提货卡'
|
||||
END cardType,
|
||||
CASE
|
||||
a.state
|
||||
WHEN 1 THEN
|
||||
'未绑卡'
|
||||
WHEN 2 THEN
|
||||
'未绑卡'
|
||||
WHEN 3 THEN
|
||||
'未预约'
|
||||
WHEN 4 THEN
|
||||
'已预约'
|
||||
WHEN 5 THEN
|
||||
'已完成'
|
||||
END stateValue,
|
||||
a.customerSid AS bind,
|
||||
a.bindDate AS bindDate,
|
||||
d.NAME AS goodsName,
|
||||
c.goodsNumber AS goodsNumber
|
||||
FROM
|
||||
lpk_giftcard a
|
||||
LEFT JOIN lpk_giftbag b ON b.sid = a.giftbagSid
|
||||
|
||||
@@ -1402,12 +1402,18 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp
|
||||
QueryWrapper<LpkGiftCardListQuery> qw = new QueryWrapper<>();
|
||||
qw.eq("1", "1");
|
||||
if(StringUtils.isNotBlank(query.getSerialNumber())){
|
||||
qw.eq("a.serialNumber",query.getSerialNumber());
|
||||
qw.like("a.serialNumber",query.getSerialNumber());
|
||||
}
|
||||
qw.groupBy("a.sid");
|
||||
qw.groupBy("c.goodsSid");
|
||||
qw.orderByDesc("a.createTime");
|
||||
// qw.groupBy("c.goodsSid");
|
||||
List<CardStatisticsExportVo> statisticsExportVos=baseMapper.cardStatisticsListExport(qw);
|
||||
String excelName = "支行汇总信息.xlsx";
|
||||
statisticsExportVos.forEach(s->{
|
||||
if(s.getIsEnable().equals("2")){
|
||||
s.setStateValue("已作废");
|
||||
}
|
||||
});
|
||||
String excelName = "提货卡信息.xlsx";
|
||||
String fileNameURL = "1";
|
||||
response.setContentType( "application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf8");
|
||||
@@ -1442,7 +1448,7 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp
|
||||
QueryWrapper<LpkGiftCardListQuery> qw = new QueryWrapper<>();
|
||||
qw.eq("1", "1");
|
||||
if(StringUtils.isNotBlank(query.getSerialNumber())){
|
||||
qw.eq("a.serialNumber",query.getSerialNumber());
|
||||
qw.like("a.serialNumber",query.getSerialNumber());
|
||||
}
|
||||
qw.groupBy("a.sid");
|
||||
qw.orderByDesc("a.createTime");
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
package com.yxt.yyth.biz.scheduled;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.yxt.common.core.result.ResultBean;
|
||||
import com.yxt.yyth.api.empcard.EmpCard;
|
||||
import com.yxt.yyth.api.empcardgift.EmpCardGift;
|
||||
import com.yxt.yyth.api.empcardgift.EmpCardGiftVo;
|
||||
import com.yxt.yyth.api.lpkgiftbag.LpkGiftBag;
|
||||
import com.yxt.yyth.api.lpkgiftcard.LpkGiftCard;
|
||||
import com.yxt.yyth.api.lpkreserveorder.LpkReserveOrderVo;
|
||||
import com.yxt.yyth.biz.empcard.EmpCardMapper;
|
||||
import com.yxt.yyth.biz.empcard.EmpCardService;
|
||||
import com.yxt.yyth.biz.empcardgift.EmpCardGiftMapper;
|
||||
import com.yxt.yyth.biz.empcardgift.EmpCardGiftService;
|
||||
import com.yxt.yyth.biz.lpkgiftbag.LpkGiftBagService;
|
||||
import com.yxt.yyth.biz.lpkgiftcard.LpkGiftCardMapper;
|
||||
import com.yxt.yyth.biz.lpkgiftcard.LpkGiftCardService;
|
||||
@@ -16,6 +24,7 @@ import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -31,7 +40,12 @@ public class scheduledRest {
|
||||
LpkGiftCardMapper lpkGiftCardMapper;
|
||||
@Autowired
|
||||
LpkReserveOrderService lpkReserveOrderService;
|
||||
@Autowired
|
||||
EmpCardMapper empCardMapper;
|
||||
@Autowired
|
||||
EmpCardGiftMapper empCardGiftMapper;
|
||||
@Scheduled(cron = "0 0 1 * * ? ")
|
||||
// @Scheduled(cron = "0 * * * * ? ")
|
||||
public void updateIsItInvalid() {
|
||||
List<LpkGiftBag> lpkGiftBags = lpkGiftBagService.list(new QueryWrapper<LpkGiftBag>().eq("isSel","1"));
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
@@ -40,14 +54,22 @@ public class scheduledRest {
|
||||
int in = DateUtil.parse(sdf.format(lpkGiftBag.getDateEnd())).compareTo(DateUtil.parse(sdf.format(new Date())));
|
||||
if (String.valueOf(in).equals("-1")) {
|
||||
Integer i = lpkGiftCardMapper.selectCount(new QueryWrapper<LpkGiftCard>().eq("giftbagSid", lpkGiftBag.getSid()).ne("state", "5"));
|
||||
List<EmpCardGiftVo> empCardGiftVos = empCardGiftMapper.getEmpCardGiftByGiftbagSid(lpkGiftBag.getSid(),"5");
|
||||
if (i != 0) {
|
||||
lpkGiftBag.setIsSel("2");
|
||||
lpkGiftBagService.updateById(lpkGiftBag);
|
||||
lpkGiftCardMapper.updateIsItInvalid(lpkGiftBag.getSid(), "5");
|
||||
}
|
||||
if(empCardGiftVos.size()!=0){
|
||||
List<String> sids=new ArrayList<>();
|
||||
empCardGiftVos.forEach(s->{
|
||||
sids.add(s.getEmpCardSid()) ;
|
||||
});
|
||||
empCardGiftMapper.updateIsItInvalid(sids, "5");
|
||||
}
|
||||
lpkGiftBag.setIsSel("2");
|
||||
lpkGiftBagService.updateById(lpkGiftBag);
|
||||
} else {
|
||||
// List<LpkGiftCard> list = lpkGiftCardMapper.selectList(new QueryWrapper<LpkGiftCard>().eq("customerSid", customerSid).eq("giftbagSid", lpkGiftBag.getSid()));
|
||||
List<LpkGiftCard> list = lpkGiftCardMapper.selectList(new QueryWrapper<LpkGiftCard>().eq("giftbagSid", lpkGiftBag.getSid()));
|
||||
List<EmpCardGiftVo> empCardGiftVos = empCardGiftMapper.getEmpCardGiftByGiftbagSid(lpkGiftBag.getSid(),"");
|
||||
for (LpkGiftCard card : list) {
|
||||
LpkReserveOrderVo LpkReserveOrderVo = lpkReserveOrderService.selByCardSid(card.getSid()).getData();
|
||||
if (null != LpkReserveOrderVo) {
|
||||
@@ -61,11 +83,33 @@ public class scheduledRest {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (EmpCardGiftVo card : empCardGiftVos) {
|
||||
LpkReserveOrderVo LpkReserveOrderVo = lpkReserveOrderService.selByCardSid(card.getSid()).getData();
|
||||
if (null != LpkReserveOrderVo) {
|
||||
int c = DateUtil.parse(sdf.format(LpkReserveOrderVo.getReserveDate())).compareTo(DateUtil.parse(sdf.format(new Date())));
|
||||
EmpCardGift entity=new EmpCardGift();
|
||||
BeanUtil.copyProperties(card, entity, "id", "sid");
|
||||
if (String.valueOf(c).equals("-1")) {
|
||||
if(card.getState().equals("5")){
|
||||
entity.setIsItInvalid("1");
|
||||
}
|
||||
entity.setIsReservation("1");
|
||||
empCardGiftMapper.updateById(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// @Scheduled(cron = "0/1 * * * * ?")
|
||||
// public void test() {
|
||||
// System.out.println("执行");
|
||||
// @Scheduled(cron = "0 * * * * ? ")
|
||||
//public void aa(){
|
||||
// List<EmpCardGiftVo> empCardGiftVos = empCardGiftMapper.getEmpCardGiftByGiftbagSid("8e667618-63de-480c-ad1e-2747b76aa99b","5");
|
||||
// if(empCardGiftVos.size()!=0){
|
||||
// List<String> sids=new ArrayList<>();
|
||||
// empCardGiftVos.forEach(s->{
|
||||
// sids.add(s.getEmpCardSid()) ;
|
||||
// });
|
||||
// empCardGiftMapper.updateIsItInvalid(sids, "5");
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user