提交 121e5a29 作者: panda

Merge remote-tracking branch 'origin/master'

...@@ -32,3 +32,4 @@ build/ ...@@ -32,3 +32,4 @@ build/
### VS Code ### ### VS Code ###
.vscode/ .vscode/
kustomization/overlays/prod/kustomize kustomization/overlays/prod/kustomize
*.log
\ No newline at end of file
FROM openjdk:8-jdk-alpine FROM openjdk:8-jdk-alpine
#VOLUME ["/tmp","/files","/var/logs/"] VOLUME ["/var/log/app/"]
ARG JAVA_OPTS ARG JAVA_OPTS
ENV JAVA_OPTS=$JAVA_OPTS ENV JAVA_OPTS=$JAVA_OPTS
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
......
...@@ -5,3 +5,5 @@ metadata: ...@@ -5,3 +5,5 @@ metadata:
namespace: default namespace: default
data: data:
SPRING_PROFILES_ACTIVE: default SPRING_PROFILES_ACTIVE: default
SW_AGENT_COLLECTOR_BACKEND_SERVICES: "default-oap.default:11800"
SW_AGENT_NAME: pms
...@@ -14,10 +14,14 @@ spec: ...@@ -14,10 +14,14 @@ spec:
metadata: metadata:
labels: labels:
app: pms app: pms
swck-java-agent-injected: 'true'
spec: spec:
containers: containers:
- name: pms - name: pms
image: REGISTRY/NAMESPACE/IMAGE:TAG image: REGISTRY/NAMESPACE/IMAGE:TAG
volumeMounts:
- name: log-of-app
mountPath: /var/log/app
resources: resources:
limits: limits:
memory: 1024Mi memory: 1024Mi
...@@ -29,4 +33,18 @@ spec: ...@@ -29,4 +33,18 @@ spec:
valueFrom: valueFrom:
configMapKeyRef: configMapKeyRef:
name: pms-map name: pms-map
key: SPRING_PROFILES_ACTIVE key: SPRING_PROFILES_ACTIVE
\ No newline at end of file - 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: ...@@ -18,4 +18,4 @@ patches:
images: images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG - name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/pms newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/pms
newTag: 506594e8af493b698ecb2e75c3f5b291e2f83181 newTag: ccc7c809c80517b9c27c53b03fafcb3feefd04b6
...@@ -18,4 +18,4 @@ patches: ...@@ -18,4 +18,4 @@ patches:
images: images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG - name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly/pms newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly/pms
newTag: f481d859358f8a8bfbd8b127a3c25a05fc288fa3 newTag: 5e9165eda0f547dc245accbd881d1cbdcf00f20d
...@@ -5,7 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; ...@@ -5,7 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication @SpringBootApplication
@EnableFeignClients @EnableFeignClients(basePackages = "com.mmc.pms.feign")
public class PmsApplication { public class PmsApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -6,18 +6,16 @@ import org.springframework.web.servlet.config.annotation.InterceptorRegistry; ...@@ -6,18 +6,16 @@ import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/** /**
* @author: zj * @author: zj @Date: 2023/5/28 10:52
* @Date: 2023/5/28 10:52
*/ */
@Configuration @Configuration
public class MvcConfiguration implements WebMvcConfigurer { public class MvcConfiguration implements WebMvcConfigurer {
@Autowired @Autowired private TokenCheckHandleInterceptor tokenCheckHandleInterceptor;
private TokenCheckHandleInterceptor tokenCheckHandleInterceptor;
@Override @Override
public void addInterceptors(InterceptorRegistry registry) { public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(tokenCheckHandleInterceptor); registry.addInterceptor(tokenCheckHandleInterceptor);
WebMvcConfigurer.super.addInterceptors(registry); WebMvcConfigurer.super.addInterceptors(registry);
} }
} }
...@@ -8,16 +8,15 @@ import org.springframework.context.annotation.PropertySource; ...@@ -8,16 +8,15 @@ import org.springframework.context.annotation.PropertySource;
import java.util.List; import java.util.List;
/** /**
* @author: zj * @author: zj @Date: 2023/5/28 13:54
* @Date: 2023/5/28 13:54
*/ */
@Data @Data
@Configuration @Configuration
@ConfigurationProperties(prefix = "data-filter", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "data-filter", ignoreUnknownFields = false)
@PropertySource("classpath:not-check.yml") @PropertySource("classpath:not-check.yml")
public class NotCheckUriConfig { public class NotCheckUriConfig {
// 不需要验证token的请求地址 // 不需要验证token的请求地址
private List<String> notAuthPath; private List<String> notAuthPath;
// 不需要验证token的请求地址;// 不需要验证token的请求地址 // 不需要验证token的请求地址;// 不需要验证token的请求地址
private List<String> uploadPath; private List<String> uploadPath;
} }
package com.mmc.pms.auth; package com.mmc.pms.auth;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum; import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.util.PathUtil; import com.mmc.pms.util.PathUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter; import java.io.PrintWriter;
/** /**
* @author: zj * @author: zj @Date: 2023/5/28 10:46
* @Date: 2023/5/28 10:46
*/ */
@Slf4j @Slf4j
@Component @Component
public class TokenCheckHandleInterceptor implements HandlerInterceptor { public class TokenCheckHandleInterceptor implements HandlerInterceptor {
@Autowired @Autowired private StringRedisTemplate stringRedisTemplate;
private StringRedisTemplate stringRedisTemplate;
@Autowired @Autowired private NotCheckUriConfig notCheckUriConfig;
private NotCheckUriConfig notCheckUriConfig;
@Override @Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
String requestURI = request.getRequestURI(); throws Exception {
// //根据uri确认是否要拦截 String requestURI = request.getRequestURI();
if (!shouldFilter(requestURI)) { // //根据uri确认是否要拦截
return true; if (!shouldFilter(requestURI)) {
} return true;
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;
}
//
// 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;
} }
String token = request.getHeader("token");
@Override if (StringUtils.isBlank(token)) {
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { exceptionProcess(response);
return false;
} }
String tokenJson = stringRedisTemplate.opsForValue().get(token);
@Override if (StringUtils.isBlank(tokenJson)) {
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { 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;
// }
// 测试-打印请求信息
return true;
}
public void exceptionProcess(HttpServletResponse response) throws Exception { @Override
response.setContentType("application/json;charset=utf-8"); public void postHandle(
PrintWriter writer = response.getWriter(); HttpServletRequest request,
writer.write(ResultBody.error(ResultEnum.LOGIN_ACCOUNT_STATUS_ERROR).toString()); HttpServletResponse response,
writer.close(); Object handler,
} ModelAndView modelAndView)
throws Exception {}
@Override
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");
PrintWriter writer = response.getWriter();
writer.write(ResultBody.error(ResultEnum.LOGIN_ACCOUNT_STATUS_ERROR).toString());
writer.close();
}
private boolean shouldFilter(String path) { private boolean shouldFilter(String path) {
// 路径与配置的相匹配,则执行过滤 // 路径与配置的相匹配,则执行过滤
for (String pathPattern : notCheckUriConfig.getNotAuthPath()) { for (String pathPattern : notCheckUriConfig.getNotAuthPath()) {
if (PathUtil.isPathMatch(pathPattern, path)) { if (PathUtil.isPathMatch(pathPattern, path)) {
// 如果匹配 // 如果匹配
return false; return false;
} }
}
return true;
} }
return true;
}
} }
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;
}
}
...@@ -7,24 +7,24 @@ import lombok.NoArgsConstructor; ...@@ -7,24 +7,24 @@ import lombok.NoArgsConstructor;
import java.io.Serializable; import java.io.Serializable;
/** /**
* @author 作者 geDuo * @author 作者 geDuo
* @version 创建时间:2021年8月31日 下午8:06:14 * @version 创建时间:2021年8月31日 下午8:06:14
* @explain 类说明 * @explain 类说明
*/ */
@Builder @Builder
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class LoginSuccessDTO implements Serializable { public class LoginSuccessDTO implements Serializable {
private static final long serialVersionUID = -1200834589953161925L; private static final long serialVersionUID = -1200834589953161925L;
private String token; private String token;
private Integer userAccountId; private Integer userAccountId;
private String accountNo; private String accountNo;
private Integer portType; private Integer portType;
private String uid; private String uid;
private String phoneNum; private String phoneNum;
private String userName; private String userName;
private String nickName; 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.common; package com.mmc.pms.common;
/** /**
* @Author small * @Author small @Date 2023/5/15 14:30 @Version 1.0
* @Date 2023/5/15 14:30
* @Version 1.0
*/ */
public enum ResultEnum implements BaseErrorInfoInterface { public enum ResultEnum implements BaseErrorInfoInterface {
// 数据操作错误定义 // 数据操作错误定义
SUCCESS("200", "success"), BODY_NOT_MATCH("400", "请求的数据格式不符!"), SIGNATURE_NOT_MATCH("401", "请求的数字签名不匹配!"), SUCCESS("200", "success"),
NOT_FOUND("404", "未找到该资源!"), INTERNAL_SERVER_ERROR("500", "服务器内部错误!"), SERVER_BUSY("503", "服务器正忙,请稍后再试!"), BODY_NOT_MATCH("400", "请求的数据格式不符!"),
FILE_UPLOAD_ERROR("600", "文件上传有误"), FILE_UPLOAD_NULL_ERROR("601", "上传的文件不能为空"), SIGNATURE_NOT_MATCH("401", "请求的数字签名不匹配!"),
TOKEN_EXPIRED_ERROR("602", "登录信息已过期,请重新登录"), TOKEN_INVALID_ERROR("603", "无效的登录信息"), NOT_FOUND("404", "未找到该资源!"),
VERIFY_CODE_ERROR("604", "验证码错误,请重新输入"), TOKEN_REDIS_ERROR("605", "登录失效"), INTERNAL_SERVER_ERROR("500", "服务器内部错误!"),
AUTH_ACCOUNT_ERROR("606", "当前账号未授权,请先授权"), TOEKN_REPEAT_ERROR("607", "该账号已在其他设备登录,请重新登录"), SERVER_BUSY("503", "服务器正忙,请稍后再试!"),
TOKEN_NOT_VALID_ERROR("608", "access_token已失效或access_token不是最新的"), FILE_UPLOAD_ERROR("600", "文件上传有误"),
SCHEDULE_SYS_ERROR("703", "系统定时任务执行错误"), FILE_UPLOAD_NULL_ERROR("601", "上传的文件不能为空"),
FORM_REPEAT_ERROR("704", "操作次数频繁,请稍后重试"), DATA_VERSION_ERROR("705", "数据写入版本不一致,请稍后重试。"), TOKEN_EXPIRED_ERROR("602", "登录信息已过期,请重新登录"),
REQUEST_PARAM_ILLEGAL_ERROR("706", "请求参数非法"), TOKEN_INVALID_ERROR("603", "无效的登录信息"),
DATA_INSERT_ERROR("707", "数据插入失败"), VERIFY_CODE_ERROR("604", "验证码错误,请重新输入"),
SCORE_RELEASE_ERROR("708", "积分发放失败,请重试或联系管理员!"), TOKEN_REDIS_ERROR("605", "登录失效"),
ENTRY_INTO_FORCE_TIME_SET_ERROR("709", "生效时间不能小于当前时间!"), AUTH_ACCOUNT_ERROR("606", "当前账号未授权,请先授权"),
INFO_NO_EXISTENCE_OR_STATUS_ERROR("710", "信息不存在或状态有误!"), TOEKN_REPEAT_ERROR("607", "该账号已在其他设备登录,请重新登录"),
TOKEN_NOT_VALID_ERROR("608", "access_token已失效或access_token不是最新的"),
// 业务操作错误定义 SCHEDULE_SYS_ERROR("703", "系统定时任务执行错误"),
CUSTOM_ERROR("-1", "自定义业务错误消息"), FORM_REPEAT_ERROR("704", "操作次数频繁,请稍后重试"),
FEIGN_ORDER_SERVLET_ERROR("4001", "访问订单服务失败"), FEIGN_USER_SERVLET_ERROR("4002", "访问用户服务失败"), DATA_VERSION_ERROR("705", "数据写入版本不一致,请稍后重试。"),
FEIGN_PAY_SERVLET_ERROR("4003", "访问消耗服务失败"), REQUEST_PARAM_ILLEGAL_ERROR("706", "请求参数非法"),
DISABLE_ACCOUNT_TOKEN_ERROR("4004", "账号信息变更,登录失效"), DATA_INSERT_ERROR("707", "数据插入失败"),
FEIGN_OPERATION_SERVLET_ERROR("4005", "访问行业服务失败"), SCORE_RELEASE_ERROR("708", "积分发放失败,请重试或联系管理员!"),
ADMIN_ROLE_REPEAT_ERROR("4006", "操作失败,超级管理员和运营管理员有且只有一个"), ENTRY_INTO_FORCE_TIME_SET_ERROR("709", "生效时间不能小于当前时间!"),
FEIGN_FLYER_SERVLET_ERROR("4007", "访问飞手服务失败"), INFO_NO_EXISTENCE_OR_STATUS_ERROR("710", "信息不存在或状态有误!"),
FEIGN_REPOORDER_SERVLET_ERROR("4008", "访问订单服务失败"),
FEIGN_REPOPAY_SERVLET_ERROR("4009", "访问云仓消耗服务失败"), // 业务操作错误定义
FEIGN_REPOUSER_SERVLET_ERROR("4010", "访问云仓用户服务失败"), CUSTOM_ERROR("-1", "自定义业务错误消息"),
FEIGN_WARE_SERVLET_ERROR("4010", "访问云仓商品服务失败"), FEIGN_ORDER_SERVLET_ERROR("4001", "访问订单服务失败"),
FEIGN_DEVICE_SERVLET_ERROR("4011", "访问云仓设备服务失败"), FEIGN_USER_SERVLET_ERROR("4002", "访问用户服务失败"),
CENTER_USER_SERVLET_ERROR("4012", "访问用户中心服务失败"), GATEWAY_HYSRIX_ERROR("4013", "服务器貌似在开小差~"), FEIGN_PAY_SERVLET_ERROR("4003", "访问消耗服务失败"),
FEIGN_FLYER_PAY_SERVLET_ERROR("4014", "访问飞手消耗服务失败"), DISABLE_ACCOUNT_TOKEN_ERROR("4004", "账号信息变更,登录失效"),
MALL_USER_SERVLET_ERROR("4015", "访问机城用户服务失败"), FEIGN_OPERATION_SERVLET_ERROR("4005", "访问行业服务失败"),
PRIMARY_KEY_DEFECT("5001", "主键ID缺失"), ADMIN_ROLE_REPEAT_ERROR("4006", "操作失败,超级管理员和运营管理员有且只有一个"),
WALLET_NOT_FIND_ERROR("5002", "钱包账户不存在"), FEIGN_FLYER_SERVLET_ERROR("4007", "访问飞手服务失败"),
PARAM_DEFECT("5004", "参数缺失"), FEIGN_REPOORDER_SERVLET_ERROR("4008", "访问订单服务失败"),
LOGIN_ACCOUNT_NOT_EXIT_ERROR("5005", "账号不存在"), FEIGN_REPOPAY_SERVLET_ERROR("4009", "访问云仓消耗服务失败"),
LOGIN_PASSWORD_ERROR("5006", "密码错误"), FEIGN_REPOUSER_SERVLET_ERROR("4010", "访问云仓用户服务失败"),
LOGIN_ACCOUNT_STATUS_ERROR("5008", "外部访问"), FEIGN_WARE_SERVLET_ERROR("4010", "访问云仓商品服务失败"),
OPERATE_USER_ORDERCOUNT_ERROR("5007", "当前账号有存在相关订单未关闭"), FEIGN_DEVICE_SERVLET_ERROR("4011", "访问云仓设备服务失败"),
WALLET_CASH_NOT_ENOUGH_ERROR("5009", "现金余额不足"), CENTER_USER_SERVLET_ERROR("4012", "访问用户中心服务失败"),
GATEWAY_HYSRIX_ERROR("4013", "服务器貌似在开小差~"),
AMT_PAID_VERITY_ERROR("5010", "变更额度不在有效范围"), FEIGN_FLYER_PAY_SERVLET_ERROR("4014", "访问飞手消耗服务失败"),
CREDIT_NOT_ENOUGH_ERROR("5011", "信用余额不足,当前信用余额:"), MALL_USER_SERVLET_ERROR("4015", "访问机城用户服务失败"),
CREDIT_METHOD_ERROR("5012", "变更类型有误"), PRIMARY_KEY_DEFECT("5001", "主键ID缺失"),
CREDIT_OWED_BEGGER_ERROR("5013", "归还额度不可超过剩余欠款,当前剩余欠款:"), WALLET_NOT_FIND_ERROR("5002", "钱包账户不存在"),
CASH_ADD_OWED_ERROR("5014", "该账号仍有剩余欠款,请先将全部欠款归还后,再进行充值。"), PARAM_DEFECT("5004", "参数缺失"),
WALLET_CREDIT_NOT_ENOUGH_ERROR("5015", "信用余额不足"), LOGIN_ACCOUNT_NOT_EXIT_ERROR("5005", "账号不存在"),
ORDER_PAY_FORMAT_ERROR("5016", "现金和信用金额不能同时为空"), LOGIN_PASSWORD_ERROR("5006", "密码错误"),
WALLET_CASH_FREEZE_NOT_ENOUGH_ERROR("5017", "现金的冻结余额不足"), LOGIN_ACCOUNT_STATUS_ERROR("5008", "外部访问"),
WALLET_CREDIT_FREEZE_NOT_ENOUGH_ERROR("5018", "信用的冻结余额不足"), OPERATE_USER_ORDERCOUNT_ERROR("5007", "当前账号有存在相关订单未关闭"),
ORDER_CASH_FREEZE_NOT_FIND_ERROR("5019", "现金的冻结余额不存在"), WALLET_CASH_NOT_ENOUGH_ERROR("5009", "现金余额不足"),
ORDER_CREDIT_FREEZE_NOT_FIND_ERROR("5019", "信用的冻结余额不存在"),
WALLET_BANLANCE_NOT_ENOUGH_ERROR("5020", "现金和信用的余额不足"), AMT_PAID_VERITY_ERROR("5010", "变更额度不在有效范围"),
WALLET_FREEZE_NOT_ENOUGH_ERROR("5020", "现金和信用的冻结余额不足"), CREDIT_NOT_ENOUGH_ERROR("5011", "信用余额不足,当前信用余额:"),
CREDIT_REPEAT_NULL_ERROR("5021", "欠款归还不能为空"), CREDIT_METHOD_ERROR("5012", "变更类型有误"),
CREDIT_CHANGE_NULL_ERROR("5021", "信用余额变更不能为空"), CREDIT_OWED_BEGGER_ERROR("5013", "归还额度不可超过剩余欠款,当前剩余欠款:"),
ORDER_TOTAL_COST_ERROR("5022", "结算金额不能大于预支付的金额"), CASH_ADD_OWED_ERROR("5014", "该账号仍有剩余欠款,请先将全部欠款归还后,再进行充值。"),
ORDER_PAY_NOT_ENOUGH_ERROR("5023", "总余额不足,订单无法结算"), WALLET_CREDIT_NOT_ENOUGH_ERROR("5015", "信用余额不足"),
NOT_MENU_POWER_ERROR("5024", "当前账号无平台使用权限"), ORDER_PAY_FORMAT_ERROR("5016", "现金和信用金额不能同时为空"),
OPENID_NOT_FIND_ERROR("5025", "OPENID未注册,请登录授权后调用"), WALLET_CASH_FREEZE_NOT_ENOUGH_ERROR("5017", "现金的冻结余额不足"),
PASSWORD_INCONSISTENT("5026", "新密码与确认密码不一致,请确认一致"), WALLET_CREDIT_FREEZE_NOT_ENOUGH_ERROR("5018", "信用的冻结余额不足"),
WX_ACCESS_TOKEN_ERROR("5027", "获取微信AccessToken失败"), ORDER_CASH_FREEZE_NOT_FIND_ERROR("5019", "现金的冻结余额不存在"),
WX_NOT_REL_ERROR("5028", "获取微信公众号用户信息失败"), ORDER_CREDIT_FREEZE_NOT_FIND_ERROR("5019", "信用的冻结余额不存在"),
WX_NOT_SEND_MSG_PARAM_ERROR("5029", "userId和openId至少一个不为空"), WALLET_BANLANCE_NOT_ENOUGH_ERROR("5020", "现金和信用的余额不足"),
APPLET_QR_CODE_CREATE_ERROR("5030", "生成小程序码错误:"), WALLET_FREEZE_NOT_ENOUGH_ERROR("5020", "现金和信用的冻结余额不足"),
APPLET_USER_ACCESS_TOKE_ERROR("5031", "获取accessToken签名校验失败"), CREDIT_REPEAT_NULL_ERROR("5021", "欠款归还不能为空"),
REBATE_AMT_NOT_MIN_ERROR("5032", "金额不足300元无法提现,300元为最低门槛"), CREDIT_CHANGE_NULL_ERROR("5021", "信用余额变更不能为空"),
REBATE_AMT_NOT_ENOUGH_ERROR("5033", "申请失败,超过可提现的金额"), ORDER_TOTAL_COST_ERROR("5022", "结算金额不能大于预支付的金额"),
BANK_INFO_NOT_SAVE_ERROR("5034", "请先完善收款账号,才可以申请提现"), ORDER_PAY_NOT_ENOUGH_ERROR("5023", "总余额不足,订单无法结算"),
REBATE_APPLY_STATUS_ERROR("5035", "提现状态有误"), NOT_MENU_POWER_ERROR("5024", "当前账号无平台使用权限"),
REBATE_INFO_NOT_FIND_ERROR("5036", "提现申请单信息不存在"), OPENID_NOT_FIND_ERROR("5025", "OPENID未注册,请登录授权后调用"),
REBATE_FAIL_EXIT_ERROR("5037", "你的收款账号信息有误,请修改信息后重新申请提现。"), PASSWORD_INCONSISTENT("5026", "新密码与确认密码不一致,请确认一致"),
REBATE_AMT_FORMAT_ERROR("5038", "提现金额必须大于0元"), WX_ACCESS_TOKEN_ERROR("5027", "获取微信AccessToken失败"),
REBATE_REPEAT_CHECK_ERROR("5039", "提现申请单已被审批,切勿重复审批。"), WX_NOT_REL_ERROR("5028", "获取微信公众号用户信息失败"),
CHOOSE_FLYER_NUM_ERROR("5040", "请至少选中一个飞手。"), WX_NOT_SEND_MSG_PARAM_ERROR("5029", "userId和openId至少一个不为空"),
CHOOSE_FLYER_MORE_NUM_ERROR("5041", "暂只支持一个订单只能指派一个飞手。"), APPLET_QR_CODE_CREATE_ERROR("5030", "生成小程序码错误:"),
ORDER_NO_EXIT_ERROR("5042", "订单信息不存在。"), APPLET_USER_ACCESS_TOKE_ERROR("5031", "获取accessToken签名校验失败"),
ORDER_STATUS_ERROR("5043", "订单状态流程有误。"), REBATE_AMT_NOT_MIN_ERROR("5032", "金额不足300元无法提现,300元为最低门槛"),
INTERFACE_NOT_INVAILD("5044", "接口已废弃或不存在"), REBATE_AMT_NOT_ENOUGH_ERROR("5033", "申请失败,超过可提现的金额"),
PAPER_CODE_NOT_INVAILD("5045", "接口已废弃或不存在"), BANK_INFO_NOT_SAVE_ERROR("5034", "请先完善收款账号,才可以申请提现"),
PHONE_INVAILD_ERROR("5046", "无效的手机号"), REBATE_APPLY_STATUS_ERROR("5035", "提现状态有误"),
TIME_CODE_INVAILD_ERROR("5047", "无效的时间编码"), REBATE_INFO_NOT_FIND_ERROR("5036", "提现申请单信息不存在"),
REPEACT_COMMIT_ERROR("5048", "已提交,切勿重复提交"), REBATE_FAIL_EXIT_ERROR("5037", "你的收款账号信息有误,请修改信息后重新申请提现。"),
IMPORT_EXCEL_ERROR("5049", "excel导入失败"), REBATE_AMT_FORMAT_ERROR("5038", "提现金额必须大于0元"),
REQ_SMS_CODE_ERROR("5050", "注册码格式有误"), REBATE_REPEAT_CHECK_ERROR("5039", "提现申请单已被审批,切勿重复审批。"),
SKU_NOT_PRICE_ERROR("5051", "当前SKU未配置价格"), CHOOSE_FLYER_NUM_ERROR("5040", "请至少选中一个飞手。"),
SKU_NOT_ENOUGH_ERROR("5052", "套餐(sku)数量不足"), CHOOSE_FLYER_MORE_NUM_ERROR("5041", "暂只支持一个订单只能指派一个飞手。"),
ORDER_NO_EXIT_ERROR("5042", "订单信息不存在。"),
LEASE_DATE_MATH_ERROR("5053", "租期开始日不能大于结束日"), ORDER_STATUS_ERROR("5043", "订单状态流程有误。"),
ADD_LEASE_ADDR_ERROR("5054", "请选择收货方式"), INTERFACE_NOT_INVAILD("5044", "接口已废弃或不存在"),
SHOP_NEED_PHONE_ERROR("5055", "门店自取需要您的联系电话,请填写联系电话"), PAPER_CODE_NOT_INVAILD("5045", "接口已废弃或不存在"),
ORDER_POWER_ERROR("5056", "订单不存在或你无权操作该订单"), PHONE_INVAILD_ERROR("5046", "无效的手机号"),
ORDER_AUTH_ERROR("5057", "请完成认证再下单"), TIME_CODE_INVAILD_ERROR("5047", "无效的时间编码"),
EXPRESS_RETURN_ERROR("5058", "请完善物流单号和物流公司"), REPEACT_COMMIT_ERROR("5048", "已提交,切勿重复提交"),
SHOP_RETURN_ERROR("5059", "请选择门店"), IMPORT_EXCEL_ERROR("5049", "excel导入失败"),
ORDER_REFUND_EXIT_ERROR("5060", "该订单已提交过退款申请,请勿重复申请。"), REQ_SMS_CODE_ERROR("5050", "注册码格式有误"),
ORDER_EXPRESS_ERROR("5061", "获取订单物流信息有误。"), SKU_NOT_PRICE_ERROR("5051", "当前SKU未配置价格"),
ORDER_PAY_JOB_ERROR("5062", "执行定时任务有误"), SKU_NOT_ENOUGH_ERROR("5052", "套餐(sku)数量不足"),
NO_AUTH_ORDER_ERROR("5063", "请完成企业认证或实名认证后再进行下单"),
WARE_NOT_ENOUGH_ERROR("5064", "商品数量不足"), LEASE_DATE_MATH_ERROR("5053", "租期开始日不能大于结束日"),
EX_INFO_ERROR("5065", "物流信息不完善"), ADD_LEASE_ADDR_ERROR("5054", "请选择收货方式"),
NOT_REAL_AUTH_ERROR("5066", "请完成实名认证后再进行操作"), SHOP_NEED_PHONE_ERROR("5055", "门店自取需要您的联系电话,请填写联系电话"),
REBATE_NOT_ENOUGH_ERROR("5067", "提现申请金额需在10至8000元范围之内"), ORDER_POWER_ERROR("5056", "订单不存在或你无权操作该订单"),
MORE_THAN_LIMIT_ERROR("5067", "提现申请金额需在0.1至98000元范围之内"), ORDER_AUTH_ERROR("5057", "请完成认证再下单"),
FLYER_ENT_MORE_THAN_LIMIT_ERROR("50670", "飞手机构用户银行卡单笔最低10元,最高100,000元"), EXPRESS_RETURN_ERROR("5058", "请完善物流单号和物流公司"),
FLYER_MORE_THAN_LIMIT_ERROR("50671", "飞手个人用户银行卡单笔最低10元,最高5,000元"), SHOP_RETURN_ERROR("5059", "请选择门店"),
MORE_THAN_LIMIT_TODAY_ERROR("50672", "单个账户每月提现额度为100,000元"), ORDER_REFUND_EXIT_ERROR("5060", "该订单已提交过退款申请,请勿重复申请。"),
SYSTEM_AMT_NOT_ENOUGH_ERROR("5068", "系统处理中,请稍后再试。"), ORDER_EXPRESS_ERROR("5061", "获取订单物流信息有误。"),
FEIGN_XZH_SERVLET_ERROR("5069", "访问线上支付接口服务失败"), ORDER_PAY_JOB_ERROR("5062", "执行定时任务有误"),
XZH_SERVLET_ERROR("5070", "调用线上支付失败:"), NO_AUTH_ORDER_ERROR("5063", "请完成企业认证或实名认证后再进行下单"),
XZH_FAIL_ERROR("5071", "支付服务失败:"), WARE_NOT_ENOUGH_ERROR("5064", "商品数量不足"),
REFUSE_COUNT_ERROR("5072", "今日拒绝的次数已达上限,暂不可参与抢单"), EX_INFO_ERROR("5065", "物流信息不完善"),
APPLY_ORDER_COUNT_ERROR("5073", "请勿重复接单"), NOT_REAL_AUTH_ERROR("5066", "请完成实名认证后再进行操作"),
ORDER_ARRIVE_ERROR("5074", "抢单失败,订单已被指派"), REBATE_NOT_ENOUGH_ERROR("5067", "提现申请金额需在10至8000元范围之内"),
REST_APPLY_ORDER_ERROR("5075", "请先开启接单状态后再进行抢单"), MORE_THAN_LIMIT_ERROR("5067", "提现申请金额需在0.1至98000元范围之内"),
EVALUATED_ERROR("5076", "您已经评价过啦!"), FLYER_ENT_MORE_THAN_LIMIT_ERROR("50670", "飞手机构用户银行卡单笔最低10元,最高100,000元"),
BACKET_TYPE_ERROR("5077", "红包类型有误"), FLYER_MORE_THAN_LIMIT_ERROR("50671", "飞手个人用户银行卡单笔最低10元,最高5,000元"),
BACKET_NOT_ENOUGH_ERROR("5078", "红包已被抢光"), MORE_THAN_LIMIT_TODAY_ERROR("50672", "单个账户每月提现额度为100,000元"),
USER_PHONE_AUTH_ERROR("5079", "请授权登录后领取"), SYSTEM_AMT_NOT_ENOUGH_ERROR("5068", "系统处理中,请稍后再试。"),
TOKEN_REQUIRED_ERROR("5080", "Please bring a token"), FEIGN_XZH_SERVLET_ERROR("5069", "访问线上支付接口服务失败"),
UNIONID_NOT_ERROR("5081", "UnionId不能为空"), XZH_SERVLET_ERROR("5070", "调用线上支付失败:"),
OPENID_NOT_ERROR("5081", "云享飞openid、云飞手openid、云仓openid、无人机城openid至少要有一个"), XZH_FAIL_ERROR("5071", "支付服务失败:"),
NO_EVALUATED_ERROR("5090", "暂无评价信息!"), REFUSE_COUNT_ERROR("5072", "今日拒绝的次数已达上限,暂不可参与抢单"),
DAY_NUM_ERROR("5091", "天数有误"), APPLY_ORDER_COUNT_ERROR("5073", "请勿重复接单"),
TASK_TYPE_ERROR("5092", "您的账号类型为个人飞手,只能抢任务人数1人的订单。"), ORDER_ARRIVE_ERROR("5074", "抢单失败,订单已被指派"),
TASK_FLYER_COUNT_LESS_ERROR("5093", "机构认证的飞手多于任务需要的飞手才可以抢单。"), REST_APPLY_ORDER_ERROR("5075", "请先开启接单状态后再进行抢单"),
FLYER_REBATE_ERROR("5094", "提现失败,请稍后重试"), EVALUATED_ERROR("5076", "您已经评价过啦!"),
OPERATION_SYS_ERROR("5095", "操作失败,请稍后重试"), BACKET_TYPE_ERROR("5077", "红包类型有误"),
WAG_CHECK_STATUS_ERROR("5096", "操作失败,未通过或待确认状态才能进行重新编辑"), BACKET_NOT_ENOUGH_ERROR("5078", "红包已被抢光"),
EXPORT_NO_DATA_ERROR("5097", "查询到当前符合条件的数据为0条"), USER_PHONE_AUTH_ERROR("5079", "请授权登录后领取"),
WAG_ZERO_ERROR("5098", "工资抵扣后当月工资不能少于0元"), TOKEN_REQUIRED_ERROR("5080", "Please bring a token"),
WAG_REPEAT_DATE_ERROR("5099", "操作失败,工资日期重复:"), UNIONID_NOT_ERROR("5081", "UnionId不能为空"),
OPENID_NOT_ERROR("5081", "云享飞openid、云飞手openid、云仓openid、无人机城openid至少要有一个"),
BUY_NUM_ERROR("5100", "购买数量必须大于0"), NO_EVALUATED_ERROR("5090", "暂无评价信息!"),
SHOP_CAR_ERROR("5101", "购物车信息不存在"), DAY_NUM_ERROR("5091", "天数有误"),
GOODS_VERSION_ERROR("5102", "操作失败,当前商品已经发生信息变更,请刷新后重试"), TASK_TYPE_ERROR("5092", "您的账号类型为个人飞手,只能抢任务人数1人的订单。"),
WAG_DETAIL_COUNT_ERROR("5103", "账单天数必须大于0"), TASK_FLYER_COUNT_LESS_ERROR("5093", "机构认证的飞手多于任务需要的飞手才可以抢单。"),
WAG_TERM_PARAM_ERROR("5104", "飞手工资、结算基数、操作三个选项必须填一个"), FLYER_REBATE_ERROR("5094", "提现失败,请稍后重试"),
IMPORT_PARAM_ERROR("5105", "导入的数据行不能为空或者格式错误"), OPERATION_SYS_ERROR("5095", "操作失败,请稍后重试"),
SHOP_GOODS_NOT_ERROR("5106", "当前商品已下架或已删除"), WAG_CHECK_STATUS_ERROR("5096", "操作失败,未通过或待确认状态才能进行重新编辑"),
ALL_PAY_ERROR("5107", "当前订单为分期付款,请先上传尾款凭证"), EXPORT_NO_DATA_ERROR("5097", "查询到当前符合条件的数据为0条"),
FLYER_EVLT_PARAM_ERROR("5108", "飞手评分参数有误,请检查"), WAG_ZERO_ERROR("5098", "工资抵扣后当月工资不能少于0元"),
FLYER_REPEAT_BIND_ERROR("5108", "飞手已被绑定过,请勿重复绑定"), WAG_REPEAT_DATE_ERROR("5099", "操作失败,工资日期重复:"),
FLYER_NUM_BIND_ERROR("5108", "飞手数量有误,本任务需要的飞手人数为:"),
FLYER_ORDER_TYPE_ERROR("5110", "飞手类型有误,该订单只允许个人飞手接单"), BUY_NUM_ERROR("5100", "购买数量必须大于0"),
FLYER_ENT_ORDER_TYPE_ERROR("5111", "飞手类型有误,该订单只允许飞手机构接单"), SHOP_CAR_ERROR("5101", "购物车信息不存在"),
PHONE_NUM_EXIT_ERROR("5112", "手机号已存在"), GOODS_VERSION_ERROR("5102", "操作失败,当前商品已经发生信息变更,请刷新后重试"),
FLYER_UN_BIND_ERROR("5113", "飞手已被解绑,请勿重复解绑"), WAG_DETAIL_COUNT_ERROR("5103", "账单天数必须大于0"),
REPEAT_NOTIFICATION("5114", "您已对此订单进行过催付款操作"), WAG_TERM_PARAM_ERROR("5104", "飞手工资、结算基数、操作三个选项必须填一个"),
FLYER_WORK_ERROR("5115", "指派飞手失败,飞手休息中:"), IMPORT_PARAM_ERROR("5105", "导入的数据行不能为空或者格式错误"),
DISABLE_APPLY_ORDER_ERROR("5116", "当前时间此订单不可抢"), SHOP_GOODS_NOT_ERROR("5106", "当前商品已下架或已删除"),
ALL_PAY_ERROR("5107", "当前订单为分期付款,请先上传尾款凭证"),
COMPANY_EXIT_ERROR("5117", "单位名称已存在"), FLYER_EVLT_PARAM_ERROR("5108", "飞手评分参数有误,请检查"),
COMPANY_NOT_BIND_ERROR("5118", "未绑定单位,请先绑定单位"), FLYER_REPEAT_BIND_ERROR("5108", "飞手已被绑定过,请勿重复绑定"),
COMPANY_REMOVE_ERROR("5119", "删除失败,请先移除该单位的账号信息"), FLYER_NUM_BIND_ERROR("5108", "飞手数量有误,本任务需要的飞手人数为:"),
COMPANY_REMOVE_CHILD_ERROR("5120", "删除失败,请先移除该单位的子级单位"), FLYER_ORDER_TYPE_ERROR("5110", "飞手类型有误,该订单只允许个人飞手接单"),
EXIST_THE_SAME_GOODS_ERROR("5121", "购物车已存在您选择的商品"), FLYER_ENT_ORDER_TYPE_ERROR("5111", "飞手类型有误,该订单只允许飞手机构接单"),
PHONE_NUM_EXIT_ERROR("5112", "手机号已存在"),
// clientOAuth FLYER_UN_BIND_ERROR("5113", "飞手已被解绑,请勿重复解绑"),
OAUTH_CLIENT_NOT_FOUND("6404", "client_id不存在或已注销"), REPEAT_NOTIFICATION("5114", "您已对此订单进行过催付款操作"),
OAUTH_SECRET_ERROR("6405", "client_secret有误"), FLYER_WORK_ERROR("5115", "指派飞手失败,飞手休息中:"),
OAUTH_AUTHORIZE_ERROR("6406", "当前账号未获得任何授权,请确认"), DISABLE_APPLY_ORDER_ERROR("5116", "当前时间此订单不可抢"),
OAUTH_API_AUTH_ERROR("6407", "当前资源未被授权"),
OAUTH_CREATE_TOKEN_ERROR("6408", "系统内部错误,获取accessToken失败,"), COMPANY_EXIT_ERROR("5117", "单位名称已存在"),
COMPANY_NOT_BIND_ERROR("5118", "未绑定单位,请先绑定单位"),
PWD_CREATE_ERROR("6001", "创建密码失败"), COMPANY_REMOVE_ERROR("5119", "删除失败,请先移除该单位的账号信息"),
PWD_CONPARED_ERROR("6002", "密码错误"), PWD_ALERT_ERROR("6003", "密码不一致"), COMPANY_REMOVE_CHILD_ERROR("5120", "删除失败,请先移除该单位的子级单位"),
PWD_REQUEST_AUTH_ERROR("6003", "密码请求验证"), EXIST_THE_SAME_GOODS_ERROR("5121", "购物车已存在您选择的商品"),
APPLET_PORT_TYPE_ERROR("7001", "小程序端口类型错误"),
APPLET_GET_OPENID_ERROR("7002", "获取小程序openid失败"), // clientOAuth
UPDATE_USER_ACCOUNT_REPEAT("7003", "修改后的账户名已存在"), ADD_USER_ACCOUNT_NAME_EXISTS("7004", "新增账户名已经存在"), OAUTH_CLIENT_NOT_FOUND("6404", "client_id不存在或已注销"),
ACCOUNT_NOT_FIND_ERROR("8000", "账号信息不存在"), OAUTH_SECRET_ERROR("6405", "client_secret有误"),
REPEAT_SOFT_DELETE("8001", "账号已删除"), OAUTH_AUTHORIZE_ERROR("6406", "当前账号未获得任何授权,请确认"),
ADMIN_ROLE_DELETE_ERROR("8002", "此账号为管理员账号,禁止删除"), OAUTH_API_AUTH_ERROR("6407", "当前资源未被授权"),
ROLE_ADMIN_DELETE_ERROR("8003", "此角色为管理员角色,禁止删除"), OAUTH_CREATE_TOKEN_ERROR("6408", "系统内部错误,获取accessToken失败,"),
ROLE_NAME_REPEAT_ERROR("8004", "角色名已存在"),
ROLE_AVL_USER_DELETE_ERROR("8005", "此角色尚有可用账号,请将所有账号移除后在进行操作"), PWD_CREATE_ERROR("6001", "创建密码失败"),
ROLE_AVL_USER_STATUS_ERROR("8006", "此角色尚有可用账号,请将所有账号禁用后在进行操作"), PWD_CONPARED_ERROR("6002", "密码错误"),
ROLE_SYSTEM_DELETE_ERROR("8007", "此角色为系统角色,禁止删除"), PWD_ALERT_ERROR("6003", "密码不一致"),
ADMIN_ROLE_POWER_ERROR("8008", "禁止修改管理类角色权限"), SYSTEM_ROLE_POWER_ERROR("8009", "禁止修改系统类角色权限"), PWD_REQUEST_AUTH_ERROR("6003", "密码请求验证"),
ROLE_SELF_POWER_ERROR("8010", "禁止修改与当前登录账号角色相同的角色权限"), APPLET_PORT_TYPE_ERROR("7001", "小程序端口类型错误"),
ADMIN_ACCOUNT_DISABLE_ERROR("8011", "此账号为管理员账号,禁用失败"), APPLET_GET_OPENID_ERROR("7002", "获取小程序openid失败"),
UPDATE_USER_ACCOUNT_REPEAT("7003", "修改后的账户名已存在"),
OPERATE_USER_DEL_ERROR("8012", "该账号仍有进行中的订单需要负责,请先移交订单后再删除。"), ADD_USER_ACCOUNT_NAME_EXISTS("7004", "新增账户名已经存在"),
OPERATE_USER_DISABLED_ERROR("8013", "该账号仍有进行中的订单需要负责,请先移交订单后再禁用。"), ACCOUNT_NOT_FIND_ERROR("8000", "账号信息不存在"),
REPEAT_SOFT_DELETE("8001", "账号已删除"),
DELETE_USER_UNFILLED_ORDER_EXIST("9001", "平台中有此账号相关的订单,不可删除此账号"), ADMIN_ROLE_DELETE_ERROR("8002", "此账号为管理员账号,禁止删除"),
STOP_UNFILLED_ORDER_EXIST("9002", "平台中有此账号相关的订单正在进行中,不可停用此账号"), ROLE_ADMIN_DELETE_ERROR("8003", "此角色为管理员角色,禁止删除"),
ACCOUNT_ALREADY_DELETED("10001", "此账号已经被删除"), ROLE_NAME_REPEAT_ERROR("8004", "角色名已存在"),
ACCOUNT_ALREADY_STOP("10002", "此账号已经被停用,不能登录此小程序,详情请联系管理员"), ROLE_AVL_USER_DELETE_ERROR("8005", "此角色尚有可用账号,请将所有账号移除后在进行操作"),
ROLE_AVL_USER_STATUS_ERROR("8006", "此角色尚有可用账号,请将所有账号禁用后在进行操作"),
INDUSTRY_NAME_CREATE_ERROR("20001", "行业名称请勿重复,请重新输入"), ROLE_SYSTEM_DELETE_ERROR("8007", "此角色为系统角色,禁止删除"),
INSPECTION_NAME_CREATE_ERROR("20002", "服务名称请勿重复,请重新输入"), ADMIN_ROLE_POWER_ERROR("8008", "禁止修改管理类角色权限"),
INSPECTION_REPEAT("20003", "绑定服务重复"), SYSTEM_ROLE_POWER_ERROR("8009", "禁止修改系统类角色权限"),
INDUSTRY_REPEAT("20004", "绑定行业重复"), ROLE_SELF_POWER_ERROR("8010", "禁止修改与当前登录账号角色相同的角色权限"),
ADMIN_ACCOUNT_DISABLE_ERROR("8011", "此账号为管理员账号,禁用失败"),
INSERT_INDUSTRY_SUCCESS("20005", "新增行业成功"),
UPDATE_INDUSTRY_SUCCESS("20006", "修改行业成功"), OPERATE_USER_DEL_ERROR("8012", "该账号仍有进行中的订单需要负责,请先移交订单后再删除。"),
DELETE_INDUSTRY_SUCCESS("20007", "删除行业成功"), OPERATE_USER_DISABLED_ERROR("8013", "该账号仍有进行中的订单需要负责,请先移交订单后再禁用。"),
INSERT_INSPECTION_SUCCESS("20008", "新增服务成功"),
UPDATE_INSPECTION_SUCCESS("20009", "修改服务成功"), DELETE_USER_UNFILLED_ORDER_EXIST("9001", "平台中有此账号相关的订单,不可删除此账号"),
DELETE_INSPECTION_SUCCESS("20010", "删除服务成功"), STOP_UNFILLED_ORDER_EXIST("9002", "平台中有此账号相关的订单正在进行中,不可停用此账号"),
SORT_PARAMETER_ERROR("28199", "排序参数错误"), ACCOUNT_ALREADY_DELETED("10001", "此账号已经被删除"),
OPRATING_FREQUENCY_TOO_HIGH("28449", "更新频率过快,请重试"), ACCOUNT_ALREADY_STOP("10002", "此账号已经被停用,不能登录此小程序,详情请联系管理员"),
INDUSTRY_NAME_CREATE_ERROR("20001", "行业名称请勿重复,请重新输入"),
INSERT_INDUSTRY_INSPECTION_SUCCESS("20011", "添加对应服务成功"), INSPECTION_NAME_CREATE_ERROR("20002", "服务名称请勿重复,请重新输入"),
INSERT_INSPECTION_INDUSTRY_SUCCESS("20012", "添加对应行业成功"), INSPECTION_REPEAT("20003", "绑定服务重复"),
DELETE_INDUSTRY_INSPECTION_SUCCESS("20013", "删除对应服务成功"), INDUSTRY_REPEAT("20004", "绑定行业重复"),
DELETE_INSPECTION_INDUSTRY_SUCCESS("20014", "删除对应行业成功"),
INSERT_INDUSTRY_SUCCESS("20005", "新增行业成功"),
INSERT_INDUSTRY_SHELF_SUCCESS("20015", "行业上架成功"), UPDATE_INDUSTRY_SUCCESS("20006", "修改行业成功"),
DELETE_INDUSTRY_SHELF_SUCCESS("20016", "行业下架成功"), DELETE_INDUSTRY_SUCCESS("20007", "删除行业成功"),
INSERT_INSPECTION_SUCCESS("20008", "新增服务成功"),
INSERT_INSPECTION_SHELF_SUCCESS("20017", "服务上架成功"), UPDATE_INSPECTION_SUCCESS("20009", "修改服务成功"),
DELETE_INSPECTION_SHELF_SUCCESS("20018", "服务下架成功"), DELETE_INSPECTION_SUCCESS("20010", "删除服务成功"),
SORT_PARAMETER_ERROR("28199", "排序参数错误"),
DELETE_INSPECTION_ERROR("20022", "该服务仍有未完成的订单,不可删除"), OPRATING_FREQUENCY_TOO_HIGH("28449", "更新频率过快,请重试"),
INSPECTION_NOT_EXIST("20023", "很抱歉,目前该服务已下架"), INSERT_INDUSTRY_INSPECTION_SUCCESS("20011", "添加对应服务成功"),
FAKE_NUM_CREATE_ERROR("20024", "输入的数据有误,请重新输入!"), INSERT_INSPECTION_INDUSTRY_SUCCESS("20012", "添加对应行业成功"),
WORK_TYPE_NAME_ERROR("20026", "服务作业类型重复,请重新输入"), DELETE_INDUSTRY_INSPECTION_SUCCESS("20013", "删除对应服务成功"),
EXIST_BINDING_INSPECTION_ERROR("20027", "此作业类型被服务绑定,删除失败!"), DELETE_INSPECTION_INDUSTRY_SUCCESS("20014", "删除对应行业成功"),
UPLOAD_IMG_ERROR("20019", "请选择jpg,png,jpeg格式的图片"), INSERT_INDUSTRY_SHELF_SUCCESS("20015", "行业上架成功"),
UPLOAD_VIDEO_ERROR("20020", "请选择MP4,avi,mov,mkv格式的视频"), DELETE_INDUSTRY_SHELF_SUCCESS("20016", "行业下架成功"),
UPLOAD_DOC_ERROR("20021", "请选择doc,ppt,pdf,xls格式的文件"),
UPLOAD_IMG_LESS_3M_ERROR("20022", "请上传小于3M的图片"), INSERT_INSPECTION_SHELF_SUCCESS("20017", "服务上架成功"),
DELETE_INSPECTION_SHELF_SUCCESS("20018", "服务下架成功"),
INSERT_ORDER_SUCCESS("21000", "新增订单成功"),
UPDATE_ORDER_SUCCESS("21001", "修改订单成功"), DELETE_INSPECTION_ERROR("20022", "该服务仍有未完成的订单,不可删除"),
ORDER_TRANS_SUCCESS("21002", "订单移交成功"),
ORDER_EVALUATE_SUCCESS("21003", "订单评价完成"), INSPECTION_NOT_EXIST("20023", "很抱歉,目前该服务已下架"),
ORDER_BEFORE_PAY_ERROR("21004", "订单预支付失败"), FAKE_NUM_CREATE_ERROR("20024", "输入的数据有误,请重新输入!"),
ORDER_CLOSE_PAY_ERROR("21005", "订单结算支付失败"), WORK_TYPE_NAME_ERROR("20026", "服务作业类型重复,请重新输入"),
INSERT_ORDER_DETAIL_SUCCESS("21006", "新增订单动态成功"), EXIST_BINDING_INSPECTION_ERROR("20027", "此作业类型被服务绑定,删除失败!"),
CHECK_USER_ERROR("22001", "用户未通过验证"), UPLOAD_IMG_ERROR("20019", "请选择jpg,png,jpeg格式的图片"),
UPLOAD_VIDEO_ERROR("20020", "请选择MP4,avi,mov,mkv格式的视频"),
GET_ORDER_LIST_ERROR("22002", "获取订单列表失败"), UPLOAD_DOC_ERROR("20021", "请选择doc,ppt,pdf,xls格式的文件"),
COMMANT_CAR_NAME_EXIST("22003", "指挥车名字已存在,请重新输入"), UPLOAD_IMG_LESS_3M_ERROR("20022", "请上传小于3M的图片"),
INSERT_ORDER_SUCCESS("21000", "新增订单成功"),
//认证提示 UPDATE_ORDER_SUCCESS("21001", "修改订单成功"),
APP_CODE_ERROR("30301", "appcode 错误"), ORDER_TRANS_SUCCESS("21002", "订单移交成功"),
REQUE_ENVIROMENT_ERROR("30302", "请求的 Method、Path 或者环境错误"), ORDER_EVALUATE_SUCCESS("21003", "订单评价完成"),
REQUEST_PARAMETER_ERROR("30303", "请求参数错误"), ORDER_BEFORE_PAY_ERROR("21004", "订单预支付失败"),
SERVICE_NOT_AUTHORIZED("30304", "服务未被授权(或URL和Path不正确)"), ORDER_CLOSE_PAY_ERROR("21005", "订单结算支付失败"),
TIMES_USED_UP("30305", "很抱歉,目前我们的实名认证次数已达上限,正在处理中,请稍后再进行认证。"), INSERT_ORDER_DETAIL_SUCCESS("21006", "新增订单动态成功"),
OTHER_ERROR("30306", "其他错误/服务次数用完"),
LIVE_AUTHENTICATION_FAILED("3824", "活体认证失败"), CHECK_USER_ERROR("22001", "用户未通过验证"),
ID_INFO_AND_ID_card_MISMATCH("3904", "身份信息与身份证不匹配"),
LIVE_AUTHENTICATION_SUCESS("3999", "活体验证成功"), GET_ORDER_LIST_ERROR("22002", "获取订单列表失败"),
NO_REAL_NAME("3854", "用户未实名认证"), COMMANT_CAR_NAME_EXIST("22003", "指挥车名字已存在,请重新输入"),
URL_FORMAT_ERROR("37462", "URL格式错误"),
URL_ADDRESS_ERROR("36752", "URL地址错误"), // 认证提示
INTERFACE_ACCESS_EXCEPTION("36894", "接口访问异常/次数用尽"), APP_CODE_ERROR("30301", "appcode 错误"),
FRONT_BACK_VAGUE("35556", "身份证正反面不明确"), REQUE_ENVIROMENT_ERROR("30302", "请求的 Method、Path 或者环境错误"),
ID_CARD_THOTO_MESSAGE_ERROR("36651", "身份照信息错误"), REQUEST_PARAMETER_ERROR("30303", "请求参数错误"),
EXPTION_ID_CARD_THOTO_MESSAGE_ERROR("36651", "信息异常"), SERVICE_NOT_AUTHORIZED("30304", "服务未被授权(或URL和Path不正确)"),
PHOTO_FORMAT_ERROR("12138", "身份证图片格式错误"), TIMES_USED_UP("30305", "很抱歉,目前我们的实名认证次数已达上限,正在处理中,请稍后再进行认证。"),
VALIDATION_INFO_EXPIRED("32815", "认证时间过长信息过期或认证信息不完整,请重新开始认证"), OTHER_ERROR("30306", "其他错误/服务次数用完"),
REAL_IMAGE_AUTHENTICATION_SUCESS("38844", "验证成功"), LIVE_AUTHENTICATION_FAILED("3824", "活体认证失败"),
REAL_IMAGE_AUTHENTICATION_FAILED("38855", "验证失败,请再次进行人脸识别"), ID_INFO_AND_ID_card_MISMATCH("3904", "身份信息与身份证不匹配"),
IDENTITY_HAS_BEEN_AUTHENTICATED("34444", "此身份证信息已经被认证,请重试"), LIVE_AUTHENTICATION_SUCESS("3999", "活体验证成功"),
REAL_NAME_ACCOUNT_ID_ERROR("36771", "账户id错误"), NO_REAL_NAME("3854", "用户未实名认证"),
REAL_NAME_FUSING_ERROR("36772", "认证失败,请重新认证"), URL_FORMAT_ERROR("37462", "URL格式错误"),
URL_ADDRESS_ERROR("36752", "URL地址错误"),
//企业认证 INTERFACE_ACCESS_EXCEPTION("36894", "接口访问异常/次数用尽"),
BUSINESS_LICENSE_CHECK_ANALYSIS_ERROR("30400", "营业执照解析失败,请上传有效清晰的执照"), FRONT_BACK_VAGUE("35556", "身份证正反面不明确"),
BUSINESS_LICENSE_CHECK_PARAMETER_ERROR("30401", "企业信息与营业执照信息不一致,请重新上传"), ID_CARD_THOTO_MESSAGE_ERROR("36651", "身份照信息错误"),
BANK_ACCOUNT_CHECK1_ERROR("30402", "账号与开户名不符"), EXPTION_ID_CARD_THOTO_MESSAGE_ERROR("36651", "信息异常"),
BANK_ACCOUNT_CHECK2_ERROR("30403", "开户行名称错误"), PHOTO_FORMAT_ERROR("12138", "身份证图片格式错误"),
BANK_ACCOUNT_CHECK3_ERROR("30404", "仅支持对公账户验证,不支持个人卡"), VALIDATION_INFO_EXPIRED("32815", "认证时间过长信息过期或认证信息不完整,请重新开始认证"),
BANK_ACCOUNT_CHECK4_ERROR("30405", "企业账号信息有误,请重新输入"), REAL_IMAGE_AUTHENTICATION_SUCESS("38844", "验证成功"),
BANK_ACCOUNT_CHECK5_ERROR("30406", "24小时之内不能重复申请"), REAL_IMAGE_AUTHENTICATION_FAILED("38855", "验证失败,请再次进行人脸识别"),
BANK_ACCOUNT_CHECK6_ERROR("30407", "很抱歉,目前我们的企业认证次数已达上限,如需继续认证请及时联系相关负责人进行处理,联系方式:科比特管理人员,18938853647。"), IDENTITY_HAS_BEEN_AUTHENTICATED("34444", "此身份证信息已经被认证,请重试"),
BANK_ACCOUNT_CHECK7_ERROR("30408", "企业名称与开户名称不一致,请确认一致后再提交认证"), REAL_NAME_ACCOUNT_ID_ERROR("36771", "账户id错误"),
ENTERPRISE_HAVE_VERIFIED("30409", "您输入的企业信息已被其他用户认证,请重新输入"), REAL_NAME_FUSING_ERROR("36772", "认证失败,请重新认证"),
ID_NUMBER_PARA_ERROR("30410", "身份证号码有错,请重新输入"), // 企业认证
DEAL_ERROR("30411", "有报错,请联系平台客服。"), BUSINESS_LICENSE_CHECK_ANALYSIS_ERROR("30400", "营业执照解析失败,请上传有效清晰的执照"),
NOT_DATA_ERROR("30412", "查无数据"), BUSINESS_LICENSE_CHECK_PARAMETER_ERROR("30401", "企业信息与营业执照信息不一致,请重新上传"),
API_STOP_USE_ERROR("30413", "接口停用"), BANK_ACCOUNT_CHECK1_ERROR("30402", "账号与开户名不符"),
OFFICE_DATA_SUSTAIN_ERROR("30414", "官方数据源维护,请稍候再试"), BANK_ACCOUNT_CHECK2_ERROR("30403", "开户行名称错误"),
SERVER_SUSTAIN_ERROR("30415", "服务商维护,请稍候再试"), BANK_ACCOUNT_CHECK3_ERROR("30404", "仅支持对公账户验证,不支持个人卡"),
PARA_ERROR("30416", "参数错误,请重新输入"), BANK_ACCOUNT_CHECK4_ERROR("30405", "企业账号信息有误,请重新输入"),
VERIFY_COUNT_ERROR("30416", "认证次数上限,请联系管理员"), BANK_ACCOUNT_CHECK5_ERROR("30406", "24小时之内不能重复申请"),
NOT_ENT_VERIFY_ERROR("30417", "机构未认证或认证未通过,请先进行机构认证"), BANK_ACCOUNT_CHECK6_ERROR(
NOT__VERIFY_ERROR("30418", "机构未认证或飞手认证未通过,请先进行认证"), "30407", "很抱歉,目前我们的企业认证次数已达上限,如需继续认证请及时联系相关负责人进行处理,联系方式:科比特管理人员,18938853647。"),
BANK_ACCOUNT_CHECK7_ERROR("30408", "企业名称与开户名称不一致,请确认一致后再提交认证"),
//渠道认证 ENTERPRISE_HAVE_VERIFIED("30409", "您输入的企业信息已被其他用户认证,请重新输入"),
NOT_ENT_USER("30501", "感谢您有意向成为我们的渠道商,请先完成企业认证。"),
NEW_NOT_ENT_USER("30502", "此用户未进行企业认证,渠道变更失败!"), ID_NUMBER_PARA_ERROR("30410", "身份证号码有错,请重新输入"),
BEFORE_NOT_CHANNEL_USER("30503", "此用户还不是渠道"), DEAL_ERROR("30411", "有报错,请联系平台客服。"),
NOT_DATA_ERROR("30412", "查无数据"),
API_STOP_USE_ERROR("30413", "接口停用"),
//飞手端认证 OFFICE_DATA_SUSTAIN_ERROR("30414", "官方数据源维护,请稍候再试"),
NOT_AUTH_FLYER_ERROR("30600", "飞手未认证,请先完成飞手认证"), SERVER_SUSTAIN_ERROR("30415", "服务商维护,请稍候再试"),
NOT_HAVE_AUTH_FLYER_ERROR("30601", "没有认证的飞手,暂不可接单"), PARA_ERROR("30416", "参数错误,请重新输入"),
VERIFY_COUNT_ERROR("30416", "认证次数上限,请联系管理员"),
//设备型号提醒 NOT_ENT_VERIFY_ERROR("30417", "机构未认证或认证未通过,请先进行机构认证"),
DEVICE_MODEL_REPEAT_ERROR("30700", "产品名称不可重复,请重新输入"), NOT__VERIFY_ERROR("30418", "机构未认证或飞手认证未通过,请先进行认证"),
DEVICE_MODEL_FAILURE_ERROR("30701", "设备添加失败"),
DEVICE_MODEL_REMOVE_ERROR("30702", "设备未在仓库,删除失败"), // 渠道认证
DEVICE_MODEL_UPDATE_ERROR("30703", "设备修改失败"), NOT_ENT_USER("30501", "感谢您有意向成为我们的渠道商,请先完成企业认证。"),
DEVICE_HAS_BEEN_RENT_ERROR("30704", "该设备不在仓库,不能出库"), NEW_NOT_ENT_USER("30502", "此用户未进行企业认证,渠道变更失败!"),
BEFORE_NOT_CHANNEL_USER("30503", "此用户还不是渠道"),
//仓库提醒
REPO_INFO_NAME("30800", "仓库名称不可重复,请重新输入"), // 飞手端认证
REPO_INFO_FAILURE("30801", "仓库添加失败"), NOT_AUTH_FLYER_ERROR("30600", "飞手未认证,请先完成飞手认证"),
REPO_INFO_REMOVE("30702", "仓库删除失败"), NOT_HAVE_AUTH_FLYER_ERROR("30601", "没有认证的飞手,暂不可接单"),
//商品 // 设备型号提醒
WARE_NAME_HAS_BEEN_EXIST("30900", "商品名称已存在"), DEVICE_MODEL_REPEAT_ERROR("30700", "产品名称不可重复,请重新输入"),
WARE_TYPE_NAME_HAS_BEEN_EXIST("30901", "分类名称已存在"), DEVICE_MODEL_FAILURE_ERROR("30701", "设备添加失败"),
WARE_TYPE_ICON_NOT_NULL("30902", "一级分类图标不能为空"), DEVICE_MODEL_REMOVE_ERROR("30702", "设备未在仓库,删除失败"),
GROUP_DONT_DELETE("30903", "该分类下尚有商品存在"), DEVICE_MODEL_UPDATE_ERROR("30703", "设备修改失败"),
GOODS_STATUS_ERROR("30904", "状态有误"), DEVICE_HAS_BEEN_RENT_ERROR("30704", "该设备不在仓库,不能出库"),
GOODS_ON_SHELF_SUCCESS("30905", "商品上架成功"),
GOODS_DOWN_SHELF_SUCCESS("30906", "商品下架成功"), // 仓库提醒
GOODS_SKU_IS_NOT_NULL("30907", "商品规格不能为空"), REPO_INFO_NAME("30800", "仓库名称不可重复,请重新输入"),
GOODS_PIC_IS_NOT_NULL("30908", "主图不能为空"), REPO_INFO_FAILURE("30801", "仓库添加失败"),
GOODS_DESC_IS_NOT_NULL("30910", "商品描述不能为空"), REPO_INFO_REMOVE("30702", "仓库删除失败"),
GOODS_GROUP_IS_NOT_NULL("30911", "商品类型不能为空"),
GROUP_DONT_DELETE_BY_CHILD("30912", "该分类下尚有子分类存在"), // 商品
GOODS_NOT_EXIST_OR_ALREADY_DOWN_SHELF("30913", "商品不存在或已下架"), WARE_NAME_HAS_BEEN_EXIST("30900", "商品名称已存在"),
GOODS_NAME_IS_NOT_NULL("30914", "商品名称不能为空或名字长度不能大于60"), WARE_TYPE_NAME_HAS_BEEN_EXIST("30901", "分类名称已存在"),
GOODS_DELETE_FAIL("30915", "批量删除商品失败,商品已被其他商品绑定"), WARE_TYPE_ICON_NOT_NULL("30902", "一级分类图标不能为空"),
BRAND_DELETE_FAIL("30916", "删除失败,产品管理中有产品绑定该品牌名称"), GROUP_DONT_DELETE("30903", "该分类下尚有商品存在"),
//返祖 GOODS_STATUS_ERROR("30904", "状态有误"),
RETURN_SHARE_ORDER_ERROR("40000", "设备返祖订单相关信息找不到,请重新输入订单号"), GOODS_ON_SHELF_SUCCESS("30905", "商品上架成功"),
RETURN_SHARE_ORDER_NOT_FINISH_ERROR("40001", "此设备的订单未完成,请添加其他设备"), GOODS_DOWN_SHELF_SUCCESS("30906", "商品下架成功"),
RETURN_SHARE_ORDER_HAS_BEEN_ADD_ERROR("40002", "此订单的设备已经被添加过,不能重复添加"), GOODS_SKU_IS_NOT_NULL("30907", "商品规格不能为空"),
GOODS_PIC_IS_NOT_NULL("30908", "主图不能为空"),
//宣传中心 GOODS_DESC_IS_NOT_NULL("30910", "商品描述不能为空"),
EXIST_SAME_NAME_OF_MODULE_ERROR("40500", "所属产品中不能有相同名字的模块"), GOODS_GROUP_IS_NOT_NULL("30911", "商品类型不能为空"),
EXIST_SAME_NAME_OF_BANNER_ERROR("40501", "名称重复,请重新输入"), GROUP_DONT_DELETE_BY_CHILD("30912", "该分类下尚有子分类存在"),
EXIST_SAME_CODE_OF_MODULE_ERROR("40502", "moduleCode已重复,请输入其他moduleCode"), GOODS_NOT_EXIST_OR_ALREADY_DOWN_SHELF("30913", "商品不存在或已下架"),
HAS_BEEN_USE_ERROR("40503", "此标签有用户在使用,不能删除!"), GOODS_NAME_IS_NOT_NULL("30914", "商品名称不能为空或名字长度不能大于60"),
GOODS_DELETE_FAIL("30915", "批量删除商品失败,商品已被其他商品绑定"),
FILE_PARSE_ERROR("40600", "上传文件无数据或内容识别失败,请重新上传"), BRAND_DELETE_FAIL("30916", "删除失败,产品管理中有产品绑定该品牌名称"),
HAS_BEEN_APPLY_ERROR("40601", "已提交申请!将有客服人员与你联系"), // 返祖
PRICE_TO_HIGH_ERROR("40602", "标价确认在0-10000000万元内"), RETURN_SHARE_ORDER_ERROR("40000", "设备返祖订单相关信息找不到,请重新输入订单号"),
EXIST_SAME_NAME_ERROR("40603", "快讯名称重复,请重新上传"), RETURN_SHARE_ORDER_NOT_FINISH_ERROR("40001", "此设备的订单未完成,请添加其他设备"),
TENDER_FORMAT_ERROR("40604", "招标序号或内容不能为空,请补全后上传"), RETURN_SHARE_ORDER_HAS_BEEN_ADD_ERROR("40002", "此订单的设备已经被添加过,不能重复添加"),
TENDER_CONTENT_TOO_LONG_ERROR("40605", "存在招标内容字符过长"),
// 宣传中心
GOODS_CATEGORY_NAME_EXIST_ERROR("40605", "名称重复,请重新输入!"), EXIST_SAME_NAME_OF_MODULE_ERROR("40500", "所属产品中不能有相同名字的模块"),
CONTRACT_STATUS_MISTAKEN("40607", "当前合同状态不可进行编辑!"), EXIST_SAME_NAME_OF_BANNER_ERROR("40501", "名称重复,请重新输入"),
CONTRACT_STATUS_CANNOT_BE_DELETED("40607", "当前合同状态不可进行删除!"), EXIST_SAME_CODE_OF_MODULE_ERROR("40502", "moduleCode已重复,请输入其他moduleCode"),
CONTRACT_NOT_EXIST("40608", "合同不存在或已删除!"), HAS_BEEN_USE_ERROR("40503", "此标签有用户在使用,不能删除!"),
CONTRACT_STATUS_DOES_NOT_ALLOW_FILE("40609", "该状态合同不允许归档!"),
SEAL_INFO_NOT_EXIST("40610", "请前往印章管理上传印章或设置默认印章!"), FILE_PARSE_ERROR("40600", "上传文件无数据或内容识别失败,请重新上传"),
AGENCY_NO_FLYER("40611", "机构下暂无飞手,快去招募吧~"), HAS_BEEN_APPLY_ERROR("40601", "已提交申请!将有客服人员与你联系"),
NO_FLYER_WORK("40612", "现在没有飞手上班哦~"), PRICE_TO_HIGH_ERROR("40602", "标价确认在0-10000000万元内"),
TEMPORARY_NOT_SUPPORT_TRANSFER_ORDER("40613", "个人订单暂不支持转单操作~"), EXIST_SAME_NAME_ERROR("40603", "快讯名称重复,请重新上传"),
ELECTRONIC_SIGNATURE_NOT_REAL_NAME_AUTHENTICATION("40614", "请完成电子签约实名认证后再进行操作"), TENDER_FORMAT_ERROR("40604", "招标序号或内容不能为空,请补全后上传"),
DIRECTORY_DOES_NOT_EXIST("40615", "目录不存在或已删除"), TENDER_CONTENT_TOO_LONG_ERROR("40605", "存在招标内容字符过长"),
DEFAULT_DIRECTORY_CANNOT_BE_DEL("40616", "默认目录不可删除"),
THERE_ARE_CATEGORIES_IN_THE_DIRECTORY("40167", "该目录下有分类存在不可删除"), GOODS_CATEGORY_NAME_EXIST_ERROR("40605", "名称重复,请重新输入!"),
DIRECTORY_NAME_HAS_BEEN_EXIST("40168", "目录名称已存在"), CONTRACT_STATUS_MISTAKEN("40607", "当前合同状态不可进行编辑!"),
FAILED_TO_ADD_DATA("40169", "数据新增失败,请稍后重试"), CONTRACT_STATUS_CANNOT_BE_DELETED("40607", "当前合同状态不可进行删除!"),
FAILED_TO_EDIT_DATA("40170", "数据修改失败,请稍后重试"), CONTRACT_NOT_EXIST("40608", "合同不存在或已删除!"),
SKU_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED("40171", "sku不存在或已删除,请刷新后重试!"), CONTRACT_STATUS_DOES_NOT_ALLOW_FILE("40609", "该状态合同不允许归档!"),
SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED("40172", "规格不存在或已删除,请刷新后重试!"), SEAL_INFO_NOT_EXIST("40610", "请前往印章管理上传印章或设置默认印章!"),
SKU_ALREADY_EXIST_IN_THIS_INDUSTRY("40173", "该所属行业下已经存在sku,请检查后重试!"), AGENCY_NO_FLYER("40611", "机构下暂无飞手,快去招募吧~"),
SPEC_EXIST_UNDER_THE_SKU("40174", "该sku下有规格存在,无法删除!"), NO_FLYER_WORK("40612", "现在没有飞手上班哦~"),
SPEC_NOT_CONFIG_PRICE("40175", "存在规格没有配置价格,请联系客服获取报价!"), TEMPORARY_NOT_SUPPORT_TRANSFER_ORDER("40613", "个人订单暂不支持转单操作~"),
SHOP_CAR_SIZE_MORE_2("40176", "行业购物车下单数量仅限一个"), ELECTRONIC_SIGNATURE_NOT_REAL_NAME_AUTHENTICATION("40614", "请完成电子签约实名认证后再进行操作"),
CONTRACT_TEMPLATE_NOT_EXIST_OR_DELETED("40177", "合同模板不存在或已删除!"), DIRECTORY_DOES_NOT_EXIST("40615", "目录不存在或已删除"),
SCORE_ERROR("40177", "您输入的积分数量有误,请重新输入!"), DEFAULT_DIRECTORY_CANNOT_BE_DEL("40616", "默认目录不可删除"),
PLEASE_FILL_IN_THE_CONTRACT_TEMPLATE_FIRST("40178", "请先填充合同模板!"), THERE_ARE_CATEGORIES_IN_THE_DIRECTORY("40167", "该目录下有分类存在不可删除"),
DIRECTORY_NAME_HAS_BEEN_EXIST("40168", "目录名称已存在"),
SCORE_NOT_GIVE_MYSELF("40179","积分不能转赠给本人,请重新操作"), FAILED_TO_ADD_DATA("40169", "数据新增失败,请稍后重试"),
FAILED_TO_EDIT_DATA("40170", "数据修改失败,请稍后重试"),
ALREADY_FINISH_ENT_AUTH_ERROR("2000", "助力已完成!"), SKU_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED("40171", "sku不存在或已删除,请刷新后重试!"),
SYSTEM_ERROR ("2001","系统错误,请稍后重试") , SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED("40172", "规格不存在或已删除,请刷新后重试!"),
RULE_ERROR ("2002","当前兑换比例已失效,请刷新后重试"), SKU_ALREADY_EXIST_IN_THIS_INDUSTRY("40173", "该所属行业下已经存在sku,请检查后重试!"),
COUNT_LIMIT_ERROR("2003", "参与次数已达上线"), SPEC_EXIST_UNDER_THE_SKU("40174", "该sku下有规格存在,无法删除!"),
ALREADY_ENT_AUTH_ERROR("2004","助力失败,您已完成企业认证!"), SPEC_NOT_CONFIG_PRICE("40175", "存在规格没有配置价格,请联系客服获取报价!"),
ALREADY_REAL_NAME_AUTH_ERROR("2005","助力失败,您已完成实名认证!"), SHOP_CAR_SIZE_MORE_2("40176", "行业购物车下单数量仅限一个"),
PARTICIPATE_BUT_NOT_AUTH_ERROR("2006", "待完成授权或认证"), CONTRACT_TEMPLATE_NOT_EXIST_OR_DELETED("40177", "合同模板不存在或已删除!"),
ALREADY_HELP_ERROR("2007", "已助力"), SCORE_ERROR("40177", "您输入的积分数量有误,请重新输入!"),
ALREADY_STOP_ERROR("2008", "活动已下线"), PLEASE_FILL_IN_THE_CONTRACT_TEMPLATE_FIRST("40178", "请先填充合同模板!"),
HELP_FAIL_ERROR("2009", "不能给自己助力哦!"),
ALREADY_BINDING_ERROR("2010", "优惠券已被绑定"), SCORE_NOT_GIVE_MYSELF("40179", "积分不能转赠给本人,请重新操作"),
ALREADY_DIVIDE_ERROR("2011", "订单已分成"),
DIVIDE_OBJ_NOT_EXIST("2012", "先点击确认添加分成对象"); ALREADY_FINISH_ENT_AUTH_ERROR("2000", "助力已完成!"),
/** SYSTEM_ERROR("2001", "系统错误,请稍后重试"),
* 错误码 RULE_ERROR("2002", "当前兑换比例已失效,请刷新后重试"),
* COUNT_LIMIT_ERROR("2003", "参与次数已达上线"),
* @return ALREADY_ENT_AUTH_ERROR("2004", "助力失败,您已完成企业认证!"),
*/ ALREADY_REAL_NAME_AUTH_ERROR("2005", "助力失败,您已完成实名认证!"),
String resultCode; PARTICIPATE_BUT_NOT_AUTH_ERROR("2006", "待完成授权或认证"),
ALREADY_HELP_ERROR("2007", "已助力"),
/** ALREADY_STOP_ERROR("2008", "活动已下线"),
* 错误描述 HELP_FAIL_ERROR("2009", "不能给自己助力哦!"),
* ALREADY_BINDING_ERROR("2010", "优惠券已被绑定"),
* @return ALREADY_DIVIDE_ERROR("2011", "订单已分成"),
*/ DIVIDE_OBJ_NOT_EXIST("2012", "先点击确认添加分成对象"),
String resultMsg;
DEFAULT_DIRECTORY("3001", "默认目录不可删除或修改名称!");
ResultEnum(String resultCode, String resultMsg) { /**
this.resultCode = resultCode; * 错误码
this.resultMsg = resultMsg; *
} * @return
*/
@Override String resultCode;
public String getResultCode() {
return resultCode; /**
} * 错误描述
*
@Override * @return
public String getResultMsg() { */
return resultMsg; String resultMsg;
}
ResultEnum(String resultCode, String resultMsg) {
this.resultCode = resultCode;
this.resultMsg = resultMsg;
}
@Override
public String getResultCode() {
return resultCode;
}
@Override
public String getResultMsg() {
return resultMsg;
}
} }
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; package com.mmc.pms.controller;
import com.mmc.pms.common.ResultBody; 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.ClassifyDetailsDTO;
import com.mmc.pms.model.categories.dto.ClassifyInfoDTO; 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.ClassifyInfoVO;
import com.mmc.pms.model.categories.vo.DirectoryInfoVO; import com.mmc.pms.model.categories.vo.DirectoryInfoVO;
import com.mmc.pms.model.categories.vo.RelevantBusinessVO; import com.mmc.pms.model.categories.vo.RelevantBusinessVO;
...@@ -16,7 +15,6 @@ import io.swagger.annotations.*; ...@@ -16,7 +15,6 @@ import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.constraints.Min; import javax.validation.constraints.Min;
import java.util.List; import java.util.List;
...@@ -28,89 +26,116 @@ import java.util.List; ...@@ -28,89 +26,116 @@ import java.util.List;
@RestController @RestController
@RequestMapping("/classify") @RequestMapping("/classify")
public class BackstageCategoriesController { public class BackstageCategoriesController {
@Autowired @Autowired private CategoriesService categoriesService;
private CategoriesService categoriesService;
@ApiOperation(value = "新增or修改目录")
@ApiOperation(value = "新增or修改目录") @PostMapping("addOrEditDirectory")
@PostMapping("addOrEditDirectory") @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) public ResultBody addOrEditDirectory(@RequestBody DirectoryInfoVO param) {
public ResultBody addOrEditDirectory(@RequestBody DirectoryInfoVO param) { return categoriesService.addOrEditDirectory(param);
return categoriesService.addOrEditDirectory(param); }
}
@ApiOperation(value = "目录列表")
@ApiOperation(value = "目录列表") @GetMapping("directoryList")
@GetMapping("directoryList") @ApiResponses({@ApiResponse(code = 200, message = "OK", response = DirectoryInfoVO.class)})
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = DirectoryInfoVO.class)}) public ResultBody directoryList(
public ResultBody directoryList(@RequestParam Integer pageNo, @RequestParam Integer pageSize, @RequestParam(required = false) Integer type) { @RequestParam Integer pageNo,
return ResultBody.success(categoriesService.directoryList(pageNo, pageSize, type)); @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)}) @ApiOperation(value = "删除目录")
public ResultBody removeDirectory(@ApiParam(value = "id") @RequestParam(value = "id") Integer id) { @GetMapping("removeDirectory")
return categoriesService.removeDirectory(id); @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
} public ResultBody removeDirectory(
@ApiParam(value = "id") @RequestParam(value = "id") Integer id) {
@ApiOperation(value = "分类新增") return categoriesService.removeDirectory(id);
@PostMapping("addClassification") }
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addClassification(@Validated(Create.class) @RequestBody ClassifyInfoVO classifyInfoVO) { @ApiOperation(value = "分类新增")
return categoriesService.addClassification(classifyInfoVO); @PostMapping("addClassification")
} @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addClassification(
@Validated(Create.class) @RequestBody ClassifyInfoVO classifyInfoVO) {
@ApiOperation(value = "分类修改") return categoriesService.addClassification(classifyInfoVO);
@PostMapping("updateClassification") }
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody updateClassification(@Validated(Update.class) @RequestBody ClassifyInfoVO classifyInfoVO) { @ApiOperation(value = "分类修改")
return categoriesService.updateClassification(classifyInfoVO); @PostMapping("updateClassification")
} @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody updateClassification(
@ApiOperation(value = "分类信息-排序") @Validated(Update.class) @RequestBody ClassifyInfoVO classifyInfoVO) {
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) return categoriesService.updateClassification(classifyInfoVO);
@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) { @ApiOperation(value = "分类信息-排序")
return categoriesService.exchangeSortType(firstId, secondId); @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
} @GetMapping("exchangeSortType")
public ResultBody exchangeSortType(
@ApiParam(value = "第一个分类id", required = true) @RequestParam(value = "firstId")
@ApiOperation(value = "分类信息-列表") Integer firstId,
@PostMapping("getClassificationList") @ApiParam(value = "第二个分类id", required = true) @RequestParam(value = "secondId")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ClassifyInfoDTO.class)}) Integer secondId) {
public ResultBody getClassificationList(@RequestBody QueryClassifyVO queryClassifyVO) { return categoriesService.exchangeSortType(firstId, secondId);
return ResultBody.success(categoriesService.getClassificationList(queryClassifyVO)); }
}
@ApiOperation(value = "分类信息-列表")
@PostMapping("getClassificationList")
@ApiOperation(value = "分类详情") @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ClassifyInfoDTO.class)})
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ClassifyDetailsDTO.class)}) public ResultBody getClassificationList(@RequestBody QueryClassifyVO queryClassifyVO) {
@GetMapping("getClassifyDetails") return ResultBody.success(categoriesService.getClassificationList(queryClassifyVO));
public ResultBody getClassifyDetails(@ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id) { }
return categoriesService.getClassifyDetails(id);
} @ApiOperation(value = "分类详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ClassifyDetailsDTO.class)})
@ApiOperation(value = "分类详情") @GetMapping("getClassifyDetails")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = RelevantBusinessVO.class)}) public ResultBody getClassifyDetails(
@GetMapping("queryRelevantBusiness") @ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id) {
public ResultBody queryRelevantBusiness(@ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id, return categoriesService.getClassifyDetails(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)})
@ApiOperation(value = "分类删除") @GetMapping("queryRelevantBusiness")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = RelevantBusinessVO.class)}) public ResultBody queryRelevantBusiness(
@GetMapping("deleteRelevantBusiness") @ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id,
public ResultBody deleteRelevantBusiness(@ApiParam(value = "分类id", required = true) @Min(value = 1) @RequestParam(value = "id") Integer id) { @ApiParam(value = "业务类型", required = true) @Min(value = 0) @RequestParam(value = "type")
return categoriesService.deleteRelevantBusiness(id); Integer type) {
} return categoriesService.queryRelevantBusiness(id, type);
}
@ApiOperation(value = "目录列表不含分页")
@GetMapping("getDirectoryList") @ApiOperation(value = "分类删除")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = DirectoryInfoVO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = RelevantBusinessVO.class)})
public ResultBody getDirectoryList(Integer type) { @GetMapping("deleteRelevantBusiness")
return categoriesService.getDirectoryList(type); public ResultBody deleteRelevantBusiness(
} @ApiParam(value = "分类id", required = true) @Min(value = 1) @RequestParam(value = "id")
Integer id) {
return categoriesService.deleteRelevantBusiness(id);
}
@ApiOperation(value = "目录列表不含分页")
@GetMapping("getDirectoryList")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = DirectoryInfoVO.class)})
public ResultBody getDirectoryList(Integer type) {
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,90 +8,130 @@ import com.mmc.pms.model.order.dto.OrderGoodsProdDTO; ...@@ -8,90 +8,130 @@ import com.mmc.pms.model.order.dto.OrderGoodsProdDTO;
import com.mmc.pms.model.qo.MallOrderGoodsInfoQO; import com.mmc.pms.model.qo.MallOrderGoodsInfoQO;
import com.mmc.pms.model.qo.ProductSpecPriceQO; import com.mmc.pms.model.qo.ProductSpecPriceQO;
import com.mmc.pms.model.sale.dto.*; 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.model.sale.vo.GoodsAddVO;
import com.mmc.pms.service.GoodsInfoService; import com.mmc.pms.service.GoodsInfoService;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
* @Author LW * @Author LW
* @date 2023/3/14 13:22 *
* 概要: * @date 2023/3/14 13:22 概要:
*/ */
@RestController @RestController
@RequestMapping("/goods") @RequestMapping("/goods")
@Api(tags = {"后台-商品管理-相关接口"}) @Api(tags = {"后台-商品管理-相关接口"})
public class BackstageGoodsManageController { public class BackstageGoodsManageController {
@Resource @Resource private GoodsInfoService goodsInfoService;
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) {
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) {
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);
}
@ApiOperation(value = "单位信息")
@GetMapping("getSkuUnit")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = SkuUnitDTO.class)})
public ResultBody getSkuUnit() {
return goodsInfoService.getSkuUnit();
}
@ApiOperation(value = "feign根据购物车信息填充未知信息", hidden = true)
@PostMapping("fillGoodsInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = MallGoodsShopCarDTO.class)})
public List<MallGoodsShopCarDTO> fillGoodsInfo(@RequestBody List<MallGoodsShopCarDTO> param) {
return goodsInfoService.fillGoodsInfo(param);
}
@ApiOperation(value = "feign根据渠道等级和产品规格id获取对应价格", hidden = true)
@PostMapping("feignListProductSpecPrice")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
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,
@RequestParam(value = "tagId") Integer tagId) {
return goodsInfoService.feignGetUnitPriceByTag(specId, tagId);
}
@ApiOperation(value = "feign根据商品的产品规格id查询商品信息", hidden = true)
@PostMapping("feignListProdGoodsSkuInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = OrderGoodsProdDTO.class)})
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) {
return goodsInfoService.feignListIndstGoodsSkuInfo(mallOrderGoodsInfoQO);
}
@ApiOperation(value = "新增(租赁/销售)商品")
@PostMapping("addGoodsInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
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) {
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,
@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 = "单位信息")
@GetMapping("getSkuUnit")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = SkuUnitDTO.class)})
public ResultBody getSkuUnit() {
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)})
public List<MallGoodsShopCarDTO> fillGoodsInfo(@RequestBody List<MallGoodsShopCarDTO> param) {
return goodsInfoService.fillGoodsInfo(param);
}
@ApiOperation(value = "feign根据渠道等级和产品规格id获取对应价格", hidden = true)
@PostMapping("feignListProductSpecPrice")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
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,
@RequestParam(value = "tagId") Integer tagId) {
return goodsInfoService.feignGetUnitPriceByTag(specId, tagId);
}
@ApiOperation(value = "feign根据商品的产品规格id查询商品信息", hidden = true)
@PostMapping("feignListProdGoodsSkuInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = OrderGoodsProdDTO.class)})
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) {
return goodsInfoService.feignListIndstGoodsSkuInfo(mallOrderGoodsInfoQO);
}
} }
package com.mmc.pms.controller; package com.mmc.pms.controller;
import com.mmc.pms.common.ResultBody; 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.Create;
import com.mmc.pms.model.group.Update; import com.mmc.pms.model.group.Update;
import com.mmc.pms.model.lease.vo.PriceAcquisition; import com.mmc.pms.model.lease.vo.PriceAcquisition;
...@@ -17,124 +18,140 @@ import java.math.BigDecimal; ...@@ -17,124 +18,140 @@ import java.math.BigDecimal;
/** /**
* @Author LW * @Author LW
* @date 2022/9/22 10:28 *
* 概要: * @date 2022/9/22 10:28 概要:
*/ */
@RestController @RestController
@RequestMapping("/product/spec/") @RequestMapping("/product/spec/")
@Api(tags = {"产品管理模块-相关接口"}) @Api(tags = {"产品管理模块-相关接口"})
public class BackstageProductSpecController { public class BackstageProductSpecController {
@Autowired @Autowired private ProductSkuService productSkuService;
private ProductSkuService productSkuService;
@ApiOperation(value = "新增产品sku")
@ApiOperation(value = "新增产品sku") @PostMapping("addProductSku")
@PostMapping("addProductSku") @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) public ResultBody addProductSku(
public ResultBody addProductSku(@Validated(Create.class) @ApiParam("产品skuVO") @RequestBody ProductSkuVO param) { @Validated(Create.class) @ApiParam("产品skuVO") @RequestBody ProductSkuVO param) {
return productSkuService.addProductSku(param); return productSkuService.addProductSku(param);
} }
@ApiOperation(value = "产品sku详情") @ApiOperation(value = "产品sku详情")
@GetMapping("getProductSkuDetail") @GetMapping("getProductSkuDetail")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSkuDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSkuDTO.class)})
public ResultBody getProductSkuDetail(@ApiParam("id") @RequestParam(value = "id") Integer id) { public ResultBody getProductSkuDetail(@ApiParam("id") @RequestParam(value = "id") Integer id) {
return productSkuService.getProductSkuDetail(id); return productSkuService.getProductSkuDetail(id);
} }
@ApiOperation(value = "编辑产品sku") @ApiOperation(value = "编辑产品sku")
@PostMapping("editProductSku") @PostMapping("editProductSku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody editProductSku(@Validated(Update.class) @ApiParam("产品skuVO") @RequestBody ProductSkuVO param) { public ResultBody editProductSku(
return productSkuService.editProductSku(param); @Validated(Update.class) @ApiParam("产品skuVO") @RequestBody ProductSkuVO param) {
} return productSkuService.editProductSku(param);
}
@ApiOperation(value = "产品sku分页列表")
@PostMapping("listPageProductSku") @ApiOperation(value = "产品目录列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSkuDTO.class)}) @GetMapping("productDirectoryList")
public ResultBody listPageProductSku(@ApiParam("条件参数") @RequestBody ProductSkuQO productSkuQO) { @ApiResponses({@ApiResponse(code = 200, message = "OK", response = DirectoryInfoVO.class)})
return productSkuService.listPageProductSku(productSkuQO); public ResultBody<DirectoryInfoVO> productDirectoryList() {
} return productSkuService.productDirectoryList();
}
@ApiOperation(value = "删除产品sku")
@GetMapping("removeProductSku") @ApiOperation(value = "产品sku分页列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @PostMapping("listPageProductSku")
public ResultBody removeProductSku(@ApiParam("id") @RequestParam(value = "id") Integer id) { @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSkuDTO.class)})
return productSkuService.removeProductSku(id); public ResultBody listPageProductSku(@ApiParam("条件参数") @RequestBody ProductSkuQO productSkuQO) {
} return productSkuService.listPageProductSku(productSkuQO);
}
@ApiOperation(value = "新增or修改产品规格")
@PostMapping("addOrEditProductSpec") @ApiOperation(value = "删除产品sku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @GetMapping("removeProductSku")
public ResultBody addOrEditProductSpec(@Validated({Create.class, Update.class}) @ApiParam("产品规格VO") @RequestBody ProductSpecVO param) { @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
return productSkuService.addOrEditProductSpec(param); public ResultBody removeProductSku(@ApiParam("id") @RequestParam(value = "id") Integer id) {
} return productSkuService.removeProductSku(id);
}
@ApiOperation(value = "产品规格编辑回显")
@GetMapping("getProductSpecDetail") @ApiOperation(value = "新增or修改产品规格")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecDTO.class)}) @PostMapping("addOrEditProductSpec")
public ResultBody getProductSpecDetail(@ApiParam("id") @RequestParam(value = "id") Integer id) { @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
return productSkuService.getProductSpecDetail(id); public ResultBody addOrEditProductSpec(
} @Validated({Create.class, Update.class}) @ApiParam("产品规格VO") @RequestBody
ProductSpecVO param) {
@ApiOperation(value = "产品规格分页列表") return productSkuService.addOrEditProductSpec(param);
@GetMapping("listPageProductSpec") }
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecDTO.class)})
public ResultBody listPageProductSpec(@ApiParam(value = "页码") @RequestParam(value = "pageNo") Integer pageNo, @ApiOperation(value = "产品规格编辑回显")
@ApiParam(value = "每页显示数") @RequestParam(value = "pageSize") Integer pageSize, @GetMapping("getProductSpecDetail")
@ApiParam(value = "产品skuId") @RequestParam(value = "productSkuId") Integer productSkuId) { @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecDTO.class)})
return productSkuService.listPageProductSpec(pageNo, pageSize, productSkuId); public ResultBody getProductSpecDetail(@ApiParam("id") @RequestParam(value = "id") Integer id) {
} return productSkuService.getProductSpecDetail(id);
}
@ApiOperation(value = "产品规格管理-价格配置")
@PostMapping("productSpecCPQ") @ApiOperation(value = "产品规格分页列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @GetMapping("listPageProductSpec")
public ResultBody productSpecCPQ(@RequestBody ProductSpecCPQVO productSpecCPQVO) { @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecDTO.class)})
return productSkuService.productSpecCPQ(productSpecCPQVO); 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,
@ApiOperation(value = "价格配置信息的修改") @ApiParam(value = "关键字") @RequestParam(value = "keyword", required = false) String keyword) {
@PostMapping("updateProductSpecCPQ") return productSkuService.listPageProductSpec(pageNo, pageSize, productSkuId, keyword);
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) }
public ResultBody updateProductSpecCPQ(@RequestBody ProductSpecCPQVO productSpecCPQVO) {
return productSkuService.updateProductSpecCPQ(productSpecCPQVO); @ApiOperation(value = "产品规格管理-价格配置")
} @PostMapping("productSpecCPQ")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@ApiOperation(value = "产品规格管理---获取价格配置信息") public ResultBody productSpecCPQ(@RequestBody ProductSpecCPQVO productSpecCPQVO) {
@PostMapping("getProductSpecCPQ") return productSkuService.productSpecCPQ(productSpecCPQVO);
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecPriceDTO.class)}) }
public ResultBody getProductSpecCPQ(@RequestBody ProductSpecCPQVO productSpecCPQVO) {
return productSkuService.getProductSpecCPQ(productSpecCPQVO); @ApiOperation(value = "价格配置信息的修改")
} @PostMapping("updateProductSpecCPQ")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
// public ResultBody updateProductSpecCPQ(@RequestBody ProductSpecCPQVO productSpecCPQVO) {
// @ApiOperation(value = "价格配置信息--恢复全局默认设置") return productSkuService.updateProductSpecCPQ(productSpecCPQVO);
// @GetMapping("getDefaultSettings") }
// @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecPriceDTO.class)})
// public ResultBody getDefaultSettings(@ApiParam(value = "规格id") @RequestParam(value = "productSpecId") Integer productSpecId) { @ApiOperation(value = "产品规格管理---获取价格配置信息")
// return productSpecService.getDefaultSettings(productSpecId); @PostMapping("getProductSpecCPQ")
// } @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecPriceDTO.class)})
// public ResultBody getProductSpecCPQ(@RequestBody ProductSpecCPQVO productSpecCPQVO) {
@ApiOperation(value = "产品规格管理---删除规格") return productSkuService.getProductSpecCPQ(productSpecCPQVO);
@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 = "价格配置信息--恢复全局默认设置")
} // @GetMapping("getDefaultSettings")
// // @ApiResponses({@ApiResponse(code = 200, message = "OK", response =
// @ApiOperation(value = "feign根据渠道等级获取单价信息") // ProductSpecPriceDTO.class)})
// @GetMapping("feignGetUnitPriceByTag") // public ResultBody getDefaultSettings(@ApiParam(value = "规格id") @RequestParam(value =
// @ApiIgnore // "productSpecId") Integer productSpecId) {
// @ApiResponses({@ApiResponse(code = 200, message = "OK",response = ProductSpecPriceDTO.class)}) // return productSpecService.getDefaultSettings(productSpecId);
// public ProductSpecPriceDTO feignGetUnitPriceByTag(@RequestParam(value = "specId")Integer specId, // }
// @RequestParam(value = "tagId")Integer tagId) { //
// return productSpecService.feignGetUnitPriceByTag(specId,tagId); @ApiOperation(value = "产品规格管理---删除规格")
// } @GetMapping("removeProductSpec")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = RemoveSkuDTO.class)})
@ApiOperation(value = "feign根据渠道等级获取单价信息") public ResultBody removeProductSpec(@ApiParam("id") @RequestParam(value = "id") Integer id) {
@PostMapping("feignGetSpecLeaseUnitPrice") return productSkuService.removeProductSpec(id);
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) }
public BigDecimal feignGetUnitPriceByTag(@RequestBody PriceAcquisition priceAcquisition) { //
return productSkuService.feignGetUnitPriceByTag(priceAcquisition); // @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")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public BigDecimal feignGetUnitPriceByTag(@RequestBody PriceAcquisition priceAcquisition) {
return productSkuService.feignGetUnitPriceByTag(priceAcquisition);
}
} }
package com.mmc.pms.controller; package com.mmc.pms.controller;
import com.mmc.pms.common.Page;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.group.Create; import com.mmc.pms.model.group.Create;
import com.mmc.pms.model.group.Update; import com.mmc.pms.model.group.Update;
import com.mmc.pms.model.qo.ServiceQO; import com.mmc.pms.model.qo.ServiceQO;
import com.mmc.pms.model.work.dto.ServiceDTO; 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.ServiceVO;
import com.mmc.pms.page.PageResult; import com.mmc.pms.model.work.vo.UpAndDownServiceVO;
import com.mmc.pms.service.BackstageTaskService; import com.mmc.pms.service.BackstageTaskService;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.List;
/** /**
* @Author LW * @Author LW
* @date 2023/6/6 10:41 *
* 概要: * @date 2023/6/6 10:41 概要:
*/ */
@Api(tags = {"后台-服务管理-模块"}) @Api(tags = {"后台-服务管理-模块"})
@RestController @RestController
@RequestMapping("/backstage/work") @RequestMapping("/backstage/work")
public class BackstageTaskServiceController extends BaseController { public class BackstageTaskServiceController extends BaseController {
@Resource @Resource private BackstageTaskService backstageTaskService;
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());
}
@ApiOperation(value = "修改作业服务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("updateWorkService")
public ResultBody updateWorkService(@Validated(Update.class) @RequestBody ServiceVO param) {
return backstageTaskService.updateById(param);
}
@ApiOperation(value = "批量删除作业服务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("deleteWorkService")
public ResultBody deleteWorkService(@ApiParam("作业服务id") @RequestBody List<Integer> ids) {
return backstageTaskService.deleteByIds(ids);
}
@ApiOperation(value = "新增作业服务") @ApiOperation(value = "批量上下架作业服务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("addWorkService") @PostMapping("batchUpAndDownWorkService")
public ResultBody addWorkService(@Validated(Create.class) @RequestBody ServiceVO param, HttpServletRequest request) { public ResultBody batchUpAndDownWorkService(@RequestBody UpAndDownServiceVO param) {
return backstageTaskService.addWorkService(param, this.getUserLoginInfoFromRedis(request).getUserAccountId()); return backstageTaskService.batchUpAndDownWorkService(param);
} }
@ApiOperation(value = "修改作业服务") @ApiOperation(value = "查询作业服务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ServiceDTO.class)})
@PostMapping("updateWorkService") @GetMapping("queryWorkService")
public ResultBody updateWorkService(@Validated(Update.class) @RequestBody ServiceVO param) { public ResultBody<ServiceDTO> queryWorkService(@ApiParam("作业服务id") @RequestParam(value = "id") Integer id) {
return backstageTaskService.updateById(param); return backstageTaskService.queryById(id);
} }
@ApiOperation(value = "删除作业服务") @ApiOperation(value = "查询服务管理列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ServiceDTO.class)})
@GetMapping("deleteWorkService") @PostMapping("queryServiceManagerList")
public ResultBody deleteWorkService(@ApiParam("作业服务id") @RequestParam(value = "id") Integer id) { public ResultBody<ServiceDTO> queryServiceManagerList(
return backstageTaskService.deleteById(id); @Validated(Page.class) @RequestBody ServiceQO param, HttpServletRequest request) {
} return ResultBody.success(backstageTaskService.queryServiceManagerList(param, this.getUserLoginInfoFromRedis(request).getUserAccountId()));
}
@ApiOperation(value = "查询作业服务") @ApiOperation(value = "web接口-条件查询作业服务列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ServiceDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = WorkServiceDTO.class)})
@GetMapping("queryWorkService") @PostMapping("queryWorkServiceList")
public ResultBody queryWorkService(@ApiParam("作业服务id") @RequestParam(value = "id") Integer id) { public ResultBody<WorkServiceDTO> queryWorkServiceList(@Validated(Page.class) @RequestBody ServiceQO param, HttpServletRequest request) {
return backstageTaskService.queryById(id); return ResultBody.success(backstageTaskService.queryWorkServiceList(param,request));
} }
@ApiOperation(value = "查询工作服务列表") @ApiOperation(value = "远程查询作业服务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ServiceDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ServiceDTO.class)})
@PostMapping("queryWorkServiceList") @PostMapping("feignQueryWorkServiceListById")
public PageResult queryWorkServiceList(@Validated(Create.class) @RequestBody ServiceQO param, HttpServletRequest request) { @ApiIgnore
return backstageTaskService.queryWorkServiceList(param, this.getUserLoginInfoFromRedis(request).getUserAccountId()); public List<ServiceDTO> feignQueryWorkServiceListById(@RequestBody List<Integer> ids) {
} return backstageTaskService.feignQueryWorkServiceListById(ids);
}
} }
...@@ -11,48 +11,48 @@ import org.springframework.data.redis.core.StringRedisTemplate; ...@@ -11,48 +11,48 @@ import org.springframework.data.redis.core.StringRedisTemplate;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
/** /**
* @author: zj * @author: zj @Date: 2023/5/25 18:11
* @Date: 2023/5/25 18:11
*/ */
public abstract class BaseController { public abstract class BaseController {
@Autowired @Autowired private StringRedisTemplate stringRedisTemplate;
private StringRedisTemplate stringRedisTemplate;
/** /**
* 解析token,获取用户信息 * 解析token,获取用户信息
* @param request *
* @return * @param request
*/ * @return
// public BaseAccountDTO getUserLoginInfo(HttpServletRequest request) { */
// String token = request.getHeader("token"); // public BaseAccountDTO getUserLoginInfo(HttpServletRequest request) {
// try { // String token = request.getHeader("token");
// Claims claims = JwtUtil.parseJwt(token); // try {
// String userId = claims.get(JwtConstant.USER_ACCOUNT_ID).toString(); // Claims claims = JwtUtil.parseJwt(token);
//// String roleId = claims.get("").toString(); // String userId = claims.get(JwtConstant.USER_ACCOUNT_ID).toString();
// String tokenType = claims.get(JwtConstant.TOKEN_TYPE).toString(); //// String roleId = claims.get("").toString();
// return BaseAccountDTO.builder().id(Integer.parseInt(userId)).tokenPort(tokenType).build(); // String tokenType = claims.get(JwtConstant.TOKEN_TYPE).toString();
// }catch (Exception e){ // return
// throw new BizException("Invalid token"); // BaseAccountDTO.builder().id(Integer.parseInt(userId)).tokenPort(tokenType).build();
// } // }catch (Exception e){
// } // throw new BizException("Invalid token");
// }
// }
/** /**
* 使用token从redis获取用户信息 * 使用token从redis获取用户信息
* *
* @param request * @param request
* @return * @return
*/ */
public LoginSuccessDTO getUserLoginInfoFromRedis(HttpServletRequest request) { public LoginSuccessDTO getUserLoginInfoFromRedis(HttpServletRequest request) {
String token = request.getHeader("token"); String token = request.getHeader("token");
if (StringUtils.isBlank(token)) { if (StringUtils.isBlank(token)) {
throw new BizException(ResultEnum.LOGIN_ACCOUNT_STATUS_ERROR); throw new BizException(ResultEnum.LOGIN_ACCOUNT_STATUS_ERROR);
}
String json = stringRedisTemplate.opsForValue().get(token);
if (StringUtils.isBlank(json)) {
throw new BizException(ResultEnum.LOGIN_ACCOUNT_STATUS_ERROR);
}
LoginSuccessDTO loginSuccessDTO = JSONObject.parseObject(json, LoginSuccessDTO.class);
return loginSuccessDTO;
} }
String json = stringRedisTemplate.opsForValue().get(token);
if (StringUtils.isBlank(json)) {
throw new BizException(ResultEnum.LOGIN_ACCOUNT_STATUS_ERROR);
}
LoginSuccessDTO loginSuccessDTO = JSONObject.parseObject(json, LoginSuccessDTO.class);
return loginSuccessDTO;
}
} }
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; ...@@ -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.BrandDTO;
import com.mmc.pms.model.lease.dto.DeviceCategoryDTO; import com.mmc.pms.model.lease.dto.DeviceCategoryDTO;
import com.mmc.pms.model.lease.dto.WareInfoDTO; 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.lease.vo.LeaseVo;
import com.mmc.pms.model.other.dto.DistrictInfoDTO; import com.mmc.pms.model.other.dto.DistrictInfoDTO;
import com.mmc.pms.model.other.dto.ModelDTO; 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.model.sale.dto.SkuInfoDTO;
import com.mmc.pms.page.Page;
import com.mmc.pms.service.WebDeviceService; import com.mmc.pms.service.WebDeviceService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired; 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.*;
/** /**
...@@ -57,13 +53,13 @@ public class MiniProgramDeviceController { ...@@ -57,13 +53,13 @@ public class MiniProgramDeviceController {
return webDeviceService.model(); return webDeviceService.model();
} }
@ApiOperation(value = "设备列表筛选") // @ApiOperation(value = "设备列表筛选")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = WareInfoItemDTO.class)}) // @ApiResponses({@ApiResponse(code = 200, message = "OK", response = WareInfoItemDTO.class)})
@PostMapping("/deviceList") // @PostMapping("/deviceList")
public ResultBody<WareInfoItemDTO> listWareInfoPage( // public ResultBody<WareInfoItemDTO> listWareInfoPage(
@RequestBody @Validated(Page.class) WareInfoQO param) { // @RequestBody @Validated(Page.class) WareInfoQO param) {
return webDeviceService.listWareInfoPage(param); // return webDeviceService.listWareInfoPage(param, request);
} // }
@ApiOperation(value = "设备详情") @ApiOperation(value = "设备详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
......
...@@ -32,197 +32,196 @@ import java.util.List; ...@@ -32,197 +32,196 @@ import java.util.List;
@RequestMapping("/partupload") @RequestMapping("/partupload")
public class PartUploadController { public class PartUploadController {
@Autowired @Autowired private StringRedisTemplate stringRedisTemplate;
private StringRedisTemplate stringRedisTemplate;
@ApiOperation(value = "初始化分片上传")
@ApiOperation(value = "初始化分片上传") @GetMapping("/initPartUpload")
@GetMapping("/initPartUpload") public ResultBody initPartUpload(@RequestParam String fileName, HttpServletRequest httpRequest) {
public ResultBody initPartUpload(@RequestParam String fileName, HttpServletRequest httpRequest) { // 创建OSSClient实例。
// 创建OSSClient实例。 OSS ossClient =
OSS ossClient = new OSSClientBuilder()
new OSSClientBuilder() .build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
StringBuffer objectName = new StringBuffer();
StringBuffer objectName = new StringBuffer(); objectName.append(OssConstant.BUCKET);
objectName.append(OssConstant.BUCKET); objectName.append("/");
objectName.append("/"); objectName.append(fileName);
objectName.append(fileName); objectName.append("-");
objectName.append("-"); objectName.append(TDateUtil.getCurrentDateByType("yyyyMMddHHmm"));
objectName.append(TDateUtil.getCurrentDateByType("yyyyMMddHHmm"));
// 创建InitiateMultipartUploadRequest对象。
// 创建InitiateMultipartUploadRequest对象。 InitiateMultipartUploadRequest request =
InitiateMultipartUploadRequest request = new InitiateMultipartUploadRequest(OssConstant.BUCKET, objectName.toString());
new InitiateMultipartUploadRequest(OssConstant.BUCKET, objectName.toString());
// 如果需要在初始化分片时设置文件存储类型,请参考以下示例代码。
// 如果需要在初始化分片时设置文件存储类型,请参考以下示例代码。 // ObjectMetadata metadata = new ObjectMetadata();
// ObjectMetadata metadata = new ObjectMetadata(); // metadata.setHeader(OSSHeaders.OSS_STORAGE_CLASS,
// metadata.setHeader(OSSHeaders.OSS_STORAGE_CLASS, // StorageClass.Standard.toString());
// StorageClass.Standard.toString()); // request.setObjectMetadata(metadata);
// request.setObjectMetadata(metadata);
// 初始化分片。
// 初始化分片。 InitiateMultipartUploadResult upresult = ossClient.initiateMultipartUpload(request);
InitiateMultipartUploadResult upresult = ossClient.initiateMultipartUpload(request); // 返回uploadId,它是分片上传事件的唯一标识。您可以根据该uploadId发起相关的操作,例如取消分片上传、查询分片上传等。
// 返回uploadId,它是分片上传事件的唯一标识。您可以根据该uploadId发起相关的操作,例如取消分片上传、查询分片上传等。 String uploadId = upresult.getUploadId();
String uploadId = upresult.getUploadId();
// 记录缓存信息
// 记录缓存信息 PartUploadInfo pinfo = new PartUploadInfo();
PartUploadInfo pinfo = new PartUploadInfo(); pinfo.setBucketName(OssConstant.BUCKET);
pinfo.setBucketName(OssConstant.BUCKET); pinfo.setObjectName(objectName.toString());
pinfo.setObjectName(objectName.toString()); pinfo.setUploadId(uploadId);
pinfo.setUploadId(uploadId); stringRedisTemplate
stringRedisTemplate .opsForValue()
.opsForValue() .set(RedisConstant.createPartUploadKey(uploadId), JsonUtil.parseObjToJson(pinfo));
.set(RedisConstant.createPartUploadKey(uploadId), JsonUtil.parseObjToJson(pinfo)); return ResultBody.success(uploadId);
return ResultBody.success(uploadId); }
@ApiOperation(value = "进行片段上传")
@PostMapping("/partUpload")
public ResultBody partUpload(
@RequestParam("partFile") MultipartFile partFile, @RequestParam("uploadId") String uploadId)
throws IOException {
PartUploadInfo pinfo =
JsonUtil.parseJsonToObj(
stringRedisTemplate.opsForValue().get(RedisConstant.createPartUploadKey(uploadId)),
PartUploadInfo.class);
// 创建OSSClient实例。
OSS ossClient =
new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
// partETags是PartETag的集合。PartETag由分片的ETag和分片号组成。
List<PartETag> partETags = new ArrayList<PartETag>();
// 每个分片的大小,用于计算文件有多少个分片。单位为字节。
final long partSize = 1 * 1024 * 1024L; // 1 MB。
// 填写本地文件的完整路径。如果未指定本地路径,则默认从示例程序所属项目对应本地路径中上传文件。
final File sampleFile = new File("D:\\localpath\\examplefile.txt");
long fileLength = sampleFile.length();
int partCount = (int) (fileLength / partSize);
if (fileLength % partSize != 0) {
partCount++;
} }
// 遍历分片上传。
@ApiOperation(value = "进行片段上传") for (int i = 0; i < partCount; i++) {
@PostMapping("/partUpload") long startPos = i * partSize;
public ResultBody partUpload( long curPartSize = (i + 1 == partCount) ? (fileLength - startPos) : partSize;
@RequestParam("partFile") MultipartFile partFile, @RequestParam("uploadId") String uploadId) InputStream instream = new FileInputStream(sampleFile);
throws IOException { // 跳过已经上传的分片。
PartUploadInfo pinfo = instream.skip(startPos);
JsonUtil.parseJsonToObj( UploadPartRequest uploadPartRequest = new UploadPartRequest();
stringRedisTemplate.opsForValue().get(RedisConstant.createPartUploadKey(uploadId)), uploadPartRequest.setBucketName(pinfo.getBucketName());
PartUploadInfo.class); uploadPartRequest.setKey(pinfo.getObjectName());
// 创建OSSClient实例。 uploadPartRequest.setUploadId(uploadId);
OSS ossClient = uploadPartRequest.setInputStream(instream);
new OSSClientBuilder() // 设置分片大小。除了最后一个分片没有大小限制,其他的分片最小为100 KB。
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET); uploadPartRequest.setPartSize(curPartSize);
// partETags是PartETag的集合。PartETag由分片的ETag和分片号组成。 // 设置分片号。每一个上传的分片都有一个分片号,取值范围是1~10000,如果超出此范围,OSS将返回InvalidArgument错误码。
List<PartETag> partETags = new ArrayList<PartETag>(); uploadPartRequest.setPartNumber(i + 1);
// 每个分片的大小,用于计算文件有多少个分片。单位为字节。 // 每个分片不需要按顺序上传,甚至可以在不同客户端上传,OSS会按照分片号排序组成完整的文件。
final long partSize = 1 * 1024 * 1024L; // 1 MB。 UploadPartResult uploadPartResult = ossClient.uploadPart(uploadPartRequest);
// 每次上传分片之后,OSS的返回结果包含PartETag。PartETag将被保存在partETags中。
// 填写本地文件的完整路径。如果未指定本地路径,则默认从示例程序所属项目对应本地路径中上传文件。 partETags.add(uploadPartResult.getPartETag());
final File sampleFile = new File("D:\\localpath\\examplefile.txt");
long fileLength = sampleFile.length();
int partCount = (int) (fileLength / partSize);
if (fileLength % partSize != 0) {
partCount++;
}
// 遍历分片上传。
for (int i = 0; i < partCount; i++) {
long startPos = i * partSize;
long curPartSize = (i + 1 == partCount) ? (fileLength - startPos) : partSize;
InputStream instream = new FileInputStream(sampleFile);
// 跳过已经上传的分片。
instream.skip(startPos);
UploadPartRequest uploadPartRequest = new UploadPartRequest();
uploadPartRequest.setBucketName(pinfo.getBucketName());
uploadPartRequest.setKey(pinfo.getObjectName());
uploadPartRequest.setUploadId(uploadId);
uploadPartRequest.setInputStream(instream);
// 设置分片大小。除了最后一个分片没有大小限制,其他的分片最小为100 KB。
uploadPartRequest.setPartSize(curPartSize);
// 设置分片号。每一个上传的分片都有一个分片号,取值范围是1~10000,如果超出此范围,OSS将返回InvalidArgument错误码。
uploadPartRequest.setPartNumber(i + 1);
// 每个分片不需要按顺序上传,甚至可以在不同客户端上传,OSS会按照分片号排序组成完整的文件。
UploadPartResult uploadPartResult = ossClient.uploadPart(uploadPartRequest);
// 每次上传分片之后,OSS的返回结果包含PartETag。PartETag将被保存在partETags中。
partETags.add(uploadPartResult.getPartETag());
}
// 创建CompleteMultipartUploadRequest对象。
// 在执行完成分片上传操作时,需要提供所有有效的partETags。OSS收到提交的partETags后,会逐一验证每个分片的有效性。当所有的数据分片验证通过后,OSS将把这些分片组合成一个完整的文件。
CompleteMultipartUploadRequest completeMultipartUploadRequest =
new CompleteMultipartUploadRequest(
pinfo.getBucketName(), pinfo.getObjectName(), uploadId, partETags);
// 如果需要在完成文件上传的同时设置文件访问权限,请参考以下示例代码。
// completeMultipartUploadRequest.setObjectACL(CannedAccessControlList.PublicRead);
// 完成上传。
CompleteMultipartUploadResult completeMultipartUploadResult =
ossClient.completeMultipartUpload(completeMultipartUploadRequest);
System.out.println(completeMultipartUploadResult.getETag());
// 关闭OSSClient。
ossClient.shutdown();
return ResultBody.success();
} }
@ApiOperation(value = "上传到阿里云oss") // 创建CompleteMultipartUploadRequest对象。
@PostMapping("/oss") // 在执行完成分片上传操作时,需要提供所有有效的partETags。OSS收到提交的partETags后,会逐一验证每个分片的有效性。当所有的数据分片验证通过后,OSS将把这些分片组合成一个完整的文件。
public ResultBody oss( CompleteMultipartUploadRequest completeMultipartUploadRequest =
@RequestPart("uploadFile") MultipartFile uploadFile, HttpServletRequest httpRequest) new CompleteMultipartUploadRequest(
throws Exception { pinfo.getBucketName(), pinfo.getObjectName(), uploadId, partETags);
// yourEndpoint填写Bucket所在地域对应的Endpoint。以华东1(杭州)为例,Endpoint填写为https://oss-cn-hangzhou.aliyuncs.com。
String endpoint = "yourEndpoint"; // 如果需要在完成文件上传的同时设置文件访问权限,请参考以下示例代码。
// 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。 // completeMultipartUploadRequest.setObjectACL(CannedAccessControlList.PublicRead);
String accessKeyId = "yourAccessKeyId";
String accessKeySecret = "yourAccessKeySecret"; // 完成上传。
CompleteMultipartUploadResult completeMultipartUploadResult =
// 填写Bucket名称,例如examplebucket。 ossClient.completeMultipartUpload(completeMultipartUploadRequest);
String bucketName = "examplebucket"; System.out.println(completeMultipartUploadResult.getETag());
// 填写Object完整路径,例如exampledir/exampleobject.txt。Object完整路径中不能包含Bucket名称。 // 关闭OSSClient。
String objectName = "exampledir/exampleobject.txt"; ossClient.shutdown();
return ResultBody.success();
// 创建OSSClient实例。 }
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
@ApiOperation(value = "上传到阿里云oss")
// 创建InitiateMultipartUploadRequest对象。 @PostMapping("/oss")
InitiateMultipartUploadRequest request = public ResultBody oss(
new InitiateMultipartUploadRequest(bucketName, objectName); @RequestPart("uploadFile") MultipartFile uploadFile, HttpServletRequest httpRequest)
throws Exception {
// 如果需要在初始化分片时设置文件存储类型,请参考以下示例代码。 // yourEndpoint填写Bucket所在地域对应的Endpoint。以华东1(杭州)为例,Endpoint填写为https://oss-cn-hangzhou.aliyuncs.com。
// ObjectMetadata metadata = new ObjectMetadata(); String endpoint = "yourEndpoint";
// metadata.setHeader(OSSHeaders.OSS_STORAGE_CLASS, // 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。
// StorageClass.Standard.toString()); String accessKeyId = "yourAccessKeyId";
// request.setObjectMetadata(metadata); String accessKeySecret = "yourAccessKeySecret";
// 初始化分片。 // 填写Bucket名称,例如examplebucket。
InitiateMultipartUploadResult upresult = ossClient.initiateMultipartUpload(request); String bucketName = "examplebucket";
// 返回uploadId,它是分片上传事件的唯一标识。您可以根据该uploadId发起相关的操作,例如取消分片上传、查询分片上传等。 // 填写Object完整路径,例如exampledir/exampleobject.txt。Object完整路径中不能包含Bucket名称。
String uploadId = upresult.getUploadId(); String objectName = "exampledir/exampleobject.txt";
// partETags是PartETag的集合。PartETag由分片的ETag和分片号组成。 // 创建OSSClient实例。
List<PartETag> partETags = new ArrayList<PartETag>(); OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
// 每个分片的大小,用于计算文件有多少个分片。单位为字节。
final long partSize = 1 * 1024 * 1024L; // 1 MB。 // 创建InitiateMultipartUploadRequest对象。
InitiateMultipartUploadRequest request =
// 填写本地文件的完整路径。如果未指定本地路径,则默认从示例程序所属项目对应本地路径中上传文件。 new InitiateMultipartUploadRequest(bucketName, objectName);
final File sampleFile = new File("D:\\localpath\\examplefile.txt");
long fileLength = sampleFile.length(); // 如果需要在初始化分片时设置文件存储类型,请参考以下示例代码。
int partCount = (int) (fileLength / partSize); // ObjectMetadata metadata = new ObjectMetadata();
if (fileLength % partSize != 0) { // metadata.setHeader(OSSHeaders.OSS_STORAGE_CLASS,
partCount++; // StorageClass.Standard.toString());
} // request.setObjectMetadata(metadata);
// 遍历分片上传。
for (int i = 0; i < partCount; i++) { // 初始化分片。
long startPos = i * partSize; InitiateMultipartUploadResult upresult = ossClient.initiateMultipartUpload(request);
long curPartSize = (i + 1 == partCount) ? (fileLength - startPos) : partSize; // 返回uploadId,它是分片上传事件的唯一标识。您可以根据该uploadId发起相关的操作,例如取消分片上传、查询分片上传等。
InputStream instream = new FileInputStream(sampleFile); String uploadId = upresult.getUploadId();
// 跳过已经上传的分片。
instream.skip(startPos); // partETags是PartETag的集合。PartETag由分片的ETag和分片号组成。
UploadPartRequest uploadPartRequest = new UploadPartRequest(); List<PartETag> partETags = new ArrayList<PartETag>();
uploadPartRequest.setBucketName(bucketName); // 每个分片的大小,用于计算文件有多少个分片。单位为字节。
uploadPartRequest.setKey(objectName); final long partSize = 1 * 1024 * 1024L; // 1 MB。
uploadPartRequest.setUploadId(uploadId);
uploadPartRequest.setInputStream(instream); // 填写本地文件的完整路径。如果未指定本地路径,则默认从示例程序所属项目对应本地路径中上传文件。
// 设置分片大小。除了最后一个分片没有大小限制,其他的分片最小为100 KB。 final File sampleFile = new File("D:\\localpath\\examplefile.txt");
uploadPartRequest.setPartSize(curPartSize); long fileLength = sampleFile.length();
// 设置分片号。每一个上传的分片都有一个分片号,取值范围是1~10000,如果超出此范围,OSS将返回InvalidArgument错误码。 int partCount = (int) (fileLength / partSize);
uploadPartRequest.setPartNumber(i + 1); if (fileLength % partSize != 0) {
// 每个分片不需要按顺序上传,甚至可以在不同客户端上传,OSS会按照分片号排序组成完整的文件。 partCount++;
UploadPartResult uploadPartResult = ossClient.uploadPart(uploadPartRequest); }
// 每次上传分片之后,OSS的返回结果包含PartETag。PartETag将被保存在partETags中。 // 遍历分片上传。
partETags.add(uploadPartResult.getPartETag()); for (int i = 0; i < partCount; i++) {
} long startPos = i * partSize;
long curPartSize = (i + 1 == partCount) ? (fileLength - startPos) : partSize;
// 创建CompleteMultipartUploadRequest对象。 InputStream instream = new FileInputStream(sampleFile);
// 在执行完成分片上传操作时,需要提供所有有效的partETags。OSS收到提交的partETags后,会逐一验证每个分片的有效性。当所有的数据分片验证通过后,OSS将把这些分片组合成一个完整的文件。 // 跳过已经上传的分片。
CompleteMultipartUploadRequest completeMultipartUploadRequest = instream.skip(startPos);
new CompleteMultipartUploadRequest(bucketName, objectName, uploadId, partETags); UploadPartRequest uploadPartRequest = new UploadPartRequest();
uploadPartRequest.setBucketName(bucketName);
// 如果需要在完成文件上传的同时设置文件访问权限,请参考以下示例代码。 uploadPartRequest.setKey(objectName);
// completeMultipartUploadRequest.setObjectACL(CannedAccessControlList.PublicRead); uploadPartRequest.setUploadId(uploadId);
uploadPartRequest.setInputStream(instream);
// 完成上传。 // 设置分片大小。除了最后一个分片没有大小限制,其他的分片最小为100 KB。
CompleteMultipartUploadResult completeMultipartUploadResult = uploadPartRequest.setPartSize(curPartSize);
ossClient.completeMultipartUpload(completeMultipartUploadRequest); // 设置分片号。每一个上传的分片都有一个分片号,取值范围是1~10000,如果超出此范围,OSS将返回InvalidArgument错误码。
System.out.println(completeMultipartUploadResult.getETag()); uploadPartRequest.setPartNumber(i + 1);
// 关闭OSSClient。 // 每个分片不需要按顺序上传,甚至可以在不同客户端上传,OSS会按照分片号排序组成完整的文件。
ossClient.shutdown(); UploadPartResult uploadPartResult = ossClient.uploadPart(uploadPartRequest);
return ResultBody.success(); // 每次上传分片之后,OSS的返回结果包含PartETag。PartETag将被保存在partETags中。
partETags.add(uploadPartResult.getPartETag());
} }
// 创建CompleteMultipartUploadRequest对象。
// 在执行完成分片上传操作时,需要提供所有有效的partETags。OSS收到提交的partETags后,会逐一验证每个分片的有效性。当所有的数据分片验证通过后,OSS将把这些分片组合成一个完整的文件。
CompleteMultipartUploadRequest completeMultipartUploadRequest =
new CompleteMultipartUploadRequest(bucketName, objectName, uploadId, partETags);
// 如果需要在完成文件上传的同时设置文件访问权限,请参考以下示例代码。
// completeMultipartUploadRequest.setObjectACL(CannedAccessControlList.PublicRead);
// 完成上传。
CompleteMultipartUploadResult completeMultipartUploadResult =
ossClient.completeMultipartUpload(completeMultipartUploadRequest);
System.out.println(completeMultipartUploadResult.getETag());
// 关闭OSSClient。
ossClient.shutdown();
return ResultBody.success();
}
} }
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; ...@@ -4,10 +4,16 @@ import com.alibaba.fastjson2.JSONObject;
import com.aliyun.oss.ClientBuilderConfiguration; import com.aliyun.oss.ClientBuilderConfiguration;
import com.aliyun.oss.OSS; import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder; 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.ResultBody;
import com.mmc.pms.common.ResultEnum; import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.util.FileLoadUtil; import com.mmc.pms.util.FileLoadUtil;
import com.mmc.pms.util.OssConstant; import com.mmc.pms.util.OssConstant;
import com.mmc.pms.util.XmlUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
...@@ -20,6 +26,7 @@ import javax.servlet.ServletOutputStream; ...@@ -20,6 +26,7 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -30,527 +37,604 @@ import java.util.*; ...@@ -30,527 +37,604 @@ import java.util.*;
@RestController @RestController
@RequestMapping("/upload") @RequestMapping("/upload")
public class UploadController { public class UploadController {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd/"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd/");
@ApiOperation(value = "V1.0.1-上传一个图片或者文件到阿里云oss") @ApiOperation(value = "V1.0.1-上传一个图片或者文件到阿里云oss")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam( @ApiImplicitParam(
paramType = "header", paramType = "header",
name = "mmc-identity", name = "mmc-identity",
dataTypeClass = java.lang.String.class, dataTypeClass = java.lang.String.class,
dataType = "String", dataType = "String",
required = false, required = false,
value = "token"), value = "token"),
@ApiImplicitParam( @ApiImplicitParam(
name = "uploadFile", name = "uploadFile",
dataType = "MultipartFile", dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class, dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true, required = true,
value = "文件/图片/后缀无限制"), value = "文件/图片/后缀无限制"),
}) })
@PostMapping("/oss") @PostMapping("/oss")
public ResultBody oss( public ResultBody oss(
@RequestParam("uploadFile") MultipartFile uploadFile, HttpServletRequest request) { @RequestParam("uploadFile") MultipartFile uploadFile, HttpServletRequest request) {
OSS ossClient = OSS ossClient =
new OSSClientBuilder() new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET); .build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
InputStream inputStream = null;
try {
inputStream = uploadFile.getInputStream();
} catch (IOException e) {
return ResultBody.error(e.getMessage());
}
String oldName = uploadFile.getOriginalFilename();
String newName =
"file/"
+ UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, inputStream);
ossClient.shutdown();
String filePath = "https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName;
JSONObject jsObj = new JSONObject();
jsObj.put("filePath", filePath);
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(
paramType = "header",
name = "mmc-identity",
dataTypeClass = java.lang.String.class,
dataType = "String",
required = false,
value = "token"),
@ApiImplicitParam(
name = "uploadFile",
dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true,
value = "文件/图片"),
})
@PostMapping("/osses")
public ResultBody osses(
@RequestParam("uploadFile") MultipartFile[] uploadFile, HttpServletRequest request)
throws IOException {
OSS ossClient =
new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
List list = new LinkedList();
if (uploadFile != null && uploadFile.length > 0) {
System.out.println("osses文件数量" + uploadFile.length);
for (int i = 0; i < uploadFile.length; i++) {
MultipartFile file = uploadFile[i];
InputStream inputStream = null; InputStream inputStream = null;
try { try {
inputStream = uploadFile.getInputStream(); inputStream = file.getInputStream();
} catch (IOException e) { } catch (IOException e) {
return ResultBody.error(e.getMessage()); return ResultBody.error(e.getMessage());
} }
String oldName = uploadFile.getOriginalFilename(); String oldName = file.getOriginalFilename();
String newName = String newName =
"file/" "file/"
+ UUID.randomUUID().toString() + UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length()); + oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, inputStream); ossClient.putObject(OssConstant.BUCKET, newName, inputStream);
ossClient.shutdown(); // ossClient.shutdown();
String filePath = "https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName; // String filePath = "https://" + OssConstant.BUCKET + '.' +
JSONObject jsObj = new JSONObject(); // OssConstant.ENDPOINT + "/" +
jsObj.put("filePath", filePath); // newName;
return ResultBody.success(jsObj); list.add("https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName);
}
} }
ossClient.shutdown(); // 关流
return ResultBody.success(list);
}
@ApiOperation(value = "V1.0.1-上传多个文件到阿里云oss") @ApiOperation(value = "V1.0.1-上传多个视频文件到阿里云oss")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam( @ApiImplicitParam(
paramType = "header", paramType = "header",
name = "mmc-identity", name = "mmc-identity",
dataTypeClass = java.lang.String.class, dataTypeClass = java.lang.String.class,
dataType = "String", dataType = "String",
required = false, required = false,
value = "token"), value = "token"),
@ApiImplicitParam( @ApiImplicitParam(
name = "uploadFile", name = "uploadFile",
dataType = "MultipartFile", dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class, dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true, required = true,
value = "文件/图片"), value = "视频不能超过1MB/mkv/avi/mov/mp4"),
}) })
@PostMapping("/osses") @PostMapping("/videoOss")
public ResultBody osses( public ResultBody videoOss(
@RequestParam("uploadFile") MultipartFile[] uploadFile, HttpServletRequest request) @RequestParam("uploadFile") MultipartFile[] uploadFile, HttpServletRequest request)
throws IOException { throws IOException {
OSS ossClient = ClientBuilderConfiguration clientBuilderConfiguration = new ClientBuilderConfiguration();
new OSSClientBuilder() clientBuilderConfiguration.setRequestTimeoutEnabled(true);
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET); clientBuilderConfiguration.setConnectionRequestTimeout(600000 * 20);
List list = new LinkedList(); clientBuilderConfiguration.setConnectionTimeout(600000 * 20);
if (uploadFile != null && uploadFile.length > 0) {
System.out.println("osses文件数量" + uploadFile.length);
for (int i = 0; i < uploadFile.length; i++) {
MultipartFile file = uploadFile[i];
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
} catch (IOException e) {
return ResultBody.error(e.getMessage());
}
String oldName = file.getOriginalFilename();
String newName = OSS ossClient =
"file/" new OSSClientBuilder()
+ UUID.randomUUID().toString() .build(
+ oldName.substring(oldName.lastIndexOf("."), oldName.length()); OssConstant.ENDPOINT,
ossClient.putObject(OssConstant.BUCKET, newName, inputStream); OssConstant.ACCESSKEYID,
// ossClient.shutdown(); OssConstant.ACCESSKEYSECRET,
// String filePath = "https://" + OssConstant.BUCKET + '.' + clientBuilderConfiguration);
// OssConstant.ENDPOINT + "/" + List list = new LinkedList();
// newName; if (uploadFile != null && uploadFile.length > 0) {
list.add("https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName); System.out.println("osses文件数量" + uploadFile.length);
} for (int i = 0; i < uploadFile.length; i++) {
MultipartFile file = uploadFile[i];
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
} catch (IOException e) {
return ResultBody.error(e.getMessage());
} }
ossClient.shutdown(); // 关流 try (final BufferedInputStream bis = new BufferedInputStream(inputStream)) {
return ResultBody.success(list); // 校验
} int typeNum = FileLoadUtil.checkFileType(FileLoadUtil.getType(bis));
if (typeNum != 3) {
@ApiOperation(value = "V1.0.1-上传多个视频文件到阿里云oss") return ResultBody.error(ResultEnum.UPLOAD_VIDEO_ERROR);
@ApiImplicitParams({ }
@ApiImplicitParam( String oldName = file.getOriginalFilename();
paramType = "header", String newName =
name = "mmc-identity", "file/"
dataTypeClass = java.lang.String.class, + UUID.randomUUID().toString()
dataType = "String", + oldName.substring(oldName.lastIndexOf("."), oldName.length());
required = false, ossClient.putObject(OssConstant.BUCKET, newName, bis);
value = "token"), System.out.println("视频名称:" + newName);
@ApiImplicitParam( list.add("https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName);
name = "uploadFile",
dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true,
value = "视频不能超过1MB/mkv/avi/mov/mp4"),
})
@PostMapping("/videoOss")
public ResultBody videoOss(
@RequestParam("uploadFile") MultipartFile[] uploadFile, HttpServletRequest request)
throws IOException {
ClientBuilderConfiguration clientBuilderConfiguration = new ClientBuilderConfiguration();
clientBuilderConfiguration.setRequestTimeoutEnabled(true);
clientBuilderConfiguration.setConnectionRequestTimeout(600000 * 20);
clientBuilderConfiguration.setConnectionTimeout(600000 * 20);
OSS ossClient =
new OSSClientBuilder()
.build(
OssConstant.ENDPOINT,
OssConstant.ACCESSKEYID,
OssConstant.ACCESSKEYSECRET,
clientBuilderConfiguration);
List list = new LinkedList();
if (uploadFile != null && uploadFile.length > 0) {
System.out.println("osses文件数量" + uploadFile.length);
for (int i = 0; i < uploadFile.length; i++) {
MultipartFile file = uploadFile[i];
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
} catch (IOException e) {
return ResultBody.error(e.getMessage());
}
try (final BufferedInputStream bis = new BufferedInputStream(inputStream)) {
// 校验
int typeNum = FileLoadUtil.checkFileType(FileLoadUtil.getType(bis));
if (typeNum != 3) {
return ResultBody.error(ResultEnum.UPLOAD_VIDEO_ERROR);
}
String oldName = file.getOriginalFilename();
String newName =
"file/"
+ UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, bis);
System.out.println("视频名称:" + newName);
list.add("https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName);
}
}
} }
ossClient.shutdown(); // 关流 }
return ResultBody.success(list);
} }
ossClient.shutdown(); // 关流
return ResultBody.success(list);
}
@ApiOperation(value = "V1.0.1-上传一个视频文件到阿里云oss") @ApiOperation(value = "V1.0.1-上传一个视频文件到阿里云oss")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam( @ApiImplicitParam(
paramType = "header", paramType = "header",
name = "mmc-identity", name = "mmc-identity",
dataTypeClass = java.lang.String.class, dataTypeClass = java.lang.String.class,
dataType = "String", dataType = "String",
required = false, required = false,
value = "token"), value = "token"),
@ApiImplicitParam( @ApiImplicitParam(
name = "uploadFile", name = "uploadFile",
dataType = "MultipartFile", dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class, dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true, required = true,
value = "视频不能超过1MB/mkv/avi/mov/mp4"), value = "视频不能超过1MB/mkv/avi/mov/mp4"),
}) })
@PostMapping("/videoOsses") @PostMapping("/videoOsses")
public ResultBody videoOsses( public ResultBody videoOsses(
@RequestParam("uploadFile") MultipartFile[] uploadFile, HttpServletRequest request) @RequestParam("uploadFile") MultipartFile[] uploadFile, HttpServletRequest request)
throws IOException { throws IOException {
ClientBuilderConfiguration clientBuilderConfiguration = new ClientBuilderConfiguration(); ClientBuilderConfiguration clientBuilderConfiguration = new ClientBuilderConfiguration();
clientBuilderConfiguration.setRequestTimeoutEnabled(true); clientBuilderConfiguration.setRequestTimeoutEnabled(true);
clientBuilderConfiguration.setConnectionRequestTimeout(600000 * 20); clientBuilderConfiguration.setConnectionRequestTimeout(600000 * 20);
clientBuilderConfiguration.setConnectionTimeout(600000 * 20); clientBuilderConfiguration.setConnectionTimeout(600000 * 20);
OSS ossClient = OSS ossClient =
new OSSClientBuilder() new OSSClientBuilder()
.build( .build(
OssConstant.ENDPOINT, OssConstant.ENDPOINT,
OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYID,
OssConstant.ACCESSKEYSECRET, OssConstant.ACCESSKEYSECRET,
clientBuilderConfiguration); clientBuilderConfiguration);
Map map = new HashMap(); Map map = new HashMap();
if (uploadFile != null && uploadFile.length > 0) { if (uploadFile != null && uploadFile.length > 0) {
System.out.println("osses文件数量" + uploadFile.length); System.out.println("osses文件数量" + uploadFile.length);
for (int i = 0; i < uploadFile.length; i++) { for (int i = 0; i < uploadFile.length; i++) {
MultipartFile file = uploadFile[i]; MultipartFile file = uploadFile[i];
InputStream inputStream = null; InputStream inputStream = null;
try { try {
inputStream = file.getInputStream(); inputStream = file.getInputStream();
} catch (IOException e) { } catch (IOException e) {
return ResultBody.error(e.getMessage()); return ResultBody.error(e.getMessage());
}
try (final BufferedInputStream bis = new BufferedInputStream(inputStream)) {
// 校验
int typeNum = FileLoadUtil.checkFileType(FileLoadUtil.getType(bis));
if (typeNum != 3) {
return ResultBody.error(ResultEnum.UPLOAD_VIDEO_ERROR);
}
String oldName = file.getOriginalFilename();
String newName =
"file/"
+ UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, bis);
System.out.println("视频名称:" + newName);
map.put(
"filePath",
"https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName);
map.put("fileName", oldName);
map.put("fileSize", file.getSize());
map.put("fileType", oldName.substring(oldName.lastIndexOf(".")).replace(".", ""));
}
}
} }
ossClient.shutdown(); // 关流 try (final BufferedInputStream bis = new BufferedInputStream(inputStream)) {
return ResultBody.success(map); // 校验
int typeNum = FileLoadUtil.checkFileType(FileLoadUtil.getType(bis));
if (typeNum != 3) {
return ResultBody.error(ResultEnum.UPLOAD_VIDEO_ERROR);
}
String oldName = file.getOriginalFilename();
String newName =
"file/"
+ UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, bis);
System.out.println("视频名称:" + newName);
map.put(
"filePath",
"https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName);
map.put("fileName", oldName);
map.put("fileSize", file.getSize());
map.put("fileType", oldName.substring(oldName.lastIndexOf(".")).replace(".", ""));
}
}
} }
ossClient.shutdown(); // 关流
return ResultBody.success(map);
}
@ApiOperation(value = "V1.0.1-上传多张图片文件到阿里云oss") @ApiOperation(value = "V1.0.1-上传多张图片文件到阿里云oss")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam( @ApiImplicitParam(
paramType = "header", paramType = "header",
name = "mmc-identity", name = "mmc-identity",
dataTypeClass = java.lang.String.class, dataTypeClass = java.lang.String.class,
dataType = "String", dataType = "String",
required = false, required = false,
value = "token"), value = "token"),
@ApiImplicitParam( @ApiImplicitParam(
name = "uploadFile", name = "uploadFile",
dataType = "MultipartFile", dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class, dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true, required = true,
value = "图片"), value = "图片"),
}) })
@PostMapping("/imgOss") @PostMapping("/imgOss")
public ResultBody imgOss( public ResultBody imgOss(
@RequestParam("uploadFile") MultipartFile[] uploadFile, HttpServletRequest request) @RequestParam("uploadFile") MultipartFile[] uploadFile, HttpServletRequest request)
throws IOException { throws IOException {
OSS ossClient = OSS ossClient =
new OSSClientBuilder() new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET); .build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
List list = new LinkedList(); List list = new LinkedList();
if (uploadFile != null && uploadFile.length > 0) { if (uploadFile != null && uploadFile.length > 0) {
System.out.println("osses文件数量" + uploadFile.length); System.out.println("osses文件数量" + uploadFile.length);
for (int i = 0; i < uploadFile.length; i++) { for (int i = 0; i < uploadFile.length; i++) {
MultipartFile file = uploadFile[i]; MultipartFile file = uploadFile[i];
InputStream inputStream = null; InputStream inputStream = null;
try { try {
inputStream = file.getInputStream(); inputStream = file.getInputStream();
} catch (IOException e) { } catch (IOException e) {
return ResultBody.error(e.getMessage()); return ResultBody.error(e.getMessage());
} }
try (final BufferedInputStream bis = new BufferedInputStream(inputStream)) { try (final BufferedInputStream bis = new BufferedInputStream(inputStream)) {
// 校验 // 校验
int typeNum = FileLoadUtil.checkFileType(FileLoadUtil.getType(bis)); int typeNum = FileLoadUtil.checkFileType(FileLoadUtil.getType(bis));
if (typeNum != 1) { if (typeNum != 1) {
return ResultBody.error(ResultEnum.UPLOAD_IMG_ERROR); return ResultBody.error(ResultEnum.UPLOAD_IMG_ERROR);
} }
String oldName = file.getOriginalFilename(); String oldName = file.getOriginalFilename();
String newName = String newName =
"file/" "file/"
+ UUID.randomUUID().toString() + UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length()); + oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, bis); ossClient.putObject(OssConstant.BUCKET, newName, bis);
System.out.println("图片名称:" + newName); System.out.println("图片名称:" + newName);
list.add("https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName); list.add("https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName);
}
}
} }
ossClient.shutdown(); // 关流 }
return ResultBody.success(list);
} }
ossClient.shutdown(); // 关流
return ResultBody.success(list);
}
@ApiOperation(value = "V1.0.1-上传一张图片文件到阿里云oss ") @ApiOperation(value = "V1.0.1-上传一张图片文件到阿里云oss ")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam( @ApiImplicitParam(
paramType = "header", paramType = "header",
name = "mmc-identity", name = "mmc-identity",
dataTypeClass = java.lang.String.class, dataTypeClass = java.lang.String.class,
dataType = "String", dataType = "String",
required = false, required = false,
value = "token"), value = "token"),
@ApiImplicitParam( @ApiImplicitParam(
name = "uploadFile", name = "uploadFile",
dataType = "MultipartFile", dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class, dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true, required = true,
value = "文件"), value = "文件"),
}) })
@PostMapping("/singleImgOss") @PostMapping("/singleImgOss")
public ResultBody singleImgOss( public ResultBody singleImgOss(
@RequestParam("uploadFile") MultipartFile uploadFile, HttpServletRequest request) @RequestParam("uploadFile") MultipartFile uploadFile, HttpServletRequest request)
throws IOException { throws IOException {
OSS ossClient = OSS ossClient =
new OSSClientBuilder() new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET); .build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
List list = new LinkedList(); List list = new LinkedList();
if (uploadFile != null) { if (uploadFile != null) {
if (uploadFile.getSize() / 1024 > 3096) { if (uploadFile.getSize() / 1024 > 3096) {
return ResultBody.error("请上传小于3M的图片"); return ResultBody.error("请上传小于3M的图片");
} }
InputStream inputStream = null; InputStream inputStream = null;
try { try {
inputStream = uploadFile.getInputStream(); inputStream = uploadFile.getInputStream();
} catch (IOException e) { } catch (IOException e) {
return ResultBody.error(e.getMessage()); return ResultBody.error(e.getMessage());
} }
try (final BufferedInputStream bis = new BufferedInputStream(inputStream)) { try (final BufferedInputStream bis = new BufferedInputStream(inputStream)) {
// 校验 // 校验
int typeNum = FileLoadUtil.checkFileType(FileLoadUtil.getType(bis)); int typeNum = FileLoadUtil.checkFileType(FileLoadUtil.getType(bis));
if (typeNum != 1) { if (typeNum != 1) {
return ResultBody.error(ResultEnum.UPLOAD_IMG_ERROR); return ResultBody.error(ResultEnum.UPLOAD_IMG_ERROR);
}
String oldName = uploadFile.getOriginalFilename();
String newName =
"file/"
+ UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, bis);
System.out.println("图片名称:" + newName);
list.add("https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName);
}
} }
ossClient.shutdown(); // 关流 String oldName = uploadFile.getOriginalFilename();
return ResultBody.success(list); String newName =
"file/"
+ UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, bis);
System.out.println("图片名称:" + newName);
list.add("https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName);
}
} }
ossClient.shutdown(); // 关流
return ResultBody.success(list);
}
@ApiOperation(value = "V1.0.1-上传一张图片文件到阿里云oss ") @ApiOperation(value = "V1.0.1-上传一张图片文件到阿里云oss ")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam( @ApiImplicitParam(
paramType = "header", paramType = "header",
name = "mmc-identity", name = "mmc-identity",
dataTypeClass = java.lang.String.class, dataTypeClass = java.lang.String.class,
dataType = "String", dataType = "String",
required = false, required = false,
value = "token"), value = "token"),
@ApiImplicitParam( @ApiImplicitParam(
name = "uploadFile", name = "uploadFile",
dataType = "MultipartFile", dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class, dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true, required = true,
value = "图片/返回图片名称及图片大小"), value = "图片/返回图片名称及图片大小"),
}) })
@PostMapping("/imgOsses") @PostMapping("/imgOsses")
public ResultBody imgOsses( public ResultBody imgOsses(
@RequestParam("uploadFile") MultipartFile[] uploadFile, HttpServletRequest request) @RequestParam("uploadFile") MultipartFile[] uploadFile, HttpServletRequest request)
throws IOException { throws IOException {
OSS ossClient = OSS ossClient =
new OSSClientBuilder() new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET); .build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
Map map = new HashMap(); Map map = new HashMap();
if (uploadFile != null && uploadFile.length > 0) { if (uploadFile != null && uploadFile.length > 0) {
System.out.println("osses文件数量" + uploadFile.length); System.out.println("osses文件数量" + uploadFile.length);
for (int i = 0; i < uploadFile.length; i++) { for (int i = 0; i < uploadFile.length; i++) {
MultipartFile file = uploadFile[i]; MultipartFile file = uploadFile[i];
InputStream inputStream = null; InputStream inputStream = null;
try { try {
inputStream = file.getInputStream(); inputStream = file.getInputStream();
} catch (IOException e) { } catch (IOException e) {
return ResultBody.error(e.getMessage()); return ResultBody.error(e.getMessage());
} }
try (final BufferedInputStream bis = new BufferedInputStream(inputStream)) { try (final BufferedInputStream bis = new BufferedInputStream(inputStream)) {
// 校验 // 校验
int typeNum = FileLoadUtil.checkFileType(FileLoadUtil.getType(bis)); int typeNum = FileLoadUtil.checkFileType(FileLoadUtil.getType(bis));
if (typeNum != 1) { if (typeNum != 1) {
return ResultBody.error(ResultEnum.UPLOAD_IMG_ERROR); return ResultBody.error(ResultEnum.UPLOAD_IMG_ERROR);
} }
String oldName = file.getOriginalFilename(); String oldName = file.getOriginalFilename();
String newName = String newName =
"file/" "file/"
+ UUID.randomUUID().toString() + UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length()); + oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, bis); ossClient.putObject(OssConstant.BUCKET, newName, bis);
System.out.println("图片名称:" + newName); System.out.println("图片名称:" + newName);
map.put( map.put(
"filePath", "filePath",
"https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName); "https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName);
map.put("fileName", oldName); map.put("fileName", oldName);
map.put("fileSize", file.getSize()); map.put("fileSize", file.getSize());
map.put("fileType", oldName.substring(oldName.lastIndexOf(".")).replace(".", "")); map.put("fileType", oldName.substring(oldName.lastIndexOf(".")).replace(".", ""));
}
}
} }
ossClient.shutdown(); // 关流 }
return ResultBody.success(map);
} }
ossClient.shutdown(); // 关流
return ResultBody.success(map);
}
private byte[] readByte(final InputStream is) throws IOException { private byte[] readByte(final InputStream is) throws IOException {
try (BufferedInputStream bis = new BufferedInputStream(is); try (BufferedInputStream bis = new BufferedInputStream(is);
ByteArrayOutputStream bas = new ByteArrayOutputStream(4096); ByteArrayOutputStream bas = new ByteArrayOutputStream(4096);
BufferedOutputStream bos = new BufferedOutputStream(bas)) { BufferedOutputStream bos = new BufferedOutputStream(bas)) {
byte[] bytes = new byte[4096]; byte[] bytes = new byte[4096];
int size; int size;
while ((size = bis.read(bytes)) != -1) { while ((size = bis.read(bytes)) != -1) {
bos.write(bytes, 0, size); bos.write(bytes, 0, size);
} }
return bas.toByteArray(); return bas.toByteArray();
}
} }
}
@ApiOperation(value = "V1.0.1-上传文档文件到阿里云oss") @ApiOperation(value = "V1.0.1-上传文档文件到阿里云oss")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam( @ApiImplicitParam(
paramType = "header", paramType = "header",
name = "mmc-identity", name = "mmc-identity",
dataTypeClass = java.lang.String.class, dataTypeClass = java.lang.String.class,
dataType = "String", dataType = "String",
required = true, required = true,
value = "token"), value = "token"),
@ApiImplicitParam( @ApiImplicitParam(
name = "uploadFile", name = "uploadFile",
dataType = "MultipartFile", dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class, dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true, required = true,
value = "文件 doc,ppt,pdf,xls结尾"), value = "文件 doc,ppt,pdf,xls结尾"),
}) })
@PostMapping("/docOss") @PostMapping("/docOss")
public ResultBody docOss( public ResultBody docOss(
@RequestParam("uploadFile") MultipartFile[] uploadFile, HttpServletRequest request) @RequestParam("uploadFile") MultipartFile[] uploadFile, HttpServletRequest request)
throws IOException { throws IOException {
OSS ossClient = OSS ossClient =
new OSSClientBuilder() new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET); .build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
Map map = new HashMap(); Map map = new HashMap();
if (uploadFile != null && uploadFile.length > 0) { if (uploadFile != null && uploadFile.length > 0) {
System.out.println("osses文件数量" + uploadFile.length); System.out.println("osses文件数量" + uploadFile.length);
for (int i = 0; i < uploadFile.length; i++) { for (int i = 0; i < uploadFile.length; i++) {
MultipartFile file = uploadFile[i]; MultipartFile file = uploadFile[i];
InputStream inputStream = null; InputStream inputStream = null;
try { try {
inputStream = file.getInputStream(); inputStream = file.getInputStream();
} catch (IOException e) { } catch (IOException e) {
return ResultBody.error(e.getMessage()); return ResultBody.error(e.getMessage());
} }
try (final BufferedInputStream bis = new BufferedInputStream(inputStream)) { try (final BufferedInputStream bis = new BufferedInputStream(inputStream)) {
// 校验 // 校验
int typeNum = FileLoadUtil.checkFileType(FileLoadUtil.getType(bis)); int typeNum = FileLoadUtil.checkFileType(FileLoadUtil.getType(bis));
if (typeNum != 2) { if (typeNum != 2) {
return ResultBody.error(ResultEnum.UPLOAD_DOC_ERROR); return ResultBody.error(ResultEnum.UPLOAD_DOC_ERROR);
} }
String oldName = file.getOriginalFilename(); String oldName = file.getOriginalFilename();
String newName = String newName =
"file/" "file/"
+ UUID.randomUUID().toString() + UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length()); + oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, bis); ossClient.putObject(OssConstant.BUCKET, newName, bis);
System.out.println("文档名称:" + newName); System.out.println("文档名称:" + newName);
map.put( map.put(
"filePath", "filePath",
"https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName); "https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName);
map.put("fileName", oldName); map.put("fileName", oldName);
map.put("fileSize", file.getSize()); map.put("fileSize", file.getSize());
map.put("fileType", oldName.substring(oldName.lastIndexOf(".")).replace(".", "")); map.put("fileType", oldName.substring(oldName.lastIndexOf(".")).replace(".", ""));
}
}
} }
ossClient.shutdown(); // 关流 }
return ResultBody.success(map);
} }
ossClient.shutdown(); // 关流
return ResultBody.success(map);
}
/** /**
* 上传文件 * 上传文件
* *
* @param uploadFile * @param uploadFile
* @return * @return
*/ */
@ApiIgnore @ApiIgnore
@RequestMapping(value = "/local", method = RequestMethod.POST) @RequestMapping(value = "/local", method = RequestMethod.POST)
public ResultBody local( public ResultBody local(
@RequestParam(value = "uploadFile", required = false) MultipartFile[] uploadFile, @RequestParam(value = "uploadFile", required = false) MultipartFile[] uploadFile,
@RequestParam(value = "directory", required = false, defaultValue = "upload") @RequestParam(value = "directory", required = false, defaultValue = "upload")
String directory, String directory,
HttpServletRequest request) HttpServletRequest request)
throws IOException { throws IOException {
return FileLoadUtil.bathCreateFile(directory, uploadFile); return FileLoadUtil.bathCreateFile(directory, uploadFile);
} }
/** /**
* 下载文件 * 下载文件
* *
* @param path * @param path
* @param response * @param response
* @throws IOException * @throws IOException
*/ */
@ApiIgnore @ApiIgnore
@RequestMapping(value = "/download/{path}", method = RequestMethod.GET) @RequestMapping(value = "/download/{path}", method = RequestMethod.GET)
public void getDownloadFile(@PathVariable("path") String path, HttpServletResponse response) public void getDownloadFile(@PathVariable("path") String path, HttpServletResponse response)
throws IOException { throws IOException {
response.setContentType("application/x-001"); response.setContentType("application/x-001");
path = FileLoadUtil.explainLoadPath(path); path = FileLoadUtil.explainLoadPath(path);
ServletOutputStream out = response.getOutputStream(); ServletOutputStream out = response.getOutputStream();
FileInputStream in = new FileInputStream(new File(path)); FileInputStream in = new FileInputStream(new File(path));
byte buffer[] = new byte[1024]; byte buffer[] = new byte[1024];
int length = 0; int length = 0;
while ((length = in.read(buffer)) != -1) { while ((length = in.read(buffer)) != -1) {
out.write(buffer, 0, length); out.write(buffer, 0, length);
}
in.close();
out.close();
} }
in.close();
out.close();
}
@ApiIgnore @ApiIgnore
@RequestMapping(value = "/heart", method = RequestMethod.GET) @RequestMapping(value = "/heart", method = RequestMethod.GET)
public ResultBody heart() { public ResultBody heart() {
return ResultBody.success("heart"); return ResultBody.success("heart");
} }
} }
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; package com.mmc.pms.controller;
import com.mmc.pms.common.ResultBody; 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.AdDTO;
import com.mmc.pms.model.other.dto.DistrictInfoDTO; 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 com.mmc.pms.service.WebDeviceService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.*; 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 * @Author small @Date 2023/5/15 13:25 @Version 1.0
...@@ -29,75 +21,18 @@ import org.springframework.web.bind.annotation.*; ...@@ -29,75 +21,18 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping("/webDevice") @RequestMapping("/webDevice")
public class WebDeviceController { public class WebDeviceController {
@Autowired @Autowired private WebDeviceService webDeviceService;
private WebDeviceService webDeviceService;
@ApiOperation(value = "地域") @ApiOperation(value = "地域")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("/getSecondDistrictInfo") @GetMapping("/getSecondDistrictInfo")
public ResultBody<DistrictInfoDTO> getSecondDistrictInfo() { public ResultBody<DistrictInfoDTO> getSecondDistrictInfo() {
return webDeviceService.listSecondDistrict(); 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);
}
@ApiOperation("设备广告位")
@GetMapping("/ad")
public ResultBody<AdDTO> ad() {
return webDeviceService.ad();
}
} }
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; package com.mmc.pms.dao;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.entity.ServiceDO; import com.mmc.pms.entity.ServiceDO;
import com.mmc.pms.model.qo.ServiceQO; 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.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
/** /**
* @Author LW * @Author LW
* @date 2023/6/6 10:48 *
* 概要: * @date 2023/6/6 10:48 概要:
*/ */
@Mapper @Mapper
public interface BackstageTaskServiceDao { public interface BackstageTaskServiceDao {
Integer insert(ServiceDO serviceDO); Integer insert(ServiceDO serviceDO);
Integer update(ServiceDO serviceDO); Integer update(ServiceDO serviceDO);
Integer deleteById(Integer id); Integer deleteByIds(@Param("ids") List<Integer> ids);
ServiceDO queryById(Integer id); ServiceDO queryById(Integer id);
List<ServiceDO> queryAllByLimit(ServiceQO param); List<ServiceDO> queryAllByLimit(ServiceQO param);
Integer count(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,53 +14,54 @@ import java.util.Set; ...@@ -14,53 +14,54 @@ import java.util.Set;
/** /**
* @author 23214 * @author 23214
* @description 针对表【categories(通用分类表)】的数据库操作Mapper * @description 针对表【categories(通用分类表)】的数据库操作Mapper
* @createDate 2023-05-24 10:29:28 * @createDate 2023-05-24 10:29:28 @Entity com.mmc.pms.entity.Categories
* @Entity com.mmc.pms.entity.Categories
*/ */
@Mapper @Mapper
public interface CategoriesDao { public interface CategoriesDao {
int countUpdateDirectoryName(DirectoryInfoVO param); int countUpdateDirectoryName(DirectoryInfoVO param);
void insertDirectory(DirectoryDO directory); void insertDirectory(DirectoryDO directory);
void updateDirectory(DirectoryDO directory); void updateDirectory(DirectoryDO directory);
int countDirectoryList(); int countDirectoryList();
List<DirectoryDO> directoryList(int pageNo, Integer pageSize, Integer type); List<DirectoryDO> directoryList(int pageNo, Integer pageSize, Integer type);
int countDirectory(Integer id); int countDirectory(Integer id);
void removeDirectory(Integer id); void removeDirectory(Integer id);
int countClassificationByName(ClassifyInfoVO classifyInfoVO); int countClassificationByName(ClassifyInfoVO classifyInfoVO);
int getCountCategoriesByPid(Integer pid, Integer type); int getCountCategoriesByPid(Integer pid, Integer type);
void insertClassification(Categories categories); void insertClassification(Categories categories);
void updateClassification(ClassifyInfoVO classifyInfoVO); void updateClassification(ClassifyInfoVO classifyInfoVO);
Categories getGoodsGroupById(Integer id); Categories getGoodsGroupById(Integer id);
int updateTypeSort(Integer id, Integer sort); int updateTypeSort(Integer id, Integer sort);
List<Categories> selectAllClassification(QueryClassifyVO queryClassifyVO); List<Categories> selectAllClassification(QueryClassifyVO queryClassifyVO);
int countListClassification(QueryClassifyVO queryClassifyVO); int countListClassification(QueryClassifyVO queryClassifyVO);
int selectDirectoryById(Integer id); DirectoryDO selectDirectoryById(Integer id);
int deleteById(Integer id); int deleteById(Integer id);
List<DirectoryDO> getDirectoryList(Integer type); List<DirectoryDO> getDirectoryList(Integer type);
List<Categories> getCategoriesByDirectoryId(Integer directoryId); List<Categories> getCategoriesByDirectoryId(Integer directoryId);
List<Categories> getCategoriesListByIds(@Param("ids") Set<Integer> ids);
}
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; package com.mmc.pms.dao;
import com.mmc.pms.entity.*; 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.GoodsAddVO;
import com.mmc.pms.model.sale.vo.SpecPriceVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -11,89 +13,105 @@ import java.util.Set; ...@@ -11,89 +13,105 @@ import java.util.Set;
/** /**
* @author 23214 * @author 23214
* @description 针对表【goods_info(商品基本信息)】的数据库操作Mapper * @description 针对表【goods_info(商品基本信息)】的数据库操作Mapper
* @createDate 2023-05-27 14:08:45 * @createDate 2023-05-27 14:08:45 @Entity com.mmc.pms.entity.GoodsInfo
* @Entity com.mmc.pms.entity.GoodsInfo
*/ */
@Mapper @Mapper
public interface GoodsInfoDao { public interface GoodsInfoDao {
int countGoodsInfoByName(GoodsAddVO goodsAddVO); int countGoodsInfoByName(GoodsAddVO goodsAddVO);
void insertGoodsInfo(GoodsInfo goodsInfo); void insertGoodsInfo(GoodsInfo goodsInfo);
int countGoodsInfo(); int countGoodsInfo();
void insertGoodsImgInfo(List<GoodsImgDO> list); void insertGoodsImgInfo(List<GoodsImgDO> list);
void insertVideoInfo(GoodsVideoDO goodsVideoDO); void insertVideoInfo(GoodsVideoDO goodsVideoDO);
void insertGoodsDetail(GoodsDetailDO goodsDetailDO); void insertGoodsDetail(GoodsDetailDO goodsDetailDO);
void insertGoodsService(List<GoodsServiceDO> otherList); void insertGoodsService(List<GoodsServiceDO> otherList);
int countGoodsInfoById(Integer id); int countGoodsInfoById(Integer id);
void updateGoodsInfo(GoodsInfo goodsInfo); void updateGoodsInfo(GoodsInfo goodsInfo);
void updateGoodsDetail(GoodsDetailDO goodsDetailDO); void updateGoodsDetail(GoodsDetailDO goodsDetailDO);
List<GoodsImgDO> listGoodsInfoByGoodsId(Integer id); List<GoodsImgDO> listGoodsInfoByGoodsId(Integer id);
void deleteImgByIds(List<Integer> deleteIds); void deleteImgByIds(List<Integer> deleteIds);
void deleteGoodsVideoById(Integer id); void deleteGoodsVideoById(Integer id);
void deleteGoodsServiceByGoodsId(Integer id); void deleteGoodsServiceByGoodsId(Integer id);
void insertMallIndustrySkuInfo(MallIndustrySkuInfoDO mallIndustrySkuInfoDO); void insertMallIndustrySkuInfo(MallIndustrySkuInfoDO mallIndustrySkuInfoDO);
void insertMallIndustrySkuInfoSpec(MallIndustrySkuInfoSpecDO mallIndustrySkuInfoSpecDO); void insertMallIndustrySkuInfoSpec(MallIndustrySkuInfoSpecDO mallIndustrySkuInfoSpecDO);
List<MallProdInfoDO> getMallProSkuInfo(Integer id); List<MallProdInfoDO> getMallProSkuInfo(Integer id);
void batchUpdateMallProductSku(List<Integer> delIds); void batchUpdateMallProductSku(List<Integer> delIds);
void batchUpdateMallProdSkuInfo(List<MallProdInfoDO> mallProdSkuInfoList); void batchUpdateMallProdSkuInfo(List<MallProdInfoDO> list);
List<MallIndustrySkuInfoDO> getMallIndustrySkuInfo(Integer id); List<MallIndustrySkuInfoDO> getMallIndustrySkuInfo(Integer id);
GoodsInfo getGoodsSimpleInfo(Integer goodsInfoId); GoodsInfo getGoodsSimpleInfo(Integer goodsInfoId);
GoodsDetailDO getGoodsDetailByGoodsId(Integer goodsInfoId); GoodsDetailDO getGoodsDetailByGoodsId(Integer goodsInfoId);
List<GoodsServiceDO> listGoodsServiceByGoodsId(Integer goodsInfoId); List<GoodsServiceDO> listGoodsServiceByGoodsId(Integer goodsInfoId);
List<SkuUnitDO> getSkuUnit(); List<SkuUnitDO> getSkuUnit();
List<GoodsInfo> listSimpleGoodsInfoByIds(@Param("ids") Set<Integer> ids); List<GoodsInfo> listSimpleGoodsInfoByIds(@Param("ids") Set<Integer> ids);
void insertMallProdSkuInfo(MallProdInfoDO mallProdSkuInfoDO); void insertMallProdSkuInfo(MallProdInfoDO mallProdSkuInfoDO);
void insertMallProdSkuInfoSpec(MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO); void insertMallProdSkuInfoSpec(MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO);
void batchUpdateMallProSpec(@Param("list") List<Integer> list, @Param("id") Integer id); void batchUpdateMallProSpec(@Param("list") List<Integer> list, @Param("id") Integer id);
List<MallProdSkuInfoSpecDO> listMallProdSpecInfo(List<Integer> mallSkuIds); List<MallProdSkuInfoSpecDO> listMallProdSpecInfo(List<Integer> mallSkuIds);
void batchUpdateMallProdSpec(List<Integer> delSpecId); void batchUpdateMallProdSpec(List<Integer> delSpecId);
List<MallGoodsSpecInfoDO> listProdSpecInfo(@Param("prodIds") Set<Integer> prodIds); List<MallGoodsSpecInfoDO> listProdSpecInfo(@Param("prodIds") Set<Integer> prodIds);
List<MallGoodsSpecInfoDO> listIndstSpecInfo(@Param("indstIds") Set<Integer> indstIds); List<MallGoodsSpecInfoDO> listIndstSpecInfo(@Param("indstIds") Set<Integer> indstIds);
List<GoodsServiceDO> listGoodsService(List<Integer> goodsIds); 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); List<Integer> listIndustrySpecIds(Set<Integer> mallIndstSkuSpecIds);
List<MallGoodsProductDO> listIndustryProductList(List<Integer> industrySpecIds); List<MallGoodsProductDO> listIndustryProductList(List<Integer> industrySpecIds);
List<GoodsInfo> ListGoodsInfoByCategoryId(Integer id); List<GoodsInfo> ListGoodsInfoByCategoryId(Integer id);
List<MallProdSkuInfoSpecDO> getMallProSkuInfoSpec(Integer goodsInfoId); 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,89 +13,90 @@ import java.util.Set; ...@@ -13,89 +13,90 @@ import java.util.Set;
/** /**
* @Author LW * @Author LW
* @date 2022/10/8 10:58 *
* 概要: * @date 2022/10/8 10:58 概要:
*/ */
@Mapper @Mapper
public interface IndustrySpecDao { public interface IndustrySpecDao {
int countSkuName(IndustrySkuVO param); int countSkuName(IndustrySkuVO param);
int insertIndustrySku(IndustrySku industrySku); int insertIndustrySku(IndustrySku industrySku);
int countIndustrySkuById(Integer id); int countIndustrySkuById(Integer id);
IndustrySku getIndustrySkuById(Integer id); IndustrySku getIndustrySkuById(Integer id);
int updateIndustrySku(IndustrySku industrySku); int updateIndustrySku(IndustrySku industrySku);
int countListPageIndustrySku(IndustrySkuQO param); int countListPageIndustrySku(IndustrySkuQO param);
List<IndustrySku> listPageIndustrySku(IndustrySkuQO param); List<IndustrySku> listPageIndustrySku(IndustrySkuQO param);
int countSpecName(IndustrySpecVO param); int countSpecName(IndustrySpecVO param);
int insertIndustrySpec(IndustrySpecDO industrySpecDO); int insertIndustrySpec(IndustrySpecDO industrySpecDO);
void insertIndustryProductInventory(IndustryProductInventoryDO industryProductInventoryDO); void insertIndustryProductInventory(IndustryProductInventoryDO industryProductInventoryDO);
void insertInventorySpec(InventorySpecDO inventorySpecDO); void insertInventorySpec(InventorySpecDO inventorySpecDO);
int countIndustrySpec(Integer industrySpecId); int countIndustrySpec(Integer industrySpecId);
IndustrySpecDO getIndustrySpecById(Integer industrySpecId); IndustrySpecDO getIndustrySpecById(Integer industrySpecId);
List<IndustryProductInventoryDO> getIndustryProductInventory(Integer industrySpecId); List<IndustryProductInventoryDO> getIndustryProductInventory(Integer industrySpecId);
int updateIndustrySpec(IndustrySpecDO industrySpecDO); int updateIndustrySpec(IndustrySpecDO industrySpecDO);
void batchDeleteInventorySpec(List<Integer> industryProductInventoryIds); void batchDeleteInventorySpec(List<Integer> industryProductInventoryIds);
void deleteIndustryProductInventory(Integer id); void deleteIndustryProductInventory(Integer id);
int countListPageIndustrySpec(Integer id, String keyword); 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); int batchInsertSpecPrice(List<IndustrySpecPriceDO> list);
void removeIndustrySpecCPQ(IndustrySpecCPQVO industrySpecCPQQ); void removeIndustrySpecCPQ(IndustrySpecCPQVO industrySpecCPQQ);
void batchInsertLeaseSpecPrice(List<IndustrySpecPriceDO> list); void batchInsertLeaseSpecPrice(List<IndustrySpecPriceDO> list);
List<IndustrySpecPriceDO> getIndustrySpecCPQ(IndustrySpecCPQVO industrySpecCPQQ); List<IndustrySpecPriceDO> getIndustrySpecCPQ(IndustrySpecCPQVO industrySpecCPQQ);
void batchUpdateMallIndustrySpec(@Param("list") List<Integer> list, @Param("id") Integer id); void batchUpdateMallIndustrySpec(@Param("list") List<Integer> list, @Param("id") Integer id);
void batchUpdateMallIndustrySku(@Param("list") List<Integer> list); void batchUpdateMallIndustrySku(@Param("list") List<Integer> list);
void batchUpdateMallIndustrySkuInfo(List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList); void batchUpdateMallIndustrySkuInfo(List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList);
List<MallIndustrySkuInfoSpecDO> listMallIndustrySpecInfo(List<Integer> mallSkuIds); List<MallIndustrySkuInfoSpecDO> listMallIndustrySpecInfo(List<Integer> mallSkuIds);
void batchUpdateMallIndustSpec(@Param("list") List<Integer> list, @Param("id") Integer id); 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(@Param("industrySpecIds") Set<Integer> industrySpecIds);
List<IndustrySpecDO> listIndustrySpec(Set<Integer> industrySpecIds); int countIndustrySpecBySkuId(Integer id);
int countIndustrySpecBySkuId(Integer id); void removeIndustrySku(Integer id);
void removeIndustrySku(Integer id); List<MallIndustrySkuInfoSpecDO> listMallIndustrySpec(Integer id);
List<MallIndustrySkuInfoSpecDO> listMallIndustrySpec(Integer id); void removeIndustryProductInventory(List<Integer> collect);
void removeIndustryProductInventory(List<Integer> collect); List<InventorySpecDO> listInventorySpec(List<Integer> ids);
List<InventorySpecDO> listInventorySpec(List<Integer> ids); void removeInventorySpec(List<Integer> ids);
void removeInventorySpec(List<Integer> ids); void removeIndustrySpec(Integer id);
void removeIndustrySpec(Integer id); List<MallIndustrySkuInfoSpecDO> getIndustrySkuInfoSpec(Integer goodsInfoId);
List<MallIndustrySkuInfoSpecDO> getIndustrySkuInfoSpec(Integer goodsInfoId); List<IndustrySpecPriceDO> listIndustrySpecPrice(Integer tagInfoId, List<Integer> industrySpecIds);
List<IndustrySpecPriceDO> listIndustrySpecPrice(Integer tagInfoId, List<Integer> industrySpecIds); List<IndustrySpecPriceDO> getIndustrySpecPriceList(List<Integer> specIds);
List<IndustrySpecPriceDO> getIndustrySpecPriceList(List<Integer> specIds);
} }
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,101 +19,103 @@ import java.util.Set; ...@@ -19,101 +19,103 @@ import java.util.Set;
/** /**
* @author 23214 * @author 23214
* @description 针对表【product_sku(产品sku表)】的数据库操作Mapper * @description 针对表【product_sku(产品sku表)】的数据库操作Mapper
* @createDate 2023-05-25 14:55:56 * @createDate 2023-05-25 14:55:56 @Entity com.mmc.pms.entity.ProductSku
* @Entity com.mmc.pms.entity.ProductSku
*/ */
@Mapper @Mapper
public interface ProductDao { public interface ProductDao {
int countSkuName(ProductSkuVO param); int countSkuName(ProductSkuVO param);
int insertProductSku(ProductSkuDO productSkuDO); int insertProductSku(ProductSkuDO productSkuDO);
int countSkuIsExist(Integer id); int countSkuIsExist(Integer id);
ProductSkuDO getProductSkuDetail(Integer id); ProductSkuDO getProductSkuDetail(Integer id);
int updateProductSku(ProductSkuDO productSkuDO); int updateProductSku(ProductSkuDO productSkuDO);
int countListPageProductSku(ProductSkuQO productSkuQO); int countListPageProductSku(ProductSkuQO productSkuQO);
List<ProductSkuDO> listPageProductSku(ProductSkuQO productSkuQO); List<ProductSkuDO> listPageProductSku(ProductSkuQO productSkuQO);
int countSpecName(ProductSpecVO param); int countSpecName(ProductSpecVO param);
int insertProductSpec(ProductSpecDO productSpecDO); int insertProductSpec(ProductSpecDO productSpecDO);
int updateProductSpec(ProductSpecDO productSpecDO); int updateProductSpec(ProductSpecDO productSpecDO);
int countSpecIsExist(Integer id); int countSpecIsExist(Integer id);
ProductSpecDO getProductSpecDetail(Integer id); 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); int batchInsertSpecPrice(List<ProductSpecPriceDO> list);
void batchInsertLeaseSpecPrice(List<ProductSpecPriceDO> list);
void batchInsertLeaseSpecPrice(List<ProductSpecPriceDO> list); void removeProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO);
void removeProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO); List<ProductSpecPriceDO> getProductSpecPrice(ProductSpecCPQVO productSpecCPQVO);
List<ProductSpecPriceDO> getProductSpecPrice(ProductSpecCPQVO productSpecCPQVO); void insertMallProdSkuInfo(MallProdInfoDO mallProdInfoDO);
void insertMallProdSkuInfo(MallProdInfoDO mallProdInfoDO); List<ProductSpecDO> listProductSpec(Integer id);
List<ProductSpecDO> listProductSpec(Integer id); List<ProductSkuDO> listProductSkuDO(List<Integer> productSkuId);
List<ProductSkuDO> listProductSkuDO(List<Integer> productSkuId); List<InventorySpecDO> listInventorySpecInfo(List<Integer> industryProductInventoryIds);
List<InventorySpecDO> listInventorySpecInfo(List<Integer> industryProductInventoryIds); List<ProductSpecDO> listProductSpecInfo(List<Integer> productSpecIds);
List<ProductSpecDO> listProductSpecInfo(List<Integer> productSpecIds); void batchUpdateMallProdSpec(List<Integer> delProductSpecId);
void batchUpdateMallProdSpec(List<Integer> delProductSpecId); int countProductSpecByBrandId(Integer id);
int countProductSpecByBrandId(Integer id); int countSpecByProdSkuId(Integer id);
int countSpecByProdSkuId(Integer id); void removeProductSku(Integer id);
void removeProductSku(Integer id); void removeProductSpec(Integer id);
List<MallProdInfoDO> listMallProdInfo(String id); List<IndustrySpecDO> listIndustrySpec(@Param("industrySpecIds") Set<Integer> industrySpecIds);
void removeProductSpec(Integer id); List<InventorySpecDO> listInventorySpec(Integer id);
List<IndustrySpecDO> listIndustrySpec(@Param("industrySpecIds") Set<Integer> industrySpecIds); BigDecimal feignGetUnitPriceByTag(PriceAcquisition priceAcquisition);
List<InventorySpecDO> listInventorySpec(Integer id); List<MallGoodsSpecInfoDO> listProdSpecInfo(@Param("prodIds") Set<Integer> prodIds);
BigDecimal feignGetUnitPriceByTag(PriceAcquisition priceAcquisition); /**
* 根据渠道等级、商品specId获取price信息
*
* @param tagInfoId
* @param prodSkuSpecIds
* @return
*/
List<ProductSpecPriceDO> listProductSpecPrice(Integer tagInfoId, Set<Integer> prodSkuSpecIds);
List<MallGoodsSpecInfoDO> listProdSpecInfo(@Param("prodIds") Set<Integer> prodIds); ProductSpecPriceDTO feignGetUnitPrice(Integer id, Integer tagId);
/** List<ProductSpecDO> getProductSpecList(List<Integer> productSkuIds);
* 根据渠道等级、商品specId获取price信息
*
* @param tagInfoId
* @param prodSkuSpecIds
* @return
*/
List<ProductSpecPriceDO> listProductSpecPrice(Integer tagInfoId, Set<Integer> prodSkuSpecIds);
ProductSpecPriceDTO feignGetUnitPrice(Integer id, Integer tagId); List<MallProdSkuInfoSpecDO> getProductSpecByIds(List<Integer> delProductSpecId);
List<ProductSpecDO> getProductSpecList(List<Integer> productSkuIds); Set<Integer> listProductSpecIds(@Param("mallProdSkuSpecIds") Set<Integer> mallProdSkuSpecIds);
List<MallProdSkuInfoSpecDO> getProductSpecByIds(List<Integer> delProductSpecId); List<OrderGoodsProdDTO> listProdGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO);
Set<Integer> listProductSpecIds(@Param("mallProdSkuSpecIds") Set<Integer> mallProdSkuSpecIds);
List<OrderGoodsProdDTO> listProdGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO);
List<MallProdSkuInfoSpecDO> listMallProductSpec(Integer id);
}
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.*; ...@@ -4,6 +4,7 @@ import com.mmc.pms.entity.*;
import com.mmc.pms.model.lease.vo.LeaseVo; import com.mmc.pms.model.lease.vo.LeaseVo;
import com.mmc.pms.model.qo.WareInfoQO; import com.mmc.pms.model.qo.WareInfoQO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -12,36 +13,42 @@ import java.util.List; ...@@ -12,36 +13,42 @@ import java.util.List;
*/ */
@Mapper @Mapper
public interface WebDeviceDao { public interface WebDeviceDao {
List<DistrictDO> listSecondDistrict(); List<DistrictDO> listSecondDistrict();
List<DeviceCategory> category(); List<DeviceCategory> category();
List<Brand> brand(); List<Brand> brand();
List<Brand> deviceBrand(); List<Brand> deviceBrand();
List<Model> model(); List<Model> model();
List<Model> deviceModel(); List<Model> deviceModel();
List<DeviceListDO> deviceList( List<DeviceListDO> deviceList(
Integer districtId, Integer categoryId, Integer brandId, Integer modelId); Integer districtId, Integer categoryId, Integer brandId, Integer modelId);
int update(LeaseVo param); int update(LeaseVo param);
InventoryDO findInventory(Integer inventoryId); InventoryDO findInventory(Integer inventoryId);
List<WareInfoDO> detail(Integer id); 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); WareInfoDO getWareInfoById(Integer id);
WareDetailDO getWareDetailById(Integer id); WareDetailDO getWareDetailById(Integer id);
List<AdDO> ad(); List<AdDO> ad();
List<SkuInfoDO> listSkuInfo(Integer id); List<SkuInfoDO> listSkuInfo(Integer id);
} }
package com.mmc.pms.entity; 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.ClassifyDetailsDTO;
import com.mmc.pms.model.categories.dto.ClassifyInfoDTO; import com.mmc.pms.model.categories.dto.ClassifyInfoDTO;
import com.mmc.pms.model.categories.vo.ClassifyInfoVO; import com.mmc.pms.model.categories.vo.ClassifyInfoVO;
...@@ -12,57 +13,79 @@ import java.io.Serializable; ...@@ -12,57 +13,79 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* @author lw * @author lw @TableName categories
* @TableName categories
*/ */
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class Categories implements Serializable { public class Categories implements Serializable {
private Integer id; private Integer id;
private Integer parentId; private Integer parentId;
private String name; private String name;
private String icon; private String icon;
private String description; private String description;
private Integer sort; private Integer sort;
private Integer type; private Integer type;
private Date createTime; private Date createTime;
private Date updateTime; private Date updateTime;
private Integer deleted; private Integer deleted;
private Integer directoryId; private Integer directoryId;
private String remark; private String remark;
public Categories(ClassifyInfoVO classifyInfoVO) { public Categories(ClassifyInfoVO classifyInfoVO) {
this.id = classifyInfoVO.getId(); this.id = classifyInfoVO.getId();
this.parentId = classifyInfoVO.getPid(); this.parentId = classifyInfoVO.getPid();
this.name = classifyInfoVO.getClassifyName(); this.name = classifyInfoVO.getClassifyName();
this.icon = classifyInfoVO.getIcon(); this.icon = classifyInfoVO.getIcon();
this.description = classifyInfoVO.getDescription(); this.description = classifyInfoVO.getDescription();
this.type = classifyInfoVO.getType(); this.type = classifyInfoVO.getType();
this.directoryId = classifyInfoVO.getDirectoryId(); this.directoryId = classifyInfoVO.getDirectoryId();
this.remark = classifyInfoVO.getRemark(); this.remark = classifyInfoVO.getRemark();
} }
public ClassifyInfoDTO buildClassifyInfoDTO() { public ClassifyInfoDTO buildClassifyInfoDTO() {
return ClassifyInfoDTO.builder().id(id).description(description) return ClassifyInfoDTO.builder()
.icon(icon).pid(parentId).classifyName(name) .id(id)
.remark(remark).createTime(createTime) .description(description)
.directoryId(directoryId).type(type).build(); .icon(icon)
} .pid(parentId)
.classifyName(name)
.remark(remark)
public ClassifyDetailsDTO buildClassifyDetailsDTO() { .createTime(createTime)
return ClassifyDetailsDTO.builder().id(id).description(description) .directoryId(directoryId)
.icon(icon).classifyName(name) .type(type)
.remark(remark).build(); .build();
} }
}
\ No newline at end of file public ClassifyDetailsDTO buildClassifyDetailsDTO() {
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; package com.mmc.pms.entity;
import com.mmc.pms.model.categories.dto.AllCategoryDTO;
import com.mmc.pms.model.categories.vo.DirectoryInfoVO; import com.mmc.pms.model.categories.vo.DirectoryInfoVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import java.io.Serializable; import java.io.Serializable;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* 目录管理表(Directory)实体类 * 目录管理表(Directory)实体类
...@@ -18,47 +24,52 @@ import java.util.Date; ...@@ -18,47 +24,52 @@ import java.util.Date;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class DirectoryDO implements Serializable { public class DirectoryDO implements Serializable {
private static final long serialVersionUID = 713939370607409336L; private static final long serialVersionUID = 713939370607409336L;
/** /** 主键id */
* 主键id private Integer id;
*/ /** 目录名称 */
private Integer id; private String directoryName;
/** /** 其他目录关联id */
* 目录名称 private Integer pid;
*/ /** 类型:(0:通用目录 1:作业服务目录 2:设备目录 3:飞手目录 4:商城目录) */
private String directoryName; private Integer type;
/** /** 创建时间 */
* 其他目录关联id private Date createTime;
*/ /** 修改时间 */
private Integer pid; private Date updateTime;
/** /** 是否删除 */
* 类型:(0:通用目录 1:作业服务目录 2:设备目录 3:飞手目录 4:商城目录) private Integer deleted;
*/
private Integer type;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
/**
* 是否删除
*/
private Integer deleted;
private String relevanceName; private String show;
public DirectoryDO(DirectoryInfoVO param) { private String relevanceName;
this.id = param.getId();
this.directoryName = param.getDirectoryName(); public DirectoryDO(DirectoryInfoVO param) {
this.pid = param.getPid(); if (CollectionUtils.isNotEmpty(param.getShow())) {
this.type = param.getType(); String show = param.getShow().stream().map(Object::toString).collect(Collectors.joining(","));
this.show = show;
} }
this.id = param.getId();
this.directoryName = param.getDirectoryName();
this.type = param.getType();
}
public DirectoryInfoVO buildDirectoryInfoVO() { 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; package com.mmc.pms.entity;
import com.mmc.pms.model.categories.vo.RelevanceGoodsInfoVO; 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 com.mmc.pms.model.sale.vo.GoodsAddVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
...@@ -10,69 +12,94 @@ import java.io.Serializable; ...@@ -10,69 +12,94 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* @author 23214 * @author 23214 @TableName goods_info
* @TableName goods_info
*/ */
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class GoodsInfo implements Serializable { public class GoodsInfo implements Serializable {
private Integer id; private Integer id;
private Integer pid; private Integer pid;
private String goodsNo; private String goodsNo;
private String goodsName; private String goodsName;
private Integer directoryId; private Integer directoryId;
private Integer addGoodsUserId; private Integer addGoodsUserId;
private Integer categoryByOne; private Integer categoryByOne;
private Integer categoryByTwo; private Integer categoryByTwo;
private String ecoLabel; private String ecoLabel;
private Integer shelfStatus; private Integer shelfStatus;
private Integer showCode; private Integer showCode;
private Integer sort; private Integer sort;
private Date createTime; private Date createTime;
private Integer goodsType; private Integer goodsType;
private Date updateTime; private Date updateTime;
private Integer deleted; private Integer deleted;
private Integer goodsVideoId; private Integer goodsVideoId;
private String videoUrl; private String videoUrl;
private String mainImg; private String mainImg;
private static final long serialVersionUID = 1L; private Integer isCoupons;
public GoodsInfo(GoodsAddVO goodsAddVO) { private String directoryName;
this.id = goodsAddVO.getId();
this.goodsName = goodsAddVO.getGoodsName();
this.shelfStatus = goodsAddVO.getShelfStatus();
this.categoryByOne = goodsAddVO.getCategoryByOne();
this.categoryByTwo = goodsAddVO.getCategoryByTwo();
this.directoryId = goodsAddVO.getDirectoryId();
this.ecoLabel = goodsAddVO.getTag();
this.goodsType = goodsAddVO.getGoodsType();
}
public GoodsInfo(Integer id) { private static final long serialVersionUID = 1L;
this.id = id;
}
public RelevanceGoodsInfoVO buildRelevanceGoodsInfoVO() { public GoodsInfo(GoodsAddVO goodsAddVO) {
return RelevanceGoodsInfoVO.builder().id(id).goodsName(goodsName).shelf(shelfStatus).mainImage(mainImg).build(); this.id = goodsAddVO.getId();
} this.goodsName = goodsAddVO.getGoodsName();
} this.shelfStatus = goodsAddVO.getShelfStatus();
\ No newline at end of file this.categoryByOne = goodsAddVO.getCategoryByOne();
this.categoryByTwo = goodsAddVO.getCategoryByTwo();
this.directoryId = goodsAddVO.getDirectoryId();
this.ecoLabel = goodsAddVO.getTag();
this.goodsType = goodsAddVO.getGoodsType();
}
public GoodsInfo(Integer id) {
this.id = id;
}
public RelevanceGoodsInfoVO buildRelevanceGoodsInfoVO() {
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;
}
...@@ -18,56 +18,51 @@ import java.util.Date; ...@@ -18,56 +18,51 @@ import java.util.Date;
@AllArgsConstructor @AllArgsConstructor
@Accessors(chain = true) @Accessors(chain = true)
public class MallProdInfoDO implements Serializable { public class MallProdInfoDO implements Serializable {
private static final long serialVersionUID = 3667714765929443857L; private static final long serialVersionUID = 3667714765929443857L;
private Integer id; private Integer id;
private Integer goodsInfoId; private Integer goodsInfoId;
private Integer prodSkuId; private Integer prodSkuId;
private String prodSkuSpecName; private String prodSkuSpecName;
private Integer categoriesId; private Integer categoriesId;
private Integer chooseType; private Integer chooseType;
private Integer must; private Integer must;
private Integer skuUnitId; private Integer skuUnitId;
private Integer deleted; private Integer deleted;
private Date createTime; private Date createTime;
private Date updateTime; private Date updateTime;
private Integer flag; private Integer flag;
private String productSpecIdList; /** 辅助字段 start */
private String beforeUpdateSpec; private String typeName;
/**
* 辅助字段 start
*/
private String typeName;
private String goodsName;
private String unitName;
private String productSkuName;
private Integer brandInfoId;
/** private String goodsName;
* 辅助字段 end private String unitName;
*/ private String productSkuName;
public MallProdInfoDO(GoodsProdSpecVO goodsSpecVO) { private Integer brandInfoId;
this.categoriesId = goodsSpecVO.getCategoryId();
this.prodSkuSpecName = goodsSpecVO.getGoodsSpecName();
this.chooseType = goodsSpecVO.getChooseType();
this.skuUnitId = goodsSpecVO.getSkuUnitId();
this.must = goodsSpecVO.getMust();
this.flag = goodsSpecVO.getFlag();
}
public GoodsSpecDTO buildGoodsSpecDTO() { /** 辅助字段 end */
return GoodsSpecDTO.builder() public MallProdInfoDO(GoodsProdSpecVO goodsSpecVO) {
.id(this.id) this.categoriesId = goodsSpecVO.getCategoryId();
.goodsSpecName(this.prodSkuSpecName) this.prodSkuSpecName = goodsSpecVO.getGoodsSpecName();
.categoryId(this.categoriesId) this.chooseType = goodsSpecVO.getChooseType();
.chooseType(this.chooseType) this.skuUnitId = goodsSpecVO.getSkuUnitId();
.skuUnitId(skuUnitId) this.must = goodsSpecVO.getMust();
.unitName(this.unitName) this.flag = goodsSpecVO.getFlag();
.skuId(this.prodSkuId) }
.typeName(this.typeName)
.must(must) public GoodsSpecDTO buildGoodsSpecDTO() {
.skuName(this.productSkuName) return GoodsSpecDTO.builder()
.brandInfoId(brandInfoId) .id(this.id)
.flag(flag) .goodsSpecName(this.prodSkuSpecName)
.build(); .categoryId(this.categoriesId)
} .chooseType(this.chooseType)
.skuUnitId(skuUnitId)
.unitName(this.unitName)
.skuId(this.prodSkuId)
.typeName(this.typeName)
.must(must)
.skuName(this.productSkuName)
.brandInfoId(brandInfoId)
.flag(flag)
.build();
}
} }
...@@ -6,6 +6,7 @@ import lombok.NoArgsConstructor; ...@@ -6,6 +6,7 @@ import lombok.NoArgsConstructor;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/** /**
...@@ -16,16 +17,17 @@ import java.util.Date; ...@@ -16,16 +17,17 @@ import java.util.Date;
@AllArgsConstructor @AllArgsConstructor
@Accessors(chain = true) @Accessors(chain = true)
public class MallProdSkuInfoSpecDO implements Serializable { public class MallProdSkuInfoSpecDO implements Serializable {
private static final long serialVersionUID = -8247363408322497387L; private static final long serialVersionUID = -8247363408322497387L;
private Integer id; private Integer id;
private Integer mallProdSkuInfoId; private Integer mallProdSkuInfoId;
private Integer goodsInfoId; private Integer goodsInfoId;
private Integer productSpecId; private Integer productSpecId;
private Integer deleted; private Integer deleted;
private Date createTime; private Date createTime;
private Date updateTime; private Date updateTime;
private String goodsName; private String goodsName;
private BigDecimal price;
private ProductSpecDO productSpecDO; private ProductSpecDO productSpecDO;
} }
package com.mmc.pms.entity; package com.mmc.pms.entity;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.mmc.pms.model.other.dto.RepoCashDTO; import com.mmc.pms.model.other.dto.RepoCashDTO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -20,53 +20,53 @@ import java.util.Date; ...@@ -20,53 +20,53 @@ import java.util.Date;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class RepoCashDO implements Serializable { public class RepoCashDO implements Serializable {
private static final long serialVersionUID = -7930603317037474755L; private static final long serialVersionUID = -7930603317037474755L;
private Integer id; private Integer id;
private Integer repoAccountId; private Integer repoAccountId;
private String uid; private String uid;
private String accountName; private String accountName;
private Integer orderInfoId; private Integer orderInfoId;
private String orderNo; private String orderNo;
private Integer skuInfoId; private Integer skuInfoId;
private String skuTitle; private String skuTitle;
private Integer wareInfoId; private Integer wareInfoId;
private String wareNo; private String wareNo;
private String wareTitle; private String wareTitle;
private String payNo; private String payNo;
private Integer payMethod; private Integer payMethod;
private BigDecimal amtPaid; private BigDecimal amtPaid;
private BigDecimal cashAmt; private BigDecimal cashAmt;
private Date payTime; private Date payTime;
private String refundNo; private String refundNo;
private String voucher; private String voucher;
private String remark; private String remark;
private Integer createUser; private Integer createUser;
private Date createTime; private Date createTime;
private Integer updateUser; private Integer updateUser;
private Date updateTime; private Date updateTime;
public RepoCashDTO buildRepoCashDTO() { public RepoCashDTO buildRepoCashDTO() {
return RepoCashDTO.builder() return RepoCashDTO.builder()
.id(this.id) .id(this.id)
.repoAccountId(this.repoAccountId) .repoAccountId(this.repoAccountId)
.uid(this.uid) .uid(this.uid)
.accountName(this.accountName) .accountName(this.accountName)
.orderInfoId(this.orderInfoId) .orderInfoId(this.orderInfoId)
.orderNo(this.orderNo) .orderNo(this.orderNo)
.skuInfoId(this.skuInfoId) .skuInfoId(this.skuInfoId)
.skuTitle(this.skuTitle) .skuTitle(this.skuTitle)
.wareInfoId(this.wareInfoId) .wareInfoId(this.wareInfoId)
.wareNo(this.wareNo) .wareNo(this.wareNo)
.wareTitle(this.wareTitle) .wareTitle(this.wareTitle)
.payNo(this.payNo) .payNo(this.payNo)
.payMethod(this.payMethod) .payMethod(this.payMethod)
.amtPaid(this.amtPaid) .amtPaid(this.amtPaid)
.refundNo(this.refundNo) .refundNo(this.refundNo)
.createUser(this.createUser) .createUser(this.createUser)
.voucher(StringUtils.isBlank(this.voucher) ? null : Arrays.asList(this.voucher.split(","))) .voucher(StringUtils.isBlank(this.voucher) ? null : Arrays.asList(this.voucher.split(",")))
.cashAmt(this.cashAmt) .cashAmt(this.cashAmt)
.payTime(this.payTime) .payTime(this.payTime)
.remark(this.remark) .remark(this.remark)
.build(); .build();
} }
} }
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; ...@@ -12,8 +12,8 @@ import java.util.Date;
/** /**
* @Author LW * @Author LW
* @date 2023/6/8 10:33 *
* 概要: * @date 2023/6/8 10:33 概要:
*/ */
@Data @Data
@AllArgsConstructor @AllArgsConstructor
...@@ -21,73 +21,65 @@ import java.util.Date; ...@@ -21,73 +21,65 @@ import java.util.Date;
@Builder @Builder
public class ServiceDO implements Serializable { public class ServiceDO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Integer id; private Integer id;
@ApiModelProperty(value = "服务名称") @ApiModelProperty(value = "服务名称")
private String serviceName; private String serviceName;
@ApiModelProperty(value = "应用") @ApiModelProperty(value = "应用")
private Integer applicationId; private Integer applicationId;
@ApiModelProperty(value = "行业") @ApiModelProperty(value = "行业")
private Integer industryId; private Integer industryId;
@ApiModelProperty(value = "展示状态") @ApiModelProperty(value = "展示状态")
private Integer displayState; private Integer displayState;
@ApiModelProperty(value = "封面图") @ApiModelProperty(value = "封面图")
private String coverPlan; private String coverPlan;
@ApiModelProperty(value = "分享卡片") @ApiModelProperty(value = "分享卡片")
private String shareCard; private String shareCard;
@ApiModelProperty(value = "视频") @ApiModelProperty(value = "视频")
private String video; private String video;
@ApiModelProperty(value = "服务介绍") @ApiModelProperty(value = "服务介绍")
private String serviceIntroduction; private String serviceIntroduction;
@ApiModelProperty(value = "创建人id") @ApiModelProperty(value = "创建人id")
private Integer accountId; private Integer accountId;
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Date createTime; private Date createTime;
@ApiModelProperty(value = "修改时间") @ApiModelProperty(value = "修改时间")
private Date updateTime; private Date updateTime;
@ApiModelProperty(value = "逻辑删除字段") @ApiModelProperty(value = "逻辑删除字段")
private Integer isDeleted; private Integer isDeleted;
public ServiceDO(ServiceVO param, Integer accountId) { public ServiceDO(ServiceVO param, Integer accountId) {
this.id = param.getId(); this(param);
this.serviceName = param.getServiceName(); this.accountId = accountId;
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.accountId = accountId;
}
public ServiceDO(ServiceVO param) { public ServiceDO(ServiceVO param) {
this.id = param.getId(); this.id = param.getId();
this.serviceName = param.getServiceName(); this.serviceName = param.getServiceName();
this.applicationId = param.getApplicationId(); this.applicationId = param.getApplicationId();
this.industryId = param.getIndustryId(); this.industryId = param.getIndustryId();
this.displayState = param.getDisplayState(); this.displayState = param.getDisplayState();
this.coverPlan = param.getCoverPlan(); this.coverPlan = param.getCoverPlan();
this.shareCard = param.getShareCard(); this.shareCard = param.getShareCard();
this.video = param.getVideo(); this.video = param.getVideo();
this.serviceIntroduction = param.getServiceIntroduction(); this.serviceIntroduction = param.getServiceIntroduction();
} }
public ServiceDO(Integer id, Integer accountId) { public ServiceDO(Integer id, Integer accountId) {
this.id = id; this.id = id;
this.accountId = accountId; 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;
}
}
...@@ -13,107 +13,107 @@ import java.util.List; ...@@ -13,107 +13,107 @@ import java.util.List;
*/ */
public class JsonUtil { public class JsonUtil {
public static void main(String[] args) { public static void main(String[] args) {
String array = "[1,24,23]"; String array = "[1,24,23]";
List<Integer> list = JSONArray.parseArray(array, Integer.class); List<Integer> list = JSONArray.parseArray(array, Integer.class);
System.out.println(list.get(2)); System.out.println(list.get(2));
} }
/** /**
* 把Java对象转换成json字符串 * 把Java对象转换成json字符串
* *
* @param object 待转化为JSON字符串的Java对象 * @param object 待转化为JSON字符串的Java对象
* @return json 串 or null * @return json 串 or null
*/ */
public static String parseObjToJson(Object object) { public static String parseObjToJson(Object object) {
String string = null; String string = null;
try { try {
string = JSONObject.toJSONString(object); string = JSONObject.toJSONString(object);
} catch (Exception e) { } catch (Exception e) {
// LOGGER.error(e.getMessage()); // LOGGER.error(e.getMessage());
}
return string;
} }
return string;
}
/** /**
* 将Json字符串信息转换成对应的Java对象 * 将Json字符串信息转换成对应的Java对象
* *
* @param json json字符串对象 * @param json json字符串对象
* @param c 对应的类型 * @param c 对应的类型
*/ */
public static <T> T parseJsonToObj(String json, Class<T> c) { public static <T> T parseJsonToObj(String json, Class<T> c) {
try { try {
JSONObject jsonObject = JSON.parseObject(json); JSONObject jsonObject = JSON.parseObject(json);
return JSON.toJavaObject(jsonObject, c); return JSON.toJavaObject(jsonObject, c);
} catch (Exception e) { } catch (Exception e) {
// LOGGER.error(e.getMessage()); // LOGGER.error(e.getMessage());
}
return null;
} }
return null;
}
/** /**
* 读取json文件 * 读取json文件
* *
* @param fileName * @param fileName
* @return * @return
*/ */
public static String readJsonFile(String fileName) { public static String readJsonFile(String fileName) {
String jsonStr = ""; String jsonStr = "";
try { try {
File jsonFile = new File(fileName); File jsonFile = new File(fileName);
FileReader fileReader = new FileReader(jsonFile); FileReader fileReader = new FileReader(jsonFile);
Reader reader = new InputStreamReader(new FileInputStream(jsonFile), "utf-8"); Reader reader = new InputStreamReader(new FileInputStream(jsonFile), "utf-8");
int ch = 0; int ch = 0;
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
while ((ch = reader.read()) != -1) { while ((ch = reader.read()) != -1) {
sb.append((char) ch); sb.append((char) ch);
} }
fileReader.close(); fileReader.close();
reader.close(); reader.close();
jsonStr = sb.toString(); jsonStr = sb.toString();
return jsonStr; return jsonStr;
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
return null; return null;
}
} }
}
/** /**
* 将JSON数据格式化并保存到文件中 * 将JSON数据格式化并保存到文件中
* *
* @param jsonData 需要输出的json数 * @param jsonData 需要输出的json数
* @param filePath 输出的文件地址 * @param filePath 输出的文件地址
* @return * @return
*/ */
public static boolean createJsonFile(Object jsonData, String filePath) { public static boolean createJsonFile(Object jsonData, String filePath) {
String content = String content =
JSON.toJSONString( JSON.toJSONString(
jsonData, jsonData,
SerializerFeature.PrettyFormat, SerializerFeature.PrettyFormat,
SerializerFeature.WriteMapNullValue, SerializerFeature.WriteMapNullValue,
SerializerFeature.WriteDateUseDateFormat); SerializerFeature.WriteDateUseDateFormat);
// 标记文件生成是否成功 // 标记文件生成是否成功
boolean flag = true; boolean flag = true;
// 生成json格式文件 // 生成json格式文件
try { try {
// 保证创建一个新文件 // 保证创建一个新文件
File file = new File(filePath); File file = new File(filePath);
if (!file.getParentFile().exists()) { // 如果父目录不存在,创建父目录 if (!file.getParentFile().exists()) { // 如果父目录不存在,创建父目录
file.getParentFile().mkdirs(); file.getParentFile().mkdirs();
} }
if (file.exists()) { // 如果已存在,删除旧文件 if (file.exists()) { // 如果已存在,删除旧文件
file.delete(); file.delete();
} }
file.createNewFile(); file.createNewFile();
// 将格式化后的字符串写入文件 // 将格式化后的字符串写入文件
Writer write = new OutputStreamWriter(new FileOutputStream(file), "UTF-8"); Writer write = new OutputStreamWriter(new FileOutputStream(file), "UTF-8");
write.write(content); write.write(content);
write.flush(); write.flush();
write.close(); write.close();
} catch (Exception e) { } catch (Exception e) {
flag = false; flag = false;
e.printStackTrace(); e.printStackTrace();
}
return flag;
} }
return flag;
}
} }
/**
* 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,25 +6,27 @@ import lombok.Builder; ...@@ -6,25 +6,27 @@ import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.List;
/** /**
* @Author LW * @Author LW
* @date 2023/5/24 11:06 *
* 概要: * @date 2023/5/24 11:06 概要:
*/ */
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Builder @Builder
public class DirectoryInfoVO { public class DirectoryInfoVO {
@ApiModelProperty(value = "目录id") @ApiModelProperty(value = "目录id")
private Integer id; private Integer id;
@ApiModelProperty(value = "目录名称")
private String directoryName; @ApiModelProperty(value = "目录名称")
@ApiModelProperty(value = "关联目录的id") private String directoryName;
private Integer pid;
@ApiModelProperty(value = "关联目录名称") @ApiModelProperty(value = "分类模块:(0:通用分类 1:作业服务分类 2:设备分类 3:飞手分类 4:商城分类)")
private String relevanceName; private Integer type;
@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; package com.mmc.pms.model.qo;
import com.mmc.pms.common.Page;
import com.mmc.pms.model.group.Freeze; import com.mmc.pms.model.group.Freeze;
import com.mmc.pms.page.Page;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
......
package com.mmc.pms.model.qo; package com.mmc.pms.model.qo;
import com.mmc.pms.common.Page;
import com.mmc.pms.model.group.Freeze; import com.mmc.pms.model.group.Freeze;
import com.mmc.pms.page.Page;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
......
package com.mmc.pms.model.qo; package com.mmc.pms.model.qo;
import com.mmc.pms.common.Page;
import com.mmc.pms.model.group.Freeze; import com.mmc.pms.model.group.Freeze;
import com.mmc.pms.page.Page;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
......
package com.mmc.pms.model.qo; package com.mmc.pms.model.qo;
import com.mmc.pms.common.Page; import com.mmc.pms.common.Page;
import com.mmc.pms.model.group.Freeze; import com.mmc.pms.model.group.Freeze;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -13,11 +12,12 @@ import org.hibernate.validator.constraints.Length; ...@@ -13,11 +12,12 @@ import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.Min; import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* @Author LW * @Author LW
* @date 2023/6/8 10:33 *
* 概要: * @date 2023/6/8 10:33 概要:
*/ */
@Data @Data
@AllArgsConstructor @AllArgsConstructor
...@@ -25,34 +25,44 @@ import java.io.Serializable; ...@@ -25,34 +25,44 @@ import java.io.Serializable;
@Builder @Builder
public class ServiceQO implements Serializable { public class ServiceQO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Integer id; private Integer id;
@ApiModelProperty(value = "服务名称", example = "服务名称")
@Length(message = "最大不超过30字", max = 30)
private String serviceName;
@ApiModelProperty(value = "分类id集合(应用/行业等)")
private List<Integer> categoryId;
@ApiModelProperty(value = "服务名称", example = "服务名称") @ApiModelProperty(value = "应用id")
@Length(message = "最大不超过30字", max = 30) private Integer applicationId;
private String serviceName;
@ApiModelProperty(value = "应用", example = "1") @ApiModelProperty(value = "行业id")
private Integer applicationId; private Integer industryId;
@ApiModelProperty(value = "行业", example = "2") @ApiModelProperty(value = "省份编码", example = "440000")
private Integer industryId; private Integer provinceId;
@ApiModelProperty(value = "账号id") @ApiModelProperty(value = "展示状态")
private Integer accountId; private Integer displayState;
@ApiModelProperty(value = "页码", required = true) @ApiModelProperty(value = "页码", required = true)
@NotNull(message = "页码不能为空", groups = {Page.class, Freeze.class}) @NotNull(
@Min(value = 1, groups = Page.class) message = "页码不能为空",
private Integer pageNo; groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true) @ApiModelProperty(value = "每页显示数", required = true)
@NotNull(message = "每页显示数不能为空", groups = {Page.class, Freeze.class}) @NotNull(
@Min(value = 1, groups = Page.class) message = "每页显示数不能为空",
private Integer pageSize; groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() { public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize; this.pageNo = (pageNo - 1) * pageSize;
} }
} }
package com.mmc.pms.model.qo; package com.mmc.pms.model.qo;
import com.mmc.pms.page.Page; import com.mmc.pms.common.Page;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
...@@ -9,6 +9,7 @@ import lombok.NoArgsConstructor; ...@@ -9,6 +9,7 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.Min; import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* @Author small @Date 2023/5/16 9:55 @Version 1.0 * @Author small @Date 2023/5/16 9:55 @Version 1.0
...@@ -16,42 +17,24 @@ import java.io.Serializable; ...@@ -16,42 +17,24 @@ import java.io.Serializable;
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
// @ApiModel(value = "com.mmc.csf.model.qo.WareInfoQO", description = "model")
public class WareInfoQO implements Serializable { public class WareInfoQO implements Serializable {
private static final long serialVersionUID = -2953141525621912414L; private static final long serialVersionUID = -2953141525621912414L;
@ApiModelProperty(name = "id", value = "设备id", example = "1", required = false) @ApiModelProperty(name = "districtId", value = "地域id", example = "440000")
private Integer id; private Integer provinceId;
@ApiModelProperty(name = "districtId", value = "地域id", example = "1", required = false) @ApiModelProperty(name = "categoryId", value = "分类id")
private Integer districtId; private List<Integer> categoryId;
@ApiModelProperty(name = "categoryId", value = "类目id", example = "类目id") @ApiModelProperty(name = "产品类型:0商城 1租赁")
private Integer categoryId; private Integer type;
@ApiModelProperty(name = "brandIdl", value = "品牌id", example = "品牌id") @ApiModelProperty(value = "页码", required = true, example = "1")
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)
@NotNull(message = "页码不能为空", groups = Page.class) @NotNull(message = "页码不能为空", groups = Page.class)
@Min(value = 1, groups = Page.class) @Min(value = 1, groups = Page.class)
private Integer pageNo; private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true) @ApiModelProperty(value = "每页显示数", required = true, example = "10")
@NotNull(message = "每页显示数不能为空", groups = Page.class) @NotNull(message = "每页显示数不能为空", groups = Page.class)
@Min(value = 1, groups = Page.class) @Min(value = 1, groups = Page.class)
private Integer pageSize; private Integer pageSize;
......
...@@ -7,43 +7,63 @@ import lombok.NoArgsConstructor; ...@@ -7,43 +7,63 @@ import lombok.NoArgsConstructor;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
/** /**
* @Author LW * @Author LW
* @date 2022/10/14 11:30 *
* 概要: * @date 2022/10/14 11:30 概要:
*/ */
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Accessors(chain = true) @Accessors(chain = true)
public class MallGoodsDetailDTO implements Serializable { public class MallGoodsDetailDTO implements Serializable {
private static final long serialVersionUID = 7041502536618388167L; private static final long serialVersionUID = 7041502536618388167L;
@ApiModelProperty(value = "id")
private Integer id; @ApiModelProperty(value = "id")
@ApiModelProperty(value = "商品图片") private Integer id;
private List<GoodsImgDTO> images;
@ApiModelProperty(value = "商品视频") @ApiModelProperty(value = "商品图片")
private String goodsVideo; private List<GoodsImgDTO> images;
@ApiModelProperty(value = "商品视频id")
private Integer goodsVideoId; @ApiModelProperty(value = "商品视频")
@ApiModelProperty(value = "商品名称") private String goodsVideo;
private String goodsName;
@ApiModelProperty(value = "商品详情") @ApiModelProperty(value = "商品视频id")
private GoodsDetailInfoDTO goodsDetail; private Integer goodsVideoId;
@ApiModelProperty(value = "所属目录")
private Integer directoryId; @ApiModelProperty(value = "商品名称")
@ApiModelProperty(value = "一级分类id") private String goodsName;
private Integer categoryByOne;
@ApiModelProperty(value = "二级分类id") @ApiModelProperty(value = "商品编号")
private Integer categoryByTwo; private String goodsNo;
@ApiModelProperty(value = "商品标签")
private String tag; @ApiModelProperty(value = "商品详情")
@ApiModelProperty(value = "商品状态 0:下架 1:上架") private GoodsDetailInfoDTO goodsDetail;
private Integer shelfStatus;
@ApiModelProperty(value = "规格信息") @ApiModelProperty(value = "所属目录")
private List<GoodsSpecDTO> goodsSpec; private Integer directoryId;
@ApiModelProperty(value = "其他服务: 1:免费配送,2:专业飞手培训2日, 3:半年保修, 4:一年保修 ")
private List<GoodsOtherServiceDTO> otherService; @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; ...@@ -9,6 +9,7 @@ import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @Author small @Date 2023/5/16 15:30 @Version 1.0 * @Author small @Date 2023/5/16 15:30 @Version 1.0
...@@ -19,26 +20,29 @@ import java.util.Date; ...@@ -19,26 +20,29 @@ import java.util.Date;
@Builder @Builder
@Accessors @Accessors
public class ProductSpecDTO implements Serializable { public class ProductSpecDTO implements Serializable {
private static final long serialVersionUID = -2681122778843398310L; private static final long serialVersionUID = -2681122778843398310L;
@ApiModelProperty(value = "id") @ApiModelProperty(value = "id")
private Integer id; private Integer id;
@ApiModelProperty(value = "productSkuId") @ApiModelProperty(value = "productSkuId")
private Integer productSkuId; private Integer productSkuId;
@ApiModelProperty(value = "规格名称") @ApiModelProperty(value = "规格名称")
private String specName; private String specName;
@ApiModelProperty(value = "规格图片") @ApiModelProperty(value = "规格图片")
private String specImage; private String specImage;
@ApiModelProperty(value = "料号") @ApiModelProperty(value = "料号")
private String partNo; private String partNo;
@ApiModelProperty(value = "版本描述") @ApiModelProperty(value = "版本描述")
private String versionDesc; private String versionDesc;
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Date createTime; 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; 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.Create;
import com.mmc.pms.model.group.Freeze; import com.mmc.pms.model.group.Freeze;
import com.mmc.pms.model.group.Update; import com.mmc.pms.model.group.Update;
import com.mmc.pms.page.Page;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
...@@ -15,30 +15,34 @@ import java.io.Serializable; ...@@ -15,30 +15,34 @@ import java.io.Serializable;
/** /**
* @Author LW * @Author LW
* @date 2023/5/25 11:25 *
* 概要: * @date 2023/5/25 11:25 概要:
*/ */
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class QueryClassifyVO implements Serializable { public class QueryClassifyVO implements Serializable {
@ApiModelProperty(value = "所属目录id") @ApiModelProperty(value = "所属目录id")
@NotNull(message = "所属目录id不能为空", groups = {Update.class, Create.class}) @NotNull(
private Integer directoryId; message = "所属目录id不能为空",
groups = {Update.class, Create.class})
private Integer directoryId;
@ApiModelProperty(value = "分类所属模块id(0:通用分类 1:作业服务分类 2:设备租赁分类 3:飞手培训分类 4:产品商城分类)") @ApiModelProperty(value = "页码", required = true)
private Integer type; @NotNull(
@ApiModelProperty(value = "页码", required = true) message = "页码不能为空",
@NotNull(message = "页码不能为空", groups = {Page.class, Freeze.class}) groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class) @Min(value = 1, groups = Page.class)
private Integer pageNo; private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true)
@NotNull(message = "每页显示数不能为空", groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() { @ApiModelProperty(value = "每页显示数", required = true)
this.pageNo = (pageNo - 1) * pageSize; @NotNull(
} message = "每页显示数不能为空",
groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
} }
...@@ -14,8 +14,10 @@ import java.math.BigDecimal; ...@@ -14,8 +14,10 @@ import java.math.BigDecimal;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class SpecPriceVO implements Serializable { public class SpecPriceVO implements Serializable {
private static final long serialVersionUID = -8976672168410262190L; private static final long serialVersionUID = -8976672168410262190L;
private Integer id; private Integer id;
private Integer cooperationTag; private Integer cooperationTag;
private BigDecimal price; private BigDecimal price;
private Integer productSpecId;
private Integer leaseTerm;
} }
package com.mmc.pms.model.work.dto; package com.mmc.pms.model.work.dto;
import com.mmc.pms.entity.InspComtDO;
import com.mmc.pms.entity.ServiceDO; import com.mmc.pms.entity.ServiceDO;
import com.mmc.pms.model.work.vo.ServiceVO; import com.mmc.pms.model.work.vo.ServiceVO;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -10,6 +11,7 @@ import lombok.NoArgsConstructor; ...@@ -10,6 +11,7 @@ import lombok.NoArgsConstructor;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @Author LW * @Author LW
...@@ -59,6 +61,12 @@ public class ServiceDTO implements Serializable { ...@@ -59,6 +61,12 @@ public class ServiceDTO implements Serializable {
@ApiModelProperty(value = "账号id") @ApiModelProperty(value = "账号id")
private Integer accountId; private Integer accountId;
@ApiModelProperty(value = "评论列表")
private List<InspComtDO> inspComtList;
@ApiModelProperty(value = "评论数量")
private Integer inspComtAmount;
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Date createTime; 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; ...@@ -15,8 +15,8 @@ import java.io.Serializable;
/** /**
* @Author LW * @Author LW
* @date 2023/6/8 10:33 *
* 概要: * @date 2023/6/8 10:33 概要:
*/ */
@Data @Data
@AllArgsConstructor @AllArgsConstructor
...@@ -24,37 +24,47 @@ import java.io.Serializable; ...@@ -24,37 +24,47 @@ import java.io.Serializable;
@Builder @Builder
public class ServiceVO implements Serializable { public class ServiceVO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@NotNull(message = "修改服务id不能为空", groups = {Update.class}) @NotNull(
private Integer id; message = "修改服务id不能为空",
groups = {Update.class})
private Integer id;
@ApiModelProperty(value = "服务名称", example = "服务名称") @ApiModelProperty(value = "服务名称", example = "服务名称")
@NotBlank(message = "服务名称不能为空", groups = {Create.class, Update.class}) @NotBlank(
@Length(message = "最大不超过30字", max = 30) message = "服务名称不能为空",
private String serviceName; groups = {Create.class})
@Length(message = "最大不超过30字", max = 30)
private String serviceName;
@ApiModelProperty(value = "应用", example = "1") @ApiModelProperty(value = "应用", example = "1")
private Integer applicationId; private Integer applicationId;
@ApiModelProperty(value = "行业", example = "2") @ApiModelProperty(value = "行业", example = "2")
@NotNull(message = "行业id不能为空", groups = {Create.class, Update.class}) @NotNull(
private Integer industryId; message = "行业id不能为空",
groups = {Create.class})
private Integer industryId;
@ApiModelProperty(value = "展示状态,0为上架,1下架", example = "0") @ApiModelProperty(value = "展示状态,0为上架,1下架", example = "0")
@NotNull(message = "展示状态不能为空", groups = {Create.class, Update.class}) @NotNull(
private Integer displayState; message = "展示状态不能为空",
groups = {Create.class})
private Integer displayState;
@ApiModelProperty(value = "封面图") @ApiModelProperty(value = "封面图")
@NotBlank(message = "封面图不能为空", groups = {Create.class, Update.class}) @NotBlank(
private String coverPlan; message = "封面图不能为空",
groups = {Create.class})
private String coverPlan;
@ApiModelProperty(value = "分享卡片") @ApiModelProperty(value = "分享卡片")
private String shareCard; private String shareCard;
@ApiModelProperty(value = "视频") @ApiModelProperty(value = "视频")
private String video; private String video;
@ApiModelProperty(value = "服务介绍") @ApiModelProperty(value = "服务介绍")
private String serviceIntroduction; private String serviceIntroduction;
} }
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; package com.mmc.pms.service;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.qo.ServiceQO; 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.ServiceVO;
import com.mmc.pms.model.work.vo.UpAndDownServiceVO;
import com.mmc.pms.page.PageResult; import com.mmc.pms.page.PageResult;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/** /**
* @Author LW * @Author LW
* @date 2023/6/6 10:46 *
* 概要: * @date 2023/6/6 10:46 概要:
*/ */
public interface BackstageTaskService { public interface BackstageTaskService {
ResultBody addWorkService(ServiceVO param, Integer userAccountId); ResultBody addWorkService(ServiceVO param, Integer userAccountId);
ResultBody updateById(ServiceVO param);
ResultBody deleteByIds(List<Integer> ids);
ResultBody<ServiceDTO> queryById(Integer id);
ResultBody updateById(ServiceVO param); PageResult queryServiceManagerList(ServiceQO param, Integer userAccountId);
ResultBody deleteById(Integer id); 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; ...@@ -4,13 +4,14 @@ import com.mmc.pms.common.ResultBody;
import com.mmc.pms.entity.Categories; import com.mmc.pms.entity.Categories;
import com.mmc.pms.entity.DirectoryDO; import com.mmc.pms.entity.DirectoryDO;
import com.mmc.pms.entity.DistrictDO; 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.ClassifyInfoVO;
import com.mmc.pms.model.categories.vo.DirectoryInfoVO; import com.mmc.pms.model.categories.vo.DirectoryInfoVO;
import com.mmc.pms.model.sale.vo.QueryClassifyVO; import com.mmc.pms.model.sale.vo.QueryClassifyVO;
import com.mmc.pms.page.PageResult; import com.mmc.pms.page.PageResult;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Set; import java.util.Set;
/** /**
...@@ -42,10 +43,13 @@ public interface CategoriesService { ...@@ -42,10 +43,13 @@ public interface CategoriesService {
ResultBody getDirectoryList(Integer type); ResultBody getDirectoryList(Integer type);
ResultBody queryCategoryInfoByType(Integer type);
List<Categories> getCategoriesListByDirectoryName(String directoryName); List<Categories> getCategoriesListByDirectoryName(String directoryName);
ResultBody getApplicationList(String directoryName); ResultBody getApplicationList(String directoryName);
List<Categories> getCategoriesListByIds(Set<Integer> ids); List<Categories> getCategoriesListByIds(Set<Integer> ids);
List<AllCategoryDTO> feigQqueryCategoryInfoByType(Integer type);
} }
package com.mmc.pms.service; package com.mmc.pms.service;
import com.mmc.pms.common.ResultBody; 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.OrderGoodsIndstDTO;
import com.mmc.pms.model.order.dto.OrderGoodsProdDTO; import com.mmc.pms.model.order.dto.OrderGoodsProdDTO;
import com.mmc.pms.model.qo.MallOrderGoodsInfoQO; import com.mmc.pms.model.qo.MallOrderGoodsInfoQO;
import com.mmc.pms.model.qo.ProductSpecPriceQO; import com.mmc.pms.model.qo.ProductSpecPriceQO;
import com.mmc.pms.model.sale.dto.MallGoodsShopCarDTO; import com.mmc.pms.model.sale.dto.MallGoodsShopCarDTO;
import com.mmc.pms.model.sale.dto.MallProductSpecPriceDTO; 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.model.sale.vo.GoodsAddVO;
import com.mmc.pms.page.PageResult;
import java.util.List; import java.util.List;
...@@ -19,21 +21,29 @@ import java.util.List; ...@@ -19,21 +21,29 @@ import java.util.List;
*/ */
public interface GoodsInfoService { public interface GoodsInfoService {
ResultBody addGoods(GoodsAddVO goodsAddVO); ResultBody addGoods(GoodsAddVO goodsAddVO);
ResultBody editGoodsInfo(GoodsAddVO goodsAddVO);
ResultBody getGoodsInfoDetail(Integer goodsInfoId, Integer type, Integer leaseTerm);
ResultBody getSkuUnit();
ResultBody getSaleServiceInfoToList();
ResultBody editGoodsInfo(GoodsAddVO goodsAddVO); List<MallGoodsShopCarDTO> fillGoodsInfo(List<MallGoodsShopCarDTO> param);
ResultBody getGoodsInfoDetail(Integer goodsInfoId); List<MallProductSpecPriceDTO> feignListProductSpecPrice(ProductSpecPriceQO productSpecPriceQO);
ResultBody getSkuUnit(); ProductSpecPriceDTO feignGetUnitPriceByTag(Integer specId, Integer tagId);
List<MallGoodsShopCarDTO> fillGoodsInfo(List<MallGoodsShopCarDTO> param); List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO);
List<MallProductSpecPriceDTO> feignListProductSpecPrice(ProductSpecPriceQO productSpecPriceQO); List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO);
ProductSpecPriceDTO feignGetUnitPriceByTag(Integer specId, Integer tagId); PageResult listPageGoodsInfo(MallGoodsQO param);
List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO); ResultBody batchOnShelfOrTakeDown(List<Integer> goodsIds, Integer status);
List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO); ResultBody batchRemoveWareInfo(List<Integer> ids);
} }
package com.mmc.pms.service.Impl; 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.common.ResultBody;
import com.mmc.pms.constant.DateConstant;
import com.mmc.pms.dao.BackstageTaskServiceDao; import com.mmc.pms.dao.BackstageTaskServiceDao;
import com.mmc.pms.dao.CategoriesDao; import com.mmc.pms.dao.CategoriesDao;
import com.mmc.pms.entity.Categories; import com.mmc.pms.entity.Categories;
import com.mmc.pms.entity.InspComtDO;
import com.mmc.pms.entity.ServiceDO; import com.mmc.pms.entity.ServiceDO;
import com.mmc.pms.feign.UserAppApi;
import com.mmc.pms.model.qo.ServiceQO; import com.mmc.pms.model.qo.ServiceQO;
import com.mmc.pms.model.work.dto.ServiceDTO; 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.ServiceVO;
import com.mmc.pms.model.work.vo.UpAndDownServiceVO;
import com.mmc.pms.page.PageResult; import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.BackstageTaskService; 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.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.servlet.http.HttpServletRequest;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* @Author LW * @Author LW
* @date 2023/6/8 9:59 *
* 概要: * @date 2023/6/8 9:59 概要:
*/ */
@Service @Service
@Slf4j
public class BackstageTaskServiceImpl implements BackstageTaskService { public class BackstageTaskServiceImpl implements BackstageTaskService {
@Autowired @Autowired private BackstageTaskServiceDao backstageTaskServiceDao;
private BackstageTaskServiceDao backstageTaskServiceDao;
@Autowired @Autowired private CategoriesDao categoriesDao;
private CategoriesDao categoriesDao;
@Override @Autowired private UserAppApi userAppApi;
public ResultBody addWorkService(ServiceVO param, Integer userAccountId) {
ServiceDO serviceDO = new ServiceDO(param, userAccountId); @Autowired private InspComtService inspComtService;
backstageTaskServiceDao.insert(serviceDO);
return ResultBody.success(); @Autowired private RedisTemplate redisTemplate;
@Override
public ResultBody addWorkService(ServiceVO param, Integer userAccountId) {
ServiceDO serviceDO = new ServiceDO(param, userAccountId);
backstageTaskServiceDao.insert(serviceDO);
return ResultBody.success();
}
@Override
public ResultBody updateById(ServiceVO param) {
ServiceDO serviceDO = new ServiceDO(param);
backstageTaskServiceDao.update(serviceDO);
return ResultBody.success();
}
@Override
public ResultBody deleteByIds(List<Integer> ids) {
if(!CollectionUtils.isEmpty(ids)){
backstageTaskServiceDao.deleteByIds(ids);
} }
return ResultBody.success();
}
@Override @Override
public ResultBody updateById(ServiceVO param) { public ResultBody<ServiceDTO> queryById(Integer id) {
ServiceDO serviceDO = new ServiceDO(param); ServiceDO serviceDO = backstageTaskServiceDao.queryById(id);
backstageTaskServiceDao.update(serviceDO); ServiceDTO serviceDTO = new ServiceDTO(serviceDO);
return ResultBody.success(); 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)) {
return new HashMap<>();
}
Set<Integer> idSet = new HashSet<>();
for (Integer id : ids) {
idSet.add(id);
}
List<Categories> categories = categoriesDao.getCategoriesListByIds(idSet);
if (CollectionUtils.isEmpty(categories)) {
return new HashMap<>();
} }
return categories.stream()
.collect(Collectors.toMap(Categories::getId, d -> d.getName(), (k1, k2) -> k1));
}
@Override @Override
public ResultBody deleteById(Integer id) { public PageResult queryServiceManagerList(ServiceQO param, Integer userAccountId) {
backstageTaskServiceDao.deleteById(id); int count = backstageTaskServiceDao.count(param);
return ResultBody.success(); 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 -> {
ServiceDTO serviceDTO = new ServiceDTO(d);
serviceDTO.setApplicationName(categoriesNameMap.get(d.getApplicationId()));
serviceDTO.setIndustryName(categoriesNameMap.get(d.getIndustryId()));
return serviceDTO;
})
.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 @Override
public ResultBody queryById(Integer id) { public ResultBody batchUpAndDownWorkService(UpAndDownServiceVO param) {
ServiceDO serviceDO = backstageTaskServiceDao.queryById(id); if(!CollectionUtils.isEmpty(param.getIds())){
ServiceDTO serviceDTO = new ServiceDTO(serviceDO); backstageTaskServiceDao.batchUpAndDownWorkService(param);
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()));
}
return ResultBody.success(serviceDTO);
} }
return ResultBody.success();
}
private Map<Integer,String> getCategoriesNameByIds(List<Integer> ids){ private List<WorkServiceDTO> getWorkServiceDTOS(List<ServiceDO> pageList) {
if(CollectionUtils.isEmpty(ids)){ // 用户暂时无关联公司数据,先用假数据展示
return new HashMap<>(); String companyName = "浙江科比特创新科技有限公司";
} List<WorkServiceDTO> workServiceDTOList = new ArrayList<>();
Set<Integer> idSet = new HashSet<>(); for (ServiceDO item : pageList) {
for (Integer id : ids) { WorkServiceDTO workServiceDTO = WorkServiceDTO.builder().id(item.getId()).serviceName(item.getServiceName()).companyName(companyName)
idSet.add(id); .coverPlan(item.getCoverPlan()).serviceIntroduction(item.getServiceIntroduction()).video(item.getVideo()).shareCard(item.getShareCard()).build();
} workServiceDTOList.add(workServiceDTO);
List<Categories> categories = categoriesDao.getCategoriesListByIds(idSet);
if(CollectionUtils.isEmpty(categories)){
return new HashMap<>();
}
return categories.stream().collect(Collectors.toMap(Categories::getId, d -> d.getName(), (k1, k2) -> k1));
} }
return workServiceDTOList;
}
@Override /**
public PageResult queryWorkServiceList(ServiceQO param, Integer userAccountId) { * 根据id随机获取50条以上的评论
int count = backstageTaskServiceDao.count(param); */
if(count == 0){ private List<InspComtDO> RandomGetInspComt(Integer id) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(),count); String listStr = (String) redisTemplate.opsForValue().get(id);
} List<InspComtDO> inspComtRandomList = null;
Integer pageNo = param.getPageNo(); if(StringUtils.isNotBlank(listStr)){
param.buildCurrentPage(); inspComtRandomList = JSONArray.parseArray(listStr, InspComtDO.class);
List<ServiceDO> services = backstageTaskServiceDao.queryAllByLimit(param); }else {
List<Integer> list = new ArrayList<>(); inspComtRandomList = inspComtService.randomGetInspComtList(RandomUtils.nextInt(50, 9999));
for (ServiceDO service : services) { String toJSONString = JSONObject.toJSONString(inspComtRandomList);
list.add(service.getApplicationId()); redisTemplate.opsForValue().set(id, toJSONString, 2L, TimeUnit.DAYS);
list.add(service.getIndustryId());
}
Map<Integer, String> categoriesNameMap = getCategoriesNameByIds(list);
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);
} }
return inspComtRandomList;
}
} }
package com.mmc.pms.service.Impl; package com.mmc.pms.service.Impl;
import com.google.common.collect.Lists; import com.alibaba.fastjson.JSONObject;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum; import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.dao.CategoriesDao; import com.mmc.pms.dao.CategoriesDao;
...@@ -9,9 +9,10 @@ import com.mmc.pms.dao.GoodsInfoDao; ...@@ -9,9 +9,10 @@ import com.mmc.pms.dao.GoodsInfoDao;
import com.mmc.pms.entity.Categories; import com.mmc.pms.entity.Categories;
import com.mmc.pms.entity.DirectoryDO; import com.mmc.pms.entity.DirectoryDO;
import com.mmc.pms.entity.GoodsInfo; import com.mmc.pms.entity.GoodsInfo;
import com.mmc.pms.model.categories.dto.AllCategoryDTO;
import com.mmc.pms.model.categories.dto.CategoriesDTO; import com.mmc.pms.model.categories.dto.CategoriesDTO;
import com.mmc.pms.model.categories.dto.CategoriesInfoListDTO;
import com.mmc.pms.model.categories.dto.ClassifyInfoDTO; 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.ClassifyInfoVO;
import com.mmc.pms.model.categories.vo.DirectoryInfoVO; import com.mmc.pms.model.categories.vo.DirectoryInfoVO;
import com.mmc.pms.model.categories.vo.RelevantBusinessVO; import com.mmc.pms.model.categories.vo.RelevantBusinessVO;
...@@ -35,207 +36,278 @@ import java.util.stream.Collectors; ...@@ -35,207 +36,278 @@ import java.util.stream.Collectors;
*/ */
@Service @Service
public class CategoriesServiceImpl implements CategoriesService { public class CategoriesServiceImpl implements CategoriesService {
@Autowired @Autowired private CategoriesDao categoriesDao;
private CategoriesDao categoriesDao; @Resource private GoodsInfoDao goodsInfoDao;
@Resource @Autowired private DirectoryDao directoryDao;
private GoodsInfoDao goodsInfoDao;
@Autowired @Override
private DirectoryDao directoryDao; public ResultBody addOrEditDirectory(DirectoryInfoVO param) {
int type = categoriesDao.countUpdateDirectoryName(param);
@Override if (type > 0) {
public ResultBody addOrEditDirectory(DirectoryInfoVO param) { return ResultBody.error(ResultEnum.DIRECTORY_NAME_HAS_BEEN_EXIST);
int type = categoriesDao.countUpdateDirectoryName(param);
if (type > 0) {
return ResultBody.error(ResultEnum.DIRECTORY_NAME_HAS_BEEN_EXIST);
}
DirectoryDO directory = new DirectoryDO(param);
if (param.getId() == null) {
categoriesDao.insertDirectory(directory);
} else {
int count = categoriesDao.selectDirectoryById(param.getId());
if (count > 0) {
return ResultBody.error("默认目录不可修改!");
}
categoriesDao.updateDirectory(directory);
}
return ResultBody.success();
} }
DirectoryDO directory = new DirectoryDO(param);
if (param.getId() == null) {
categoriesDao.insertDirectory(directory);
} else {
// 获取默认目录信息
DirectoryDO directoryDO = categoriesDao.selectDirectoryById(param.getId());
if (directoryDO != null && !directoryDO.getDirectoryName().equals(param.getDirectoryName())) {
return ResultBody.error(ResultEnum.DEFAULT_DIRECTORY);
}
categoriesDao.updateDirectory(directory);
}
return ResultBody.success();
}
@Override @Override
public PageResult directoryList(Integer pageNo, Integer pageSize, Integer type) { public PageResult directoryList(Integer pageNo, Integer pageSize, Integer type) {
int count = categoriesDao.countDirectoryList(); int count = categoriesDao.countDirectoryList();
if (count == 0) { if (count == 0) {
return PageResult.buildPage(pageNo, pageSize, count); return PageResult.buildPage(pageNo, pageSize, count);
}
List<DirectoryDO> directoryList = categoriesDao.directoryList((pageNo - 1) * pageSize, pageSize, type);
List<DirectoryInfoVO> list = directoryList.stream().map(DirectoryDO::buildDirectoryInfoVO).collect(Collectors.toList());
return PageResult.buildPage(pageNo, pageSize, count, list);
} }
List<DirectoryDO> directoryList =
categoriesDao.directoryList((pageNo - 1) * pageSize, pageSize, type);
List<DirectoryInfoVO> list =
directoryList.stream().map(DirectoryDO::buildDirectoryInfoVO).collect(Collectors.toList());
return PageResult.buildPage(pageNo, pageSize, count, list);
}
@Override @Override
public ResultBody removeDirectory(Integer id) { public ResultBody removeDirectory(Integer id) {
// 查询该目录下是否有分类有的话就不给删除 // 查询该目录下是否有分类有的话就不给删除
int count = categoriesDao.countDirectory(id); int count = categoriesDao.countDirectory(id);
if (count > 0) { if (count > 0) {
return ResultBody.error(ResultEnum.THERE_ARE_CATEGORIES_IN_THE_DIRECTORY); return ResultBody.error(ResultEnum.THERE_ARE_CATEGORIES_IN_THE_DIRECTORY);
} }
categoriesDao.removeDirectory(id); DirectoryDO defaultCount = categoriesDao.selectDirectoryById(id);
return ResultBody.success(); if (defaultCount != null) {
return ResultBody.error(ResultEnum.DEFAULT_DIRECTORY);
} }
categoriesDao.removeDirectory(id);
return ResultBody.success();
}
@Override @Override
public ResultBody addClassification(ClassifyInfoVO classifyInfoVO) { public ResultBody addClassification(ClassifyInfoVO classifyInfoVO) {
int count = categoriesDao.countClassificationByName(classifyInfoVO); int count = categoriesDao.countClassificationByName(classifyInfoVO);
if (count > 0) { if (count > 0) {
return ResultBody.error(ResultEnum.WARE_TYPE_NAME_HAS_BEEN_EXIST); return ResultBody.error(ResultEnum.WARE_TYPE_NAME_HAS_BEEN_EXIST);
}
Categories categories = new Categories(classifyInfoVO);
if (classifyInfoVO.getPid() == 0) {
if (classifyInfoVO.getIcon() != null) {
int typeCount = categoriesDao.getCountCategoriesByPid(0, classifyInfoVO.getType());
categories.setSort(typeCount + 1);
categoriesDao.insertClassification(categories);
} else {
return ResultBody.error(ResultEnum.WARE_TYPE_ICON_NOT_NULL);
}
} else {
categoriesDao.insertClassification(categories);
}
return ResultBody.success();
} }
Categories categories = new Categories(classifyInfoVO);
if (classifyInfoVO.getPid() == 0) {
if (classifyInfoVO.getIcon() != null) {
int typeCount = categoriesDao.getCountCategoriesByPid(0, classifyInfoVO.getType());
categories.setSort(typeCount + 1);
categoriesDao.insertClassification(categories);
} else {
return ResultBody.error(ResultEnum.WARE_TYPE_ICON_NOT_NULL);
}
} else {
categoriesDao.insertClassification(categories);
}
return ResultBody.success();
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResultBody updateClassification(ClassifyInfoVO classifyInfoVO) { public ResultBody updateClassification(ClassifyInfoVO classifyInfoVO) {
int count = categoriesDao.countClassificationByName(classifyInfoVO); int count = categoriesDao.countClassificationByName(classifyInfoVO);
if (count > 0) { if (count > 0) {
return ResultBody.error(ResultEnum.WARE_TYPE_NAME_HAS_BEEN_EXIST); return ResultBody.error(ResultEnum.WARE_TYPE_NAME_HAS_BEEN_EXIST);
}
if (classifyInfoVO.getPid() == 0) {
if (classifyInfoVO.getIcon() != null) {
categoriesDao.updateClassification(classifyInfoVO);
} else {
return ResultBody.error(ResultEnum.WARE_TYPE_ICON_NOT_NULL);
}
} else {
categoriesDao.updateClassification(classifyInfoVO);
}
return ResultBody.success();
}
@Override
@Transactional(rollbackFor = Exception.class)
public ResultBody exchangeSortType(Integer firstId, Integer secondId) {
Categories firstCategories = categoriesDao.getGoodsGroupById(firstId);
Categories secondCategories = categoriesDao.getGoodsGroupById(secondId);
int updateCount1 = categoriesDao.updateTypeSort(firstId, secondCategories.getSort());
int updateCount2 = categoriesDao.updateTypeSort(secondId, firstCategories.getSort());
if (updateCount1 == updateCount2) {
return ResultBody.success();
} else {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return ResultBody.error("排序失败");
}
} }
if (classifyInfoVO.getPid() == 0) {
if (classifyInfoVO.getIcon() != null) {
categoriesDao.updateClassification(classifyInfoVO);
} else {
return ResultBody.error(ResultEnum.WARE_TYPE_ICON_NOT_NULL);
}
} else {
categoriesDao.updateClassification(classifyInfoVO);
}
return ResultBody.success();
}
@Override @Override
public PageResult getClassificationList(QueryClassifyVO queryClassifyVO) { @Transactional(rollbackFor = Exception.class)
int count = categoriesDao.countListClassification(queryClassifyVO); public ResultBody exchangeSortType(Integer firstId, Integer secondId) {
if (count == 0) { Categories firstCategories = categoriesDao.getGoodsGroupById(firstId);
return PageResult.buildPage(queryClassifyVO.getPageNo(), queryClassifyVO.getPageSize(), count); Categories secondCategories = categoriesDao.getGoodsGroupById(secondId);
} int updateCount1 = categoriesDao.updateTypeSort(firstId, secondCategories.getSort());
int updateCount2 = categoriesDao.updateTypeSort(secondId, firstCategories.getSort());
if (updateCount1 == updateCount2) {
return ResultBody.success();
} else {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return ResultBody.error("排序失败");
}
}
@Override
public PageResult getClassificationList(QueryClassifyVO queryClassifyVO) {
int count = categoriesDao.countListClassification(queryClassifyVO);
if (count == 0) {
return PageResult.buildPage(
queryClassifyVO.getPageNo(), queryClassifyVO.getPageSize(), count);
}
int pageNo = queryClassifyVO.getPageNo(); int pageNo = queryClassifyVO.getPageNo();
queryClassifyVO.buildCurrentPage(); queryClassifyVO.buildCurrentPage();
List<Categories> categories = categoriesDao.selectAllClassification(queryClassifyVO); List<Categories> categories = categoriesDao.selectAllClassification(queryClassifyVO);
List<ClassifyInfoDTO> categoriesList = categories.stream().map(Categories::buildClassifyInfoDTO).collect(Collectors.toList()); List<ClassifyInfoDTO> categoriesList =
categories.stream().map(Categories::buildClassifyInfoDTO).collect(Collectors.toList());
List<ClassifyInfoDTO> topLevelCategories = new ArrayList<>(); List<ClassifyInfoDTO> topLevelCategories = new ArrayList<>();
Map<Integer, ClassifyInfoDTO> categoriesMap = new HashMap<>(); Map<Integer, ClassifyInfoDTO> categoriesMap = new HashMap<>();
// 将每个数据模型对象添加到Map中,以便在递归过程中查找它们的父母 // 将每个数据模型对象添加到Map中,以便在递归过程中查找它们的父母
for (ClassifyInfoDTO category : categoriesList) { for (ClassifyInfoDTO category : categoriesList) {
category.setChildren(new ArrayList<>()); category.setChildren(new ArrayList<>());
categoriesMap.put(category.getId(), category); categoriesMap.put(category.getId(), category);
}
// 构建树结构
for (ClassifyInfoDTO category : categoriesList) {
if (category.getPid() == 0) {
topLevelCategories.add(category);
} else {
ClassifyInfoDTO parent = categoriesMap.get(category.getPid());
parent.getChildren().add(category);
}
}
return PageResult.buildPage(pageNo, queryClassifyVO.getPageSize(), count, topLevelCategories);
}
@Override
public ResultBody getClassifyDetails(Integer id) {
Categories goodsGroup = categoriesDao.getGoodsGroupById(id);
return ResultBody.success(goodsGroup == null ? null : goodsGroup.buildClassifyDetailsDTO()
);
}
@Override
public ResultBody queryRelevantBusiness(Integer id, Integer type) {
RelevantBusinessVO relevantBusinessVO = new RelevantBusinessVO();
switch (type) {
case 0:
List<GoodsInfo> goodsInfo = goodsInfoDao.ListGoodsInfoByCategoryId(id);
if (CollectionUtils.isNotEmpty(goodsInfo)) {
relevantBusinessVO.setRelevanceGoodsInfoVOs(goodsInfo.stream().map(GoodsInfo::buildRelevanceGoodsInfoVO).collect(Collectors.toList()));
return ResultBody.success(relevantBusinessVO);
}
break;
default:
return ResultBody.error("输入类型有误!");
}
return ResultBody.success();
} }
// 构建树结构
@Override for (ClassifyInfoDTO category : categoriesList) {
public ResultBody getDirectoryList(Integer type) { if (category.getPid() == 0) {
List<DirectoryDO> directoryList = categoriesDao.getDirectoryList(type); topLevelCategories.add(category);
List<DirectoryInfoVO> list = directoryList.stream().map(DirectoryDO::buildDirectoryInfoVO).collect(Collectors.toList()); } else {
return ResultBody.success(list); ClassifyInfoDTO parent = categoriesMap.get(category.getPid());
parent.getChildren().add(category);
}
} }
return PageResult.buildPage(pageNo, queryClassifyVO.getPageSize(), count, topLevelCategories);
}
@Override @Override
public List<Categories> getCategoriesListByDirectoryName(String directoryName) { public ResultBody getClassifyDetails(Integer id) {
DirectoryDO directoryDO = directoryDao.getDirectoryByName(directoryName); Categories goodsGroup = categoriesDao.getGoodsGroupById(id);
List<Categories> categories = categoriesDao.getCategoriesByDirectoryId(directoryDO.getId()); return ResultBody.success(goodsGroup == null ? null : goodsGroup.buildClassifyDetailsDTO());
return categories; }
}
@Override @Override
public ResultBody getApplicationList(String directoryName) { public ResultBody queryRelevantBusiness(Integer id, Integer type) {
List<Categories> categories = getCategoriesListByDirectoryName(directoryName); RelevantBusinessVO relevantBusinessVO = new RelevantBusinessVO();
if(org.springframework.util.CollectionUtils.isEmpty(categories)){ switch (type) {
return ResultBody.success(); case 0:
List<GoodsInfo> goodsInfo = goodsInfoDao.ListGoodsInfoByCategoryId(id);
if (CollectionUtils.isNotEmpty(goodsInfo)) {
relevantBusinessVO.setRelevanceGoodsInfoVOs(
goodsInfo.stream()
.map(GoodsInfo::buildRelevanceGoodsInfoVO)
.collect(Collectors.toList()));
return ResultBody.success(relevantBusinessVO);
} }
List<CategoriesDTO> collect = categories.stream().map(CategoriesDTO::new).collect(Collectors.toList()); break;
return ResultBody.success(collect); default:
return ResultBody.error("输入类型有误!");
} }
return ResultBody.success();
}
@Override @Override
public List<Categories> getCategoriesListByIds(Set<Integer> ids) { public ResultBody getDirectoryList(Integer type) {
if(CollectionUtils.isEmpty(ids)){ List<DirectoryDO> directoryList = categoriesDao.getDirectoryList(type);
return null; List<DirectoryInfoVO> list =
} directoryList.stream().map(DirectoryDO::buildDirectoryInfoVO).collect(Collectors.toList());
return categoriesDao.getCategoriesListByIds(ids); return ResultBody.success(list);
} }
@Override
public List<Categories> getCategoriesListByDirectoryName(String directoryName) {
DirectoryDO directoryDO = directoryDao.getDirectoryByName(directoryName);
List<Categories> categories = categoriesDao.getCategoriesByDirectoryId(directoryDO.getId());
return categories;
}
@Override @Override
public ResultBody deleteRelevantBusiness(Integer id) { public ResultBody getApplicationList(String directoryName) {
int count = categoriesDao.deleteById(id); List<Categories> categories = getCategoriesListByDirectoryName(directoryName);
return ResultBody.success(); if (org.springframework.util.CollectionUtils.isEmpty(categories)) {
return ResultBody.success();
} }
List<CategoriesDTO> collect =
categories.stream().map(CategoriesDTO::new).collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public List<Categories> getCategoriesListByIds(Set<Integer> ids) {
if (CollectionUtils.isEmpty(ids)) {
return null;
}
return categoriesDao.getCategoriesListByIds(ids);
}
} @Override
public List<AllCategoryDTO> feigQqueryCategoryInfoByType(Integer type) {
List<DirectoryDO> categoryDirectoryList = getCategoryDirectoryList(type);
if (CollectionUtils.isNotEmpty(categoryDirectoryList)) {
List<AllCategoryDTO> allCategoryDTOList =
categoryDirectoryList.stream()
.map(DirectoryDO::buildAllCategoryDTO)
.collect(Collectors.toList());
Map<Integer, List<CategoriesInfoListDTO>> categoryMap = getCategoryMap(allCategoryDTOList);
addSubCategories(allCategoryDTOList, categoryMap);
System.out.println("Res: " + JSONObject.toJSON(allCategoryDTOList));
return allCategoryDTOList;
}
return null;
}
@Override
public ResultBody deleteRelevantBusiness(Integer id) {
int count = goodsInfoDao.countGoodsInfoByCategoryId(id);
if (count > 0) {
return ResultBody.error(ResultEnum.GROUP_DONT_DELETE);
}
// 获取分类信息
Categories categories = categoriesDao.getGoodsGroupById(id);
if (categories != null && categories.getParentId().equals(0)) {
int childCount = categoriesDao.countChildById(id);
if (childCount > 0) {
return ResultBody.error(ResultEnum.GROUP_DONT_DELETE_BY_CHILD);
}
}
categoriesDao.deleteById(id);
return ResultBody.success();
}
@Override
public ResultBody queryCategoryInfoByType(Integer type) {
List<DirectoryDO> categoryDirectoryList = getCategoryDirectoryList(type);
if (CollectionUtils.isNotEmpty(categoryDirectoryList)) {
List<AllCategoryDTO> allCategoryDTOList =
categoryDirectoryList.stream()
.map(DirectoryDO::buildAllCategoryDTO)
.collect(Collectors.toList());
Map<Integer, List<CategoriesInfoListDTO>> categoryMap = getCategoryMap(allCategoryDTOList);
addSubCategories(allCategoryDTOList, categoryMap);
return ResultBody.success(allCategoryDTOList);
}
return ResultBody.success();
}
private List<DirectoryDO> getCategoryDirectoryList(Integer type) {
return categoriesDao.getDirectoryList(type);
}
private Map<Integer, List<CategoriesInfoListDTO>> getCategoryMap(
List<AllCategoryDTO> allCategoryDTOList) {
List<Integer> directoryIdIds =
allCategoryDTOList.stream()
.map(AllCategoryDTO::getDirectoryId)
.collect(Collectors.toList());
List<Categories> categoriesList = categoriesDao.selectCategoryByDirectoryId(directoryIdIds);
return categoriesList.stream()
.map(Categories::buildCategoriesInfoListDTO)
.collect(Collectors.groupingBy(CategoriesInfoListDTO::getDirectoryId));
}
private void addSubCategories(
List<AllCategoryDTO> allCategoryDTOList,
Map<Integer, List<CategoriesInfoListDTO>> categoryMap) {
for (AllCategoryDTO allCategoryDTO : allCategoryDTOList) {
Optional.ofNullable(categoryMap.get(allCategoryDTO.getDirectoryId()))
.ifPresent(allCategoryDTO::setCategoriesInfoListDTO);
}
}
}
...@@ -12,7 +12,9 @@ import com.mmc.pms.model.order.dto.OrderGoodsProdDetailDTO; ...@@ -12,7 +12,9 @@ import com.mmc.pms.model.order.dto.OrderGoodsProdDetailDTO;
import com.mmc.pms.model.qo.MallOrderGoodsInfoQO; import com.mmc.pms.model.qo.MallOrderGoodsInfoQO;
import com.mmc.pms.model.qo.ProductSpecPriceQO; import com.mmc.pms.model.qo.ProductSpecPriceQO;
import com.mmc.pms.model.sale.dto.*; import com.mmc.pms.model.sale.dto.*;
import com.mmc.pms.model.sale.qo.MallGoodsQO;
import com.mmc.pms.model.sale.vo.*; import com.mmc.pms.model.sale.vo.*;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.GoodsInfoService; import com.mmc.pms.service.GoodsInfoService;
import com.mmc.pms.util.CodeUtil; import com.mmc.pms.util.CodeUtil;
import com.mmc.pms.util.TDateUtil; import com.mmc.pms.util.TDateUtil;
...@@ -32,821 +34,1112 @@ import java.util.stream.Collectors; ...@@ -32,821 +34,1112 @@ import java.util.stream.Collectors;
@Service @Service
public class GoodsInfoServiceImpl implements GoodsInfoService { public class GoodsInfoServiceImpl implements GoodsInfoService {
@Resource @Resource private GoodsInfoDao goodsInfoDao;
private GoodsInfoDao goodsInfoDao;
@Resource @Resource private ProductDao productDao;
private ProductDao productDao;
@Resource @Resource private ProductServiceImpl productSkuService;
private ProductServiceImpl productSkuService;
@Resource @Resource private IndustrySpecDao industrySpecDao;
private IndustrySpecDao industrySpecDao;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResultBody addGoods(GoodsAddVO goodsAddVO) { public ResultBody addGoods(GoodsAddVO goodsAddVO) {
// 判断商品名称是否存在 // 判断商品名称是否存在
if (goodsInfoDao.countGoodsInfoByName(goodsAddVO) > 0) { if (goodsInfoDao.countGoodsInfoByName(goodsAddVO) > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR); return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
// 判断商品详情中描述是否为空
if (goodsAddVO.getGoodsDetailVO().getGoodsDesc() == null) {
return ResultBody.error(ResultEnum.GOODS_DESC_IS_NOT_NULL);
}
String YYYY_MM_DD_HH_MM_SS = "yyyyMMddHHmmss";
// 初始化商品对象,并构建对象
GoodsInfo goodsInfo = new GoodsInfo(goodsAddVO);
goodsInfo.setGoodsNo("IUAV" + TDateUtil.getDateStr(new Date(), YYYY_MM_DD_HH_MM_SS) + CodeUtil.getRandomNum(4));
// 暂未接入用户默认传1
goodsInfo.setAddGoodsUserId(1);
goodsInfo.setSort(goodsInfoDao.countGoodsInfo() + 1);
// 插入商品基本信息
goodsInfoDao.insertGoodsInfo(goodsInfo);
// 调用图片视频插入信息方法
addGoodsImageInfo(goodsInfo.getId(), goodsAddVO);
// 调用商品详情信息方法
addGoodsDetail(goodsInfo.getId(), goodsAddVO.getGoodsDetailVO());
// 判断其他服务是否为空,不为空则插入
if (!CollectionUtils.isEmpty(goodsAddVO.getOtherService())) {
addOtherService(goodsAddVO.getOtherService(), goodsInfo.getId());
}
// 调用产品规格的新增方法
if (!goodsAddVO.getDirectoryId().equals(2)) {
// 添加产品规格信息
productSkuSpecOperation(goodsInfo, goodsAddVO.getProductSpec());
} else {
industrySkuSpecOperation(goodsInfo, goodsAddVO.getProductSpec());
}
return ResultBody.success();
}
/**
* 插入行业sku及规格信息
*/
@Transactional(rollbackFor = Exception.class)
public void industrySkuSpecOperation(GoodsInfo goodsInfo, List<GoodsProdSpecVO> productSpec) {
for (GoodsProdSpecVO goodsSpecVO : productSpec) {
MallIndustrySkuInfoDO mallIndustrySkuInfoDO = new MallIndustrySkuInfoDO(goodsSpecVO).setGoodsInfoId(goodsInfo.getId());
// 插入数据库商品对应的sku信息
goodsInfoDao.insertMallIndustrySkuInfo(mallIndustrySkuInfoDO);
for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) {
// 构建商品对应的规格信息
MallIndustrySkuInfoSpecDO mallIndustrySkuInfoSpecDO = new MallIndustrySkuInfoSpecDO()
.setIndustrySpecId(mallProductSpecVO.getMallSpecId())
.setMallIndustrySkuInfoId(mallIndustrySkuInfoDO.getId())
.setGoodsInfoId(goodsInfo.getId());
// 插入数据库商品对应的规格信息
goodsInfoDao.insertMallIndustrySkuInfoSpec(mallIndustrySkuInfoSpecDO);
}
}
} }
// 判断商品详情中描述是否为空
if (goodsAddVO.getGoodsDetailVO().getGoodsDesc() == null) {
return ResultBody.error(ResultEnum.GOODS_DESC_IS_NOT_NULL);
}
String YYYY_MM_DD_HH_MM_SS = "yyyyMMddHHmmss";
// 初始化商品对象,并构建对象
GoodsInfo goodsInfo = new GoodsInfo(goodsAddVO);
goodsInfo.setGoodsNo(
"IUAV" + TDateUtil.getDateStr(new Date(), YYYY_MM_DD_HH_MM_SS) + CodeUtil.getRandomNum(4));
// 暂未接入用户默认传1
goodsInfo.setAddGoodsUserId(1);
goodsInfo.setSort(goodsInfoDao.countGoodsInfo() + 1);
// 插入商品基本信息
goodsInfoDao.insertGoodsInfo(goodsInfo);
// 调用图片视频插入信息方法
addGoodsImageInfo(goodsInfo.getId(), goodsAddVO);
// 调用商品详情信息方法
addGoodsDetail(goodsInfo.getId(), goodsAddVO.getGoodsDetailVO());
// 判断其他服务是否为空,不为空则插入
if (!CollectionUtils.isEmpty(goodsAddVO.getOtherService())) {
addOtherService(goodsAddVO.getOtherService(), goodsInfo.getId());
}
// 调用产品规格的新增方法
if (!goodsAddVO.getDirectoryId().equals(2)) {
// 添加产品规格信息
productSkuSpecOperation(goodsInfo, goodsAddVO.getProductSpec());
} else {
industrySkuSpecOperation(goodsInfo, goodsAddVO.getProductSpec());
}
return ResultBody.success();
}
@Transactional(rollbackFor = Exception.class) /** 插入行业sku及规格信息 */
public void productSkuSpecOperation(GoodsInfo goodsInfo, List<GoodsProdSpecVO> productSpec) { @Transactional(rollbackFor = Exception.class)
// 遍历规格信息,获取其中自定义的规格信息 public void industrySkuSpecOperation(GoodsInfo goodsInfo, List<GoodsProdSpecVO> productSpec) {
List<GoodsProdSpecVO> customGoodsSpecList = productSpec.stream().filter(spec -> spec.getFlag().equals(1)).collect(Collectors.toList()); for (GoodsProdSpecVO goodsSpecVO : productSpec) {
if (CollectionUtils.isNotEmpty(customGoodsSpecList)) { MallIndustrySkuInfoDO mallIndustrySkuInfoDO =
addCustomization(goodsInfo, customGoodsSpecList); new MallIndustrySkuInfoDO(goodsSpecVO).setGoodsInfoId(goodsInfo.getId());
} // 插入数据库商品对应的sku信息
// 遍历规格信息,获取其中非自定义的规格信息 goodsInfoDao.insertMallIndustrySkuInfo(mallIndustrySkuInfoDO);
List<GoodsProdSpecVO> goodsSpecList = productSpec.stream().filter(spec -> spec.getFlag().equals(0)).collect(Collectors.toList()); for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) {
for (GoodsProdSpecVO goodsSpecVO : goodsSpecList) { // 构建商品对应的规格信息
MallProdInfoDO mallProdSkuInfoDO = new MallProdInfoDO(goodsSpecVO) MallIndustrySkuInfoSpecDO mallIndustrySkuInfoSpecDO =
.setProdSkuId(goodsSpecVO.getSkuId()).setGoodsInfoId(goodsInfo.getId()); new MallIndustrySkuInfoSpecDO()
// 插入数据库商品对应的sku信息 .setIndustrySpecId(mallProductSpecVO.getMallSpecId())
goodsInfoDao.insertMallProdSkuInfo(mallProdSkuInfoDO); .setMallIndustrySkuInfoId(mallIndustrySkuInfoDO.getId())
for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) { .setGoodsInfoId(goodsInfo.getId());
// 构建商品对应的规格信息 // 插入数据库商品对应的规格信息
MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO = new MallProdSkuInfoSpecDO() goodsInfoDao.insertMallIndustrySkuInfoSpec(mallIndustrySkuInfoSpecDO);
.setProductSpecId(mallProductSpecVO.getMallSpecId()) }
.setMallProdSkuInfoId(mallProdSkuInfoDO.getId()) }
.setGoodsInfoId(goodsInfo.getId()); }
// 插入数据库商品对应的规格信息
goodsInfoDao.insertMallProdSkuInfoSpec(mallProdSkuInfoSpecDO); @Transactional(rollbackFor = Exception.class)
} public void productSkuSpecOperation(GoodsInfo goodsInfo, List<GoodsProdSpecVO> productSpec) {
} // 遍历规格信息,获取其中自定义的规格信息
List<GoodsProdSpecVO> customGoodsSpecList =
productSpec.stream().filter(spec -> spec.getFlag().equals(1)).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(customGoodsSpecList)) {
addCustomization(goodsInfo, customGoodsSpecList);
}
// 遍历规格信息,获取其中非自定义的规格信息
List<GoodsProdSpecVO> goodsSpecList =
productSpec.stream().filter(spec -> spec.getFlag().equals(0)).collect(Collectors.toList());
for (GoodsProdSpecVO goodsSpecVO : goodsSpecList) {
MallProdInfoDO mallProdSkuInfoDO =
new MallProdInfoDO(goodsSpecVO)
.setProdSkuId(goodsSpecVO.getSkuId())
.setGoodsInfoId(goodsInfo.getId());
// 插入数据库商品对应的sku信息
goodsInfoDao.insertMallProdSkuInfo(mallProdSkuInfoDO);
for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) {
// 构建商品对应的规格信息
MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO =
new MallProdSkuInfoSpecDO()
.setProductSpecId(mallProductSpecVO.getMallSpecId())
.setMallProdSkuInfoId(mallProdSkuInfoDO.getId())
.setGoodsInfoId(goodsInfo.getId());
// 插入数据库商品对应的规格信息
goodsInfoDao.insertMallProdSkuInfoSpec(mallProdSkuInfoSpecDO);
}
} }
}
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public MallProdInfoDO buildMallProdSkuInfo(GoodsInfo goodsInfo, GoodsProdSpecVO goodsSpec, Integer id) { public MallProdInfoDO buildMallProdSkuInfo(
MallProdInfoDO mallProdInfoDO = new MallProdInfoDO(); GoodsInfo goodsInfo, GoodsProdSpecVO goodsSpec, Integer id) {
mallProdInfoDO.setGoodsInfoId(goodsInfo.getId()); MallProdInfoDO mallProdInfoDO = new MallProdInfoDO();
mallProdInfoDO.setProdSkuId(id); mallProdInfoDO.setGoodsInfoId(goodsInfo.getId());
mallProdInfoDO.setProdSkuSpecName(goodsSpec.getGoodsSpecName()); mallProdInfoDO.setProdSkuId(id);
mallProdInfoDO.setCategoriesId(goodsSpec.getCategoryId()); mallProdInfoDO.setProdSkuSpecName(goodsSpec.getGoodsSpecName());
mallProdInfoDO.setChooseType(goodsSpec.getChooseType()); mallProdInfoDO.setCategoriesId(goodsSpec.getCategoryId());
mallProdInfoDO.setMust(goodsSpec.getMust()); mallProdInfoDO.setChooseType(goodsSpec.getChooseType());
mallProdInfoDO.setFlag(goodsSpec.getFlag()); mallProdInfoDO.setMust(goodsSpec.getMust());
mallProdInfoDO.setSkuUnitId(goodsSpec.getSkuUnitId()); mallProdInfoDO.setFlag(goodsSpec.getFlag());
return mallProdInfoDO; mallProdInfoDO.setSkuUnitId(goodsSpec.getSkuUnitId());
} return mallProdInfoDO;
}
@Transactional(rollbackFor = Exception.class)
public void addCustomization(GoodsInfo goodsInfo, List<GoodsProdSpecVO> customGoodsSpecList) { @Transactional(rollbackFor = Exception.class)
// 遍历自定义规格信息 public void addCustomization(GoodsInfo goodsInfo, List<GoodsProdSpecVO> customGoodsSpecList) {
for (GoodsProdSpecVO productSpec : customGoodsSpecList) { // 遍历自定义规格信息
// 构建商品对应的sku信息 for (GoodsProdSpecVO productSpec : customGoodsSpecList) {
ProductSkuDO productSkuDO = new ProductSkuDO().setCategoriesId(productSpec.getCategoryId()) // 构建商品对应的sku信息
.setProductName(productSpec.getProductName()).setCustomize(1) ProductSkuDO productSkuDO =
.setDirectoryId(goodsInfo.getDirectoryId()); new ProductSkuDO()
// 插入产品sku信息 .setCategoriesId(productSpec.getCategoryId())
productDao.insertProductSku(productSkuDO); .setProductName(productSpec.getProductName())
MallProdInfoDO mallProdInfoDO = buildMallProdSkuInfo(goodsInfo, productSpec, productSkuDO.getId()); .setCustomize(1)
// 插入数据库商品对应的sku信息 .setDirectoryId(goodsInfo.getDirectoryId());
productDao.insertMallProdSkuInfo(mallProdInfoDO); // 插入产品sku信息
// 先将自定的信息存储到数据库中 productDao.insertProductSku(productSkuDO);
productSpec.getCustomizeInfo().stream().peek(param -> { MallProdInfoDO mallProdInfoDO =
ProductSpecDO productSpecDO = new ProductSpecDO().setProductSkuId(productSkuDO.getId()) buildMallProdSkuInfo(goodsInfo, productSpec, productSkuDO.getId());
.setVersionDesc("自定义").setSpecImage(param.getSpecImage()) // 插入数据库商品对应的sku信息
.setSpecName(param.getSpecName()).setPartNo(param.getPartNo()); productDao.insertMallProdSkuInfo(mallProdInfoDO);
// 先将自定的信息存储到数据库中
productSpec.getCustomizeInfo().stream()
.peek(
param -> {
ProductSpecDO productSpecDO =
new ProductSpecDO()
.setProductSkuId(productSkuDO.getId())
.setVersionDesc("自定义")
.setSpecImage(param.getSpecImage())
.setSpecName(param.getSpecName())
.setPartNo(param.getPartNo());
// 新增产品sku // 新增产品sku
productDao.insertProductSpec(productSpecDO); productDao.insertProductSpec(productSpecDO);
// 批量配置价格信息 // 批量配置价格信息
ProductSpecCPQVO productSpecCPQVO = param.getProductSpecCPQVO(); ProductSpecCPQVO productSpecCPQVO = param.getProductSpecCPQVO();
if (productSpecCPQVO != null) { if (productSpecCPQVO != null) {
productSpecCPQVO.setProductSpecId(productSpecDO.getId()); productSpecCPQVO.setProductSpecId(productSpecDO.getId());
productSkuService.insertSpecPrice(productSpecCPQVO); productSkuService.insertSpecPrice(productSpecCPQVO);
} }
// 构建商品对应的规格信息 // 构建商品对应的规格信息
MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO = new MallProdSkuInfoSpecDO() MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO =
new MallProdSkuInfoSpecDO()
.setProductSpecId(productSpecDO.getId()) .setProductSpecId(productSpecDO.getId())
.setMallProdSkuInfoId(mallProdInfoDO.getId()) .setMallProdSkuInfoId(mallProdInfoDO.getId())
.setGoodsInfoId(goodsInfo.getId()); .setGoodsInfoId(goodsInfo.getId());
// 插入数据库商品对应的规格信息 // 插入数据库商品对应的规格信息
goodsInfoDao.insertMallProdSkuInfoSpec(mallProdSkuInfoSpecDO); goodsInfoDao.insertMallProdSkuInfoSpec(mallProdSkuInfoSpecDO);
}).collect(Collectors.toList()); })
} .collect(Collectors.toList());
} }
}
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void addOtherService(List<Integer> otherService, Integer goodsId) { public void addOtherService(List<Integer> otherService, Integer goodsId) {
// 插入其他服务 // 插入其他服务
List<GoodsServiceDO> otherList = otherService.stream().map(d -> { List<GoodsServiceDO> otherList =
GoodsServiceDO goodsServiceDO = new GoodsServiceDO(); otherService.stream()
goodsServiceDO.setGoodsInfoId(goodsId); .map(
goodsServiceDO.setSaleServiceId(d); d -> {
return goodsServiceDO; GoodsServiceDO goodsServiceDO = new GoodsServiceDO();
}).collect(Collectors.toList()); goodsServiceDO.setGoodsInfoId(goodsId);
goodsInfoDao.insertGoodsService(otherList); goodsServiceDO.setSaleServiceId(d);
} return goodsServiceDO;
})
@Transactional(rollbackFor = Exception.class) .collect(Collectors.toList());
public void addGoodsDetail(Integer goodsId, GoodsDetailVO goodsDetailVO) { goodsInfoDao.insertGoodsService(otherList);
GoodsDetailDO goodsDetailDO = new GoodsDetailDO(goodsDetailVO); }
goodsDetailDO.setGoodsInfoId(goodsId);
goodsInfoDao.insertGoodsDetail(goodsDetailDO); @Transactional(rollbackFor = Exception.class)
} public void addGoodsDetail(Integer goodsId, GoodsDetailVO goodsDetailVO) {
GoodsDetailDO goodsDetailDO = new GoodsDetailDO(goodsDetailVO);
@Transactional(rollbackFor = Exception.class) goodsDetailDO.setGoodsInfoId(goodsId);
public void addGoodsImageInfo(Integer goodsId, GoodsAddVO goodsAddVO) { goodsInfoDao.insertGoodsDetail(goodsDetailDO);
List<GoodsImgDO> list = goodsAddVO.getImages().stream().map(d -> { }
GoodsImgDO goodsImgDO = new GoodsImgDO(d);
goodsImgDO.setGoodsInfoId(goodsId); @Transactional(rollbackFor = Exception.class)
return goodsImgDO; public void addGoodsImageInfo(Integer goodsId, GoodsAddVO goodsAddVO) {
}).collect(Collectors.toList()); List<GoodsImgDO> list =
// 插入图片信息 goodsAddVO.getImages().stream()
goodsInfoDao.insertGoodsImgInfo(list); .map(
// 插入商品视频信息 d -> {
if (goodsAddVO.getGoodsVideo() != null) { GoodsImgDO goodsImgDO = new GoodsImgDO(d);
GoodsVideoDO goodsVideoDO = new GoodsVideoDO().setGoodsInfoId(goodsId).setVideoUrl(goodsAddVO.getGoodsVideo()); goodsImgDO.setGoodsInfoId(goodsId);
goodsInfoDao.insertVideoInfo(goodsVideoDO); return goodsImgDO;
} })
.collect(Collectors.toList());
// 插入图片信息
goodsInfoDao.insertGoodsImgInfo(list);
// 插入商品视频信息
if (goodsAddVO.getGoodsVideo() != null) {
GoodsVideoDO goodsVideoDO =
new GoodsVideoDO().setGoodsInfoId(goodsId).setVideoUrl(goodsAddVO.getGoodsVideo());
goodsInfoDao.insertVideoInfo(goodsVideoDO);
} }
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResultBody editGoodsInfo(GoodsAddVO goodsAddVO) { public ResultBody editGoodsInfo(GoodsAddVO goodsAddVO) {
// 判断商品是否还存在 // 判断商品是否还存在
int count = goodsInfoDao.countGoodsInfoById(goodsAddVO.getId()); int count = goodsInfoDao.countGoodsInfoById(goodsAddVO.getId());
if (count <= 0) { if (count <= 0) {
return ResultBody.error(ResultEnum.GOODS_NOT_EXIST_OR_ALREADY_DOWN_SHELF); return ResultBody.error(ResultEnum.GOODS_NOT_EXIST_OR_ALREADY_DOWN_SHELF);
} }
// 判断商品名称是否存在 // 判断商品名称是否存在
if (goodsInfoDao.countGoodsInfoByName(goodsAddVO) > 0) { if (goodsInfoDao.countGoodsInfoByName(goodsAddVO) > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR); return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
} }
// 判断商品详情中描述是否为空 // 判断商品详情中描述是否为空
if (goodsAddVO.getGoodsDetailVO().getGoodsDesc() == null) { if (goodsAddVO.getGoodsDetailVO().getGoodsDesc() == null) {
return ResultBody.error(ResultEnum.GOODS_DESC_IS_NOT_NULL); return ResultBody.error(ResultEnum.GOODS_DESC_IS_NOT_NULL);
} }
// 初始化商品对象,并构建对象 // 初始化商品对象,并构建对象
GoodsInfo goodsInfo = new GoodsInfo(goodsAddVO); GoodsInfo goodsInfo = new GoodsInfo(goodsAddVO);
// 插入商品基本信息 // 插入商品基本信息
goodsInfoDao.updateGoodsInfo(goodsInfo); goodsInfoDao.updateGoodsInfo(goodsInfo);
// 修改商品详情信息 // 修改商品详情信息
updateGoodsDetail(goodsAddVO); updateGoodsDetail(goodsAddVO);
// 修改商品图片及视频信息 // 修改商品图片及视频信息
updateImageInfo(goodsAddVO); updateImageInfo(goodsAddVO);
// 修改其他服务信息 // 修改其他服务信息
updateOtherService(goodsAddVO); updateOtherService(goodsAddVO);
// 修改规格信息 // 修改规格信息
if (!goodsAddVO.getDirectoryId().equals(2)) { if (!goodsAddVO.getDirectoryId().equals(2)) {
updateMallProductSkuSpec(goodsAddVO); updateMallProductSkuSpec(goodsAddVO);
} else { } else {
updateMallIndustrySkuSpec(goodsAddVO); updateMallIndustrySkuSpec(goodsAddVO);
} }
return null; return ResultBody.success();
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateMallIndustrySkuSpec(GoodsAddVO goodsAddVO) { public void updateMallIndustrySkuSpec(GoodsAddVO goodsAddVO) {
// 先获取用户输入的商品绑定sku的id集合 // 先获取用户输入的商品绑定sku的id集合
Set<Integer> inputMallSkuIds = goodsAddVO.getProductSpec().stream().map(GoodsProdSpecVO::getId).filter(Objects::nonNull).collect(Collectors.toSet()); Set<Integer> inputMallSkuIds =
// 从数据库获取该商品对应绑定的skuId的集合 goodsAddVO.getProductSpec().stream()
List<MallIndustrySkuInfoDO> mallIndusSkuInfoList = goodsInfoDao.getMallIndustrySkuInfo(goodsAddVO.getId()); .map(GoodsProdSpecVO::getId)
List<Integer> dbMallSkuIds = mallIndusSkuInfoList.stream().map(MallIndustrySkuInfoDO::getId).collect(Collectors.toList()); .filter(Objects::nonNull)
// 对比数据库id如果不在就删除 .collect(Collectors.toSet());
List<Integer> delIds = dbMallSkuIds.stream().filter(id -> !inputMallSkuIds.contains(id)).collect(Collectors.toList()); // 从数据库获取该商品对应绑定的skuId的集合
if (delIds.size() != 0) { List<MallIndustrySkuInfoDO> mallIndusSkuInfoList =
// 先删除商品绑定sku下的spec信息 goodsInfoDao.getMallIndustrySkuInfo(goodsAddVO.getId());
industrySpecDao.batchUpdateMallIndustrySpec(delIds, goodsAddVO.getId()); List<Integer> dbMallSkuIds =
industrySpecDao.batchUpdateMallIndustrySku(delIds); mallIndusSkuInfoList.stream()
.map(MallIndustrySkuInfoDO::getId)
.collect(Collectors.toList());
// 对比数据库id如果不在就删除
List<Integer> delIds =
dbMallSkuIds.stream()
.filter(id -> !inputMallSkuIds.contains(id))
.collect(Collectors.toList());
if (delIds.size() != 0) {
// 先删除商品绑定sku下的spec信息
industrySpecDao.batchUpdateMallIndustrySpec(delIds, goodsAddVO.getId());
industrySpecDao.batchUpdateMallIndustrySku(delIds);
}
// 修改商品绑定的sku信息
List<GoodsProdSpecVO> updateGoodsSpec =
goodsAddVO.getProductSpec().stream().filter(Objects::nonNull).collect(Collectors.toList());
List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList =
updateGoodsSpec.stream()
.map(
d -> {
MallIndustrySkuInfoDO mallIndustrySkuInfoDO = new MallIndustrySkuInfoDO();
mallIndustrySkuInfoDO
.setId(d.getId())
.setIndustrySkuId(d.getSkuId())
.setCategoriesId(d.getCategoryId())
.setIndustrySkuSpecName(d.getGoodsSpecName())
.setChooseType(d.getChooseType())
.setSkuUnitId(d.getSkuUnitId())
.setMust(d.getMust());
return mallIndustrySkuInfoDO;
})
.collect(Collectors.toList());
// 批量修改sku的信息
industrySpecDao.batchUpdateMallIndustrySkuInfo(mallIndustrySkuInfoList);
// 获取新的sku信息
List<GoodsProdSpecVO> list =
goodsAddVO.getProductSpec().stream()
.filter(d -> d.getId() == null)
.collect(Collectors.toList());
industrySkuSpecOperation(new GoodsInfo(goodsAddVO.getId()), list);
// 获取商品对应的skuId
List<Integer> mallSkuIds =
goodsAddVO.getProductSpec().stream()
.map(GoodsProdSpecVO::getId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
// 根据这些id查出下面对应的规格信息
List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpecList =
industrySpecDao.listMallIndustrySpecInfo(mallSkuIds);
// 分组
Map<Integer, List<MallIndustrySkuInfoSpecDO>> dbSpecMap =
mallIndustrySkuInfoSpecList.stream()
.collect(Collectors.groupingBy(MallIndustrySkuInfoSpecDO::getMallIndustrySkuInfoId));
List<GoodsProdSpecVO> goodsSpecList =
goodsAddVO.getProductSpec().stream()
.filter(d -> d.getId() != null)
.collect(Collectors.toList());
for (GoodsProdSpecVO goodsSpecVO : goodsSpecList) {
// 分组后的每一条商品绑定的规格信息
List<MallIndustrySkuInfoSpecDO> dbMallIndustrySkuSpecList =
dbSpecMap.get(goodsSpecVO.getId());
Set<Integer> inputMallSpecIds =
goodsSpecVO.getSpecIds().stream()
.map(MallProductSpecVO::getId)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
List<Integer> delSpecId =
dbMallIndustrySkuSpecList.stream()
.map(MallIndustrySkuInfoSpecDO::getId)
.filter(id -> !inputMallSpecIds.contains(id))
.collect(Collectors.toList());
if (delSpecId.size() != 0) {
// 删除多余的spec信息
industrySpecDao.batchUpdateMallIndustSpec(delSpecId, goodsAddVO.getId());
}
// 新增spec的信息
for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) {
if (mallProductSpecVO.getId() == null) {
MallIndustrySkuInfoSpecDO mallIndustrySkuInfoSpecDO =
new MallIndustrySkuInfoSpecDO()
.setIndustrySpecId(mallProductSpecVO.getMallSpecId())
.setMallIndustrySkuInfoId(goodsSpecVO.getId())
.setGoodsInfoId(goodsAddVO.getId());
// 插入数据库商品对应的规格信息
goodsInfoDao.insertMallIndustrySkuInfoSpec(mallIndustrySkuInfoSpecDO);
} }
// 修改商品绑定的sku信息 }
List<GoodsProdSpecVO> updateGoodsSpec = goodsAddVO.getProductSpec().stream().filter(Objects::nonNull).collect(Collectors.toList()); }
List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList = updateGoodsSpec.stream().map(d -> { }
MallIndustrySkuInfoDO mallIndustrySkuInfoDO = new MallIndustrySkuInfoDO();
mallIndustrySkuInfoDO.setId(d.getId()).setIndustrySkuId(d.getSkuId()) @Transactional(rollbackFor = Exception.class)
.setCategoriesId(d.getCategoryId()).setIndustrySkuSpecName(d.getGoodsSpecName()) public void updateMallProductSkuSpec(GoodsAddVO goodsAddVO) {
.setChooseType(d.getChooseType()).setSkuUnitId(d.getSkuUnitId()).setMust(d.getMust()); GoodsInfo goodsInfo = new GoodsInfo(goodsAddVO);
return mallIndustrySkuInfoDO; // 1、普通的sku修改逻辑
}).collect(Collectors.toList()); List<GoodsProdSpecVO> specInfo =
// 批量修改sku的信息 goodsAddVO.getProductSpec().stream()
industrySpecDao.batchUpdateMallIndustrySkuInfo(mallIndustrySkuInfoList); .filter(spec -> !spec.getFlag().equals(1))
// 获取新的sku信息 .collect(Collectors.toList());
List<GoodsProdSpecVO> list = goodsAddVO.getProductSpec().stream().filter(d -> d.getId() == null).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(specInfo)) {
industrySkuSpecOperation(new GoodsInfo(goodsAddVO.getId()), list); // 1.1先获取用户输入的商品绑定sku的id集合
// 获取商品对应的skuId List<GoodsProdSpecVO> updateGoodsSpec =
List<Integer> mallSkuIds = goodsAddVO.getProductSpec().stream().map(GoodsProdSpecVO::getId).filter(Objects::nonNull).collect(Collectors.toList()); specInfo.stream().filter(d -> d.getId() != null).collect(Collectors.toList());
List<Integer> inputMallSkuIds =
updateGoodsSpec.stream().map(GoodsProdSpecVO::getId).collect(Collectors.toList());
// 1.2从数据库获取该商品对应绑定的skuId的集合
List<MallProdInfoDO> mallProSkuInfoList = goodsInfoDao.getMallProSkuInfo(goodsAddVO.getId());
List<Integer> dbMallSkuIds =
mallProSkuInfoList.stream().map(MallProdInfoDO::getId).collect(Collectors.toList());
// 对比数据库id如果不在就删除
List<Integer> delIds =
dbMallSkuIds.stream()
.filter(id -> !inputMallSkuIds.contains(id))
.collect(Collectors.toList());
if (delIds.size() != 0) {
// 先删除商品绑定sku下的spec信息
goodsInfoDao.batchUpdateMallProSpec(delIds, goodsAddVO.getId());
goodsInfoDao.batchUpdateMallProductSku(delIds);
}
// 修改商品绑定的sku信息
List<MallProdInfoDO> mallProdSkuInfoList =
updateGoodsSpec.stream()
.map(
d -> {
MallProdInfoDO mallProdInfoDO = new MallProdInfoDO();
mallProdInfoDO
.setId(d.getId())
.setProdSkuId(d.getSkuId())
.setCategoriesId(d.getCategoryId())
.setProdSkuSpecName(d.getGoodsSpecName())
.setChooseType(d.getChooseType())
.setSkuUnitId(d.getSkuUnitId())
.setMust(d.getMust());
return mallProdInfoDO;
})
.collect(Collectors.toList());
// 1.3批量修改sku的信息
for (MallProdInfoDO mallProdInfoDO : mallProdSkuInfoList) {
goodsInfoDao.updateMallProdSkuInfo(mallProdInfoDO);
}
// goodsInfoDao.batchUpdateMallProdSkuInfo(mallProdSkuInfoList);
// 1.4对新的sku进行操作
List<GoodsProdSpecVO> list =
specInfo.stream().filter(d -> d.getId() == null).collect(Collectors.toList());
productSkuSpecOperation(goodsInfo, list);
// 获取商品对应的skuId
List<Integer> mallSkuIds =
goodsAddVO.getProductSpec().stream()
.filter(d -> d.getId() != null)
.map(GoodsProdSpecVO::getId)
.collect(Collectors.toList());
if (mallSkuIds.size() > 0) {
// 根据这些id查出下面对应的规格信息 // 根据这些id查出下面对应的规格信息
List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpecList = industrySpecDao.listMallIndustrySpecInfo(mallSkuIds); List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpecList =
goodsInfoDao.listMallProdSpecInfo(mallSkuIds);
// 分组 // 分组
Map<Integer, List<MallIndustrySkuInfoSpecDO>> dbSpecMap = mallIndustrySkuInfoSpecList.stream().collect(Collectors.groupingBy(MallIndustrySkuInfoSpecDO::getMallIndustrySkuInfoId)); Map<Integer, List<MallProdSkuInfoSpecDO>> dbSpecMap =
List<GoodsProdSpecVO> goodsSpecList = goodsAddVO.getProductSpec().stream().filter(d -> d.getId() != null).collect(Collectors.toList()); mallProdSkuInfoSpecList.stream()
for (GoodsProdSpecVO goodsSpecVO : goodsSpecList) { .collect(Collectors.groupingBy(MallProdSkuInfoSpecDO::getMallProdSkuInfoId));
// 分组后的每一条商品绑定的规格信息 for (GoodsProdSpecVO goodsSpecVO : updateGoodsSpec) {
List<MallIndustrySkuInfoSpecDO> dbMallIndustrySkuSpecList = dbSpecMap.get(goodsSpecVO.getId()); // 分组后的每一条商品绑定的规格信息
Set<Integer> inputMallSpecIds = goodsSpecVO.getSpecIds().stream().map(MallProductSpecVO::getId).filter(Objects::nonNull).collect(Collectors.toSet()); List<MallProdSkuInfoSpecDO> dbMallProdSkuSpecList = dbSpecMap.get(goodsSpecVO.getId());
List<Integer> delSpecId = dbMallIndustrySkuSpecList.stream().map(MallIndustrySkuInfoSpecDO::getId).filter(id -> !inputMallSpecIds.contains(id)).collect(Collectors.toList()); Set<Integer> inputMallSpecIds =
if (delSpecId.size() != 0) { goodsSpecVO.getSpecIds().stream()
// 删除多余的spec信息 .map(MallProductSpecVO::getId)
industrySpecDao.batchUpdateMallIndustSpec(delSpecId, goodsAddVO.getId()); .filter(Objects::nonNull)
} .collect(Collectors.toSet());
// 新增spec的信息 List<Integer> delSpecId =
for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) { dbMallProdSkuSpecList.stream()
if (mallProductSpecVO.getId() == null) { .map(MallProdSkuInfoSpecDO::getId)
MallIndustrySkuInfoSpecDO mallIndustrySkuInfoSpecDO = new MallIndustrySkuInfoSpecDO() .filter(id -> !inputMallSpecIds.contains(id))
.setIndustrySpecId(mallProductSpecVO.getMallSpecId()) .collect(Collectors.toList());
.setMallIndustrySkuInfoId(goodsSpecVO.getId()) if (delSpecId.size() != 0) {
.setGoodsInfoId(goodsAddVO.getId()); // 删除多余的spec信息
// 插入数据库商品对应的规格信息 goodsInfoDao.batchUpdateMallProdSpec(delSpecId);
goodsInfoDao.insertMallIndustrySkuInfoSpec(mallIndustrySkuInfoSpecDO); }
} // 新增spec的信息
for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) {
if (mallProductSpecVO.getId() == null) {
MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO =
new MallProdSkuInfoSpecDO()
.setProductSpecId(mallProductSpecVO.getMallSpecId())
.setMallProdSkuInfoId(goodsSpecVO.getId())
.setGoodsInfoId(goodsAddVO.getId());
// 插入数据库商品对应的规格信息
goodsInfoDao.insertMallProdSkuInfoSpec(mallProdSkuInfoSpecDO);
} }
}
} }
}
} }
// 2、对自定义的sku进行操作
@Transactional(rollbackFor = Exception.class) List<GoodsProdSpecVO> zdySpecInfo =
public void updateMallProductSkuSpec(GoodsAddVO goodsAddVO) { goodsAddVO.getProductSpec().stream()
// 1、普通的sku修改逻辑 .filter(spec -> spec.getFlag().equals(1))
List<GoodsProdSpecVO> specInfo = goodsAddVO.getProductSpec().stream().filter(spec -> !spec.getFlag().equals(1)).collect(Collectors.toList()); .collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(specInfo)) { if (CollectionUtils.isNotEmpty(zdySpecInfo)) {
// 1.1先获取用户输入的商品绑定sku的id集合 updateCustomize(goodsInfo, zdySpecInfo, goodsAddVO.getId());
List<GoodsProdSpecVO> updateGoodsSpec = specInfo.stream().filter(d -> d.getId() != null).collect(Collectors.toList());
List<Integer> inputMallSkuIds = updateGoodsSpec.stream().map(GoodsProdSpecVO::getId).collect(Collectors.toList());
// 1.2从数据库获取该商品对应绑定的skuId的集合
List<MallProdInfoDO> mallProSkuInfoList = goodsInfoDao.getMallProSkuInfo(goodsAddVO.getId());
List<Integer> dbMallSkuIds = mallProSkuInfoList.stream().map(MallProdInfoDO::getId).collect(Collectors.toList());
// 对比数据库id如果不在就删除
List<Integer> delIds = dbMallSkuIds.stream().filter(id -> !inputMallSkuIds.contains(id)).collect(Collectors.toList());
if (delIds.size() != 0) {
// 先删除商品绑定sku下的spec信息
goodsInfoDao.batchUpdateMallProSpec(delIds, goodsAddVO.getId());
goodsInfoDao.batchUpdateMallProductSku(delIds);
}
// 修改商品绑定的sku信息
List<MallProdInfoDO> mallProdSkuInfoList = updateGoodsSpec.stream().map(d -> {
MallProdInfoDO mallProdInfoDO = new MallProdInfoDO();
mallProdInfoDO.setId(d.getId()).setProdSkuId(d.getSkuId())
.setCategoriesId(d.getCategoryId()).setProdSkuSpecName(d.getGoodsSpecName())
.setChooseType(d.getChooseType()).setSkuUnitId(d.getSkuUnitId()).setMust(d.getMust());
return mallProdInfoDO;
}).collect(Collectors.toList());
// 1.3批量修改sku的信息
goodsInfoDao.batchUpdateMallProdSkuInfo(mallProdSkuInfoList);
// 1.4对新的sku进行操作
List<GoodsProdSpecVO> list = specInfo.stream().filter(d -> d.getId() == null).collect(Collectors.toList());
productSkuSpecOperation(new GoodsInfo(goodsAddVO.getId()), list);
// 获取商品对应的skuId
List<Integer> mallSkuIds = goodsAddVO.getProductSpec().stream().filter(d -> d.getId() != null).map(GoodsProdSpecVO::getId).collect(Collectors.toList());
if (mallSkuIds.size() > 0) {
// 根据这些id查出下面对应的规格信息
List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpecList = goodsInfoDao.listMallProdSpecInfo(mallSkuIds);
// 分组
Map<Integer, List<MallProdSkuInfoSpecDO>> dbSpecMap = mallProdSkuInfoSpecList.stream().collect(Collectors.groupingBy(MallProdSkuInfoSpecDO::getMallProdSkuInfoId));
for (GoodsProdSpecVO goodsSpecVO : updateGoodsSpec) {
// 分组后的每一条商品绑定的规格信息
List<MallProdSkuInfoSpecDO> dbMallProdSkuSpecList = dbSpecMap.get(goodsSpecVO.getId());
Set<Integer> inputMallSpecIds = goodsSpecVO.getSpecIds().stream().map(MallProductSpecVO::getId).filter(Objects::nonNull).collect(Collectors.toSet());
List<Integer> delSpecId = dbMallProdSkuSpecList.stream().map(MallProdSkuInfoSpecDO::getId).filter(id -> !inputMallSpecIds.contains(id)).collect(Collectors.toList());
if (delSpecId.size() != 0) {
// 删除多余的spec信息
goodsInfoDao.batchUpdateMallProdSpec(delSpecId);
}
// 新增spec的信息
for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) {
if (mallProductSpecVO.getId() == null) {
MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO = new MallProdSkuInfoSpecDO()
.setProductSpecId(mallProductSpecVO.getMallSpecId())
.setMallProdSkuInfoId(goodsSpecVO.getId())
.setGoodsInfoId(goodsAddVO.getId());
// 插入数据库商品对应的规格信息
goodsInfoDao.insertMallProdSkuInfoSpec(mallProdSkuInfoSpecDO);
}
}
}
}
// 2、对自定义的sku进行操作
List<GoodsProdSpecVO> zdySpecInfo = goodsAddVO.getProductSpec().stream().filter(spec -> spec.getFlag().equals(1)).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(zdySpecInfo)) {
updateCustomize(zdySpecInfo, goodsAddVO.getId());
}
}
} }
}
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateCustomize(List<GoodsProdSpecVO> zdySpecInfo, Integer id) { public void updateCustomize(GoodsInfo goodsInfo, List<GoodsProdSpecVO> zdySpecInfo, Integer id) {
// 先获取自定义的sku及规格(原来有的) // 先获取自定义的sku及规格(原来有的)
List<GoodsProdSpecVO> zdySpec = zdySpecInfo.stream().filter(d -> d.getId() != null).collect(Collectors.toList()); List<GoodsProdSpecVO> zdySpec =
if (!CollectionUtils.isEmpty(zdySpec)) { zdySpecInfo.stream().filter(d -> d.getId() != null).collect(Collectors.toList());
// 根据获取到的自定义sku及规格进行操作 if (!CollectionUtils.isEmpty(zdySpec)) {
List<MallProdInfoDO> zdySpecList = zdySpec.stream().map(d -> { // 根据获取到的自定义sku及规格进行操作
// 构建商品对应的sku信息 List<MallProdInfoDO> zdySpecList =
ProductSkuDO productSkuDO = new ProductSkuDO().setId(d.getSkuId()).setCategoriesId(d.getCategoryId()).setProductName(d.getProductName()); zdySpec.stream()
productDao.updateProductSku(productSkuDO); .map(
return new MallProdInfoDO(d).setId(d.getId()).setProdSkuId(d.getSkuId()); d -> {
}).collect(Collectors.toList()); // 构建商品对应的sku信息
// 批量修改sku的信息 ProductSkuDO productSkuDO =
goodsInfoDao.batchUpdateMallProdSkuInfo(zdySpecList); new ProductSkuDO()
} .setId(d.getSkuId())
for (GoodsProdSpecVO goodsSpecVO : zdySpec) { .setCategoriesId(d.getCategoryId())
// 【1】获取输入的自定义规格信息// id不为空则修改 .setProductName(d.getProductName());
List<ProductSpecVO> customizeInfoList = goodsSpecVO.getCustomizeInfo().stream().filter(d -> d.getId() != null).collect(Collectors.toList()); productDao.updateProductSku(productSkuDO);
for (ProductSpecVO d : customizeInfoList) { return new MallProdInfoDO(d).setId(d.getId()).setProdSkuId(d.getSkuId());
// ①修改价格配置 })
ProductSpecCPQVO productSpecCPQVO = d.getProductSpecCPQVO(); .collect(Collectors.toList());
// 删除所有的随后在新增 // 批量修改sku的信息
productDao.removeProductSpecCPQ(productSpecCPQVO); for (MallProdInfoDO mallProdInfoDO : zdySpecList) {
productSkuService.insertSpecPrice(productSpecCPQVO); goodsInfoDao.updateMallProdSkuInfo(mallProdInfoDO);
// ②在修改自定义的数据 }
productDao.updateProductSpec(new ProductSpecDO(d)); // goodsInfoDao.batchUpdateMallProdSkuInfo(zdySpecList);
} }
// 【2】删除多余的自定义规格 for (GoodsProdSpecVO goodsSpecVO : zdySpec) {
if (!CollectionUtils.isEmpty(goodsSpecVO.getDelProductSpecId())) { // 【1】获取输入的自定义规格信息// id不为空则修改
// 批量查出spec的数据 List<ProductSpecVO> customizeInfoList =
List<MallProdSkuInfoSpecDO> prodSkuInfoSpecList = productDao.getProductSpecByIds(goodsSpecVO.getDelProductSpecId()); goodsSpecVO.getCustomizeInfo().stream()
for (MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO : prodSkuInfoSpecList) { .filter(d -> d.getId() != null)
productDao.removeProductSpec(mallProdSkuInfoSpecDO.getProductSpecId()); .collect(Collectors.toList());
} for (ProductSpecVO d : customizeInfoList) {
goodsInfoDao.batchUpdateMallProdSpec(goodsSpecVO.getDelProductSpecId()); // ①修改价格配置
} ProductSpecCPQVO productSpecCPQVO = d.getProductSpecCPQVO();
// 【3】新增最新的自定义规格 // 删除所有的随后在新增
List<ProductSpecVO> collect = goodsSpecVO.getCustomizeInfo().stream().filter(d -> d.getId() == null).collect(Collectors.toList()); productDao.removeProductSpecCPQ(productSpecCPQVO);
for (ProductSpecVO param : collect) { productSkuService.insertSpecPrice(productSpecCPQVO);
ProductSpecDO productSpecDO = new ProductSpecDO(param); // ②在修改自定义的数据
// 新增产品sku productDao.updateProductSpec(new ProductSpecDO(d));
productDao.insertProductSpec(productSpecDO); }
// 批量配置价格信息 // 【2】删除多余的自定义规格
ProductSpecCPQVO productSpecCPQVO = param.getProductSpecCPQVO(); if (!CollectionUtils.isEmpty(goodsSpecVO.getDelProductSpecId())) {
productSpecCPQVO.setProductSpecId(productSpecDO.getId()); // 批量查出spec的数据
productSkuService.insertSpecPrice(productSpecCPQVO); List<MallProdSkuInfoSpecDO> prodSkuInfoSpecList =
// 构建商品对应的规格信息 productDao.getProductSpecByIds(goodsSpecVO.getDelProductSpecId());
MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO = new MallProdSkuInfoSpecDO() for (MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO : prodSkuInfoSpecList) {
.setProductSpecId(productSpecDO.getId()) productDao.removeProductSpec(mallProdSkuInfoSpecDO.getProductSpecId());
.setMallProdSkuInfoId(goodsSpecVO.getId())
.setGoodsInfoId(id);
// 插入数据库商品对应的规格信息
goodsInfoDao.insertMallProdSkuInfoSpec(mallProdSkuInfoSpecDO);
}
}
// 2.2 新增新的自定义规格信息
List<GoodsProdSpecVO> newZdySpec = zdySpecInfo.stream().filter(d -> d.getId() == null).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(newZdySpec)) {
productSkuSpecOperation(new GoodsInfo(id), newZdySpec);
} }
goodsInfoDao.batchUpdateMallProdSpec(goodsSpecVO.getDelProductSpecId());
}
// 【3】新增最新的自定义规格
List<ProductSpecVO> collect =
goodsSpecVO.getCustomizeInfo().stream()
.filter(d -> d.getId() == null)
.collect(Collectors.toList());
for (ProductSpecVO param : collect) {
ProductSpecDO productSpecDO = new ProductSpecDO(param);
// 新增产品sku
productDao.insertProductSpec(productSpecDO);
// 批量配置价格信息
ProductSpecCPQVO productSpecCPQVO = param.getProductSpecCPQVO();
productSpecCPQVO.setProductSpecId(productSpecDO.getId());
productSkuService.insertSpecPrice(productSpecCPQVO);
// 构建商品对应的规格信息
MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO =
new MallProdSkuInfoSpecDO()
.setProductSpecId(productSpecDO.getId())
.setMallProdSkuInfoId(goodsSpecVO.getId())
.setGoodsInfoId(id);
// 插入数据库商品对应的规格信息
goodsInfoDao.insertMallProdSkuInfoSpec(mallProdSkuInfoSpecDO);
}
} }
// 2.2 新增新的自定义规格信息
List<GoodsProdSpecVO> newZdySpec =
zdySpecInfo.stream().filter(d -> d.getId() == null).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(newZdySpec)) {
productSkuSpecOperation(goodsInfo, newZdySpec);
}
}
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateOtherService(GoodsAddVO goodsAddVO) { public void updateOtherService(GoodsAddVO goodsAddVO) {
// 删除其他服务 // 删除其他服务
goodsInfoDao.deleteGoodsServiceByGoodsId(goodsAddVO.getId()); goodsInfoDao.deleteGoodsServiceByGoodsId(goodsAddVO.getId());
// 插入其他服务 // 插入其他服务
if (!CollectionUtils.isEmpty(goodsAddVO.getOtherService())) { if (!CollectionUtils.isEmpty(goodsAddVO.getOtherService())) {
List<Integer> other = goodsAddVO.getOtherService(); List<Integer> other = goodsAddVO.getOtherService();
List<GoodsServiceDO> otherList = other.stream().map(d -> { List<GoodsServiceDO> otherList =
GoodsServiceDO goodsServiceDO = new GoodsServiceDO(); other.stream()
goodsServiceDO.setGoodsInfoId(goodsAddVO.getId()); .map(
goodsServiceDO.setSaleServiceId(d); d -> {
return goodsServiceDO; GoodsServiceDO goodsServiceDO = new GoodsServiceDO();
}).collect(Collectors.toList()); goodsServiceDO.setGoodsInfoId(goodsAddVO.getId());
goodsInfoDao.insertGoodsService(otherList); goodsServiceDO.setSaleServiceId(d);
} return goodsServiceDO;
})
.collect(Collectors.toList());
goodsInfoDao.insertGoodsService(otherList);
} }
}
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateImageInfo(GoodsAddVO goodsAddVO) { public void updateImageInfo(GoodsAddVO goodsAddVO) {
Set<Integer> imgIds = goodsAddVO.getImages().stream().map(GoodsImgVO::getId).filter(Objects::nonNull).collect(Collectors.toSet()); Set<Integer> imgIds =
List<GoodsImgDO> dbImgList = goodsInfoDao.listGoodsInfoByGoodsId(goodsAddVO.getId()); goodsAddVO.getImages().stream()
List<Integer> deleteIds = dbImgList.stream().map(GoodsImgDO::getId).filter(id -> !imgIds.contains(id)).collect(Collectors.toList()); .map(GoodsImgVO::getId)
if (deleteIds.size() != 0) { .filter(Objects::nonNull)
// 删除多余的图片 .collect(Collectors.toSet());
goodsInfoDao.deleteImgByIds(deleteIds); List<GoodsImgDO> dbImgList = goodsInfoDao.listGoodsInfoByGoodsId(goodsAddVO.getId());
} List<Integer> deleteIds =
// 新增图片 dbImgList.stream()
List<GoodsImgDO> imgDOList = goodsAddVO.getImages().stream().filter(d -> d.getId() == null).map(d -> { .map(GoodsImgDO::getId)
GoodsImgDO goodsImgDO = new GoodsImgDO(d); .filter(id -> !imgIds.contains(id))
goodsImgDO.setGoodsInfoId(goodsAddVO.getId()); .collect(Collectors.toList());
return goodsImgDO; if (deleteIds.size() != 0) {
}).collect(Collectors.toList()); // 删除多余的图片
if (imgDOList.size() != 0) { goodsInfoDao.deleteImgByIds(deleteIds);
goodsInfoDao.insertGoodsImgInfo(imgDOList); }
} // 新增图片
// 删除视频 List<GoodsImgDO> imgDOList =
goodsInfoDao.deleteGoodsVideoById(goodsAddVO.getId()); goodsAddVO.getImages().stream()
// 插入视频 .filter(d -> d.getId() == null)
if (goodsAddVO.getGoodsVideo() != null) { .map(
GoodsVideoDO goodsVideoDO = new GoodsVideoDO(); d -> {
goodsVideoDO.setGoodsInfoId(goodsAddVO.getId()); GoodsImgDO goodsImgDO = new GoodsImgDO(d);
goodsVideoDO.setVideoUrl(goodsAddVO.getGoodsVideo()); goodsImgDO.setGoodsInfoId(goodsAddVO.getId());
goodsInfoDao.insertVideoInfo(goodsVideoDO); return goodsImgDO;
} })
.collect(Collectors.toList());
if (imgDOList.size() != 0) {
goodsInfoDao.insertGoodsImgInfo(imgDOList);
}
// 删除视频
goodsInfoDao.deleteGoodsVideoById(goodsAddVO.getId());
// 插入视频
if (goodsAddVO.getGoodsVideo() != null) {
GoodsVideoDO goodsVideoDO = new GoodsVideoDO();
goodsVideoDO.setGoodsInfoId(goodsAddVO.getId());
goodsVideoDO.setVideoUrl(goodsAddVO.getGoodsVideo());
goodsInfoDao.insertVideoInfo(goodsVideoDO);
} }
}
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateGoodsDetail(GoodsAddVO goodsAddVO) { public void updateGoodsDetail(GoodsAddVO goodsAddVO) {
GoodsDetailDO goodsDetailDO = new GoodsDetailDO(goodsAddVO.getGoodsDetailVO()).setGoodsInfoId(goodsAddVO.getId()); GoodsDetailDO goodsDetailDO =
// 商品详情修改 new GoodsDetailDO(goodsAddVO.getGoodsDetailVO()).setGoodsInfoId(goodsAddVO.getId());
goodsInfoDao.updateGoodsDetail(goodsDetailDO); // 商品详情修改
goodsInfoDao.updateGoodsDetail(goodsDetailDO);
}
@Override
public ResultBody getGoodsInfoDetail(Integer goodsInfoId, Integer type, Integer leaseTerm) {
// 判断此商品是否还存在
int count = goodsInfoDao.countGoodsInfoById(goodsInfoId);
if (count <= 0) {
return ResultBody.error(ResultEnum.GOODS_NOT_EXIST_OR_ALREADY_DOWN_SHELF);
}
// 初始化商品返回信息的对象
MallGoodsDetailDTO mallGoodsDetail = new MallGoodsDetailDTO();
// 获取商品基本信息
GoodsInfo goodsInfo = goodsInfoDao.getGoodsSimpleInfo(goodsInfoId);
mallGoodsDetail
.setId(goodsInfo.getId())
.setGoodsNo(goodsInfo.getGoodsNo())
.setGoodsName(goodsInfo.getGoodsName())
.setCategoryByOne(goodsInfo.getCategoryByOne())
.setGoodsVideo(goodsInfo.getVideoUrl())
.setDirectoryId(goodsInfo.getDirectoryId())
.setCategoryByTwo(goodsInfo.getCategoryByTwo())
.setTag(goodsInfo.getEcoLabel())
.setShelfStatus(goodsInfo.getShelfStatus())
.setGoodsVideoId(goodsInfo.getGoodsVideoId());
// 获取商品图片信息
mallGoodsDetail.setImages(getGoodsImageInfo(goodsInfoId));
// 获取商品详细信息
mallGoodsDetail.setGoodsDetail(getGoodsDetail(goodsInfoId));
// 获取其他服务信息
mallGoodsDetail.setOtherService(getOtherServiceInfo(goodsInfoId));
// 获取规格信息
if (!goodsInfo.getDirectoryId().equals(2)) {
// 获取产品规格信息
mallGoodsDetail.setGoodsSpec(getProductSpecInfo(goodsInfoId, type, leaseTerm));
} else {
// 获取行业规格信息
mallGoodsDetail.setGoodsSpec(getIndustrySpecInfo(goodsInfoId));
} }
return ResultBody.success(mallGoodsDetail);
}
private List<GoodsSpecDTO> getIndustrySpecInfo(Integer goodsInfoId) {
// 获取商品对应绑定的行业sku信息
List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList =
goodsInfoDao.getMallIndustrySkuInfo(goodsInfoId);
List<GoodsSpecDTO> list =
mallIndustrySkuInfoList.stream()
.map(MallIndustrySkuInfoDO::buildGoodsSpecDTO)
.collect(Collectors.toList());
// 根据商品id查出该商品下绑定的规格信息
List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpec =
industrySpecDao.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();
MallIndustrySpecDTO industrySpecDTO =
industrySpecDO.buildMallIndustrySpecDTO();
industrySpecDTO.setId(e.getId());
industrySpecDTO.setIndustrySpecId(e.getIndustrySpecId());
industrySpecDTO.setIndustrySkuId(d.getSkuId());
industrySpec.add(industrySpecDTO);
}
}
d.setIndustrySpecList(industrySpec);
})
.collect(Collectors.toList());
return list;
}
@Override private List<GoodsSpecDTO> getProductSpecInfo(
public ResultBody getGoodsInfoDetail(Integer goodsInfoId) { Integer goodsInfoId, Integer type, Integer leaseTerm) {
// 判断此商品是否还存在 // 获取商品对应绑定sku的信息
int count = goodsInfoDao.countGoodsInfoById(goodsInfoId); List<MallProdInfoDO> mallProdSkuInfoList = goodsInfoDao.getAllMallProSkuInfo(goodsInfoId);
if (count <= 0) { List<GoodsSpecDTO> list =
return ResultBody.error(ResultEnum.GOODS_NOT_EXIST_OR_ALREADY_DOWN_SHELF); mallProdSkuInfoList.stream()
} .map(MallProdInfoDO::buildGoodsSpecDTO)
// 初始化商品返回信息的对象 .collect(Collectors.toList());
MallGoodsDetailDTO mallGoodsDetail = new MallGoodsDetailDTO(); // 获取规格来源详细信息
// 获取商品基本信息 List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpec =
GoodsInfo goodsInfo = goodsInfoDao.getGoodsSimpleInfo(goodsInfoId); goodsInfoDao.getMallProSkuInfoSpec(goodsInfoId);
mallGoodsDetail.setId(goodsInfo.getId()).setGoodsName(goodsInfo.getGoodsName()) // 根据id查询出规格的具体信息
.setCategoryByOne(goodsInfo.getCategoryByOne()).setGoodsVideo(goodsInfo.getVideoUrl()) list =
.setDirectoryId(goodsInfo.getDirectoryId()).setCategoryByTwo(goodsInfo.getCategoryByTwo()) list.stream()
.setTag(goodsInfo.getEcoLabel()).setShelfStatus(goodsInfo.getShelfStatus()) .peek(
.setGoodsVideoId(goodsInfo.getGoodsVideoId()); d -> {
// 获取商品图片信息 List<MallProductSpecDTO> specList = new ArrayList<>();
mallGoodsDetail.setImages(getGoodsImageInfo(goodsInfoId)); for (MallProdSkuInfoSpecDO e : mallProdSkuInfoSpec) {
// 获取商品详细信息 if (d.getId().equals(e.getMallProdSkuInfoId())) {
mallGoodsDetail.setGoodsDetail(getGoodsDetail(goodsInfoId)); // 构建规格对象
// 获取其他服务信息 ProductSpecDO productSpecDO = e.getProductSpecDO();
mallGoodsDetail.setOtherService(getOtherServiceInfo(goodsInfoId)); MallProductSpecDTO productSpecDTO = productSpecDO.buildMallProductSpecDTO();
// 获取规格信息 productSpecDTO.setProductSkuId(d.getSkuId());
if (!goodsInfo.getDirectoryId().equals(2)) { productSpecDTO.setId(e.getId());
// 获取产品规格信息 productSpecDTO.setProductSpec(e.getProductSpecId());
mallGoodsDetail.setGoodsSpec(getProductSpecInfo(goodsInfoId)); // 获取自定义sku下规格的价格配置信息
} else { ProductSpecCPQVO productSpecCPQVO = new ProductSpecCPQVO();
// 获取行业规格信息 productSpecCPQVO.setProductSpecId(e.getProductSpecId());
mallGoodsDetail.setGoodsSpec(getIndustrySpecInfo(goodsInfoId)); productSpecCPQVO.setType(type);
} if (type.equals(1)) {
return ResultBody.success(mallGoodsDetail); productSpecCPQVO.setLeaseTerm(leaseTerm);
} }
List<ProductSpecPriceDO> productSpecPrice =
private List<GoodsSpecDTO> getIndustrySpecInfo(Integer goodsInfoId) { productDao.getProductSpecPrice(productSpecCPQVO);
// 获取商品对应绑定的行业sku信息 List<SpecPriceVO> collect =
List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList = goodsInfoDao.getMallIndustrySkuInfo(goodsInfoId); productSpecPrice.stream()
List<GoodsSpecDTO> list = mallIndustrySkuInfoList.stream().map(MallIndustrySkuInfoDO::buildGoodsSpecDTO).collect(Collectors.toList()); .map(
// 根据商品id查出该商品下绑定的规格信息 m -> {
List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpec = industrySpecDao.getIndustrySkuInfoSpec(goodsInfoId); SpecPriceVO specPriceVO = new SpecPriceVO();
list = list.stream().peek(d -> { specPriceVO.setId(m.getId());
List<MallIndustrySpecDTO> industrySpec = new ArrayList<>(); specPriceVO.setPrice(m.getPrice());
for (MallIndustrySkuInfoSpecDO e : mallIndustrySkuInfoSpec) { specPriceVO.setCooperationTag(m.getCooperationTag());
if (d.getId().equals(e.getMallIndustrySkuInfoId())) { return specPriceVO;
IndustrySpecDO industrySpecDO = e.getIndustrySpecDO(); })
MallIndustrySpecDTO industrySpecDTO = industrySpecDO.buildMallIndustrySpecDTO(); .collect(Collectors.toList());
industrySpecDTO.setId(e.getId()); productSpecCPQVO.setSpecPrice(collect);
industrySpecDTO.setIndustrySpecId(e.getIndustrySpecId()); productSpecDTO.setProductSpecCPQVO(productSpecCPQVO);
industrySpecDTO.setIndustrySkuId(d.getSkuId());
industrySpec.add(industrySpecDTO); specList.add(productSpecDTO);
}
}
d.setIndustrySpecList(industrySpec);
}).collect(Collectors.toList());
return list;
}
private List<GoodsSpecDTO> getProductSpecInfo(Integer goodsInfoId) {
// 获取商品对应绑定sku的信息
List<MallProdInfoDO> mallProdSkuInfoList = goodsInfoDao.getMallProSkuInfo(goodsInfoId);
List<GoodsSpecDTO> list = mallProdSkuInfoList.stream().map(MallProdInfoDO::buildGoodsSpecDTO).collect(Collectors.toList());
// 获取规格来源详细信息
List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpec = goodsInfoDao.getMallProSkuInfoSpec(goodsInfoId);
// 根据id查询出规格的具体信息
list = list.stream().peek(d -> {
List<MallProductSpecDTO> specList = new ArrayList<>();
for (MallProdSkuInfoSpecDO e : mallProdSkuInfoSpec) {
if (d.getId().equals(e.getMallProdSkuInfoId())) {
// 构建规格对象
ProductSpecDO productSpecDO = e.getProductSpecDO();
MallProductSpecDTO productSpecDTO = productSpecDO.buildMallProductSpecDTO();
productSpecDTO.setProductSkuId(d.getSkuId());
productSpecDTO.setId(e.getId());
productSpecDTO.setProductSpec(e.getProductSpecId());
if (d.getFlag().equals(1)) {
// 获取自定义sku下规格的价格配置信息
ProductSpecCPQVO productSpecCPQVO = new ProductSpecCPQVO();
productSpecCPQVO.setProductSpecId(e.getProductSpecId());
List<ProductSpecPriceDO> productSpecPrice = productDao.getProductSpecPrice(productSpecCPQVO);
List<SpecPriceVO> collect = productSpecPrice.stream().map(m -> {
SpecPriceVO specPriceVO = new SpecPriceVO();
specPriceVO.setId(m.getId());
specPriceVO.setPrice(m.getPrice());
specPriceVO.setCooperationTag(m.getCooperationTag());
return specPriceVO;
}).collect(Collectors.toList());
productSpecCPQVO.setSpecPrice(collect);
productSpecDTO.setProductSpecCPQVO(productSpecCPQVO);
} }
specList.add(productSpecDTO); }
} d.setProductSpecList(specList);
} })
d.setProductSpecList(specList); .collect(Collectors.toList());
}).collect(Collectors.toList()); return list;
return list; }
}
private List<GoodsOtherServiceDTO> getOtherServiceInfo(Integer goodsInfoId) { public List<GoodsOtherServiceDTO> getOtherServiceInfo(Integer goodsInfoId) {
List<GoodsServiceDO> goodsServiceDO = goodsInfoDao.listGoodsServiceByGoodsId(goodsInfoId); List<GoodsServiceDO> goodsServiceDO = goodsInfoDao.listGoodsServiceByGoodsId(goodsInfoId);
return goodsServiceDO.stream().map(GoodsServiceDO::buildGoodsOtherServiceDTO).collect(Collectors.toList()); return goodsServiceDO.stream()
} .map(GoodsServiceDO::buildGoodsOtherServiceDTO)
.collect(Collectors.toList());
}
private GoodsDetailInfoDTO getGoodsDetail(Integer goodsInfoId) { public GoodsDetailInfoDTO getGoodsDetail(Integer goodsInfoId) {
GoodsDetailDO goodsDetail = goodsInfoDao.getGoodsDetailByGoodsId(goodsInfoId); GoodsDetailDO goodsDetail = goodsInfoDao.getGoodsDetailByGoodsId(goodsInfoId);
return goodsDetail.buildGoodsDetailInfoDTO(); return goodsDetail.buildGoodsDetailInfoDTO();
} }
private List<GoodsImgDTO> getGoodsImageInfo(Integer goodsInfoId) { public List<GoodsImgDTO> getGoodsImageInfo(Integer goodsInfoId) {
List<GoodsImgDO> goodsImgList = goodsInfoDao.listGoodsInfoByGoodsId(goodsInfoId); List<GoodsImgDO> goodsImgList = goodsInfoDao.listGoodsInfoByGoodsId(goodsInfoId);
return goodsImgList.stream().map(GoodsImgDO::buildGoodsImgDTO).collect(Collectors.toList()); return goodsImgList.stream().map(GoodsImgDO::buildGoodsImgDTO).collect(Collectors.toList());
} }
@Override
public ResultBody getSaleServiceInfoToList() {
List<SaleServiceDO> list = goodsInfoDao.listSaleServiceInfo();
List<SaleServiceDTO> serviceDTOList =
list.stream().map(d -> d.buildSaleServiceDTO()).collect(Collectors.toList());
return ResultBody.success(serviceDTOList);
}
@Override @Override
public ResultBody getSkuUnit() { public ResultBody getSkuUnit() {
List<SkuUnitDO> skuUnitList = goodsInfoDao.getSkuUnit(); List<SkuUnitDO> skuUnitList = goodsInfoDao.getSkuUnit();
List<SkuUnitDTO> list = skuUnitList.stream().map(SkuUnitDO::buildSkuUnitDTO).collect(Collectors.toList()); List<SkuUnitDTO> list =
return ResultBody.success(list); skuUnitList.stream().map(SkuUnitDO::buildSkuUnitDTO).collect(Collectors.toList());
} return ResultBody.success(list);
}
/** /**
* 根据商品id,商品规格id查询并填充相关信息 * 根据商品id,商品规格id查询并填充相关信息
* *
* @param param * @param param
* @return * @return
*/ */
@Override @Override
public List<MallGoodsShopCarDTO> fillGoodsInfo(List<MallGoodsShopCarDTO> param) { public List<MallGoodsShopCarDTO> fillGoodsInfo(List<MallGoodsShopCarDTO> param) {
Set<Integer> goodsIds = new HashSet<>(); Set<Integer> goodsIds = new HashSet<>();
//获取商品id // 获取商品id
for (MallGoodsShopCarDTO mallGoodsShopCarDTO : param) { for (MallGoodsShopCarDTO mallGoodsShopCarDTO : param) {
goodsIds.add(mallGoodsShopCarDTO.getGoodsInfoId()); goodsIds.add(mallGoodsShopCarDTO.getGoodsInfoId());
} }
//查询出商品信息后进行填充 // 查询出商品信息后进行填充
List<GoodsInfo> goodsInfoDOList = goodsInfoDao.listSimpleGoodsInfoByIds(goodsIds); List<GoodsInfo> goodsInfoDOList = goodsInfoDao.listSimpleGoodsInfoByIds(goodsIds);
for (MallGoodsShopCarDTO mallGoodsShopCarDTO : param) { for (MallGoodsShopCarDTO mallGoodsShopCarDTO : param) {
for (GoodsInfo goodsInfo : goodsInfoDOList) { for (GoodsInfo goodsInfo : goodsInfoDOList) {
if (mallGoodsShopCarDTO.getGoodsInfoId().toString().equals(goodsInfo.getId().toString())) { if (mallGoodsShopCarDTO.getGoodsInfoId().toString().equals(goodsInfo.getId().toString())) {
mallGoodsShopCarDTO.setDirectoryId(goodsInfo.getDirectoryId()); mallGoodsShopCarDTO.setDirectoryId(goodsInfo.getDirectoryId());
mallGoodsShopCarDTO.setShelfStatus(goodsInfo.getShelfStatus()); mallGoodsShopCarDTO.setShelfStatus(goodsInfo.getShelfStatus());
mallGoodsShopCarDTO.setGoodsName(goodsInfo.getGoodsName()); mallGoodsShopCarDTO.setGoodsName(goodsInfo.getGoodsName());
mallGoodsShopCarDTO.setMainImg(goodsInfo.getMainImg()); mallGoodsShopCarDTO.setMainImg(goodsInfo.getMainImg());
break; break;
}
}
} }
}
}
//对产品和行业的规格id进行分类 // 对产品和行业的规格id进行分类
Set<Integer> prodIds = new HashSet<>(); Set<Integer> prodIds = new HashSet<>();
Set<Integer> indstIds = new HashSet<>(); Set<Integer> indstIds = new HashSet<>();
for (MallGoodsShopCarDTO mallGoodsShopCarDTO : param) { for (MallGoodsShopCarDTO mallGoodsShopCarDTO : param) {
if (mallGoodsShopCarDTO.getDirectoryId().equals(1)) { if (mallGoodsShopCarDTO.getDirectoryId().equals(1)) {
for (MallSkuInfoSpecDTO mallSkuInfoSpecDTO : mallGoodsShopCarDTO.getSkuList()) { for (MallSkuInfoSpecDTO mallSkuInfoSpecDTO : mallGoodsShopCarDTO.getSkuList()) {
prodIds.add(mallSkuInfoSpecDTO.getMallSkuInfoSpecId()); prodIds.add(mallSkuInfoSpecDTO.getMallSkuInfoSpecId());
}
} else if (mallGoodsShopCarDTO.getDirectoryId().equals(2)) {
for (MallSkuInfoSpecDTO mallSkuInfoSpecDTO : mallGoodsShopCarDTO.getSkuList()) {
indstIds.add(mallSkuInfoSpecDTO.getMallSkuInfoSpecId());
}
}
} }
//根据规格id查找规格信息 } else if (mallGoodsShopCarDTO.getDirectoryId().equals(2)) {
List<MallGoodsSpecInfoDO> goodsSpecInfoDOList = new ArrayList<>(); for (MallSkuInfoSpecDTO mallSkuInfoSpecDTO : mallGoodsShopCarDTO.getSkuList()) {
if (!CollectionUtils.isEmpty(prodIds)) { indstIds.add(mallSkuInfoSpecDTO.getMallSkuInfoSpecId());
List<MallGoodsSpecInfoDO> goodsProdSpecInfoDOList = goodsInfoDao.listProdSpecInfo(prodIds);
goodsSpecInfoDOList.addAll(goodsProdSpecInfoDOList);
} }
if (!CollectionUtils.isEmpty(indstIds)) { }
List<MallGoodsSpecInfoDO> goodsIndstSpecInfoDOList = goodsInfoDao.listIndstSpecInfo(indstIds); }
goodsSpecInfoDOList.addAll(goodsIndstSpecInfoDOList); // 根据规格id查找规格信息
} List<MallGoodsSpecInfoDO> goodsSpecInfoDOList = new ArrayList<>();
//根据查出来的sku,填充到MallGoodsShopCarDTO里面 if (!CollectionUtils.isEmpty(prodIds)) {
for (MallGoodsShopCarDTO mallGoodsShopCarDTO : param) { List<MallGoodsSpecInfoDO> goodsProdSpecInfoDOList = goodsInfoDao.listProdSpecInfo(prodIds);
for (MallGoodsSpecInfoDO mallGoodsSpecInfoDO : goodsSpecInfoDOList) { goodsSpecInfoDOList.addAll(goodsProdSpecInfoDOList);
//找到对应商品 }
if (mallGoodsShopCarDTO.getGoodsInfoId().toString().equals(mallGoodsSpecInfoDO.getId().toString()) if (!CollectionUtils.isEmpty(indstIds)) {
&& mallGoodsShopCarDTO.getDirectoryId().toString().equals(mallGoodsSpecInfoDO.getDirectoryId().toString())) { List<MallGoodsSpecInfoDO> goodsIndstSpecInfoDOList = goodsInfoDao.listIndstSpecInfo(indstIds);
for (SkuSpecDO skuSpecDO : mallGoodsSpecInfoDO.getSkuSpecDOList()) { goodsSpecInfoDOList.addAll(goodsIndstSpecInfoDOList);
for (MallSkuInfoSpecDTO mallSkuInfoSpecDTO : mallGoodsShopCarDTO.getSkuList()) { }
//根据对应规格进行填充 // 根据查出来的sku,填充到MallGoodsShopCarDTO里面
if (skuSpecDO.getId().toString().equals(mallSkuInfoSpecDTO.getMallSkuInfoSpecId().toString())) { for (MallGoodsShopCarDTO mallGoodsShopCarDTO : param) {
mallSkuInfoSpecDTO.setSpecName(skuSpecDO.getSpecName()); for (MallGoodsSpecInfoDO mallGoodsSpecInfoDO : goodsSpecInfoDOList) {
mallSkuInfoSpecDTO.setDeleted(skuSpecDO.getSkuSpecDeleted()); // 找到对应商品
mallSkuInfoSpecDTO.setValid(skuSpecDO.getSkuSpecDeleted() == 0 && skuSpecDO.getSpecDeleted() == 0); if (mallGoodsShopCarDTO
break; .getGoodsInfoId()
} .toString()
} .equals(mallGoodsSpecInfoDO.getId().toString())
} && mallGoodsShopCarDTO
break; .getDirectoryId()
} .toString()
.equals(mallGoodsSpecInfoDO.getDirectoryId().toString())) {
for (SkuSpecDO skuSpecDO : mallGoodsSpecInfoDO.getSkuSpecDOList()) {
for (MallSkuInfoSpecDTO mallSkuInfoSpecDTO : mallGoodsShopCarDTO.getSkuList()) {
// 根据对应规格进行填充
if (skuSpecDO
.getId()
.toString()
.equals(mallSkuInfoSpecDTO.getMallSkuInfoSpecId().toString())) {
mallSkuInfoSpecDTO.setSpecName(skuSpecDO.getSpecName());
mallSkuInfoSpecDTO.setDeleted(skuSpecDO.getSkuSpecDeleted());
mallSkuInfoSpecDTO.setValid(
skuSpecDO.getSkuSpecDeleted() == 0 && skuSpecDO.getSpecDeleted() == 0);
break;
}
} }
}
break;
} }
return param; }
} }
return param;
@Override }
public List<MallProductSpecPriceDTO> feignListProductSpecPrice(ProductSpecPriceQO productSpecPriceQO) {
Set<Integer> ids = new HashSet<>(productSpecPriceQO.getProductSpecIds()); @Override
List<MallProductSpecPriceDTO> mallProductSpecPriceDTOS = productSpecPriceQO.getProductSpecIds().stream().map(d -> { public List<MallProductSpecPriceDTO> feignListProductSpecPrice(
MallProductSpecPriceDTO mallProductSpecPriceDTO = new MallProductSpecPriceDTO(); ProductSpecPriceQO productSpecPriceQO) {
mallProductSpecPriceDTO.setProductSpecId(d); Set<Integer> ids = new HashSet<>(productSpecPriceQO.getProductSpecIds());
return mallProductSpecPriceDTO; List<MallProductSpecPriceDTO> mallProductSpecPriceDTOS =
}).collect(Collectors.toList()); productSpecPriceQO.getProductSpecIds().stream()
//分别找出渠道价格和市场价格 .map(
List<ProductSpecPriceDO> productSpecPriceDOS = productDao.listProductSpecPrice(productSpecPriceQO.getChannelClass(), ids); d -> {
List<ProductSpecPriceDO> productSpecPriceDOS1 = productDao.listProductSpecPrice(0, ids); MallProductSpecPriceDTO mallProductSpecPriceDTO = new MallProductSpecPriceDTO();
//设置合作价格 mallProductSpecPriceDTO.setProductSpecId(d);
for (ProductSpecPriceDO productSpecPriceDO : productSpecPriceDOS) { return mallProductSpecPriceDTO;
for (MallProductSpecPriceDTO mallProductSpecPriceDTO : mallProductSpecPriceDTOS) { })
if (mallProductSpecPriceDTO.getProductSpecId().equals(productSpecPriceDO.getProductSpecId())) { .collect(Collectors.toList());
mallProductSpecPriceDTO.setOpPrice(productSpecPriceDO.getPrice()); // 分别找出渠道价格和市场价格
break; List<ProductSpecPriceDO> productSpecPriceDOS =
} productDao.listProductSpecPrice(productSpecPriceQO.getChannelClass(), ids);
} List<ProductSpecPriceDO> productSpecPriceDOS1 = productDao.listProductSpecPrice(0, ids);
// 设置合作价格
for (ProductSpecPriceDO productSpecPriceDO : productSpecPriceDOS) {
for (MallProductSpecPriceDTO mallProductSpecPriceDTO : mallProductSpecPriceDTOS) {
if (mallProductSpecPriceDTO
.getProductSpecId()
.equals(productSpecPriceDO.getProductSpecId())) {
mallProductSpecPriceDTO.setOpPrice(productSpecPriceDO.getPrice());
break;
} }
//设置市场价格 }
for (ProductSpecPriceDO productSpecPriceDO : productSpecPriceDOS1) { }
for (MallProductSpecPriceDTO mallProductSpecPriceDTO : mallProductSpecPriceDTOS) { // 设置市场价格
if (mallProductSpecPriceDTO.getProductSpecId().equals(productSpecPriceDO.getProductSpecId())) { for (ProductSpecPriceDO productSpecPriceDO : productSpecPriceDOS1) {
mallProductSpecPriceDTO.setMkPrice(productSpecPriceDO.getPrice()); for (MallProductSpecPriceDTO mallProductSpecPriceDTO : mallProductSpecPriceDTOS) {
break; if (mallProductSpecPriceDTO
} .getProductSpecId()
} .equals(productSpecPriceDO.getProductSpecId())) {
mallProductSpecPriceDTO.setMkPrice(productSpecPriceDO.getPrice());
break;
} }
return mallProductSpecPriceDTOS; }
} }
return mallProductSpecPriceDTOS;
}
@Override
public ProductSpecPriceDTO feignGetUnitPriceByTag(Integer id, Integer tagId) {
ProductSpecPriceDTO price = productDao.feignGetUnitPrice(id, tagId);
return price;
}
@Override @Override
public ProductSpecPriceDTO feignGetUnitPriceByTag(Integer id, Integer tagId) { public List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(
ProductSpecPriceDTO price = productDao.feignGetUnitPrice(id, tagId); MallOrderGoodsInfoQO mallOrderGoodsInfoQO) {
return price; // 查询渠道等级对应的商品价格
Set<Integer> prodSkuSpecIds =
productDao.listProductSpecIds(mallOrderGoodsInfoQO.getMallProdSkuSpecIds());
List<ProductSpecPriceDO> productSpecPriceDOS =
productDao.listProductSpecPrice(mallOrderGoodsInfoQO.getCooperationTagId(), prodSkuSpecIds);
// 查询商品信息
List<OrderGoodsProdDTO> orderGoodsProdDTOList =
productDao.listProdGoodsSkuInfo(mallOrderGoodsInfoQO);
if (!CollectionUtils.isEmpty(productSpecPriceDOS)) {
// 填充渠道价格
this.fillOrderGoodsProdPrice(orderGoodsProdDTOList, productSpecPriceDOS, prodSkuSpecIds);
} }
// 商品没有设置渠道价格的,按照市场价设置
if (!CollectionUtils.isEmpty(prodSkuSpecIds)) {
// 查询市场价格,tagInfoId为0
List<ProductSpecPriceDO> prodMarketPrice = productDao.listProductSpecPrice(0, prodSkuSpecIds);
// 填充市场价格
this.fillOrderGoodsProdPrice(orderGoodsProdDTOList, prodMarketPrice, prodSkuSpecIds);
}
// 还需配置商品规格金额, 单个商品skuSpecAmount, 全部小sku金额
List<Integer> goodsIds =
orderGoodsProdDTOList.stream()
.map(OrderGoodsProdDTO::getGoodsInfoId)
.collect(Collectors.toList());
// 拼装商品服务
List<GoodsServiceDTO> services =
goodsInfoDao.listGoodsService(goodsIds).stream()
.map(d -> d.buildGoodsServiceDTO())
.collect(Collectors.toList());
Map<Integer, List<GoodsServiceDTO>> mapGoodsService =
org.springframework.util.CollectionUtils.isEmpty(services)
? null
: services.stream().collect(Collectors.groupingBy(GoodsServiceDTO::getGoodsInfoId));
List<OrderGoodsProdDTO> collect =
orderGoodsProdDTOList.stream()
.map(
d -> {
OrderGoodsProdDTO orderGoodsProdDTO = d;
if (mapGoodsService != null && mapGoodsService.containsKey(d.getGoodsInfoId())) {
orderGoodsProdDTO.setServices(mapGoodsService.get(d.getGoodsInfoId()));
}
return orderGoodsProdDTO;
})
.collect(Collectors.toList());
return collect;
}
@Override /**
public List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO) { * 填充产品规格价格
//查询渠道等级对应的商品价格 *
Set<Integer> prodSkuSpecIds = productDao.listProductSpecIds(mallOrderGoodsInfoQO.getMallProdSkuSpecIds()); * @param orderGoodsProdDTOList
List<ProductSpecPriceDO> productSpecPriceDOS = productDao.listProductSpecPrice(mallOrderGoodsInfoQO.getCooperationTagId(), prodSkuSpecIds); * @param productSpecPriceDOS
//查询商品信息 * @param prodSkuSpecIds
List<OrderGoodsProdDTO> orderGoodsProdDTOList = productDao.listProdGoodsSkuInfo(mallOrderGoodsInfoQO); * @return
if (!CollectionUtils.isEmpty(productSpecPriceDOS)) { */
//填充渠道价格 private List<OrderGoodsProdDTO> fillOrderGoodsProdPrice(
this.fillOrderGoodsProdPrice(orderGoodsProdDTOList, productSpecPriceDOS, prodSkuSpecIds); List<OrderGoodsProdDTO> orderGoodsProdDTOList,
} List<ProductSpecPriceDO> productSpecPriceDOS,
//还需配置商品规格金额, 单个商品skuSpecAmount, 全部小sku金额 Set<Integer> prodSkuSpecIds) {
List<Integer> goodsIds = orderGoodsProdDTOList.stream().map(OrderGoodsProdDTO::getGoodsInfoId).collect(Collectors.toList()); for (OrderGoodsProdDTO orderGoodsProdDTO : orderGoodsProdDTOList) {
// 拼装商品服务 for (OrderGoodsProdDetailDTO orderGoodsProdDetailDTO :
List<GoodsServiceDTO> services = goodsInfoDao.listGoodsService(goodsIds).stream().map(d -> d.buildGoodsServiceDTO()).collect(Collectors.toList()); orderGoodsProdDTO.getOrderGoodsProdDetailDTOS()) {
Map<Integer, List<GoodsServiceDTO>> mapGoodsService = org.springframework.util.CollectionUtils.isEmpty(services) ? null // 配置价格
: services.stream() for (ProductSpecPriceDO productSpecPriceDO : productSpecPriceDOS) {
.collect(Collectors.groupingBy(GoodsServiceDTO::getGoodsInfoId)); // 找到规格对应的价格
if (productSpecPriceDO
List<OrderGoodsProdDTO> collect = orderGoodsProdDTOList.stream().map(d -> { .getProductSpecId()
OrderGoodsProdDTO orderGoodsProdDTO = d; .toString()
if (mapGoodsService != null && mapGoodsService.containsKey(d.getGoodsInfoId())) { .equals(orderGoodsProdDetailDTO.getProductSpecId().toString())) {
orderGoodsProdDTO.setServices(mapGoodsService.get(d.getGoodsInfoId())); orderGoodsProdDetailDTO.setUnitPrice(productSpecPriceDO.getPrice());
} // 配置价格后移除,剩余没有配置的
return orderGoodsProdDTO; prodSkuSpecIds.removeIf(
}).collect(Collectors.toList()); d -> d.toString().equals(orderGoodsProdDetailDTO.getProductSpecId().toString()));
return collect; break;
} }
/**
* 填充产品规格价格
*
* @param orderGoodsProdDTOList
* @param productSpecPriceDOS
* @param prodSkuSpecIds
* @return
*/
private List<OrderGoodsProdDTO> fillOrderGoodsProdPrice(List<OrderGoodsProdDTO> orderGoodsProdDTOList, List<ProductSpecPriceDO> productSpecPriceDOS, Set<Integer> prodSkuSpecIds) {
for (OrderGoodsProdDTO orderGoodsProdDTO : orderGoodsProdDTOList) {
for (OrderGoodsProdDetailDTO orderGoodsProdDetailDTO : orderGoodsProdDTO.getOrderGoodsProdDetailDTOS()) {
//配置价格
for (ProductSpecPriceDO productSpecPriceDO : productSpecPriceDOS) {
//找到规格对应的价格
if (productSpecPriceDO.getProductSpecId().toString().equals(orderGoodsProdDetailDTO.getProductSpecId().toString())) {
orderGoodsProdDetailDTO.setUnitPrice(productSpecPriceDO.getPrice());
//配置价格后移除,剩余没有配置的
prodSkuSpecIds.removeIf(d -> d.toString().equals(orderGoodsProdDetailDTO.getProductSpecId().toString()));
break;
}
}
}
}
return orderGoodsProdDTOList;
}
@Override
public List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO) {
//查询商品信息
List<MallGoodsInfoSimpleDO> mallGoodsInfoSimpleDOS = goodsInfoDao.listMallGoodsIndstSimpleInfo(mallOrderGoodsInfoQO.getMallIndstSkuSpecIds());
List<Integer> industrySpecIds = goodsInfoDao.listIndustrySpecIds(mallOrderGoodsInfoQO.getMallIndstSkuSpecIds());
//查询商品价格
List<IndustrySpecPriceDO> industrySpecPriceDOS = industrySpecDao.listIndustrySpecPrice(mallOrderGoodsInfoQO.getCooperationTagId(), industrySpecIds);
//查询商品行业规格对应的产品清单
List<MallGoodsProductDO> mallGoodsProductDOS = goodsInfoDao.listIndustryProductList(industrySpecIds);
//配置商品行业规格价格
this.fillOrderGoodsIndstPrice(mallGoodsInfoSimpleDOS, industrySpecPriceDOS, industrySpecIds);
if (!CollectionUtils.isEmpty(industrySpecIds)) {
//查询商品价格,找出市场价
List<IndustrySpecPriceDO> industryMarketPrice = industrySpecDao.listIndustrySpecPrice(0, industrySpecIds);
this.fillOrderGoodsIndstPrice(mallGoodsInfoSimpleDOS, industryMarketPrice, industrySpecIds);
}
//配置产品清单
for (MallGoodsInfoSimpleDO mallGoodsInfoSimpleDO : mallGoodsInfoSimpleDOS) {
for (MallGoodsSpecSimpleDO mallGoodsSpecSimpleDO : mallGoodsInfoSimpleDO.getMallGoodsSpecSimpleDOS()) {
mallGoodsSpecSimpleDO.setMallGoodsProductDOS(new ArrayList<MallGoodsProductDO>());
//从产品清单中拿出对应的方案规格里面
for (MallGoodsProductDO mallGoodsProductDO : mallGoodsProductDOS) {
if (mallGoodsProductDO.getIndustrySpecId().toString().equals(mallGoodsSpecSimpleDO.getIndustrySpecId().toString())) {
mallGoodsSpecSimpleDO.getMallGoodsProductDOS().add(mallGoodsProductDO);
}
}
}
} }
//转换对象 }
List<OrderGoodsIndstDTO> collect = mallGoodsInfoSimpleDOS.stream().map(d -> d.buildOrderGoodsIndstDTO()).collect(Collectors.toList()); }
// 拼装商品服务 return orderGoodsProdDTOList;
List<Integer> goodsIds = collect.stream().map(OrderGoodsIndstDTO::getGoodsInfoId).collect(Collectors.toList()); }
List<GoodsServiceDTO> services = goodsInfoDao.listGoodsService(goodsIds).stream().map(d -> d.buildGoodsServiceDTO()).collect(Collectors.toList());
Map<Integer, List<GoodsServiceDTO>> mapGoodsService = org.springframework.util.CollectionUtils.isEmpty(services) ? null @Override
: services.stream() public List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(
.collect(Collectors.groupingBy(GoodsServiceDTO::getGoodsInfoId)); MallOrderGoodsInfoQO mallOrderGoodsInfoQO) {
List<OrderGoodsIndstDTO> resultList = collect.stream().map(d -> { // 查询商品信息
OrderGoodsIndstDTO orderGoodsIndstDTO = d; List<MallGoodsInfoSimpleDO> mallGoodsInfoSimpleDOS =
if (mapGoodsService != null && mapGoodsService.containsKey(d.getGoodsInfoId())) { goodsInfoDao.listMallGoodsIndstSimpleInfo(mallOrderGoodsInfoQO.getMallIndstSkuSpecIds());
orderGoodsIndstDTO.setServices(mapGoodsService.get(d.getGoodsInfoId())); List<Integer> industrySpecIds =
} goodsInfoDao.listIndustrySpecIds(mallOrderGoodsInfoQO.getMallIndstSkuSpecIds());
return orderGoodsIndstDTO; // 查询商品价格
}).collect(Collectors.toList()); List<IndustrySpecPriceDO> industrySpecPriceDOS =
return resultList; industrySpecDao.listIndustrySpecPrice(
} mallOrderGoodsInfoQO.getCooperationTagId(), industrySpecIds);
// 查询商品行业规格对应的产品清单
private List<MallGoodsInfoSimpleDO> fillOrderGoodsIndstPrice(List<MallGoodsInfoSimpleDO> mallGoodsInfoSimpleDOS, List<IndustrySpecPriceDO> industrySpecPriceDOS, List<Integer> industrySpecIds) { List<MallGoodsProductDO> mallGoodsProductDOS =
//配置商品行业规格价格 goodsInfoDao.listIndustryProductList(industrySpecIds);
for (MallGoodsInfoSimpleDO mallGoodsInfoSimpleDO : mallGoodsInfoSimpleDOS) { // 配置商品行业规格价格
for (MallGoodsSpecSimpleDO mallGoodsSpecSimpleDO : mallGoodsInfoSimpleDO.getMallGoodsSpecSimpleDOS()) { this.fillOrderGoodsIndstPrice(mallGoodsInfoSimpleDOS, industrySpecPriceDOS, industrySpecIds);
//查询规格进行配置 if (!CollectionUtils.isEmpty(industrySpecIds)) {
for (IndustrySpecPriceDO industrySpecPriceDO : industrySpecPriceDOS) { // 查询商品价格,找出市场价
if (mallGoodsSpecSimpleDO.getIndustrySpecId().toString().equals(industrySpecPriceDO.getIndustrySpecId().toString())) { List<IndustrySpecPriceDO> industryMarketPrice =
mallGoodsSpecSimpleDO.setUnitPrice(industrySpecPriceDO.getPrice()); industrySpecDao.listIndustrySpecPrice(0, industrySpecIds);
industrySpecIds.removeIf(d -> d.toString().equals(industrySpecPriceDO.getIndustrySpecId().toString())); this.fillOrderGoodsIndstPrice(mallGoodsInfoSimpleDOS, industryMarketPrice, industrySpecIds);
break; }
} // 配置产品清单
} for (MallGoodsInfoSimpleDO mallGoodsInfoSimpleDO : mallGoodsInfoSimpleDOS) {
} for (MallGoodsSpecSimpleDO mallGoodsSpecSimpleDO :
mallGoodsInfoSimpleDO.getMallGoodsSpecSimpleDOS()) {
mallGoodsSpecSimpleDO.setMallGoodsProductDOS(new ArrayList<MallGoodsProductDO>());
// 从产品清单中拿出对应的方案规格里面
for (MallGoodsProductDO mallGoodsProductDO : mallGoodsProductDOS) {
if (mallGoodsProductDO
.getIndustrySpecId()
.toString()
.equals(mallGoodsSpecSimpleDO.getIndustrySpecId().toString())) {
mallGoodsSpecSimpleDO.getMallGoodsProductDOS().add(mallGoodsProductDO);
}
} }
return mallGoodsInfoSimpleDOS; }
} }
} // 转换对象
List<OrderGoodsIndstDTO> collect =
mallGoodsInfoSimpleDOS.stream()
.map(d -> d.buildOrderGoodsIndstDTO())
.collect(Collectors.toList());
// 拼装商品服务
List<Integer> goodsIds =
collect.stream().map(OrderGoodsIndstDTO::getGoodsInfoId).collect(Collectors.toList());
List<GoodsServiceDTO> services =
goodsInfoDao.listGoodsService(goodsIds).stream()
.map(d -> d.buildGoodsServiceDTO())
.collect(Collectors.toList());
Map<Integer, List<GoodsServiceDTO>> mapGoodsService =
org.springframework.util.CollectionUtils.isEmpty(services)
? null
: services.stream().collect(Collectors.groupingBy(GoodsServiceDTO::getGoodsInfoId));
List<OrderGoodsIndstDTO> resultList =
collect.stream()
.map(
d -> {
OrderGoodsIndstDTO orderGoodsIndstDTO = d;
if (mapGoodsService != null && mapGoodsService.containsKey(d.getGoodsInfoId())) {
orderGoodsIndstDTO.setServices(mapGoodsService.get(d.getGoodsInfoId()));
}
return orderGoodsIndstDTO;
})
.collect(Collectors.toList());
return resultList;
}
private List<MallGoodsInfoSimpleDO> fillOrderGoodsIndstPrice(
List<MallGoodsInfoSimpleDO> mallGoodsInfoSimpleDOS,
List<IndustrySpecPriceDO> industrySpecPriceDOS,
List<Integer> industrySpecIds) {
// 配置商品行业规格价格
for (MallGoodsInfoSimpleDO mallGoodsInfoSimpleDO : mallGoodsInfoSimpleDOS) {
for (MallGoodsSpecSimpleDO mallGoodsSpecSimpleDO :
mallGoodsInfoSimpleDO.getMallGoodsSpecSimpleDOS()) {
// 查询规格进行配置
for (IndustrySpecPriceDO industrySpecPriceDO : industrySpecPriceDOS) {
if (mallGoodsSpecSimpleDO
.getIndustrySpecId()
.toString()
.equals(industrySpecPriceDO.getIndustrySpecId().toString())) {
mallGoodsSpecSimpleDO.setUnitPrice(industrySpecPriceDO.getPrice());
industrySpecIds.removeIf(
d -> d.toString().equals(industrySpecPriceDO.getIndustrySpecId().toString()));
break;
}
}
}
}
return mallGoodsInfoSimpleDOS;
}
@Override
public PageResult listPageGoodsInfo(MallGoodsQO param) {
int count = goodsInfoDao.countListGoodsInfo(param);
if (count == 0) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
}
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<GoodsInfo> goodsInfo = goodsInfoDao.listGoodsInfo(param);
List<GoodsInfoListDTO> pageList =
goodsInfo.stream().map(GoodsInfo::buildGoodsInfoListDTO).collect(Collectors.toList());
return PageResult.buildPage(pageNo, param.getPageSize(), count, pageList);
}
@Override
public ResultBody batchOnShelfOrTakeDown(List<Integer> ids, Integer status) {
goodsInfoDao.batchUpOrDownWare(ids, status);
return ResultBody.success();
}
@Override
public ResultBody batchRemoveWareInfo(List<Integer> ids) {
goodsInfoDao.removeWareInfo(ids);
return ResultBody.success();
}
}
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; ...@@ -3,12 +3,9 @@ package com.mmc.pms.service.Impl;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum; import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.dao.MiniProgramProductMallDao; import com.mmc.pms.dao.MiniProgramProductMallDao;
import com.mmc.pms.dao.WebDeviceDao;
import com.mmc.pms.entity.*; 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.dto.*;
import com.mmc.pms.model.sale.vo.GoodsProductSkuVO; import com.mmc.pms.model.sale.vo.GoodsProductSkuVO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.MiniProgramProductMallService; import com.mmc.pms.service.MiniProgramProductMallService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -26,210 +23,184 @@ import java.util.stream.Collectors; ...@@ -26,210 +23,184 @@ import java.util.stream.Collectors;
@Service @Service
public class MiniProgramProductMallServiceImpl implements MiniProgramProductMallService { public class MiniProgramProductMallServiceImpl implements MiniProgramProductMallService {
@Autowired @Autowired private MiniProgramProductMallDao goodsInfoDao;
private MiniProgramProductMallDao goodsInfoDao;
@Autowired
private WebDeviceDao webDeviceDao;
@Override @Override
public ResultBody getAppGoodsInfoDetail(Integer goodsId) { public ResultBody getAppGoodsInfoDetail(Integer goodsId) {
// 查询此商品是否下架或删除 // 查询此商品是否下架或删除
GoodsInfoDO goodsInfoDO = goodsInfoDao.getGoodsInfoByGoodsId(goodsId); GoodsInfoDO goodsInfoDO = goodsInfoDao.getGoodsInfoByGoodsId(goodsId);
if (goodsInfoDO == null || goodsInfoDO.getShelfStatus().equals(0)) { if (goodsInfoDO == null || goodsInfoDO.getShelfStatus().equals(0)) {
return ResultBody.error(ResultEnum.SHOP_GOODS_NOT_ERROR); return ResultBody.error(ResultEnum.SHOP_GOODS_NOT_ERROR);
} }
AppGoodsInfoDetailDTO appGoodsInfoDetailDTO = new AppGoodsInfoDetailDTO(); AppGoodsInfoDetailDTO appGoodsInfoDetailDTO = new AppGoodsInfoDetailDTO();
appGoodsInfoDetailDTO appGoodsInfoDetailDTO
.setId(goodsInfoDO.getId()) .setId(goodsInfoDO.getId())
.setGoodsName(goodsInfoDO.getGoodsName()) .setGoodsName(goodsInfoDO.getGoodsName())
.setGoodsVideoId(goodsInfoDO.getGoodsVideoId()) .setGoodsVideoId(goodsInfoDO.getGoodsVideoId())
.setMasterTypeId(goodsInfoDO.getMasterTypeId()) .setMasterTypeId(goodsInfoDO.getMasterTypeId())
.setRepoId(goodsInfoDO.getRepoId()) .setRepoId(goodsInfoDO.getRepoId())
.setSortTypeId(goodsInfoDO.getSortTypeId()) .setSortTypeId(goodsInfoDO.getSortTypeId())
.setShelfStatus(goodsInfoDO.getShelfStatus()) .setShelfStatus(goodsInfoDO.getShelfStatus())
.setSlaveTypeId(goodsInfoDO.getSlaveTypeId()) .setSlaveTypeId(goodsInfoDO.getSlaveTypeId())
.setShareFlyServiceId(goodsInfoDO.getShareFlyServiceId()) .setShareFlyServiceId(goodsInfoDO.getShareFlyServiceId())
.setGoodsVideo(goodsInfoDO.getVideoUrl()) .setGoodsVideo(goodsInfoDO.getVideoUrl())
.setTag(goodsInfoDO.getTag()) .setTag(goodsInfoDO.getTag())
.setPid(goodsInfoDO.getPid()); .setPid(goodsInfoDO.getPid());
// 获取商品图片信息 // 获取商品图片信息
List<GoodsImgDO> goodsImgDO = goodsInfoDao.listGoodsInfoByGoodsId(goodsId); List<GoodsImgDO> goodsImgDO = goodsInfoDao.listGoodsInfoByGoodsId(goodsId);
appGoodsInfoDetailDTO.setImages( appGoodsInfoDetailDTO.setImages(
goodsImgDO.stream().map(GoodsImgDO::buildGoodsImgDTO).collect(Collectors.toList())); goodsImgDO.stream().map(GoodsImgDO::buildGoodsImgDTO).collect(Collectors.toList()));
// 获取商品详情信息 // 获取商品详情信息
GoodsDetailDO goodsDetailDO = goodsInfoDao.getGoodsDetailByGoodsId(goodsId); GoodsDetailDO goodsDetailDO = goodsInfoDao.getGoodsDetailByGoodsId(goodsId);
appGoodsInfoDetailDTO.setGoodsDetail(goodsDetailDO.buildGoodsDetailInfoDTO()); appGoodsInfoDetailDTO.setGoodsDetail(goodsDetailDO.buildGoodsDetailInfoDTO());
// 获取其他服务信息 // 获取其他服务信息
List<GoodsServiceDO> goodsServiceDO = goodsInfoDao.listGoodsServiceByGoodsId(goodsId); List<GoodsServiceDO> goodsServiceDO = goodsInfoDao.listGoodsServiceByGoodsId(goodsId);
appGoodsInfoDetailDTO.setOtherService( appGoodsInfoDetailDTO.setOtherService(
goodsServiceDO.stream() goodsServiceDO.stream()
.map(GoodsServiceDO::buildGoodsOtherServiceDTO) .map(GoodsServiceDO::buildGoodsOtherServiceDTO)
.collect(Collectors.toList())); .collect(Collectors.toList()));
// 判断商品是什么类型 // 判断商品是什么类型
if (!goodsInfoDO.getSortTypeId().equals(2)) { if (!goodsInfoDO.getSortTypeId().equals(2)) {
// 获取该商品绑定的sku信息 // 获取该商品绑定的sku信息
List<MallProdInfoDO> mallProdSkuInfo = goodsInfoDao.getMallProdInfoByGoodsId(goodsId); List<MallProdInfoDO> mallProdSkuInfo = goodsInfoDao.getMallProdInfoByGoodsId(goodsId);
// 获取该商品绑定的规格信息 // 获取该商品绑定的规格信息
List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpecList = List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpecList =
goodsInfoDao.listMallProdSkuInfoSpec(goodsId); goodsInfoDao.listMallProdSkuInfoSpec(goodsId);
Map<Integer, List<MallProdSkuInfoSpecDO>> specMap = Map<Integer, List<MallProdSkuInfoSpecDO>> specMap =
mallProdSkuInfoSpecList.stream() mallProdSkuInfoSpecList.stream()
.collect(Collectors.groupingBy(MallProdSkuInfoSpecDO::getMallProdSkuInfoId)); .collect(Collectors.groupingBy(MallProdSkuInfoSpecDO::getMallProdSkuInfoId));
List<GoodsSpecDTO> list = List<GoodsSpecDTO> list =
mallProdSkuInfo.stream() mallProdSkuInfo.stream()
.map( .map(
d -> { d -> {
// 获取sku下规格信息 // 获取sku下规格信息
List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpecDOList = specMap.get(d.getId()); List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpecDOList = specMap.get(d.getId());
List<ProductSpecDO> productSpecList = List<ProductSpecDO> productSpecList =
goodsInfoDao.listProductSpecInfo( goodsInfoDao.listProductSpecInfo(
mallProdSkuInfoSpecDOList.stream() mallProdSkuInfoSpecDOList.stream()
.map(MallProdSkuInfoSpecDO::getProductSpecId) .map(MallProdSkuInfoSpecDO::getProductSpecId)
.collect(Collectors.toList())); .collect(Collectors.toList()));
List<MallProductSpecDTO> collect = List<MallProductSpecDTO> collect =
productSpecList.stream() productSpecList.stream()
.map(ProductSpecDO::buildMallProductSpecDTO) .map(ProductSpecDO::buildMallProductSpecDTO)
.collect(Collectors.toList());
collect.stream()
.peek(
m -> {
for (MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO :
mallProdSkuInfoSpecDOList) {
if (m.getProductSpec()
.equals(mallProdSkuInfoSpecDO.getProductSpecId())) {
m.setId(mallProdSkuInfoSpecDO.getId());
break;
}
}
})
.collect(Collectors.toList());
GoodsSpecDTO goodsSpecDTO = new GoodsSpecDTO();
goodsSpecDTO
.setId(d.getId())
.setSkuId(d.getProdSkuId())
.setGoodsSpecName(d.getProdSkuSpecName())
.setSkuName(d.getProductSkuName())
.setBrandInfoId(d.getBrandInfoId())
.setCategoryId(d.getCategoriesId())
.setTypeName(d.getTypeName())
.setChooseType(d.getChooseType())
.setSkuUnitId(d.getSkuUnitId())
.setUnitName(d.getUnitName())
.setMust(d.getMust())
.setProductSpecList(collect);
return goodsSpecDTO;
})
.collect(Collectors.toList()); .collect(Collectors.toList());
appGoodsInfoDetailDTO.setGoodsSpec(list); collect.stream()
} else { .peek(
appGoodsInfoDetailDTO.setGoodsSpec(getIndustrySpecInfo(goodsId)); m -> {
} for (MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO :
return ResultBody.success(appGoodsInfoDetailDTO); mallProdSkuInfoSpecDOList) {
if (m.getProductSpec()
.equals(mallProdSkuInfoSpecDO.getProductSpecId())) {
m.setId(mallProdSkuInfoSpecDO.getId());
break;
}
}
})
.collect(Collectors.toList());
GoodsSpecDTO goodsSpecDTO = new GoodsSpecDTO();
goodsSpecDTO
.setId(d.getId())
.setSkuId(d.getProdSkuId())
.setGoodsSpecName(d.getProdSkuSpecName())
.setSkuName(d.getProductSkuName())
.setBrandInfoId(d.getBrandInfoId())
.setCategoryId(d.getCategoriesId())
.setTypeName(d.getTypeName())
.setChooseType(d.getChooseType())
.setSkuUnitId(d.getSkuUnitId())
.setUnitName(d.getUnitName())
.setMust(d.getMust())
.setProductSpecList(collect);
return goodsSpecDTO;
})
.collect(Collectors.toList());
appGoodsInfoDetailDTO.setGoodsSpec(list);
} else {
appGoodsInfoDetailDTO.setGoodsSpec(getIndustrySpecInfo(goodsId));
} }
return ResultBody.success(appGoodsInfoDetailDTO);
}
@Override private List<GoodsSpecDTO> getIndustrySpecInfo(Integer goodsInfoId) {
public ResultBody listGoodsByQO(GoodsInfoQO param) { // 获取商品对应绑定的行业sku信息
int count = goodsInfoDao.countListGoodsByQO(param); List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList =
if (count == 0) { goodsInfoDao.getMallIndustrySkuInfo(goodsInfoId);
return ResultBody.success( List<GoodsSpecDTO> list =
PageResult.buildPage(param.getPageNo(), param.getPageSize(), count)); mallIndustrySkuInfoList.stream()
} .map(MallIndustrySkuInfoDO::buildGoodsSpecDTO)
int pageNo = param.getPageNo(); .collect(Collectors.toList());
param.buildCurrentPage(); // 根据商品id查出该商品下绑定的规格信息
List<GoodsInfoDO> list = goodsInfoDao.listGoodsByQO(param); List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpec =
// 找出行业对应的序号 goodsInfoDao.getIndustrySkuInfoSpec(goodsInfoId);
List<GoodsTypeDO> ids = goodsInfoDao.listIndustryIdBySort(); list =
int order = 0; list.stream()
/*if (param.getMasterTypeId() != null) { .peek(
for (int i = 0; i < ids.size(); i++) { d -> {
if (param.getMasterTypeId().toString().equals(ids.get(i).getId().toString())) { List<MallIndustrySpecDTO> industrySpec = new ArrayList<>();
order = i + 1; for (MallIndustrySkuInfoSpecDO e : mallIndustrySkuInfoSpec) {
break; if (d.getId().equals(e.getMallIndustrySkuInfoId())) {
} IndustrySpecDO industrySpecDO = e.getIndustrySpecDO();
} // 获取商品清单信息
}*/ List<IndustryProductInventoryDO> industryProdInventory =
List<AppGoodsInfoDTO> pageList = new ArrayList<>(); goodsInfoDao.getIndustryProductInventory(e.getIndustrySpecId());
for (GoodsInfoDO d : list) { List<ProductInventoryVO> productInventoryList = new ArrayList<>();
AppGoodsInfoDTO appGoodsInfoDTO = d.buildAppGoodsInfoDTO(); // 获取行业规格绑定的产品规格信息
// 直接看该服务在当前行业对应所有服务中在第几个 List<InventorySpecDO> inventorySpecDOList =
for (int j = 0; j < list.size(); j++) { goodsInfoDao.listInventorySpec(
if (appGoodsInfoDTO.getId().toString().equals(list.get(j).getId().toString())) { industryProdInventory.stream()
if (j < 9) { .map(IndustryProductInventoryDO::getId)
appGoodsInfoDTO.setCode(order + "0" + (j + 1)); .collect(Collectors.toList()));
} else { Map<Integer, List<InventorySpecDO>> inventoryMap =
appGoodsInfoDTO.setCode(order + "" + (j + 1)); 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());
industrySpecDTO.setProductInventoryList(productInventoryList);
industrySpec.add(industrySpecDTO);
} }
break; }
} d.setIndustrySpecList(industrySpec);
} })
if (appGoodsInfoDTO.getShelfStatus() == 1) { .collect(Collectors.toList());
pageList.add(appGoodsInfoDTO); return list;
} }
}
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, pageList));
}
private List<GoodsSpecDTO> getIndustrySpecInfo(Integer goodsInfoId) { private void getIndustrySpecOnProdSpecInfo(
// 获取商品对应绑定的行业sku信息 List<IndustryProductInventoryDO> industryProdInventory,
List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList = goodsInfoDao.getMallIndustrySkuInfo(goodsInfoId); List<ProductInventoryVO> productInventoryList,
List<GoodsSpecDTO> list = mallIndustrySkuInfoList.stream().map(MallIndustrySkuInfoDO::buildGoodsSpecDTO).collect(Collectors.toList()); Map<Integer, List<InventorySpecDO>> inventoryMap) {
// 根据商品id查出该商品下绑定的规格信息 for (IndustryProductInventoryDO industryProductInventoryDO : industryProdInventory) {
List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpec = goodsInfoDao.getIndustrySkuInfoSpec(goodsInfoId); List<InventorySpecDO> inventorySpec = inventoryMap.get(industryProductInventoryDO.getId());
list = list.stream().peek(d -> { if (!CollectionUtils.isEmpty(inventorySpec)) {
List<MallIndustrySpecDTO> industrySpec = new ArrayList<>(); List<ProductSpecVO> productSpecList =
for (MallIndustrySkuInfoSpecDO e : mallIndustrySkuInfoSpec) { inventorySpec.stream()
if (d.getId().equals(e.getMallIndustrySkuInfoId())) { .map(
IndustrySpecDO industrySpecDO = e.getIndustrySpecDO(); in -> {
// 获取商品清单信息 ProductSpecDO productSpecDetail =
List<IndustryProductInventoryDO> industryProdInventory = goodsInfoDao.getIndustryProductInventory(e.getIndustrySpecId()); goodsInfoDao.getProductSpecDetail(in.getProductSpecId());
List<ProductInventoryVO> productInventoryList = new ArrayList<>(); ProductSpecVO productSpecVO = new ProductSpecVO();
// 获取行业规格绑定的产品规格信息 BeanUtils.copyProperties(productSpecDetail, productSpecVO);
List<InventorySpecDO> inventorySpecDOList = goodsInfoDao.listInventorySpec(industryProdInventory.stream().map(IndustryProductInventoryDO::getId).collect(Collectors.toList())); return productSpecVO;
Map<Integer, List<InventorySpecDO>> inventoryMap = inventorySpecDOList.stream().collect(Collectors.groupingBy(InventorySpecDO::getIndustryProductInventoryId)); })
getIndustrySpecOnProdSpecInfo(industryProdInventory, productInventoryList, inventoryMap); .collect(Collectors.toList());
MallIndustrySpecDTO industrySpecDTO = industrySpecDO.buildMallIndustrySpecDTO(); ProductSkuDO productSkuDetail =
industrySpecDTO.setId(e.getId()); goodsInfoDao.getProductSkuDetail(industryProductInventoryDO.getProductSkuId());
industrySpecDTO.setIndustrySpecId(e.getIndustrySpecId()); GoodsProductSkuVO goodsProductSkuVO = new GoodsProductSkuVO();
industrySpecDTO.setIndustrySkuId(d.getSkuId()); BeanUtils.copyProperties(productSkuDetail, goodsProductSkuVO);
industrySpecDTO.setProductInventoryList(productInventoryList); // 添加数据
industrySpec.add(industrySpecDTO); ProductInventoryVO productInventoryVO = new ProductInventoryVO();
} productInventoryVO.setSelect(industryProductInventoryDO.getSelected());
} productInventoryVO.setProductSku(goodsProductSkuVO);
d.setIndustrySpecList(industrySpec); productInventoryVO.setProductSpecList(productSpecList);
}).collect(Collectors.toList()); productInventoryList.add(productInventoryVO);
return list; }
}
private void getIndustrySpecOnProdSpecInfo(
List<IndustryProductInventoryDO> industryProdInventory,
List<ProductInventoryVO> productInventoryList,
Map<Integer, List<InventorySpecDO>> inventoryMap) {
for (IndustryProductInventoryDO industryProductInventoryDO : industryProdInventory) {
List<InventorySpecDO> inventorySpec = inventoryMap.get(industryProductInventoryDO.getId());
if (!CollectionUtils.isEmpty(inventorySpec)) {
List<ProductSpecVO> productSpecList =
inventorySpec.stream()
.map(
in -> {
ProductSpecDO productSpecDetail =
goodsInfoDao.getProductSpecDetail(in.getProductSpecId());
ProductSpecVO productSpecVO = new ProductSpecVO();
BeanUtils.copyProperties(productSpecDetail, productSpecVO);
return productSpecVO;
})
.collect(Collectors.toList());
ProductSkuDO productSkuDetail =
goodsInfoDao.getProductSkuDetail(industryProductInventoryDO.getProductSkuId());
GoodsProductSkuVO goodsProductSkuVO = new GoodsProductSkuVO();
BeanUtils.copyProperties(productSkuDetail, goodsProductSkuVO);
// 添加数据
ProductInventoryVO productInventoryVO = new ProductInventoryVO();
productInventoryVO.setSelect(industryProductInventoryDO.getSelected());
productInventoryVO.setProductSku(goodsProductSkuVO);
productInventoryVO.setProductSpecList(productSpecList);
productInventoryList.add(productInventoryVO);
}
}
} }
}
} }
...@@ -11,9 +11,9 @@ import com.mmc.pms.model.sale.dto.*; ...@@ -11,9 +11,9 @@ import com.mmc.pms.model.sale.dto.*;
import com.mmc.pms.model.sale.vo.ProductSpecCPQVO; import com.mmc.pms.model.sale.vo.ProductSpecCPQVO;
import com.mmc.pms.page.PageResult; import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.ProductSkuService; import com.mmc.pms.service.ProductSkuService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -27,257 +27,310 @@ import java.util.stream.Collectors; ...@@ -27,257 +27,310 @@ import java.util.stream.Collectors;
*/ */
@Service @Service
public class ProductServiceImpl implements ProductSkuService { public class ProductServiceImpl implements ProductSkuService {
@Autowired @Autowired private ProductDao productDao;
private ProductDao productDao; @Autowired private IndustrySpecDao industrySpecDao;
@Autowired
private IndustrySpecDao industrySpecDao;
@Override @Override
public ResultBody addProductSku(ProductSkuVO param) { public ResultBody addProductSku(ProductSkuVO param) {
// 获取名称判断此前是否已经存在 // 获取名称判断此前是否已经存在
int count = productDao.countSkuName(param); int count = productDao.countSkuName(param);
if (count > 0) { if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR); return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
ProductSkuDO productSkuDO = new ProductSkuDO(param);
// 新增产品sku
int status = productDao.insertProductSku(productSkuDO);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_ADD_DATA);
}
return ResultBody.success();
} }
ProductSkuDO productSkuDO = new ProductSkuDO(param);
@Override productSkuDO.setCustomize(0);
public ResultBody getProductSkuDetail(Integer id) { // 新增产品sku
// 校验此sku是否还存在或已删除 int status = productDao.insertProductSku(productSkuDO);
int count = productDao.countSkuIsExist(id); if (status <= 0) {
if (count <= 0) { return ResultBody.error(ResultEnum.FAILED_TO_ADD_DATA);
return ResultBody.error(ResultEnum.SKU_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
}
ProductSkuDO productSkuDO = productDao.getProductSkuDetail(id);
return ResultBody.success(productSkuDO.buildProductSkuDTO());
} }
return ResultBody.success();
}
@Override @Override
public ResultBody editProductSku(ProductSkuVO param) { public ResultBody getProductSkuDetail(Integer id) {
// 获取名称判断此前是否已经存在 // 校验此sku是否还存在或已删除
int count = productDao.countSkuName(param); int count = productDao.countSkuIsExist(id);
if (count > 0) { if (count <= 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR); return ResultBody.error(ResultEnum.SKU_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
}
ProductSkuDO productSkuDO = new ProductSkuDO(param);
int status = productDao.updateProductSku(productSkuDO);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_EDIT_DATA);
}
return ResultBody.success();
} }
ProductSkuDO productSkuDO = productDao.getProductSkuDetail(id);
return ResultBody.success(productSkuDO.buildProductSkuDTO());
}
@Override @Override
public ResultBody listPageProductSku(ProductSkuQO productSkuQO) { public ResultBody editProductSku(ProductSkuVO param) {
int count = productDao.countListPageProductSku(productSkuQO); // 获取名称判断此前是否已经存在
if (count == 0) { int count = productDao.countSkuName(param);
return ResultBody.success(PageResult.buildPage(productSkuQO.getPageNo(), productSkuQO.getPageSize(), count)); if (count > 0) {
} return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
Integer pageNo = productSkuQO.getPageNo();
productSkuQO.buildCurrentPage();
List<ProductSkuDO> productSkuList = productDao.listPageProductSku(productSkuQO);
List<Integer> productSkuIds = productSkuList.stream().map(ProductSkuDO::getId).collect(Collectors.toList());
List<ProductSpecDO> productSpecList = productDao.getProductSpecList(productSkuIds);
Map<Integer, List<ProductSpecDO>> productSpecMap = productSpecList.stream().collect(Collectors.groupingBy(ProductSpecDO::getProductSkuId));
List<ProductSkuDTO> list = productSkuList.stream()
.map(ProductSkuDO::buildProductSkuDTO)
.collect(Collectors.toList());
list.stream().peek(d -> {
List<ProductSpecDO> productSpecDOS = productSpecMap.get(d.getId());
if (CollectionUtils.isEmpty(productSpecDOS)) {
d.setProductSpecList(null);
} else {
d.setProductSpecList(productSpecDOS.stream().map(ProductSpecDO::buildProductSpecDTO).collect(Collectors.toList()));
}
}).collect(Collectors.toList());
return ResultBody.success(PageResult.buildPage(pageNo, productSkuQO.getPageSize(), count, list));
} }
ProductSkuDO productSkuDO = new ProductSkuDO(param);
@Override int status = productDao.updateProductSku(productSkuDO);
public ResultBody addOrEditProductSpec(ProductSpecVO param) { if (status <= 0) {
// 获取名称判断此前是否已经存在 return ResultBody.error(ResultEnum.FAILED_TO_EDIT_DATA);
int count = productDao.countSpecName(param);
if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
if (param.getId() == null) {
ProductSpecDO productSpecDO = new ProductSpecDO(param);
// 新增产品sku
int status = productDao.insertProductSpec(productSpecDO);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_ADD_DATA);
}
} else {
ProductSpecDO productSpecDO = new ProductSpecDO(param);
int status = productDao.updateProductSpec(productSpecDO);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_EDIT_DATA);
}
}
return ResultBody.success();
} }
return ResultBody.success();
}
@Override @Override
public ResultBody getProductSpecDetail(Integer id) { public ResultBody listPageProductSku(ProductSkuQO productSkuQO) {
// 校验此sku是否还存在或已删除 int count = productDao.countListPageProductSku(productSkuQO);
int count = productDao.countSpecIsExist(id); if (count == 0) {
if (count <= 0) { return ResultBody.success(
return ResultBody.error(ResultEnum.SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED); PageResult.buildPage(productSkuQO.getPageNo(), productSkuQO.getPageSize(), count));
}
ProductSpecDO productSpecDO = productDao.getProductSpecDetail(id);
return ResultBody.success(productSpecDO.buildProductSpecDTO());
} }
Integer pageNo = productSkuQO.getPageNo();
productSkuQO.buildCurrentPage();
List<ProductSkuDO> productSkuList = productDao.listPageProductSku(productSkuQO);
List<Integer> productSkuIds =
productSkuList.stream().map(ProductSkuDO::getId).collect(Collectors.toList());
List<ProductSpecDO> productSpecList = productDao.getProductSpecList(productSkuIds);
Map<Integer, List<ProductSpecDO>> productSpecMap =
productSpecList.stream().collect(Collectors.groupingBy(ProductSpecDO::getProductSkuId));
List<ProductSkuDTO> list =
productSkuList.stream().map(ProductSkuDO::buildProductSkuDTO).collect(Collectors.toList());
list.stream()
.peek(
d -> {
List<ProductSpecDO> productSpecDOS = productSpecMap.get(d.getId());
if (CollectionUtils.isEmpty(productSpecDOS)) {
d.setProductSpecList(null);
} else {
d.setProductSpecList(
productSpecDOS.stream()
.map(ProductSpecDO::buildProductSpecDTO)
.collect(Collectors.toList()));
}
})
.collect(Collectors.toList());
return ResultBody.success(
PageResult.buildPage(pageNo, productSkuQO.getPageSize(), count, list));
}
@Override @Override
public ResultBody listPageProductSpec(Integer pageNo, Integer pageSize, Integer productSkuId) { public ResultBody addOrEditProductSpec(ProductSpecVO param) {
int count = productDao.countListPageProductSpec(productSkuId); // 获取名称判断此前是否已经存在
if (count == 0) { int count = productDao.countSpecName(param);
return ResultBody.success(PageResult.buildPage(pageNo, pageSize, count)); if (count > 0) {
} return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
List<ProductSpecDO> productSpecList = productDao.listPageProductSpec((pageNo - 1) * pageSize, pageSize, productSkuId);
List<ProductSpecDTO> list = productSpecList.stream().map(ProductSpecDO::buildProductSpecDTO).collect(Collectors.toList());
return ResultBody.success(PageResult.buildPage(pageNo, pageSize, count, list));
} }
if (param.getId() == null) {
@Override ProductSpecDO productSpecDO = new ProductSpecDO(param);
public ResultBody productSpecCPQ(ProductSpecCPQVO productSpecCPQVO) { // 新增产品sku
// 判断该规格是否存在 int status = productDao.insertProductSpec(productSpecDO);
int count = productDao.countSpecIsExist(productSpecCPQVO.getProductSpecId()); if (status <= 0) {
if (count <= 0) { return ResultBody.error(ResultEnum.FAILED_TO_ADD_DATA);
return ResultBody.error(ResultEnum.SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED); }
} } else {
// 批量插入规格销售或租赁价格 ProductSpecDO productSpecDO = new ProductSpecDO(param);
return insertSpecPrice(productSpecCPQVO); int status = productDao.updateProductSpec(productSpecDO);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_EDIT_DATA);
}
} }
return ResultBody.success();
}
@Override @Override
public List<ProductSpecPriceDO> getProductSpecPriceDOS(ProductSpecCPQVO productSpecCPQVO) { public ResultBody getProductSpecDetail(Integer id) {
// 批量插入规格价格 // 校验此sku是否还存在或已删除
return productSpecCPQVO.getSpecPrice().stream().map(d -> { int count = productDao.countSpecIsExist(id);
ProductSpecPriceDO productSpecPriceDO = new ProductSpecPriceDO(); if (count <= 0) {
productSpecPriceDO.setCooperationTag(d.getCooperationTag()); return ResultBody.error(ResultEnum.SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
productSpecPriceDO.setPrice(d.getPrice());
productSpecPriceDO.setType(productSpecCPQVO.getType());
productSpecPriceDO.setProductSpecId(productSpecCPQVO.getProductSpecId());
if (productSpecCPQVO.getType().equals(1)) {
productSpecPriceDO.setLeaseTerm(productSpecCPQVO.getLeaseTerm());
}
return productSpecPriceDO;
}).collect(Collectors.toList());
} }
ProductSpecDO productSpecDO = productDao.getProductSpecDetail(id);
return ResultBody.success(productSpecDO.buildProductSpecDTO());
}
@Override @Override
public ResultBody updateProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO) { public ResultBody listPageProductSpec(
// 先删除原来该规格下的所有价格配置信息 Integer pageNo, Integer pageSize, Integer productSkuId, String keyword) {
productDao.removeProductSpecCPQ(productSpecCPQVO); int count = productDao.countListPageProductSpec(productSkuId, keyword);
// 批量插入规格销售或租赁价格 if (count == 0) {
return insertSpecPrice(productSpecCPQVO); return ResultBody.success(PageResult.buildPage(pageNo, pageSize, count));
} }
List<ProductSpecDO> productSpecList =
productDao.listPageProductSpec((pageNo - 1) * pageSize, pageSize, productSkuId, keyword);
List<Integer> specIds =
productSpecList.stream().map(ProductSpecDO::getId).collect(Collectors.toList());
List<ProductSpecPriceDO> productSpecPrice = productDao.getProductSpecPriceList(specIds);
Map<Integer, List<ProductSpecPriceDO>> priceMap =
productSpecPrice.stream()
.collect(Collectors.groupingBy(ProductSpecPriceDO::getProductSpecId));
List<ProductSpecDTO> list =
productSpecList.stream()
.map(
d -> {
ProductSpecDTO productSpecDTO = d.buildProductSpecDTO();
if (!org.springframework.util.CollectionUtils.isEmpty(priceMap.get(d.getId()))) {
productSpecDTO.setPriceList(
priceMap.get(d.getId()).stream()
.map(ProductSpecPriceDO::buildProductSpecPriceDTO)
.collect(Collectors.toList()));
}
return productSpecDTO;
})
.collect(Collectors.toList());
return ResultBody.success(PageResult.buildPage(pageNo, pageSize, count, list));
}
@NotNull @Override
public ResultBody insertSpecPrice(ProductSpecCPQVO productSpecCPQVO) { public ResultBody productSpecCPQ(ProductSpecCPQVO productSpecCPQVO) {
List<ProductSpecPriceDO> list = getProductSpecPriceDOS(productSpecCPQVO); // 判断该规格是否存在
// 批量插入规格销售价格 int count = productDao.countSpecIsExist(productSpecCPQVO.getProductSpecId());
if (productSpecCPQVO.getType().equals(0)) { if (count <= 0) {
int status = productDao.batchInsertSpecPrice(list); return ResultBody.error(ResultEnum.SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_ADD_DATA);
}
} else {
// 批量插入租赁价格
productDao.batchInsertLeaseSpecPrice(list);
}
return ResultBody.success();
} }
// 批量插入规格销售或租赁价格
return insertSpecPrice(productSpecCPQVO);
}
@Override
public List<ProductSpecPriceDO> getProductSpecPriceDOS(ProductSpecCPQVO productSpecCPQVO) {
// 批量插入规格价格
return productSpecCPQVO.getSpecPrice().stream()
.map(
d -> {
ProductSpecPriceDO productSpecPriceDO = new ProductSpecPriceDO();
productSpecPriceDO.setCooperationTag(d.getCooperationTag());
productSpecPriceDO.setPrice(d.getPrice());
productSpecPriceDO.setType(productSpecCPQVO.getType());
productSpecPriceDO.setProductSpecId(productSpecCPQVO.getProductSpecId());
if (productSpecCPQVO.getType().equals(1)) {
productSpecPriceDO.setLeaseTerm(productSpecCPQVO.getLeaseTerm());
}
return productSpecPriceDO;
})
.collect(Collectors.toList());
}
@Override
public ResultBody updateProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO) {
// 先删除原来该规格下的所有价格配置信息
productDao.removeProductSpecCPQ(productSpecCPQVO);
// 批量插入规格销售或租赁价格
return insertSpecPrice(productSpecCPQVO);
}
@Override @NotNull
public ResultBody getProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO) { public ResultBody insertSpecPrice(ProductSpecCPQVO productSpecCPQVO) {
if (productSpecCPQVO.getType().equals(1) && productSpecCPQVO.getLeaseTerm() == null) { List<ProductSpecPriceDO> list = getProductSpecPriceDOS(productSpecCPQVO);
return ResultBody.error("租赁期限不能为空!"); if (productSpecCPQVO.getType().equals(1) && productSpecCPQVO.getLeaseTerm() == null) {
} return ResultBody.error("租赁期限不能为空!");
List<ProductSpecPriceDO> productSpecPriceList = productDao.getProductSpecPrice(productSpecCPQVO);
List<ProductSpecPriceDTO> list = productSpecPriceList.stream()
.map(ProductSpecPriceDO::buildProductSpecPriceDTO).collect(Collectors.toList());
return ResultBody.success(list);
} }
// 批量插入规格销售价格
@Override if (productSpecCPQVO.getType().equals(0)) {
public ResultBody removeProductSku(Integer id) { productDao.batchInsertSpecPrice(list);
// 判断该sku下是否有规格,没有则删除,有则不能删除 } else {
int specCount = productDao.countSpecByProdSkuId(id); // 批量插入租赁价格
if (specCount <= 0) { productDao.batchInsertLeaseSpecPrice(list);
// 删除
productDao.removeProductSku(id);
return ResultBody.success();
} else {
return ResultBody.error(ResultEnum.SPEC_EXIST_UNDER_THE_SKU);
}
} }
return ResultBody.success();
}
@Override @Override
public ResultBody removeProductSpec(Integer id) { public ResultBody getProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO) {
// 根据规格id查询绑定的商品或者行业的sku if (productSpecCPQVO.getType().equals(1) && productSpecCPQVO.getLeaseTerm() == null) {
RemoveSkuDTO removeSkuDTO = new RemoveSkuDTO(); return ResultBody.error("租赁期限不能为空!");
List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpecList = productDao.listMallProductSpec(id);
// 拿到清单的id
List<InventorySpecDO> inventorySpecList = productDao.listInventorySpec(id);
if (mallProdSkuInfoSpecList.size() != 0 || inventorySpecList.size() != 0) {
if (inventorySpecList.size() != 0) {
// 根据清单id 获取行业规格id
Set<Integer> inventoryIds = inventorySpecList.stream().map(InventorySpecDO::getIndustryProductInventoryId).collect(Collectors.toSet());
List<IndustryProductInventoryDO> industryProductInventoryList = industrySpecDao.listIndustryProdInventory(inventoryIds);
// 获取行业规格id
Set<Integer> industrySpecIds = industryProductInventoryList.stream().map(IndustryProductInventoryDO::getIndustrySpecId).collect(Collectors.toSet());
// 分别获取规格对应的sku信息
List<IndustrySpecDO> industrySpecList = industrySpecDao.listIndustrySpec(industrySpecIds);
List<SkuAndSpecDTO> industrySkuNameList = new ArrayList<>();
industrySpecList.stream().peek(d -> {
SkuAndSpecDTO skuAndSpecDTO = new SkuAndSpecDTO();
skuAndSpecDTO.setIndustrySkuName(d.getSolutionName());
skuAndSpecDTO.setIndustrySpecNames(d.getSpecName());
industrySkuNameList.add(skuAndSpecDTO);
}).collect(Collectors.toList());
removeSkuDTO.setIndustrySkuName(industrySkuNameList);
}
if (mallProdSkuInfoSpecList.size() != 0) {
// 获取商品名称
List<String> goodsNameList = new ArrayList<>();
mallProdSkuInfoSpecList.forEach(d -> goodsNameList.add(d.getGoodsName()));
removeSkuDTO.setGoodsName(goodsNameList);
}
return ResultBody.success(removeSkuDTO);
} else {
productDao.removeProductSpec(id);
return ResultBody.success();
}
} }
List<ProductSpecPriceDO> productSpecPriceList =
productDao.getProductSpecPrice(productSpecCPQVO);
List<ProductSpecPriceDTO> list =
productSpecPriceList.stream()
.map(ProductSpecPriceDO::buildProductSpecPriceDTO)
.collect(Collectors.toList());
return ResultBody.success(list);
}
@Override @Override
public BigDecimal feignGetUnitPriceByTag(PriceAcquisition priceAcquisition) { public ResultBody removeProductSku(Integer id) {
Map<Integer, Integer> dayMap = new HashMap<>(); // 判断该sku下是否有规格,没有则删除,有则不能删除
dayMap.put(0, 7); int specCount = productDao.countSpecByProdSkuId(id);
dayMap.put(8, 15); if (specCount <= 0) {
dayMap.put(16, 30); // 删除
dayMap.put(31, Integer.MAX_VALUE); productDao.removeProductSku(id);
return ResultBody.success();
Integer dayRange = dayMap.entrySet().stream() } else {
.filter(entry -> priceAcquisition.getDay() <= entry.getKey()) return ResultBody.error(ResultEnum.SPEC_EXIST_UNDER_THE_SKU);
.findFirst()
.map(Map.Entry::getValue)
.orElseThrow(() -> new RuntimeException("租赁期限错误错误!"));
priceAcquisition.setDay(dayRange);
return productDao.feignGetUnitPriceByTag(priceAcquisition);
} }
} }
@Override
public ResultBody removeProductSpec(Integer id) {
// 根据规格id查询绑定的商品或者行业的sku
RemoveSkuDTO removeSkuDTO = new RemoveSkuDTO();
List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpecList = productDao.listMallProductSpec(id);
// 拿到清单的id
List<InventorySpecDO> inventorySpecList = productDao.listInventorySpec(id);
if (mallProdSkuInfoSpecList.size() != 0 || inventorySpecList.size() != 0) {
if (inventorySpecList.size() != 0) {
// 根据清单id 获取行业规格id
Set<Integer> inventoryIds =
inventorySpecList.stream()
.map(InventorySpecDO::getIndustryProductInventoryId)
.collect(Collectors.toSet());
List<IndustryProductInventoryDO> industryProductInventoryList =
industrySpecDao.listIndustryProdInventory(inventoryIds);
// 获取行业规格id
Set<Integer> industrySpecIds =
industryProductInventoryList.stream()
.map(IndustryProductInventoryDO::getIndustrySpecId)
.collect(Collectors.toSet());
// 分别获取规格对应的sku信息
List<IndustrySpecDO> industrySpecList = industrySpecDao.listIndustrySpec(industrySpecIds);
List<SkuAndSpecDTO> industrySkuNameList = new ArrayList<>();
industrySpecList.stream()
.peek(
d -> {
SkuAndSpecDTO skuAndSpecDTO = new SkuAndSpecDTO();
skuAndSpecDTO.setIndustrySkuName(d.getSolutionName());
skuAndSpecDTO.setIndustrySpecNames(d.getSpecName());
industrySkuNameList.add(skuAndSpecDTO);
})
.collect(Collectors.toList());
removeSkuDTO.setIndustrySkuName(industrySkuNameList);
}
if (mallProdSkuInfoSpecList.size() != 0) {
// 获取商品名称
List<String> goodsNameList = new ArrayList<>();
mallProdSkuInfoSpecList.forEach(d -> goodsNameList.add(d.getGoodsName()));
removeSkuDTO.setGoodsName(goodsNameList);
}
return ResultBody.success(removeSkuDTO);
} else {
productDao.removeProductSpec(id);
return ResultBody.success();
}
}
@Override
public BigDecimal feignGetUnitPriceByTag(PriceAcquisition priceAcquisition) {
Map<Integer, Integer> dayMap = new HashMap<>();
dayMap.put(0, 7);
dayMap.put(8, 15);
dayMap.put(16, 30);
dayMap.put(31, Integer.MAX_VALUE);
Integer dayRange =
dayMap.entrySet().stream()
.filter(entry -> priceAcquisition.getDay() <= entry.getKey())
.findFirst()
.map(Map.Entry::getValue)
.orElseThrow(() -> new RuntimeException("租赁期限错误错误!"));
priceAcquisition.setDay(dayRange);
return productDao.feignGetUnitPriceByTag(priceAcquisition);
}
@Override
public ResultBody productDirectoryList() {
List<DirectoryDO> directoryList = productDao.productDirectoryList();
if (CollectionUtils.isNotEmpty(directoryList)) {
return ResultBody.success(
directoryList.stream()
.map(DirectoryDO::buildDirectoryInfoVO)
.collect(Collectors.toList()));
}
return ResultBody.success();
}
}
package com.mmc.pms.service.Impl; package com.mmc.pms.service.Impl;
import com.mmc.pms.auth.dto.UserAccountSimpleDTO;
import com.mmc.pms.common.ResultBody; 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.dao.WebDeviceDao;
import com.mmc.pms.entity.*; import com.mmc.pms.entity.*;
import com.mmc.pms.feign.UserAppApi;
import com.mmc.pms.model.lease.dto.*; import com.mmc.pms.model.lease.dto.*;
import com.mmc.pms.model.lease.vo.LeaseVo; import com.mmc.pms.model.lease.vo.LeaseVo;
import com.mmc.pms.model.other.dto.AdDTO; import com.mmc.pms.model.other.dto.AdDTO;
import com.mmc.pms.model.other.dto.DistrictInfoDTO; import com.mmc.pms.model.other.dto.DistrictInfoDTO;
import com.mmc.pms.model.other.dto.ModelDTO; import com.mmc.pms.model.other.dto.ModelDTO;
import com.mmc.pms.model.qo.WareInfoQO; 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.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.page.PageResult;
import com.mmc.pms.service.WebDeviceService; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -24,174 +39,257 @@ import java.util.stream.Collectors; ...@@ -24,174 +39,257 @@ import java.util.stream.Collectors;
@Service @Service
public class WebDeviceServiceImpl implements WebDeviceService { public class WebDeviceServiceImpl implements WebDeviceService {
@Autowired @Autowired WebDeviceDao webDeviceDao;
WebDeviceDao webDeviceDao;
@Override
public ResultBody listSecondDistrict() {
List<DistrictDO> list = webDeviceDao.listSecondDistrict();
List<DistrictInfoDTO> dtoList =
list.stream()
.map(
d -> {
return d.builderDistrictInfoDTO();
})
.collect(Collectors.toList());
return ResultBody.success(dtoList);
}
@Override @Autowired UserAppApi userAppApi;
public ResultBody category() {
List<DeviceCategory> category = webDeviceDao.category();
List<DeviceCategoryDTO> collect =
category.stream()
.map(
t -> {
return t.deviceCategory();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override @Autowired ProductDao productDao;
public ResultBody brand() {
List<Brand> brand = webDeviceDao.brand();
List<BrandDTO> collect =
brand.stream()
.map(
t -> {
return t.brandDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override @Autowired GoodsInfoDao goodsInfoDao;
public ResultBody deviceBrand() {
List<Brand> brand = webDeviceDao.deviceBrand();
List<BrandDTO> collect =
brand.stream()
.map(
t -> {
return t.brandDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override @Autowired GoodsInfoServiceImpl goodsInfoService;
public ResultBody model() {
List<Model> model = webDeviceDao.model();
List<ModelDTO> collect =
model.stream()
.map(
t -> {
return t.modelDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override @Autowired private CategoriesDao categoriesDao;
public ResultBody deviceModel() {
List<Model> model = webDeviceDao.deviceModel();
List<ModelDTO> collect =
model.stream()
.map(
t -> {
return t.modelDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override @Override
public ResultBody deviceList( public ResultBody listSecondDistrict() {
Integer districtId, Integer categoryId, Integer brandId, Integer modelId) { List<DistrictDO> list = webDeviceDao.listSecondDistrict();
List<DeviceListDO> deviceList = List<DistrictInfoDTO> dtoList =
webDeviceDao.deviceList(districtId, categoryId, brandId, modelId); list.stream().map(DistrictDO::builderDistrictInfoDTO).collect(Collectors.toList());
List<DeviceListDTO> collect = return ResultBody.success(dtoList);
deviceList.stream() }
.map(
t -> {
return t.deviceListDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override @Override
public ResultBody update(LeaseVo param) { public ResultBody category() {
InventoryDO inventory = webDeviceDao.findInventory(param.getInventoryId()); List<DeviceCategory> category = webDeviceDao.category();
Integer residueCount = inventory.getResidueCount(); List<DeviceCategoryDTO> collect =
Integer count = residueCount - param.getInventoryUsage(); category.stream()
param.setInventoryUsage(count); .map(
int update = webDeviceDao.update(param); t -> {
return ResultBody.success(update); return t.deviceCategory();
} })
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public ResultBody brand() {
List<Brand> brand = webDeviceDao.brand();
List<BrandDTO> collect =
brand.stream()
.map(
t -> {
return t.brandDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public ResultBody deviceBrand() {
List<Brand> brand = webDeviceDao.deviceBrand();
List<BrandDTO> collect =
brand.stream()
.map(
t -> {
return t.brandDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override @Override
public ResultBody detail(Integer id) { public ResultBody model() {
List<WareInfoDO> list = webDeviceDao.detail(id); List<Model> model = webDeviceDao.model();
List<WareInfoItemDTO> pageList = List<ModelDTO> collect =
list.stream() model.stream()
.map( .map(
d -> { t -> {
return d.buildWareInfoItemDTO(); return t.modelDTO();
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
return ResultBody.success(pageList); return ResultBody.success(collect);
}
@Override
public ResultBody deviceModel() {
List<Model> model = webDeviceDao.deviceModel();
List<ModelDTO> collect =
model.stream()
.map(
t -> {
return t.modelDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public ResultBody deviceList(
Integer districtId, Integer categoryId, Integer brandId, Integer modelId) {
List<DeviceListDO> deviceList =
webDeviceDao.deviceList(districtId, categoryId, brandId, modelId);
List<DeviceListDTO> collect =
deviceList.stream()
.map(
t -> {
return t.deviceListDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public ResultBody update(LeaseVo param) {
InventoryDO inventory = webDeviceDao.findInventory(param.getInventoryId());
Integer residueCount = inventory.getResidueCount();
Integer count = residueCount - param.getInventoryUsage();
param.setInventoryUsage(count);
int update = webDeviceDao.update(param);
return ResultBody.success(update);
}
@Override
public ResultBody detail(Integer id) {
List<WareInfoDO> list = webDeviceDao.detail(id);
List<WareInfoItemDTO> pageList =
list.stream()
.map(
d -> {
return d.buildWareInfoItemDTO();
})
.collect(Collectors.toList());
return ResultBody.success(pageList);
}
@Override
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<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));
} }
@Override UserAccountSimpleDTO userAccountSimpleDTO =
public ResultBody listWareInfoPage(WareInfoQO param) { userAppApi.feignGetUserSimpleInfo(userAccountId, request.getHeader(TokenConstant.TOKEN));
int count = webDeviceDao.countListWareInfoPage(param); if (userAccountSimpleDTO == null) {
if (count == 0) { return ResultBody.error(ResultEnum.INTERNAL_SERVER_ERROR);
return ResultBody.success( }
PageResult.buildPage(param.getPageNo(), param.getPageSize(), count)); if (userAccountSimpleDTO.getCooperationTagId() == null) {
} return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, pageList));
int pageNo = param.getPageNo();
param.buildCurrentPage();
List<WareInfoDO> list = webDeviceDao.listWareInfoPage(param);
List<WareInfoItemDTO> pageList =
list.stream()
.map(
d -> {
return d.buildWareInfoItemDTO();
})
.collect(Collectors.toList());
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 -> {
MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO = specMap.get(d.getId());
d.setPrice(mallProdSkuInfoSpecDO.getPrice());
})
.collect(Collectors.toList());
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, pageList));
}
@Override @Override
public WareInfoDTO getWareInfoById(Integer id) { public ResultBody getLeaseGoodsDetail(
WareInfoDO wareInfoDO = webDeviceDao.getWareInfoById(id); Integer goodsInfoId, Integer userAccountId, HttpServletRequest request, Integer type) {
WareDetailDO wareDetailDO = webDeviceDao.getWareDetailById(id); int count = goodsInfoDao.countGoodsInfoById(goodsInfoId);
if (wareInfoDO != null) { if (count <= 0) {
wareInfoDO.setWareDetailContent(wareDetailDO.getContent()); return ResultBody.error(ResultEnum.GOODS_NOT_EXIST_OR_ALREADY_DOWN_SHELF);
}
return wareInfoDO == null ? null : wareInfoDO.buildWareInfoDTO();
} }
// 初始化商品返回信息的对象
ResultBody goodsInfoDetail = goodsInfoService.getGoodsInfoDetail(goodsInfoId, type, 0);
MallGoodsDetailDTO result = (MallGoodsDetailDTO) goodsInfoDetail.getResult();
return ResultBody.success(result);
}
@Override @Override
public ResultBody<AdDTO> ad() { public WareInfoDTO getWareInfoById(Integer id) {
List<AdDO> ad = webDeviceDao.ad(); WareInfoDO wareInfoDO = webDeviceDao.getWareInfoById(id);
List<AdDTO> collect = WareDetailDO wareDetailDO = webDeviceDao.getWareDetailById(id);
ad.stream() if (wareInfoDO != null) {
.map( wareInfoDO.setWareDetailContent(wareDetailDO.getContent());
t -> {
return t.adDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
} }
return wareInfoDO == null ? null : wareInfoDO.buildWareInfoDTO();
}
@Override @Override
public List<SkuInfoDTO> listWareSkuById(Integer id) { public ResultBody getPageHomeCategories(Integer type) {
List<SkuInfoDO> skuInfoDOS = webDeviceDao.listSkuInfo(id); List<DirectoryDO> directoryList = categoriesDao.getDirectoryList(type);
return skuInfoDOS.isEmpty() ? null : skuInfoDOS.stream().map(d -> { if (CollectionUtils.isNotEmpty(directoryList)) {
return d.buildSkuInfoDTO(); List<Integer> directoryIds =
}).collect(Collectors.toList()); 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 =
ad.stream()
.map(
t -> {
return t.adDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public List<SkuInfoDTO> listWareSkuById(Integer id) {
List<SkuInfoDO> skuInfoDOS = webDeviceDao.listSkuInfo(id);
return skuInfoDOS.isEmpty()
? null
: skuInfoDOS.stream()
.map(
d -> {
return d.buildSkuInfoDTO();
})
.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; ...@@ -6,9 +6,10 @@ import com.mmc.pms.entity.AdDO;
import com.mmc.pms.entity.GoodsInfoDO; import com.mmc.pms.entity.GoodsInfoDO;
import com.mmc.pms.entity.ProductCategory; import com.mmc.pms.entity.ProductCategory;
import com.mmc.pms.model.other.dto.AdDTO; 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.qo.GoodsInfoQO;
import com.mmc.pms.model.sale.dto.GoodsInfoListDTO; 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.page.PageResult;
import com.mmc.pms.service.WebProductMallService; import com.mmc.pms.service.WebProductMallService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -23,78 +24,77 @@ import java.util.stream.Collectors; ...@@ -23,78 +24,77 @@ import java.util.stream.Collectors;
@Service @Service
public class WebProductMallServiceImpl implements WebProductMallService { public class WebProductMallServiceImpl implements WebProductMallService {
@Autowired @Autowired private WebProductMallDao webProductMallDao;
private WebProductMallDao webProductMallDao;
@Override @Override
public ResultBody productCategory() { public ResultBody productCategory() {
List<ProductCategory> category = webProductMallDao.productCategory(); List<ProductCategory> category = webProductMallDao.productCategory();
List<ProductCategoryDTO> collect = List<ProductCategoryDTO> collect =
category.stream() category.stream()
.map( .map(
t -> { t -> {
return t.productCategoryDTO(); return t.productCategoryDTO();
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
return ResultBody.success(collect); return ResultBody.success(collect);
} }
@Override @Override
public ResultBody productParts() { public ResultBody productParts() {
List<ProductCategory> category = webProductMallDao.productParts(); List<ProductCategory> category = webProductMallDao.productParts();
List<ProductCategoryDTO> collect = List<ProductCategoryDTO> collect =
category.stream() category.stream()
.map( .map(
t -> { t -> {
return t.productCategoryDTO(); return t.productCategoryDTO();
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
return ResultBody.success(collect); return ResultBody.success(collect);
} }
@Override @Override
public ResultBody productQuality() { public ResultBody productQuality() {
List<ProductCategory> category = webProductMallDao.productQuality(); List<ProductCategory> category = webProductMallDao.productQuality();
List<ProductCategoryDTO> collect = List<ProductCategoryDTO> collect =
category.stream() category.stream()
.map( .map(
t -> { t -> {
return t.productCategoryDTO(); return t.productCategoryDTO();
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
return ResultBody.success(collect); return ResultBody.success(collect);
} }
@Override @Override
public PageResult listPageGoodsInfo(GoodsInfoQO param) { public ResultBody<AdDTO> ad() {
int count = webProductMallDao.countListGoodsInfo(param); List<AdDO> ad = webProductMallDao.ad();
if (count == 0) { List<AdDTO> collect =
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count); ad.stream()
} .map(
Integer pageNo = param.getPageNo(); t -> {
param.buildCurrentPage(); return t.adDTO();
List<GoodsInfoDO> goodsInfo = webProductMallDao.listGoodsInfo(param); })
goodsInfo.stream() .collect(Collectors.toList());
.forEach( return ResultBody.success(collect);
t -> { }
Integer product = webProductMallDao.findProduct(t.getId());
t.setIsCoupons(product);
});
List<GoodsInfoListDTO> pageList =
goodsInfo.stream().map(GoodsInfoDO::buildGoodsInfoListDTO).collect(Collectors.toList());
return PageResult.buildPage(pageNo, param.getPageSize(), count, pageList);
}
@Override @Override
public ResultBody<AdDTO> ad() { public PageResult listPageGoodsInfo(GoodsInfoQO param) {
List<AdDO> ad = webProductMallDao.ad(); int count = webProductMallDao.countListGoodsInfo(param);
List<AdDTO> collect = if (count == 0) {
ad.stream() return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
.map(
t -> {
return t.adDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
} }
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<GoodsInfoDO> goodsInfo = webProductMallDao.listGoodsInfo(param);
goodsInfo.stream()
.forEach(
t -> {
Integer product = webProductMallDao.findProduct(t.getId());
t.setIsCoupons(product);
});
List<GoodsInfoListDTO> pageList =
goodsInfo.stream().map(GoodsInfoDO::buildGoodsInfoListDTO).collect(Collectors.toList());
return PageResult.buildPage(pageNo, param.getPageSize(), count, pageList);
}
} }
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; package com.mmc.pms.service;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.qo.GoodsInfoQO;
/** /**
* @Author small @Date 2023/5/16 15:08 @Version 1.0 * @Author small @Date 2023/5/16 15:08 @Version 1.0
*/ */
public interface MiniProgramProductMallService { public interface MiniProgramProductMallService {
ResultBody getAppGoodsInfoDetail(Integer id); ResultBody getAppGoodsInfoDetail(Integer id);
ResultBody listGoodsByQO(GoodsInfoQO param);
} }
...@@ -2,6 +2,7 @@ package com.mmc.pms.service; ...@@ -2,6 +2,7 @@ package com.mmc.pms.service;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.entity.ProductSpecPriceDO; 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.lease.vo.PriceAcquisition;
import com.mmc.pms.model.qo.ProductSkuQO; import com.mmc.pms.model.qo.ProductSkuQO;
import com.mmc.pms.model.sale.dto.ProductSkuVO; import com.mmc.pms.model.sale.dto.ProductSkuVO;
...@@ -18,32 +19,34 @@ import java.util.List; ...@@ -18,32 +19,34 @@ import java.util.List;
*/ */
public interface ProductSkuService { public interface ProductSkuService {
ResultBody addProductSku(ProductSkuVO param); ResultBody addProductSku(ProductSkuVO param);
ResultBody getProductSkuDetail(Integer id); ResultBody getProductSkuDetail(Integer id);
ResultBody editProductSku(ProductSkuVO param); ResultBody editProductSku(ProductSkuVO param);
ResultBody listPageProductSku(ProductSkuQO productSkuQO); ResultBody listPageProductSku(ProductSkuQO productSkuQO);
ResultBody addOrEditProductSpec(ProductSpecVO param); ResultBody addOrEditProductSpec(ProductSpecVO param);
ResultBody getProductSpecDetail(Integer id); 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); ResultBody productSpecCPQ(ProductSpecCPQVO productSpecCPQVO);
List<ProductSpecPriceDO> getProductSpecPriceDOS(ProductSpecCPQVO productSpecCPQVO); List<ProductSpecPriceDO> getProductSpecPriceDOS(ProductSpecCPQVO productSpecCPQVO);
ResultBody updateProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO); ResultBody updateProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO);
ResultBody getProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO); ResultBody getProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO);
ResultBody removeProductSku(Integer id); ResultBody removeProductSku(Integer id);
ResultBody removeProductSpec(Integer id); ResultBody removeProductSpec(Integer id);
BigDecimal feignGetUnitPriceByTag(PriceAcquisition priceAcquisition); BigDecimal feignGetUnitPriceByTag(PriceAcquisition priceAcquisition);
ResultBody<DirectoryInfoVO> productDirectoryList();
} }
package com.mmc.pms.service; package com.mmc.pms.service;
import com.mmc.pms.common.ResultBody; 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.dto.WareInfoDTO;
import com.mmc.pms.model.lease.vo.LeaseVo; import com.mmc.pms.model.lease.vo.LeaseVo;
import com.mmc.pms.model.other.dto.AdDTO; import com.mmc.pms.model.other.dto.AdDTO;
import com.mmc.pms.model.qo.WareInfoQO; import com.mmc.pms.model.qo.WareInfoQO;
import com.mmc.pms.model.sale.dto.SkuInfoDTO; 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; import java.util.List;
/** /**
* @Author small @Date 2023/5/15 14:28 @Version 1.0 * @Author small @Date 2023/5/15 14:28 @Version 1.0
*/ */
public interface WebDeviceService { public interface WebDeviceService {
ResultBody listSecondDistrict(); ResultBody listSecondDistrict();
ResultBody category(); ResultBody category();
ResultBody brand(); ResultBody brand();
ResultBody deviceBrand(); ResultBody deviceBrand();
ResultBody model(); ResultBody model();
ResultBody deviceModel(); ResultBody deviceModel();
ResultBody deviceList(Integer districtId, Integer categoryId, Integer brandId, Integer modelId); ResultBody deviceList(Integer districtId, Integer categoryId, Integer brandId, Integer modelId);
ResultBody update(LeaseVo param); ResultBody update(LeaseVo param);
ResultBody detail(Integer id); ResultBody detail(Integer id);
ResultBody listWareInfoPage(WareInfoQO param); ResultBody listWareInfoPage(WareInfoQO param, HttpServletRequest request, Integer userAccountId);
WareInfoDTO getWareInfoById(Integer id); WareInfoDTO getWareInfoById(Integer id);
ResultBody<AdDTO> ad(); ResultBody<AdDTO> ad();
List<SkuInfoDTO> listWareSkuById(Integer id); 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; ...@@ -3,7 +3,6 @@ package com.mmc.pms.util;
import com.mmc.pms.common.BaseErrorInfoInterface; import com.mmc.pms.common.BaseErrorInfoInterface;
import com.mmc.pms.common.ResultEnum; import com.mmc.pms.common.ResultEnum;
/** /**
* @author 作者 geDuo * @author 作者 geDuo
* @version 创建时间:2021年8月13日 上午9:25:43 * @version 创建时间:2021年8月13日 上午9:25:43
...@@ -11,80 +10,76 @@ import com.mmc.pms.common.ResultEnum; ...@@ -11,80 +10,76 @@ import com.mmc.pms.common.ResultEnum;
*/ */
public class BizException extends RuntimeException { public class BizException extends RuntimeException {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /** 错误码 */
* 错误码 protected String errorCode;
*/ /** 错误信息 */
protected String errorCode; protected String errorMsg;
/**
* 错误信息 public BizException() {
*/ super();
protected String errorMsg; }
public BizException() { public BizException(BaseErrorInfoInterface errorInfoInterface) {
super(); super(errorInfoInterface.getResultCode());
} this.errorCode = errorInfoInterface.getResultCode();
this.errorMsg = errorInfoInterface.getResultMsg();
public BizException(BaseErrorInfoInterface errorInfoInterface) { }
super(errorInfoInterface.getResultCode());
this.errorCode = errorInfoInterface.getResultCode(); public BizException(BaseErrorInfoInterface errorInfoInterface, Throwable cause) {
this.errorMsg = errorInfoInterface.getResultMsg(); super(errorInfoInterface.getResultCode(), cause);
} this.errorCode = errorInfoInterface.getResultCode();
this.errorMsg = errorInfoInterface.getResultMsg();
public BizException(BaseErrorInfoInterface errorInfoInterface, Throwable cause) { }
super(errorInfoInterface.getResultCode(), cause);
this.errorCode = errorInfoInterface.getResultCode(); public BizException(ResultEnum enums) {
this.errorMsg = errorInfoInterface.getResultMsg(); super(enums.getResultCode());
} this.errorCode = enums.getResultCode();
this.errorMsg = enums.getResultMsg();
public BizException(ResultEnum enums) { }
super(enums.getResultCode());
this.errorCode = enums.getResultCode(); public BizException(String errorMsg) {
this.errorMsg = enums.getResultMsg(); super(errorMsg);
} this.errorCode = "-1";
this.errorMsg = errorMsg;
public BizException(String errorMsg) { }
super(errorMsg);
this.errorCode = "-1"; public BizException(String errorCode, String errorMsg) {
this.errorMsg = errorMsg; super(errorCode);
} this.errorCode = errorCode;
this.errorMsg = errorMsg;
public BizException(String errorCode, String errorMsg) { }
super(errorCode);
this.errorCode = errorCode; public BizException(String errorCode, String errorMsg, Throwable cause) {
this.errorMsg = errorMsg; super(errorCode, cause);
} this.errorCode = errorCode;
this.errorMsg = errorMsg;
public BizException(String errorCode, String errorMsg, Throwable cause) { }
super(errorCode, cause);
this.errorCode = errorCode; public String getErrorCode() {
this.errorMsg = errorMsg; return errorCode;
} }
public String getErrorCode() { public void setErrorCode(String errorCode) {
return errorCode; this.errorCode = errorCode;
} }
public void setErrorCode(String errorCode) { public String getErrorMsg() {
this.errorCode = errorCode; return errorMsg;
} }
public String getErrorMsg() { public void setErrorMsg(String errorMsg) {
return errorMsg; this.errorMsg = errorMsg;
} }
public void setErrorMsg(String errorMsg) { @Override
this.errorMsg = errorMsg; public String getMessage() {
} return errorMsg;
}
@Override
public String getMessage() { @Override
return errorMsg; public Throwable fillInStackTrace() {
} return this;
}
@Override
public Throwable fillInStackTrace() {
return this;
}
} }
...@@ -8,9 +8,9 @@ import org.springframework.util.AntPathMatcher; ...@@ -8,9 +8,9 @@ import org.springframework.util.AntPathMatcher;
* @explain 解析地址类 * @explain 解析地址类
*/ */
public class PathUtil { public class PathUtil {
private static AntPathMatcher matcher = new AntPathMatcher(); private static AntPathMatcher matcher = new AntPathMatcher();
public static boolean isPathMatch(String pattern, String path) { public static boolean isPathMatch(String pattern, String path) {
return matcher.match(pattern, path); return matcher.match(pattern, path);
} }
} }
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: ...@@ -15,8 +15,8 @@ spring:
max-active: 2 max-active: 2
servlet: servlet:
multipart: multipart:
max-file-size: 200MB max-file-size: 512MB
max-request-size: 200MB max-request-size: 512MB
springfox: springfox:
documentation: documentation:
...@@ -37,4 +37,8 @@ mmcflying: ...@@ -37,4 +37,8 @@ mmcflying:
mount: mount:
directory: D:@javaVolume@ directory: D:@javaVolume@
iuav:
userapp:
url: https://test.iuav.shop
...@@ -22,6 +22,10 @@ spring: ...@@ -22,6 +22,10 @@ spring:
max-idle: 8 max-idle: 8
#初始化最小 #初始化最小
min-idle: 1 min-idle: 1
servlet:
multipart:
max-file-size: 512MB
max-request-size: 512MB
#mybatis-plus #mybatis-plus
mybatis-plus: mybatis-plus:
global-config: global-config:
...@@ -54,4 +58,8 @@ mmcflying: ...@@ -54,4 +58,8 @@ mmcflying:
mount: mount:
directory: D:@javaVolume@ directory: D:@javaVolume@
iuav:
userapp:
url: http://127.0.0.1:35150
...@@ -15,8 +15,8 @@ spring: ...@@ -15,8 +15,8 @@ spring:
max-active: 2 max-active: 2
servlet: servlet:
multipart: multipart:
max-file-size: 200MB max-file-size: 512MB
max-request-size: 200MB max-request-size: 512MB
springfox: springfox:
documentation: documentation:
...@@ -36,3 +36,7 @@ mmcflying: ...@@ -36,3 +36,7 @@ mmcflying:
path: /ossservlet/upload/download/ path: /ossservlet/upload/download/
mount: mount:
directory: D:@javaVolume@ directory: D:@javaVolume@
iuav:
userapp:
url: https://www.iuav.shop
...@@ -15,8 +15,8 @@ spring: ...@@ -15,8 +15,8 @@ spring:
jackson: jackson:
date-format: yyyy-MM-dd HH:mm:ss date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8 time-zone: GMT+8
main:
banner-mode: off
logging: logging:
level: file:
com: name: "/var/log/app/${spring.application.name}.log"
mmc: \ No newline at end of file
pms: DEBUG
...@@ -25,9 +25,8 @@ ...@@ -25,9 +25,8 @@
is_deleted is_deleted
</sql> </sql>
<insert id="insertDirectory"> <insert id="insertDirectory">
insert into directory(directory_name, pid, insert into directory (directory_name, `type`, `show`)
`type`) values (#{directoryName}, #{type}, #{show})
values (#{directoryName}, #{pid}, #{type})
</insert> </insert>
<insert id="insertClassification"> <insert id="insertClassification">
insert into categories (parent_id, insert into categories (parent_id,
...@@ -42,8 +41,8 @@ ...@@ -42,8 +41,8 @@
<update id="updateDirectory"> <update id="updateDirectory">
update directory update directory
set directory_name = #{directoryName}, set directory_name = #{directoryName},
pid = #{pid}, `type` = #{type},
`type` = #{type} `show` = #{show}
where id = #{id} where id = #{id}
</update> </update>
<update id="removeDirectory"> <update id="removeDirectory">
...@@ -87,12 +86,10 @@ ...@@ -87,12 +86,10 @@
<select id="directoryList" resultType="com.mmc.pms.entity.DirectoryDO"> <select id="directoryList" resultType="com.mmc.pms.entity.DirectoryDO">
SELECT d.id, SELECT d.id,
d.directory_name, d.directory_name,
d.pid,
d.`type`, d.`type`,
d.create_time, d.create_time,
dt.directory_name relevanceName d.show
FROM `directory` d FROM `directory` d
LEFT JOIN `directory` dt ON dt.id = d.pid
<where> <where>
d.is_deleted = 0 d.is_deleted = 0
<if test="type != null"> <if test="type != null">
...@@ -151,7 +148,6 @@ ...@@ -151,7 +148,6 @@
FROM categories FROM categories
WHERE is_deleted = 0 WHERE is_deleted = 0
AND directory_id = #{directoryId} AND directory_id = #{directoryId}
AND type = #{type}
ORDER BY sort asc ORDER BY sort asc
LIMIT #{pageNo}, #{pageSize} LIMIT #{pageNo}, #{pageSize}
</select> </select>
...@@ -160,30 +156,37 @@ ...@@ -160,30 +156,37 @@
FROM categories FROM categories
WHERE is_deleted = 0 WHERE is_deleted = 0
AND directory_id = #{directoryId} 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>
<select id="getDirectoryList" resultType="com.mmc.pms.entity.DirectoryDO"> <select id="getDirectoryList" resultType="com.mmc.pms.entity.DirectoryDO">
SELECT d.id, SELECT d.id,
d.directory_name, d.directory_name,
d.pid,
d.`type`, d.`type`,
d.create_time d.create_time
FROM `directory` d FROM `directory` d
WHERE d.is_deleted = 0 WHERE d.is_deleted = 0
AND d.type = #{type} AND d.type = #{type}
OR d.type = 0 or (d.type = 0 and d.`show` like CONCAT('%', #{type}, '%') and d.is_deleted = 0)
AND d.pid IS NULL
ORDER BY create_time DESC ORDER BY create_time DESC
</select> </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="getCategoriesByDirectoryId" resultType="com.mmc.pms.entity.Categories"
SELECT id,`name` from categories where directory_id = #{directoryId} and is_deleted = 0 order by create_time desc parameterType="java.lang.Integer">
SELECT id, `name`
from categories
where directory_id = #{directoryId}
and is_deleted = 0
order by create_time desc
</select> </select>
<select id="getCategoriesListByIds" resultType="com.mmc.pms.entity.Categories"> <select id="getCategoriesListByIds" resultType="com.mmc.pms.entity.Categories">
...@@ -194,6 +197,32 @@ ...@@ -194,6 +197,32 @@
</foreach> </foreach>
and is_deleted = 0 and is_deleted = 0
</select> </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 id="deleteById">
UPDATE `categories` UPDATE `categories`
......
...@@ -65,10 +65,10 @@ ...@@ -65,10 +65,10 @@
</insert> </insert>
<insert id="insertMallProdSkuInfo" parameterType="com.mmc.pms.entity.MallProdInfoDO" useGeneratedKeys="true" <insert id="insertMallProdSkuInfo" parameterType="com.mmc.pms.entity.MallProdInfoDO" useGeneratedKeys="true"
keyProperty="id"> keyProperty="id">
insert into mall_prod_sku_info (goods_info_id, product_id, prod_sku_spec_name, categories_id, choose_type, insert into mall_prod_info (goods_info_id, product_id, prod_spec_name, categories_id, choose_type,
sku_unit_id, is_must, flag) sku_unit_id, is_must, flag)
values (#{goodsInfoId}, #{prodSkuId}, #{prodSkuSpecName}, #{categoriesId}, #{chooseType}, #{skuUnitId}, #{must}, values (#{goodsInfoId}, #{prodSkuId}, #{prodSkuSpecName}, #{categoriesId}, #{chooseType}, #{skuUnitId}, #{must},
#{flag}) > #{flag})
</insert> </insert>
<insert id="insertMallProdSkuInfoSpec"> <insert id="insertMallProdSkuInfoSpec">
insert into mall_prod_info_spec (goods_info_id, mall_prod_info_id, product_spec_id) insert into mall_prod_info_spec (goods_info_id, mall_prod_info_id, product_spec_id)
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
where goods_info_id = #{goodsId} where goods_info_id = #{goodsId}
</update> </update>
<update id="batchUpdateMallProductSku"> <update id="batchUpdateMallProductSku">
<foreach collection="list" item="d" separator=";"> <foreach collection="list" item="d" separator=";" index="index">
update mall_prod_info update mall_prod_info
set is_deleted = 1 set is_deleted = 1
where id = #{d} where id = #{d}
...@@ -111,10 +111,10 @@ ...@@ -111,10 +111,10 @@
</foreach> </foreach>
</update> </update>
<update id="batchUpdateMallProdSkuInfo"> <update id="batchUpdateMallProdSkuInfo">
<foreach collection="list" item="d" separator=";"> <foreach collection="list" item="d" separator=";" index="index">
update mall_prod_info update mall_prod_info
<set> <set>
prod_sku_id = #{d.prodSkuId}, product_id = #{d.prodSkuId},
categories_id = #{d.categoriesId}, categories_id = #{d.categoriesId},
prod_spec_name = #{d.prodSkuSpecName}, prod_spec_name = #{d.prodSkuSpecName},
choose_type = #{d.chooseType}, choose_type = #{d.chooseType},
...@@ -127,8 +127,8 @@ ...@@ -127,8 +127,8 @@
</foreach> </foreach>
</update> </update>
<update id="batchUpdateMallProSpec"> <update id="batchUpdateMallProSpec">
<foreach collection="list" separator=";" item="d"> <foreach collection="list" separator=";" item="d" index="index">
update mall_prod_sku_info_spec update mall_prod_info_spec
set is_deleted = 1 set is_deleted = 1
where mall_prod_info_id = #{d} where mall_prod_info_id = #{d}
and goods_info_id =#{id} and goods_info_id =#{id}
...@@ -136,13 +136,41 @@ ...@@ -136,13 +136,41 @@
</foreach> </foreach>
</update> </update>
<update id="batchUpdateMallProdSpec"> <update id="batchUpdateMallProdSpec">
<foreach collection="list" item="d" separator=";"> update mall_prod_info_spec
update mall_prod_info_spec set is_deleted = 1
set is_deleted = 1 where is_deleted = 0
where id = #{d} <foreach collection="list" item="d" separator="," index="index" open="and id in (" close=")">
and is_deleted = 0 #{d}
</foreach>
</update>
<update id="batchDownWare">
update goods_info set shelf_status = 0 where id in
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<update id="batchUpOrDownWare">
update goods_info set shelf_status = #{status} where id in
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<update id="removeWareInfo">
update goods_info set is_deleted=1 where id in
<foreach collection="list" separator="," item="item" index="index" open="(" close=")">
#{item}
</foreach> </foreach>
</update> </update>
<update id="updateMallProdSkuInfo">
update mall_prod_info
set product_id = #{prodSkuId},
categories_id = #{categoriesId},
prod_spec_name = #{prodSkuSpecName},
choose_type = #{chooseType},
sku_unit_id = #{skuUnitId},
is_must = #{must}
where id = #{id}
</update>
<delete id="deleteGoodsServiceByGoodsId"> <delete id="deleteGoodsServiceByGoodsId">
delete delete
from goods_service from goods_service
...@@ -154,6 +182,7 @@ ...@@ -154,6 +182,7 @@
from goods_info from goods_info
where is_deleted = 0 where is_deleted = 0
and goods_name = #{goodsName} and goods_name = #{goodsName}
and goods_type = #{goodsType}
<if test="id!=null and id!=''"> <if test="id!=null and id!=''">
and id <![CDATA[<>]]> #{id} and id <![CDATA[<>]]> #{id}
</if> </if>
...@@ -179,26 +208,25 @@ ...@@ -179,26 +208,25 @@
<select id="getMallProSkuInfo" resultType="com.mmc.pms.entity.MallProdInfoDO"> <select id="getMallProSkuInfo" resultType="com.mmc.pms.entity.MallProdInfoDO">
SELECT mi.id, SELECT mi.id,
mi.goods_info_id, mi.goods_info_id,
mi.prod_sku_id, mi.product_id prodSkuId,
mi.prod_spec_name, mi.prod_spec_name prodSkuSpecName,
mi.categories_id, mi.categories_id categoriesId,
mi.choose_type, mi.choose_type chooseType,
mi.sku_unit_id, mi.sku_unit_id skuUnitId,
mi.is_must, mi.is_must must,
mi.product_spec_id_list, mi.flag flag,
mi.before_update_spec, mi.create_time createTime,
mi.flag, c.name typeName,
mi.create_time createTime, su.id skuUnitId,
c.type_name typeName, su.unit_name unitName,
su.id skuUnitId, ps.product_name productSkuName
su.unit_name unitName,
ps.product_name productSkuName
FROM mall_prod_info mi FROM mall_prod_info mi
INNER JOIN categories c ON c.id = mi.categories_id INNER JOIN categories c ON c.id = mi.categories_id
INNER JOIN sku_unit su ON mi.sku_unit_id = su.id INNER JOIN sku_unit su ON mi.sku_unit_id = su.id
INNER JOIN product ps ON ps.id = mi.prod_sku_id INNER JOIN product ps ON ps.id = mi.product_id
WHERE mi.goods_info_id = #{id} WHERE mi.goods_info_id = #{id}
AND mi.is_deleted = 0 AND mi.is_deleted = 0
and flag = 0
</select> </select>
<select id="getMallIndustrySkuInfo" resultType="com.mmc.pms.entity.MallIndustrySkuInfoDO"> <select id="getMallIndustrySkuInfo" resultType="com.mmc.pms.entity.MallIndustrySkuInfoDO">
SELECT mi.id, SELECT mi.id,
...@@ -440,7 +468,19 @@ ...@@ -440,7 +468,19 @@
AND im.img_type = 0 AND im.img_type = 0
WHERE gi.category_by_one = #{id} WHERE gi.category_by_one = #{id}
</select> </select>
<select id="getMallProSkuInfoSpec" resultType="com.mmc.pms.entity.MallProdSkuInfoSpecDO"> <resultMap id="resultMallProdSkuInfoSpecMap" type="com.mmc.pms.entity.MallProdSkuInfoSpecDO">
<id property="id" column="id"/>
<result property="mallProdSkuInfoId" column="mall_prod_info_id"/>
<result property="productSpecId" column="product_spec_id"/>
<association property="productSpecDO" resultMap="resultProductSpecMap"/>
</resultMap>
<resultMap id="resultProductSpecMap" type="com.mmc.pms.entity.ProductSpecDO">
<result property="specImage" column="spec_image"/>
<result property="partNo" column="part_no"/>
<result property="specName" column="spec_name"/>
<result property="versionDesc" column="version_desc"/>
</resultMap>
<select id="getMallProSkuInfoSpec" resultMap="resultMallProdSkuInfoSpecMap">
SELECT mp.id, SELECT mp.id,
mp.mall_prod_info_id, mp.mall_prod_info_id,
mp.product_spec_id, mp.product_spec_id,
...@@ -452,5 +492,133 @@ ...@@ -452,5 +492,133 @@
INNER JOIN product_spec ps ON mp.product_spec_id = ps.id INNER JOIN product_spec ps ON mp.product_spec_id = ps.id
WHERE mp.goods_info_id = #{id} WHERE mp.goods_info_id = #{id}
AND mp.is_deleted = 0 AND mp.is_deleted = 0
ORDER BY mp.create_time asc
</select>
<select id="listMallprodSpecById" resultType="com.mmc.pms.entity.MallProdSkuInfoSpecDO">
SELECT
mp.id,
mp.goods_info_id,
mp.product_spec_id,
psp.price price
FROM
mall_prod_info_spec mp
LEFT JOIN product_spec_price psp ON mp.product_spec_id = psp.product_spec_id
AND psp.cooperation_tag = 0
AND psp.type = 0
and psp.lease_term = 0
<where>
mp.is_deleted = 0
<foreach collection="list" separator="," open=" and mp.goods_info_id in (" close=")" index="index" item="d">
#{d}
</foreach>
</where>
</select>
<select id="listSaleServiceInfo" resultType="com.mmc.pms.entity.SaleServiceDO">
SELECT id, service_name
FROM sale_service
WHERE is_deleted = 0
</select>
<select id="countListGoodsInfo" resultType="java.lang.Integer">
SELECT
count(*)
FROM
goods_info gi
<where>
gi.is_deleted = 0 and gi.goods_type = #{goodsType}
<if test="goodsName != null and goodsName !=''">
AND (gi.goods_name LIKE CONCAT('%',#{goodsName},'%'))
</if>
<if test="status != null">
AND (gi.shelf_status = #{status})
</if>
<if test="startTime != null and startTime != '' ">
and gi.create_time &gt;= STR_TO_DATE(#{startTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test="endTime != null and endTime != '' ">
and gi.create_time &lt;= STR_TO_DATE(#{endTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test="directoryId != null">
and (gi.directory_id = #{directoryId})
</if>
</where>
</select>
<select id="listGoodsInfo" resultType="com.mmc.pms.entity.GoodsInfo">
SELECT
gi.id,
gi.goods_name,
gi.shelf_status,
gi.create_time,
gi.directory_id,
img.img_url mainImg,
d.directory_name
FROM
goods_info gi
LEFT JOIN goods_img img ON gi.id = img.goods_info_id
AND img.img_type = 0
AND img.is_deleted = 0
INNER JOIN `directory` d ON gi.directory_id = d.id
<where>
gi.is_deleted = 0 and gi.goods_type = #{goodsType}
<if test="goodsName != null and goodsName !=''">
AND (gi.goods_name LIKE CONCAT('%',#{goodsName},'%'))
</if>
<if test="status != null">
AND (gi.shelf_status = #{status})
</if>
<if test="startTime != null and startTime != '' ">
and gi.create_time &gt;= STR_TO_DATE(#{startTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test="endTime != null and endTime != '' ">
and gi.create_time &lt;= STR_TO_DATE(#{endTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test="directoryId != null">
and (gi.directory_id = #{directoryId})
</if>
</where>
ORDER BY
gi.shelf_status DESC , gi.create_time asc
limit #{pageNo},#{pageSize}
</select>
<select id="getPriceBySpecId" resultType="com.mmc.pms.model.sale.vo.SpecPriceVO">
SELECT id,
product_spec_id,
cooperation_tag,
price,
lease_term
FROM product_spec_price
WHERE product_spec_id = #{productSpecId}
AND lease_term = #{leaseTerm}
and type = 1
</select>
<select id="countGoodsInfoByCategoryId" resultType="java.lang.Integer">
SELECT COUNT(*)
FROM goods_info gi
WHERE (gi.category_by_one = #{id}
OR gi.category_by_two = #{id})
AND gi.is_deleted = 0
</select>
<select id="getAllMallProSkuInfo" resultType="com.mmc.pms.entity.MallProdInfoDO">
SELECT mi.id,
mi.goods_info_id,
mi.product_id prodSkuId,
mi.prod_spec_name prodSkuSpecName,
mi.categories_id categoriesId,
mi.choose_type chooseType,
mi.sku_unit_id skuUnitId,
mi.is_must must,
mi.flag flag,
mi.create_time createTime,
c.name typeName,
su.id skuUnitId,
su.unit_name unitName,
ps.product_name productSkuName
FROM mall_prod_info mi
INNER JOIN categories c ON c.id = mi.categories_id
INNER JOIN sku_unit su ON mi.sku_unit_id = su.id
INNER JOIN product ps ON ps.id = mi.product_id
WHERE mi.goods_info_id = #{id}
AND mi.is_deleted = 0
ORDER BY mi.create_time asc
</select> </select>
</mapper> </mapper>
...@@ -311,12 +311,10 @@ ...@@ -311,12 +311,10 @@
industry_spec ins industry_spec ins
INNER JOIN industry_sku inds ON ins.industry_sku_id = inds.id INNER JOIN industry_sku inds ON ins.industry_sku_id = inds.id
WHERE WHERE
ins.id IN ( ins.is_deleted = 0
<foreach collection="industrySpecIds" separator="," item="id" index="index"> <foreach collection="industrySpecIds" separator="," item="id" index="index" open="AND ins.id IN (" close=")">
#{id} #{id}
</foreach> </foreach>
)
AND ins.is_deleted = 0
</select> </select>
<select id="countIndustrySpecBySkuId" resultType="java.lang.Integer"> <select id="countIndustrySpecBySkuId" resultType="java.lang.Integer">
select count(*) select count(*)
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mmc.pms.dao.InspComtDao">
<resultMap type="com.mmc.pms.entity.InspComtDO" id="InspComtMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="userImg" column="user_img" jdbcType="VARCHAR"/>
<result property="nickName" column="nick_name" jdbcType="VARCHAR"/>
<result property="content" column="content" jdbcType="VARCHAR"/>
<result property="contentImgs" column="content_imgs" jdbcType="VARCHAR"/>
<result property="contentVideo" column="content_video" jdbcType="VARCHAR"/>
<result property="star" column="star" jdbcType="INTEGER"/>
<result property="tags" column="tags" jdbcType="VARCHAR"/>
<result property="isImg" column="is_img" jdbcType="INTEGER"/>
<result property="type" column="type" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
</resultMap>
<select id="randomGetInspComtList" resultMap="InspComtMap">
SELECT id, user_img, nick_name, content, content_imgs, content_video, star, tags, is_img, `type`, create_time
FROM insp_comt
ORDER BY RAND() LIMIT #{size}
</select>
</mapper>
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
<select id="getMallProdInfoByGoodsId" resultType="com.mmc.pms.entity.MallProdInfoDO"> <select id="getMallProdInfoByGoodsId" resultType="com.mmc.pms.entity.MallProdInfoDO">
SELECT mp.id, SELECT mp.id,
mp.prod_sku_id prodSkuId, mp.product_id prodSkuId,
mp.prod_spec_name prodSkuSpecName, mp.prod_spec_name prodSkuSpecName,
mp.goods_type_id goodsTypeId, mp.goods_type_id goodsTypeId,
mp.choose_type chooseType, mp.choose_type chooseType,
...@@ -133,9 +133,9 @@ ...@@ -133,9 +133,9 @@
ps.product_name productSkuName, ps.product_name productSkuName,
ps.brand_info_id brandInfoId, ps.brand_info_id brandInfoId,
gt.type_name typeName gt.type_name typeName
FROM mall_prod_sku_info mp FROM mall_prod_info mp
INNER JOIN sku_unit su ON su.id = mp.sku_unit_id INNER JOIN sku_unit su ON su.id = mp.sku_unit_id
INNER JOIN product ps ON ps.id = mp.prod_sku_id INNER JOIN product ps ON ps.id = mp.product_id
LEFT JOIN goods_type gt ON mp.goods_type_id = gt.id LEFT JOIN goods_type gt ON mp.goods_type_id = gt.id
WHERE mp.goods_info_id = #{goodsId} WHERE mp.goods_info_id = #{goodsId}
AND mp.is_deleted = 0 AND mp.is_deleted = 0
...@@ -143,9 +143,9 @@ ...@@ -143,9 +143,9 @@
<select id="listMallProdSkuInfoSpec" resultType="com.mmc.pms.entity.MallProdSkuInfoSpecDO"> <select id="listMallProdSkuInfoSpec" resultType="com.mmc.pms.entity.MallProdSkuInfoSpecDO">
SELECT id, SELECT id,
mall_prod_sku_info_id mallProdSkuInfoId, mall_prod_info_id mallProdSkuInfoId,
product_spec_id productSpecId product_spec_id productSpecId
FROM mall_prod_sku_info_spec FROM mall_prod_info_spec
WHERE goods_info_id = #{goodsId} WHERE goods_info_id = #{goodsId}
AND is_deleted = 0 AND is_deleted = 0
</select> </select>
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
<mapper namespace="com.mmc.pms.dao.ProductDao"> <mapper namespace="com.mmc.pms.dao.ProductDao">
<insert id="insertProductSku" parameterType="com.mmc.pms.entity.ProductSkuDO" <insert id="insertProductSku" parameterType="com.mmc.pms.entity.ProductSkuDO"
useGeneratedKeys="true" keyProperty="id"> useGeneratedKeys="true" keyProperty="id">
insert into product (product_name, categories_id, model, brand_info_id, directory_id) insert into product (product_name, categories_id, model, brand_info_id, directory_id, customize)
values (#{productName}, #{categoriesId}, #{model}, #{brandInfoId}, #{directoryId}) values (#{productName}, #{categoriesId}, #{model}, #{brandInfoId}, #{directoryId}, #{customize})
</insert> </insert>
<insert id="insertProductSpec" keyProperty="id" useGeneratedKeys="true" <insert id="insertProductSpec" keyProperty="id" useGeneratedKeys="true"
parameterType="com.mmc.pms.entity.ProductSpecDO"> parameterType="com.mmc.pms.entity.ProductSpecDO">
...@@ -30,9 +30,9 @@ ...@@ -30,9 +30,9 @@
</insert> </insert>
<insert id="insertMallProdSkuInfo" parameterType="com.mmc.pms.entity.MallProdInfoDO" <insert id="insertMallProdSkuInfo" parameterType="com.mmc.pms.entity.MallProdInfoDO"
keyProperty="id" useGeneratedKeys="true"> keyProperty="id" useGeneratedKeys="true">
insert into mall_prod_info (goods_info_id, prod_sku_id, prod_spec_name, category_id, choose_type, insert into mall_prod_info (goods_info_id, product_id, prod_spec_name, categories_id, choose_type,
sku_unit_id, is_must, product_spec_id_list, flag) sku_unit_id, is_must, flag)
values (#{goodsInfoId}, #{prodSkuId}, #{prodSkuSpecName}, #{categoryId}, #{chooseType}, #{skuUnitId}, #{must}, values (#{goodsInfoId}, #{prodSkuId}, #{prodSkuSpecName}, #{categoriesId}, #{chooseType}, #{skuUnitId}, #{must},
#{flag}) #{flag})
</insert> </insert>
<update id="updateProductSku"> <update id="updateProductSku">
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
<delete id="removeProductSpecCPQ"> <delete id="removeProductSpecCPQ">
DELETE DELETE
FROM product_spec_price FROM product_spec_price
WHERE product_spec_id = #{id} WHERE product_spec_id = #{productSpecId}
and `type` = #{type} and `type` = #{type}
</delete> </delete>
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
and product_name like CONCAT ('%',#{productName},'%') and product_name like CONCAT ('%',#{productName},'%')
</if> </if>
<if test="categoryId != null"> <if test="categoryId != null">
and categories = #{categoryId} and categories_id = #{categoryId}
</if> </if>
<if test="directoryId != null"> <if test="directoryId != null">
and directory_id = #{directoryId} and directory_id = #{directoryId}
...@@ -178,22 +178,32 @@ ...@@ -178,22 +178,32 @@
<select id="countListPageProductSpec" resultType="java.lang.Integer"> <select id="countListPageProductSpec" resultType="java.lang.Integer">
select count(*) select count(*)
from product_spec from product_spec
where is_deleted = 0 <where>
and product_id = #{id} is_deleted = 0
and product_id = #{id}
<if test="keyword != null and keyword != ''">
and spec_name like CONCAT('%',#{keyword},'%')
</if>
</where>
</select> </select>
<select id="listPageProductSpec" resultType="com.mmc.pms.entity.ProductSpecDO"> <select id="listPageProductSpec" resultType="com.mmc.pms.entity.ProductSpecDO">
select id, select id,
product_id productSkuId, product_id productSkuId,
spec_name specName, spec_name specName,
spec_image specImage, spec_image specImage,
part_no partNo, part_no partNo,
version_desc versionDesc, version_desc versionDesc,
create_time createTime create_time createTime
from product_spec from product_spec
where is_deleted = 0 <where>
and product_id = #{productSkuId} is_deleted = 0
and product_id = #{productSkuId}
<if test="keyword != null and keyword != ''">
and spec_name like CONCAT('%',#{keyword},'%')
</if>
</where>
order by create_time desc order by create_time desc
limit #{pageNo}, #{pageSize} limit #{pageNo}, #{pageSize}
</select> </select>
<select id="getProductSpecPrice" resultType="com.mmc.pms.entity.ProductSpecPriceDO"> <select id="getProductSpecPrice" resultType="com.mmc.pms.entity.ProductSpecPriceDO">
select id, select id,
...@@ -414,7 +424,7 @@ ...@@ -414,7 +424,7 @@
<result property="shelfStatus" column="shelf_status"/> <result property="shelfStatus" column="shelf_status"/>
<result property="deleted" column="is_deleted"/> <result property="deleted" column="is_deleted"/>
<collection property="orderGoodsProdDetailDTOS" ofType="com.mmc.pms.model.order.dto.OrderGoodsProdDetailDTO"> <collection property="orderGoodsProdDetailDTOS" ofType="com.mmc.pms.model.order.dto.OrderGoodsProdDetailDTO">
<result property="mallProdSkuInfoId" column="mall_prod_sku_info_id"/> <result property="mallProdSkuInfoId" column="mall_prod_info_id"/>
<result property="unitName" column="unit_name"/> <result property="unitName" column="unit_name"/>
<result property="mallProdSkuInfoSpecId" column="mall_prod_info_spec_id"/> <result property="mallProdSkuInfoSpecId" column="mall_prod_info_spec_id"/>
<result property="productSpecId" column="product_spec_id"/> <result property="productSpecId" column="product_spec_id"/>
...@@ -479,4 +489,36 @@ ...@@ -479,4 +489,36 @@
AND mp.is_deleted = 0 AND mp.is_deleted = 0
AND gi.is_deleted = 0 AND gi.is_deleted = 0
</select> </select>
<select id="getProductSpecPriceList" resultType="com.mmc.pms.entity.ProductSpecPriceDO">
SELECT
id,
product_spec_id productSpecId,
cooperation_tag cooperationTag,
price
FROM
product_spec_price
WHERE product_spec_id in (
<foreach collection="list" separator="," index="index" item="d">
#{d}
</foreach>)
</select>
<select id="getProductSpecPriceById" resultType="com.mmc.pms.entity.ProductSpecPriceDO">
SELECT product_spec_id,
cooperation_tag,
price
FROM product_spec_price
WHERE product_spec_id = #{id}
AND cooperation_tag = 0
AND type = 1
</select>
<select id="productDirectoryList" resultType="com.mmc.pms.entity.DirectoryDO">
SELECT id,
directory_name,
`type`
FROM `directory`
WHERE type IN (2, 4)
OR (`type` = 0 AND `show` LIKE '%2%')
OR (`type` = 0 AND `show` LIKE '%4%')
AND is_deleted = 0
</select>
</mapper> </mapper>
...@@ -152,52 +152,50 @@ ...@@ -152,52 +152,50 @@
order by wi.create_time DESC order by wi.create_time DESC
</select> </select>
<select id="countListWareInfoPage" parameterType="com.mmc.pms.model.qo.WareInfoQO" resultType="int"> <select id="countListWareInfoPage" parameterType="com.mmc.pms.entity.GoodsInfo" resultType="int">
select count(*) SELECT count(*)
from ware_info wi INNER JOIN ware_img img ON wi.id=img.ware_info_id LEFT JOIN ware_prop wp on FROM goods_info gi
wi.id=wp.ware_info_id <where>
where wi.is_deleted = 0 and img.img_type = 0 gi.is_deleted = 0 and gi.shelf_status = 1 and gi.goods_type = #{type}
<if test="districtId != null "> <if test="categoryIds != null and categoryIds.size != 0">
and wi.district_id = #{districtId} <foreach collection="categoryIds" item="item" index="index" open="and gi.category_by_one IN (" close=")"
</if> separator=",">
<if test="categoryId != null "> #{item}
and wi.ware_type_id = #{categoryId} </foreach>
</if> </if>
<if test="brandId != null "> <if test="userIds != null">
and wi.brand_id = #{brandId} <foreach collection="userIds" item="user" index="index" open="and gi.add_goods_user_id IN (" close=")"
</if> separator=",">
<if test="modelId != null and modelId != '' "> #{user}
and wi.model_id = #{modelId} </foreach>
</if> </if>
</where>
</select> </select>
<select id="listWareInfoPage" parameterType="com.mmc.pms.model.qo.WareInfoQO" resultMap="wareInfoResultMap"> <select id="listWareInfoPage" resultType="com.mmc.pms.entity.GoodsInfo">
select SELECT
wi.id,wi.ware_no,wi.ware_type_id,wi.ware_title,wi.ware_status,wi.pay_status,wi.min_deposit,wi.max_deposit,wi.min_rent, gi.id,gi.goods_name,img.img_url mainImg
wi.max_rent,wi.total_stock,wi.total_sale,wi.sku_num,wi.tags,wi.district_id, FROM
wi.brand_id, goods_info gi
wi.model_id,wi.create_time,wi.update_time,img.id as INNER JOIN goods_img img ON gi.id = img.goods_info_id and img.img_type = 0 AND img.is_deleted = 0
ware_img_id,img.ware_info_id,img.img_url,img.img_type,wp.prop_info_id <where>
from ware_info wi INNER JOIN ware_img img ON wi.id=img.ware_info_id LEFT JOIN ware_prop wp on gi.is_deleted = 0 and gi.shelf_status = 1 and gi.goods_type = #{type}
wi.id=wp.ware_info_id <if test="param.categoryId != null">
where wi.is_deleted = 0 and img.img_type = 0 <foreach collection="param.categoryId" item="item" index="index" open="and gi.category_by_one IN ("
<if test="id != null "> close=")"
and wi.id = #{id} separator=",">
</if> #{item}
<if test="districtId != null "> </foreach>
and wi.district_id = #{districtId} </if>
</if> <if test="userIds != null">
<if test="categoryId != null "> <foreach collection="userIds" item="user" index="index" open="and gi.add_goods_user_id IN (" close=")"
and wi.ware_type_id = #{categoryId} separator=",">
</if> #{user}
<if test="brandId != null "> </foreach>
and wi.brand_id = #{brandId} </if>
</if> </where>
<if test="modelId != null and modelId != '' "> order by gi.create_time asc
and wi.model_id = #{modelId} limit #{param.pageNo},#{param.pageSize}
</if>
order by wi.create_time DESC
limit #{pageNo},#{pageSize}
</select> </select>
<select id="getWareInfoById" resultMap="wareInfoResultMap" parameterType="java.lang.Integer"> <select id="getWareInfoById" resultMap="wareInfoResultMap" parameterType="java.lang.Integer">
select wi.id, select wi.id,
...@@ -243,37 +241,48 @@ ...@@ -243,37 +241,48 @@
where ware_info_id = #{wareInfoId} where ware_info_id = #{wareInfoId}
</select> </select>
<select id="ad" resultType="com.mmc.pms.entity.AdDO"> <select id="ad" resultType="com.mmc.pms.entity.AdDO">
SELECT SELECT id,
id, image_url AS imageUrl
image_url AS imageUrl FROM device_ad
FROM
device_ad
</select> </select>
<resultMap type="com.mmc.pms.entity.SkuInfoDO" <resultMap type="com.mmc.pms.entity.SkuInfoDO"
id="skuInfoDoResultMap"> id="skuInfoDoResultMap">
<id property="id" column="sku_info_id" /> <id property="id" column="sku_info_id"/>
<result property="wareInfoId" column="ware_info_id" /> <result property="wareInfoId" column="ware_info_id"/>
<result property="skuTitle" column="sku_title" /> <result property="skuTitle" column="sku_title"/>
<result property="rentDeposit" column="rent_deposit" /> <result property="rentDeposit" column="rent_deposit"/>
<result property="stockNum" column="stock_num" /> <result property="stockNum" column="stock_num"/>
<result property="saleNum" column="sale_num" /> <result property="saleNum" column="sale_num"/>
<result property="rentDeposit" column="rent_deposit" /> <result property="rentDeposit" column="rent_deposit"/>
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time"/>
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time"/>
<collection property="skuPriceDOList" javaType="java.util.List" <collection property="skuPriceDOList" javaType="java.util.List"
ofType="com.mmc.pms.entity.SkuPriceDO"> ofType="com.mmc.pms.entity.SkuPriceDO">
<id property="id" column="sku_price_id" /> <id property="id" column="sku_price_id"/>
<result property="wareInfoId" column="ware_info_id" /> <result property="wareInfoId" column="ware_info_id"/>
<result property="skuInfoId" column="sku_info_id" /> <result property="skuInfoId" column="sku_info_id"/>
<result property="rentPrice" column="rent_price" /> <result property="rentPrice" column="rent_price"/>
<result property="minDay" column="min_day" /> <result property="minDay" column="min_day"/>
<result property="maxDay" column="max_day" /> <result property="maxDay" column="max_day"/>
</collection> </collection>
</resultMap> </resultMap>
<select id="listSkuInfo" resultMap="skuInfoDoResultMap" parameterType="java.lang.Integer"> <select id="listSkuInfo" resultMap="skuInfoDoResultMap" parameterType="java.lang.Integer">
select si.id as sku_info_id,si.ware_info_id,si.sku_title,si.rent_deposit,si.stock_num,si.sale_num, select si.id as sku_info_id,
si.create_time,si.update_time,sp.id as sku_price_id,sp.rent_price,sp.min_day,sp.max_day si.ware_info_id,
from sku_info si INNER JOIN sku_price sp ON si.id=sp.sku_info_id where si.ware_info_id = #{id} and si.is_deleted = 0 si.sku_title,
si.rent_deposit,
si.stock_num,
si.sale_num,
si.create_time,
si.update_time,
sp.id as sku_price_id,
sp.rent_price,
sp.min_day,
sp.max_day
from sku_info si
INNER JOIN sku_price sp ON si.id = sp.sku_info_id
where si.ware_info_id = #{id}
and si.is_deleted = 0
</select> </select>
</mapper> </mapper>
...@@ -167,7 +167,7 @@ ...@@ -167,7 +167,7 @@
SELECT count(1) SELECT count(1)
FROM goods_info gi FROM goods_info gi
INNER JOIN mall_prod_sku_info mpsi ON mpsi.goods_info_id = gi.id INNER JOIN mall_prod_sku_info mpsi ON mpsi.goods_info_id = gi.id
INNER JOIN product ps ON mpsi.prod_sku_id = ps.id INNER JOIN product ps ON mpsi.product_id = ps.id
AND ps.is_deleted = 0 AND ps.is_deleted = 0
INNER JOIN brand_info bi ON ps.brand_info_id = bi.id INNER JOIN brand_info bi ON ps.brand_info_id = bi.id
AND bi.is_delete = 0 AND bi.is_delete = 0
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
service_introduction, create_time, update_time, account_id service_introduction, create_time, update_time, account_id
from service from service
<where> <where>
is_deleted = 0
<if test="serviceName != null and serviceName != ''"> <if test="serviceName != null and serviceName != ''">
and service_name LIKE CONCAT('%',#{serviceName},'%') and service_name LIKE CONCAT('%',#{serviceName},'%')
</if> </if>
...@@ -73,11 +74,9 @@ ...@@ -73,11 +74,9 @@
<if test="industryId != null"> <if test="industryId != null">
and industry_id = #{industryId} and industry_id = #{industryId}
</if> </if>
<if test="accountId != null"> <if test="displayState != null">
and account_id = #{accountId} and display_state = #{displayState}
</if> </if>
and is_deleted = 0
and display_state = 0
</where> </where>
order by create_time desc order by create_time desc
limit #{pageNo}, #{pageSize} limit #{pageNo}, #{pageSize}
...@@ -88,6 +87,7 @@ ...@@ -88,6 +87,7 @@
select count(*) select count(*)
from service from service
<where> <where>
is_deleted = 0
<if test="serviceName != null and serviceName != ''"> <if test="serviceName != null and serviceName != ''">
and service_name LIKE CONCAT('%',#{serviceName},'%') and service_name LIKE CONCAT('%',#{serviceName},'%')
</if> </if>
...@@ -97,11 +97,9 @@ ...@@ -97,11 +97,9 @@
<if test="industryId != null"> <if test="industryId != null">
and industry_id = #{industryId} and industry_id = #{industryId}
</if> </if>
<if test="accountId != null"> <if test="displayState != null">
and account_id = #{accountId} and display_state = #{displayState}
</if> </if>
and is_deleted = 0
and display_state = 0
</where> </where>
</select> </select>
...@@ -155,9 +153,117 @@ ...@@ -155,9 +153,117 @@
</update> </update>
<!--通过主键删除--> <!--通过主键删除-->
<update id="deleteById" parameterType="java.lang.Integer"> <update id="deleteByIds" parameterType="java.lang.Integer">
update service update service
set is_deleted = 1 set is_deleted = 1
where id = #{id} where
<foreach collection="ids" open="id in (" close=")" item="item" separator=",">
#{item}
</foreach>
</update> </update>
<select id="conditionCount" resultType="java.lang.Integer">
select count(*)
from service
<where>
is_deleted = 0
<if test="categoriesIds != null">
<foreach collection="categoriesIds" item="item" open="and (application_id in (" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="categoriesIds != null">
<foreach collection="categoriesIds" item="item" open="or industry_id in (" close="))" separator=",">
#{item}
</foreach>
</if>
<if test="userIds !=null">
<foreach collection="userIds" open="and account_id in (" close=")" separator="," item="item">
#{item}
</foreach>
</if>
<if test="param.serviceName != null and param.serviceName!=''">
and service_name LIKE CONCAT('%',#{param.serviceName},'%')
</if>
<if test="param.industryId!=null">
and industry_id = #{param.industryId}
</if>
<if test="param.applicationId!=null">
and application_id = #{param.applicationId}
</if>
<if test="param.displayState != null">
and display_state = #{param.displayState}
</if>
</where>
</select>
<select id="queryPageByLimit" resultType="com.mmc.pms.entity.ServiceDO">
select
id, service_name, application_id, industry_id, display_state, cover_plan, share_card, video,
service_introduction, create_time, update_time, account_id
from service
<where>
is_deleted = 0
<if test="categoriesIds != null">
<foreach collection="categoriesIds" item="item" open="and (application_id in (" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="categoriesIds != null">
<foreach collection="categoriesIds" item="item" open="or industry_id in (" close="))" separator=",">
#{item}
</foreach>
</if>
<if test="userIds !=null">
<foreach collection="userIds" open="and account_id in (" close=")" separator="," item="item">
#{item}
</foreach>
</if>
<if test="param.serviceName != null and param.serviceName!=''">
and service_name LIKE CONCAT('%',#{param.serviceName},'%')
</if>
<if test="param.industryId!=null">
and industry_id = #{param.industryId}
</if>
<if test="param.applicationId!=null">
and application_id = #{param.applicationId}
</if>
<if test="param.displayState != null">
and display_state = #{param.displayState}
</if>
</where>
order by create_time desc
limit #{param.pageNo}, #{param.pageSize}
</select>
<select id="QueryWorkServiceListById" resultType="com.mmc.pms.model.work.dto.ServiceDTO">
select id,
service_name,
application_id,
industry_id,
display_state,
cover_plan,
share_card,
video,
service_introduction,
create_time,
update_time,
account_id
from service
where
is_deleted = 0
<if test="ids != null">
<foreach collection="ids" item="id" open="and id in (" close=")" separator=",">
#{id}
</foreach>
</if>
</select>
<select id="batchUpAndDownWorkService" resultType="java.lang.Integer">
update service
set display_state = #{param.displayState}
where
<foreach collection="param.ids" open="id in (" close=")" item="item" separator=",">
#{item}
</foreach>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -7,3 +7,13 @@ data-filter: ...@@ -7,3 +7,13 @@ data-filter:
- /pms/swagger-resources/** - /pms/swagger-resources/**
- /pms/webjars/** - /pms/webjars/**
- /pms/product/spec/feignGetSpecLeaseUnitPrice - /pms/product/spec/feignGetSpecLeaseUnitPrice
- /pms/product/mall/deviceList
- /pms/classify/queryCategoryInfoByType
- /pms/classify/feignQqueryCategoryInfoByType
- /pms/product/mall/getLeaseGoodsDetail
- /pms/product/mall/getPageHomeCategories
- /pms/backstage/work/queryWorkServiceList
- /pms/backstage/work/queryWorkService
- /pms/backstage/work/feignQueryWorkServiceListById
- /pms/webDevice/getSecondDistrictInfo
- /pms/webDevice/ad
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论