批量导入生成礼品卡功能
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package com.yxt.yyth.api.lpkgiftcard;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Fan
|
||||
* @description
|
||||
* @date 2023/12/16 15:00
|
||||
*/
|
||||
@Data
|
||||
public class ReturnExcelInfo {
|
||||
List<ReturnExcelInfoDetails> infoDetails;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yxt.yyth.api.lpkgiftcard;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Fan
|
||||
* @description
|
||||
* @date 2023/12/16 16:05
|
||||
*/
|
||||
@Data
|
||||
public class ReturnExcelInfoDetails {
|
||||
private String goodName;
|
||||
private String goodNum;
|
||||
private String name;
|
||||
private String phone;
|
||||
}
|
||||
18
src/main/java/com/yxt/yyth/api/lpkgiftcard/ReturnMsg.java
Normal file
18
src/main/java/com/yxt/yyth/api/lpkgiftcard/ReturnMsg.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package com.yxt.yyth.api.lpkgiftcard;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Fan
|
||||
* @description
|
||||
* @date 2023/12/16 18:34
|
||||
*/
|
||||
@Data
|
||||
public class ReturnMsg {
|
||||
List<ReturnExcelInfo> infos;
|
||||
Set<String> setMsg;
|
||||
}
|
||||
@@ -38,7 +38,7 @@ public class LpkGiftBagRest {
|
||||
|
||||
@ApiOperation("保存修改")
|
||||
@PostMapping("/saveGiftBag")
|
||||
public ResultBean saveGiftBag(@RequestBody LpkGiftBagDto dto) {
|
||||
public ResultBean<String> saveGiftBag(@RequestBody LpkGiftBagDto dto) {
|
||||
return lpkGiftBagService.saveGiftBag(dto);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,9 +67,11 @@ public class LpkGiftBagService extends MybatisBaseService<LpkGiftBagMapper, LpkG
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResultBean saveGiftBag(LpkGiftBagDto dto) {
|
||||
public ResultBean<String> saveGiftBag(LpkGiftBagDto dto) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
String sid = "";
|
||||
if (StringUtils.isNotBlank(dto.getSid())) {
|
||||
sid = dto.getSid();
|
||||
lpkGiftBagGoodsService.deleteGoodsByBagSid(dto.getSid());
|
||||
LpkGiftBag lpkGiftBag = fetchBySid(dto.getSid());
|
||||
BeanUtil.copyProperties(dto, lpkGiftBag, "id", "sid");
|
||||
@@ -93,6 +95,7 @@ public class LpkGiftBagService extends MybatisBaseService<LpkGiftBagMapper, LpkG
|
||||
}
|
||||
} else {
|
||||
LpkGiftBag lpkGiftBag = new LpkGiftBag();
|
||||
sid = lpkGiftBag.getSid();
|
||||
BeanUtil.copyProperties(dto, lpkGiftBag, "id", "sid");
|
||||
lpkGiftBag.setCreateTime(new DateTime());
|
||||
if (StringUtils.isNotBlank(dto.getIconUrl())) {
|
||||
@@ -113,7 +116,7 @@ public class LpkGiftBagService extends MybatisBaseService<LpkGiftBagMapper, LpkG
|
||||
}
|
||||
}
|
||||
}
|
||||
return rb.success();
|
||||
return rb.success().setData(sid);
|
||||
}
|
||||
|
||||
public ResultBean giftBagInit(String sid) {
|
||||
@@ -172,6 +175,7 @@ public class LpkGiftBagService extends MybatisBaseService<LpkGiftBagMapper, LpkG
|
||||
}
|
||||
return rb.success();
|
||||
}
|
||||
|
||||
public ResultBean giftBagList() {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
List<LpkGiftBagVo> pagging = baseMapper.giftBagList();
|
||||
|
||||
@@ -12,11 +12,15 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
@@ -115,4 +119,16 @@ public class LpkGiftCardRest {
|
||||
return lpkGiftCardService.cardGrant(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量发行导入")
|
||||
@PostMapping("/getExcelInfo")
|
||||
public ResultBean getExcelInfo(
|
||||
@RequestParam(value = "startDate") String startDate,
|
||||
@RequestParam(value = "endDate") String endDate,
|
||||
@RequestParam(value = "file") MultipartFile file,
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response) throws IOException, ParseException {
|
||||
return lpkGiftCardService.getExcelInfo(startDate,endDate,file,request,response);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -24,4 +24,6 @@ public interface LpkGoodsMapper extends BaseMapper<LpkGoods> {
|
||||
|
||||
List<LpkGoodsVo> getGoods();
|
||||
LpkGoodsVo getGoodsDetails(@Param("sid")String sid);
|
||||
|
||||
LpkGoods getGoodsByName(@Param("goodName") String goodName);
|
||||
}
|
||||
|
||||
@@ -47,5 +47,10 @@
|
||||
from lpk_goods
|
||||
where sid = #{sid}
|
||||
</select>
|
||||
<select id="getGoodsByName" resultType="com.yxt.yyth.api.lpkgoods.LpkGoods">
|
||||
select *
|
||||
from lpk_goods
|
||||
where `name` = #{goodName}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -122,4 +122,8 @@ public class LpkGoodsService extends MybatisBaseService<LpkGoodsMapper, LpkGoods
|
||||
List<LpkGoodsVo> list = baseMapper.getGoods();
|
||||
return rb.success().setData(list);
|
||||
}
|
||||
|
||||
public LpkGoods getGoodsByName(String goodName) {
|
||||
return baseMapper.getGoodsByName(goodName);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user