From 33f7057cebf79849af8aa5c260c240e05db37f2a Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 7 Dec 2021 15:14:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BC=98=E6=83=A0=E5=88=B8?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1 | Bin 0 -> 3440 bytes .../bweb/controller/HighCouponController.java | 117 ++++++++++++++++++ .../impl/HighCouponCodeServiceImpl.java | 8 ++ 3 files changed, 125 insertions(+) create mode 100644 1 diff --git a/1 b/1 new file mode 100644 index 0000000000000000000000000000000000000000..39603359b5b4252bb8c6713fd9961fc7d587e4d1 GIT binary patch literal 3440 zcmaJ@c|6nqAIGrG?PnF~o10RxD0j&j&6P?exsN%wndEBD=DsCGi6*&^Xc+m;kz0-& zQOnm6a-&S|0ZBQs(X|7C8UjrRbI1TQ-^3g1VnrE? zYqx<4NygzUsAU^_2m9-*wy#mIO*Pbc{OaHOHApT>!p8{Mdne7m`kGiJo5T23&a?yN zQVk9cgKk{TX~KR}Yyt`yeH#&7<|6X+V8?A=*nHJYayqWeg@4}t#E9sySlOu+tS@2M z)%u{LZ*2aJj=bJmcyz)eUgZN(1k8R_bkBQ~DP~^C?e65N<<^6k75!ZscUW zdUf;C%Ue-k+}opq%55bN!DL?patbDN@WxUwvhj$wv!PxFBX69uL4e6TZYld?t-2`& zTU`CrAH}=s|AA95!irD8J?u|k!&-VH7!c%>)QVE3r=vT{M5lTv8`h$6ili`S8Fd-|P-e*<+&jc7Z*f zs-e0ym!+OQ54_VGlnMW^G05+A{#^e2g#*MXQmPE|XloUP)2-c|@ zs2U7pNXGIs4oxcnlT5#uOO%PM;^bX@^HvO*(`5U)`I;}{neWtnOyo_G*zWZ9vpSj@ zQ4k%gSqq*hTuJ6|u>fe@Y<`nMS2J6>;fZn)kR8z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Jo4Y457Chx#M9mW%ldz{-AE?3tU>tFem68x}+5}UwD-In&m|^o<@G>RPcN%zS5cz5{sWK z8d!VxP{OjLOk3UT5!zCuw6%m+tXC`@)AyO$S>-bM{$D91Sp9Y=9R5ku&qYd0*3YFH zukTD*suy-6y6>TSh`i6;q;0xp`nTz9PN3kze6X#l+H^vF{{^5jSu|?Vm$Qt7=}h!) z5*A4eE_5UcGR26nbC|Cg%CA{!p3_o2odK{ObnAbo;9a098hukwD^5WtcY|mO20KWz zJK(COE8ERyUa`q-Ar}Ed*M>xy)$U>SBm@N49C@V_**z9AP_+JHC#!b5&mXC%qyGMi_aC3iVHn12UP8s{ z7gj1aSb%c;d& zYn0Z*Blnx$1QE_Qn@%)x2E*26Bgcoi=6F;*4>b7Yr(RDhwu@@t3D7;Y+j3X2_0^$2 zRyUzbtfx5P*m#=`{n-s?@1mOnd1FAn_xV7-9t>0}44cxTJvQnC$ds@qhfAqNm5{*V zvxc6)$R#vJv8zjojLP})YPPQ5*(0)K?kw)OsC+D@R(f<4rMegyww lGVDKxRut5}*#imuR}%l%MMf|tX6i4&l$R={O#DAe{vQreX;}aO literal 0 HcmV?d00001 diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java b/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java index a244b2b1..e8bd2408 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java @@ -4,6 +4,7 @@ import com.alibaba.excel.EasyExcel; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.bweb.config.SysConst; import com.bweb.excelListener.ImportCouponListener; import com.bweb.model.ImportCouponModel; import com.github.pagehelper.PageHelper; @@ -37,6 +38,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.io.File; import java.util.*; import java.util.stream.Collectors; @@ -453,6 +455,121 @@ public class HighCouponController { } } + @RequestMapping(value="/exportStock",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "导出卡卷库存") + public ResponseData exportStock(@RequestBody JSONObject body, HttpServletRequest request) { + try { + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + + if (body == null || body.getLong("couponId") == null) { + log.error("HighCouponController -> exportStock() error!","请求参数校验失败"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + // 查找卡卷 + HighCoupon coupon = highCouponService.getCouponById(body.getLong("couponId")); + if (coupon == null) { + log.error("HighCouponController -> writeStock() error!","未找到卡卷信息"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_COUPON, ""); + } + + Map param = new HashMap<>(); + param.put("couponId", body.getLong("couponId")); + param.put("status", body.getInteger("status")); + param.put("createTimeS", body.getLong("createTimeS")); + param.put("createTimeE", body.getLong("createTimeE")); + // 销售码 + List codeList = highCouponCodeService.getCouponCodeList(param); + + List headList = new ArrayList<>();; + headList.add("序号"); + headList.add("消费码key"); + headList.add("消费码"); + headList.add("状态"); + headList.add("使用门店"); + headList.add("领取时间"); + headList.add("消费时间"); + headList.add("销售截止时间"); + headList.add("使用截止时间"); + headList.add("创建时间"); + + List> dataList = new ArrayList<>(); + List data; + Integer i = 1; + + for (HighCouponCode couponCode : codeList) { + data = new ArrayList<>(); + data.add(i++); + data.add(couponCode.getCodeKey()); + data.add(couponCode.getSalesCode()); + if (couponCode.getStatus() == 1) { + data.add("待销售"); + } else if (couponCode.getStatus() == 2) { + data.add("待使用"); + } else if (couponCode.getStatus() == 3) { + data.add("已使用"); + } else if (couponCode.getStatus() == 4) { + data.add("已过期"); + } else if (couponCode.getStatus() == 99) { + data.add("预支付"); + } else { + data.add("未知"); + } + data.add(couponCode.getStoreName()); + data.add(couponCode.getReceiveTime()); + data.add(couponCode.getConsumeTime()); + data.add(couponCode.getSalesEndTime()); + data.add(couponCode.getUseEndTime()); + data.add(couponCode.getCreateTime()); + dataList.add(data); + } + + String fileUrl = SysConst.getSysConfig().getFileUrl() + "/temporary/"; + String pathName = "导出销售码"+System.currentTimeMillis()+".xlsx"; + File file = new File(fileUrl); + if (!file.exists()) { + file.mkdirs(); + } + EasyExcel.write(fileUrl+pathName).head(generationHead(headList)).sheet("消费码").doWrite(dataList); + return ResponseMsgUtil.success(pathName); + } catch (Exception e) { + log.error("HighCouponController -> importStock() error!",e); + return ResponseMsgUtil.exception(e); + } + } + +/* private List> generationHead(List headList) { + List> list = new ArrayList<>(); + List head0 = new ArrayList<>(); + head0.add("字符串" + System.currentTimeMillis()); + List head1 = new ArrayList<>(); + head1.add("数字" + System.currentTimeMillis()); + List head2 = new ArrayList<>(); + head2.add("日期" + System.currentTimeMillis()); + list.add(head0); + list.add(head1); + list.add(head2); + return list; + }*/ + + /** + * 生成头部 + * @param headList + * @return + */ + private List> generationHead(List headList) { + List> list = new ArrayList<>(); + List head; + for (String headStr : headList) { + head = new ArrayList<>(); + head.add(headStr); + list.add(head); + } + return list; + } + @RequestMapping(value="/writeStock",method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "填写卡卷库存(内部劵)") diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java index f83b806d..abc2c985 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java @@ -266,6 +266,14 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService { criteria.andSalesEndTimeGreaterThan(new Date(MapUtils.getLong(map, "salesEndTimeS"))); } + if (MapUtils.getLong(map, "createTimeS") != null) { + criteria.andCreateTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(map, "createTimeS"))); + } + + if (MapUtils.getLong(map, "createTimeE") != null) { + criteria.andCreateTimeLessThanOrEqualTo(new Date(MapUtils.getLong(map, "createTimeE"))); + } + if (MapUtils.getBoolean(map, "isAssignAgent") != null) { criteria.andIsAssignAgentEqualTo(MapUtils.getBoolean(map, "isAssignAgent")); }