diff --git a/food-admin/src/main/java/com/zbkj/admin/controller/AdminHomeController.java b/food-admin/src/main/java/com/zbkj/admin/controller/AdminHomeController.java new file mode 100644 index 0000000..c09f982 --- /dev/null +++ b/food-admin/src/main/java/com/zbkj/admin/controller/AdminHomeController.java @@ -0,0 +1,100 @@ +package com.zbkj.admin.controller; + +import com.zbkj.common.response.CommonResult; +import com.zbkj.common.response.HomeRateResponse; +import com.zbkj.service.service.HomeService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Map; + + +/** + * 统计 -- 主页 前端控制器 + + */ +@Slf4j +@RestController +@RequestMapping("api/admin/statistics/home") +@Api(tags = "统计 -- 主页") +public class AdminHomeController { + + @Autowired + private HomeService homeService; + + @PreAuthorize("hasAuthority('admin:statistics:home:index')") + @ApiOperation(value = "首页数据") + @RequestMapping(value = "/index", method = RequestMethod.GET) + public CommonResult indexDate() { + return CommonResult.success(homeService.indexDate()); + } + + /** + * 用户曲线图 + */ + @PreAuthorize("hasAuthority('admin:statistics:home:chart:user')") + @ApiOperation(value = "用户曲线图") + @RequestMapping(value = "/chart/user", method = RequestMethod.GET) + public CommonResult> chartUser() { + return CommonResult.success(homeService.chartUser()); + } + + /** + * 用户购买统计 + */ + @PreAuthorize("hasAuthority('admin:statistics:home:chart:user:buy')") + @ApiOperation(value = "用户购买统计") + @RequestMapping(value = "/chart/user/buy", method = RequestMethod.GET) + public CommonResult> chartUserBuy() { + return CommonResult.success(homeService.chartUserBuy()); + } + + /** + * 30天订单量趋势 + */ + @PreAuthorize("hasAuthority('admin:statistics:home:chart:order')") + @ApiOperation(value = "30天订单量趋势") + @RequestMapping(value = "/chart/order", method = RequestMethod.GET) + public CommonResult> chartOrder() { + return CommonResult.success(homeService.chartOrder()); + } + + /** + * 周订单量趋势 + */ + @PreAuthorize("hasAuthority('admin:statistics:home:chart:order:week')") + @ApiOperation(value = "周订单量趋势") + @RequestMapping(value = "/chart/order/week", method = RequestMethod.GET) + public CommonResult> chartOrderInWeek() { + return CommonResult.success(homeService.chartOrderInWeek()); + } + + /** + * 月订单量趋势 + */ + @PreAuthorize("hasAuthority('admin:statistics:home:chart:order:month')") + @ApiOperation(value = "月订单量趋势") + @RequestMapping(value = "/chart/order/month", method = RequestMethod.GET) + public CommonResult> chartOrderInMonth() { + return CommonResult.success(homeService.chartOrderInMonth()); + } + + /** + * 年订单量趋势 + */ + @PreAuthorize("hasAuthority('admin:statistics:home:chart:order:year')") + @ApiOperation(value = "年订单量趋势") + @RequestMapping(value = "/chart/order/year", method = RequestMethod.GET) + public CommonResult> chartOrderInYear() { + return CommonResult.success(homeService.chartOrderInYear()); + } +} + + + diff --git a/food-admin/src/main/java/com/zbkj/admin/controller/ExcelImportController.java b/food-admin/src/main/java/com/zbkj/admin/controller/ExcelImportController.java new file mode 100644 index 0000000..554b7c4 --- /dev/null +++ b/food-admin/src/main/java/com/zbkj/admin/controller/ExcelImportController.java @@ -0,0 +1,52 @@ +package com.zbkj.admin.controller; + +import com.alibaba.fastjson.JSON; +import com.zbkj.common.request.StoreProductAddRequest; +import com.zbkj.common.response.CommonResult; +import com.zbkj.common.utils.excel.ExcelImportUtil; +import com.zbkj.common.utils.excel.ExcelValidUtil; +import com.zbkj.common.utils.excel.ImportParams; +import com.zbkj.service.service.ExcelService; +import com.zbkj.service.service.StoreProductService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +@Slf4j +@RestController +@RequestMapping("api/admin/import/excel") +@Api(tags = "导入 -- Excel") +public class ExcelImportController { + + @Autowired + private ExcelService excelService; + + @Autowired + private StoreProductService storeProductService; + + /** + * 商品导入 + */ + @ApiOperation(value = "产品导入") + @RequestMapping(value = "/product", method = RequestMethod.POST) + public CommonResult export(@RequestParam("multipart") MultipartFile multipart) { + try { + ExcelValidUtil.canImport(multipart); + List list = (List) ExcelImportUtil.importExcelByIs(multipart.getInputStream(), StoreProductAddRequest.class, new ImportParams()); + CommonResult result = storeProductService.saveBatch(list); + return result; + } catch (Exception e) { e.printStackTrace(); } + return CommonResult.failed(); + } +} + + + diff --git a/food-admin/src/main/java/com/zbkj/admin/controller/HomeController.java b/food-admin/src/main/java/com/zbkj/admin/controller/HomeController.java index c8a0bfd..cb37dbd 100644 --- a/food-admin/src/main/java/com/zbkj/admin/controller/HomeController.java +++ b/food-admin/src/main/java/com/zbkj/admin/controller/HomeController.java @@ -1,99 +1,82 @@ package com.zbkj.admin.controller; +import com.zbkj.common.model.home.Home; +import com.zbkj.common.page.CommonPage; +import com.zbkj.common.request.HomeRequest; +import com.zbkj.common.request.PageParamRequest; import com.zbkj.common.response.CommonResult; -import com.zbkj.common.response.HomeRateResponse; -import com.zbkj.service.service.HomeService; +import com.zbkj.common.vo.HomeVo; +import com.zbkj.service.service.EbHomeService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; -import java.util.Map; - - -/** - * 统计 -- 主页 前端控制器 - - */ @Slf4j @RestController -@RequestMapping("api/admin/statistics/home") -@Api(tags = "统计 -- 主页") +@RequestMapping("api/admin/floor/") +@Api(tags = "楼层") public class HomeController { @Autowired - private HomeService homeService; + private EbHomeService homeService; - @PreAuthorize("hasAuthority('admin:statistics:home:index')") - @ApiOperation(value = "首页数据") - @RequestMapping(value = "/index", method = RequestMethod.GET) - public CommonResult indexDate() { - return CommonResult.success(homeService.indexDate()); +// @PreAuthorize("hasAuthority('admin:home:list')") + @ApiOperation(value = "分页列表") + @RequestMapping(value = "/list", method = RequestMethod.GET) + public CommonResult> getList(@Validated HomeRequest request, @Validated PageParamRequest pageParamRequest) { + return CommonResult.success(CommonPage.restPage(homeService.getAdminList(request, pageParamRequest))); } - /** - * 用户曲线图 - */ - @PreAuthorize("hasAuthority('admin:statistics:home:chart:user')") - @ApiOperation(value = "用户曲线图") - @RequestMapping(value = "/chart/user", method = RequestMethod.GET) - public CommonResult> chartUser() { - return CommonResult.success(homeService.chartUser()); +// @PreAuthorize("hasAuthority('admin:home:save')") + @ApiOperation(value = "新增") + @RequestMapping(value = "/save", method = RequestMethod.POST) + public CommonResult save(@RequestBody @Validated HomeRequest request) { + if (homeService.create(request)) { + return CommonResult.success(); + } else { + return CommonResult.failed(); + } } - /** - * 用户购买统计 - */ - @PreAuthorize("hasAuthority('admin:statistics:home:chart:user:buy')") - @ApiOperation(value = "用户购买统计") - @RequestMapping(value = "/chart/user/buy", method = RequestMethod.GET) - public CommonResult> chartUserBuy() { - return CommonResult.success(homeService.chartUserBuy()); +// @PreAuthorize("hasAuthority('admin:home:delete')") + @ApiOperation(value = "删除") + @RequestMapping(value = "/delete", method = RequestMethod.GET) + public CommonResult delete(@RequestParam(value = "id") Integer id) { + if (homeService.deleteById(id)) { + return CommonResult.success(); + } else { + return CommonResult.failed(); + } } - /** - * 30天订单量趋势 - */ - @PreAuthorize("hasAuthority('admin:statistics:home:chart:order')") - @ApiOperation(value = "30天订单量趋势") - @RequestMapping(value = "/chart/order", method = RequestMethod.GET) - public CommonResult> chartOrder() { - return CommonResult.success(homeService.chartOrder()); +// @PreAuthorize("hasAuthority('admin:home:update')") + @ApiOperation(value = "修改") + @RequestMapping(value = "/update", method = RequestMethod.POST) + public CommonResult update(@RequestParam Integer id, @RequestBody @Validated HomeRequest request) { + Home upd = new Home(); + BeanUtils.copyProperties(request, upd); + upd.setId(id); + if (homeService.updateById(upd)) { + return CommonResult.success(); + } else { + return CommonResult.failed(); + } } - /** - * 周订单量趋势 - */ - @PreAuthorize("hasAuthority('admin:statistics:home:chart:order:week')") - @ApiOperation(value = "周订单量趋势") - @RequestMapping(value = "/chart/order/week", method = RequestMethod.GET) - public CommonResult> chartOrderInWeek() { - return CommonResult.success(homeService.chartOrderInWeek()); - } - - /** - * 月订单量趋势 - */ - @PreAuthorize("hasAuthority('admin:statistics:home:chart:order:month')") - @ApiOperation(value = "月订单量趋势") - @RequestMapping(value = "/chart/order/month", method = RequestMethod.GET) - public CommonResult> chartOrderInMonth() { - return CommonResult.success(homeService.chartOrderInMonth()); - } - - /** - * 年订单量趋势 - */ - @PreAuthorize("hasAuthority('admin:statistics:home:chart:order:year')") - @ApiOperation(value = "年订单量趋势") - @RequestMapping(value = "/chart/order/year", method = RequestMethod.GET) - public CommonResult> chartOrderInYear() { - return CommonResult.success(homeService.chartOrderInYear()); - } + @PreAuthorize("hasAuthority('admin:home:info')") + @ApiOperation(value = "详情") + @RequestMapping(value = "/info", method = RequestMethod.GET) + public CommonResult info(@RequestParam(value = "id") Integer id) { + Home home = homeService.getById(id); + HomeVo homeVo = new HomeVo(); + BeanUtils.copyProperties(home, homeVo); + return CommonResult.success(homeVo); + } } diff --git a/food-admin/src/main/java/com/zbkj/admin/controller/HomeItemController.java b/food-admin/src/main/java/com/zbkj/admin/controller/HomeItemController.java new file mode 100644 index 0000000..a82c5a4 --- /dev/null +++ b/food-admin/src/main/java/com/zbkj/admin/controller/HomeItemController.java @@ -0,0 +1,90 @@ +package com.zbkj.admin.controller; + +import com.zbkj.common.model.home.HomeItem; +import com.zbkj.common.page.CommonPage; +import com.zbkj.common.request.HomeItemRequest; +import com.zbkj.common.request.PageParamRequest; +import com.zbkj.common.response.CommonResult; +import com.zbkj.common.vo.HomeItemVo; +import com.zbkj.service.service.EbHomeItemService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +@Slf4j +@RestController +@RequestMapping("api/admin/floorItem/") +@Api(tags = "楼层商品") +public class HomeItemController { + + @Autowired + private EbHomeItemService homeItemService; + +// @PreAuthorize("hasAuthority('admin:home:list')") + @ApiOperation(value = "分页列表") + @RequestMapping(value = "/list", method = RequestMethod.GET) + public CommonResult> getList(@Validated HomeItemRequest request, @Validated PageParamRequest pageParamRequest) { + return CommonResult.success(CommonPage.restPage(homeItemService.getAdminList(request, pageParamRequest))); + } + +// @PreAuthorize("hasAuthority('admin:home:save')") + @ApiOperation(value = "新增") + @RequestMapping(value = "/save", method = RequestMethod.POST) + public CommonResult save(@RequestBody @Validated HomeItemRequest request) { + HomeItem add = new HomeItem(); + BeanUtils.copyProperties(request, add); + if (homeItemService.save(add)) { + return CommonResult.success(); + } else { + return CommonResult.failed(); + } + } + +// @PreAuthorize("hasAuthority('admin:home:delete')") + @ApiOperation(value = "删除") + @RequestMapping(value = "/delete", method = RequestMethod.GET) + public CommonResult delete(@RequestParam(value = "ids") String ids) { + List idList = Arrays.stream(ids.split(",")).map(Integer::parseInt).collect(Collectors.toList()); + if (homeItemService.removeByIds(idList)) { + return CommonResult.success(); + } else { + return CommonResult.failed(); + } + } + +// @PreAuthorize("hasAuthority('admin:home:update')") + @ApiOperation(value = "修改") + @RequestMapping(value = "/update", method = RequestMethod.POST) + public CommonResult update(@RequestParam Integer id, @RequestBody @Validated HomeItemRequest request) { + HomeItem upd = new HomeItem(); + BeanUtils.copyProperties(request, upd); + upd.setId(id); + if (homeItemService.updateById(upd)) { + return CommonResult.success(); + } else { + return CommonResult.failed(); + } + } + + @PreAuthorize("hasAuthority('admin:home:info')") + @ApiOperation(value = "详情") + @RequestMapping(value = "/info", method = RequestMethod.GET) + public CommonResult info(@RequestParam(value = "id") Integer id) { + HomeItem homeItem = homeItemService.getById(id); + HomeItemVo homeItemVo = new HomeItemVo(); + BeanUtils.copyProperties(homeItem, homeItemVo); + return CommonResult.success(homeItemVo); + } +} + + + diff --git a/food-admin/src/main/java/com/zbkj/admin/controller/SystemHelpController.java b/food-admin/src/main/java/com/zbkj/admin/controller/SystemHelpController.java index b7c276a..7ab7717 100644 --- a/food-admin/src/main/java/com/zbkj/admin/controller/SystemHelpController.java +++ b/food-admin/src/main/java/com/zbkj/admin/controller/SystemHelpController.java @@ -14,7 +14,9 @@ import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; @Slf4j @RestController @@ -67,11 +69,11 @@ public class SystemHelpController { @RequestMapping(value = "/delete", method = RequestMethod.POST) @PreAuthorize("hasAuthority('admin:helpProblem:delete')") - public CommonResult delete(@RequestBody Integer[] ids) { - System.out.println("111"); -// if (helpService.removeByIds(Arrays.asList(ids))) { + public CommonResult delete(@RequestParam(value = "ids") String ids) { + List idList = Arrays.stream(ids.split(",")).map(Integer::parseInt).collect(Collectors.toList()); + if (helpService.removeByIds(idList)) { return CommonResult.success(); -// } -// return CommonResult.failed(); + } + return CommonResult.failed(); } } diff --git a/food-admin/src/main/java/com/zbkj/admin/filter/ResponseRouter.java b/food-admin/src/main/java/com/zbkj/admin/filter/ResponseRouter.java index a8efa6b..9e7f74d 100644 --- a/food-admin/src/main/java/com/zbkj/admin/filter/ResponseRouter.java +++ b/food-admin/src/main/java/com/zbkj/admin/filter/ResponseRouter.java @@ -22,11 +22,11 @@ public class ResponseRouter { //根据需要处理返回值 if (data.contains(Constants.UPLOAD_TYPE_IMAGE+"/") && !data.contains("data:image/png;base64")) { - data = SpringUtil.getBean(SystemAttachmentService.class).prefixImage(data); + return SpringUtil.getBean(SystemAttachmentService.class).prefixImage(data); } if (data.contains("file/")) { - data = SpringUtil.getBean(SystemAttachmentService.class).prefixFile(data); + return SpringUtil.getBean(SystemAttachmentService.class).prefixFile(data); } return data; diff --git a/food-common/pom.xml b/food-common/pom.xml index e19692b..1dc1266 100644 --- a/food-common/pom.xml +++ b/food-common/pom.xml @@ -214,13 +214,32 @@ + + + + + + + + + + + org.apache.poi poi + 3.14 + compile org.apache.poi poi-ooxml + 3.14 + + + org.apache.poi + poi-ooxml-schemas + 3.14 diff --git a/food-common/src/main/java/com/zbkj/common/annotation/Excel.java b/food-common/src/main/java/com/zbkj/common/annotation/Excel.java new file mode 100644 index 0000000..db06383 --- /dev/null +++ b/food-common/src/main/java/com/zbkj/common/annotation/Excel.java @@ -0,0 +1,96 @@ +package com.zbkj.common.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface Excel { + /** + *导出时,对应数据库的字段 主要是用户区分每个字段, + *不能有annocation重名的 + *导出时的列名 导出排序跟定义了annotation的字段的顺序有关 + *可以使用a_id,b_id来确实是否使用 + */ + public String exportName(); + + /** + * 导出时在excel中每个列的宽 单位为字符,一个汉字=2个字符 + *如 以列名列内容中较合适的长度 例如姓名列6 【姓名一般三个字】 性别列4【男女占1,但是列标题两个汉字】 + *限制1-255 + */ + public int exportFieldWidth() default 10; + /** + * 导出时在excel中每个列的高度 单位为字符,一个汉字=2个字符 + */ + public int exportFieldHeight() default 10; + + /** + * 若是sign为1,则需要在pojo中加入一个方法 convertGet字段名() + * 例如,字段sex ,需要加入 public String convertGet字段名() 返回值为string + * 若是sign为0,则不转换 建议使用 @Transient 这个注解让hibernate忽略这个方法 + */ + public int exportConvertSign() default 0; + + /** + * 导入数据是否需要转化 及 对已有的excel,是否需要将字段转为对应的数据 + * 若是sign为1,则需要在pojo中加入 void convertSet字段名(String text) + */ + public int importConvertSign() default 0; + /** + * 导入导出是否都需要转化,同事设置exportConvertSign和importConvertSign + */ + public int imExConvert() default 0; + + /** + * 导出类型 1 是文本 2 是图片,3是函数 默认是文本 + */ + public int exportType() default 1; + /** + * 导出类型 1 从file读取 2 是从数据库中读取 默认是文件 + * 同样导入也是一样的 + */ + public int imageType() default 1; + /** + * 导入路径,如果是图片可以填写,默认是upload/className/ + * IconEntity这个类对应的就是upload/Icon/ + * + */ + public String savePath() default "upload"; + /** + * 展示到第几个 + */ + public String orderNum() default "0"; + /** + * 是否换行 即支持\n + */ + public boolean isWrap() default true; + /** + * 是否需要纵向合并单元格(用于含有list中,单个的单元格,合并list创建的多个row) + */ + public boolean needMerge() default false; + + /** + * 导出时间设置,如果字段是Date类型则不需要设置 + * 数据库如果是string 类型,这个需要设置这个数据库格式 + */ + public String databaseFormat() default "yyyyMMddHHmmss"; + /** + * 导出的时间格式,以这个是否为空来判断是否需要格式化日期 + */ + public String exportFormat() default ""; + /** + * 导入的时间格式,以这个是否为空来判断是否需要格式化日期 + */ + public String importFormat() default ""; + /** + *时间格式,相当于同时设置了exportFormat 和 importFormat + */ + public String imExFormat() default ""; + /** + * cell 写入的设置的函数 + */ + public String cellFormula() default ""; +} diff --git a/food-common/src/main/java/com/zbkj/common/constants/Constants.java b/food-common/src/main/java/com/zbkj/common/constants/Constants.java index d0937d0..d41499a 100644 --- a/food-common/src/main/java/com/zbkj/common/constants/Constants.java +++ b/food-common/src/main/java/com/zbkj/common/constants/Constants.java @@ -149,6 +149,7 @@ public class Constants { public static final String CONFIG_KEY_API_URL = "api_url"; //admin接口地址 public static final String CONFIG_KEY_FRONT_API_URL = "front_api_url"; //移动商城接口地址 public static final String CONFIG_KEY_SITE_LOGO = "mobile_top_logo"; //logo地址 + public static final String WISHES_IMAGE = "wishes_image"; //随心配顶部图 public static final String CONFIG_KEY_SITE_LONGITUDE = "venue-reservation-longitude"; //场地预约-经度 public static final String CONFIG_KEY_SITE_LATITUDE = "venue-reservation-latitude"; //场地预约-纬度 public static final String CONFIG_KEY_MOBILE_LOGIN_LOGO = "mobile_login_logo"; // 移动端登录 logo diff --git a/food-common/src/main/java/com/zbkj/common/model/product/StoreProduct.java b/food-common/src/main/java/com/zbkj/common/model/product/StoreProduct.java index f5d1e7a..529b342 100644 --- a/food-common/src/main/java/com/zbkj/common/model/product/StoreProduct.java +++ b/food-common/src/main/java/com/zbkj/common/model/product/StoreProduct.java @@ -163,5 +163,6 @@ public class StoreProduct implements Serializable { private String content; @ApiModelProperty(value = "标签") - private String tags; + private String tags = ""; + } diff --git a/food-common/src/main/java/com/zbkj/common/model/product/StoreProductAttr.java b/food-common/src/main/java/com/zbkj/common/model/product/StoreProductAttr.java index c4d05b6..854e0de 100644 --- a/food-common/src/main/java/com/zbkj/common/model/product/StoreProductAttr.java +++ b/food-common/src/main/java/com/zbkj/common/model/product/StoreProductAttr.java @@ -1,9 +1,12 @@ package com.zbkj.common.model.product; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import java.io.Serializable; +import java.util.List; + import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -36,6 +39,10 @@ public class StoreProductAttr implements Serializable { @ApiModelProperty(value = "属性值") private String attrValues; + @TableField(exist = false) + @ApiModelProperty(value = "属性值") + private List attrValueList; + @ApiModelProperty(value = "活动类型 0=商品,1=秒杀,2=砍价,3=拼团") private Integer type; diff --git a/food-common/src/main/java/com/zbkj/common/model/product/StoreProductProblem.java b/food-common/src/main/java/com/zbkj/common/model/product/StoreProductProblem.java index 0944878..48ddd93 100644 --- a/food-common/src/main/java/com/zbkj/common/model/product/StoreProductProblem.java +++ b/food-common/src/main/java/com/zbkj/common/model/product/StoreProductProblem.java @@ -1,6 +1,7 @@ package com.zbkj.common.model.product; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; @@ -8,6 +9,7 @@ import java.io.Serializable; import java.util.Date; import lombok.Data; +import org.springframework.data.annotation.Transient; @Data @TableName("eb_store_product_problem") @@ -58,6 +60,8 @@ public class StoreProductProblem implements Serializable { /** * 点赞数 */ + @Transient + @TableField(exist = false) private Integer praiseNum; } diff --git a/food-common/src/main/java/com/zbkj/common/model/product/StoreProductRelation.java b/food-common/src/main/java/com/zbkj/common/model/product/StoreProductRelation.java index 26e29a9..3e6213e 100644 --- a/food-common/src/main/java/com/zbkj/common/model/product/StoreProductRelation.java +++ b/food-common/src/main/java/com/zbkj/common/model/product/StoreProductRelation.java @@ -1,6 +1,7 @@ package com.zbkj.common.model.product; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; @@ -8,6 +9,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; +import org.springframework.data.annotation.Transient; import java.io.Serializable; import java.util.Date; @@ -46,5 +48,9 @@ public class StoreProductRelation implements Serializable { @ApiModelProperty(value = "创建时间") private Date createTime; + @Transient + @TableField(exist = false) + private Integer count; + } diff --git a/food-common/src/main/java/com/zbkj/common/model/system/SystemHelpProblem.java b/food-common/src/main/java/com/zbkj/common/model/system/SystemHelpProblem.java index 6c07043..96fb2ef 100644 --- a/food-common/src/main/java/com/zbkj/common/model/system/SystemHelpProblem.java +++ b/food-common/src/main/java/com/zbkj/common/model/system/SystemHelpProblem.java @@ -31,7 +31,7 @@ public class SystemHelpProblem implements Serializable { private Integer id; @ApiModelProperty(value = "分类id") - private String cid; + private Integer cid; @Transient @TableField(exist = false) diff --git a/food-common/src/main/java/com/zbkj/common/request/GetReplyListRequest.java b/food-common/src/main/java/com/zbkj/common/request/GetReplyListRequest.java index 7a041c4..8921ab6 100644 --- a/food-common/src/main/java/com/zbkj/common/request/GetReplyListRequest.java +++ b/food-common/src/main/java/com/zbkj/common/request/GetReplyListRequest.java @@ -21,8 +21,8 @@ public class GetReplyListRequest implements Serializable { @NotNull(message = "产品id不能为空") private Integer productId; - @ApiModelProperty(value = "评价等级|0=全部,1=好评,2=中评,3=差评") - private Integer type; +// @ApiModelProperty(value = "评价等级|0=全部,1=好评,2=中评,3=差评") +// private Integer type; @ApiModelProperty(value = "评论标签名称") private String tag; diff --git a/food-common/src/main/java/com/zbkj/common/request/HomeItemRequest.java b/food-common/src/main/java/com/zbkj/common/request/HomeItemRequest.java new file mode 100644 index 0000000..4e9da7e --- /dev/null +++ b/food-common/src/main/java/com/zbkj/common/request/HomeItemRequest.java @@ -0,0 +1,52 @@ +package com.zbkj.common.request; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="HomeItemRequest对象", description="HomeItemRequest对象") +public class HomeItemRequest implements Serializable { + + private static final long serialVersionUID=1L; + + @ApiModelProperty(value = "编号") + private Integer id; + + @ApiModelProperty(value = "楼层编号") + private Integer homeId; + + @ApiModelProperty(value = "名称") + private String name; + + @ApiModelProperty(value = "标题") + private String title; + + @ApiModelProperty(value = "图片") + private String imgUrl; + + @ApiModelProperty(value = "跳转类型 0默认值,1商品详情,2分类列表,3商品列表,4活动栏目") + private Integer jumpType; + + @ApiModelProperty(value = "类型 0商品,1轮播图") + private Integer type; + + @ApiModelProperty(value = "跳转路径") + private String jumpUrl; + + @ApiModelProperty(value = "跳转参数(pId,cIds,pIds,hId)") + private String jumpIds; + + @ApiModelProperty(value = "展示渠道:【1首页楼层,2随心配套餐层,3首页精品推荐】") + private String channel; + + @ApiModelProperty(value = "排序") + private Integer orderNo; + +} diff --git a/food-common/src/main/java/com/zbkj/common/request/HomeRequest.java b/food-common/src/main/java/com/zbkj/common/request/HomeRequest.java new file mode 100644 index 0000000..9a5d505 --- /dev/null +++ b/food-common/src/main/java/com/zbkj/common/request/HomeRequest.java @@ -0,0 +1,68 @@ +package com.zbkj.common.request; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.zbkj.common.vo.HomeItemVo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.springframework.data.annotation.Transient; +import org.springframework.format.annotation.DateTimeFormat; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="HomeRequest对象", description="HomeRequest对象") +public class HomeRequest implements Serializable { + + private static final long serialVersionUID=1L; + + @ApiModelProperty(value = "名称") + private String name; + + @ApiModelProperty(value = "标题") + private String title; + + @ApiModelProperty(value = "图片") + private String imgUrl; + + @ApiModelProperty(value = "跳转类型 0默认值,1商品详情,2分类列表,3商品列表,4活动栏目") + private Integer jumpType; + + @ApiModelProperty(value = "跳转路径") + private String jumpUrl; + + @ApiModelProperty(value = "跳转参数(pId,cIds,pIds,hId)") + private String jumpIds; + + @ApiModelProperty(value = "展示渠道:【1首页楼层,2随心配套餐层,3首页精品推荐】") + private String channel; + + @ApiModelProperty(value = "业务:channel=2分类id") + private Integer business; + + @ApiModelProperty(value = "排序") + private Integer orderNo; + + @ApiModelProperty(value = "开始时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date beginTime; + + @ApiModelProperty(value = "结束时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date endTime; + + @Transient + @TableField(exist = false) + private List items; + +} diff --git a/food-common/src/main/java/com/zbkj/common/request/StoreProductAddRequest.java b/food-common/src/main/java/com/zbkj/common/request/StoreProductAddRequest.java index 4668ca9..833e441 100644 --- a/food-common/src/main/java/com/zbkj/common/request/StoreProductAddRequest.java +++ b/food-common/src/main/java/com/zbkj/common/request/StoreProductAddRequest.java @@ -1,6 +1,7 @@ package com.zbkj.common.request; import com.baomidou.mybatisplus.annotation.TableName; +import com.zbkj.common.annotation.Excel; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -30,44 +31,53 @@ public class StoreProductAddRequest implements Serializable { @ApiModelProperty(value = "商品id|添加时不填,修改时必填") private Integer id; + @Excel(exportName = "商品图片") @ApiModelProperty(value = "商品图片", required = true) @NotBlank(message = "商品图片不能为空") @Length(max = 255, message = "商品图片名称长度不能超过255个字符") private String image; + @Excel(exportName = "轮播图") @ApiModelProperty(value = "轮播图", required = true) @NotBlank(message = "轮播图不能为空") @Length(max = 2000, message = "轮播图名称长度不能超过2000个字符") private String sliderImage; + @Excel(exportName = "商品名称") @ApiModelProperty(value = "商品名称", required = true) @NotBlank(message = "商品名称不能为空") @Length(max = 128, message = "商品名称长度不能超过128个字符") private String storeName; + @Excel(exportName = "商品简介") @ApiModelProperty(value = "商品简介", required = true) @NotBlank(message = "商品简介不能为空") @Length(max = 256, message = "商品简介长度不能超过256个字符") private String storeInfo; + @Excel(exportName = "关键字") @ApiModelProperty(value = "关键字", required = true) @Length(max = 255, message = "关键字长度不能超过255个字符") @NotBlank(message = "关键字不能为空") private String keyword; + @Excel(exportName = "分类") @ApiModelProperty(value = "分类id|逗号分隔", required = true) @NotBlank(message = "商品分类不能为空") @Length(max = 64, message = "商品分类组合长度不能超过64个字符") private String cateId; + @Excel(exportName = "单位名") @ApiModelProperty(value = "单位名", required = true) @NotBlank(message = "单位名称不能为空") @Length(max = 32, message = "单位名长度不能超过32个字符") private String unitName; + @Excel(exportName = "排序") @ApiModelProperty(value = "排序") private Integer sort; + @Excel(exportName = "是否热卖") @ApiModelProperty(value = "是否热卖") private Boolean isHot; @@ -80,6 +90,7 @@ public class StoreProductAddRequest implements Serializable { @ApiModelProperty(value = "是否新品") private Boolean isNew; + @Excel(exportName = "是否优品推荐") @ApiModelProperty(value = "是否优品推荐") private Boolean isGood; @@ -89,13 +100,16 @@ public class StoreProductAddRequest implements Serializable { @ApiModelProperty(value = "是否单独分佣") private Boolean isSub; + @Excel(exportName = "虚拟销量") @ApiModelProperty(value = "虚拟销量") private Integer ficti; + @Excel(exportName = "配送模板") @ApiModelProperty(value = "配送模板ID", required = true) @NotNull(message = "配送模板不能为空") private Integer tempId; + @Excel(exportName = "规格") @ApiModelProperty(value = "规格 0单 1多", required = true) @NotNull(message = "商品规格类型不能为空") private Boolean specType; @@ -103,27 +117,33 @@ public class StoreProductAddRequest implements Serializable { @ApiModelProperty(value = "活动显示排序 0=默认,1=秒杀,2=砍价,3=拼团") private List activity; + @Excel(exportName = "商品属性") @ApiModelProperty(value = "商品属性", required = true) @NotEmpty(message = "商品属性不能为空") private List attr; + @Excel(exportName = "商品属性详情") @ApiModelProperty(value = "商品属性详情", required = true) @NotEmpty(message = "商品属性详情不能为空") private List attrValue; + @Excel(exportName = "商品描述") @ApiModelProperty(value = "商品描述") private String content; + @Excel(exportName = "质检报告") @ApiModelProperty(value = "质检报告") private String qualityTest; @ApiModelProperty(value = "优惠券id集合") private List couponIds; + @Excel(exportName = "展示图") @ApiModelProperty(value = "展示图") @Length(max = 1000, message = "展示图名称长度不能超过1000个字符") private String flatPattern; + @Excel(exportName = "标签") @ApiModelProperty(value = "标签") private String tags; diff --git a/food-common/src/main/java/com/zbkj/common/request/SystemHelpRequest.java b/food-common/src/main/java/com/zbkj/common/request/SystemHelpRequest.java index c6922d5..1e24919 100644 --- a/food-common/src/main/java/com/zbkj/common/request/SystemHelpRequest.java +++ b/food-common/src/main/java/com/zbkj/common/request/SystemHelpRequest.java @@ -20,7 +20,7 @@ public class SystemHelpRequest implements Serializable { private Integer id; @ApiModelProperty(value = "分类id") - private String cid; + private Integer cid; @ApiModelProperty(value = "内容") private String content; diff --git a/food-common/src/main/java/com/zbkj/common/request/UserAddressRequest.java b/food-common/src/main/java/com/zbkj/common/request/UserAddressRequest.java index 4f596ac..47e5a2f 100644 --- a/food-common/src/main/java/com/zbkj/common/request/UserAddressRequest.java +++ b/food-common/src/main/java/com/zbkj/common/request/UserAddressRequest.java @@ -43,6 +43,12 @@ public class UserAddressRequest implements Serializable { @Length(max = 256, message = "收货人详细地址不能超过32个字符") private String detail; + @ApiModelProperty(value = "经度") + private String longitude; + + @ApiModelProperty(value = "纬度") + private String latitude; + @ApiModelProperty(value = "是否默认", example = "false", required = true) private Boolean isDefault; diff --git a/food-common/src/main/java/com/zbkj/common/response/IndexInfoResponse.java b/food-common/src/main/java/com/zbkj/common/response/IndexInfoResponse.java index 32b9c03..e8d3ecc 100644 --- a/food-common/src/main/java/com/zbkj/common/response/IndexInfoResponse.java +++ b/food-common/src/main/java/com/zbkj/common/response/IndexInfoResponse.java @@ -28,6 +28,9 @@ public class IndexInfoResponse implements Serializable { @ApiModelProperty(value = "企业logo") private String logoUrl; + @ApiModelProperty(value = "随心配顶部图") + private String wishesImage; + @ApiModelProperty(value = "客服电话") private String consumerHotline; diff --git a/food-common/src/main/java/com/zbkj/common/response/IndexProductResponse.java b/food-common/src/main/java/com/zbkj/common/response/IndexProductResponse.java index caf5e12..52517af 100644 --- a/food-common/src/main/java/com/zbkj/common/response/IndexProductResponse.java +++ b/food-common/src/main/java/com/zbkj/common/response/IndexProductResponse.java @@ -1,9 +1,6 @@ package com.zbkj.common.response; -import com.zbkj.common.vo.HomeItemVo; import com.zbkj.common.vo.HomeVo; -import com.zbkj.common.vo.product.ProductAttrVo; -import com.zbkj.common.vo.product.ProductInfoVo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -12,7 +9,6 @@ import lombok.experimental.Accessors; import java.math.BigDecimal; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; /** @@ -58,31 +54,25 @@ public class IndexProductResponse { @ApiModelProperty(value = "单位名") private String unitName; - @ApiModelProperty(value = "活动显示排序0=默认,1=秒杀,2=砍价,3=拼团") - private String activity; - - @ApiModelProperty(value = "为移动端特定参数") - private ProductActivityItemResponse activityH5; +// @ApiModelProperty(value = "活动显示排序0=默认,1=秒杀,2=砍价,3=拼团") +// private String activity; +// +// @ApiModelProperty(value = "为移动端特定参数") +// private ProductActivityItemResponse activityH5; @ApiModelProperty(value = "购物车商品数量") - private Integer cartNum; + private Integer cartNum = 0; @ApiModelProperty(value = "库存") private Integer stock; - @ApiModelProperty(value = "展示图") - private String flatPattern; - @ApiModelProperty(value = "标签") private String tags = ""; + @ApiModelProperty(value = "标签数组") + private List tagList = new ArrayList<>(); + @ApiModelProperty(value = "规格 false单 true多") private Boolean specType; - @ApiModelProperty(value = "产品属性") - private List productAttr; - - @ApiModelProperty(value = "商品属性详情") - private HashMap productValue; - } diff --git a/food-common/src/main/java/com/zbkj/common/response/ProductDetailReplyResponse.java b/food-common/src/main/java/com/zbkj/common/response/ProductDetailReplyResponse.java index c8ff565..58fe821 100644 --- a/food-common/src/main/java/com/zbkj/common/response/ProductDetailReplyResponse.java +++ b/food-common/src/main/java/com/zbkj/common/response/ProductDetailReplyResponse.java @@ -21,16 +21,16 @@ public class ProductDetailReplyResponse implements Serializable { private static final long serialVersionUID = 8822745472328151094L; @ApiModelProperty(value = "评论总数") - private Integer sumCount; + private Integer sumCount = 0; @ApiModelProperty(value = "好评率") - private String replyChance; + private String replyChance = "0"; @ApiModelProperty(value = "一条评论信息") private ProductReplyResponse productReply; @ApiModelProperty(value = "问题数量") - private Integer problemNum; + private Integer problemNum = 0; @ApiModelProperty(value = "一条常见问题") private ProductProblemResponse productProblem; diff --git a/food-common/src/main/java/com/zbkj/common/response/ProductDetailResponse.java b/food-common/src/main/java/com/zbkj/common/response/ProductDetailResponse.java index 8bdcbaa..c5bf8af 100644 --- a/food-common/src/main/java/com/zbkj/common/response/ProductDetailResponse.java +++ b/food-common/src/main/java/com/zbkj/common/response/ProductDetailResponse.java @@ -1,44 +1,43 @@ -package com.zbkj.common.response; - -import com.zbkj.common.model.product.StoreProduct; -import com.zbkj.common.model.product.StoreProductAttr; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; - -/** - * 商品详情 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Accessors(chain = true) -@ApiModel(value="ProductDetailResponse对象", description="商品详情H5") -public class ProductDetailResponse implements Serializable { - - private static final long serialVersionUID=1L; - - @ApiModelProperty(value = "产品属性") - private List productAttr; - - @ApiModelProperty(value = "商品属性详情") - private HashMap productValue; - -// @ApiModelProperty(value = "返佣金额区间") -// private String priceName; - -// @ApiModelProperty(value = "为移动端特定参数 所有参与的活动") -// private List activityAllH5; - - @ApiModelProperty(value = "商品信息") - private StoreProductResponse productInfo; - - @ApiModelProperty(value = "收藏标识") - private Boolean userCollect; - -} +//package com.zbkj.common.response; +// +//import com.zbkj.common.model.product.StoreProductAttr; +//import io.swagger.annotations.ApiModel; +//import io.swagger.annotations.ApiModelProperty; +//import lombok.Data; +//import lombok.EqualsAndHashCode; +//import lombok.experimental.Accessors; +// +//import java.io.Serializable; +//import java.util.HashMap; +//import java.util.List; +// +///** +// * 商品详情 +// */ +//@Data +//@EqualsAndHashCode(callSuper = false) +//@Accessors(chain = true) +//@ApiModel(value="ProductDetailResponse对象", description="商品详情H5") +//public class ProductDetailResponse implements Serializable { +// +// private static final long serialVersionUID=1L; +// +// @ApiModelProperty(value = "产品属性") +// private List productAttr; +// +// @ApiModelProperty(value = "商品属性详情") +// private HashMap productValue; +// +//// @ApiModelProperty(value = "返佣金额区间") +//// private String priceName; +// +//// @ApiModelProperty(value = "为移动端特定参数 所有参与的活动") +//// private List activityAllH5; +// +// @ApiModelProperty(value = "商品信息") +// private StoreProductResponse productInfo; +// +// @ApiModelProperty(value = "收藏标识") +// private Boolean userCollect; +// +//} diff --git a/food-common/src/main/java/com/zbkj/common/response/ProductProblemResponse.java b/food-common/src/main/java/com/zbkj/common/response/ProductProblemResponse.java index 92e3ef7..878d315 100644 --- a/food-common/src/main/java/com/zbkj/common/response/ProductProblemResponse.java +++ b/food-common/src/main/java/com/zbkj/common/response/ProductProblemResponse.java @@ -22,6 +22,12 @@ public class ProductProblemResponse { @ApiModelProperty(value = "用户编号:不返回") private String userId; + @ApiModelProperty(value = "问题") + private String title; + + @ApiModelProperty(value = "内容") + private String content; + @ApiModelProperty(value = "用户昵称") private String nickName; @@ -31,9 +37,6 @@ public class ProductProblemResponse { @ApiModelProperty(value = "时间") private String createTime; - @ApiModelProperty(value = "内容") - private String content; - @ApiModelProperty(value = "子评论数量") private Integer sonNum = 0; diff --git a/food-common/src/main/java/com/zbkj/common/response/ProductReplyResponse.java b/food-common/src/main/java/com/zbkj/common/response/ProductReplyResponse.java index 9ae656a..f104cf6 100644 --- a/food-common/src/main/java/com/zbkj/common/response/ProductReplyResponse.java +++ b/food-common/src/main/java/com/zbkj/common/response/ProductReplyResponse.java @@ -23,10 +23,10 @@ public class ProductReplyResponse { @ApiModelProperty(value = "评论ID") private Integer id; - @ApiModelProperty(value = "用户ID") - private Integer uid; +// @ApiModelProperty(value = "用户ID") +// private Integer uid; - @ApiModelProperty(value = "商品分数") + @ApiModelProperty(value = "商品星数 好评>=4,中评>2 && <4 ,差评<=2") private Integer score; @ApiModelProperty(value = "评论内容") diff --git a/food-common/src/main/java/com/zbkj/common/response/StoreProductResponse.java b/food-common/src/main/java/com/zbkj/common/response/StoreProductResponse.java index 72faa25..443c91e 100644 --- a/food-common/src/main/java/com/zbkj/common/response/StoreProductResponse.java +++ b/food-common/src/main/java/com/zbkj/common/response/StoreProductResponse.java @@ -2,7 +2,6 @@ package com.zbkj.common.response; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; import com.zbkj.common.model.coupon.StoreCoupon; import com.zbkj.common.model.product.StoreProductAttr; import io.swagger.annotations.ApiModel; @@ -13,7 +12,7 @@ import lombok.experimental.Accessors; import java.io.Serializable; import java.math.BigDecimal; -import java.util.Date; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -41,7 +40,10 @@ public class StoreProductResponse implements Serializable { private String image; @ApiModelProperty(value = "轮播图") - private String sliderImage; + private String sliderImage = ""; + + @ApiModelProperty(value = "轮播图") + private List sliderImages = new ArrayList<>(); @ApiModelProperty(value = "商品名称") private String storeName; @@ -76,8 +78,8 @@ public class StoreProductResponse implements Serializable { @ApiModelProperty(value = "单位名") private String unitName; -// @ApiModelProperty(value = "排序") -// private Integer sort; + @ApiModelProperty(value = "排序") + private Integer sort; @ApiModelProperty(value = "销量") private Integer sales; @@ -100,8 +102,8 @@ public class StoreProductResponse implements Serializable { // @ApiModelProperty(value = "是否新品") // private Boolean isNew; // -// @ApiModelProperty(value = "添加时间") -// private Integer addTime; + @ApiModelProperty(value = "添加时间") + private Integer addTime; // // @ApiModelProperty(value = "是否包邮") // private Boolean isPostage; @@ -115,8 +117,8 @@ public class StoreProductResponse implements Serializable { // @ApiModelProperty(value = "获得积分") // private Integer giveIntegral; // -// @ApiModelProperty(value = "成本价") -// private BigDecimal cost; + @ApiModelProperty(value = "成本价") + private BigDecimal cost; // // @ApiModelProperty(value = "秒杀状态 0 未开启 1已开启") // private Boolean isSeckill; @@ -151,8 +153,8 @@ public class StoreProductResponse implements Serializable { @ApiModelProperty(value = "规格 0单 1多") private Boolean specType; - @ApiModelProperty(value = "活动显示排序 0=默认,1=秒杀,2=砍价,3=拼团") - private String activity; +// @ApiModelProperty(value = "活动显示排序 0=默认,1=秒杀,2=砍价,3=拼团") +// private String activity; // @ApiModelProperty(value = "活动显示排序 0=默认,1=秒杀,2=砍价,3=拼团") // private String activityStr; @@ -163,22 +165,31 @@ public class StoreProductResponse implements Serializable { // @ApiModelProperty(value = "为移动端特定参数 所有参与的活动") // private List activityAllH5; - @ApiModelProperty(value = "商品属性") - private List attr; - +// @ApiModelProperty(value = "商品属性") +// private List attr; +// @ApiModelProperty(value = "商品属性详情") private List attrValue; + @ApiModelProperty(value = "产品属性") + private List productAttr; + + @ApiModelProperty(value = "商品属性详情") + private HashMap productValue; + + @ApiModelProperty(value = "收藏标识:true已收藏,false未收藏") + private Boolean userCollect; + // @ApiModelProperty(value = "管理端用于映射attrResults") // private List> attrValues; - private Integer[] cateIds; +// private Integer[] cateIds; @ApiModelProperty(value = "商品描述") private String content; @ApiModelProperty(value = "收藏数量") - private Integer collectCount; + private Integer collectCount = 0; @ApiModelProperty(value = "优惠券") private List coupons; diff --git a/food-common/src/main/java/com/zbkj/common/response/StoreProductSkuResponse.java b/food-common/src/main/java/com/zbkj/common/response/StoreProductSkuResponse.java new file mode 100644 index 0000000..bbf9433 --- /dev/null +++ b/food-common/src/main/java/com/zbkj/common/response/StoreProductSkuResponse.java @@ -0,0 +1,26 @@ +package com.zbkj.common.response; + +import com.zbkj.common.model.product.StoreProductAttr; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="StoreProductSkuResponse", description="StoreProductSkuResponse") +public class StoreProductSkuResponse implements Serializable { + + @ApiModelProperty(value = "产品属性") + private List productAttr; + + @ApiModelProperty(value = "商品属性详情") + private HashMap productValue; + +} diff --git a/food-common/src/main/java/com/zbkj/common/utils/excel/ExcelImportEntity.java b/food-common/src/main/java/com/zbkj/common/utils/excel/ExcelImportEntity.java new file mode 100644 index 0000000..702a4e0 --- /dev/null +++ b/food-common/src/main/java/com/zbkj/common/utils/excel/ExcelImportEntity.java @@ -0,0 +1,126 @@ +package com.zbkj.common.utils.excel; + +import java.lang.reflect.Method; +import java.util.List; +/** + * excel 导入工具类,对cell类型做映射 + */ +public class ExcelImportEntity { + /** + * 对应exportName + */ + private String name; + /** + * 对应exportType + */ + private int type; + /** + * 对应 Collection NAME + */ + private String collectionName; + /** + * 保存图片的地址 + */ + private String saveUrl; + /** + * 保存图片的类型,1是文件,2是数据库 + */ + private int saveType; + /** + * 对应exportType + */ + private String classType; + /** + * 导入日期格式 + */ + private String importFormat; + /** + * set 和convert 合并 + */ + private Method setMethod; + + private List setMethods; + + private List list; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + public Method getSetMethod() { + return setMethod; + } + + public void setSetMethod(Method setMethod) { + this.setMethod = setMethod; + } + + public List getSetMethods() { + return setMethods; + } + + public void setSetMethods(List setMethods) { + this.setMethods = setMethods; + } + + public String getSaveUrl() { + return saveUrl; + } + + public void setSaveUrl(String saveUrl) { + this.saveUrl = saveUrl; + } + + public String getClassType() { + return classType; + } + + public void setClassType(String classType) { + this.classType = classType; + } + + public String getCollectionName() { + return collectionName; + } + + public void setCollectionName(String collectionName) { + this.collectionName = collectionName; + } + + public int getSaveType() { + return saveType; + } + + public void setSaveType(int saveType) { + this.saveType = saveType; + } + + public String getImportFormat() { + return importFormat; + } + + public void setImportFormat(String importFormat) { + this.importFormat = importFormat; + } + +} \ No newline at end of file diff --git a/food-common/src/main/java/com/zbkj/common/utils/excel/ExcelImportUtil.java b/food-common/src/main/java/com/zbkj/common/utils/excel/ExcelImportUtil.java new file mode 100644 index 0000000..a634b45 --- /dev/null +++ b/food-common/src/main/java/com/zbkj/common/utils/excel/ExcelImportUtil.java @@ -0,0 +1,397 @@ +package com.zbkj.common.utils.excel; + +import com.alibaba.fastjson.JSON; +import com.zbkj.common.annotation.Excel; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.math.NumberUtils; +import org.apache.poi.POIXMLDocument; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.openxml4j.opc.OPCPackage; +import org.apache.poi.poifs.filesystem.POIFSFileSystem; +import org.apache.poi.ss.formula.functions.T; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import java.io.*; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Type; +import java.math.BigDecimal; +import java.text.NumberFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + + +public final class ExcelImportUtil { + + /** + * Excel 导入 字段类型 Integer,Long,Double,Date,String,Boolean,BigDecimal + */ + public static Collection importExcel(File file, Class pojoClass, ImportParams params) { + FileInputStream in = null; + Collection result = null; + try { + in = new FileInputStream(file); + result = importExcelByIs(in, pojoClass, params); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + in.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return result; + } + + /** + * Excel 导入 field 字段类型 Integer,Long,Double,Date,String,Boolean,BigDecimal + */ + public static Collection importExcelByIs(InputStream inputstream, + Class pojoClass, ImportParams params) throws Exception { + Collection result = new ArrayList(); + Workbook book = null; + if (!inputstream.markSupported()) { + inputstream = new BufferedInputStream(inputstream); + } + if (POIFSFileSystem.hasPOIFSHeader(inputstream)) { + book = new HSSFWorkbook(inputstream); + } else if (POIXMLDocument.hasOOXMLHeader(inputstream)) { + book = new XSSFWorkbook(OPCPackage.open(inputstream)); + } + for (int i = 0; i < params.getSheetNum(); i++) { + result.addAll(importExcel(result, book.getSheetAt(i), pojoClass, params)); + } + return result; + } + + + @SuppressWarnings({"rawtypes", "unchecked"}) + private static Collection importExcel(Collection result, Sheet sheet, + Class pojoClass, ImportParams params) throws Exception { + Collection collection = new ArrayList(); + Map excelParams = new HashMap(); + Field fileds[] = ExcelPublicUtil.getClassFields(pojoClass); + getAllExcelField(fileds, excelParams, pojoClass, null); + Iterator rows = sheet.rowIterator(); + for (int j = 0; j < params.getTitleRows(); j++) { + rows.next(); + } + Row row = null; + Iterator cellTitle; + Map titlemap = new HashMap(); + for (int j = 0; j < params.getSecondTitleRows(); j++) { + row = rows.next(); + cellTitle = row.cellIterator(); + int i = row.getFirstCellNum(); + while (cellTitle.hasNext()) { + Cell cell = cellTitle.next(); + String value = cell.getStringCellValue(); + if (!StringUtils.isEmpty(value)) { + titlemap.put(i, value); + } + i = i + 1; + } + } + Object object = null; + while (rows.hasNext()) { + row = rows.next(); + + object = ExcelPublicUtil.createObject(pojoClass); + for (int i = row.getFirstCellNum(); i < row.getLastCellNum(); i++) { + Cell cell = row.getCell(i); + String titleString = (String) titlemap.get(i); + if (excelParams.containsKey(titleString)) { + if (cell == null || ("").equals(cell.toString())) { + continue; + } + judgeTypeAndSetValue(object, cell, excelParams, titleString); + } + } + collection.add(object); + } + return collection; + } + + /** + * 设置值 + */ + private static void judgeTypeAndSetValue(Object object, Cell cell, + Map excelParams, String titleString) + throws Exception { + ExcelImportEntity entity = excelParams.get(titleString); + Method setMethod = entity.getSetMethods() != null && entity.getSetMethods().size() > 0 ? entity + .getSetMethods().get(entity.getSetMethods().size() - 1) + : entity.getSetMethod(); + Type[] ts = setMethod.getGenericParameterTypes(); + String xclass = ts[0].toString(); + if (xclass.equals("class java.lang.String")) { + cell.setCellType(Cell.CELL_TYPE_STRING); + String cellValue = cell.getStringCellValue(); + //NumberUtils.isCreatable()判断是否是数字类型 + if (NumberUtils.isCreatable(cellValue)) { + NumberFormat numberFormat = NumberFormat.getInstance(); + //如果在格式化和分析数字时使用千分隔符,则为true. + numberFormat.setGroupingUsed(false); + //x设置小数点保留位数,这里保留10位小数 + numberFormat.setMaximumFractionDigits(10); + //numberFormat.format()格式化小数 + cellValue = numberFormat.format(Double.valueOf(cellValue)); + } + setValues(entity, object, cellValue); + } else if (xclass.equals("class java.util.Date")) { + Date cellDate = null; + if (Cell.CELL_TYPE_NUMERIC == cell.getCellType()) { + // 日期格式 + cellDate = cell.getDateCellValue(); + setValues(entity, object, cellDate); + } else { + cell.setCellType(Cell.CELL_TYPE_STRING); + cellDate = getDateData(entity, cell.getStringCellValue()); + setValues(entity, object, cellDate); + } + } else if (xclass.equals("class java.lang.Boolean")) { + boolean valBool; + if (Cell.CELL_TYPE_BOOLEAN == cell.getCellType()) { + valBool = cell.getBooleanCellValue(); + } else { + valBool = cell.getStringCellValue().equalsIgnoreCase("true") + || (!cell.getStringCellValue().equals("0")); + } + setValues(entity, object, valBool); + } else if (xclass.equals("class java.lang.Integer")) { + Integer valInt; + if (Cell.CELL_TYPE_NUMERIC == cell.getCellType()) { + valInt = (new Double(cell.getNumericCellValue())).intValue(); + } else { + valInt = new Integer(cell.getStringCellValue()); + } + setValues(entity, object, valInt); + } else if (xclass.equals("class java.lang.Long")) { + Long valLong; + if (Cell.CELL_TYPE_NUMERIC == cell.getCellType()) { + valLong = (new Double(cell.getNumericCellValue())).longValue(); + } else { + valLong = new Long(cell.getStringCellValue()); + } + setValues(entity, object, valLong); + } else if (xclass.equals("class java.math.BigDecimal")) { + BigDecimal valDecimal; + if (Cell.CELL_TYPE_NUMERIC == cell.getCellType()) { + valDecimal = new BigDecimal(cell.getNumericCellValue()); + } else { + valDecimal = new BigDecimal(cell.getStringCellValue()); + } + setValues(entity, object, valDecimal); + } else if (xclass.equals("class java.lang.Double")) { + Double valDouble; + if (Cell.CELL_TYPE_NUMERIC == cell.getCellType()) { + valDouble = new Double(cell.getNumericCellValue()); + } else { + valDouble = new Double(cell.getStringCellValue()); + } + setValues(entity, object, valDouble); + } else if (xclass.contains("java.util.List")) { + int start = xclass.indexOf('<'); + int end = xclass.indexOf('>'); + Class clazz = Class.forName(xclass.substring(start + 1, end)); + Object instance = clazz.newInstance(); + List list = JSON.parseArray(cell.getStringCellValue(), instance.getClass()); + setValues(entity, object, list); + } + } + + /** + * 获取日期类型数据 + */ + private static Date getDateData(ExcelImportEntity entity, String value) { + if (StringUtils.isNotEmpty(entity.getImportFormat()) && + StringUtils.isNotEmpty(value)) { + SimpleDateFormat format = new SimpleDateFormat(entity.getImportFormat()); + try { + return format.parse(value); + } catch (ParseException e) { + } + } + return null; + } + + private static void setValues(ExcelImportEntity entity, Object object, + Object value) throws Exception { + if (entity.getSetMethods() != null) { + setFieldBySomeMethod(entity.getSetMethods(), object, value); + } else { + entity.getSetMethod().invoke(object, value); + } + } + + /** + * 多个get 最后再set + */ + private static void setFieldBySomeMethod(List setMethods, + Object object, Object value) throws Exception { + Object t = getFieldBySomeMethod(setMethods, object); + setMethods.get(setMethods.size() - 1).invoke(t, value); + } + + private static Object getFieldBySomeMethod(List list, Object t) + throws Exception { + Method m; + for (int i = 0; i < list.size() - 1; i++) { + m = list.get(i); + t = m.invoke(t, new Object[]{}); + } + return t; + } + + /** + * 获取需要的全部字段 + */ + private static void getAllExcelField(Field[] fields, + Map excelParams, Class pojoClass, + List getMethods) throws Exception { + ExcelImportEntity excelEntity = null; + for (int i = 0; i < fields.length; i++) { + Field field = fields[i]; + if (ExcelPublicUtil.isNotUserExcelUserThis(field)) { + continue; + } + if (ExcelPublicUtil.isJavaClass(field)) { + addEntityToMap(field, excelEntity, pojoClass, getMethods, excelParams); + } else { + List newMethods = new ArrayList(); + if (getMethods != null) { + newMethods.addAll(getMethods); + } + newMethods.add(ExcelPublicUtil.getMethod(field.getName(), + pojoClass)); + getAllExcelField(ExcelPublicUtil.getClassFields(field.getType()), + excelParams, field.getType(), + newMethods); + } + } + } + + /** + * 把这个注解解析放到类型对象中 + */ + private static void addEntityToMap(Field field, + ExcelImportEntity excelEntity, Class pojoClass, + List getMethods, Map temp) throws Exception { + Excel excel = field.getAnnotation(Excel.class); + excelEntity = new ExcelImportEntity(); + getExcelField(field, excelEntity, excel, pojoClass); + if (getMethods != null) { + List newMethods = new ArrayList(); + newMethods.addAll(getMethods); + newMethods.add(excelEntity.getSetMethod()); + excelEntity.setSetMethods(newMethods); + } + for (String name : excelEntity.getName().split(",")) { + temp.put(name, excelEntity); + } + + } + + private static void getExcelField(Field field, + ExcelImportEntity excelEntity, Excel excel, Class pojoClass) + throws Exception { + excelEntity.setName(getExcelName(excel.exportName())); + String fieldname = field.getName(); + excelEntity.setSetMethod(ExcelPublicUtil.getMethod(fieldname, pojoClass, field.getType())); + if (StringUtils.isNotBlank(excel.importFormat())) { + excelEntity.setImportFormat(excel.importFormat()); + } + } + + /** + * 判断在这个单元格显示的名称 + */ + private static String getExcelName(String exportName) { + if (exportName.indexOf("_") < 0) { + return exportName; + } + String[] arr = exportName.split(","); + for (String str : arr) { + return str.split("_")[0]; + } + return null; + } + + /** + * 校验标头完整性 + * Excel 导入 field 字段类型 Integer,Long,Double,Date,String,Boolean,BigDecimal + */ + public static String importExcelByTitleCheck(InputStream inputstream, + Class pojoClass, ImportParams params) throws Exception { + Workbook book = null; + if (!(inputstream.markSupported())) { + inputstream = new PushbackInputStream(inputstream, 8); + } + if (POIFSFileSystem.hasPOIFSHeader(inputstream)) { + book = new HSSFWorkbook(inputstream); + } else if (POIXMLDocument.hasOOXMLHeader(inputstream)) { + book = new XSSFWorkbook(OPCPackage.open(inputstream)); + } + + Map excelParams = new HashMap(); + Field fileds[] = ExcelPublicUtil.getClassFields(pojoClass); + getAllExcelField(fileds, excelParams, pojoClass, null); + Set nemeSet = excelParams.keySet(); + List listExcelTitleName = new ArrayList(nemeSet); + + Sheet sheet = book.getSheetAt(0); + Row row = null; + Iterator cellTitle; + List sheetTitleNames = new ArrayList(); + Iterator rows = sheet.rowIterator(); + for (int j = 0; j < params.getSecondTitleRows(); j++) { + row = rows.next(); + cellTitle = row.cellIterator(); + while (cellTitle.hasNext()) { + Cell cell = cellTitle.next(); + String value = cell.getStringCellValue(); + if (!StringUtils.isEmpty(value)) { + sheetTitleNames.add(value); + } + } + } + + String result = null; + List resultList = new ArrayList(); + if (null != listExcelTitleName && listExcelTitleName.size() > 0) { + for (String name : listExcelTitleName) { + if (!sheetTitleNames.contains(name)) { + resultList.add(name); + } + } + } + if (resultList.size() > 0) { + for (int i = 0; i < resultList.size(); i++) { + if (i == 0) { + result = resultList.get(i); + } else { + result += "," + resultList.get(i); + } + } + } + return result; + } + + /* + 获取sheet名称k + */ + public static String getSheetName(InputStream inputstream) throws Exception { + String sheetName = ""; + Collection result = new ArrayList(); + if (!(inputstream.markSupported())) { + inputstream = new PushbackInputStream(inputstream, 8); + } + Workbook book = WorkbookFactory.create(inputstream); + return book.getSheetName(0); + } +} diff --git a/food-common/src/main/java/com/zbkj/common/utils/excel/ExcelPublicUtil.java b/food-common/src/main/java/com/zbkj/common/utils/excel/ExcelPublicUtil.java new file mode 100644 index 0000000..f6ad388 --- /dev/null +++ b/food-common/src/main/java/com/zbkj/common/utils/excel/ExcelPublicUtil.java @@ -0,0 +1,212 @@ +package com.zbkj.common.utils.excel; + +import com.zbkj.common.annotation.Excel; +import org.apache.poi.POIXMLDocumentPart; +import org.apache.poi.hssf.usermodel.*; +import org.apache.poi.ss.usermodel.PictureData; +import org.apache.poi.xssf.usermodel.*; +import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.*; + +public class ExcelPublicUtil { + + public static int MAXEXPORT=500000; + public static String GET = "get"; + public static String SET = "set"; + + /** + * 获取class的 包括父类的 + * @param clazz + * @return + */ + public static Field[] getClassFields(Class clazz) { + List list = new ArrayList(); + Field[] fields; + do{ + fields = clazz.getDeclaredFields(); + for(int i = 0;i clazz) { + return clazz.isAssignableFrom(List.class)|| + clazz.isAssignableFrom(Set.class)|| + clazz.isAssignableFrom(Collection.class); + } + + public static boolean isNotUserExcelUserThis(Field field) { + boolean boo = true; + if(boo&&field.getAnnotation(Excel.class)!=null + &&isUseInThis(field.getAnnotation(Excel.class).exportName())){ + boo = false; + } + return boo; + } + + private static boolean isUseInThis(String exportName) { + return exportName.equals("") || exportName.indexOf("_") < 0; + } + + /** + * 是不是java基础类 + * @param field + * @return + */ + public static boolean isJavaClass(Field field) { + Class fieldType = field.getType(); + boolean isBaseClass = false; + if(fieldType.isArray()){ + isBaseClass = false; + }else if (fieldType.isPrimitive()||fieldType.getPackage()==null + || fieldType.getPackage().getName().equals("java.lang") + || fieldType.getPackage().getName().equals("java.math") + || fieldType.getPackage().getName().equals("java.util")) { + isBaseClass = true; + } + return isBaseClass; + } + + public static Object createObject(Class clazz) { + Object obj = null; + String fieldname; + Method setMethod; + try { + obj = clazz.newInstance(); + Field[] fields = getClassFields(clazz); + for(Field field:fields){ + if(isNotUserExcelUserThis(field)){continue;} + if(!isJavaClass(field)){ + fieldname = field.getName(); + setMethod = getMethod(fieldname,clazz,field.getType() ); + setMethod.invoke(obj, createObject(field.getType())); + } + } + + } catch (Exception e) { + e.printStackTrace(); + } + return obj; + + } + + /** + * 获取方法 + * @param name + * @param pojoClass + * @return + * @throws Exception + */ + public static Method getMethod(String name, Class pojoClass) + throws Exception { + StringBuffer getMethodName = new StringBuffer(GET); + getMethodName.append(name.substring(0, 1).toUpperCase()); + getMethodName.append(name.substring(1)); + return pojoClass.getMethod(getMethodName.toString(),new Class[]{}); + } + /** + * 获取方法 + * @param name + * @param pojoClass + * @param type + * @return + * @throws Exception + */ + public static Method getMethod(String name, Class pojoClass,Class type) + throws Exception { + StringBuffer getMethodName = new StringBuffer(SET); + getMethodName.append(name.substring(0, 1).toUpperCase()); + getMethodName.append(name.substring(1)); + return pojoClass.getMethod(getMethodName.toString(),new Class[]{type}); + } + + /** + * + * @param photoByte + * @return + */ + public static String getFileExtendName(byte[] photoByte) { + String strFileExtendName = "JPG"; + if ((photoByte[0] == 71) && (photoByte[1] == 73) + && (photoByte[2] == 70) && (photoByte[3] == 56) + && ((photoByte[4] == 55) || (photoByte[4] == 57)) + && (photoByte[5] == 97)) { + strFileExtendName = "GIF"; + } else if ((photoByte[6] == 74) && (photoByte[7] == 70) + && (photoByte[8] == 73) && (photoByte[9] == 70)) { + strFileExtendName = "JPG"; + } else if ((photoByte[0] == 66) && (photoByte[1] == 77)) { + strFileExtendName = "BMP"; + } else if ((photoByte[1] == 80) && (photoByte[2] == 78) + && (photoByte[3] == 71)) { + strFileExtendName = "PNG"; + } + return strFileExtendName; + } + + /** + * 获取Excel2003图片 + * @param sheet 当前sheet对象 + * @param workbook 工作簿对象 + * @return Map key:图片单元格索引(1_1)String,value:图片流PictureData + */ + @SuppressWarnings("unchecked") + public static Map getSheetPictrues03(HSSFSheet sheet, + HSSFWorkbook workbook) { + Map sheetIndexPicMap = new HashMap(); + List pictures = workbook.getAllPictures(); + if (pictures.size() != 0) { + for (HSSFShape shape : sheet.getDrawingPatriarch().getChildren()) { + HSSFClientAnchor anchor = (HSSFClientAnchor) shape.getAnchor(); + if (shape instanceof HSSFPicture) { + HSSFPicture pic = (HSSFPicture) shape; + int pictureIndex = pic.getPictureIndex() - 1; + HSSFPictureData picData = pictures.get(pictureIndex); + String picIndex = String.valueOf(anchor.getRow1()) + "_" + + String.valueOf(anchor.getCol1()); + sheetIndexPicMap.put(picIndex, picData); + } + } + return sheetIndexPicMap; + } else { + return (Map) sheetIndexPicMap.put(null, null); + } + } + + /** + * 获取Excel2007图片 + * @param sheet 当前sheet对象 + * @param workbook 工作簿对象 + * @return Map key:图片单元格索引(1_1)String,value:图片流PictureData + */ + public static Map getSheetPictrues07( + XSSFSheet sheet, XSSFWorkbook workbook) { + Map sheetIndexPicMap = new HashMap(); + for (POIXMLDocumentPart dr : sheet.getRelations()) { + if (dr instanceof XSSFDrawing) { + XSSFDrawing drawing = (XSSFDrawing) dr; + List shapes = drawing.getShapes(); + for (XSSFShape shape : shapes) { + XSSFPicture pic = (XSSFPicture) shape; + XSSFClientAnchor anchor = pic.getPreferredSize(); + CTMarker ctMarker = anchor.getFrom(); + String picIndex = ctMarker.getRow() + "_" + ctMarker.getCol(); + sheetIndexPicMap.put(picIndex, pic.getPictureData()); + } + } + } + return sheetIndexPicMap; + } + +} \ No newline at end of file diff --git a/food-common/src/main/java/com/zbkj/common/utils/excel/ExcelUtil.java b/food-common/src/main/java/com/zbkj/common/utils/excel/ExcelUtil.java new file mode 100644 index 0000000..911e00b --- /dev/null +++ b/food-common/src/main/java/com/zbkj/common/utils/excel/ExcelUtil.java @@ -0,0 +1,132 @@ +package com.zbkj.common.utils.excel; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.poi.hssf.usermodel.HSSFCellStyle; +import org.apache.poi.ss.usermodel.FillPatternType; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.apache.poi.xssf.usermodel.*; + +import java.math.BigDecimal; +import java.util.*; + +public class ExcelUtil { + public static Log logger = LogFactory.getLog(ExcelUtil.class); + + /** + * 生成excel + * @param list + * @param titles + * @return + */ + public static XSSFWorkbook exportDataList(List> list, String[] titles, List titles2, Integer beginRow, String sheeetName) { + List> titleList = new ArrayList<>(); + if (titles.length > 0) { + Map map = null; + for (String title : titles) { + map = new HashMap<>(); + map.put("content", title); + titleList.add(map); + } + } + return exportDataList(list, titleList, titles2, beginRow, sheeetName); + } + + /** + * 生成excel + * @param list + * @param titles + * @return + */ + public static XSSFWorkbook exportDataList(List> list, List> titles, List titles2, Integer beginRow, String sheeetName) { + XSSFWorkbook workbook = new XSSFWorkbook(); + XSSFSheet sheet = workbook.createSheet(null == sheeetName ? "sheet1" : sheeetName); + sheet.setColumnWidth(0,20*256); + sheet.setColumnWidth(1,20*256); + sheet.setColumnWidth(2,20*256); + sheet.setColumnWidth(7,20*256); + XSSFRow titleRow = sheet.createRow(0); + + XSSFCellStyle boderStyle = workbook.createCellStyle(); + boderStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);// 上边框 + boderStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); // 下边框 + boderStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);// 左边框 + boderStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);// 右边框 + boderStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); + boderStyle.setAlignment(XSSFCellStyle.ALIGN_CENTER); + boderStyle.setFillForegroundColor(IndexedColors.LIGHT_CORNFLOWER_BLUE.getIndex()); //填充背景色 + boderStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); //填充模式 + int temp = 0; + for (int i = 0; i < titles.size(); i++) { + XSSFCell cell = titleRow.createCell(i); + cell.setCellValue(titles.get(i).get("content").toString()); + /*XSSFCell cell = titleRow.createCell(temp); + cell.setCellStyle(boderStyle); + + Map m = titles.get(i); + cell.setCellValue(m.get("content").toString()); + + Integer v1 = null == m.get("v1") ? 0 : Integer.parseInt(m.get("v1").toString()); //第一行 + Integer v2 = null == m.get("v2") ? 0 : Integer.parseInt(m.get("v2").toString()); //最后一行 + Integer v3 = null == m.get("v3") ? temp : Integer.parseInt(m.get("v3").toString()); //第一列 + Integer v4 = null == m.get("v4") ? temp : Integer.parseInt(m.get("v4").toString())+temp; //最后一列 + System.out.println(v1+"="+v2+"="+v3+"="+v4); + temp=v4+1; + + sheet.autoSizeColumn((short) v3.intValue()); + sheet.addMergedRegion(new CellRangeAddress(v1,v2,v3,v4));*/ + } + int contentBeginRow = 1; + if(null != titles2){ + contentBeginRow++; + XSSFRow titleRow2 = sheet.createRow(1); + for(int i = 0; i < titles2.size(); i++){ + XSSFCell cell = titleRow2.createCell(beginRow++); + cell.setCellStyle(boderStyle); + cell.setCellValue(titles2.get(i)); + } + } + + boderStyle = workbook.createCellStyle(); + boderStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);// 上边框 + boderStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); // 下边框 + boderStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);// 左边框 + boderStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);// 右边框 + boderStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); + boderStyle.setAlignment(XSSFCellStyle.ALIGN_CENTER); + for (int i = contentBeginRow; i < list.size() + contentBeginRow; i++) { + XSSFRow row = sheet.createRow(i); + List datas = list.get(i - contentBeginRow); + for (int j = 0; j < datas.size(); j++) { + try { + XSSFCell cell = row.createCell(j); + cell.setCellStyle(boderStyle); + Object value = datas.get(j); + if (value != null) { + if (value instanceof Integer) { + cell.setCellValue(((Integer) value).doubleValue()); + } else if (value instanceof Float) { + cell.setCellValue(((Float) value).doubleValue()); + } else if (value instanceof Long) { + cell.setCellValue(((Long) value).doubleValue()); + } else if (value instanceof Double) { + cell.setCellValue(((Double) value).doubleValue()); + } else if (value instanceof Boolean) { + cell.setCellValue((Boolean) value); + } else if (value instanceof Date) { + cell.setCellValue((Date) value); + } else if (value instanceof String) { + cell.setCellValue((String) value); + } else if(value instanceof BigDecimal){ + cell.setCellValue(value.toString()); + } + } + } catch (Exception e) { + logger.error(">>>>>系统异常>>>>>>", e); + } + } + } + return workbook; + } + +} diff --git a/food-common/src/main/java/com/zbkj/common/utils/excel/ExcelValidUtil.java b/food-common/src/main/java/com/zbkj/common/utils/excel/ExcelValidUtil.java new file mode 100644 index 0000000..cf8ba72 --- /dev/null +++ b/food-common/src/main/java/com/zbkj/common/utils/excel/ExcelValidUtil.java @@ -0,0 +1,17 @@ +package com.zbkj.common.utils.excel; + +import com.zbkj.common.exception.CrmebException; +import org.springframework.web.multipart.MultipartFile; + +public class ExcelValidUtil { + + public static void canImport(final MultipartFile file) { + if (file == null || file.isEmpty()) { + throw new CrmebException("请选择要导入的文件"); + } + String filename = file.getOriginalFilename().toLowerCase(); + if (!(filename.endsWith("csv") || filename.endsWith("xls") || filename.endsWith("xlsx"))) { + throw new CrmebException("导入的文件格式错误,允许的格式:csv、xls、xlsx"); + } + } +} diff --git a/food-common/src/main/java/com/zbkj/common/utils/excel/ImportParams.java b/food-common/src/main/java/com/zbkj/common/utils/excel/ImportParams.java new file mode 100644 index 0000000..01d83ba --- /dev/null +++ b/food-common/src/main/java/com/zbkj/common/utils/excel/ImportParams.java @@ -0,0 +1,96 @@ +package com.zbkj.common.utils.excel; + +/** + * 导入参数设置 + * + */ +public class ImportParams { + /** + * 表格标题行数,默认0 + */ + private int titleRows = 0; + /** + * 表格列标题行数,默认1 + */ + private int secondTitleRows = 1; + /** + * 字段真正值和列标题之间的距离 默认0 + */ + private int startRows = 0; + /** + * 主键设置,如何这个cell没有值,就跳过 + * 或者认为这个是list的下面的值 + */ + private int keyIndex = 0; + /** + * 上传表格需要读取的sheet 数量,默认为1 + */ + private int sheetNum = 1; + /** + * 是否需要保存上传的Excel,默认为false + */ + private boolean needSave = false; + /** + * 保存上传的Excel目录,默认是 + * 如 TestEntity这个类保存路径就是 + * upload/excelUpload/Test/yyyyMMddHHmss_***** + * 保存名称上传时间_五位随机数 + */ + private String saveUrl = "upload/excelUpload"; + + public int getTitleRows() { + return titleRows; + } + + public void setTitleRows(int titleRows) { + this.titleRows = titleRows; + } + + public int getSecondTitleRows() { + return secondTitleRows; + } + + public void setSecondTitleRows(int secondTitleRows) { + this.secondTitleRows = secondTitleRows; + } + + public int getStartRows() { + return startRows; + } + + public void setStartRows(int startRows) { + this.startRows = startRows; + } + + public int getSheetNum() { + return sheetNum; + } + + public void setSheetNum(int sheetNum) { + this.sheetNum = sheetNum; + } + + public int getKeyIndex() { + return keyIndex; + } + + public void setKeyIndex(int keyIndex) { + this.keyIndex = keyIndex; + } + + public boolean isNeedSave() { + return needSave; + } + + public void setNeedSave(boolean needSave) { + this.needSave = needSave; + } + + public String getSaveUrl() { + return saveUrl; + } + + public void setSaveUrl(String saveUrl) { + this.saveUrl = saveUrl; + } +} diff --git a/food-common/src/main/java/com/zbkj/common/vo/HomeItemVo.java b/food-common/src/main/java/com/zbkj/common/vo/HomeItemVo.java index fe78417..0cca361 100644 --- a/food-common/src/main/java/com/zbkj/common/vo/HomeItemVo.java +++ b/food-common/src/main/java/com/zbkj/common/vo/HomeItemVo.java @@ -1,6 +1,5 @@ package com.zbkj.common.vo; -import com.zbkj.common.vo.product.ProductAttrVo; import com.zbkj.common.vo.product.ProductInfoVo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -9,8 +8,6 @@ import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import java.io.Serializable; -import java.util.HashMap; -import java.util.List; @Data @EqualsAndHashCode(callSuper = false) @@ -51,12 +48,6 @@ public class HomeItemVo implements Serializable { @ApiModelProperty(value = "类型 0商品,1轮播图") private Integer type; - @ApiModelProperty(value = "产品属性") - private List productAttr; - - @ApiModelProperty(value = "商品属性详情") - private HashMap productValue; - @ApiModelProperty(value = "商品信息") private ProductInfoVo productInfo; diff --git a/food-common/src/main/java/com/zbkj/common/vo/HomeVo.java b/food-common/src/main/java/com/zbkj/common/vo/HomeVo.java index 446d930..bced250 100644 --- a/food-common/src/main/java/com/zbkj/common/vo/HomeVo.java +++ b/food-common/src/main/java/com/zbkj/common/vo/HomeVo.java @@ -18,7 +18,7 @@ public class HomeVo implements Serializable { private static final long serialVersionUID=1L; - private Integer homeId; + private Integer id; /** * 名称 */ @@ -50,6 +50,9 @@ public class HomeVo implements Serializable { @ApiModelProperty(value = "跳转类型 0默认值,1商品详情,2分类列表,3商品列表,4活动栏目") private Integer jumpType; + @ApiModelProperty(value = "展示渠道:【1首页楼层,2随心配套餐层,3首页精品推荐】") + private String channel; + @Transient @TableField(exist = false) private List items; diff --git a/food-common/src/main/java/com/zbkj/common/vo/product/ProductInfoVo.java b/food-common/src/main/java/com/zbkj/common/vo/product/ProductInfoVo.java index 061bc33..c5af5a9 100644 --- a/food-common/src/main/java/com/zbkj/common/vo/product/ProductInfoVo.java +++ b/food-common/src/main/java/com/zbkj/common/vo/product/ProductInfoVo.java @@ -12,6 +12,8 @@ import lombok.experimental.Accessors; import java.io.Serializable; import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; /** * 商品表 @@ -57,6 +59,9 @@ public class ProductInfoVo implements Serializable { private Boolean specType; @ApiModelProperty(value = "标签") - private String tags; + private String tags = ""; + + @ApiModelProperty(value = "标签数组") + private List tagList = new ArrayList<>(); } diff --git a/food-front/src/main/java/com/zbkj/front/controller/GroupDataController.java b/food-front/src/main/java/com/zbkj/front/controller/GroupDataController.java index 235b973..0bad4b1 100644 --- a/food-front/src/main/java/com/zbkj/front/controller/GroupDataController.java +++ b/food-front/src/main/java/com/zbkj/front/controller/GroupDataController.java @@ -1,43 +1,43 @@ -package com.zbkj.front.controller; - - -import com.zbkj.common.response.CommonResult; -import com.zbkj.service.service.SystemCityService; -import com.zbkj.service.service.SystemGroupDataService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import java.util.HashMap; -import java.util.List; - -/** - * 城市服务 - - */ -@Slf4j -@RestController("GroupDataFrontController") -@RequestMapping("api/front/groupData") -@Api(tags = "静态数据") -public class GroupDataController { - - @Autowired - private SystemGroupDataService systemGroupDataService; - - @ApiOperation(value = "静态数据") - @RequestMapping(value = "/getData", method = RequestMethod.GET) - @ApiImplicitParam(name="id", value="数据id") - public CommonResult getData(@RequestParam(value = "id") Integer id) { - List> data = systemGroupDataService.getListMapByGid(id); - return CommonResult.success(data); - } -} - - - +//package com.zbkj.front.controller; +// +// +//import com.zbkj.common.response.CommonResult; +//import com.zbkj.service.service.SystemCityService; +//import com.zbkj.service.service.SystemGroupDataService; +//import io.swagger.annotations.Api; +//import io.swagger.annotations.ApiImplicitParam; +//import io.swagger.annotations.ApiOperation; +//import lombok.extern.slf4j.Slf4j; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.web.bind.annotation.RequestMapping; +//import org.springframework.web.bind.annotation.RequestMethod; +//import org.springframework.web.bind.annotation.RequestParam; +//import org.springframework.web.bind.annotation.RestController; +// +//import java.util.HashMap; +//import java.util.List; +// +///** +// * 城市服务 +// +// */ +//@Slf4j +//@RestController("GroupDataFrontController") +//@RequestMapping("api/front/groupData") +//@Api(tags = "静态数据") +//public class GroupDataController { +// +// @Autowired +// private SystemGroupDataService systemGroupDataService; +// +// @ApiOperation(value = "静态数据") +// @RequestMapping(value = "/getData", method = RequestMethod.GET) +// @ApiImplicitParam(name="id", value="数据id") +// public CommonResult getData(@RequestParam(value = "id") Integer id) { +// List> data = systemGroupDataService.getListMapByGid(id); +// return CommonResult.success(data); +// } +//} +// +// +// diff --git a/food-front/src/main/java/com/zbkj/front/controller/HelpController.java b/food-front/src/main/java/com/zbkj/front/controller/HelpController.java index c999b77..d26c42e 100644 --- a/food-front/src/main/java/com/zbkj/front/controller/HelpController.java +++ b/food-front/src/main/java/com/zbkj/front/controller/HelpController.java @@ -1,6 +1,5 @@ package com.zbkj.front.controller; -import com.zbkj.common.constants.Constants; import com.zbkj.common.model.system.SystemHelpProblem; import com.zbkj.common.page.CommonPage; import com.zbkj.common.response.CommonResult; @@ -38,7 +37,7 @@ public class HelpController { @ApiOperation(value = "分页列表") @RequestMapping(value = "/list/{cid}", method = RequestMethod.GET) - public CommonResult> getListArticle(@PathVariable(name="cid") String cid, @Validated PageParamRequest pageParamRequest) { + public CommonResult> getListArticle(@PathVariable(name="cid") Integer cid, @Validated PageParamRequest pageParamRequest) { SystemHelpProblem entity = new SystemHelpProblem(); entity.setCid(cid); entity.setStatus(true); diff --git a/food-front/src/main/java/com/zbkj/front/controller/ProblemController.java b/food-front/src/main/java/com/zbkj/front/controller/ProblemController.java index 69ab1ef..c1b64ab 100644 --- a/food-front/src/main/java/com/zbkj/front/controller/ProblemController.java +++ b/food-front/src/main/java/com/zbkj/front/controller/ProblemController.java @@ -31,11 +31,11 @@ public class ProblemController { return CommonResult.success(storeProductProblemService.getResponseList(productId, pageParamRequest)); } - @ApiOperation(value = "常见问题列表-子回复列表") - @RequestMapping(value = "/son/{majorId}", method = RequestMethod.GET) - public CommonResult> getSonResponseList(@PathVariable Integer majorId, @Validated PageParamRequest pageParamRequest) { - return CommonResult.success(storeProductProblemService.getSonResponseList(majorId, pageParamRequest)); - } +// @ApiOperation(value = "常见问题列表-子回复列表") +// @RequestMapping(value = "/son/{majorId}", method = RequestMethod.GET) +// public CommonResult> getSonResponseList(@PathVariable Integer majorId, @Validated PageParamRequest pageParamRequest) { +// return CommonResult.success(storeProductProblemService.getSonResponseList(majorId, pageParamRequest)); +// } @ApiOperation(value = "常见问题-提问/回复") @PostMapping("/commit") diff --git a/food-front/src/main/java/com/zbkj/front/controller/ProductController.java b/food-front/src/main/java/com/zbkj/front/controller/ProductController.java index 9df0618..94259b1 100644 --- a/food-front/src/main/java/com/zbkj/front/controller/ProductController.java +++ b/food-front/src/main/java/com/zbkj/front/controller/ProductController.java @@ -6,10 +6,8 @@ import com.zbkj.common.request.*; import com.zbkj.common.response.*; import com.zbkj.common.vo.CategoryTreeVo; import com.zbkj.front.service.ProductService; -import com.zbkj.service.service.StoreProductProblemService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -73,9 +71,8 @@ public class ProductController { */ @ApiOperation(value = "商品详情") @RequestMapping(value = "/product/detail/{id}", method = RequestMethod.GET) - @ApiImplicitParam(name = "type", value = "normal-正常") - public CommonResult getDetail(@PathVariable Integer id, @RequestParam(value = "type", defaultValue = "normal") String type) { - return CommonResult.success(productService.getDetail(id, type)); + public CommonResult getDetail(@PathVariable Integer id) { + return CommonResult.success(productService.getDetail(id)); } /** @@ -83,7 +80,7 @@ public class ProductController { */ @ApiOperation(value = "商品规格详情") @RequestMapping(value = "/product/sku/detail/{id}", method = RequestMethod.GET) - public CommonResult getSkuDetail(@PathVariable Integer id) { + public CommonResult getSkuDetail(@PathVariable Integer id) { return CommonResult.success(productService.getSkuDetail(id)); } diff --git a/food-front/src/main/java/com/zbkj/front/controller/StoreOrderController.java b/food-front/src/main/java/com/zbkj/front/controller/StoreOrderController.java index f7a93ca..c350b34 100644 --- a/food-front/src/main/java/com/zbkj/front/controller/StoreOrderController.java +++ b/food-front/src/main/java/com/zbkj/front/controller/StoreOrderController.java @@ -190,16 +190,16 @@ public class StoreOrderController { // return CommonResult.success(orderService.getRefundReason()); // } - /** - * 根据订单号查询物流信息 - * @param orderId 订单号 - * @return 物流信息 - */ - @ApiOperation(value = "物流信息查询") - @RequestMapping(value = "/express/{orderId}", method = RequestMethod.GET) - public CommonResult getExpressInfo(@PathVariable String orderId) { - return CommonResult.success(orderService.expressOrder(orderId)); - } +// /** +// * 根据订单号查询物流信息 +// * @param orderId 订单号 +// * @return 物流信息 +// */ +// @ApiOperation(value = "物流信息查询") +// @RequestMapping(value = "/express/{orderId}", method = RequestMethod.GET) +// public CommonResult getExpressInfo(@PathVariable String orderId) { +// return CommonResult.success(orderService.expressOrder(orderId)); +// } /** * 获取支付配置 diff --git a/food-front/src/main/java/com/zbkj/front/filter/ResponseRouter.java b/food-front/src/main/java/com/zbkj/front/filter/ResponseRouter.java index 33d7e59..0e9d2dc 100644 --- a/food-front/src/main/java/com/zbkj/front/filter/ResponseRouter.java +++ b/food-front/src/main/java/com/zbkj/front/filter/ResponseRouter.java @@ -22,11 +22,11 @@ public class ResponseRouter { //根据需要处理返回值 if (data.contains(Constants.UPLOAD_TYPE_IMAGE+"/") && !data.contains("data:image/png;base64")) { - data = SpringUtil.getBean(SystemAttachmentService.class).prefixImage(data); + return SpringUtil.getBean(SystemAttachmentService.class).prefixImage(data); } if (data.contains("file/")) { - data = SpringUtil.getBean(SystemAttachmentService.class).prefixFile(data); + return SpringUtil.getBean(SystemAttachmentService.class).prefixFile(data); } return data; diff --git a/food-front/src/main/java/com/zbkj/front/service/ProductService.java b/food-front/src/main/java/com/zbkj/front/service/ProductService.java index 5a8c8fc..d0820ab 100644 --- a/food-front/src/main/java/com/zbkj/front/service/ProductService.java +++ b/food-front/src/main/java/com/zbkj/front/service/ProductService.java @@ -35,17 +35,16 @@ public interface ProductService { /** * 获取商品详情 * @param id 商品编号 - * @param type normal-正常,void-视频 * @return 商品详情信息 */ - ProductDetailResponse getDetail(Integer id, String type); + StoreProductResponse getDetail(Integer id); /** * 获取商品SKU详情 * @param id 商品编号 * @return 商品详情信息 */ - ProductDetailResponse getSkuDetail(Integer id); + StoreProductSkuResponse getSkuDetail(Integer id); /** * 商品评论列表 diff --git a/food-front/src/main/java/com/zbkj/front/service/impl/IndexServiceImpl.java b/food-front/src/main/java/com/zbkj/front/service/impl/IndexServiceImpl.java index 3a54777..18a8f75 100644 --- a/food-front/src/main/java/com/zbkj/front/service/impl/IndexServiceImpl.java +++ b/food-front/src/main/java/com/zbkj/front/service/impl/IndexServiceImpl.java @@ -66,6 +66,7 @@ public class IndexServiceImpl implements IndexService { IndexInfoResponse indexInfoResponse = new IndexInfoResponse(); indexInfoResponse.setHomeList(homeService.getIndexHomeList(0)); // 楼层 indexInfoResponse.setLogoUrl(systemConfigService.getValueByKey(Constants.CONFIG_KEY_SITE_LOGO));// 企业logo地址 + indexInfoResponse.setWishesImage(systemConfigService.getValueByKey(Constants.WISHES_IMAGE));// 企业logo地址 indexInfoResponse.setConsumerHotline(systemConfigService.getValueByKey(Constants.CONFIG_KEY_CONSUMER_HOTLINE));// 客服电话 indexInfoResponse.setTelephoneServiceSwitch(systemConfigService.getValueByKey(Constants.CONFIG_KEY_TELEPHONE_SERVICE_SWITCH));// 客服电话服务 // 保存用户访问记录 diff --git a/food-front/src/main/java/com/zbkj/front/service/impl/ProductServiceImpl.java b/food-front/src/main/java/com/zbkj/front/service/impl/ProductServiceImpl.java index 82dd576..17d78cf 100644 --- a/food-front/src/main/java/com/zbkj/front/service/impl/ProductServiceImpl.java +++ b/food-front/src/main/java/com/zbkj/front/service/impl/ProductServiceImpl.java @@ -14,21 +14,19 @@ import com.zbkj.common.model.product.StoreProduct; import com.zbkj.common.model.product.StoreProductAttr; import com.zbkj.common.model.product.StoreProductAttrValue; import com.zbkj.common.model.record.UserVisitRecord; -import com.zbkj.common.model.system.SystemUserLevel; import com.zbkj.common.model.user.User; import com.zbkj.common.page.CommonPage; import com.zbkj.common.request.*; import com.zbkj.common.response.*; -import com.zbkj.common.utils.CrmebUtil; import com.zbkj.common.utils.RedisUtil; import com.zbkj.common.vo.CategoryTreeVo; import com.zbkj.common.vo.HomeVo; import com.zbkj.common.vo.MyRecord; import com.zbkj.common.vo.ReplyReviewTagsVo; -import com.zbkj.common.vo.product.ProductDetailVo; import com.zbkj.front.service.ProductService; import com.zbkj.service.delete.ProductUtils; import com.zbkj.service.service.*; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -36,7 +34,6 @@ import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.*; -import java.util.stream.Collectors; /** * IndexServiceImpl 接口实现 @@ -118,11 +115,10 @@ public class ProductServiceImpl implements ProductService { /** * 获取商品详情 * @param id 商品编号 - * @param type normal-正常,video-视频 * @return 商品详情信息 */ @Override - public ProductDetailResponse getDetail(Integer id, String type) { + public StoreProductResponse getDetail(Integer id) { // 获取用户 User user = userService.getInfo(); // SystemUserLevel userLevel = null; @@ -130,7 +126,8 @@ public class ProductServiceImpl implements ProductService { // userLevel = systemUserLevelService.getByLevelId(user.getLevel()); // } - ProductDetailResponse productDetailResponse = new ProductDetailResponse(); + // ProductDetailResponse productDetailResponse = new ProductDetailResponse(); + // StoreProductResponse productDetailResponse = new StoreProductResponse(); // 查询商品 StoreProduct storeProduct = storeProductService.getH5Detail(id); // if (ObjectUtil.isNotNull(userLevel)) { @@ -139,12 +136,13 @@ public class ProductServiceImpl implements ProductService { StoreProductResponse spResponse = new StoreProductResponse(); BeanUtils.copyProperties(storeProduct, spResponse); - productDetailResponse.setProductInfo(spResponse); + spResponse.setSliderImages(StringUtils.isNotEmpty(storeProduct.getSliderImage()) ? JSON.parseArray(storeProduct.getSliderImage(), String.class) : new ArrayList<>()); + // productDetailResponse.setProductInfo(spResponse); // 获取商品规格 List attrList = attrService.getListByProductIdAndType(storeProduct.getId(), Constants.PRODUCT_TYPE_NORMAL); // 根据制式设置attr属性 - productDetailResponse.setProductAttr(attrList); + spResponse.setProductAttr(attrList); // 根据制式设置sku属性 HashMap skuMap = CollUtil.newHashMap(); @@ -158,13 +156,13 @@ public class ProductServiceImpl implements ProductService { // } skuMap.put(atr.getSuk(), atr); } - productDetailResponse.setProductValue(skuMap); + spResponse.setProductValue(skuMap); // 用户收藏 if (ObjectUtil.isNotNull(user)) { // 查询用户是否收藏收藏 user = userService.getInfo(); - productDetailResponse.setUserCollect(storeProductRelationService.getLikeOrCollectByUser(user.getUid(), id,false).size() > 0); + spResponse.setUserCollect(storeProductRelationService.getLikeOrCollectByUser(user.getUid(), id,false).size() > 0); // // 判断是否开启分销 // String brokerageFuncStatus = systemConfigService.getValueByKey(SysConfigConstants.CONFIG_KEY_BROKERAGE_FUNC_STATUS); // if (brokerageFuncStatus.equals(Constants.COMMON_SWITCH_OPEN)) {// 分销开启 @@ -175,7 +173,7 @@ public class ProductServiceImpl implements ProductService { // } // } } else { - productDetailResponse.setUserCollect(false); + spResponse.setUserCollect(false); } // // 商品活动 // List activityAllH5 = productUtils.getProductAllActivity(storeProduct); @@ -196,7 +194,7 @@ public class ProductServiceImpl implements ProductService { userVisitRecordService.save(visitRecord); } - return productDetailResponse; + return spResponse; } /** @@ -205,7 +203,7 @@ public class ProductServiceImpl implements ProductService { * @return 商品详情信息 */ @Override - public ProductDetailResponse getSkuDetail(Integer id) { + public StoreProductSkuResponse getSkuDetail(Integer id) { // 获取用户 // User user = userService.getInfo(); // SystemUserLevel userLevel = null; @@ -213,14 +211,14 @@ public class ProductServiceImpl implements ProductService { // userLevel = systemUserLevelService.getByLevelId(user.getLevel()); // } - ProductDetailResponse productDetailResponse = new ProductDetailResponse(); + StoreProductSkuResponse spResponse = new StoreProductSkuResponse(); // 查询商品 StoreProduct storeProduct = storeProductService.getH5Detail(id); // 获取商品规格 List attrList = attrService.getListByProductIdAndType(storeProduct.getId(), Constants.PRODUCT_TYPE_NORMAL); // 根据制式设置attr属性 - productDetailResponse.setProductAttr(attrList); + spResponse.setProductAttr(attrList); // 根据制式设置sku属性 HashMap skuMap = CollUtil.newHashMap(); @@ -235,9 +233,9 @@ public class ProductServiceImpl implements ProductService { // } skuMap.put(atr.getSuk(), atr); } - productDetailResponse.setProductValue(skuMap); + spResponse.setProductValue(skuMap); - return productDetailResponse; + return spResponse; } /** @@ -347,7 +345,7 @@ public class ProductServiceImpl implements ProductService { FloorRequest floor = new FloorRequest(); floor.setChannel(Constants.HOME_TYPE_3); PageParamRequest page = new PageParamRequest(); - page.setPage(floorPage); + page.setPage(1); page.setLimit(2); List homeVos = ebHomeService.selectPageFloor(floor, page); if (!homeVos.isEmpty()) { @@ -365,36 +363,31 @@ public class ProductServiceImpl implements ProductService { private CommonPage resultIndexProductResponse(List storeProductList) { CommonPage storeProductCommonPage = CommonPage.restPage(storeProductList); - Map skuDetails = storeProductService.getSkuDetails(storeProductList.stream().map(StoreProduct::getId).collect(Collectors.toList())); List productResponseArrayList = new ArrayList<>(); for (StoreProduct storeProduct : storeProductList) { IndexProductResponse productResponse = new IndexProductResponse(); BeanUtils.copyProperties(storeProduct, productResponse); - - ProductDetailVo skuDetail = skuDetails.get(storeProduct.getId()); - productResponse.setProductValue(skuDetail.getProductValue()); - productResponse.setProductAttr(skuDetail.getProductAttr()); - - List activityList = CrmebUtil.stringToArrayInt(storeProduct.getActivity()); - // 活动类型默认:直接跳过 - if (activityList.get(0).equals(Constants.PRODUCT_TYPE_NORMAL)) { - productResponseArrayList.add(productResponse); - continue; - } - // 根据参与活动添加对应商品活动标示 - HashMap activityByProduct = productUtils.getActivityByProduct(storeProduct.getId(), storeProduct.getActivity()); - if (CollUtil.isNotEmpty(activityByProduct)) { - for (Integer activity : activityList) { - if (activity.equals(Constants.PRODUCT_TYPE_NORMAL)) { - break; - } - if (activity.equals(Constants.PRODUCT_TYPE_SECKILL)) { - ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_SECKILL); - if (ObjectUtil.isNotNull(itemResponse)) { - productResponse.setActivityH5(itemResponse); - break; - } - } + productResponse.setTagList(StringUtils.isNotBlank(productResponse.getTags()) ? Arrays.asList(productResponse.getTags().split(",")) : new ArrayList<>()); +// List activityList = CrmebUtil.stringToArrayInt(storeProduct.getActivity()); +// // 活动类型默认:直接跳过 +// if (activityList.get(0).equals(Constants.PRODUCT_TYPE_NORMAL)) { +// productResponseArrayList.add(productResponse); +// continue; +// } +// // 根据参与活动添加对应商品活动标示 +// HashMap activityByProduct = productUtils.getActivityByProduct(storeProduct.getId(), storeProduct.getActivity()); +// if (CollUtil.isNotEmpty(activityByProduct)) { +// for (Integer activity : activityList) { +// if (activity.equals(Constants.PRODUCT_TYPE_NORMAL)) { +// break; +// } +// if (activity.equals(Constants.PRODUCT_TYPE_SECKILL)) { +// ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_SECKILL); +// if (ObjectUtil.isNotNull(itemResponse)) { +// productResponse.setActivityH5(itemResponse); +// break; +// } +// } // if (activity.equals(Constants.PRODUCT_TYPE_BARGAIN)) { // ProductActivityItemResponse itemResponse = activityByProduct.get(Constants.PRODUCT_TYPE_BARGAIN); // if (ObjectUtil.isNotNull(itemResponse)) { @@ -409,8 +402,8 @@ public class ProductServiceImpl implements ProductService { // break; // } // } - } - } +// } +// } productResponseArrayList.add(productResponse); } CommonPage productResponseCommonPage = CommonPage.restPage(productResponseArrayList); @@ -449,7 +442,6 @@ public class ProductServiceImpl implements ProductService { User user = userService.getInfo(); List productResponseArrayList = new ArrayList<>(); - Map skuDetails = storeProductService.getSkuDetails(storeProductList.stream().map(StoreProduct::getId).collect(Collectors.toList())); for (StoreProduct storeProduct : storeProductList) { IndexProductResponse productResponse = new IndexProductResponse(); // 获取商品购物车数量 @@ -457,9 +449,6 @@ public class ProductServiceImpl implements ProductService { productResponse.setCartNum(cartService.getProductNumByUidAndProductId(user.getUid(), storeProduct.getId())); } BeanUtils.copyProperties(storeProduct, productResponse); - ProductDetailVo skuDetail = skuDetails.get(storeProduct.getId()); - productResponse.setProductValue(skuDetail.getProductValue()); - productResponse.setProductAttr(skuDetail.getProductAttr()); productResponseArrayList.add(productResponse); } CommonPage productResponseCommonPage = CommonPage.restPage(productResponseArrayList); diff --git a/food-service/src/main/java/com/zbkj/service/service/EbHomeItemService.java b/food-service/src/main/java/com/zbkj/service/service/EbHomeItemService.java new file mode 100644 index 0000000..0e187d7 --- /dev/null +++ b/food-service/src/main/java/com/zbkj/service/service/EbHomeItemService.java @@ -0,0 +1,16 @@ +package com.zbkj.service.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.zbkj.common.model.home.HomeItem; +import com.zbkj.common.request.HomeItemRequest; +import com.zbkj.common.request.PageParamRequest; +import com.zbkj.common.vo.HomeItemVo; + +import java.util.List; + +public interface EbHomeItemService extends IService { + + List getAdminList(HomeItemRequest request, PageParamRequest pageParamRequest); + +} + diff --git a/food-service/src/main/java/com/zbkj/service/service/EbHomeService.java b/food-service/src/main/java/com/zbkj/service/service/EbHomeService.java index d233913..c628177 100644 --- a/food-service/src/main/java/com/zbkj/service/service/EbHomeService.java +++ b/food-service/src/main/java/com/zbkj/service/service/EbHomeService.java @@ -2,10 +2,7 @@ package com.zbkj.service.service; import com.baomidou.mybatisplus.extension.service.IService; import com.zbkj.common.model.home.Home; -import com.zbkj.common.request.FloorProRequest; -import com.zbkj.common.request.FloorRequest; -import com.zbkj.common.request.PageParamRequest; -import com.zbkj.common.request.SetMealRequest; +import com.zbkj.common.request.*; import com.zbkj.common.response.SetMealResponse; import com.zbkj.common.vo.HomeItemVo; import com.zbkj.common.vo.HomeVo; @@ -23,5 +20,13 @@ public interface EbHomeService extends IService { List selectPageFloorItem(FloorProRequest entity, PageParamRequest page); + List selectFloorItem(FloorProRequest entity, PageParamRequest page); + + List getAdminList(HomeRequest request, PageParamRequest pageParamRequest); + + boolean create(HomeRequest request); + + boolean deleteById(Integer id); + } diff --git a/food-service/src/main/java/com/zbkj/service/service/StoreProductRelationService.java b/food-service/src/main/java/com/zbkj/service/service/StoreProductRelationService.java index 7bab197..7a1e637 100644 --- a/food-service/src/main/java/com/zbkj/service/service/StoreProductRelationService.java +++ b/food-service/src/main/java/com/zbkj/service/service/StoreProductRelationService.java @@ -8,6 +8,7 @@ import com.zbkj.common.request.UserCollectRequest; import com.zbkj.common.response.UserRelationResponse; import java.util.List; +import java.util.Map; /** * StoreProductRelationService 接口 @@ -31,7 +32,9 @@ public interface StoreProductRelationService extends IService getLikeOrCollectByUser(Integer userId, Integer productId,boolean isLike); + Map getCollectCount(List productIdList, String type); + + List getLikeOrCollectByUser(Integer userId, Integer productId, boolean isLike); /** * 获取用户收藏列表 diff --git a/food-service/src/main/java/com/zbkj/service/service/StoreProductService.java b/food-service/src/main/java/com/zbkj/service/service/StoreProductService.java index 3062a0f..3d286b1 100644 --- a/food-service/src/main/java/com/zbkj/service/service/StoreProductService.java +++ b/food-service/src/main/java/com/zbkj/service/service/StoreProductService.java @@ -3,10 +3,7 @@ package com.zbkj.service.service; import com.baomidou.mybatisplus.extension.service.IService; import com.zbkj.common.model.product.StoreProduct; import com.zbkj.common.request.*; -import com.zbkj.common.response.ProductDetailResponse; -import com.zbkj.common.response.StoreProductInfoResponse; -import com.zbkj.common.response.StoreProductResponse; -import com.zbkj.common.response.StoreProductTabsHeader; +import com.zbkj.common.response.*; import com.zbkj.common.vo.MyRecord; import com.github.pagehelper.PageInfo; import com.zbkj.common.vo.product.ProductDetailVo; @@ -41,6 +38,13 @@ public interface StoreProductService extends IService { */ List getListInIds(List productIds); + /** + * 批量新增商品 + * @param list + * @return + */ + CommonResult saveBatch(List list); + /** * 新增商品 * @param request 商品请求对象 @@ -163,6 +167,8 @@ public interface StoreProductService extends IService { */ List findH5List(ProductRequest request, PageParamRequest pageRequest); + Map getH5Detail(List productIds); + /** * 获取移动端商品详情 * @param id 商品id diff --git a/food-service/src/main/java/com/zbkj/service/service/impl/CategoryServiceImpl.java b/food-service/src/main/java/com/zbkj/service/service/impl/CategoryServiceImpl.java index 3bc11eb..9ca64e1 100644 --- a/food-service/src/main/java/com/zbkj/service/service/impl/CategoryServiceImpl.java +++ b/food-service/src/main/java/com/zbkj/service/service/impl/CategoryServiceImpl.java @@ -84,7 +84,9 @@ public class CategoryServiceImpl extends ServiceImpl impl @Override public List getByIds(List idList) { LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); - lambdaQueryWrapper.in(Category::getId, idList); + if (!idList.isEmpty()) { + lambdaQueryWrapper.in(Category::getId, idList); + } return dao.selectList(lambdaQueryWrapper); } diff --git a/food-service/src/main/java/com/zbkj/service/service/impl/EbHomeItemServiceImpl.java b/food-service/src/main/java/com/zbkj/service/service/impl/EbHomeItemServiceImpl.java new file mode 100644 index 0000000..44a1143 --- /dev/null +++ b/food-service/src/main/java/com/zbkj/service/service/impl/EbHomeItemServiceImpl.java @@ -0,0 +1,42 @@ +package com.zbkj.service.service.impl; + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.github.pagehelper.PageHelper; +import com.zbkj.common.model.home.HomeItem; +import com.zbkj.common.request.HomeItemRequest; +import com.zbkj.common.request.PageParamRequest; +import com.zbkj.common.vo.HomeItemVo; +import com.zbkj.service.dao.HomeItemDao; +import com.zbkj.service.service.EbHomeItemService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class EbHomeItemServiceImpl extends ServiceImpl implements EbHomeItemService { + + @Autowired private HomeItemDao dao; + + @Override + public List getAdminList(HomeItemRequest request, PageParamRequest pageParamRequest) { + PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit()); + LambdaQueryWrapper lambdaQueryWrapper = Wrappers.lambdaQuery(); + if (StringUtils.isNotBlank(request.getName())) { + lambdaQueryWrapper.and(i -> i + .or().like(HomeItem::getName, request.getName()) + .or().like(HomeItem::getTitle, request.getName())); + } + if (null != request.getJumpType()) { + lambdaQueryWrapper.eq(HomeItem::getJumpType, request.getJumpType()); + } + lambdaQueryWrapper.orderByDesc(HomeItem::getOrderNo).orderByDesc(HomeItem::getId); + List itemList = dao.selectList(lambdaQueryWrapper); + List itemVoArrayList = JSON.parseArray(JSON.toJSONString(itemList), HomeItemVo.class); + return itemVoArrayList; + } +} diff --git a/food-service/src/main/java/com/zbkj/service/service/impl/EbHomeServiceImpl.java b/food-service/src/main/java/com/zbkj/service/service/impl/EbHomeServiceImpl.java index 6976b98..200ef40 100644 --- a/food-service/src/main/java/com/zbkj/service/service/impl/EbHomeServiceImpl.java +++ b/food-service/src/main/java/com/zbkj/service/service/impl/EbHomeServiceImpl.java @@ -1,23 +1,32 @@ package com.zbkj.service.service.impl; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.github.pagehelper.PageHelper; import com.zbkj.common.constants.Constants; import com.zbkj.common.model.home.Home; -import com.zbkj.common.page.CommonPage; +import com.zbkj.common.model.home.HomeItem; +import com.zbkj.common.model.product.StoreProduct; import com.zbkj.common.request.*; import com.zbkj.common.response.*; import com.zbkj.common.utils.RedisUtil; import com.zbkj.common.vo.HomeItemVo; import com.zbkj.common.vo.HomeVo; -import com.zbkj.common.vo.product.ProductDetailVo; +import com.zbkj.common.vo.product.ProductInfoVo; import com.zbkj.service.dao.HomeDao; import com.zbkj.service.dao.HomeItemDao; +import com.zbkj.service.service.EbHomeItemService; import com.zbkj.service.service.EbHomeService; import com.zbkj.service.service.StoreProductService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -29,6 +38,7 @@ public class EbHomeServiceImpl extends ServiceImpl implements EbH @Autowired private RedisUtil redisUtil; @Autowired private HomeDao dao; @Autowired private HomeItemDao homeItemDao; + @Autowired private EbHomeItemService homeItemService; @Autowired private StoreProductService productService; @Override @@ -40,7 +50,7 @@ public class EbHomeServiceImpl extends ServiceImpl implements EbH fpPage.setPage(1); fpPage.setLimit(5); FloorProRequest fp = new FloorProRequest(); - fp.setHomeId(homeVo.getHomeId()); + fp.setHomeId(homeVo.getId()); List fpResult = selectPageFloorItem(fp, fpPage); homeVo.setItems(fpResult); } @@ -64,7 +74,7 @@ public class EbHomeServiceImpl extends ServiceImpl implements EbH fpPage.setPage(1); fpPage.setLimit(5); FloorProRequest fp = new FloorProRequest(); - fp.setHomeId(home.getHomeId()); + fp.setHomeId(home.getId()); List fpResult = selectPageFloorItem(fp, fpPage); home.setItems(fpResult); } @@ -73,22 +83,72 @@ public class EbHomeServiceImpl extends ServiceImpl implements EbH @Override public List selectPageFloorItem(FloorProRequest entity, PageParamRequest page) { - PageHelper.startPage(page.getPage(), page.getLimit()); - List list = homeItemDao.selectHomeItem(entity.getHomeId()); - PageHelper.clearPage(); + List list = selectFloorItem(entity, page); List proList = list.stream().filter(i -> i.getType() == 0).collect(Collectors.toList()); if (!proList.isEmpty()) { List pIds = proList.stream().map(HomeItemVo::getJumpIds).map(Integer::valueOf).collect(Collectors.toList()); - Map skuDetails = productService.getSkuDetails(pIds); + Map h5Detail = productService.getH5Detail(pIds); for (HomeItemVo itemVo : list) { if (itemVo.getType() != 0) { continue; } - ProductDetailVo skuDetail = skuDetails.get(Integer.parseInt(itemVo.getJumpIds())); - itemVo.setProductValue(skuDetail.getProductValue()); - itemVo.setProductAttr(skuDetail.getProductAttr()); - itemVo.setProductInfo(skuDetail.getProductInfo()); + StoreProduct storeProduct = h5Detail.get(Integer.parseInt(itemVo.getJumpIds())); + ProductInfoVo productInfoVo = JSON.parseObject(JSON.toJSONString(storeProduct), ProductInfoVo.class); + productInfoVo.setTagList(StringUtils.isNotBlank(productInfoVo.getTags()) ? Arrays.asList(productInfoVo.getTags().split(",")) : new ArrayList<>()); + itemVo.setProductInfo(productInfoVo); } } return list; } + @Override + public List selectFloorItem(FloorProRequest entity, PageParamRequest page) { + PageHelper.startPage(page.getPage(), page.getLimit()); + List list = homeItemDao.selectHomeItem(entity.getHomeId()); + PageHelper.clearPage(); + return list; + } + + @Override + public List getAdminList(HomeRequest request, PageParamRequest pageParamRequest) { + PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit()); + LambdaQueryWrapper lambdaQueryWrapper = Wrappers.lambdaQuery(); + if (StringUtils.isNotBlank(request.getName())) { + lambdaQueryWrapper.and(i -> i + .or().like(Home::getName, request.getName()) + .or().like(Home::getTitle, request.getName())); + } + if (null != request.getJumpType()) { + lambdaQueryWrapper.eq(Home::getJumpType, request.getJumpType()); + } + if (StringUtils.isNotBlank(request.getChannel())) { + lambdaQueryWrapper.apply( "FIND_IN_SET ('" + request.getChannel() + "', channel)"); + } + lambdaQueryWrapper.orderByDesc(Home::getOrderNo).orderByDesc(Home::getId); + List homeList = dao.selectList(lambdaQueryWrapper); + List homeVoArrayList = JSON.parseArray(JSON.toJSONString(homeList), HomeVo.class); + return homeVoArrayList; + } + + @Override + public boolean create(HomeRequest request) { + Home home = new Home(); + BeanUtils.copyProperties(request, home); + dao.insert(home); + + List items = request.getItems(); + List homeItems = JSON.parseArray(JSON.toJSONString(items), HomeItem.class); + homeItems.forEach(i-> i.setHomeId(home.getId())); + homeItemService.saveBatch(homeItems); + return true; + } + + @Override + public boolean deleteById(Integer id) { + dao.deleteById(id); + + LambdaQueryWrapper lq = new LambdaQueryWrapper<>(); + lq.eq(HomeItem::getHomeId, id); + List homeItems = homeItemDao.selectList(lq); + homeItems.forEach(i-> homeItemDao.deleteById(i.getId())); + return true; + } } diff --git a/food-service/src/main/java/com/zbkj/service/service/impl/OrderServiceImpl.java b/food-service/src/main/java/com/zbkj/service/service/impl/OrderServiceImpl.java index f00b362..6f0f29a 100644 --- a/food-service/src/main/java/com/zbkj/service/service/impl/OrderServiceImpl.java +++ b/food-service/src/main/java/com/zbkj/service/service/impl/OrderServiceImpl.java @@ -2248,10 +2248,15 @@ public class OrderServiceImpl implements OrderService { } } } - // 不满足指定包邮条件,走指定区域配送 - ShippingTemplatesRegion shippingTemplatesRegion = shippingTemplatesRegionService.getByTempIdAndCityId(tempId, cityId); + // 不满足指定包邮条件 + // 查看是否有默认全国 + ShippingTemplatesRegion shippingTemplatesRegion = shippingTemplatesRegionService.getByTempIdAndCityId(tempId, 0); + if (null == shippingTemplatesRegion) { + // 查指定区域配送 + shippingTemplatesRegion = shippingTemplatesRegionService.getByTempIdAndCityId(tempId, cityId); + } if (ObjectUtil.isNull(shippingTemplatesRegion)) { - throw new CrmebException("计算配送费时,未找到全国配送配置"); + throw new CrmebException("计算配送费时,未找到城市配送配置"); } // 判断距离是否超过首公里数 if (km.compareTo(shippingTemplatesRegion.getFirst()) <= 0) { @@ -2306,7 +2311,6 @@ public class OrderServiceImpl implements OrderService { record.set("weight", weight); BigDecimal volume = e.getVolume().multiply(BigDecimal.valueOf(e.getPayNum())); record.set("volume", volume); - proMap.put(proId, record); } }); diff --git a/food-service/src/main/java/com/zbkj/service/service/impl/OrderTaskServiceImpl.java b/food-service/src/main/java/com/zbkj/service/service/impl/OrderTaskServiceImpl.java index 58f0e63..a50b1de 100644 --- a/food-service/src/main/java/com/zbkj/service/service/impl/OrderTaskServiceImpl.java +++ b/food-service/src/main/java/com/zbkj/service/service/impl/OrderTaskServiceImpl.java @@ -156,7 +156,8 @@ public class OrderTaskServiceImpl implements OrderTaskService { continue; } try { - StoreOrder storeOrder = getJavaBeanStoreOrder(data); + StoreOrder storeOrder = new StoreOrder();// getJavaBeanStoreOrder(data); + storeOrder.setId(Integer.parseInt(data.toString())); boolean result = storeOrderTaskService.complete(storeOrder); if (!result) { redisUtil.lPush(redisKey, data); @@ -280,7 +281,10 @@ public class OrderTaskServiceImpl implements OrderTaskService { // 根据订单状态表判断订单是否可以自动完成 for (StoreOrder order : orderList) { StoreOrderStatus orderStatus = storeOrderStatusService.getLastByOrderId(order.getId()); - if (!"user_take_delivery".equals(orderStatus.getChangeType())) { + // 用户已收货 || 售后退款拒绝 || 售后退款成功 + if (!("user_take_delivery".equals(orderStatus.getChangeType()) + || "refund_refuse".equals(orderStatus.getChangeType()) + || "refund_price".equals(orderStatus.getChangeType()))) { logger.error("订单自动完成:订单记录最后一条不是收货状态,orderId = " + order.getId()); continue ; } @@ -288,7 +292,7 @@ public class OrderTaskServiceImpl implements OrderTaskService { // 快递是7天,配送是2天 String comTime = DateUtil.addDay(orderStatus.getCreateTime(), Integer.parseInt(delivery_auto_complete_num), Constants.DATE_FORMAT); int compareDate = DateUtil.compareDate(comTime, DateUtil.nowDateTime(Constants.DATE_FORMAT), Constants.DATE_FORMAT); - if (compareDate < 0) { + if (compareDate == 1) { continue ; } diff --git a/food-service/src/main/java/com/zbkj/service/service/impl/ShippingTemplatesRegionServiceImpl.java b/food-service/src/main/java/com/zbkj/service/service/impl/ShippingTemplatesRegionServiceImpl.java index c97f521..6c51f78 100644 --- a/food-service/src/main/java/com/zbkj/service/service/impl/ShippingTemplatesRegionServiceImpl.java +++ b/food-service/src/main/java/com/zbkj/service/service/impl/ShippingTemplatesRegionServiceImpl.java @@ -67,7 +67,7 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl(){{ add(0); }}; //getCityIdList(); }else{ cityIdList = CrmebUtil.stringToArray(shippingTemplatesRegionRequest.getCityId()); } @@ -86,9 +86,9 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl i PageParamRequest page = new PageParamRequest(); page.setPage(1); page.setLimit(999); - List list = homeService.selectPageFloorItem(query, page); - cartList = list.stream().filter(i-> i.getType() == 0).map(i -> { + List list = homeService.selectFloorItem(query, page); + List productIds = list.stream().filter(i -> i.getType() == 0).map(i -> Integer.parseInt(i.getJumpIds())).collect(Collectors.toList()); + if (productIds.isEmpty()) { throw new CrmebException("一键加入失败,未查询到商品"); } + Map> productAttrValues = storeProductAttrValueService.getListByProductIdAndType(productIds, Constants.PRODUCT_TYPE_NORMAL); + cartList = productIds.stream().map(i -> { CartRequest cart = new CartRequest(); cart.setCartNum(1); - cart.setProductId(Integer.parseInt(i.getJumpIds())); - cart.setProductAttrUnique(((ProductAttrValueVo) i.getProductValue().get(i.getProductAttr().get(0).getAttrValues())).getId() + ""); + cart.setProductId(i); + cart.setProductAttrUnique((productAttrValues.get(i)).get(0).getId() + ""); return cart; }).collect(Collectors.toList()); } diff --git a/food-service/src/main/java/com/zbkj/service/service/impl/StoreOrderServiceImpl.java b/food-service/src/main/java/com/zbkj/service/service/impl/StoreOrderServiceImpl.java index 9130589..dfc88af 100644 --- a/food-service/src/main/java/com/zbkj/service/service/impl/StoreOrderServiceImpl.java +++ b/food-service/src/main/java/com/zbkj/service/service/impl/StoreOrderServiceImpl.java @@ -522,7 +522,7 @@ public class StoreOrderServiceImpl extends ServiceImpl 0) { try { - //storeOrderRefundService.refund(request, storeOrder); + storeOrderRefundService.refund(request, storeOrder); } catch (Exception e) { e.printStackTrace(); throw new CrmebException("微信申请退款失败!"); diff --git a/food-service/src/main/java/com/zbkj/service/service/impl/StoreProductAttrServiceImpl.java b/food-service/src/main/java/com/zbkj/service/service/impl/StoreProductAttrServiceImpl.java index 7846128..e9d480c 100644 --- a/food-service/src/main/java/com/zbkj/service/service/impl/StoreProductAttrServiceImpl.java +++ b/food-service/src/main/java/com/zbkj/service/service/impl/StoreProductAttrServiceImpl.java @@ -11,6 +11,7 @@ import com.zbkj.service.service.StoreProductAttrService; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -84,7 +85,8 @@ public class StoreProductAttrServiceImpl extends ServiceImpl attrs = dao.selectList(lqw); + return attrs.stream().map(i-> i.setAttrValueList(Arrays.asList(i.getAttrValues().split(",")))).collect(Collectors.toList()); } @Override diff --git a/food-service/src/main/java/com/zbkj/service/service/impl/StoreProductRelationServiceImpl.java b/food-service/src/main/java/com/zbkj/service/service/impl/StoreProductRelationServiceImpl.java index 30d73ae..e1a186a 100644 --- a/food-service/src/main/java/com/zbkj/service/service/impl/StoreProductRelationServiceImpl.java +++ b/food-service/src/main/java/com/zbkj/service/service/impl/StoreProductRelationServiceImpl.java @@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zbkj.common.request.PageParamRequest; @@ -22,9 +23,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; +import java.util.*; +import java.util.stream.Collectors; /** * StoreProductRelationServiceImpl 接口实现 @@ -119,6 +119,18 @@ public class StoreProductRelationServiceImpl extends ServiceImpl getCollectCount(List productIdList, String type) { + QueryWrapper lqr = new QueryWrapper<>(); + lqr.select("product_id productId, count(id) count"); + lqr.in("product_id", productIdList); + lqr.eq("type", type); + lqr.groupBy("product_id"); + List list = dao.selectList(lqr); + Map returnMap = list.stream().collect(Collectors.toMap(StoreProductRelation::getProductId, StoreProductRelation::getCount)); + return returnMap; + } + /** * 获取用户当前是否喜欢该商品 * @param userId 用户id diff --git a/food-service/src/main/java/com/zbkj/service/service/impl/StoreProductReplyServiceImpl.java b/food-service/src/main/java/com/zbkj/service/service/impl/StoreProductReplyServiceImpl.java index 774a0ec..a403f8d 100644 --- a/food-service/src/main/java/com/zbkj/service/service/impl/StoreProductReplyServiceImpl.java +++ b/food-service/src/main/java/com/zbkj/service/service/impl/StoreProductReplyServiceImpl.java @@ -267,62 +267,59 @@ public class StoreProductReplyServiceImpl extends ServiceImpl 0 && goodCount > 0) { - replyChance = String.format("%.2f", ((goodCount.doubleValue() / sumCount.doubleValue()))); - } - - // 查询最后一条评论 - LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); - lqw.eq(StoreProductReply::getProductId, proId); - lqw.eq(StoreProductReply::getIsDel, false); - lqw.orderByDesc(StoreProductReply::getId); - lqw.last(" limit 1"); - StoreProductReply storeProductReply = dao.selectOne(lqw); - ProductReplyResponse productReplyResponse = new ProductReplyResponse(); - BeanUtils.copyProperties(storeProductReply, productReplyResponse); - // 评价图 - productReplyResponse.setPics(CrmebUtil.stringToArrayStr(storeProductReply.getPics())); - // 昵称 - String nickname = storeProductReply.getNickname(); - if (StrUtil.isNotBlank(nickname)) { - if (nickname.length() == 1) { - nickname = nickname.concat("**"); - } else if (nickname.length() == 2) { - nickname = nickname.substring(0, 1) + "**"; - } else { - nickname = nickname.substring(0, 1) + "**" + nickname.substring(nickname.length() - 1); + if (sumCount > 0) { + // 好评总数 + Integer goodCount = getCountByScore(proId, "good"); + // 好评率 + String replyChance = "0"; + if (sumCount > 0 && goodCount > 0) { + replyChance = String.format("%.2f", ((goodCount.doubleValue() / sumCount.doubleValue()))); } - productReplyResponse.setNickname(nickname); + // 查询最后一条评论 + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); + lqw.eq(StoreProductReply::getProductId, proId); + lqw.eq(StoreProductReply::getIsDel, false); + lqw.orderByDesc(StoreProductReply::getId); + lqw.last(" limit 1"); + StoreProductReply storeProductReply = dao.selectOne(lqw); + ProductReplyResponse productReplyResponse = new ProductReplyResponse(); + BeanUtils.copyProperties(storeProductReply, productReplyResponse); + // 评价图 + productReplyResponse.setPics(CrmebUtil.stringToArrayStr(storeProductReply.getPics())); + // 昵称 + String nickname = storeProductReply.getNickname(); + if (StrUtil.isNotBlank(nickname)) { + if (nickname.length() == 1) { + nickname = nickname.concat("**"); + } else if (nickname.length() == 2) { + nickname = nickname.substring(0, 1) + "**"; + } else { + nickname = nickname.substring(0, 1) + "**" + nickname.substring(nickname.length() - 1); + } + productReplyResponse.setNickname(nickname); + } + // 星数 = (商品评星 + 服务评星) / 2 + BigDecimal sumScore = new BigDecimal(storeProductReply.getProductScore() + storeProductReply.getServiceScore()); + BigDecimal divide = sumScore.divide(BigDecimal.valueOf(2L), 0, BigDecimal.ROUND_DOWN); + productReplyResponse.setScore(divide.intValue()); + response.setSumCount(sumCount); + response.setReplyChance(replyChance); + response.setProductReply(productReplyResponse); } - // 星数 = (商品评星 + 服务评星) / 2 - BigDecimal sumScore = new BigDecimal(storeProductReply.getProductScore() + storeProductReply.getServiceScore()); - BigDecimal divide = sumScore.divide(BigDecimal.valueOf(2L), 0, BigDecimal.ROUND_DOWN); - productReplyResponse.setScore(divide.intValue()); - - response.setSumCount(sumCount); - response.setReplyChance(replyChance); - response.setProductReply(productReplyResponse); // 查询一条问题 LambdaQueryWrapper lqwSpp = new LambdaQueryWrapper<>(); lqwSpp.eq(StoreProductProblem::getBusinessId, proId); int problemNum = storeProductProblemService.count(lqwSpp); - lqw.last(" limit 1"); - StoreProductProblem one = storeProductProblemService.getOne(lqwSpp); - ProductProblemResponse sppRes = new ProductProblemResponse(); - BeanUtils.copyProperties(one, sppRes); + ProductProblemResponse sppRes = null; + if (problemNum > 0) { + lqwSpp.last(" limit 1"); + StoreProductProblem one = storeProductProblemService.getOne(lqwSpp); + sppRes = new ProductProblemResponse(); + BeanUtils.copyProperties(one, sppRes); + } response.setProblemNum(problemNum); response.setProductProblem(sppRes); return response; @@ -338,7 +335,7 @@ public class StoreProductReplyServiceImpl extends ServiceImpl getH5List(GetReplyListRequest request, PageParamRequest pageParamRequest) { Page startPage = PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit()); Integer productId = request.getProductId(); - Integer type = request.getType(); + // Integer type = request.getType(); String tag = request.getTag(); String latest = request.getLatest(); String havePics = request.getHavePics(); @@ -346,22 +343,22 @@ public class StoreProductReplyServiceImpl extends ServiceImpl lqw = new LambdaQueryWrapper<>(); lqw.eq(StoreProductReply::getIsDel, false); lqw.eq(StoreProductReply::getProductId, productId); - if (null != type) { - //评价等级|0=全部,1=好评,2=中评,3=差评 - switch (type) { - case 1: - lqw.apply(" (product_score + service_score) >= 8"); - break; - case 2: - lqw.apply(" (product_score + service_score) < 8 and (product_score + service_score) > 4"); - break; - case 3: - lqw.apply(" (product_score + service_score) <= 4"); - break; - default: - break; - } - } +// if (null != type) { +// //评价等级|0=全部,1=好评,2=中评,3=差评 +// switch (type) { +// case 1: +// lqw.apply(" (product_score + service_score) >= 8"); +// break; +// case 2: +// lqw.apply(" (product_score + service_score) < 8 and (product_score + service_score) > 4"); +// break; +// case 3: +// lqw.apply(" (product_score + service_score) <= 4"); +// break; +// default: +// break; +// } +// } if (StringUtils.isNotBlank(tag)) { lqw.like(StoreProductReply::getReviewTags, tag); } @@ -370,8 +367,9 @@ public class StoreProductReplyServiceImpl extends ServiceImpl replyList = dao.selectList(lqw); List responseList = new ArrayList<>(); for (StoreProductReply productReply : replyList) { @@ -381,7 +379,7 @@ public class StoreProductReplyServiceImpl extends ServiceImpl storeProductPage = PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit()); List storeProducts = dao.selectList(lambdaQueryWrapper); List storeProductResponses = new ArrayList<>(); - for (StoreProduct product : storeProducts) { - StoreProductResponse storeProductResponse = new StoreProductResponse(); - BeanUtils.copyProperties(product, storeProductResponse); + if (!storeProducts.isEmpty()) { + List productIds = storeProducts.stream().map(StoreProduct::getId).collect(Collectors.toList()); + List cateIds = storeProducts.stream().flatMap(s -> Arrays.stream(s.getCateId().split(","))).map(Integer::parseInt).collect(Collectors.toList()); + Map collectMap = storeProductRelationService.getCollectCount(productIds, "collect"); + Map cateMap = categoryService.getListInId(cateIds); + for (StoreProduct product : storeProducts) { + StoreProductResponse storeProductResponse = new StoreProductResponse(); + BeanUtils.copyProperties(product, storeProductResponse); // StoreProductAttr storeProductAttrPram = new StoreProductAttr(); // storeProductAttrPram.setProductId(product.getId()).setType(Constants.PRODUCT_TYPE_NORMAL); // List attrs = attrService.getByEntity(storeProductAttrPram); @@ -253,17 +259,20 @@ public class StoreProductServiceImpl extends ServiceImpl cg = categoryService.getByIds(CrmebUtil.stringToArray(product.getCateId())); -// if (CollUtil.isEmpty(cg)) { -// storeProductResponse.setCateValues(""); -// } else { -// storeProductResponse.setCateValues(cg.stream().map(Category::getName).collect(Collectors.joining(","))); -// } -// -// storeProductResponse.setCollectCount( -// storeProductRelationService.getList(product.getId(),"collect").size()); - storeProductResponses.add(storeProductResponse); + // 处理分类中文 +// List cg = categoryService.getByIds(CrmebUtil.stringToArray(product.getCateId())); +// if (CollUtil.isEmpty(cg)) { +// storeProductResponse.setCateValues(""); +// } else { +// storeProductResponse.setCateValues(cg.stream().map(Category::getName).collect(Collectors.joining(","))); +// } + StringBuilder cateValues = new StringBuilder(); + List pCateIds = CrmebUtil.stringToArray(product.getCateId()); + for (Integer pCateId : pCateIds) { cateValues.append(cateMap.get(pCateId)).append(","); } + storeProductResponse.setCateValues(cateValues.length() > 0 ? cateValues.substring(0, cateValues.length() - 1) : ""); + storeProductResponse.setCollectCount(collectMap.isEmpty() ? 0 : collectMap.get(product.getId())); + storeProductResponses.add(storeProductResponse); + } } // 多条sql查询处理分页正确 return CommonPage.copyPageInfo(storeProductPage, storeProductResponses); @@ -282,6 +291,20 @@ public class StoreProductServiceImpl extends ServiceImpl saveBatch(List list) { + List errName = new ArrayList<>(); + for (StoreProductAddRequest addVo : list) { +// try { +// save(addVo); +// } catch (Exception e) { + logger.info("导入失败,商品名称:" + addVo.getStoreName()); + errName.add(addVo.getStoreName()); +// } + } + return CommonResult.success(!errName.isEmpty() ? "导入失败商品:【" + errName.stream().collect(Collectors.joining(",")) + "】" : "导入成功"); + } + /** * 新增产品 * @param request 新增产品request对象 @@ -304,16 +327,12 @@ public class StoreProductServiceImpl extends ServiceImpl attrValueAddRequestList = request.getAttrValue(); //计算价格 @@ -372,7 +391,7 @@ public class StoreProductServiceImpl extends ServiceImpl 0 ? systemAttachmentService.clearPrefix(request.getContent()) : ""); + spd.setDescription(StringUtils.isNotEmpty(request.getContent()) ? systemAttachmentService.clearPrefix(request.getContent()) : ""); spd.setType(Constants.PRODUCT_TYPE_NORMAL); Boolean execute = transactionTemplate.execute(e -> { @@ -384,7 +403,7 @@ public class StoreProductServiceImpl extends ServiceImpl activityList) { if (CollUtil.isEmpty(activityList)) { - return "0, 1, 2, 3"; + return "0"; } List activities = new ArrayList<>(); activityList.forEach(e->{ @@ -605,7 +624,7 @@ public class StoreProductServiceImpl extends ServiceImpl getH5Detail(List productIds) { + @Override + public Map getH5Detail(List productIds) { LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); lqw.select(StoreProduct::getId, StoreProduct::getImage, StoreProduct::getStoreName, StoreProduct::getSliderImage, StoreProduct::getOtPrice, StoreProduct::getStock, StoreProduct::getSales, StoreProduct::getPrice, StoreProduct::getActivity, @@ -1313,7 +1335,10 @@ public class StoreProductServiceImpl extends ServiceImpl lqw = Wrappers.lambdaQuery(); lqw.select(StoreProduct::getId, StoreProduct::getImage, StoreProduct::getStoreName, StoreProduct::getSliderImage, StoreProduct::getQualityTest, StoreProduct::getOtPrice, StoreProduct::getStock, StoreProduct::getSales, StoreProduct::getPrice, StoreProduct::getActivity, StoreProduct::getSpecType, - StoreProduct::getFicti, StoreProduct::getIsSub, StoreProduct::getStoreInfo, StoreProduct::getBrowse, StoreProduct::getUnitName, StoreProduct::getTags); + StoreProduct::getFicti, StoreProduct::getIsSub, StoreProduct::getStoreInfo, StoreProduct::getBrowse, StoreProduct::getUnitName, StoreProduct::getTags, + StoreProduct::getIsShow, StoreProduct::getAddTime + ); + lqw.eq(StoreProduct::getId, id); lqw.eq(StoreProduct::getIsRecycle, false); lqw.eq(StoreProduct::getIsDel, false); diff --git a/food-service/src/main/java/com/zbkj/service/service/impl/SystemAttachmentServiceImpl.java b/food-service/src/main/java/com/zbkj/service/service/impl/SystemAttachmentServiceImpl.java index 1677f76..f331019 100644 --- a/food-service/src/main/java/com/zbkj/service/service/impl/SystemAttachmentServiceImpl.java +++ b/food-service/src/main/java/com/zbkj/service/service/impl/SystemAttachmentServiceImpl.java @@ -76,7 +76,8 @@ public class SystemAttachmentServiceImpl extends ServiceImpl select t.id cid, t.name from ( - select c.id, c.name, c.sort from eb_home h - INNER JOIN eb_home_item hp on h.id = hp.home_id - INNER JOIN eb_category c on h.business = c.id - JOIN help_topic b ON b.help_topic_id (length(h.channel) - length(replace(h.channel,',','')) + 1) - where h.del_flag = 1 and hp.del_flag = 1 - and substring_index(SUBSTRING_INDEX(h.channel, ',', b.help_topic_id + 1), ',', -1) = 2 - group by h.business + select c.id, c.name, c.sort from eb_home h + inner join eb_home_item hp on h.id = hp.home_id + inner join eb_category c on h.business = c.id + where h.del_flag = 1 and hp.del_flag = 1 and FIND_IN_SET(2, h.channel) + group by h.business ) t order by t.sort diff --git a/food-service/src/main/resources/mapper/store/ReviewTagMapper.xml b/food-service/src/main/resources/mapper/store/ReviewTagMapper.xml index c30210a..7ce3587 100644 --- a/food-service/src/main/resources/mapper/store/ReviewTagMapper.xml +++ b/food-service/src/main/resources/mapper/store/ReviewTagMapper.xml @@ -5,14 +5,11 @@ diff --git a/food-service/src/main/resources/mapper/store/StoreProductProblemMapper.xml b/food-service/src/main/resources/mapper/store/StoreProductProblemMapper.xml index f911859..e126877 100644 --- a/food-service/src/main/resources/mapper/store/StoreProductProblemMapper.xml +++ b/food-service/src/main/resources/mapper/store/StoreProductProblemMapper.xml @@ -9,6 +9,7 @@ u.uid userId, u.nickname nickName, u.avatar, + c.title, c.content, DATE_FORMAT(c.create_time, '%Y-%m-%d %H:%i:%s') createTime, (select count(1) from eb_store_product_problem c1 where c1.top_id = c.id and c1.top_id ]]> 0 and c1.is_del = 0) sonNum @@ -23,6 +24,7 @@ u.uid userId, u.nickname nickName, u.avatar, + a.title, a.content, DATE_FORMAT(a.create_time, '%Y-%m-%d %H:%i:%s') createTime, u1.nickname beReplier diff --git a/food-service/src/main/resources/mapper/store/StoreProductReplyMapper.xml b/food-service/src/main/resources/mapper/store/StoreProductReplyMapper.xml index 605ff1d..8bd226f 100644 --- a/food-service/src/main/resources/mapper/store/StoreProductReplyMapper.xml +++ b/food-service/src/main/resources/mapper/store/StoreProductReplyMapper.xml @@ -4,12 +4,22 @@