调整
This commit is contained in:
parent
2602d29a4e
commit
964cd199ff
@ -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<HomeRateResponse> indexDate() {
|
||||
return CommonResult.success(homeService.indexDate());
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户曲线图
|
||||
*/
|
||||
@PreAuthorize("hasAuthority('admin:statistics:home:chart:user')")
|
||||
@ApiOperation(value = "用户曲线图")
|
||||
@RequestMapping(value = "/chart/user", method = RequestMethod.GET)
|
||||
public CommonResult<Map<Object, Object>> 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<Map<String, Integer>> 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<Map<String, Object>> 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<Map<String, Object>> 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<Map<String, Object>> 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<Map<String, Object>> chartOrderInYear() {
|
||||
return CommonResult.success(homeService.chartOrderInYear());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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<String> export(@RequestParam("multipart") MultipartFile multipart) {
|
||||
try {
|
||||
ExcelValidUtil.canImport(multipart);
|
||||
List<StoreProductAddRequest> list = (List<StoreProductAddRequest>) ExcelImportUtil.importExcelByIs(multipart.getInputStream(), StoreProductAddRequest.class, new ImportParams());
|
||||
CommonResult<String> result = storeProductService.saveBatch(list);
|
||||
return result;
|
||||
} catch (Exception e) { e.printStackTrace(); }
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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<HomeRateResponse> indexDate() {
|
||||
return CommonResult.success(homeService.indexDate());
|
||||
// @PreAuthorize("hasAuthority('admin:home:list')")
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<HomeVo>> 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<Map<Object, Object>> chartUser() {
|
||||
return CommonResult.success(homeService.chartUser());
|
||||
// @PreAuthorize("hasAuthority('admin:home:save')")
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> 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<Map<String, Integer>> chartUserBuy() {
|
||||
return CommonResult.success(homeService.chartUserBuy());
|
||||
// @PreAuthorize("hasAuthority('admin:home:delete')")
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
||||
public CommonResult<String> 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<Map<String, Object>> chartOrder() {
|
||||
return CommonResult.success(homeService.chartOrder());
|
||||
// @PreAuthorize("hasAuthority('admin:home:update')")
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> 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<Map<String, Object>> 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<Map<String, Object>> 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<Map<String, Object>> chartOrderInYear() {
|
||||
return CommonResult.success(homeService.chartOrderInYear());
|
||||
}
|
||||
@PreAuthorize("hasAuthority('admin:home:info')")
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
public CommonResult<HomeVo> info(@RequestParam(value = "id") Integer id) {
|
||||
Home home = homeService.getById(id);
|
||||
HomeVo homeVo = new HomeVo();
|
||||
BeanUtils.copyProperties(home, homeVo);
|
||||
return CommonResult.success(homeVo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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<CommonPage<HomeItemVo>> 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<String> 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<String> delete(@RequestParam(value = "ids") String ids) {
|
||||
List<Integer> 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<String> 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<HomeItemVo> info(@RequestParam(value = "id") Integer id) {
|
||||
HomeItem homeItem = homeItemService.getById(id);
|
||||
HomeItemVo homeItemVo = new HomeItemVo();
|
||||
BeanUtils.copyProperties(homeItem, homeItemVo);
|
||||
return CommonResult.success(homeItemVo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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<String> delete(@RequestBody Integer[] ids) {
|
||||
System.out.println("111");
|
||||
// if (helpService.removeByIds(Arrays.asList(ids))) {
|
||||
public CommonResult<String> delete(@RequestParam(value = "ids") String ids) {
|
||||
List<Integer> idList = Arrays.stream(ids.split(",")).map(Integer::parseInt).collect(Collectors.toList());
|
||||
if (helpService.removeByIds(idList)) {
|
||||
return CommonResult.success();
|
||||
// }
|
||||
// return CommonResult.failed();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -214,13 +214,32 @@
|
||||
</dependency>
|
||||
|
||||
<!--导出excel-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.apache.poi</groupId>-->
|
||||
<!-- <artifactId>poi</artifactId>-->
|
||||
<!-- <version>4.1.2</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.apache.poi</groupId>-->
|
||||
<!-- <artifactId>poi-ooxml</artifactId>-->
|
||||
<!-- <version>4.1.2</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>3.14</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>3.14</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>3.14</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Apache Commons FileUpload -->
|
||||
|
@ -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 "";
|
||||
}
|
@ -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
|
||||
|
@ -163,5 +163,6 @@ public class StoreProduct implements Serializable {
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "标签")
|
||||
private String tags;
|
||||
private String tags = "";
|
||||
|
||||
}
|
||||
|
@ -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<String> attrValueList;
|
||||
|
||||
@ApiModelProperty(value = "活动类型 0=商品,1=秒杀,2=砍价,3=拼团")
|
||||
private Integer type;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
}
|
@ -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<HomeItemVo> items;
|
||||
|
||||
}
|
@ -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<String> activity;
|
||||
|
||||
@Excel(exportName = "商品属性")
|
||||
@ApiModelProperty(value = "商品属性", required = true)
|
||||
@NotEmpty(message = "商品属性不能为空")
|
||||
private List<StoreProductAttrAddRequest> attr;
|
||||
|
||||
@Excel(exportName = "商品属性详情")
|
||||
@ApiModelProperty(value = "商品属性详情", required = true)
|
||||
@NotEmpty(message = "商品属性详情不能为空")
|
||||
private List<StoreProductAttrValueAddRequest> attrValue;
|
||||
|
||||
@Excel(exportName = "商品描述")
|
||||
@ApiModelProperty(value = "商品描述")
|
||||
private String content;
|
||||
|
||||
@Excel(exportName = "质检报告")
|
||||
@ApiModelProperty(value = "质检报告")
|
||||
private String qualityTest;
|
||||
|
||||
@ApiModelProperty(value = "优惠券id集合")
|
||||
private List<Integer> couponIds;
|
||||
|
||||
@Excel(exportName = "展示图")
|
||||
@ApiModelProperty(value = "展示图")
|
||||
@Length(max = 1000, message = "展示图名称长度不能超过1000个字符")
|
||||
private String flatPattern;
|
||||
|
||||
@Excel(exportName = "标签")
|
||||
@ApiModelProperty(value = "标签")
|
||||
private String tags;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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<String> tagList = new ArrayList<>();
|
||||
|
||||
@ApiModelProperty(value = "规格 false单 true多")
|
||||
private Boolean specType;
|
||||
|
||||
@ApiModelProperty(value = "产品属性")
|
||||
private List<ProductAttrVo> productAttr;
|
||||
|
||||
@ApiModelProperty(value = "商品属性详情")
|
||||
private HashMap<String, Object> productValue;
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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<StoreProductAttr> productAttr;
|
||||
|
||||
@ApiModelProperty(value = "商品属性详情")
|
||||
private HashMap<String, Object> productValue;
|
||||
|
||||
// @ApiModelProperty(value = "返佣金额区间")
|
||||
// private String priceName;
|
||||
|
||||
// @ApiModelProperty(value = "为移动端特定参数 所有参与的活动")
|
||||
// private List<ProductActivityItemResponse> 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<StoreProductAttr> productAttr;
|
||||
//
|
||||
// @ApiModelProperty(value = "商品属性详情")
|
||||
// private HashMap<String, Object> productValue;
|
||||
//
|
||||
//// @ApiModelProperty(value = "返佣金额区间")
|
||||
//// private String priceName;
|
||||
//
|
||||
//// @ApiModelProperty(value = "为移动端特定参数 所有参与的活动")
|
||||
//// private List<ProductActivityItemResponse> activityAllH5;
|
||||
//
|
||||
// @ApiModelProperty(value = "商品信息")
|
||||
// private StoreProductResponse productInfo;
|
||||
//
|
||||
// @ApiModelProperty(value = "收藏标识")
|
||||
// private Boolean userCollect;
|
||||
//
|
||||
//}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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 = "评论内容")
|
||||
|
@ -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<String> 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<ProductActivityItemResponse> activityAllH5;
|
||||
|
||||
@ApiModelProperty(value = "商品属性")
|
||||
private List<StoreProductAttr> attr;
|
||||
|
||||
// @ApiModelProperty(value = "商品属性")
|
||||
// private List<StoreProductAttr> attr;
|
||||
//
|
||||
@ApiModelProperty(value = "商品属性详情")
|
||||
private List<StoreProductAttrValueResponse> attrValue;
|
||||
|
||||
@ApiModelProperty(value = "产品属性")
|
||||
private List<StoreProductAttr> productAttr;
|
||||
|
||||
@ApiModelProperty(value = "商品属性详情")
|
||||
private HashMap<String, Object> productValue;
|
||||
|
||||
@ApiModelProperty(value = "收藏标识:true已收藏,false未收藏")
|
||||
private Boolean userCollect;
|
||||
|
||||
// @ApiModelProperty(value = "管理端用于映射attrResults")
|
||||
// private List<HashMap<String,Object>> 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<StoreCoupon> coupons;
|
||||
|
@ -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<StoreProductAttr> productAttr;
|
||||
|
||||
@ApiModelProperty(value = "商品属性详情")
|
||||
private HashMap<String, Object> productValue;
|
||||
|
||||
}
|
@ -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<Method> setMethods;
|
||||
|
||||
private List<ExcelImportEntity> 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<ExcelImportEntity> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<ExcelImportEntity> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public Method getSetMethod() {
|
||||
return setMethod;
|
||||
}
|
||||
|
||||
public void setSetMethod(Method setMethod) {
|
||||
this.setMethod = setMethod;
|
||||
}
|
||||
|
||||
public List<Method> getSetMethods() {
|
||||
return setMethods;
|
||||
}
|
||||
|
||||
public void setSetMethods(List<Method> 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;
|
||||
}
|
||||
|
||||
}
|
@ -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<T> result = new ArrayList<T>();
|
||||
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<? extends T> importExcel(Collection<T> result, Sheet sheet,
|
||||
Class<?> pojoClass, ImportParams params) throws Exception {
|
||||
Collection collection = new ArrayList();
|
||||
Map<String, ExcelImportEntity> excelParams = new HashMap<String, ExcelImportEntity>();
|
||||
Field fileds[] = ExcelPublicUtil.getClassFields(pojoClass);
|
||||
getAllExcelField(fileds, excelParams, pojoClass, null);
|
||||
Iterator<Row> rows = sheet.rowIterator();
|
||||
for (int j = 0; j < params.getTitleRows(); j++) {
|
||||
rows.next();
|
||||
}
|
||||
Row row = null;
|
||||
Iterator<Cell> cellTitle;
|
||||
Map<Integer, String> titlemap = new HashMap<Integer, String>();
|
||||
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<String, ExcelImportEntity> 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<Method> 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<Method> 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<String, ExcelImportEntity> excelParams, Class<?> pojoClass,
|
||||
List<Method> 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<Method> newMethods = new ArrayList<Method>();
|
||||
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<Method> getMethods, Map<String, ExcelImportEntity> temp) throws Exception {
|
||||
Excel excel = field.getAnnotation(Excel.class);
|
||||
excelEntity = new ExcelImportEntity();
|
||||
getExcelField(field, excelEntity, excel, pojoClass);
|
||||
if (getMethods != null) {
|
||||
List<Method> newMethods = new ArrayList<Method>();
|
||||
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<String, ExcelImportEntity> excelParams = new HashMap<String, ExcelImportEntity>();
|
||||
Field fileds[] = ExcelPublicUtil.getClassFields(pojoClass);
|
||||
getAllExcelField(fileds, excelParams, pojoClass, null);
|
||||
Set<String> nemeSet = excelParams.keySet();
|
||||
List<String> listExcelTitleName = new ArrayList<String>(nemeSet);
|
||||
|
||||
Sheet sheet = book.getSheetAt(0);
|
||||
Row row = null;
|
||||
Iterator<Cell> cellTitle;
|
||||
List<String> sheetTitleNames = new ArrayList<String>();
|
||||
Iterator<Row> 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<String> resultList = new ArrayList<String>();
|
||||
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<T> result = new ArrayList<T>();
|
||||
if (!(inputstream.markSupported())) {
|
||||
inputstream = new PushbackInputStream(inputstream, 8);
|
||||
}
|
||||
Workbook book = WorkbookFactory.create(inputstream);
|
||||
return book.getSheetName(0);
|
||||
}
|
||||
}
|
@ -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<Field> list = new ArrayList<Field>();
|
||||
Field[] fields;
|
||||
do{
|
||||
fields = clazz.getDeclaredFields();
|
||||
for(int i = 0;i<fields.length;i++){
|
||||
list.add(fields[i]);
|
||||
}
|
||||
clazz = clazz.getSuperclass();
|
||||
}while(clazz!= Object.class&&clazz!=null);
|
||||
return list.toArray(fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是不是集合的实现类
|
||||
* @param clazz
|
||||
* @return
|
||||
*/
|
||||
public static boolean isCollection(Class<?> 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<String, PictureData> getSheetPictrues03(HSSFSheet sheet,
|
||||
HSSFWorkbook workbook) {
|
||||
Map<String, PictureData> sheetIndexPicMap = new HashMap<String, PictureData>();
|
||||
List<HSSFPictureData> 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<String, PictureData>) sheetIndexPicMap.put(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Excel2007图片
|
||||
* @param sheet 当前sheet对象
|
||||
* @param workbook 工作簿对象
|
||||
* @return Map key:图片单元格索引(1_1)String,value:图片流PictureData
|
||||
*/
|
||||
public static Map<String, PictureData> getSheetPictrues07(
|
||||
XSSFSheet sheet, XSSFWorkbook workbook) {
|
||||
Map<String, PictureData> sheetIndexPicMap = new HashMap<String, PictureData>();
|
||||
for (POIXMLDocumentPart dr : sheet.getRelations()) {
|
||||
if (dr instanceof XSSFDrawing) {
|
||||
XSSFDrawing drawing = (XSSFDrawing) dr;
|
||||
List<XSSFShape> 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;
|
||||
}
|
||||
|
||||
}
|
@ -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<?>> list, String[] titles, List<String> titles2, Integer beginRow, String sheeetName) {
|
||||
List<Map<String,Object>> titleList = new ArrayList<>();
|
||||
if (titles.length > 0) {
|
||||
Map<String, Object> 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, List<Map<String,Object>> titles, List<String> 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<String,Object> 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;
|
||||
}
|
||||
|
||||
}
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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<ProductAttrVo> productAttr;
|
||||
|
||||
@ApiModelProperty(value = "商品属性详情")
|
||||
private HashMap<String, Object> productValue;
|
||||
|
||||
@ApiModelProperty(value = "商品信息")
|
||||
private ProductInfoVo productInfo;
|
||||
|
||||
|
@ -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<HomeItemVo> items;
|
||||
|
@ -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<String> tagList = new ArrayList<>();
|
||||
|
||||
}
|
||||
|
@ -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<Object> getData(@RequestParam(value = "id") Integer id) {
|
||||
List<HashMap<String, Object>> 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<Object> getData(@RequestParam(value = "id") Integer id) {
|
||||
// List<HashMap<String, Object>> data = systemGroupDataService.getListMapByGid(id);
|
||||
// return CommonResult.success(data);
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//
|
||||
//
|
||||
|
@ -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<CommonPage<HelpResponse>> getListArticle(@PathVariable(name="cid") String cid, @Validated PageParamRequest pageParamRequest) {
|
||||
public CommonResult<CommonPage<HelpResponse>> getListArticle(@PathVariable(name="cid") Integer cid, @Validated PageParamRequest pageParamRequest) {
|
||||
SystemHelpProblem entity = new SystemHelpProblem();
|
||||
entity.setCid(cid);
|
||||
entity.setStatus(true);
|
||||
|
@ -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<CommonPage<ProductProblemResponse>> 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<CommonPage<ProductProblemResponse>> getSonResponseList(@PathVariable Integer majorId, @Validated PageParamRequest pageParamRequest) {
|
||||
// return CommonResult.success(storeProductProblemService.getSonResponseList(majorId, pageParamRequest));
|
||||
// }
|
||||
|
||||
@ApiOperation(value = "常见问题-提问/回复")
|
||||
@PostMapping("/commit")
|
||||
|
@ -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<ProductDetailResponse> getDetail(@PathVariable Integer id, @RequestParam(value = "type", defaultValue = "normal") String type) {
|
||||
return CommonResult.success(productService.getDetail(id, type));
|
||||
public CommonResult<StoreProductResponse> 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<ProductDetailResponse> getSkuDetail(@PathVariable Integer id) {
|
||||
public CommonResult<StoreProductSkuResponse> getSkuDetail(@PathVariable Integer id) {
|
||||
return CommonResult.success(productService.getSkuDetail(id));
|
||||
}
|
||||
|
||||
|
@ -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<Object> getExpressInfo(@PathVariable String orderId) {
|
||||
return CommonResult.success(orderService.expressOrder(orderId));
|
||||
}
|
||||
// /**
|
||||
// * 根据订单号查询物流信息
|
||||
// * @param orderId 订单号
|
||||
// * @return 物流信息
|
||||
// */
|
||||
// @ApiOperation(value = "物流信息查询")
|
||||
// @RequestMapping(value = "/express/{orderId}", method = RequestMethod.GET)
|
||||
// public CommonResult<Object> getExpressInfo(@PathVariable String orderId) {
|
||||
// return CommonResult.success(orderService.expressOrder(orderId));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取支付配置
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
/**
|
||||
* 商品评论列表
|
||||
|
@ -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));// 客服电话服务
|
||||
// 保存用户访问记录
|
||||
|
@ -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<StoreProductAttr> attrList = attrService.getListByProductIdAndType(storeProduct.getId(), Constants.PRODUCT_TYPE_NORMAL);
|
||||
// 根据制式设置attr属性
|
||||
productDetailResponse.setProductAttr(attrList);
|
||||
spResponse.setProductAttr(attrList);
|
||||
|
||||
// 根据制式设置sku属性
|
||||
HashMap<String, Object> 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<ProductActivityItemResponse> 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<StoreProductAttr> attrList = attrService.getListByProductIdAndType(storeProduct.getId(), Constants.PRODUCT_TYPE_NORMAL);
|
||||
// 根据制式设置attr属性
|
||||
productDetailResponse.setProductAttr(attrList);
|
||||
spResponse.setProductAttr(attrList);
|
||||
|
||||
// 根据制式设置sku属性
|
||||
HashMap<String, Object> 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<HomeVo> homeVos = ebHomeService.selectPageFloor(floor, page);
|
||||
if (!homeVos.isEmpty()) {
|
||||
@ -365,36 +363,31 @@ public class ProductServiceImpl implements ProductService {
|
||||
|
||||
private CommonPage<IndexProductResponse> resultIndexProductResponse(List<StoreProduct> storeProductList) {
|
||||
CommonPage<StoreProduct> storeProductCommonPage = CommonPage.restPage(storeProductList);
|
||||
Map<Integer, ProductDetailVo> skuDetails = storeProductService.getSkuDetails(storeProductList.stream().map(StoreProduct::getId).collect(Collectors.toList()));
|
||||
List<IndexProductResponse> 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<Integer> activityList = CrmebUtil.stringToArrayInt(storeProduct.getActivity());
|
||||
// 活动类型默认:直接跳过
|
||||
if (activityList.get(0).equals(Constants.PRODUCT_TYPE_NORMAL)) {
|
||||
productResponseArrayList.add(productResponse);
|
||||
continue;
|
||||
}
|
||||
// 根据参与活动添加对应商品活动标示
|
||||
HashMap<Integer, ProductActivityItemResponse> 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<Integer> activityList = CrmebUtil.stringToArrayInt(storeProduct.getActivity());
|
||||
// // 活动类型默认:直接跳过
|
||||
// if (activityList.get(0).equals(Constants.PRODUCT_TYPE_NORMAL)) {
|
||||
// productResponseArrayList.add(productResponse);
|
||||
// continue;
|
||||
// }
|
||||
// // 根据参与活动添加对应商品活动标示
|
||||
// HashMap<Integer, ProductActivityItemResponse> 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<IndexProductResponse> productResponseCommonPage = CommonPage.restPage(productResponseArrayList);
|
||||
@ -449,7 +442,6 @@ public class ProductServiceImpl implements ProductService {
|
||||
|
||||
User user = userService.getInfo();
|
||||
List<IndexProductResponse> productResponseArrayList = new ArrayList<>();
|
||||
Map<Integer, ProductDetailVo> 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<IndexProductResponse> productResponseCommonPage = CommonPage.restPage(productResponseArrayList);
|
||||
|
@ -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<HomeItem> {
|
||||
|
||||
List<HomeItemVo> getAdminList(HomeItemRequest request, PageParamRequest pageParamRequest);
|
||||
|
||||
}
|
||||
|
@ -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<Home> {
|
||||
|
||||
List<HomeItemVo> selectPageFloorItem(FloorProRequest entity, PageParamRequest page);
|
||||
|
||||
List<HomeItemVo> selectFloorItem(FloorProRequest entity, PageParamRequest page);
|
||||
|
||||
List<HomeVo> getAdminList(HomeRequest request, PageParamRequest pageParamRequest);
|
||||
|
||||
boolean create(HomeRequest request);
|
||||
|
||||
boolean deleteById(Integer id);
|
||||
|
||||
}
|
||||
|
||||
|
@ -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<StoreProductRelati
|
||||
*/
|
||||
Boolean all(UserCollectAllRequest request);
|
||||
|
||||
List<StoreProductRelation> getLikeOrCollectByUser(Integer userId, Integer productId,boolean isLike);
|
||||
Map<Integer, Integer> getCollectCount(List<Integer> productIdList, String type);
|
||||
|
||||
List<StoreProductRelation> getLikeOrCollectByUser(Integer userId, Integer productId, boolean isLike);
|
||||
|
||||
/**
|
||||
* 获取用户收藏列表
|
||||
|
@ -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<StoreProduct> {
|
||||
*/
|
||||
List<StoreProduct> getListInIds(List<Integer> productIds);
|
||||
|
||||
/**
|
||||
* 批量新增商品
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
CommonResult<String> saveBatch(List<StoreProductAddRequest> list);
|
||||
|
||||
/**
|
||||
* 新增商品
|
||||
* @param request 商品请求对象
|
||||
@ -163,6 +167,8 @@ public interface StoreProductService extends IService<StoreProduct> {
|
||||
*/
|
||||
List<StoreProduct> findH5List(ProductRequest request, PageParamRequest pageRequest);
|
||||
|
||||
Map<Integer, StoreProduct> getH5Detail(List<Integer> productIds);
|
||||
|
||||
/**
|
||||
* 获取移动端商品详情
|
||||
* @param id 商品id
|
||||
|
@ -84,7 +84,9 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, Category> impl
|
||||
@Override
|
||||
public List<Category> getByIds(List<Integer> idList) {
|
||||
LambdaQueryWrapper<Category> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(Category::getId, idList);
|
||||
if (!idList.isEmpty()) {
|
||||
lambdaQueryWrapper.in(Category::getId, idList);
|
||||
}
|
||||
return dao.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
|
@ -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<HomeItemDao, HomeItem> implements EbHomeItemService {
|
||||
|
||||
@Autowired private HomeItemDao dao;
|
||||
|
||||
@Override
|
||||
public List<HomeItemVo> getAdminList(HomeItemRequest request, PageParamRequest pageParamRequest) {
|
||||
PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
||||
LambdaQueryWrapper<HomeItem> 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<HomeItem> itemList = dao.selectList(lambdaQueryWrapper);
|
||||
List<HomeItemVo> itemVoArrayList = JSON.parseArray(JSON.toJSONString(itemList), HomeItemVo.class);
|
||||
return itemVoArrayList;
|
||||
}
|
||||
}
|
@ -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<HomeDao, Home> 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<HomeDao, Home> implements EbH
|
||||
fpPage.setPage(1);
|
||||
fpPage.setLimit(5);
|
||||
FloorProRequest fp = new FloorProRequest();
|
||||
fp.setHomeId(homeVo.getHomeId());
|
||||
fp.setHomeId(homeVo.getId());
|
||||
List<HomeItemVo> fpResult = selectPageFloorItem(fp, fpPage);
|
||||
homeVo.setItems(fpResult);
|
||||
}
|
||||
@ -64,7 +74,7 @@ public class EbHomeServiceImpl extends ServiceImpl<HomeDao, Home> implements EbH
|
||||
fpPage.setPage(1);
|
||||
fpPage.setLimit(5);
|
||||
FloorProRequest fp = new FloorProRequest();
|
||||
fp.setHomeId(home.getHomeId());
|
||||
fp.setHomeId(home.getId());
|
||||
List<HomeItemVo> fpResult = selectPageFloorItem(fp, fpPage);
|
||||
home.setItems(fpResult);
|
||||
}
|
||||
@ -73,22 +83,72 @@ public class EbHomeServiceImpl extends ServiceImpl<HomeDao, Home> implements EbH
|
||||
|
||||
@Override
|
||||
public List<HomeItemVo> selectPageFloorItem(FloorProRequest entity, PageParamRequest page) {
|
||||
PageHelper.startPage(page.getPage(), page.getLimit());
|
||||
List<HomeItemVo> list = homeItemDao.selectHomeItem(entity.getHomeId());
|
||||
PageHelper.clearPage();
|
||||
List<HomeItemVo> list = selectFloorItem(entity, page);
|
||||
List<HomeItemVo> proList = list.stream().filter(i -> i.getType() == 0).collect(Collectors.toList());
|
||||
if (!proList.isEmpty()) {
|
||||
List<Integer> pIds = proList.stream().map(HomeItemVo::getJumpIds).map(Integer::valueOf).collect(Collectors.toList());
|
||||
Map<Integer, ProductDetailVo> skuDetails = productService.getSkuDetails(pIds);
|
||||
Map<Integer, StoreProduct> 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<HomeItemVo> selectFloorItem(FloorProRequest entity, PageParamRequest page) {
|
||||
PageHelper.startPage(page.getPage(), page.getLimit());
|
||||
List<HomeItemVo> list = homeItemDao.selectHomeItem(entity.getHomeId());
|
||||
PageHelper.clearPage();
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HomeVo> getAdminList(HomeRequest request, PageParamRequest pageParamRequest) {
|
||||
PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
||||
LambdaQueryWrapper<Home> 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<Home> homeList = dao.selectList(lambdaQueryWrapper);
|
||||
List<HomeVo> 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<HomeItemVo> items = request.getItems();
|
||||
List<HomeItem> 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<HomeItem> lq = new LambdaQueryWrapper<>();
|
||||
lq.eq(HomeItem::getHomeId, id);
|
||||
List<HomeItem> homeItems = homeItemDao.selectList(lq);
|
||||
homeItems.forEach(i-> homeItemDao.deleteById(i.getId()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
@ -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 ;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl<ShippingTemp
|
||||
String uniqueKey = DigestUtils.md5Hex(shippingTemplatesRegionRequest.toString());
|
||||
|
||||
if("all".equals(shippingTemplatesRegionRequest.getCityId()) || "0".equals(shippingTemplatesRegionRequest.getCityId())){
|
||||
cityIdList = getCityIdList();
|
||||
cityIdList = new ArrayList<Integer>(){{ add(0); }}; //getCityIdList();
|
||||
}else{
|
||||
cityIdList = CrmebUtil.stringToArray(shippingTemplatesRegionRequest.getCityId());
|
||||
}
|
||||
@ -86,9 +86,9 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl<ShippingTemp
|
||||
shippingTemplatesRegionList.add(shippingTemplatesRegion);
|
||||
}
|
||||
}
|
||||
//批量保存模板数据
|
||||
// 批量保存模板数据
|
||||
saveBatch(shippingTemplatesRegionList);
|
||||
//删除模板下的无效数据
|
||||
// 删除模板下的无效数据
|
||||
delete(tempId);
|
||||
}
|
||||
|
||||
|
@ -206,12 +206,15 @@ public class StoreCartServiceImpl extends ServiceImpl<StoreCartDao, StoreCart> i
|
||||
PageParamRequest page = new PageParamRequest();
|
||||
page.setPage(1);
|
||||
page.setLimit(999);
|
||||
List<HomeItemVo> list = homeService.selectPageFloorItem(query, page);
|
||||
cartList = list.stream().filter(i-> i.getType() == 0).map(i -> {
|
||||
List<HomeItemVo> list = homeService.selectFloorItem(query, page);
|
||||
List<Integer> productIds = list.stream().filter(i -> i.getType() == 0).map(i -> Integer.parseInt(i.getJumpIds())).collect(Collectors.toList());
|
||||
if (productIds.isEmpty()) { throw new CrmebException("一键加入失败,未查询到商品"); }
|
||||
Map<Integer, List<StoreProductAttrValue>> 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());
|
||||
}
|
||||
|
@ -522,7 +522,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
//退款
|
||||
if (storeOrder.getPayType().equals(Constants.PAY_TYPE_WE_CHAT) && request.getAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
try {
|
||||
//storeOrderRefundService.refund(request, storeOrder);
|
||||
storeOrderRefundService.refund(request, storeOrder);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new CrmebException("微信申请退款失败!");
|
||||
|
@ -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<StoreProductAttrDao
|
||||
lqw.eq(StoreProductAttr::getProductId, productId);
|
||||
lqw.eq(StoreProductAttr::getType, type);
|
||||
lqw.eq(StoreProductAttr::getIsDel, false);
|
||||
return dao.selectList(lqw);
|
||||
List<StoreProductAttr> attrs = dao.selectList(lqw);
|
||||
return attrs.stream().map(i-> i.setAttrValueList(Arrays.asList(i.getAttrValues().split(",")))).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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<StoreProductRel
|
||||
return dao.selectList(lqr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Integer, Integer> getCollectCount(List<Integer> productIdList, String type) {
|
||||
QueryWrapper<StoreProductRelation> 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<StoreProductRelation> list = dao.selectList(lqr);
|
||||
Map<Integer, Integer> returnMap = list.stream().collect(Collectors.toMap(StoreProductRelation::getProductId, StoreProductRelation::getCount));
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户当前是否喜欢该商品
|
||||
* @param userId 用户id
|
||||
|
@ -267,62 +267,59 @@ public class StoreProductReplyServiceImpl extends ServiceImpl<StoreProductReplyD
|
||||
@Override
|
||||
public ProductDetailReplyResponse getH5ProductReply(Integer proId) {
|
||||
ProductDetailReplyResponse response = new ProductDetailReplyResponse();
|
||||
|
||||
// 评论总数
|
||||
Integer sumCount = getCountByScore(proId, "all");
|
||||
if (sumCount.equals(0)) {
|
||||
response.setSumCount(0);
|
||||
response.setReplyChance("0");
|
||||
return response;
|
||||
}
|
||||
// 好评总数
|
||||
Integer goodCount = getCountByScore(proId, "good");
|
||||
// 好评率
|
||||
String replyChance = "0";
|
||||
if (sumCount > 0 && goodCount > 0) {
|
||||
replyChance = String.format("%.2f", ((goodCount.doubleValue() / sumCount.doubleValue())));
|
||||
}
|
||||
|
||||
// 查询最后一条评论
|
||||
LambdaQueryWrapper<StoreProductReply> 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<StoreProductReply> 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<StoreProductProblem> 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<StoreProductReplyD
|
||||
public PageInfo<ProductReplyResponse> getH5List(GetReplyListRequest request, PageParamRequest pageParamRequest) {
|
||||
Page<StoreProductReply> 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<StoreProductReplyD
|
||||
LambdaQueryWrapper<StoreProductReply> 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<StoreProductReplyD
|
||||
}
|
||||
if (StringUtils.isNotBlank(latest)) {
|
||||
lqw.orderByDesc(StoreProductReply::getCreateTime);
|
||||
} else {
|
||||
lqw.last(" order by (product_score + service_score) desc");
|
||||
}
|
||||
// lqw.orderByDesc(StoreProductReply::getId);
|
||||
List<StoreProductReply> replyList = dao.selectList(lqw);
|
||||
List<ProductReplyResponse> responseList = new ArrayList<>();
|
||||
for (StoreProductReply productReply : replyList) {
|
||||
@ -381,7 +379,7 @@ public class StoreProductReplyServiceImpl extends ServiceImpl<StoreProductReplyD
|
||||
productReplyResponse.setPics(CrmebUtil.stringToArrayStr(productReply.getPics()));
|
||||
// 昵称
|
||||
String nickname = productReply.getNickname();
|
||||
if (StrUtil.isNotBlank(nickname)) {
|
||||
if (StrUtil.isNotBlank(nickname) && productReply.getIsPrivacy() == 0) {
|
||||
if (nickname.length() == 1) {
|
||||
nickname = nickname.concat("**");
|
||||
} else if (nickname.length() == 2) {
|
||||
@ -390,12 +388,13 @@ public class StoreProductReplyServiceImpl extends ServiceImpl<StoreProductReplyD
|
||||
nickname = nickname.substring(0, 1) + "**" + nickname.substring(nickname.length() - 1);
|
||||
}
|
||||
productReplyResponse.setNickname(nickname);
|
||||
} else if (productReply.getIsPrivacy() == 1) {
|
||||
productReplyResponse.setNickname("匿名吃货");
|
||||
}
|
||||
// 星数 = (商品评星 + 服务评星) / 2
|
||||
BigDecimal sumScore = new BigDecimal(productReply.getProductScore() + productReply.getServiceScore());
|
||||
BigDecimal divide = sumScore.divide(BigDecimal.valueOf(2L), 0, BigDecimal.ROUND_DOWN);
|
||||
productReplyResponse.setScore(divide.intValue());
|
||||
|
||||
responseList.add(productReplyResponse);
|
||||
}
|
||||
return CommonPage.copyPageInfo(startPage, responseList);
|
||||
|
@ -39,6 +39,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
@ -223,9 +224,14 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
Page<StoreProduct> storeProductPage = PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
||||
List<StoreProduct> storeProducts = dao.selectList(lambdaQueryWrapper);
|
||||
List<StoreProductResponse> storeProductResponses = new ArrayList<>();
|
||||
for (StoreProduct product : storeProducts) {
|
||||
StoreProductResponse storeProductResponse = new StoreProductResponse();
|
||||
BeanUtils.copyProperties(product, storeProductResponse);
|
||||
if (!storeProducts.isEmpty()) {
|
||||
List<Integer> productIds = storeProducts.stream().map(StoreProduct::getId).collect(Collectors.toList());
|
||||
List<Integer> cateIds = storeProducts.stream().flatMap(s -> Arrays.stream(s.getCateId().split(","))).map(Integer::parseInt).collect(Collectors.toList());
|
||||
Map<Integer, Integer> collectMap = storeProductRelationService.getCollectCount(productIds, "collect");
|
||||
Map<Integer, String> 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<StoreProductAttr> attrs = attrService.getByEntity(storeProductAttrPram);
|
||||
@ -253,17 +259,20 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
// if (null != sd) {
|
||||
// storeProductResponse.setContent(null == sd.getDescription()?"":sd.getDescription());
|
||||
// }
|
||||
// // 处理分类中文
|
||||
// List<Category> 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<Category> 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<Integer> 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<StoreProductDao, StoreP
|
||||
return dao.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<String> saveBatch(List<StoreProductAddRequest> list) {
|
||||
List<String> 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<StoreProductDao, StoreP
|
||||
|
||||
// 设置Acticity活动
|
||||
storeProduct.setActivity(getProductActivityStr(request.getActivity()));
|
||||
|
||||
//主图
|
||||
// 主图
|
||||
storeProduct.setImage(systemAttachmentService.clearPrefix(storeProduct.getImage()));
|
||||
|
||||
//轮播图
|
||||
// 轮播图
|
||||
storeProduct.setSliderImage(systemAttachmentService.clearPrefix(storeProduct.getSliderImage()));
|
||||
// 展示图
|
||||
if (StrUtil.isNotEmpty(storeProduct.getFlatPattern())) {
|
||||
storeProduct.setFlatPattern(systemAttachmentService.clearPrefix(storeProduct.getFlatPattern()));
|
||||
}
|
||||
storeProduct.setFlatPattern(systemAttachmentService.clearPrefix(storeProduct.getFlatPattern()));
|
||||
|
||||
List<StoreProductAttrValueAddRequest> attrValueAddRequestList = request.getAttrValue();
|
||||
//计算价格
|
||||
@ -372,7 +391,7 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
|
||||
// 处理富文本
|
||||
StoreProductDescription spd = new StoreProductDescription();
|
||||
spd.setDescription(request.getContent().length() > 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<StoreProductDao, StoreP
|
||||
storeProductAttrValueService.saveBatch(attrValueList);
|
||||
|
||||
spd.setProductId(storeProduct.getId());
|
||||
storeProductDescriptionService.deleteByProductId(storeProduct.getId(), Constants.PRODUCT_TYPE_NORMAL);
|
||||
// storeProductDescriptionService.deleteByProductId(storeProduct.getId(), Constants.PRODUCT_TYPE_NORMAL);
|
||||
storeProductDescriptionService.save(spd);
|
||||
|
||||
if (CollUtil.isNotEmpty(request.getCouponIds())) {
|
||||
@ -425,7 +444,7 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
*/
|
||||
private String getProductActivityStr(List<String> activityList) {
|
||||
if (CollUtil.isEmpty(activityList)) {
|
||||
return "0, 1, 2, 3";
|
||||
return "0";
|
||||
}
|
||||
List<Integer> activities = new ArrayList<>();
|
||||
activityList.forEach(e->{
|
||||
@ -605,7 +624,7 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
BeanUtils.copyProperties(storeProduct, storeProductResponse);
|
||||
StoreProductAttr spaPram = new StoreProductAttr();
|
||||
spaPram.setProductId(storeProduct.getId()).setType(Constants.PRODUCT_TYPE_NORMAL);
|
||||
storeProductResponse.setAttr(attrService.getByEntity(spaPram));
|
||||
storeProductResponse.setProductAttr(attrService.getByEntity(spaPram));
|
||||
|
||||
// 设置商品所参与的活动
|
||||
// storeProductResponse.setActivityH5(productUtils.getProductCurrentActivity(storeProduct));
|
||||
@ -1242,7 +1261,9 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
// id、名称、图片、价格、销量、活动
|
||||
lqw.select(StoreProduct::getId, StoreProduct::getStoreName, StoreProduct::getImage, StoreProduct::getPrice,
|
||||
StoreProduct::getActivity, StoreProduct::getSales, StoreProduct::getFicti, StoreProduct::getUnitName,
|
||||
StoreProduct::getFlatPattern, StoreProduct::getStock, StoreProduct::getTags);
|
||||
StoreProduct::getFlatPattern, StoreProduct::getStock, StoreProduct::getTags, StoreProduct::getStoreInfo,
|
||||
StoreProduct::getOtPrice, StoreProduct::getSpecType
|
||||
);
|
||||
|
||||
lqw.eq(StoreProduct::getIsRecycle, false);
|
||||
lqw.eq(StoreProduct::getIsDel, false);
|
||||
@ -1290,7 +1311,8 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
return dao.selectList(lqw);
|
||||
}
|
||||
|
||||
private Map<Integer, StoreProduct> getH5Detail(List<Integer> productIds) {
|
||||
@Override
|
||||
public Map<Integer, StoreProduct> getH5Detail(List<Integer> productIds) {
|
||||
LambdaQueryWrapper<StoreProduct> 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<StoreProductDao, StoreP
|
||||
LambdaQueryWrapper<StoreProduct> 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);
|
||||
|
@ -76,7 +76,8 @@ public class SystemAttachmentServiceImpl extends ServiceImpl<SystemAttachmentDao
|
||||
@Override
|
||||
public String prefixImage(String path) {
|
||||
// 如果那些域名不需要加,则跳过
|
||||
return path.replace(Constants.UPLOAD_TYPE_IMAGE+"/", getCdnUrl() + "/"+ Constants.UPLOAD_TYPE_IMAGE+"/");
|
||||
String str = path.replace(Constants.UPLOAD_TYPE_IMAGE+"/", getCdnUrl() + "/"+ Constants.UPLOAD_TYPE_IMAGE+"/");
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,26 +4,20 @@
|
||||
|
||||
<select id="selectPageSetMealType" resultType="com.zbkj.common.response.SetMealResponse">
|
||||
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 <![CDATA[<]]> (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
|
||||
</select>
|
||||
|
||||
<select id="selectPageFloor" resultType="com.zbkj.common.vo.HomeVo">
|
||||
select h.id homeId, h.name, h.title, h.img_url imgUrl, h.jump_type jumpType, h.jump_url jumpUrl, h.jump_ids jumpIds
|
||||
from eb_home h
|
||||
JOIN help_topic b ON b.help_topic_id <![CDATA[<]]> (length(h.channel) - length(replace(h.channel,',','')) + 1)
|
||||
where del_flag = 1
|
||||
and substring_index(SUBSTRING_INDEX(h.channel, ',', b.help_topic_id + 1), ',', -1) = #{entity.channel}
|
||||
and ((h.begin_time is null or h.end_time is null) or (h.begin_time <![CDATA[<=]]> NOW() and h.end_time >= NOW()))
|
||||
select h.id, h.name, h.title, h.img_url imgUrl, h.jump_type jumpType, h.jump_url jumpUrl, h.jump_ids jumpIds
|
||||
from eb_home h
|
||||
where FIND_IN_SET(${entity.channel}, h.channel)
|
||||
<if test="entity.channel == 2"> and h.business = #{entity.cid} </if>
|
||||
order by order_no
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@ -5,14 +5,11 @@
|
||||
|
||||
<select id="getReviewTagsByProductId" resultType="java.lang.String">
|
||||
select t.`name` from eb_review_tag t
|
||||
inner join eb_review_tag_category tc on t.id = tc.review_tag_id
|
||||
inner join (
|
||||
select
|
||||
substring_index(SUBSTRING_INDEX(r.cate_id, ',', b.help_topic_id + 1), ',', -1) cid
|
||||
from eb_store_product r
|
||||
JOIN help_topic b ON b.help_topic_id <![CDATA[<]]> (length(r.cate_id) - length(replace(r.cate_id,',','')) + 1)
|
||||
where r.id = #{id}
|
||||
) t on tc.cid = t.cid
|
||||
inner join eb_review_tag_category tc on t.id = tc.review_tag_id
|
||||
inner join (
|
||||
select r.cate_id
|
||||
from eb_store_product r where r.id = #{id}
|
||||
) t on FIND_IN_SET(tc.cid,t.cate_id)
|
||||
where t.status = 1 and tc.status = 1
|
||||
</select>
|
||||
|
||||
|
@ -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 <![CDATA[ <> ]]> 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
|
||||
|
@ -4,12 +4,22 @@
|
||||
|
||||
<select id="getReviewTags" resultType="com.zbkj.common.vo.ReplyReviewTagsVo">
|
||||
select t.tag, count(1) num from (
|
||||
select
|
||||
substring_index(SUBSTRING_INDEX(r.review_tags, ',', b.help_topic_id + 1), ',', -1) tag
|
||||
select substring_index(SUBSTRING_INDEX(r.review_tags, ',', b.index_id + 1), ',', -1) tag
|
||||
from eb_store_product_reply r
|
||||
JOIN help_topic b ON b.help_topic_id <![CDATA[<]]> (length(r.review_tags) - length(replace(r.review_tags,',','')) + 1)
|
||||
where r.product_id = #{id}
|
||||
) t GROUP BY t.tag
|
||||
join (
|
||||
select 0 index_id union all
|
||||
select 1 index_id union all
|
||||
select 2 index_id union all
|
||||
select 3 index_id union all
|
||||
select 4 index_id union all
|
||||
select 5 index_id union all
|
||||
select 6 index_id union all
|
||||
select 7 index_id union all
|
||||
select 8 index_id union all
|
||||
select 9 index_id
|
||||
) b on b.index_id <![CDATA[<]]> (length(r.review_tags) - length(replace(r.review_tags,',','')) + 1)
|
||||
where r.product_id = #{id}
|
||||
) t group by t.tag
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user