diff --git a/docs/databases-new/table_create-banner.sql b/docs/databases-new/table_create-banner.sql new file mode 100644 index 0000000..b7c4b4d --- /dev/null +++ b/docs/databases-new/table_create-banner.sql @@ -0,0 +1,23 @@ + + +DROP TABLE IF EXISTS `applet_banner`; +CREATE TABLE `applet_banner` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'ID,唯一编号', + `sid` VARCHAR(64) NOT NULL COMMENT 'sid', + `createTime` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP COMMENT '记录创建时间', + `remarks` VARCHAR(255) NULL DEFAULT NULL COMMENT '备注信息', + `isEnable` INT(11) NULL DEFAULT '1' COMMENT '是否可用 1显示 2 不显示', + + `bannerUrl` VARCHAR(1024) NULL DEFAULT NULL COMMENT '轮播图完整URL', + `bannerPath` VARCHAR(1024) NULL DEFAULT NULL COMMENT '轮播图相对地址', + `title` VARCHAR(255) NULL DEFAULT NULL COMMENT '标题', + `content` TEXT NULL DEFAULT NULL COMMENT '内容', + `startDate` DATETIME NULL DEFAULT NULL COMMENT '开始时间', + `endDate` DATETIME NULL DEFAULT NULL COMMENT '结束时间', + `sort` int DEFAULT 1, + `releaseTime` DATETIME NULL DEFAULT NULL COMMENT '发布时间', + `publisher` VARCHAR(255) NULL DEFAULT NULL COMMENT '发布人', + `isShow` VARCHAR(255) NULL DEFAULT '1' COMMENT '是否显示 1 显示 2不显示', + PRIMARY KEY (`id`) USING BTREE +) COMMENT='小程序轮播图' ENGINE=InnoDB; + diff --git a/docs/databases-new/修改表结构编码.txt b/docs/databases-new/修改表结构编码.txt new file mode 100644 index 0000000..5518eb3 --- /dev/null +++ b/docs/databases-new/修改表结构编码.txt @@ -0,0 +1,2 @@ + +alter table lpk_customer convert to character set utf8 collate utf8_general_ci \ No newline at end of file diff --git a/src/main/java/com/yxt/yythmall/adminapi/AdminReserveRest.java b/src/main/java/com/yxt/yythmall/adminapi/AdminReserveRest.java index 51344dd..d7622f4 100644 --- a/src/main/java/com/yxt/yythmall/adminapi/AdminReserveRest.java +++ b/src/main/java/com/yxt/yythmall/adminapi/AdminReserveRest.java @@ -1,8 +1,6 @@ package com.yxt.yythmall.adminapi; import com.alibaba.excel.EasyExcel; -import com.alibaba.excel.ExcelWriter; -import com.alibaba.excel.write.metadata.WriteSheet; import com.baomidou.mybatisplus.core.metadata.IPage; import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.result.ResultBean; @@ -20,7 +18,6 @@ import java.io.IOException; import java.net.URLEncoder; import java.util.List; import java.util.Map; -import java.util.concurrent.atomic.AtomicInteger; @RestController("com.yxt.yythmall.adminapi.AdminReserveRest") @RequestMapping("/adminapi/reserve") @@ -43,16 +40,17 @@ public class AdminReserveRest { // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 String fileName = URLEncoder.encode("预约单明细", "UTF-8").replaceAll("\\+", "%20"); response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); - Map> map = vegeCellarReserveOrderService.mapForExcelCustomer(pq); -// EasyExcel.write(response.getOutputStream(), RpHzcExcel.class).sheet("cck").doWrite(list); - try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), ReserveCustomerExcel.class).build()) { - AtomicInteger i= new AtomicInteger(); - map.forEach((key,val) ->{ - WriteSheet writeSheet = EasyExcel.writerSheet(i.get(),key).build(); - i.getAndIncrement(); - excelWriter.write(val, writeSheet); - }); - } +// Map> map = vegeCellarReserveOrderService.mapForExcelCustomer(pq); + List list = vegeCellarReserveOrderService.listForExcelCustomer(pq); + EasyExcel.write(response.getOutputStream(), ReserveCustomerExcel.class).sheet("预约单明细").doWrite(list); +// try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), ReserveCustomerExcel.class).build()) { +// AtomicInteger i= new AtomicInteger(); +// map.forEach((key,val) ->{ +// WriteSheet writeSheet = EasyExcel.writerSheet(i.get(),key).build(); +// i.getAndIncrement(); +// excelWriter.write(val, writeSheet); +// }); +// } } @ApiOperation("精确到客户的预约单列表") @@ -95,18 +93,19 @@ public class AdminReserveRest { response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); response.setCharacterEncoding("utf-8"); // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 - String fileName = URLEncoder.encode("提货点配货单", "UTF-8").replaceAll("\\+", "%20"); + String fileName = URLEncoder.encode("支行配货单", "UTF-8").replaceAll("\\+", "%20"); response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); Map> map = vegeCellarReserveOrderService.mapForExcelBank(pq); -// EasyExcel.write(response.getOutputStream(), RpHzcExcel.class).sheet("cck").doWrite(list); - try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), ReserveBankExcel.class).build()) { - AtomicInteger i= new AtomicInteger(); - map.forEach((key,val) ->{ - WriteSheet writeSheet = EasyExcel.writerSheet(i.get(),key).build(); - i.getAndIncrement(); - excelWriter.write(val, writeSheet); - }); - } + List list = vegeCellarReserveOrderService.listForExcelBank(pq); + EasyExcel.write(response.getOutputStream(), ReserveBankExcel.class).sheet("支行配货单").doWrite(list); +// try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), ReserveBankExcel.class).build()) { +// AtomicInteger i= new AtomicInteger(); +// map.forEach((key,val) ->{ +// WriteSheet writeSheet = EasyExcel.writerSheet(i.get(),key).build(); +// i.getAndIncrement(); +// excelWriter.write(val, writeSheet); +// }); +// } } @ApiOperation("精确到客户的预约单列表") diff --git a/src/main/java/com/yxt/yythmall/adminapi/BannerRest.java b/src/main/java/com/yxt/yythmall/adminapi/BannerRest.java new file mode 100644 index 0000000..2acc365 --- /dev/null +++ b/src/main/java/com/yxt/yythmall/adminapi/BannerRest.java @@ -0,0 +1,52 @@ +package com.yxt.yythmall.adminapi; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.yxt.common.core.query.PagerQuery; +import com.yxt.common.core.result.ResultBean; +import com.yxt.yythmall.biz.appletbanner.AppletBanner; +import com.yxt.yythmall.biz.appletbanner.AppletBannerQuery; +import com.yxt.yythmall.biz.appletbanner.AppletBannerService; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@RestController("com.yxt.yythmall.adminapi.BannerRest") +@RequestMapping("/adminapi/banner") +public class BannerRest { + @Autowired + private AppletBannerService appletBannerService; + + + @ApiOperation("分页列表") + @PostMapping("/pageList") + public ResultBean> pageList(@RequestBody PagerQuery pq) { + ResultBean rb = ResultBean.fireFail(); + IPage page = appletBannerService.pageList(pq); + return rb.success().setData(page); + } + + @ApiOperation("修改或保存") + @PostMapping("/saveOrUpdate") + public ResultBean saveOrUpdate(@RequestBody AppletBanner dto) { + ResultBean rb = ResultBean.fireFail(); + appletBannerService.saveOrUpdate(dto); + return rb.success(); + } + + @ApiOperation("初始化") + @GetMapping("/noticeInit/{sid}") + public ResultBean noticeInit(@PathVariable("sid") String sid) { + ResultBean rb = ResultBean.fireFail(); + AppletBanner ab = appletBannerService.fetchBySid(sid); + return rb.success().setData(ab); + } + + @ApiOperation("是否显示") + @GetMapping("/isDisplayed/{sid}/{state}") + public ResultBean isDisplayed(@PathVariable("sid") String sid, @PathVariable("state") String state) { + ResultBean rb = ResultBean.fireFail(); + appletBannerService.updateShowState(sid, state); + return rb.success().setMsg("更改成功!"); + } +} diff --git a/src/main/java/com/yxt/yythmall/biz/appletbanner/AppletBanner.java b/src/main/java/com/yxt/yythmall/biz/appletbanner/AppletBanner.java new file mode 100644 index 0000000..0903629 --- /dev/null +++ b/src/main/java/com/yxt/yythmall/biz/appletbanner/AppletBanner.java @@ -0,0 +1,41 @@ +package com.yxt.yythmall.biz.appletbanner; + +import cn.hutool.core.util.IdUtil; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.yxt.common.core.domain.EntityWithId; +import lombok.Data; + +import java.util.Date; +import java.util.UUID; + +/** + * @author wangpengfei + * @date 2023/12/8 9:10 + */ +@Data +@TableName("applet_banner") +public class AppletBanner extends EntityWithId { + + private String sid = IdUtil.fastSimpleUUID(); + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date createTime = new Date(); + private String remarks; + private String isEnable; + private String title; + private String content; + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date startDate; + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date endDate; + private int sort = 1; + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date releaseTime;//发布时间 + private String publisher;//发布人 + private String isShow = "1"; + + + private String bannerUrl;//轮播图完整URL + private String bannerPath;//轮播图相对地址 +} diff --git a/src/main/java/com/yxt/yythmall/biz/appletbanner/AppletBannerMapper.java b/src/main/java/com/yxt/yythmall/biz/appletbanner/AppletBannerMapper.java new file mode 100644 index 0000000..17b12a9 --- /dev/null +++ b/src/main/java/com/yxt/yythmall/biz/appletbanner/AppletBannerMapper.java @@ -0,0 +1,8 @@ +package com.yxt.yythmall.biz.appletbanner; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface AppletBannerMapper extends BaseMapper { +} diff --git a/src/main/java/com/yxt/yythmall/biz/appletbanner/AppletBannerQuery.java b/src/main/java/com/yxt/yythmall/biz/appletbanner/AppletBannerQuery.java new file mode 100644 index 0000000..860c063 --- /dev/null +++ b/src/main/java/com/yxt/yythmall/biz/appletbanner/AppletBannerQuery.java @@ -0,0 +1,16 @@ +package com.yxt.yythmall.biz.appletbanner; + +import com.yxt.common.core.query.Query; +import lombok.Data; + +/** + * @author wangpengfei + * @date 2023/12/8 9:11 + */ +@Data +public class AppletBannerQuery implements Query { + private String startDate; //开始时间 + private String endDate; //结束时间 + private String countNumber; //总数 + private String name; +} diff --git a/src/main/java/com/yxt/yythmall/biz/appletbanner/AppletBannerService.java b/src/main/java/com/yxt/yythmall/biz/appletbanner/AppletBannerService.java new file mode 100644 index 0000000..4cd8e3d --- /dev/null +++ b/src/main/java/com/yxt/yythmall/biz/appletbanner/AppletBannerService.java @@ -0,0 +1,60 @@ +package com.yxt.yythmall.biz.appletbanner; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.yxt.common.base.utils.PagerUtil; +import com.yxt.common.base.utils.StringUtils; +import com.yxt.common.core.query.PagerQuery; +import com.yxt.yythmall.wxapi.vo.WxBannerListVo; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +@Service +public class AppletBannerService extends ServiceImpl { + + public IPage pageList(PagerQuery pq) { + AppletBannerQuery query = pq.getParams(); + IPage page = PagerUtil.queryToPage(pq); + + QueryWrapper qw = new QueryWrapper<>(); + if (StringUtils.isNotBlank(query.getName())) { + qw.like("title", query.getName()); + } + IPage iPage = baseMapper.selectPage(page, qw); + return iPage; + } + + public AppletBanner fetchBySid(String sid) { + QueryWrapper qw = new QueryWrapper<>(); + qw.eq("sid", sid); + List list = baseMapper.selectList(qw); + if (list == null || list.isEmpty()) + return null; + return list.get(0); + } + + public void updateShowState(String sid, String state) { + UpdateWrapper uw = new UpdateWrapper<>(); + uw.set("isShow", state); + uw.eq("sid", sid); + baseMapper.update(null, uw); + } + + public List listWxVo() { + QueryWrapper qw = new QueryWrapper<>(); + qw.eq("isShow", 1); + List list = baseMapper.selectList(qw); + List voList = new ArrayList<>(); + list.forEach(entity -> { + WxBannerListVo vo = new WxBannerListVo(); + BeanUtil.copyProperties(entity, vo); + voList.add(vo); + }); + return voList; + } +} diff --git a/src/main/java/com/yxt/yythmall/biz/vegecallerreserveorder/ReserveCustomerExcel.java b/src/main/java/com/yxt/yythmall/biz/vegecallerreserveorder/ReserveCustomerExcel.java index 52c34eb..ce6181a 100644 --- a/src/main/java/com/yxt/yythmall/biz/vegecallerreserveorder/ReserveCustomerExcel.java +++ b/src/main/java/com/yxt/yythmall/biz/vegecallerreserveorder/ReserveCustomerExcel.java @@ -38,4 +38,7 @@ public class ReserveCustomerExcel { @ColumnWidth(20) @ExcelProperty(value = "商品数量(份)",index = 7) private String goodsNumber; + @ColumnWidth(20) + @ExcelProperty(value = "客户所属支行",index = 8) + private String customerBank; } diff --git a/src/main/java/com/yxt/yythmall/biz/vegecallerreserveorder/ReserveOrderVo.java b/src/main/java/com/yxt/yythmall/biz/vegecallerreserveorder/ReserveOrderVo.java index 50cd571..26fa80e 100644 --- a/src/main/java/com/yxt/yythmall/biz/vegecallerreserveorder/ReserveOrderVo.java +++ b/src/main/java/com/yxt/yythmall/biz/vegecallerreserveorder/ReserveOrderVo.java @@ -35,4 +35,5 @@ public class ReserveOrderVo implements Vo { private String goodsSid; private String goodsName; private String goodsNumber; + private String customerBank; } diff --git a/src/main/java/com/yxt/yythmall/biz/vegecallerreserveorder/VegeCellarReserveOrderMapper.xml b/src/main/java/com/yxt/yythmall/biz/vegecallerreserveorder/VegeCellarReserveOrderMapper.xml index 169b0f7..885b2de 100644 --- a/src/main/java/com/yxt/yythmall/biz/vegecallerreserveorder/VegeCellarReserveOrderMapper.xml +++ b/src/main/java/com/yxt/yythmall/biz/vegecallerreserveorder/VegeCellarReserveOrderMapper.xml @@ -471,13 +471,16 @@ max(lb.address) bankAddress, vd.goodsSid, max(vd.goodsName) goodsName, - sum(vd.goodsNumber) goodsNumber + sum(vd.goodsNumber) goodsNumber, + max(lcb.name) customerBank from vege_cellar_reserve_order vo LEFT JOIN lpk_store ls ON ls.sid=vo.storeSid LEFT JOIN lpk_bank lb ON lb.sid=ls.bankSid left join vege_cellar_reserve_details vd on vo.sid=vd.orderSid left join lpk_goods lg on vd.goodsSid=lg.sid left join pms_brand pb on pb.id=vo.affiliation + LEFT JOIN lpk_customer lc ON lc.sid=vo.customerSid + LEFT JOIN lpk_customer_bank lcb ON lcb.sid = lc.customerBankSid ${ew.sqlSegment} diff --git a/src/main/java/com/yxt/yythmall/biz/vegecallerreserveorder/VegeCellarReserveOrderService.java b/src/main/java/com/yxt/yythmall/biz/vegecallerreserveorder/VegeCellarReserveOrderService.java index 4d9c919..6d5f4df 100644 --- a/src/main/java/com/yxt/yythmall/biz/vegecallerreserveorder/VegeCellarReserveOrderService.java +++ b/src/main/java/com/yxt/yythmall/biz/vegecallerreserveorder/VegeCellarReserveOrderService.java @@ -55,7 +55,7 @@ public class VegeCellarReserveOrderService extends MybatisBaseServicel =cannotReserveDictionaryService.list(new QueryWrapper().eq("unavailableTime",date)); - if (l.size()>0){ + List l = cannotReserveDictionaryService.list(new QueryWrapper().eq("unavailableTime", date)); + if (l.size() > 0) { return false; } return true; } + // @Test // public void isSatAndSun(){ // String date="2023-12-11"; @@ -725,6 +727,18 @@ public class VegeCellarReserveOrderService extends MybatisBaseService listForExcelCustomer(LpkReserveOrderQuery query) { + QueryWrapper qw = buildQuery(query); + List list = baseMapper.pageOfCustomer(qw); + List volist = new ArrayList<>(); + list.forEach(vo -> { + ReserveCustomerExcel ex = new ReserveCustomerExcel(); + BeanUtil.copyProperties(vo, ex); + volist.add(ex); + }); + return volist; + } + public ResultBean> pageOfStore(PagerQuery pq) { ResultBean rb = ResultBean.fireFail(); LpkReserveOrderQuery query = pq.getParams(); @@ -792,6 +806,18 @@ public class VegeCellarReserveOrderService extends MybatisBaseService listForExcelBank(LpkReserveOrderQuery query) { + QueryWrapper qw = buildQuery(query); + List list = baseMapper.pageOfBank(qw); + List volist = new ArrayList<>(); + list.forEach(vo -> { + ReserveBankExcel ex = new ReserveBankExcel(); + BeanUtil.copyProperties(vo, ex); + volist.add(ex); + }); + return volist; + } + public ResultBean> pageOfAll(PagerQuery pq) { ResultBean rb = ResultBean.fireFail(); LpkReserveOrderQuery query = pq.getParams(); diff --git a/src/main/java/com/yxt/yythmall/wxapi/WxBannerRest.java b/src/main/java/com/yxt/yythmall/wxapi/WxBannerRest.java new file mode 100644 index 0000000..ea6909c --- /dev/null +++ b/src/main/java/com/yxt/yythmall/wxapi/WxBannerRest.java @@ -0,0 +1,36 @@ +package com.yxt.yythmall.wxapi; + +import com.yxt.common.core.result.ResultBean; +import com.yxt.yythmall.biz.appletbanner.AppletBanner; +import com.yxt.yythmall.biz.appletbanner.AppletBannerService; +import com.yxt.yythmall.wxapi.vo.WxBannerListVo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController("om.yxt.yythmall.wxapi.WxBannerRest") +@RequestMapping("/wxapi/banner") +public class WxBannerRest { + + @Autowired + private AppletBannerService appletBannerService; + + @GetMapping("/list") + public ResultBean> list() { + ResultBean rb = ResultBean.fireFail(); + List list = appletBannerService.listWxVo(); + return rb.success().setData(list); + } + + @GetMapping("/banner/{sid}") + public ResultBean fetchBySid(@PathVariable("sid") String sid) { + ResultBean rb = ResultBean.fireFail(); + AppletBanner entity = appletBannerService.fetchBySid(sid); + return rb.success().setData(entity); + } + +} diff --git a/src/main/java/com/yxt/yythmall/wxapi/vo/WxBannerListVo.java b/src/main/java/com/yxt/yythmall/wxapi/vo/WxBannerListVo.java new file mode 100644 index 0000000..0dee0fe --- /dev/null +++ b/src/main/java/com/yxt/yythmall/wxapi/vo/WxBannerListVo.java @@ -0,0 +1,13 @@ +package com.yxt.yythmall.wxapi.vo; + +import lombok.Data; + +@Data +public class WxBannerListVo { + + private String sid; + private String title; + + private String bannerUrl;//轮播图完整URL + private String bannerPath;//轮播图相对地址 +} diff --git a/src/main/resources/application-devv.yml b/src/main/resources/application-devv.yml index 7d63187..4513022 100644 --- a/src/main/resources/application-devv.yml +++ b/src/main/resources/application-devv.yml @@ -3,11 +3,11 @@ spring: hikari: max-lifetime: 500000 driver-class-name: com.mysql.cj.jdbc.Driver -# url: jdbc:mysql://39.104.100.138:3306/yxt_lpk_yythmall?serverTimezone=GMT%2B8&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true - url: jdbc:mysql://8.130.39.13:3306/yxt_lpk_yythmall?serverTimezone=GMT%2B8&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true + url: jdbc:mysql://39.104.100.138:3306/yxt_lpk_yythmall?serverTimezone=GMT%2B8&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true +# url: jdbc:mysql://8.130.39.13:3306/yxt_lpk_yythmall?serverTimezone=GMT%2B8&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true username: root - password: 1LAiGz$t1*Iw -# password: yxt_mysql_138 +# password: 1LAiGz$t1*Iw + password: yxt_mysql_138 cloud: nacos: discovery: