提交 121e5a29 作者: panda

Merge remote-tracking branch 'origin/master'

......@@ -32,3 +32,4 @@ build/
### VS Code ###
.vscode/
kustomization/overlays/prod/kustomize
*.log
\ No newline at end of file
FROM openjdk:8-jdk-alpine
#VOLUME ["/tmp","/files","/var/logs/"]
VOLUME ["/var/log/app/"]
ARG JAVA_OPTS
ENV JAVA_OPTS=$JAVA_OPTS
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
......
......@@ -5,3 +5,5 @@ metadata:
namespace: default
data:
SPRING_PROFILES_ACTIVE: default
SW_AGENT_COLLECTOR_BACKEND_SERVICES: "default-oap.default:11800"
SW_AGENT_NAME: pms
......@@ -14,10 +14,14 @@ spec:
metadata:
labels:
app: pms
swck-java-agent-injected: 'true'
spec:
containers:
- name: pms
image: REGISTRY/NAMESPACE/IMAGE:TAG
volumeMounts:
- name: log-of-app
mountPath: /var/log/app
resources:
limits:
memory: 1024Mi
......@@ -30,3 +34,17 @@ spec:
configMapKeyRef:
name: pms-map
key: SPRING_PROFILES_ACTIVE
- name: SW_AGENT_COLLECTOR_BACKEND_SERVICES
valueFrom:
configMapKeyRef:
name: pms-map
key: SW_AGENT_COLLECTOR_BACKEND_SERVICES
- name: SW_AGENT_NAME
valueFrom:
configMapKeyRef:
name: pms-map
key: SW_AGENT_NAME
volumes:
- name: log-of-app
hostPath:
path: /var/log/app
\ No newline at end of file
......@@ -18,4 +18,4 @@ patches:
images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/pms
newTag: 506594e8af493b698ecb2e75c3f5b291e2f83181
newTag: ccc7c809c80517b9c27c53b03fafcb3feefd04b6
......@@ -18,4 +18,4 @@ patches:
images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly/pms
newTag: f481d859358f8a8bfbd8b127a3c25a05fc288fa3
newTag: 5e9165eda0f547dc245accbd881d1cbdcf00f20d
......@@ -5,7 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableFeignClients
@EnableFeignClients(basePackages = "com.mmc.pms.feign")
public class PmsApplication {
public static void main(String[] args) {
......
......@@ -6,14 +6,12 @@ import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* @author: zj
* @Date: 2023/5/28 10:52
* @author: zj @Date: 2023/5/28 10:52
*/
@Configuration
public class MvcConfiguration implements WebMvcConfigurer {
@Autowired
private TokenCheckHandleInterceptor tokenCheckHandleInterceptor;
@Autowired private TokenCheckHandleInterceptor tokenCheckHandleInterceptor;
@Override
public void addInterceptors(InterceptorRegistry registry) {
......
......@@ -8,8 +8,7 @@ import org.springframework.context.annotation.PropertySource;
import java.util.List;
/**
* @author: zj
* @Date: 2023/5/28 13:54
* @author: zj @Date: 2023/5/28 13:54
*/
@Data
@Configuration
......
package com.mmc.pms.auth;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.util.PathUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
/**
* @author: zj
* @Date: 2023/5/28 10:46
* @author: zj @Date: 2023/5/28 10:46
*/
@Slf4j
@Component
public class TokenCheckHandleInterceptor implements HandlerInterceptor {
@Autowired
private StringRedisTemplate stringRedisTemplate;
@Autowired private StringRedisTemplate stringRedisTemplate;
@Autowired
private NotCheckUriConfig notCheckUriConfig;
@Autowired private NotCheckUriConfig notCheckUriConfig;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
String requestURI = request.getRequestURI();
// //根据uri确认是否要拦截
// //根据uri确认是否要拦截
if (!shouldFilter(requestURI)) {
return true;
}
......@@ -46,38 +43,44 @@ public class TokenCheckHandleInterceptor implements HandlerInterceptor {
exceptionProcess(response);
return false;
}
//
// String serverName = request.getServerName();
// String remoteHost = request.getRemoteHost();
// log.info("hostName: {}", hostName);
// log.info("serverName: {}", serverName);
// log.info("remoteHost: {}", remoteHost);
// log.info("forwardedFor: {}", forwardedFor);
// log.info("forwardedHost: {}", forwardedHost);
// if (hostName.equals("iuav.mmcuav.cn") || hostName.equals("test.iuav.mmcuav.cn") || hostName.equals("www.iuav.shop") || hostName.equals("test.iuav.shop")){
// String token = request.getHeader("token");
// if (StringUtils.isBlank(token)){
// exceptionProcess(response);
// return false;
// }
// String tokenJson = stringRedisTemplate.opsForValue().get(token);
// if (StringUtils.isBlank(tokenJson)){
// exceptionProcess(response);
// return false;
// }
// return true;
// }
//测试-打印请求信息
//
// String serverName = request.getServerName();
// String remoteHost = request.getRemoteHost();
// log.info("hostName: {}", hostName);
// log.info("serverName: {}", serverName);
// log.info("remoteHost: {}", remoteHost);
// log.info("forwardedFor: {}", forwardedFor);
// log.info("forwardedHost: {}", forwardedHost);
// if (hostName.equals("iuav.mmcuav.cn") || hostName.equals("test.iuav.mmcuav.cn") ||
// hostName.equals("www.iuav.shop") || hostName.equals("test.iuav.shop")){
// String token = request.getHeader("token");
// if (StringUtils.isBlank(token)){
// exceptionProcess(response);
// return false;
// }
// String tokenJson = stringRedisTemplate.opsForValue().get(token);
// if (StringUtils.isBlank(tokenJson)){
// exceptionProcess(response);
// return false;
// }
// return true;
// }
// 测试-打印请求信息
return true;
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
}
public void postHandle(
HttpServletRequest request,
HttpServletResponse response,
Object handler,
ModelAndView modelAndView)
throws Exception {}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
}
public void afterCompletion(
HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
throws Exception {}
public void exceptionProcess(HttpServletResponse response) throws Exception {
response.setContentType("application/json;charset=utf-8");
......
package com.mmc.pms.auth.dto;
import com.mmc.pms.common.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @author: zj
* @Date: 2023/5/25 13:32
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BUserAccountQO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "关键字", required = false)
private String keyword;
@ApiModelProperty(value = "地区", required = false)
private String area;
@ApiModelProperty(value = "省份编码", required = false)
private Integer provinceCode;
@ApiModelProperty(value = "城市编码", required = false)
private Integer cityCode;
@ApiModelProperty(value = "县区编码", required = false)
private Integer districtCode;
@ApiModelProperty(value = "角色id", required = false)
private Integer roleId;
@ApiModelProperty(value = "账号状态:0禁用 1可用")
private Integer accountStatus;
@ApiModelProperty(value = "账号状态:0合伙人 1员工")
private Integer userType;
@ApiModelProperty(value = "用户id集合")
private List<Integer> userIds;
@ApiModelProperty(value = "推荐单位id")
private Integer rcdCompanyId;
@ApiModelProperty(value = "单位集合", hidden = true)
private List<Integer> companys;
@ApiModelProperty(value = "页码", required = true)
@NotNull(message = "页码不能为空", groups = Page.class)
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true)
@NotNull(message = "每页显示数不能为空", groups = Page.class)
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
}
......@@ -8,10 +8,10 @@ import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author 作者 geDuo
* @version 创建时间:2021年8月31日 下午8:06:14
* @explain 类说明
*/
* @author 作者 geDuo
* @version 创建时间:2021年8月31日 下午8:06:14
* @explain 类说明
*/
@Builder
@Data
@AllArgsConstructor
......@@ -26,5 +26,5 @@ public class LoginSuccessDTO implements Serializable {
private String phoneNum;
private String userName;
private String nickName;
// private RoleInfoDTO roleInfo;
// private RoleInfoDTO roleInfo;
}
package com.mmc.pms.auth.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author: zj
* @Date: 2023/5/18 17:28
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class UserAccountSimpleDTO implements Serializable {
private static final long serialVersionUID = 3451336520607073343L;
@ApiModelProperty(value = "用户id")
private Integer id;
@ApiModelProperty(value = "用户类型")
private Integer accountType;
@ApiModelProperty(value = "用户账号")
private String accountNo;
@ApiModelProperty(value = "用户uid")
private String uid;
@ApiModelProperty(value = "手机号")
private String phoneNum;
@ApiModelProperty(value = "用户名称")
private String userName;
@ApiModelProperty(value = "用户昵称")
private String nickName;
@ApiModelProperty(value = "用户头像")
private String userImg;
@ApiModelProperty(value = "用户性别:0未知、1男、2女")
private Integer userSex;
@ApiModelProperty(value = "用户邮箱")
private String email;
@ApiModelProperty(value = "用户来源,0自然流、1海报、2抖音、3公众号、4社群、5招投标、6官网")
private Integer source;
@ApiModelProperty(value = "用户可用状态:0禁用、1可用")
private Integer accountStatus;
@ApiModelProperty(value = "账号类型:0后台管理账号 ; 100云享飞-客户端;")
private Integer portType;
@ApiModelProperty(value = "企业认证状态, 0未通过,1通过")
private Integer companyAuthStatus;
@ApiModelProperty(value = "合作标签id")
private Integer cooperationTagId;
}
\ No newline at end of file
package com.mmc.pms.config;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
//Converter<S,T> S: 代表的是源,将要转换的数据类型 T:目标类型,将会转成什么数据类型
@Component
public class GlobalFormDateConvert implements Converter<String, Date> {
// 静态初始化定义日期字符串参数列表(需要转换的)
private static final List<String> paramList = new ArrayList<>();
// 静态初始化可能初夏你的日期格式
private static final String param1 = "yyyy-MM";
private static final String param2 = "yyyy-MM-dd";
private static final String param3 = "yyyy-MM-dd HH:mm";
private static final String param4 = "yyyy-MM-dd HH:mm:ss";
// 静态代码块,将日期参数加入到列表中
static {
paramList.add(param1);
paramList.add(param2);
paramList.add(param3);
paramList.add(param4);
}
// 自定义函数,将字符串转Date 参1:传入的日期字符串 参2:格式参数
public Date parseDate(String source, String format) {
System.out.println("parseDate转换日期");
Date date = null;
try {
// 日期格式转换器
DateFormat dateFormat = new SimpleDateFormat(format);
date = dateFormat.parse(source);
} catch (Exception e) {
e.printStackTrace();
}
return date;
}
// convert转换方法 ,s是将会传递过来的日期的字符串
@Override
public Date convert(String source) {
System.out.println("convert日期格式转换器");
if (StringUtils.isEmpty(source)) {
return null;
}
source = source.trim(); // 去除首尾空格
// 正则表达式判断是哪一种格式参数
if (source.matches("^\\d{4}-\\d{1,2}$")) {
return parseDate(source, paramList.get(0));
} else if (source.matches("^\\d{4}-\\d{1,2}-\\d{1,2}$")) {
return parseDate(source, paramList.get(1));
} else if (source.matches("^\\d{4}-\\d{1,2}-\\d{1,2} {1}\\d{1,2}:\\d{1,2}$")) {
return parseDate(source, paramList.get(2));
} else if (source.matches("^\\d{4}-\\d{1,2}-\\d{1,2} {1}\\d{1,2}:\\d{1,2}:\\d{1,2}$")) {
return parseDate(source, paramList.get(3));
} else {
throw new IllegalArgumentException("还未定义该种字符串转Date的日期转换格式 --> 【日期格式】:" + source);
}
}
}
package com.mmc.pms.config;
import com.fasterxml.jackson.databind.util.StdDateFormat;
import org.springframework.util.StringUtils;
import java.text.FieldPosition;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;
public class GlobalJsonDateConvert extends StdDateFormat {
private static final long serialVersionUID = -6738131740618766141L;
// 静态初始化final,共享
public static final GlobalJsonDateConvert instance = new GlobalJsonDateConvert();
// 覆盖parse(String)这个方法即可实现
@Override
public Date parse(String dateStr, ParsePosition pos) {
return getDate(dateStr, pos);
}
@Override
public Date parse(String dateStr) {
ParsePosition pos = new ParsePosition(0);
return getDate(dateStr, pos);
}
private Date getDate(String dateStr, ParsePosition pos) {
SimpleDateFormat sdf = null;
if (StringUtils.isEmpty(dateStr)) {
return null;
} else if (dateStr.matches("^\\d{4}-\\d{1,2}$")) {
sdf = new SimpleDateFormat("yyyy-MM");
return sdf.parse(dateStr, pos);
} else if (dateStr.matches("^\\d{4}-\\d{1,2}-\\d{1,2}$")) {
sdf = new SimpleDateFormat("yyyy-MM-dd");
return sdf.parse(dateStr, pos);
} else if (dateStr.matches("^\\d{4}-\\d{1,2}-\\d{1,2} {1}\\d{1,2}:\\d{1,2}$")) {
sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
return sdf.parse(dateStr, pos);
} else if (dateStr.matches("^\\d{4}-\\d{1,2}-\\d{1,2} {1}\\d{1,2}:\\d{1,2}:\\d{1,2}$")) {
sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdf.parse(dateStr, pos);
} else if (dateStr.length() == 23) {
sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
return sdf.parse(dateStr, pos);
}
return super.parse(dateStr, pos);
}
@Override
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdf.format(date, toAppendTo, fieldPosition);
}
@Override
public GlobalJsonDateConvert clone() {
return new GlobalJsonDateConvert();
}
}
package com.mmc.pms.config;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ConversionServiceFactoryBean;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.converter.Converter;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@Configuration
public class WebConfig {
// JSON格式 全局日期转换器配置
@Bean
public MappingJackson2HttpMessageConverter getMappingJackson2HttpMessageConverter() {
MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter();
// 设置日期格式
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.setDateFormat(GlobalJsonDateConvert.instance);
objectMapper.setSerializationInclusion(JsonInclude.Include.ALWAYS);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mappingJackson2HttpMessageConverter.setObjectMapper(objectMapper);
// 设置中文编码格式
List<MediaType> list = new ArrayList<MediaType>();
list.add(MediaType.APPLICATION_JSON_UTF8);
mappingJackson2HttpMessageConverter.setSupportedMediaTypes(list);
return mappingJackson2HttpMessageConverter;
}
// 表单格式 全局日期转换器
@Bean
@Autowired
public ConversionService getConversionService(GlobalFormDateConvert globalDateConvert) {
ConversionServiceFactoryBean factoryBean = new ConversionServiceFactoryBean();
Set<Converter> converters = new HashSet<>();
converters.add(globalDateConvert);
factoryBean.setConverters(converters);
return factoryBean.getObject();
}
}
package com.mmc.pms.constant;
public interface DateConstant {
String YYYYMMDDHHMMSS = "yyyy-MM-dd HH:mm:ss";
}
package com.mmc.pms.constant;
/**
* @author: zj
* @Date: 2023/5/31 20:07
*/
public class TokenConstant {
public static final String TOKEN = "token";
}
package com.mmc.pms.controller;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.entity.Categories;
import com.mmc.pms.model.categories.dto.AllCategoryDTO;
import com.mmc.pms.model.categories.dto.ClassifyDetailsDTO;
import com.mmc.pms.model.categories.dto.ClassifyInfoDTO;
import com.mmc.pms.model.categories.vo.CategoriesInfoVO;
import com.mmc.pms.model.categories.vo.ClassifyInfoVO;
import com.mmc.pms.model.categories.vo.DirectoryInfoVO;
import com.mmc.pms.model.categories.vo.RelevantBusinessVO;
......@@ -16,7 +15,6 @@ import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.constraints.Min;
import java.util.List;
......@@ -28,8 +26,7 @@ import java.util.List;
@RestController
@RequestMapping("/classify")
public class BackstageCategoriesController {
@Autowired
private CategoriesService categoriesService;
@Autowired private CategoriesService categoriesService;
@ApiOperation(value = "新增or修改目录")
@PostMapping("addOrEditDirectory")
......@@ -41,41 +38,48 @@ public class BackstageCategoriesController {
@ApiOperation(value = "目录列表")
@GetMapping("directoryList")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = DirectoryInfoVO.class)})
public ResultBody directoryList(@RequestParam Integer pageNo, @RequestParam Integer pageSize, @RequestParam(required = false) Integer type) {
public ResultBody directoryList(
@RequestParam Integer pageNo,
@RequestParam Integer pageSize,
@RequestParam(required = false) Integer type) {
return ResultBody.success(categoriesService.directoryList(pageNo, pageSize, type));
}
@ApiOperation(value = "删除目录")
@GetMapping("removeDirectory")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody removeDirectory(@ApiParam(value = "id") @RequestParam(value = "id") Integer id) {
public ResultBody removeDirectory(
@ApiParam(value = "id") @RequestParam(value = "id") Integer id) {
return categoriesService.removeDirectory(id);
}
@ApiOperation(value = "分类新增")
@PostMapping("addClassification")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addClassification(@Validated(Create.class) @RequestBody ClassifyInfoVO classifyInfoVO) {
public ResultBody addClassification(
@Validated(Create.class) @RequestBody ClassifyInfoVO classifyInfoVO) {
return categoriesService.addClassification(classifyInfoVO);
}
@ApiOperation(value = "分类修改")
@PostMapping("updateClassification")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody updateClassification(@Validated(Update.class) @RequestBody ClassifyInfoVO classifyInfoVO) {
public ResultBody updateClassification(
@Validated(Update.class) @RequestBody ClassifyInfoVO classifyInfoVO) {
return categoriesService.updateClassification(classifyInfoVO);
}
@ApiOperation(value = "分类信息-排序")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("exchangeSortType")
public ResultBody exchangeSortType(@ApiParam(value = "第一个分类id", required = true) @RequestParam(value = "firstId") Integer firstId,
@ApiParam(value = "第二个分类id", required = true) @RequestParam(value = "secondId") Integer secondId) {
public ResultBody exchangeSortType(
@ApiParam(value = "第一个分类id", required = true) @RequestParam(value = "firstId")
Integer firstId,
@ApiParam(value = "第二个分类id", required = true) @RequestParam(value = "secondId")
Integer secondId) {
return categoriesService.exchangeSortType(firstId, secondId);
}
@ApiOperation(value = "分类信息-列表")
@PostMapping("getClassificationList")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ClassifyInfoDTO.class)})
......@@ -83,26 +87,30 @@ public class BackstageCategoriesController {
return ResultBody.success(categoriesService.getClassificationList(queryClassifyVO));
}
@ApiOperation(value = "分类详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ClassifyDetailsDTO.class)})
@GetMapping("getClassifyDetails")
public ResultBody getClassifyDetails(@ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id) {
public ResultBody getClassifyDetails(
@ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id) {
return categoriesService.getClassifyDetails(id);
}
@ApiOperation(value = "分类详情")
@ApiOperation(value = "分类详情下关联业务列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = RelevantBusinessVO.class)})
@GetMapping("queryRelevantBusiness")
public ResultBody queryRelevantBusiness(@ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id,
@ApiParam(value = "业务类型", required = true) @Min(value = 0) @RequestParam(value = "type") Integer type) {
public ResultBody queryRelevantBusiness(
@ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id,
@ApiParam(value = "业务类型", required = true) @Min(value = 0) @RequestParam(value = "type")
Integer type) {
return categoriesService.queryRelevantBusiness(id, type);
}
@ApiOperation(value = "分类删除")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = RelevantBusinessVO.class)})
@GetMapping("deleteRelevantBusiness")
public ResultBody deleteRelevantBusiness(@ApiParam(value = "分类id", required = true) @Min(value = 1) @RequestParam(value = "id") Integer id) {
public ResultBody deleteRelevantBusiness(
@ApiParam(value = "分类id", required = true) @Min(value = 1) @RequestParam(value = "id")
Integer id) {
return categoriesService.deleteRelevantBusiness(id);
}
......@@ -113,4 +121,21 @@ public class BackstageCategoriesController {
return categoriesService.getDirectoryList(type);
}
@ApiOperation(value = "根据类型获取各个目录及分类信息")
@GetMapping("queryCategoryInfoByType")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = AllCategoryDTO.class)})
public ResultBody queryCategoryInfoByType(
@ApiParam(value = "类型:1:作业服务 2:设备 3:培训 4:产品商城", required = true) @RequestParam(value = "type")
Integer type) {
return categoriesService.queryCategoryInfoByType(type);
}
@ApiOperation(value = "feign根据类型获取各个目录及分类信息", hidden = true)
@GetMapping("feignQqueryCategoryInfoByType")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = AllCategoryDTO.class)})
public List<AllCategoryDTO> feignQqueryCategoryInfoByType(
@ApiParam(value = "类型:1:作业服务 2:设备 3:培训 4:产品商城", required = true) @RequestParam(value = "type")
Integer type) {
return categoriesService.feigQqueryCategoryInfoByType(type);
}
}
......@@ -8,47 +8,77 @@ import com.mmc.pms.model.order.dto.OrderGoodsProdDTO;
import com.mmc.pms.model.qo.MallOrderGoodsInfoQO;
import com.mmc.pms.model.qo.ProductSpecPriceQO;
import com.mmc.pms.model.sale.dto.*;
import com.mmc.pms.model.sale.qo.MallGoodsQO;
import com.mmc.pms.model.sale.vo.BatchShelfVO;
import com.mmc.pms.model.sale.vo.GoodsAddVO;
import com.mmc.pms.service.GoodsInfoService;
import io.swagger.annotations.*;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author LW
* @date 2023/3/14 13:22
* 概要:
*
* @date 2023/3/14 13:22 概要:
*/
@RestController
@RequestMapping("/goods")
@Api(tags = {"后台-商品管理-相关接口"})
public class BackstageGoodsManageController {
@Resource
private GoodsInfoService goodsInfoService;
@Resource private GoodsInfoService goodsInfoService;
@ApiOperation(value = "新增(租赁/销售)商品")
@PostMapping("addGoodsInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addGoods(@ApiParam("商品信息VO") @Validated(Create.class) @RequestBody GoodsAddVO goodsAddVO) {
public ResultBody addGoods(
@ApiParam("商品信息VO") @Validated(Create.class) @RequestBody GoodsAddVO goodsAddVO) {
return goodsInfoService.addGoods(goodsAddVO);
}
@ApiOperation(value = "修改(租赁/销售)商品")
@PostMapping("editGoodsInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody editGoodsInfo(@ApiParam("商品信息VO") @Validated(Update.class) @RequestBody GoodsAddVO goodsAddVO) {
public ResultBody editGoodsInfo(
@ApiParam("商品信息VO") @Validated(Update.class) @RequestBody GoodsAddVO goodsAddVO) {
return goodsInfoService.editGoodsInfo(goodsAddVO);
}
@ApiOperation(value = "PC端-商品详情")
@GetMapping("getGoodsInfoDetail")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = MallGoodsDetailDTO.class)})
public ResultBody getGoodsInfoDetail(@ApiParam("商品id") @RequestParam Integer goodsInfoId) {
return goodsInfoService.getGoodsInfoDetail(goodsInfoId);
public ResultBody getGoodsInfoDetail(
@ApiParam("商品id") @RequestParam Integer goodsInfoId,
@RequestParam Integer type,
@RequestParam(required = false) @ApiParam("租赁时限:(输入0:1-7天、输入1:8-15天、输入2:16-30天、输入3:30天以上)")
Integer leaseTerm) {
return goodsInfoService.getGoodsInfoDetail(goodsInfoId, type, leaseTerm);
}
@ApiOperation(value = "商品列表-分页")
@PostMapping("listPageGoodsInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = GoodsInfoListDTO.class)})
public ResultBody listPageGoodsInfo(@ApiParam("商品查询条件QO") @RequestBody MallGoodsQO param) {
return ResultBody.success(goodsInfoService.listPageGoodsInfo(param));
}
@ApiOperation(value = "商品批量上下架")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("batchOnShelfOrTakeDown")
public ResultBody batchOnShelfOrTakeDown(
@ApiParam(value = "商品上下架参数", required = true) @RequestBody BatchShelfVO batchOnShelfVO) {
return goodsInfoService.batchOnShelfOrTakeDown(
batchOnShelfVO.getGoodsIds(), batchOnShelfVO.getStatus());
}
@ApiOperation(value = "商品批量删除")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("batchRemoveWareInfo")
public ResultBody batchRemoveWareInfo(
@ApiParam(value = "商品id数组", required = true) @RequestBody List<Integer> ids) {
return goodsInfoService.batchRemoveWareInfo(ids);
}
@ApiOperation(value = "单位信息")
......@@ -58,6 +88,13 @@ public class BackstageGoodsManageController {
return goodsInfoService.getSkuUnit();
}
@ApiOperation(value = "PC端-其他服务-列表")
@GetMapping("listOtherService")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = SaleServiceDTO.class)})
public ResultBody listOtherService() {
return goodsInfoService.getSaleServiceInfoToList();
}
@ApiOperation(value = "feign根据购物车信息填充未知信息", hidden = true)
@PostMapping("fillGoodsInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = MallGoodsShopCarDTO.class)})
......@@ -68,14 +105,16 @@ public class BackstageGoodsManageController {
@ApiOperation(value = "feign根据渠道等级和产品规格id获取对应价格", hidden = true)
@PostMapping("feignListProductSpecPrice")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public List<MallProductSpecPriceDTO> feignListProductSpecPrice(@RequestBody ProductSpecPriceQO productSpecPriceQO) {
public List<MallProductSpecPriceDTO> feignListProductSpecPrice(
@RequestBody ProductSpecPriceQO productSpecPriceQO) {
return goodsInfoService.feignListProductSpecPrice(productSpecPriceQO);
}
@ApiOperation(value = "feign根据渠道等级获取单价信息", hidden = true)
@GetMapping("feignGetUnitPriceByTag")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecPriceDTO.class)})
public ProductSpecPriceDTO feignGetUnitPriceByTag(@RequestParam(value = "specId") Integer specId,
public ProductSpecPriceDTO feignGetUnitPriceByTag(
@RequestParam(value = "specId") Integer specId,
@RequestParam(value = "tagId") Integer tagId) {
return goodsInfoService.feignGetUnitPriceByTag(specId, tagId);
}
......@@ -83,15 +122,16 @@ public class BackstageGoodsManageController {
@ApiOperation(value = "feign根据商品的产品规格id查询商品信息", hidden = true)
@PostMapping("feignListProdGoodsSkuInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = OrderGoodsProdDTO.class)})
public List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(@RequestBody MallOrderGoodsInfoQO mallOrderGoodsInfoQO) {
public List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(
@RequestBody MallOrderGoodsInfoQO mallOrderGoodsInfoQO) {
return goodsInfoService.feignListProdGoodsSkuInfo(mallOrderGoodsInfoQO);
}
@ApiOperation(value = "feign根据商品的行业规格id查询商品清单信息", hidden = true)
@PostMapping("feignListIndstGoodsSkuInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = OrderGoodsProdDTO.class)})
public List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(@RequestBody MallOrderGoodsInfoQO mallOrderGoodsInfoQO) {
public List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(
@RequestBody MallOrderGoodsInfoQO mallOrderGoodsInfoQO) {
return goodsInfoService.feignListIndstGoodsSkuInfo(mallOrderGoodsInfoQO);
}
}
package com.mmc.pms.controller;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.categories.vo.DirectoryInfoVO;
import com.mmc.pms.model.group.Create;
import com.mmc.pms.model.group.Update;
import com.mmc.pms.model.lease.vo.PriceAcquisition;
......@@ -17,20 +18,20 @@ import java.math.BigDecimal;
/**
* @Author LW
* @date 2022/9/22 10:28
* 概要:
*
* @date 2022/9/22 10:28 概要:
*/
@RestController
@RequestMapping("/product/spec/")
@Api(tags = {"产品管理模块-相关接口"})
public class BackstageProductSpecController {
@Autowired
private ProductSkuService productSkuService;
@Autowired private ProductSkuService productSkuService;
@ApiOperation(value = "新增产品sku")
@PostMapping("addProductSku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addProductSku(@Validated(Create.class) @ApiParam("产品skuVO") @RequestBody ProductSkuVO param) {
public ResultBody addProductSku(
@Validated(Create.class) @ApiParam("产品skuVO") @RequestBody ProductSkuVO param) {
return productSkuService.addProductSku(param);
}
......@@ -44,10 +45,18 @@ public class BackstageProductSpecController {
@ApiOperation(value = "编辑产品sku")
@PostMapping("editProductSku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody editProductSku(@Validated(Update.class) @ApiParam("产品skuVO") @RequestBody ProductSkuVO param) {
public ResultBody editProductSku(
@Validated(Update.class) @ApiParam("产品skuVO") @RequestBody ProductSkuVO param) {
return productSkuService.editProductSku(param);
}
@ApiOperation(value = "产品目录列表")
@GetMapping("productDirectoryList")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = DirectoryInfoVO.class)})
public ResultBody<DirectoryInfoVO> productDirectoryList() {
return productSkuService.productDirectoryList();
}
@ApiOperation(value = "产品sku分页列表")
@PostMapping("listPageProductSku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSkuDTO.class)})
......@@ -65,7 +74,9 @@ public class BackstageProductSpecController {
@ApiOperation(value = "新增or修改产品规格")
@PostMapping("addOrEditProductSpec")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addOrEditProductSpec(@Validated({Create.class, Update.class}) @ApiParam("产品规格VO") @RequestBody ProductSpecVO param) {
public ResultBody addOrEditProductSpec(
@Validated({Create.class, Update.class}) @ApiParam("产品规格VO") @RequestBody
ProductSpecVO param) {
return productSkuService.addOrEditProductSpec(param);
}
......@@ -79,10 +90,12 @@ public class BackstageProductSpecController {
@ApiOperation(value = "产品规格分页列表")
@GetMapping("listPageProductSpec")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecDTO.class)})
public ResultBody listPageProductSpec(@ApiParam(value = "页码") @RequestParam(value = "pageNo") Integer pageNo,
public ResultBody listPageProductSpec(
@ApiParam(value = "页码") @RequestParam(value = "pageNo") Integer pageNo,
@ApiParam(value = "每页显示数") @RequestParam(value = "pageSize") Integer pageSize,
@ApiParam(value = "产品skuId") @RequestParam(value = "productSkuId") Integer productSkuId) {
return productSkuService.listPageProductSpec(pageNo, pageSize, productSkuId);
@ApiParam(value = "产品skuId") @RequestParam(value = "productSkuId") Integer productSkuId,
@ApiParam(value = "关键字") @RequestParam(value = "keyword", required = false) String keyword) {
return productSkuService.listPageProductSpec(pageNo, pageSize, productSkuId, keyword);
}
@ApiOperation(value = "产品规格管理-价格配置")
......@@ -92,7 +105,6 @@ public class BackstageProductSpecController {
return productSkuService.productSpecCPQ(productSpecCPQVO);
}
@ApiOperation(value = "价格配置信息的修改")
@PostMapping("updateProductSpecCPQ")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
......@@ -108,28 +120,33 @@ public class BackstageProductSpecController {
}
//
// @ApiOperation(value = "价格配置信息--恢复全局默认设置")
// @GetMapping("getDefaultSettings")
// @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecPriceDTO.class)})
// public ResultBody getDefaultSettings(@ApiParam(value = "规格id") @RequestParam(value = "productSpecId") Integer productSpecId) {
// return productSpecService.getDefaultSettings(productSpecId);
// }
//
// @ApiOperation(value = "价格配置信息--恢复全局默认设置")
// @GetMapping("getDefaultSettings")
// @ApiResponses({@ApiResponse(code = 200, message = "OK", response =
// ProductSpecPriceDTO.class)})
// public ResultBody getDefaultSettings(@ApiParam(value = "规格id") @RequestParam(value =
// "productSpecId") Integer productSpecId) {
// return productSpecService.getDefaultSettings(productSpecId);
// }
//
@ApiOperation(value = "产品规格管理---删除规格")
@GetMapping("removeProductSpec")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = RemoveSkuDTO.class)})
public ResultBody removeProductSpec(@ApiParam("id") @RequestParam(value = "id") Integer id) {
return productSkuService.removeProductSpec(id);
}
//
// @ApiOperation(value = "feign根据渠道等级获取单价信息")
// @GetMapping("feignGetUnitPriceByTag")
// @ApiIgnore
// @ApiResponses({@ApiResponse(code = 200, message = "OK",response = ProductSpecPriceDTO.class)})
// public ProductSpecPriceDTO feignGetUnitPriceByTag(@RequestParam(value = "specId")Integer specId,
// @RequestParam(value = "tagId")Integer tagId) {
// return productSpecService.feignGetUnitPriceByTag(specId,tagId);
// }
//
// @ApiOperation(value = "feign根据渠道等级获取单价信息")
// @GetMapping("feignGetUnitPriceByTag")
// @ApiIgnore
// @ApiResponses({@ApiResponse(code = 200, message = "OK",response =
// ProductSpecPriceDTO.class)})
// public ProductSpecPriceDTO feignGetUnitPriceByTag(@RequestParam(value = "specId")Integer
// specId,
// @RequestParam(value = "tagId")Integer
// tagId) {
// return productSpecService.feignGetUnitPriceByTag(specId,tagId);
// }
@ApiOperation(value = "feign根据渠道等级获取单价信息")
@PostMapping("feignGetSpecLeaseUnitPrice")
......
package com.mmc.pms.controller;
import com.mmc.pms.common.Page;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.group.Create;
import com.mmc.pms.model.group.Update;
import com.mmc.pms.model.qo.ServiceQO;
import com.mmc.pms.model.work.dto.ServiceDTO;
import com.mmc.pms.model.work.dto.WorkServiceDTO;
import com.mmc.pms.model.work.vo.ServiceVO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.model.work.vo.UpAndDownServiceVO;
import com.mmc.pms.service.BackstageTaskService;
import io.swagger.annotations.*;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* @Author LW
* @date 2023/6/6 10:41
* 概要:
*
* @date 2023/6/6 10:41 概要:
*/
@Api(tags = {"后台-服务管理-模块"})
@RestController
@RequestMapping("/backstage/work")
public class BackstageTaskServiceController extends BaseController {
@Resource
private BackstageTaskService backstageTaskService;
@Resource private BackstageTaskService backstageTaskService;
@ApiOperation(value = "新增作业服务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("addWorkService")
public ResultBody addWorkService(@Validated(Create.class) @RequestBody ServiceVO param, HttpServletRequest request) {
return backstageTaskService.addWorkService(param, this.getUserLoginInfoFromRedis(request).getUserAccountId());
public ResultBody addWorkService(
@Validated(Create.class) @RequestBody ServiceVO param, HttpServletRequest request) {
return backstageTaskService.addWorkService(
param, this.getUserLoginInfoFromRedis(request).getUserAccountId());
}
@ApiOperation(value = "修改作业服务")
......@@ -42,24 +46,47 @@ public class BackstageTaskServiceController extends BaseController {
return backstageTaskService.updateById(param);
}
@ApiOperation(value = "删除作业服务")
@ApiOperation(value = "批量删除作业服务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("deleteWorkService")
public ResultBody deleteWorkService(@ApiParam("作业服务id") @RequestParam(value = "id") Integer id) {
return backstageTaskService.deleteById(id);
@PostMapping("deleteWorkService")
public ResultBody deleteWorkService(@ApiParam("作业服务id") @RequestBody List<Integer> ids) {
return backstageTaskService.deleteByIds(ids);
}
@ApiOperation(value = "批量上下架作业服务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("batchUpAndDownWorkService")
public ResultBody batchUpAndDownWorkService(@RequestBody UpAndDownServiceVO param) {
return backstageTaskService.batchUpAndDownWorkService(param);
}
@ApiOperation(value = "查询作业服务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ServiceDTO.class)})
@GetMapping("queryWorkService")
public ResultBody queryWorkService(@ApiParam("作业服务id") @RequestParam(value = "id") Integer id) {
public ResultBody<ServiceDTO> queryWorkService(@ApiParam("作业服务id") @RequestParam(value = "id") Integer id) {
return backstageTaskService.queryById(id);
}
@ApiOperation(value = "查询工作服务列表")
@ApiOperation(value = "查询服务管理列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ServiceDTO.class)})
@PostMapping("queryServiceManagerList")
public ResultBody<ServiceDTO> queryServiceManagerList(
@Validated(Page.class) @RequestBody ServiceQO param, HttpServletRequest request) {
return ResultBody.success(backstageTaskService.queryServiceManagerList(param, this.getUserLoginInfoFromRedis(request).getUserAccountId()));
}
@ApiOperation(value = "web接口-条件查询作业服务列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = WorkServiceDTO.class)})
@PostMapping("queryWorkServiceList")
public PageResult queryWorkServiceList(@Validated(Create.class) @RequestBody ServiceQO param, HttpServletRequest request) {
return backstageTaskService.queryWorkServiceList(param, this.getUserLoginInfoFromRedis(request).getUserAccountId());
public ResultBody<WorkServiceDTO> queryWorkServiceList(@Validated(Page.class) @RequestBody ServiceQO param, HttpServletRequest request) {
return ResultBody.success(backstageTaskService.queryWorkServiceList(param,request));
}
@ApiOperation(value = "远程查询作业服务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ServiceDTO.class)})
@PostMapping("feignQueryWorkServiceListById")
@ApiIgnore
public List<ServiceDTO> feignQueryWorkServiceListById(@RequestBody List<Integer> ids) {
return backstageTaskService.feignQueryWorkServiceListById(ids);
}
}
......@@ -11,31 +11,31 @@ import org.springframework.data.redis.core.StringRedisTemplate;
import javax.servlet.http.HttpServletRequest;
/**
* @author: zj
* @Date: 2023/5/25 18:11
* @author: zj @Date: 2023/5/25 18:11
*/
public abstract class BaseController {
@Autowired
private StringRedisTemplate stringRedisTemplate;
@Autowired private StringRedisTemplate stringRedisTemplate;
/**
* 解析token,获取用户信息
*
* @param request
* @return
*/
// public BaseAccountDTO getUserLoginInfo(HttpServletRequest request) {
// String token = request.getHeader("token");
// try {
// Claims claims = JwtUtil.parseJwt(token);
// String userId = claims.get(JwtConstant.USER_ACCOUNT_ID).toString();
//// String roleId = claims.get("").toString();
// String tokenType = claims.get(JwtConstant.TOKEN_TYPE).toString();
// return BaseAccountDTO.builder().id(Integer.parseInt(userId)).tokenPort(tokenType).build();
// }catch (Exception e){
// throw new BizException("Invalid token");
// }
// }
// public BaseAccountDTO getUserLoginInfo(HttpServletRequest request) {
// String token = request.getHeader("token");
// try {
// Claims claims = JwtUtil.parseJwt(token);
// String userId = claims.get(JwtConstant.USER_ACCOUNT_ID).toString();
//// String roleId = claims.get("").toString();
// String tokenType = claims.get(JwtConstant.TOKEN_TYPE).toString();
// return
// BaseAccountDTO.builder().id(Integer.parseInt(userId)).tokenPort(tokenType).build();
// }catch (Exception e){
// throw new BizException("Invalid token");
// }
// }
/**
* 使用token从redis获取用户信息
......
package com.mmc.pms.controller;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.entity.Categories;
import com.mmc.pms.model.categories.dto.CategoriesDTO;
import com.mmc.pms.model.group.Create;
import com.mmc.pms.model.qo.ServiceQO;
import com.mmc.pms.model.work.dto.ServiceDTO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.CategoriesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 前端控制器
* </p>
*
* @author Pika
* @since 2023-06-08
*/
@Api(tags = {"后台-目录管理-接口"})
@RestController
@RequestMapping("/directory")
public class DirectoryController {
private final String DIRECTORY_NAME_APPLICATION = "应用";
private final String DIRECTORY_NAME_INDUSTRY = "行业";
@Autowired
private CategoriesService categoriesService;
@ApiOperation(value = "获取应用类型列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = CategoriesDTO.class)})
@PostMapping("getApplicationList")
public ResultBody getApplicationList() {
return categoriesService.getApplicationList(DIRECTORY_NAME_APPLICATION);
}
@ApiOperation(value = "获取对应行业列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = CategoriesDTO.class)})
@PostMapping("getIndustryList")
public ResultBody getIndustryList() {
return categoriesService.getApplicationList(DIRECTORY_NAME_INDUSTRY);
}
}
......@@ -5,20 +5,16 @@ import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.model.lease.dto.BrandDTO;
import com.mmc.pms.model.lease.dto.DeviceCategoryDTO;
import com.mmc.pms.model.lease.dto.WareInfoDTO;
import com.mmc.pms.model.lease.dto.WareInfoItemDTO;
import com.mmc.pms.model.lease.vo.LeaseVo;
import com.mmc.pms.model.other.dto.DistrictInfoDTO;
import com.mmc.pms.model.other.dto.ModelDTO;
import com.mmc.pms.model.qo.WareInfoQO;
import com.mmc.pms.model.sale.dto.SkuInfoDTO;
import com.mmc.pms.page.Page;
import com.mmc.pms.service.WebDeviceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
......@@ -57,13 +53,13 @@ public class MiniProgramDeviceController {
return webDeviceService.model();
}
@ApiOperation(value = "设备列表筛选")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = WareInfoItemDTO.class)})
@PostMapping("/deviceList")
public ResultBody<WareInfoItemDTO> listWareInfoPage(
@RequestBody @Validated(Page.class) WareInfoQO param) {
return webDeviceService.listWareInfoPage(param);
}
// @ApiOperation(value = "设备列表筛选")
// @ApiResponses({@ApiResponse(code = 200, message = "OK", response = WareInfoItemDTO.class)})
// @PostMapping("/deviceList")
// public ResultBody<WareInfoItemDTO> listWareInfoPage(
// @RequestBody @Validated(Page.class) WareInfoQO param) {
// return webDeviceService.listWareInfoPage(param, request);
// }
@ApiOperation(value = "设备详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
......
......@@ -32,8 +32,7 @@ import java.util.List;
@RequestMapping("/partupload")
public class PartUploadController {
@Autowired
private StringRedisTemplate stringRedisTemplate;
@Autowired private StringRedisTemplate stringRedisTemplate;
@ApiOperation(value = "初始化分片上传")
@GetMapping("/initPartUpload")
......
package com.mmc.pms.controller;
import com.mmc.pms.common.Page;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.constant.TokenConstant;
import com.mmc.pms.model.categories.dto.CategoryTypeDTO;
import com.mmc.pms.model.lease.dto.LeaseGoodsInfoDTO;
import com.mmc.pms.model.qo.WareInfoQO;
import com.mmc.pms.model.sale.dto.MallGoodsDetailDTO;
import com.mmc.pms.model.sale.vo.ProductSpecCPQVO;
import com.mmc.pms.service.WebDeviceService;
import io.swagger.annotations.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
/**
* @Author LW
*
* @date 2023/6/8 17:16 概要:
*/
@Api(tags = {"v1.0.1-租赁销售-相关接口"})
@RestController
@RequestMapping("/product/mall")
public class ProductMallController extends BaseController {
@Autowired private WebDeviceService webDeviceService;
@ApiOperation(value = "设备列表筛选")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = LeaseGoodsInfoDTO.class)})
@PostMapping("/deviceList")
public ResultBody<LeaseGoodsInfoDTO> listWareInfoPage(
@RequestBody @Validated(Page.class) WareInfoQO param, HttpServletRequest request) {
return webDeviceService.listWareInfoPage(
param,
request,
StringUtils.isBlank(request.getHeader(TokenConstant.TOKEN))
? null
: this.getUserLoginInfoFromRedis(request).getUserAccountId());
}
@ApiOperation(value = "设备商品详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = MallGoodsDetailDTO.class)})
@GetMapping("/getLeaseGoodsDetail")
public ResultBody<MallGoodsDetailDTO> getLeaseGoodsDetail(
Integer goodsId,
HttpServletRequest request,
@ApiParam(value = "租赁:1 销售商品:0") @RequestParam(value = "type") Integer type) {
return webDeviceService.getLeaseGoodsDetail(
goodsId,
StringUtils.isBlank(request.getHeader(TokenConstant.TOKEN))
? null
: this.getUserLoginInfoFromRedis(request).getUserAccountId(),
request,
type);
}
@ApiOperation(value = "web-首页分类数据-展示")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = CategoryTypeDTO.class)})
@GetMapping("/getPageHomeCategories")
public ResultBody<CategoryTypeDTO> getPageHomeCategories(
@ApiParam(value = "类型:1:作业服务 2:设备 3:培训 4:产品商城") @RequestParam(value = "type") Integer type) {
return webDeviceService.getPageHomeCategories(type);
}
@ApiOperation(value = "获取设备商品规格价格详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecCPQVO.class)})
@GetMapping("/getLeaseGoodsPriceDetail")
public ResultBody<ProductSpecCPQVO> getLeaseGoodsPriceDetail(
@ApiParam(value = "商品id") @RequestParam(value = "productSpecId") Integer productSpecId,
@ApiParam(value = "租赁时限:(输入0:1-7天、输入1:8-15天、输入2:16-30天、输入3:30天以上)")
@RequestParam(value = "leaseTerm")
Integer leaseTerm) {
return webDeviceService.getLeaseGoodsPriceDetail(productSpecId, leaseTerm);
}
}
......@@ -4,10 +4,16 @@ import com.alibaba.fastjson2.JSONObject;
import com.aliyun.oss.ClientBuilderConfiguration;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.OSSException;
import com.aliyun.oss.model.ObjectMetadata;
import com.aliyun.oss.model.PutObjectRequest;
import com.aliyun.oss.model.UploadFileRequest;
import com.aliyun.oss.model.UploadFileResult;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.util.FileLoadUtil;
import com.mmc.pms.util.OssConstant;
import com.mmc.pms.util.XmlUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
......@@ -20,6 +26,7 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -74,6 +81,83 @@ public class UploadController {
return ResultBody.success(jsObj);
}
@PostMapping("/breakpoint")
public ResultBody breakpoint(
@RequestParam("uploadFile") MultipartFile uploadFile, HttpServletRequest request) throws IOException {
OSS ossClient =
new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
File file = XmlUtil.ossUpload(uploadFile);
String location =null;
try {
ObjectMetadata meta = new ObjectMetadata();
// 指定上传的内容类型。
// meta.setContentType("text/plain");
// 文件上传时设置访问权限ACL。
// meta.setObjectAcl(CannedAccessControlList.Private);
String oldName = uploadFile.getOriginalFilename();
String newName =
"file/"
+ UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
// 通过UploadFileRequest设置多个参数。
// 依次填写Bucket名称(例如examplebucket)以及Object完整路径(例如exampledir/exampleobject.txt),Object完整路径中不能包含Bucket名称。
UploadFileRequest uploadFileRequest = new UploadFileRequest("pad-video-x",newName);
// 通过UploadFileRequest设置单个参数。
// 填写本地文件的完整路径,例如D:\\localpath\\examplefile.txt。如果未指定本地路径,则默认从示例程序所属项目对应本地路径中上传文件。
uploadFileRequest.setUploadFile(file.toString());
// 指定上传并发线程数,默认值为1。
uploadFileRequest.setTaskNum(15);
// 指定上传的分片大小,单位为字节,取值范围为100 KB~5 GB。默认值为100 KB。
uploadFileRequest.setPartSize(1 * 1024 * 1024);
// 开启断点续传,默认关闭。
uploadFileRequest.setEnableCheckpoint(true);
// 记录本地分片上传结果的文件。上传过程中的进度信息会保存在该文件中,如果某一分片上传失败,再次上传时会根据文件中记录的点继续上传。上传完成后,该文件会被删除。
// 如果未设置该值,默认与待上传的本地文件同路径,名称为${uploadFile}.ucp。
uploadFileRequest.setCheckpointFile("uploadFile.ucp");
// 文件的元数据。
uploadFileRequest.setObjectMetadata(meta);
// 设置上传回调,参数为Callback类型。
//uploadFileRequest.setCallback("yourCallbackEvent");
// 断点续传上传。
UploadFileResult uploadFileResult = ossClient.uploadFile(uploadFileRequest);
location = uploadFileResult.getMultipartUploadResult().getLocation();
System.out.println(uploadFileResult);
} catch (OSSException oe) {
System.out.println("Caught an OSSException, which means your request made it to OSS, "
+ "but was rejected with an error response for some reason.");
System.out.println("Error Message:" + oe.getErrorMessage());
System.out.println("Error Code:" + oe.getErrorCode());
System.out.println("Request ID:" + oe.getRequestId());
System.out.println("Host ID:" + oe.getHostId());
} catch (Throwable ce) {
System.out.println("Caught an ClientException, which means the client encountered "
+ "a serious internal problem while trying to communicate with OSS, "
+ "such as not being able to access the network.");
System.out.println("Error Message:" + ce.getMessage());
} finally {
// 关闭OSSClient。
if (ossClient != null) {
ossClient.shutdown();
}
}
deleteFile(file);
return ResultBody.success(location);
}
private void deleteFile(File... files) {
for (File file : files) {
if (file.exists()) {
file.delete();
}
}
}
@ApiOperation(value = "V1.0.1-上传多个文件到阿里云oss")
@ApiImplicitParams({
@ApiImplicitParam(
......
package com.mmc.pms.controller;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author LW
* @date 2023/6/7 13:33
* 概要:
*/
@Api(tags = {"分类信息"})
@RestController
@RequestMapping("/category")
public class WebAndMiniProgramCategoryController {
// @ApiOperation(value = "web-分类信息")
// @PostMapping("queryCategoryByType")
// @ApiResponses({@ApiResponse(code = 200, message = "OK", response = GoodsInfoListDTO.class)})
// public ResultBody<GoodsInfoListDTO> listPageGoodsInfo(
// @ApiParam("商品查询条件QO") @RequestBody GoodsInfoQO param) {
// return ResultBody.success(webProductMallService.listPageGoodsInfo(param));
// }
}
package com.mmc.pms.controller;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.model.lease.dto.BrandDTO;
import com.mmc.pms.model.lease.dto.DeviceCategoryDTO;
import com.mmc.pms.model.lease.dto.WareInfoDTO;
import com.mmc.pms.model.lease.dto.WareInfoItemDTO;
import com.mmc.pms.model.lease.vo.LeaseVo;
import com.mmc.pms.model.other.dto.AdDTO;
import com.mmc.pms.model.other.dto.DistrictInfoDTO;
import com.mmc.pms.model.other.dto.ModelDTO;
import com.mmc.pms.model.qo.WareInfoQO;
import com.mmc.pms.page.Page;
import com.mmc.pms.service.WebDeviceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author small @Date 2023/5/15 13:25 @Version 1.0
......@@ -29,8 +21,7 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping("/webDevice")
public class WebDeviceController {
@Autowired
private WebDeviceService webDeviceService;
@Autowired private WebDeviceService webDeviceService;
@ApiOperation(value = "地域")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
......@@ -39,65 +30,9 @@ public class WebDeviceController {
return webDeviceService.listSecondDistrict();
}
@ApiOperation("设备类目")
@GetMapping("/category")
public ResultBody<DeviceCategoryDTO> category() {
return webDeviceService.category();
}
@ApiOperation("品牌")
@GetMapping("/brand")
public ResultBody<BrandDTO> brand() {
return webDeviceService.brand();
}
@ApiOperation("型号")
@GetMapping("/model")
public ResultBody<ModelDTO> model() {
return webDeviceService.model();
}
@ApiOperation("设备品牌")
@GetMapping("/deviceBrand")
public ResultBody<BrandDTO> deviceBrand() {
return webDeviceService.deviceBrand();
}
@ApiOperation("设备型号")
@GetMapping("/deviceModel")
public ResultBody<ModelDTO> deviceModel() {
return webDeviceService.deviceModel();
}
@ApiOperation(value = "设备详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("/detail")
public ResultBody<WareInfoDTO> detail(@RequestParam(value = "id", required = true) Integer id) {
WareInfoDTO wareInfoDTO = webDeviceService.getWareInfoById(id);
return wareInfoDTO == null
? ResultBody.error(ResultEnum.NOT_FOUND)
: ResultBody.success(wareInfoDTO);
}
@ApiOperation(value = "立即租赁")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("/update")
public ResultBody update(@RequestBody LeaseVo param) {
return webDeviceService.update(param);
}
@ApiOperation("设备广告位")
@GetMapping("/ad")
public ResultBody<AdDTO> ad() {
return webDeviceService.ad();
}
@ApiOperation(value = "设备列表筛选")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = WareInfoItemDTO.class)})
@PostMapping("/deviceList")
public ResultBody<WareInfoItemDTO> listWareInfoPage(
@RequestBody @Validated(Page.class) WareInfoQO param) {
return webDeviceService.listWareInfoPage(param);
}
}
package com.mmc.pms.controller.web;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author LW
* @date 2023/6/8 15:19
* 概要:
*/
@RestController
@RequestMapping("/lease/goods")
@Api(tags = {"web端-设备租赁-相关接口"})
public class WebLeaseGoodsController {
}
package com.mmc.pms.dao;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.entity.ServiceDO;
import com.mmc.pms.model.qo.ServiceQO;
import com.mmc.pms.model.work.dto.ServiceDTO;
import com.mmc.pms.model.work.vo.UpAndDownServiceVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Author LW
* @date 2023/6/6 10:48
* 概要:
*
* @date 2023/6/6 10:48 概要:
*/
@Mapper
public interface BackstageTaskServiceDao {
......@@ -17,11 +21,19 @@ public interface BackstageTaskServiceDao {
Integer update(ServiceDO serviceDO);
Integer deleteById(Integer id);
Integer deleteByIds(@Param("ids") List<Integer> ids);
ServiceDO queryById(Integer id);
List<ServiceDO> queryAllByLimit(ServiceQO param);
Integer count(ServiceQO param);
int conditionCount(@Param("param") ServiceQO param, @Param("categoriesIds") List<Integer> categoriesIds, @Param("userIds") List<Integer> userIds);
List<ServiceDO> queryPageByLimit(@Param("param") ServiceQO param,@Param("categoriesIds") List<Integer> categoriesIds, @Param("userIds") List<Integer> userIds);
List<ServiceDTO> QueryWorkServiceListById(@Param("ids") List<Integer> ids);
Integer batchUpAndDownWorkService(@Param("param") UpAndDownServiceVO param);
}
......@@ -14,8 +14,7 @@ import java.util.Set;
/**
* @author 23214
* @description 针对表【categories(通用分类表)】的数据库操作Mapper
* @createDate 2023-05-24 10:29:28
* @Entity com.mmc.pms.entity.Categories
* @createDate 2023-05-24 10:29:28 @Entity com.mmc.pms.entity.Categories
*/
@Mapper
public interface CategoriesDao {
......@@ -50,7 +49,7 @@ public interface CategoriesDao {
int countListClassification(QueryClassifyVO queryClassifyVO);
int selectDirectoryById(Integer id);
DirectoryDO selectDirectoryById(Integer id);
int deleteById(Integer id);
......@@ -59,8 +58,10 @@ public interface CategoriesDao {
List<Categories> getCategoriesByDirectoryId(Integer directoryId);
List<Categories> getCategoriesListByIds(@Param("ids") Set<Integer> ids);
}
List<Categories> selectCategoryByDirectoryId(List<Integer> directoryIds);
List<Categories> getCategoriesListByDirectoryIds(List<Integer> directoryIds);
int countChildById(Integer id);
}
package com.mmc.pms.dao;
import com.mmc.pms.entity.*;
import com.mmc.pms.model.sale.qo.MallGoodsQO;
import com.mmc.pms.model.sale.vo.GoodsAddVO;
import com.mmc.pms.model.sale.vo.SpecPriceVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -11,8 +13,7 @@ import java.util.Set;
/**
* @author 23214
* @description 针对表【goods_info(商品基本信息)】的数据库操作Mapper
* @createDate 2023-05-27 14:08:45
* @Entity com.mmc.pms.entity.GoodsInfo
* @createDate 2023-05-27 14:08:45 @Entity com.mmc.pms.entity.GoodsInfo
*/
@Mapper
public interface GoodsInfoDao {
......@@ -53,7 +54,7 @@ public interface GoodsInfoDao {
void batchUpdateMallProductSku(List<Integer> delIds);
void batchUpdateMallProdSkuInfo(List<MallProdInfoDO> mallProdSkuInfoList);
void batchUpdateMallProdSkuInfo(List<MallProdInfoDO> list);
List<MallIndustrySkuInfoDO> getMallIndustrySkuInfo(Integer id);
......@@ -83,7 +84,8 @@ public interface GoodsInfoDao {
List<GoodsServiceDO> listGoodsService(List<Integer> goodsIds);
List<MallGoodsInfoSimpleDO> listMallGoodsIndstSimpleInfo(@Param("indstSkuSpecIds") Set<Integer> indstSkuSpecIds);
List<MallGoodsInfoSimpleDO> listMallGoodsIndstSimpleInfo(
@Param("indstSkuSpecIds") Set<Integer> indstSkuSpecIds);
List<Integer> listIndustrySpecIds(Set<Integer> mallIndstSkuSpecIds);
......@@ -92,8 +94,24 @@ public interface GoodsInfoDao {
List<GoodsInfo> ListGoodsInfoByCategoryId(Integer id);
List<MallProdSkuInfoSpecDO> getMallProSkuInfoSpec(Integer goodsInfoId);
}
List<MallProdSkuInfoSpecDO> listMallprodSpecById(List<Integer> goodsIds);
List<SaleServiceDO> listSaleServiceInfo();
int countListGoodsInfo(MallGoodsQO param);
List<GoodsInfo> listGoodsInfo(MallGoodsQO param);
void batchUpOrDownWare(@Param("ids") List<Integer> ids, @Param("status") Integer status);
void removeWareInfo(List<Integer> ids);
List<SpecPriceVO> getPriceBySpecId(Integer productSpecId, Integer leaseTerm);
int countGoodsInfoByCategoryId(Integer id);
void updateMallProdSkuInfo(MallProdInfoDO mallProdInfoDO);
List<MallProdInfoDO> getAllMallProSkuInfo(Integer goodsInfoId);
}
......@@ -13,8 +13,8 @@ import java.util.Set;
/**
* @Author LW
* @date 2022/10/8 10:58
* 概要:
*
* @date 2022/10/8 10:58 概要:
*/
@Mapper
public interface IndustrySpecDao {
......@@ -54,7 +54,8 @@ public interface IndustrySpecDao {
int countListPageIndustrySpec(Integer id, String keyword);
List<IndustrySpecDO> listPageIndustrySpec(int pageNo, Integer pageSize, Integer industrySkuId, String keyword);
List<IndustrySpecDO> listPageIndustrySpec(
int pageNo, Integer pageSize, Integer industrySkuId, String keyword);
int batchInsertSpecPrice(List<IndustrySpecPriceDO> list);
......@@ -74,10 +75,10 @@ public interface IndustrySpecDao {
void batchUpdateMallIndustSpec(@Param("list") List<Integer> list, @Param("id") Integer id);
List<IndustryProductInventoryDO> listIndustryProdInventory(
@Param("inventoryIds") Set<Integer> inventoryIds);
List<IndustryProductInventoryDO> listIndustryProdInventory(Set<Integer> inventoryIds);
List<IndustrySpecDO> listIndustrySpec(Set<Integer> industrySpecIds);
List<IndustrySpecDO> listIndustrySpec(@Param("industrySpecIds") Set<Integer> industrySpecIds);
int countIndustrySpecBySkuId(Integer id);
......
package com.mmc.pms.dao;
import com.mmc.pms.entity.InspComtDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* <p>
* 评论表 Mapper 接口
* </p>
*
* @author Pika
* @since 2023-06-09
*/
@Mapper
public interface InspComtDao {
List<InspComtDO> randomGetInspComtList(Integer size);
}
......@@ -19,8 +19,7 @@ import java.util.Set;
/**
* @author 23214
* @description 针对表【product_sku(产品sku表)】的数据库操作Mapper
* @createDate 2023-05-25 14:55:56
* @Entity com.mmc.pms.entity.ProductSku
* @createDate 2023-05-25 14:55:56 @Entity com.mmc.pms.entity.ProductSku
*/
@Mapper
public interface ProductDao {
......@@ -49,13 +48,16 @@ public interface ProductDao {
ProductSpecDO getProductSpecDetail(Integer id);
int countListPageProductSpec(Integer productSkuId);
int countListPageProductSpec(@Param("id") Integer id, @Param("keyword") String keyword);
List<ProductSpecDO> listPageProductSpec(int pageNo, Integer pageSize, Integer productSkuId);
List<ProductSpecDO> listPageProductSpec(
@Param(value = "pageNo") Integer pageNo,
@Param(value = "pageSize") Integer pageSize,
@Param(value = "productSkuId") Integer productSkuId,
@Param(value = "keyword") String keyword);
int batchInsertSpecPrice(List<ProductSpecPriceDO> list);
void batchInsertLeaseSpecPrice(List<ProductSpecPriceDO> list);
void removeProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO);
......@@ -80,8 +82,6 @@ public interface ProductDao {
void removeProductSku(Integer id);
List<MallProdInfoDO> listMallProdInfo(String id);
void removeProductSpec(Integer id);
List<IndustrySpecDO> listIndustrySpec(@Param("industrySpecIds") Set<Integer> industrySpecIds);
......@@ -112,8 +112,10 @@ public interface ProductDao {
List<OrderGoodsProdDTO> listProdGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO);
List<MallProdSkuInfoSpecDO> listMallProductSpec(Integer id);
}
List<ProductSpecPriceDO> getProductSpecPriceList(List<Integer> specIds);
ProductSpecPriceDO getProductSpecPriceById(Integer id);
List<DirectoryDO> productDirectoryList();
}
......@@ -4,6 +4,7 @@ import com.mmc.pms.entity.*;
import com.mmc.pms.model.lease.vo.LeaseVo;
import com.mmc.pms.model.qo.WareInfoQO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -33,9 +34,15 @@ public interface WebDeviceDao {
List<WareInfoDO> detail(Integer id);
int countListWareInfoPage(WareInfoQO param);
int countListWareInfoPage(
@Param("categoryIds") List<Integer> categoryIds,
@Param("userIds") List<Integer> userIds,
@Param("type") Integer type);
List<WareInfoDO> listWareInfoPage(WareInfoQO param);
List<GoodsInfo> listWareInfoPage(
@Param("param") WareInfoQO param,
@Param("userIds") List<Integer> userIds,
@Param("type") Integer type);
WareInfoDO getWareInfoById(Integer id);
......
package com.mmc.pms.entity;
import com.mmc.pms.model.categories.dto.CategoriesInfoListDTO;
import com.mmc.pms.model.categories.dto.CategoryTypeDTO;
import com.mmc.pms.model.categories.dto.ClassifyDetailsDTO;
import com.mmc.pms.model.categories.dto.ClassifyInfoDTO;
import com.mmc.pms.model.categories.vo.ClassifyInfoVO;
......@@ -12,8 +13,7 @@ import java.io.Serializable;
import java.util.Date;
/**
* @author lw
* @TableName categories
* @author lw @TableName categories
*/
@Data
@AllArgsConstructor
......@@ -53,16 +53,39 @@ public class Categories implements Serializable {
}
public ClassifyInfoDTO buildClassifyInfoDTO() {
return ClassifyInfoDTO.builder().id(id).description(description)
.icon(icon).pid(parentId).classifyName(name)
.remark(remark).createTime(createTime)
.directoryId(directoryId).type(type).build();
return ClassifyInfoDTO.builder()
.id(id)
.description(description)
.icon(icon)
.pid(parentId)
.classifyName(name)
.remark(remark)
.createTime(createTime)
.directoryId(directoryId)
.type(type)
.build();
}
public ClassifyDetailsDTO buildClassifyDetailsDTO() {
return ClassifyDetailsDTO.builder().id(id).description(description)
.icon(icon).classifyName(name)
.remark(remark).build();
return ClassifyDetailsDTO.builder()
.id(id)
.description(description)
.icon(icon)
.classifyName(name)
.remark(remark)
.build();
}
public CategoriesInfoListDTO buildCategoriesInfoListDTO() {
return CategoriesInfoListDTO.builder()
.id(id)
.directoryId(directoryId)
.icon(icon)
.name(name)
.build();
}
public CategoryTypeDTO buildCategoryTypeDTO() {
return CategoryTypeDTO.builder().id(id).categoryName(name).build();
}
}
package com.mmc.pms.entity;
import com.mmc.pms.model.categories.dto.AllCategoryDTO;
import com.mmc.pms.model.categories.vo.DirectoryInfoVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 目录管理表(Directory)实体类
......@@ -19,46 +25,51 @@ import java.util.Date;
@NoArgsConstructor
public class DirectoryDO implements Serializable {
private static final long serialVersionUID = 713939370607409336L;
/**
* 主键id
*/
/** 主键id */
private Integer id;
/**
* 目录名称
*/
/** 目录名称 */
private String directoryName;
/**
* 其他目录关联id
*/
/** 其他目录关联id */
private Integer pid;
/**
* 类型:(0:通用目录 1:作业服务目录 2:设备目录 3:飞手目录 4:商城目录)
*/
/** 类型:(0:通用目录 1:作业服务目录 2:设备目录 3:飞手目录 4:商城目录) */
private Integer type;
/**
* 创建时间
*/
/** 创建时间 */
private Date createTime;
/**
* 修改时间
*/
/** 修改时间 */
private Date updateTime;
/**
* 是否删除
*/
/** 是否删除 */
private Integer deleted;
private String show;
private String relevanceName;
public DirectoryDO(DirectoryInfoVO param) {
if (CollectionUtils.isNotEmpty(param.getShow())) {
String show = param.getShow().stream().map(Object::toString).collect(Collectors.joining(","));
this.show = show;
}
this.id = param.getId();
this.directoryName = param.getDirectoryName();
this.pid = param.getPid();
this.type = param.getType();
}
public DirectoryInfoVO buildDirectoryInfoVO() {
return DirectoryInfoVO.builder().id(id).directoryName(directoryName).pid(pid).relevanceName(relevanceName).type(type).build();
List<Integer> show = null;
if (!StringUtils.isBlank(this.show)) {
String[] split = this.show.split(",");
show = Arrays.stream(split).map(Integer::parseInt).collect(Collectors.toList());
}
}
return DirectoryInfoVO.builder()
.id(id)
.directoryName(directoryName)
.show(show)
.type(type)
.build();
}
public AllCategoryDTO buildAllCategoryDTO() {
return AllCategoryDTO.builder().directoryId(id).name(directoryName).build();
}
}
package com.mmc.pms.entity;
import com.mmc.pms.model.categories.vo.RelevanceGoodsInfoVO;
import com.mmc.pms.model.lease.dto.LeaseGoodsInfoDTO;
import com.mmc.pms.model.sale.dto.GoodsInfoListDTO;
import com.mmc.pms.model.sale.vo.GoodsAddVO;
import lombok.AllArgsConstructor;
import lombok.Data;
......@@ -10,8 +12,7 @@ import java.io.Serializable;
import java.util.Date;
/**
* @author 23214
* @TableName goods_info
* @author 23214 @TableName goods_info
*/
@Data
@NoArgsConstructor
......@@ -55,6 +56,10 @@ public class GoodsInfo implements Serializable {
private String mainImg;
private Integer isCoupons;
private String directoryName;
private static final long serialVersionUID = 1L;
public GoodsInfo(GoodsAddVO goodsAddVO) {
......@@ -73,6 +78,28 @@ public class GoodsInfo implements Serializable {
}
public RelevanceGoodsInfoVO buildRelevanceGoodsInfoVO() {
return RelevanceGoodsInfoVO.builder().id(id).goodsName(goodsName).shelf(shelfStatus).mainImage(mainImg).build();
return RelevanceGoodsInfoVO.builder()
.id(id)
.goodsName(goodsName)
.shelf(shelfStatus)
.mainImage(mainImg)
.build();
}
public LeaseGoodsInfoDTO buildLeaseGoodsInfoDTO() {
return LeaseGoodsInfoDTO.builder().id(id).goodsName(goodsName).images(mainImg).build();
}
public GoodsInfoListDTO buildGoodsInfoListDTO() {
return GoodsInfoListDTO.builder()
.id(id)
.goodsName(goodsName)
.directoryName(directoryName)
.directoryId(directoryId)
.createTime(createTime)
.imgUrl(mainImg)
.status(shelfStatus)
.isCoupons(this.isCoupons)
.build();
}
}
package com.mmc.pms.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
* <p>
* 评论表
* </p>
*
* @author Pika
* @since 2023-06-09
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class InspComtDO implements Serializable {
private static final long serialVersionUID = 1896389867L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "头像")
private String userImg;
@ApiModelProperty(value = "昵称")
private String nickName;
@ApiModelProperty(value = "评价内容")
private String content;
@ApiModelProperty(value = "评价图片集合 1.jpg,2.jpg 使用逗号隔开")
private String contentImgs;
@ApiModelProperty(value = "评价视频")
private String contentVideo;
@ApiModelProperty(value = "评价星级")
private Integer star;
@ApiModelProperty(value = "关键字集合 深圳市,广州市,长沙市使用逗号隔开")
private String tags;
@ApiModelProperty(value = "是否带图 0:带图 1:不带图")
private Integer isImg;
@ApiModelProperty(value = "评价类型:0:好评 1:差评")
private Integer type;
@ApiModelProperty(value = "创建时间")
private Date createTime;
}
......@@ -31,20 +31,15 @@ public class MallProdInfoDO implements Serializable {
private Date createTime;
private Date updateTime;
private Integer flag;
private String productSpecIdList;
private String beforeUpdateSpec;
/**
* 辅助字段 start
*/
/** 辅助字段 start */
private String typeName;
private String goodsName;
private String unitName;
private String productSkuName;
private Integer brandInfoId;
/**
* 辅助字段 end
*/
/** 辅助字段 end */
public MallProdInfoDO(GoodsProdSpecVO goodsSpecVO) {
this.categoriesId = goodsSpecVO.getCategoryId();
this.prodSkuSpecName = goodsSpecVO.getGoodsSpecName();
......
......@@ -6,6 +6,7 @@ import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
......@@ -26,6 +27,7 @@ public class MallProdSkuInfoSpecDO implements Serializable {
private Date updateTime;
private String goodsName;
private BigDecimal price;
private ProductSpecDO productSpecDO;
}
package com.mmc.pms.entity;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.mmc.pms.model.other.dto.RepoCashDTO;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import java.math.BigDecimal;
......
package com.mmc.pms.entity;
import com.mmc.pms.model.sale.dto.SaleServiceDTO;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* @Author LW
*
* @date 2022/3/28 10:24 概要:
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class SaleServiceDO implements Serializable {
private Integer id;
private String serviceName;
private String remark;
private Integer deleted;
private Date updateTime;
private Date createTime;
public SaleServiceDTO buildSaleServiceDTO() {
return SaleServiceDTO.builder().id(this.id).saleServiceName(this.serviceName).build();
}
}
......@@ -12,8 +12,8 @@ import java.util.Date;
/**
* @Author LW
* @date 2023/6/8 10:33
* 概要:
*
* @date 2023/6/8 10:33 概要:
*/
@Data
@AllArgsConstructor
......@@ -62,15 +62,7 @@ public class ServiceDO implements Serializable {
private Integer isDeleted;
public ServiceDO(ServiceVO param, Integer accountId) {
this.id = param.getId();
this.serviceName = param.getServiceName();
this.applicationId = param.getApplicationId();
this.industryId = param.getIndustryId();
this.displayState = param.getDisplayState();
this.coverPlan = param.getCoverPlan();
this.shareCard = param.getShareCard();
this.video = param.getVideo();
this.serviceIntroduction = param.getServiceIntroduction();
this(param);
this.accountId = accountId;
}
......
package com.mmc.pms.feign;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.mmc.pms.auth.dto.BUserAccountQO;
import com.mmc.pms.auth.dto.UserAccountSimpleDTO;
import com.mmc.pms.feign.hystrix.UserAppApiHystrix;
import io.swagger.annotations.ApiParam;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author: zj
* @Date: 2023/5/18 17:06
*/
//@FeignClient(name = "cms-svc", fallback = UserAppApiHystrix.class)
@FeignClient(url = "${iuav.userapp.url}", name = "cms-svc", fallback = UserAppApiHystrix.class)
public interface UserAppApi {
/**
* 根据用户id获取基本信息
*
* @param userAccountId
* @return
*/
@RequestMapping(value = "/userapp/user-account/feignGetUserSimpleInfo", method = RequestMethod.GET)
public UserAccountSimpleDTO feignGetUserSimpleInfo(@RequestParam Integer userAccountId, @RequestHeader("token") String token);
/**
* 根据地区信息查询用户id
*
* @param provinceCode
* @param cityCode
* @param districtCode
* @return
*/
@GetMapping("/userapp/user-account/feignListUserAccountIds")
List<Integer> feignListUserAccountIds(@RequestParam Integer provinceCode, @RequestParam(required = false) Integer cityCode,
@RequestParam(required = false) Integer districtCode, @RequestHeader(value = "token", required = false) String token);
/**
* 获取用户集合列表页面
*
* @param bUserAccountQO 问:b用户帐户
* @return {@link List}<{@link UserAccountSimpleDTO}>
*/
@PostMapping("/userapp/back-user/feignListBAccountPage")
List<UserAccountSimpleDTO> feignListBAccountPage(@ApiParam(value = "账号查询QO", required = true) @RequestBody BUserAccountQO bUserAccountQO, @RequestHeader("token") String token);
}
package com.mmc.pms.feign.config;
import com.mmc.pms.feign.hystrix.UserAppApiHystrix;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
/**
* @author: zj
* @Date: 2023/5/18 18:21
*/
@ComponentScan(basePackages = "com.mmc.pms.feign")
@Configuration
public class FeignConfiguration {
@Bean(name = "userAppApiHystrix")
public UserAppApiHystrix userAppApi() {
return new UserAppApiHystrix();
}
}
package com.mmc.pms.feign.hystrix;
import com.mmc.pms.auth.dto.BUserAccountQO;
import com.mmc.pms.auth.dto.UserAccountSimpleDTO;
import com.mmc.pms.feign.UserAppApi;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
/**
* @author: zj
* @Date: 2023/5/18 17:08
*/
@Slf4j
public class UserAppApiHystrix implements UserAppApi {
@Override
public UserAccountSimpleDTO feignGetUserSimpleInfo(Integer userAccountId, String token) {
log.error("熔断:feignGetUserSimpleInfo:{}", userAccountId);
return null;
}
@Override
public List<Integer> feignListUserAccountIds(Integer provinceCode, Integer cityCode, Integer districtCode, String token) {
log.error("熔断:feignListUserAccountIds:{}, {}, {}", provinceCode, cityCode, districtCode);
return null;
}
@Override
public List<UserAccountSimpleDTO> feignListBAccountPage(BUserAccountQO bUserAccountQO, String token) {
log.error("熔断:feignListBAccountPage:{}", bUserAccountQO);
return null;
}
}
/**
* Copyright 2023 bejson.com
*/
package com.mmc.pms.model.categories.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* Auto-generated: 2023-06-08 16:2:43
*
* @author 23214
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class AllCategoryDTO implements Serializable {
private static final long serialVersionUID = 1171841063641249397L;
private Integer directoryId;
private String name;
private List<CategoriesInfoListDTO> categoriesInfoListDTO;
}
\ No newline at end of file
/** Copyright 2023 bejson.com */
package com.mmc.pms.model.categories.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* Auto-generated: 2023-06-08 16:2:43
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class CategoriesInfoListDTO implements Serializable {
private static final long serialVersionUID = -8381856228953745772L;
private Integer id;
private Integer directoryId;
private String name;
private String icon;
}
package com.mmc.pms.model.categories.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @Author LW
*
* @date 2023/6/10 13:46 概要:
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class CategoryTypeDTO implements Serializable {
private Integer id;
private String categoryName;
}
......@@ -6,11 +6,12 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @Author LW
* @date 2023/5/24 11:06
* 概要:
*
* @date 2023/5/24 11:06 概要:
*/
@Data
@NoArgsConstructor
......@@ -19,12 +20,13 @@ import lombok.NoArgsConstructor;
public class DirectoryInfoVO {
@ApiModelProperty(value = "目录id")
private Integer id;
@ApiModelProperty(value = "目录名称")
private String directoryName;
@ApiModelProperty(value = "关联目录的id")
private Integer pid;
@ApiModelProperty(value = "关联目录名称")
private String relevanceName;
@ApiModelProperty(value = "分类模块:(0:通用分类 1:作业服务分类 2:设备分类 3:飞手分类 4:商城分类)")
private Integer type;
@ApiModelProperty(value = "显示:1:作业服务分类 2:设备分类 3:飞手分类 4:商城分类")
private List<Integer> show;
}
package com.mmc.pms.model.lease.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Author small @Date 2023/5/16 9:53 @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LeaseGoodsInfoDTO implements Serializable {
private static final long serialVersionUID = -4354269497656808831L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "商品名称")
private String goodsName;
@ApiModelProperty(value = "商品图片")
private String images;
@ApiModelProperty(value = "价格")
private BigDecimal price;
}
package com.mmc.pms.model.qo;
import com.mmc.pms.common.Page;
import com.mmc.pms.model.group.Freeze;
import com.mmc.pms.page.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
......
package com.mmc.pms.model.qo;
import com.mmc.pms.common.Page;
import com.mmc.pms.model.group.Freeze;
import com.mmc.pms.page.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
......
package com.mmc.pms.model.qo;
import com.mmc.pms.common.Page;
import com.mmc.pms.model.group.Freeze;
import com.mmc.pms.page.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
......
package com.mmc.pms.model.qo;
import com.mmc.pms.common.Page;
import com.mmc.pms.model.group.Freeze;
import io.swagger.annotations.ApiModelProperty;
......@@ -13,11 +12,12 @@ import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @Author LW
* @date 2023/6/8 10:33
* 概要:
*
* @date 2023/6/8 10:33 概要:
*/
@Data
@AllArgsConstructor
......@@ -33,22 +33,32 @@ public class ServiceQO implements Serializable {
@Length(message = "最大不超过30字", max = 30)
private String serviceName;
@ApiModelProperty(value = "应用", example = "1")
@ApiModelProperty(value = "分类id集合(应用/行业等)")
private List<Integer> categoryId;
@ApiModelProperty(value = "应用id")
private Integer applicationId;
@ApiModelProperty(value = "行业", example = "2")
@ApiModelProperty(value = "行业id")
private Integer industryId;
@ApiModelProperty(value = "账号id")
private Integer accountId;
@ApiModelProperty(value = "省份编码", example = "440000")
private Integer provinceId;
@ApiModelProperty(value = "展示状态")
private Integer displayState;
@ApiModelProperty(value = "页码", required = true)
@NotNull(message = "页码不能为空", groups = {Page.class, Freeze.class})
@NotNull(
message = "页码不能为空",
groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true)
@NotNull(message = "每页显示数不能为空", groups = {Page.class, Freeze.class})
@NotNull(
message = "每页显示数不能为空",
groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
......
package com.mmc.pms.model.qo;
import com.mmc.pms.page.Page;
import com.mmc.pms.common.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
......@@ -9,6 +9,7 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @Author small @Date 2023/5/16 9:55 @Version 1.0
......@@ -16,42 +17,24 @@ import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
// @ApiModel(value = "com.mmc.csf.model.qo.WareInfoQO", description = "model")
public class WareInfoQO implements Serializable {
private static final long serialVersionUID = -2953141525621912414L;
@ApiModelProperty(name = "id", value = "设备id", example = "1", required = false)
private Integer id;
@ApiModelProperty(name = "districtId", value = "地域id", example = "440000")
private Integer provinceId;
@ApiModelProperty(name = "districtId", value = "地域id", example = "1", required = false)
private Integer districtId;
@ApiModelProperty(name = "categoryId", value = "分类id")
private List<Integer> categoryId;
@ApiModelProperty(name = "categoryId", value = "类目id", example = "类目id")
private Integer categoryId;
@ApiModelProperty(name = "产品类型:0商城 1租赁")
private Integer type;
@ApiModelProperty(name = "brandIdl", value = "品牌id", example = "品牌id")
private Integer brandId;
@ApiModelProperty(name = "modelId", value = "型号id", example = "型号id")
private Integer modelId;
/*@ApiModelProperty(value = "关键字")
private String keyword;
@ApiModelProperty(value = "商品状态,出租中或仓库中")
private Integer wareStatus;
@ApiModelProperty(value = "商品类型")
private Integer wareTypeId;
@ApiModelProperty(value = "活动属性")
private Integer propInfoId;*/
@ApiModelProperty(value = "页码", required = true)
@ApiModelProperty(value = "页码", required = true, example = "1")
@NotNull(message = "页码不能为空", groups = Page.class)
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true)
@ApiModelProperty(value = "每页显示数", required = true, example = "10")
@NotNull(message = "每页显示数不能为空", groups = Page.class)
@Min(value = 1, groups = Page.class)
private Integer pageSize;
......
......@@ -7,12 +7,13 @@ import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* @Author LW
* @date 2022/10/14 11:30
* 概要:
*
* @date 2022/10/14 11:30 概要:
*/
@Data
@NoArgsConstructor
......@@ -20,30 +21,49 @@ import java.util.List;
@Accessors(chain = true)
public class MallGoodsDetailDTO implements Serializable {
private static final long serialVersionUID = 7041502536618388167L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "商品图片")
private List<GoodsImgDTO> images;
@ApiModelProperty(value = "商品视频")
private String goodsVideo;
@ApiModelProperty(value = "商品视频id")
private Integer goodsVideoId;
@ApiModelProperty(value = "商品名称")
private String goodsName;
@ApiModelProperty(value = "商品编号")
private String goodsNo;
@ApiModelProperty(value = "商品详情")
private GoodsDetailInfoDTO goodsDetail;
@ApiModelProperty(value = "所属目录")
private Integer directoryId;
@ApiModelProperty(value = "一级分类id")
private Integer categoryByOne;
@ApiModelProperty(value = "二级分类id")
private Integer categoryByTwo;
@ApiModelProperty(value = "商品标签")
private String tag;
@ApiModelProperty(value = "商品状态 0:下架 1:上架")
private Integer shelfStatus;
@ApiModelProperty(value = "规格信息")
private List<GoodsSpecDTO> goodsSpec;
@ApiModelProperty(value = "其他服务: 1:免费配送,2:专业飞手培训2日, 3:半年保修, 4:一年保修 ")
private List<GoodsOtherServiceDTO> otherService;
@ApiModelProperty(value = "price(用于租赁商品)")
private BigDecimal price;
}
......@@ -9,6 +9,7 @@ import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Author small @Date 2023/5/16 15:30 @Version 1.0
......@@ -41,4 +42,7 @@ public class ProductSpecDTO implements Serializable {
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "价格配置")
private List<ProductSpecPriceDTO> priceList;
}
package com.mmc.pms.model.sale.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author LW
* @date 2022/3/28 10:48
* 概要:
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "com.mmc.csf.mall.dto.SaleServiceDTO", description = "其他服务信息DTO")
public class SaleServiceDTO {
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "其他服务名称")
private String saleServiceName;
}
package com.mmc.pms.model.sale.qo;
import com.mmc.pms.common.Page;
import com.mmc.pms.model.group.Freeze;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/**
* @Author LW
*
* @date 2022/3/22 9:44 概要:商品列表查询QO
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MallGoodsQO {
@ApiModelProperty(value = "商品名称", example = "商品名称")
private String goodsName;
@ApiModelProperty(value = "商品类型 0:销售 1:租赁", example = "0")
private Integer goodsType;
@ApiModelProperty(value = "开始时间", example = "2023-06-09 00:00:00")
private String startTime;
@ApiModelProperty(value = "结束时间", example = "2023-06-11 23:59:59")
private String endTime;
@ApiModelProperty(value = "状态 0:下架(仓库中)1:上架", example = "1")
private Integer status;
@ApiModelProperty(value = "目录id", example = "1")
private Integer directoryId;
@ApiModelProperty(value = "页码", required = true, example = "1")
@NotNull(
message = "页码不能为空",
groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true, example = "10")
@NotNull(
message = "每页显示数不能为空",
groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
}
package com.mmc.pms.model.sale.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @Author LW
*
* @date 2022/4/1 20:22 概要:
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "com.mmc.csf.model.vo.BatchShelfVO", description = "商品上下架参数")
public class BatchShelfVO implements Serializable {
@ApiModelProperty(value = "商品id")
private List<Integer> goodsIds;
@ApiModelProperty(value = "状态:上架:1,下架:0")
private Integer status;
}
package com.mmc.pms.model.sale.vo;
import com.mmc.pms.common.Page;
import com.mmc.pms.model.group.Create;
import com.mmc.pms.model.group.Freeze;
import com.mmc.pms.model.group.Update;
import com.mmc.pms.page.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
......@@ -15,30 +15,34 @@ import java.io.Serializable;
/**
* @Author LW
* @date 2023/5/25 11:25
* 概要:
*
* @date 2023/5/25 11:25 概要:
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class QueryClassifyVO implements Serializable {
@ApiModelProperty(value = "所属目录id")
@NotNull(message = "所属目录id不能为空", groups = {Update.class, Create.class})
@NotNull(
message = "所属目录id不能为空",
groups = {Update.class, Create.class})
private Integer directoryId;
@ApiModelProperty(value = "分类所属模块id(0:通用分类 1:作业服务分类 2:设备租赁分类 3:飞手培训分类 4:产品商城分类)")
private Integer type;
@ApiModelProperty(value = "页码", required = true)
@NotNull(message = "页码不能为空", groups = {Page.class, Freeze.class})
@NotNull(
message = "页码不能为空",
groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true)
@NotNull(message = "每页显示数不能为空", groups = {Page.class, Freeze.class})
@NotNull(
message = "每页显示数不能为空",
groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
}
......@@ -18,4 +18,6 @@ public class SpecPriceVO implements Serializable {
private Integer id;
private Integer cooperationTag;
private BigDecimal price;
private Integer productSpecId;
private Integer leaseTerm;
}
package com.mmc.pms.model.work.dto;
import com.mmc.pms.entity.InspComtDO;
import com.mmc.pms.entity.ServiceDO;
import com.mmc.pms.model.work.vo.ServiceVO;
import io.swagger.annotations.ApiModelProperty;
......@@ -10,6 +11,7 @@ import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Author LW
......@@ -59,6 +61,12 @@ public class ServiceDTO implements Serializable {
@ApiModelProperty(value = "账号id")
private Integer accountId;
@ApiModelProperty(value = "评论列表")
private List<InspComtDO> inspComtList;
@ApiModelProperty(value = "评论数量")
private Integer inspComtAmount;
@ApiModelProperty(value = "创建时间")
private Date createTime;
......
package com.mmc.pms.model.work.dto;
import com.mmc.pms.entity.InspComtDO;
import com.mmc.pms.model.group.Create;
import com.mmc.pms.model.group.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class WorkServiceDTO implements Serializable {
private static final long serialVersionUID = -15752785758L;
private Integer id;
@ApiModelProperty(value = "服务名称")
private String serviceName;
@ApiModelProperty(value = "服务价格")
private BigDecimal servicePrice;
@ApiModelProperty(value = "封面图")
private String coverPlan;
@ApiModelProperty(value = "分享卡片")
private String shareCard;
@ApiModelProperty(value = "视频")
private String video;
@ApiModelProperty(value = "服务介绍")
private String serviceIntroduction;
@ApiModelProperty(value = "公司名称")
private String companyName;
@ApiModelProperty(value = "评论列表")
private List<InspComtDO> inspComtList;
@ApiModelProperty(value = "评论数量")
private Integer inspComtAmount;
}
......@@ -15,8 +15,8 @@ import java.io.Serializable;
/**
* @Author LW
* @date 2023/6/8 10:33
* 概要:
*
* @date 2023/6/8 10:33 概要:
*/
@Data
@AllArgsConstructor
......@@ -26,11 +26,15 @@ public class ServiceVO implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull(message = "修改服务id不能为空", groups = {Update.class})
@NotNull(
message = "修改服务id不能为空",
groups = {Update.class})
private Integer id;
@ApiModelProperty(value = "服务名称", example = "服务名称")
@NotBlank(message = "服务名称不能为空", groups = {Create.class, Update.class})
@NotBlank(
message = "服务名称不能为空",
groups = {Create.class})
@Length(message = "最大不超过30字", max = 30)
private String serviceName;
......@@ -38,15 +42,21 @@ public class ServiceVO implements Serializable {
private Integer applicationId;
@ApiModelProperty(value = "行业", example = "2")
@NotNull(message = "行业id不能为空", groups = {Create.class, Update.class})
@NotNull(
message = "行业id不能为空",
groups = {Create.class})
private Integer industryId;
@ApiModelProperty(value = "展示状态,0为上架,1下架", example = "0")
@NotNull(message = "展示状态不能为空", groups = {Create.class, Update.class})
@NotNull(
message = "展示状态不能为空",
groups = {Create.class})
private Integer displayState;
@ApiModelProperty(value = "封面图")
@NotBlank(message = "封面图不能为空", groups = {Create.class, Update.class})
@NotBlank(
message = "封面图不能为空",
groups = {Create.class})
private String coverPlan;
@ApiModelProperty(value = "分享卡片")
......
package com.mmc.pms.model.work.vo;
import com.mmc.pms.model.group.Update;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class UpAndDownServiceVO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id集合")
@Size(min = 1,message = "修改时id集合不能为空",groups = Update.class)
private List<Integer> ids;
@ApiModelProperty(value = "展示状态,0为上架,1下架", example = "0")
@NotNull(message = "修改时展示状态不能为空",groups = Update.class)
private Integer displayState;
}
package com.mmc.pms.page;
/**
* @Author small @Date 2023/5/16 10:09 @Version 1.0
*/
public interface Page {}
package com.mmc.pms.service;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.qo.ServiceQO;
import com.mmc.pms.model.work.dto.ServiceDTO;
import com.mmc.pms.model.work.vo.ServiceVO;
import com.mmc.pms.model.work.vo.UpAndDownServiceVO;
import com.mmc.pms.page.PageResult;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* @Author LW
* @date 2023/6/6 10:46
* 概要:
*
* @date 2023/6/6 10:46 概要:
*/
public interface BackstageTaskService {
ResultBody addWorkService(ServiceVO param, Integer userAccountId);
ResultBody updateById(ServiceVO param);
ResultBody deleteById(Integer id);
ResultBody deleteByIds(List<Integer> ids);
ResultBody<ServiceDTO> queryById(Integer id);
PageResult queryServiceManagerList(ServiceQO param, Integer userAccountId);
PageResult queryWorkServiceList(ServiceQO param, HttpServletRequest request);
ResultBody queryById(Integer id);
List<ServiceDTO> feignQueryWorkServiceListById(List<Integer> ids);
PageResult queryWorkServiceList(ServiceQO param, Integer userAccountId);
ResultBody batchUpAndDownWorkService(UpAndDownServiceVO param);
}
......@@ -4,13 +4,14 @@ import com.mmc.pms.common.ResultBody;
import com.mmc.pms.entity.Categories;
import com.mmc.pms.entity.DirectoryDO;
import com.mmc.pms.entity.DistrictDO;
import com.mmc.pms.model.categories.vo.CategoriesInfoVO;
import com.mmc.pms.model.categories.dto.AllCategoryDTO;
import com.mmc.pms.model.categories.vo.ClassifyInfoVO;
import com.mmc.pms.model.categories.vo.DirectoryInfoVO;
import com.mmc.pms.model.sale.vo.QueryClassifyVO;
import com.mmc.pms.page.PageResult;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
......@@ -42,10 +43,13 @@ public interface CategoriesService {
ResultBody getDirectoryList(Integer type);
ResultBody queryCategoryInfoByType(Integer type);
List<Categories> getCategoriesListByDirectoryName(String directoryName);
ResultBody getApplicationList(String directoryName);
List<Categories> getCategoriesListByIds(Set<Integer> ids);
List<AllCategoryDTO> feigQqueryCategoryInfoByType(Integer type);
}
package com.mmc.pms.service;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.sale.dto.ProductSpecPriceDTO;
import com.mmc.pms.model.order.dto.OrderGoodsIndstDTO;
import com.mmc.pms.model.order.dto.OrderGoodsProdDTO;
import com.mmc.pms.model.qo.MallOrderGoodsInfoQO;
import com.mmc.pms.model.qo.ProductSpecPriceQO;
import com.mmc.pms.model.sale.dto.MallGoodsShopCarDTO;
import com.mmc.pms.model.sale.dto.MallProductSpecPriceDTO;
import com.mmc.pms.model.sale.dto.ProductSpecPriceDTO;
import com.mmc.pms.model.sale.qo.MallGoodsQO;
import com.mmc.pms.model.sale.vo.GoodsAddVO;
import com.mmc.pms.page.PageResult;
import java.util.List;
......@@ -23,10 +25,12 @@ public interface GoodsInfoService {
ResultBody editGoodsInfo(GoodsAddVO goodsAddVO);
ResultBody getGoodsInfoDetail(Integer goodsInfoId);
ResultBody getGoodsInfoDetail(Integer goodsInfoId, Integer type, Integer leaseTerm);
ResultBody getSkuUnit();
ResultBody getSaleServiceInfoToList();
List<MallGoodsShopCarDTO> fillGoodsInfo(List<MallGoodsShopCarDTO> param);
List<MallProductSpecPriceDTO> feignListProductSpecPrice(ProductSpecPriceQO productSpecPriceQO);
......@@ -36,4 +40,10 @@ public interface GoodsInfoService {
List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO);
List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO);
PageResult listPageGoodsInfo(MallGoodsQO param);
ResultBody batchOnShelfOrTakeDown(List<Integer> goodsIds, Integer status);
ResultBody batchRemoveWareInfo(List<Integer> ids);
}
package com.mmc.pms.service.Impl;
import com.google.common.collect.Lists;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.constant.DateConstant;
import com.mmc.pms.dao.BackstageTaskServiceDao;
import com.mmc.pms.dao.CategoriesDao;
import com.mmc.pms.entity.Categories;
import com.mmc.pms.entity.InspComtDO;
import com.mmc.pms.entity.ServiceDO;
import com.mmc.pms.feign.UserAppApi;
import com.mmc.pms.model.qo.ServiceQO;
import com.mmc.pms.model.work.dto.ServiceDTO;
import com.mmc.pms.model.work.dto.WorkServiceDTO;
import com.mmc.pms.model.work.vo.ServiceVO;
import com.mmc.pms.model.work.vo.UpAndDownServiceVO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.BackstageTaskService;
import com.mmc.pms.service.CategoriesService;
import com.mmc.pms.service.InspComtService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* @Author LW
* @date 2023/6/8 9:59
* 概要:
*
* @date 2023/6/8 9:59 概要:
*/
@Service
@Slf4j
public class BackstageTaskServiceImpl implements BackstageTaskService {
@Autowired
private BackstageTaskServiceDao backstageTaskServiceDao;
@Autowired private BackstageTaskServiceDao backstageTaskServiceDao;
@Autowired
private CategoriesDao categoriesDao;
@Autowired private CategoriesDao categoriesDao;
@Autowired private UserAppApi userAppApi;
@Autowired private InspComtService inspComtService;
@Autowired private RedisTemplate redisTemplate;
@Override
public ResultBody addWorkService(ServiceVO param, Integer userAccountId) {
......@@ -48,25 +66,32 @@ public class BackstageTaskServiceImpl implements BackstageTaskService {
}
@Override
public ResultBody deleteById(Integer id) {
backstageTaskServiceDao.deleteById(id);
public ResultBody deleteByIds(List<Integer> ids) {
if(!CollectionUtils.isEmpty(ids)){
backstageTaskServiceDao.deleteByIds(ids);
}
return ResultBody.success();
}
@Override
public ResultBody queryById(Integer id) {
public ResultBody<ServiceDTO> queryById(Integer id) {
ServiceDO serviceDO = backstageTaskServiceDao.queryById(id);
ServiceDTO serviceDTO = new ServiceDTO(serviceDO);
Map<Integer, String> categoriesNameMap = getCategoriesNameByIds(Arrays.asList(serviceDTO.getApplicationId(),serviceDTO.getIndustryId()));
if(!CollectionUtils.isEmpty(categoriesNameMap)){
Map<Integer, String> categoriesNameMap =
getCategoriesNameByIds(
Arrays.asList(serviceDTO.getApplicationId(), serviceDTO.getIndustryId()));
if (!CollectionUtils.isEmpty(categoriesNameMap)) {
serviceDTO.setApplicationName(categoriesNameMap.get(serviceDTO.getApplicationId()));
serviceDTO.setIndustryName(categoriesNameMap.get(serviceDTO.getIndustryId()));
}
List<InspComtDO> inspComtList = RandomGetInspComt(id);
serviceDTO.setInspComtList(inspComtList);
serviceDTO.setInspComtAmount(inspComtList.size());
return ResultBody.success(serviceDTO);
}
private Map<Integer,String> getCategoriesNameByIds(List<Integer> ids){
if(CollectionUtils.isEmpty(ids)){
private Map<Integer, String> getCategoriesNameByIds(List<Integer> ids) {
if (CollectionUtils.isEmpty(ids)) {
return new HashMap<>();
}
Set<Integer> idSet = new HashSet<>();
......@@ -74,33 +99,114 @@ public class BackstageTaskServiceImpl implements BackstageTaskService {
idSet.add(id);
}
List<Categories> categories = categoriesDao.getCategoriesListByIds(idSet);
if(CollectionUtils.isEmpty(categories)){
if (CollectionUtils.isEmpty(categories)) {
return new HashMap<>();
}
return categories.stream().collect(Collectors.toMap(Categories::getId, d -> d.getName(), (k1, k2) -> k1));
return categories.stream()
.collect(Collectors.toMap(Categories::getId, d -> d.getName(), (k1, k2) -> k1));
}
@Override
public PageResult queryWorkServiceList(ServiceQO param, Integer userAccountId) {
public PageResult queryServiceManagerList(ServiceQO param, Integer userAccountId) {
int count = backstageTaskServiceDao.count(param);
if(count == 0){
return PageResult.buildPage(param.getPageNo(), param.getPageSize(),count);
if (count == 0) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
}
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<ServiceDO> services = backstageTaskServiceDao.queryAllByLimit(param);
List<ServiceDTO> pageList = setApplicationNameAndIndustryName(services);
return PageResult.buildPage(pageNo, param.getPageSize(), count, pageList);
}
private List<ServiceDTO> setApplicationNameAndIndustryName(List<ServiceDO> services) {
List<Integer> list = new ArrayList<>();
for (ServiceDO service : services) {
list.add(service.getApplicationId());
list.add(service.getIndustryId());
}
Map<Integer, String> categoriesNameMap = getCategoriesNameByIds(list);
List<ServiceDTO> pageList = services.stream().map(d->{
List<ServiceDTO> pageList =
services.stream()
.map(
d -> {
ServiceDTO serviceDTO = new ServiceDTO(d);
serviceDTO.setApplicationName(categoriesNameMap.get(d.getApplicationId()));
serviceDTO.setIndustryName(categoriesNameMap.get(d.getIndustryId()));
return serviceDTO;
}).collect(Collectors.toList());
return PageResult.buildPage(pageNo, param.getPageSize(),count,pageList);
})
.collect(Collectors.toList());
return pageList;
}
@Override
public PageResult queryWorkServiceList(ServiceQO param, HttpServletRequest request) {
log.info(
"开始queryWorkServiceList==>{}",
JSONObject.toJSONString(DateFormatUtils.format(new Date(), DateConstant.YYYYMMDDHHMMSS)));
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<Integer> userIds = null;
Integer provinceCode = param.getProvinceId();
if(provinceCode!=null){
userIds = userAppApi.feignListUserAccountIds(provinceCode, null, null, null);
if(userIds==null || userIds.size()==0){
userIds = Arrays.asList(-1);
}
}
List<Integer> categoriesIds = param.getCategoryId();
int count = backstageTaskServiceDao.conditionCount(param,categoriesIds,userIds);
if (count == 0) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
}
List<ServiceDO> pageList = backstageTaskServiceDao.queryPageByLimit(param,categoriesIds,userIds);
List<WorkServiceDTO> workServiceDTOList = getWorkServiceDTOS(pageList);
log.info(
"结束queryWorkServiceList==>{}",
JSONObject.toJSONString(DateFormatUtils.format(new Date(), DateConstant.YYYYMMDDHHMMSS)));
return PageResult.buildPage(pageNo, param.getPageSize(), count, workServiceDTOList);
}
@Override
public List<ServiceDTO> feignQueryWorkServiceListById(List<Integer> ids) {
return backstageTaskServiceDao.QueryWorkServiceListById(ids);
}
@Override
public ResultBody batchUpAndDownWorkService(UpAndDownServiceVO param) {
if(!CollectionUtils.isEmpty(param.getIds())){
backstageTaskServiceDao.batchUpAndDownWorkService(param);
}
return ResultBody.success();
}
private List<WorkServiceDTO> getWorkServiceDTOS(List<ServiceDO> pageList) {
// 用户暂时无关联公司数据,先用假数据展示
String companyName = "浙江科比特创新科技有限公司";
List<WorkServiceDTO> workServiceDTOList = new ArrayList<>();
for (ServiceDO item : pageList) {
WorkServiceDTO workServiceDTO = WorkServiceDTO.builder().id(item.getId()).serviceName(item.getServiceName()).companyName(companyName)
.coverPlan(item.getCoverPlan()).serviceIntroduction(item.getServiceIntroduction()).video(item.getVideo()).shareCard(item.getShareCard()).build();
workServiceDTOList.add(workServiceDTO);
}
return workServiceDTOList;
}
/**
* 根据id随机获取50条以上的评论
*/
private List<InspComtDO> RandomGetInspComt(Integer id) {
String listStr = (String) redisTemplate.opsForValue().get(id);
List<InspComtDO> inspComtRandomList = null;
if(StringUtils.isNotBlank(listStr)){
inspComtRandomList = JSONArray.parseArray(listStr, InspComtDO.class);
}else {
inspComtRandomList = inspComtService.randomGetInspComtList(RandomUtils.nextInt(50, 9999));
String toJSONString = JSONObject.toJSONString(inspComtRandomList);
redisTemplate.opsForValue().set(id, toJSONString, 2L, TimeUnit.DAYS);
}
return inspComtRandomList;
}
}
package com.mmc.pms.service.Impl;
import com.mmc.pms.dao.InspComtDao;
import com.mmc.pms.entity.InspComtDO;
import com.mmc.pms.service.InspComtService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 评论表 服务实现类
* </p>
*
* @author Pika
* @since 2023-06-09
*/
@Service
public class InspComtServiceImpl implements InspComtService {
@Autowired
private InspComtDao inspComtDao;
@Override
public List<InspComtDO> randomGetInspComtList(Integer size) {
return inspComtDao.randomGetInspComtList(size);
}
}
......@@ -3,12 +3,9 @@ package com.mmc.pms.service.Impl;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.dao.MiniProgramProductMallDao;
import com.mmc.pms.dao.WebDeviceDao;
import com.mmc.pms.entity.*;
import com.mmc.pms.model.qo.GoodsInfoQO;
import com.mmc.pms.model.sale.dto.*;
import com.mmc.pms.model.sale.vo.GoodsProductSkuVO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.MiniProgramProductMallService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -26,10 +23,7 @@ import java.util.stream.Collectors;
@Service
public class MiniProgramProductMallServiceImpl implements MiniProgramProductMallService {
@Autowired
private MiniProgramProductMallDao goodsInfoDao;
@Autowired
private WebDeviceDao webDeviceDao;
@Autowired private MiniProgramProductMallDao goodsInfoDao;
@Override
public ResultBody getAppGoodsInfoDetail(Integer goodsId) {
......@@ -127,68 +121,44 @@ public class MiniProgramProductMallServiceImpl implements MiniProgramProductMall
return ResultBody.success(appGoodsInfoDetailDTO);
}
@Override
public ResultBody listGoodsByQO(GoodsInfoQO param) {
int count = goodsInfoDao.countListGoodsByQO(param);
if (count == 0) {
return ResultBody.success(
PageResult.buildPage(param.getPageNo(), param.getPageSize(), count));
}
int pageNo = param.getPageNo();
param.buildCurrentPage();
List<GoodsInfoDO> list = goodsInfoDao.listGoodsByQO(param);
// 找出行业对应的序号
List<GoodsTypeDO> ids = goodsInfoDao.listIndustryIdBySort();
int order = 0;
/*if (param.getMasterTypeId() != null) {
for (int i = 0; i < ids.size(); i++) {
if (param.getMasterTypeId().toString().equals(ids.get(i).getId().toString())) {
order = i + 1;
break;
}
}
}*/
List<AppGoodsInfoDTO> pageList = new ArrayList<>();
for (GoodsInfoDO d : list) {
AppGoodsInfoDTO appGoodsInfoDTO = d.buildAppGoodsInfoDTO();
// 直接看该服务在当前行业对应所有服务中在第几个
for (int j = 0; j < list.size(); j++) {
if (appGoodsInfoDTO.getId().toString().equals(list.get(j).getId().toString())) {
if (j < 9) {
appGoodsInfoDTO.setCode(order + "0" + (j + 1));
} else {
appGoodsInfoDTO.setCode(order + "" + (j + 1));
}
break;
}
}
if (appGoodsInfoDTO.getShelfStatus() == 1) {
pageList.add(appGoodsInfoDTO);
}
}
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, pageList));
}
private List<GoodsSpecDTO> getIndustrySpecInfo(Integer goodsInfoId) {
// 获取商品对应绑定的行业sku信息
List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList = goodsInfoDao.getMallIndustrySkuInfo(goodsInfoId);
List<GoodsSpecDTO> list = mallIndustrySkuInfoList.stream().map(MallIndustrySkuInfoDO::buildGoodsSpecDTO).collect(Collectors.toList());
List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList =
goodsInfoDao.getMallIndustrySkuInfo(goodsInfoId);
List<GoodsSpecDTO> list =
mallIndustrySkuInfoList.stream()
.map(MallIndustrySkuInfoDO::buildGoodsSpecDTO)
.collect(Collectors.toList());
// 根据商品id查出该商品下绑定的规格信息
List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpec = goodsInfoDao.getIndustrySkuInfoSpec(goodsInfoId);
list = list.stream().peek(d -> {
List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpec =
goodsInfoDao.getIndustrySkuInfoSpec(goodsInfoId);
list =
list.stream()
.peek(
d -> {
List<MallIndustrySpecDTO> industrySpec = new ArrayList<>();
for (MallIndustrySkuInfoSpecDO e : mallIndustrySkuInfoSpec) {
if (d.getId().equals(e.getMallIndustrySkuInfoId())) {
IndustrySpecDO industrySpecDO = e.getIndustrySpecDO();
// 获取商品清单信息
List<IndustryProductInventoryDO> industryProdInventory = goodsInfoDao.getIndustryProductInventory(e.getIndustrySpecId());
List<IndustryProductInventoryDO> industryProdInventory =
goodsInfoDao.getIndustryProductInventory(e.getIndustrySpecId());
List<ProductInventoryVO> productInventoryList = new ArrayList<>();
// 获取行业规格绑定的产品规格信息
List<InventorySpecDO> inventorySpecDOList = goodsInfoDao.listInventorySpec(industryProdInventory.stream().map(IndustryProductInventoryDO::getId).collect(Collectors.toList()));
Map<Integer, List<InventorySpecDO>> inventoryMap = inventorySpecDOList.stream().collect(Collectors.groupingBy(InventorySpecDO::getIndustryProductInventoryId));
getIndustrySpecOnProdSpecInfo(industryProdInventory, productInventoryList, inventoryMap);
MallIndustrySpecDTO industrySpecDTO = industrySpecDO.buildMallIndustrySpecDTO();
List<InventorySpecDO> inventorySpecDOList =
goodsInfoDao.listInventorySpec(
industryProdInventory.stream()
.map(IndustryProductInventoryDO::getId)
.collect(Collectors.toList()));
Map<Integer, List<InventorySpecDO>> inventoryMap =
inventorySpecDOList.stream()
.collect(
Collectors.groupingBy(
InventorySpecDO::getIndustryProductInventoryId));
getIndustrySpecOnProdSpecInfo(
industryProdInventory, productInventoryList, inventoryMap);
MallIndustrySpecDTO industrySpecDTO =
industrySpecDO.buildMallIndustrySpecDTO();
industrySpecDTO.setId(e.getId());
industrySpecDTO.setIndustrySpecId(e.getIndustrySpecId());
industrySpecDTO.setIndustrySkuId(d.getSkuId());
......@@ -197,7 +167,8 @@ public class MiniProgramProductMallServiceImpl implements MiniProgramProductMall
}
}
d.setIndustrySpecList(industrySpec);
}).collect(Collectors.toList());
})
.collect(Collectors.toList());
return list;
}
......
package com.mmc.pms.service.Impl;
import com.mmc.pms.auth.dto.UserAccountSimpleDTO;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.constant.TokenConstant;
import com.mmc.pms.dao.CategoriesDao;
import com.mmc.pms.dao.GoodsInfoDao;
import com.mmc.pms.dao.ProductDao;
import com.mmc.pms.dao.WebDeviceDao;
import com.mmc.pms.entity.*;
import com.mmc.pms.feign.UserAppApi;
import com.mmc.pms.model.lease.dto.*;
import com.mmc.pms.model.lease.vo.LeaseVo;
import com.mmc.pms.model.other.dto.AdDTO;
import com.mmc.pms.model.other.dto.DistrictInfoDTO;
import com.mmc.pms.model.other.dto.ModelDTO;
import com.mmc.pms.model.qo.WareInfoQO;
import com.mmc.pms.model.sale.dto.MallGoodsDetailDTO;
import com.mmc.pms.model.sale.dto.SkuInfoDTO;
import com.mmc.pms.model.sale.vo.ProductSpecCPQVO;
import com.mmc.pms.model.sale.vo.SpecPriceVO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.WebDeviceService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
......@@ -24,19 +39,23 @@ import java.util.stream.Collectors;
@Service
public class WebDeviceServiceImpl implements WebDeviceService {
@Autowired
WebDeviceDao webDeviceDao;
@Autowired WebDeviceDao webDeviceDao;
@Autowired UserAppApi userAppApi;
@Autowired ProductDao productDao;
@Autowired GoodsInfoDao goodsInfoDao;
@Autowired GoodsInfoServiceImpl goodsInfoService;
@Autowired private CategoriesDao categoriesDao;
@Override
public ResultBody listSecondDistrict() {
List<DistrictDO> list = webDeviceDao.listSecondDistrict();
List<DistrictInfoDTO> dtoList =
list.stream()
.map(
d -> {
return d.builderDistrictInfoDTO();
})
.collect(Collectors.toList());
list.stream().map(DistrictDO::builderDistrictInfoDTO).collect(Collectors.toList());
return ResultBody.success(dtoList);
}
......@@ -144,26 +163,75 @@ public class WebDeviceServiceImpl implements WebDeviceService {
}
@Override
public ResultBody listWareInfoPage(WareInfoQO param) {
int count = webDeviceDao.countListWareInfoPage(param);
public ResultBody listWareInfoPage(
WareInfoQO param, HttpServletRequest request, Integer userAccountId) {
List<Integer> userIds = null;
if (param.getProvinceId() != null) {
userIds =
userAppApi.feignListUserAccountIds(
param.getProvinceId(),
null,
null,
StringUtils.isBlank(request.getHeader(TokenConstant.TOKEN))
? null
: request.getHeader(TokenConstant.TOKEN));
if (userIds == null || userIds.size() == 0) {
userIds = Collections.singletonList(-1);
}
}
int count = webDeviceDao.countListWareInfoPage(param.getCategoryId(), userIds, param.getType());
if (count == 0) {
return ResultBody.success(
PageResult.buildPage(param.getPageNo(), param.getPageSize(), count));
}
int pageNo = param.getPageNo();
param.buildCurrentPage();
List<WareInfoDO> list = webDeviceDao.listWareInfoPage(param);
List<WareInfoItemDTO> pageList =
list.stream()
.map(
List<GoodsInfo> list = webDeviceDao.listWareInfoPage(param, userIds, param.getType());
List<LeaseGoodsInfoDTO> pageList =
list.stream().map(GoodsInfo::buildLeaseGoodsInfoDTO).collect(Collectors.toList());
if (StringUtils.isBlank(request.getHeader(TokenConstant.TOKEN))) {
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, pageList));
}
UserAccountSimpleDTO userAccountSimpleDTO =
userAppApi.feignGetUserSimpleInfo(userAccountId, request.getHeader(TokenConstant.TOKEN));
if (userAccountSimpleDTO == null) {
return ResultBody.error(ResultEnum.INTERNAL_SERVER_ERROR);
}
if (userAccountSimpleDTO.getCooperationTagId() == null) {
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, pageList));
}
List<Integer> goodsId =
pageList.stream().map(LeaseGoodsInfoDTO::getId).collect(Collectors.toList());
List<MallProdSkuInfoSpecDO> mallProSkuInfoSpec = goodsInfoDao.listMallprodSpecById(goodsId);
Map<Integer, MallProdSkuInfoSpecDO> specMap =
mallProSkuInfoSpec.stream()
.collect(
Collectors.toMap(MallProdSkuInfoSpecDO::getGoodsInfoId, d -> d, (k1, k2) -> k1));
pageList.stream()
.peek(
d -> {
return d.buildWareInfoItemDTO();
MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO = specMap.get(d.getId());
d.setPrice(mallProdSkuInfoSpecDO.getPrice());
})
.collect(Collectors.toList());
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, pageList));
}
@Override
public ResultBody getLeaseGoodsDetail(
Integer goodsInfoId, Integer userAccountId, HttpServletRequest request, Integer type) {
int count = goodsInfoDao.countGoodsInfoById(goodsInfoId);
if (count <= 0) {
return ResultBody.error(ResultEnum.GOODS_NOT_EXIST_OR_ALREADY_DOWN_SHELF);
}
// 初始化商品返回信息的对象
ResultBody goodsInfoDetail = goodsInfoService.getGoodsInfoDetail(goodsInfoId, type, 0);
MallGoodsDetailDTO result = (MallGoodsDetailDTO) goodsInfoDetail.getResult();
return ResultBody.success(result);
}
@Override
public WareInfoDTO getWareInfoById(Integer id) {
WareInfoDO wareInfoDO = webDeviceDao.getWareInfoById(id);
WareDetailDO wareDetailDO = webDeviceDao.getWareDetailById(id);
......@@ -174,6 +242,21 @@ public class WebDeviceServiceImpl implements WebDeviceService {
}
@Override
public ResultBody getPageHomeCategories(Integer type) {
List<DirectoryDO> directoryList = categoriesDao.getDirectoryList(type);
if (CollectionUtils.isNotEmpty(directoryList)) {
List<Integer> directoryIds =
directoryList.stream().map(DirectoryDO::getId).collect(Collectors.toList());
List<Categories> categoriesList = categoriesDao.getCategoriesListByDirectoryIds(directoryIds);
return ResultBody.success(
categoriesList.stream()
.map(Categories::buildCategoryTypeDTO)
.collect(Collectors.toList()));
}
return ResultBody.success();
}
@Override
public ResultBody<AdDTO> ad() {
List<AdDO> ad = webDeviceDao.ad();
List<AdDTO> collect =
......@@ -189,9 +272,24 @@ public class WebDeviceServiceImpl implements WebDeviceService {
@Override
public List<SkuInfoDTO> listWareSkuById(Integer id) {
List<SkuInfoDO> skuInfoDOS = webDeviceDao.listSkuInfo(id);
return skuInfoDOS.isEmpty() ? null : skuInfoDOS.stream().map(d -> {
return skuInfoDOS.isEmpty()
? null
: skuInfoDOS.stream()
.map(
d -> {
return d.buildSkuInfoDTO();
}).collect(Collectors.toList());
})
.collect(Collectors.toList());
}
@Override
public ResultBody<ProductSpecCPQVO> getLeaseGoodsPriceDetail(
Integer productSpecId, Integer leaseTerm) {
ProductSpecCPQVO productSpecCPQVO = new ProductSpecCPQVO();
List<SpecPriceVO> specPriceList = goodsInfoDao.getPriceBySpecId(productSpecId, leaseTerm);
productSpecCPQVO.setProductSpecId(productSpecId);
productSpecCPQVO.setLeaseTerm(leaseTerm);
productSpecCPQVO.setSpecPrice(specPriceList);
return ResultBody.success(productSpecCPQVO);
}
}
......@@ -6,9 +6,10 @@ import com.mmc.pms.entity.AdDO;
import com.mmc.pms.entity.GoodsInfoDO;
import com.mmc.pms.entity.ProductCategory;
import com.mmc.pms.model.other.dto.AdDTO;
import com.mmc.pms.model.sale.dto.ProductCategoryDTO;
import com.mmc.pms.model.qo.GoodsInfoQO;
import com.mmc.pms.model.sale.dto.GoodsInfoListDTO;
import com.mmc.pms.model.qo.GoodsInfoQO;
import com.mmc.pms.model.sale.dto.ProductCategoryDTO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.WebProductMallService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -23,8 +24,7 @@ import java.util.stream.Collectors;
@Service
public class WebProductMallServiceImpl implements WebProductMallService {
@Autowired
private WebProductMallDao webProductMallDao;
@Autowired private WebProductMallDao webProductMallDao;
@Override
public ResultBody productCategory() {
......@@ -66,6 +66,19 @@ public class WebProductMallServiceImpl implements WebProductMallService {
}
@Override
public ResultBody<AdDTO> ad() {
List<AdDO> ad = webProductMallDao.ad();
List<AdDTO> collect =
ad.stream()
.map(
t -> {
return t.adDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public PageResult listPageGoodsInfo(GoodsInfoQO param) {
int count = webProductMallDao.countListGoodsInfo(param);
if (count == 0) {
......@@ -84,17 +97,4 @@ public class WebProductMallServiceImpl implements WebProductMallService {
goodsInfo.stream().map(GoodsInfoDO::buildGoodsInfoListDTO).collect(Collectors.toList());
return PageResult.buildPage(pageNo, param.getPageSize(), count, pageList);
}
@Override
public ResultBody<AdDTO> ad() {
List<AdDO> ad = webProductMallDao.ad();
List<AdDTO> collect =
ad.stream()
.map(
t -> {
return t.adDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
}
package com.mmc.pms.service;
import com.mmc.pms.entity.InspComtDO;
import java.util.List;
/**
* <p>
* 评论表 服务类
* </p>
*
* @author Pika
* @since 2023-06-09
*/
public interface InspComtService {
List<InspComtDO> randomGetInspComtList(Integer size);
}
package com.mmc.pms.service;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.qo.GoodsInfoQO;
/**
* @Author small @Date 2023/5/16 15:08 @Version 1.0
*/
public interface MiniProgramProductMallService {
ResultBody getAppGoodsInfoDetail(Integer id);
ResultBody listGoodsByQO(GoodsInfoQO param);
}
......@@ -2,6 +2,7 @@ package com.mmc.pms.service;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.entity.ProductSpecPriceDO;
import com.mmc.pms.model.categories.vo.DirectoryInfoVO;
import com.mmc.pms.model.lease.vo.PriceAcquisition;
import com.mmc.pms.model.qo.ProductSkuQO;
import com.mmc.pms.model.sale.dto.ProductSkuVO;
......@@ -30,7 +31,8 @@ public interface ProductSkuService {
ResultBody getProductSpecDetail(Integer id);
ResultBody listPageProductSpec(Integer pageNo, Integer pageSize, Integer productSkuId);
ResultBody listPageProductSpec(
Integer pageNo, Integer pageSize, Integer productSkuId, String keyword);
ResultBody productSpecCPQ(ProductSpecCPQVO productSpecCPQVO);
......@@ -46,4 +48,5 @@ public interface ProductSkuService {
BigDecimal feignGetUnitPriceByTag(PriceAcquisition priceAcquisition);
ResultBody<DirectoryInfoVO> productDirectoryList();
}
package com.mmc.pms.service;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.categories.dto.CategoryTypeDTO;
import com.mmc.pms.model.lease.dto.WareInfoDTO;
import com.mmc.pms.model.lease.vo.LeaseVo;
import com.mmc.pms.model.other.dto.AdDTO;
import com.mmc.pms.model.qo.WareInfoQO;
import com.mmc.pms.model.sale.dto.SkuInfoDTO;
import com.mmc.pms.model.sale.vo.ProductSpecCPQVO;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
......@@ -31,11 +34,18 @@ public interface WebDeviceService {
ResultBody detail(Integer id);
ResultBody listWareInfoPage(WareInfoQO param);
ResultBody listWareInfoPage(WareInfoQO param, HttpServletRequest request, Integer userAccountId);
WareInfoDTO getWareInfoById(Integer id);
ResultBody<AdDTO> ad();
List<SkuInfoDTO> listWareSkuById(Integer id);
ResultBody getLeaseGoodsDetail(
Integer goodsId, Integer userAccountId, HttpServletRequest request, Integer type);
ResultBody<CategoryTypeDTO> getPageHomeCategories(Integer type);
ResultBody<ProductSpecCPQVO> getLeaseGoodsPriceDetail(Integer productSpecId, Integer leaseTerm);
}
package com.mmc.pms.util;
import org.springframework.beans.BeanUtils;
import java.util.Objects;
/**
* @author 作者 dahang
* @version 创建时间:2022年7月23日
* @explain 同名属性拷贝值
*/
public class BeanCopyUtils {
public static <T> T properties(Object source, T target) {
if (Objects.isNull(source)) {
return target;
}
BeanUtils.copyProperties(source, target);
return target;
}
public static <T> T properties(Object source, Class<T> target) {
T t = null;
try {
t = target.newInstance();
if (Objects.isNull(source)) {
return t;
}
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
BeanUtils.copyProperties(source, t);
return t;
}
}
......@@ -3,7 +3,6 @@ package com.mmc.pms.util;
import com.mmc.pms.common.BaseErrorInfoInterface;
import com.mmc.pms.common.ResultEnum;
/**
* @author 作者 geDuo
* @version 创建时间:2021年8月13日 上午9:25:43
......@@ -13,13 +12,9 @@ public class BizException extends RuntimeException {
private static final long serialVersionUID = 1L;
/**
* 错误码
*/
/** 错误码 */
protected String errorCode;
/**
* 错误信息
*/
/** 错误信息 */
protected String errorMsg;
public BizException() {
......
package com.mmc.pms.util;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.util.UUID;
/**
* @Author small
* @Date 2023/6/12 19:36
* @Version 1.0
*/
public class XmlUtil {
public static File ossUpload(MultipartFile file) throws IOException {
// 获取文件名
String fileName = file.getOriginalFilename();
// 获取文件后缀
String prefix = fileName.substring(fileName.lastIndexOf("."));
// 用uuid作为文件名,防止生成的临时文件重复
File excelFile = File.createTempFile(UUID.randomUUID().toString(), prefix);
// MultipartFile to File
file.transferTo(excelFile);
//程序结束时,删除临时文件
return excelFile;
}
}
......@@ -15,8 +15,8 @@ spring:
max-active: 2
servlet:
multipart:
max-file-size: 200MB
max-request-size: 200MB
max-file-size: 512MB
max-request-size: 512MB
springfox:
documentation:
......@@ -37,4 +37,8 @@ mmcflying:
mount:
directory: D:@javaVolume@
iuav:
userapp:
url: https://test.iuav.shop
......@@ -22,6 +22,10 @@ spring:
max-idle: 8
#初始化最小
min-idle: 1
servlet:
multipart:
max-file-size: 512MB
max-request-size: 512MB
#mybatis-plus
mybatis-plus:
global-config:
......@@ -54,4 +58,8 @@ mmcflying:
mount:
directory: D:@javaVolume@
iuav:
userapp:
url: http://127.0.0.1:35150
......@@ -15,8 +15,8 @@ spring:
max-active: 2
servlet:
multipart:
max-file-size: 200MB
max-request-size: 200MB
max-file-size: 512MB
max-request-size: 512MB
springfox:
documentation:
......@@ -36,3 +36,7 @@ mmcflying:
path: /ossservlet/upload/download/
mount:
directory: D:@javaVolume@
iuav:
userapp:
url: https://www.iuav.shop
......@@ -15,8 +15,8 @@ spring:
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
main:
banner-mode: off
logging:
level:
com:
mmc:
pms: DEBUG
file:
name: "/var/log/app/${spring.application.name}.log"
\ No newline at end of file
......@@ -25,9 +25,8 @@
is_deleted
</sql>
<insert id="insertDirectory">
insert into directory(directory_name, pid,
`type`)
values (#{directoryName}, #{pid}, #{type})
insert into directory (directory_name, `type`, `show`)
values (#{directoryName}, #{type}, #{show})
</insert>
<insert id="insertClassification">
insert into categories (parent_id,
......@@ -42,8 +41,8 @@
<update id="updateDirectory">
update directory
set directory_name = #{directoryName},
pid = #{pid},
`type` = #{type}
`type` = #{type},
`show` = #{show}
where id = #{id}
</update>
<update id="removeDirectory">
......@@ -87,12 +86,10 @@
<select id="directoryList" resultType="com.mmc.pms.entity.DirectoryDO">
SELECT d.id,
d.directory_name,
d.pid,
d.`type`,
d.create_time,
dt.directory_name relevanceName
d.show
FROM `directory` d
LEFT JOIN `directory` dt ON dt.id = d.pid
<where>
d.is_deleted = 0
<if test="type != null">
......@@ -151,7 +148,6 @@
FROM categories
WHERE is_deleted = 0
AND directory_id = #{directoryId}
AND type = #{type}
ORDER BY sort asc
LIMIT #{pageNo}, #{pageSize}
</select>
......@@ -160,30 +156,37 @@
FROM categories
WHERE is_deleted = 0
AND directory_id = #{directoryId}
AND `type` = #{type}
</select>
<select id="selectDirectoryById" resultType="java.lang.Integer">
select count(*)
from directory
where id = #{id}
and is_default = 0
</select>
<select id="getDirectoryList" resultType="com.mmc.pms.entity.DirectoryDO">
SELECT d.id,
d.directory_name,
d.pid,
d.`type`,
d.create_time
FROM `directory` d
WHERE d.is_deleted = 0
AND d.type = #{type}
OR d.type = 0
AND d.pid IS NULL
or (d.type = 0 and d.`show` like CONCAT('%', #{type}, '%') and d.is_deleted = 0)
ORDER BY create_time DESC
</select>
<select id="selectCategoryByDirectoryId" resultType="com.mmc.pms.entity.Categories">
select id, `name`, icon,directory_id
from categories
<where>
is_deleted = 0 and parent_id = 0
<foreach collection="list" separator="," open="and directory_id in(" close=")" index="index" item="d">
#{d}
</foreach>
</where>
order by sort asc
</select>
<select id="getCategoriesByDirectoryId" resultType="com.mmc.pms.entity.Categories" parameterType="java.lang.Integer">
SELECT id,`name` from categories where directory_id = #{directoryId} and is_deleted = 0 order by create_time desc
<select id="getCategoriesByDirectoryId" resultType="com.mmc.pms.entity.Categories"
parameterType="java.lang.Integer">
SELECT id, `name`
from categories
where directory_id = #{directoryId}
and is_deleted = 0
order by create_time desc
</select>
<select id="getCategoriesListByIds" resultType="com.mmc.pms.entity.Categories">
......@@ -194,6 +197,32 @@
</foreach>
and is_deleted = 0
</select>
<select id="selectDirectoryById" resultType="com.mmc.pms.entity.DirectoryDO">
select id, directory_name
from directory
where id = #{id}
and is_default = 0
</select>
<select id="getCategoriesListByDirectoryIds" resultType="com.mmc.pms.entity.Categories">
SELECT
id,
`name`
FROM
categories
<where>
is_deleted = 0
<foreach collection="list" item="d" index="index" open=" and directory_id IN (" close=")" separator=",">
#{d}
</foreach>
</where>
</select>
<select id="countChildById" resultType="java.lang.Integer">
SELECT COUNT(*)
FROM categories c1
INNER JOIN categories c2 ON c1.id = c2.parent_id
AND c2.is_deleted = 0
WHERE c1.id = #{id}
</select>
<update id="deleteById">
UPDATE `categories`
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论