提交 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
...@@ -30,3 +34,17 @@ spec: ...@@ -30,3 +34,17 @@ spec:
configMapKeyRef: configMapKeyRef:
name: pms-map name: pms-map
key: SPRING_PROFILES_ACTIVE key: SPRING_PROFILES_ACTIVE
- name: SW_AGENT_COLLECTOR_BACKEND_SERVICES
valueFrom:
configMapKeyRef:
name: pms-map
key: SW_AGENT_COLLECTOR_BACKEND_SERVICES
- name: SW_AGENT_NAME
valueFrom:
configMapKeyRef:
name: pms-map
key: SW_AGENT_NAME
volumes:
- name: log-of-app
hostPath:
path: /var/log/app
\ No newline at end of file
...@@ -18,4 +18,4 @@ patches: ...@@ -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,14 +6,12 @@ import org.springframework.web.servlet.config.annotation.InterceptorRegistry; ...@@ -6,14 +6,12 @@ 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) {
......
...@@ -8,8 +8,7 @@ import org.springframework.context.annotation.PropertySource; ...@@ -8,8 +8,7 @@ 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
......
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)
throws Exception {
String requestURI = request.getRequestURI(); String requestURI = request.getRequestURI();
// //根据uri确认是否要拦截 // //根据uri确认是否要拦截
if (!shouldFilter(requestURI)) { if (!shouldFilter(requestURI)) {
return true; return true;
} }
...@@ -46,38 +43,44 @@ public class TokenCheckHandleInterceptor implements HandlerInterceptor { ...@@ -46,38 +43,44 @@ public class TokenCheckHandleInterceptor implements HandlerInterceptor {
exceptionProcess(response); exceptionProcess(response);
return false; return false;
} }
// //
// String serverName = request.getServerName(); // String serverName = request.getServerName();
// String remoteHost = request.getRemoteHost(); // String remoteHost = request.getRemoteHost();
// log.info("hostName: {}", hostName); // log.info("hostName: {}", hostName);
// log.info("serverName: {}", serverName); // log.info("serverName: {}", serverName);
// log.info("remoteHost: {}", remoteHost); // log.info("remoteHost: {}", remoteHost);
// log.info("forwardedFor: {}", forwardedFor); // log.info("forwardedFor: {}", forwardedFor);
// log.info("forwardedHost: {}", forwardedHost); // 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")){ // if (hostName.equals("iuav.mmcuav.cn") || hostName.equals("test.iuav.mmcuav.cn") ||
// String token = request.getHeader("token"); // hostName.equals("www.iuav.shop") || hostName.equals("test.iuav.shop")){
// if (StringUtils.isBlank(token)){ // String token = request.getHeader("token");
// exceptionProcess(response); // if (StringUtils.isBlank(token)){
// return false; // exceptionProcess(response);
// } // return false;
// String tokenJson = stringRedisTemplate.opsForValue().get(token); // }
// if (StringUtils.isBlank(tokenJson)){ // String tokenJson = stringRedisTemplate.opsForValue().get(token);
// exceptionProcess(response); // if (StringUtils.isBlank(tokenJson)){
// return false; // exceptionProcess(response);
// } // return false;
// return true; // }
// } // return true;
//测试-打印请求信息 // }
// 测试-打印请求信息
return true; return true;
} }
@Override @Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { public void postHandle(
} HttpServletRequest request,
HttpServletResponse response,
Object handler,
ModelAndView modelAndView)
throws Exception {}
@Override @Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { public void afterCompletion(
} HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
throws Exception {}
public void exceptionProcess(HttpServletResponse response) throws Exception { public void exceptionProcess(HttpServletResponse response) throws Exception {
response.setContentType("application/json;charset=utf-8"); response.setContentType("application/json;charset=utf-8");
......
package com.mmc.pms.auth.dto;
import com.mmc.pms.common.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @author: zj
* @Date: 2023/5/25 13:32
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BUserAccountQO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "关键字", required = false)
private String keyword;
@ApiModelProperty(value = "地区", required = false)
private String area;
@ApiModelProperty(value = "省份编码", required = false)
private Integer provinceCode;
@ApiModelProperty(value = "城市编码", required = false)
private Integer cityCode;
@ApiModelProperty(value = "县区编码", required = false)
private Integer districtCode;
@ApiModelProperty(value = "角色id", required = false)
private Integer roleId;
@ApiModelProperty(value = "账号状态:0禁用 1可用")
private Integer accountStatus;
@ApiModelProperty(value = "账号状态:0合伙人 1员工")
private Integer userType;
@ApiModelProperty(value = "用户id集合")
private List<Integer> userIds;
@ApiModelProperty(value = "推荐单位id")
private Integer rcdCompanyId;
@ApiModelProperty(value = "单位集合", hidden = true)
private List<Integer> companys;
@ApiModelProperty(value = "页码", required = true)
@NotNull(message = "页码不能为空", groups = Page.class)
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true)
@NotNull(message = "每页显示数不能为空", groups = Page.class)
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
}
...@@ -8,10 +8,10 @@ import lombok.NoArgsConstructor; ...@@ -8,10 +8,10 @@ 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
...@@ -26,5 +26,5 @@ public class LoginSuccessDTO implements Serializable { ...@@ -26,5 +26,5 @@ public class LoginSuccessDTO implements Serializable {
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", "服务器正忙,请稍后再试!"),
FILE_UPLOAD_ERROR("600", "文件上传有误"),
FILE_UPLOAD_NULL_ERROR("601", "上传的文件不能为空"),
TOKEN_EXPIRED_ERROR("602", "登录信息已过期,请重新登录"),
TOKEN_INVALID_ERROR("603", "无效的登录信息"),
VERIFY_CODE_ERROR("604", "验证码错误,请重新输入"),
TOKEN_REDIS_ERROR("605", "登录失效"),
AUTH_ACCOUNT_ERROR("606", "当前账号未授权,请先授权"),
TOEKN_REPEAT_ERROR("607", "该账号已在其他设备登录,请重新登录"),
TOKEN_NOT_VALID_ERROR("608", "access_token已失效或access_token不是最新的"), TOKEN_NOT_VALID_ERROR("608", "access_token已失效或access_token不是最新的"),
SCHEDULE_SYS_ERROR("703", "系统定时任务执行错误"), SCHEDULE_SYS_ERROR("703", "系统定时任务执行错误"),
FORM_REPEAT_ERROR("704", "操作次数频繁,请稍后重试"), DATA_VERSION_ERROR("705", "数据写入版本不一致,请稍后重试。"), FORM_REPEAT_ERROR("704", "操作次数频繁,请稍后重试"),
DATA_VERSION_ERROR("705", "数据写入版本不一致,请稍后重试。"),
REQUEST_PARAM_ILLEGAL_ERROR("706", "请求参数非法"), REQUEST_PARAM_ILLEGAL_ERROR("706", "请求参数非法"),
DATA_INSERT_ERROR("707", "数据插入失败"), DATA_INSERT_ERROR("707", "数据插入失败"),
SCORE_RELEASE_ERROR("708", "积分发放失败,请重试或联系管理员!"), SCORE_RELEASE_ERROR("708", "积分发放失败,请重试或联系管理员!"),
...@@ -25,7 +32,8 @@ public enum ResultEnum implements BaseErrorInfoInterface { ...@@ -25,7 +32,8 @@ public enum ResultEnum implements BaseErrorInfoInterface {
// 业务操作错误定义 // 业务操作错误定义
CUSTOM_ERROR("-1", "自定义业务错误消息"), CUSTOM_ERROR("-1", "自定义业务错误消息"),
FEIGN_ORDER_SERVLET_ERROR("4001", "访问订单服务失败"), FEIGN_USER_SERVLET_ERROR("4002", "访问用户服务失败"), FEIGN_ORDER_SERVLET_ERROR("4001", "访问订单服务失败"),
FEIGN_USER_SERVLET_ERROR("4002", "访问用户服务失败"),
FEIGN_PAY_SERVLET_ERROR("4003", "访问消耗服务失败"), FEIGN_PAY_SERVLET_ERROR("4003", "访问消耗服务失败"),
DISABLE_ACCOUNT_TOKEN_ERROR("4004", "账号信息变更,登录失效"), DISABLE_ACCOUNT_TOKEN_ERROR("4004", "账号信息变更,登录失效"),
FEIGN_OPERATION_SERVLET_ERROR("4005", "访问行业服务失败"), FEIGN_OPERATION_SERVLET_ERROR("4005", "访问行业服务失败"),
...@@ -36,7 +44,8 @@ public enum ResultEnum implements BaseErrorInfoInterface { ...@@ -36,7 +44,8 @@ public enum ResultEnum implements BaseErrorInfoInterface {
FEIGN_REPOUSER_SERVLET_ERROR("4010", "访问云仓用户服务失败"), FEIGN_REPOUSER_SERVLET_ERROR("4010", "访问云仓用户服务失败"),
FEIGN_WARE_SERVLET_ERROR("4010", "访问云仓商品服务失败"), FEIGN_WARE_SERVLET_ERROR("4010", "访问云仓商品服务失败"),
FEIGN_DEVICE_SERVLET_ERROR("4011", "访问云仓设备服务失败"), FEIGN_DEVICE_SERVLET_ERROR("4011", "访问云仓设备服务失败"),
CENTER_USER_SERVLET_ERROR("4012", "访问用户中心服务失败"), GATEWAY_HYSRIX_ERROR("4013", "服务器貌似在开小差~"), CENTER_USER_SERVLET_ERROR("4012", "访问用户中心服务失败"),
GATEWAY_HYSRIX_ERROR("4013", "服务器貌似在开小差~"),
FEIGN_FLYER_PAY_SERVLET_ERROR("4014", "访问飞手消耗服务失败"), FEIGN_FLYER_PAY_SERVLET_ERROR("4014", "访问飞手消耗服务失败"),
MALL_USER_SERVLET_ERROR("4015", "访问机城用户服务失败"), MALL_USER_SERVLET_ERROR("4015", "访问机城用户服务失败"),
PRIMARY_KEY_DEFECT("5001", "主键ID缺失"), PRIMARY_KEY_DEFECT("5001", "主键ID缺失"),
...@@ -173,11 +182,13 @@ public enum ResultEnum implements BaseErrorInfoInterface { ...@@ -173,11 +182,13 @@ public enum ResultEnum implements BaseErrorInfoInterface {
OAUTH_CREATE_TOKEN_ERROR("6408", "系统内部错误,获取accessToken失败,"), OAUTH_CREATE_TOKEN_ERROR("6408", "系统内部错误,获取accessToken失败,"),
PWD_CREATE_ERROR("6001", "创建密码失败"), PWD_CREATE_ERROR("6001", "创建密码失败"),
PWD_CONPARED_ERROR("6002", "密码错误"), PWD_ALERT_ERROR("6003", "密码不一致"), PWD_CONPARED_ERROR("6002", "密码错误"),
PWD_ALERT_ERROR("6003", "密码不一致"),
PWD_REQUEST_AUTH_ERROR("6003", "密码请求验证"), PWD_REQUEST_AUTH_ERROR("6003", "密码请求验证"),
APPLET_PORT_TYPE_ERROR("7001", "小程序端口类型错误"), APPLET_PORT_TYPE_ERROR("7001", "小程序端口类型错误"),
APPLET_GET_OPENID_ERROR("7002", "获取小程序openid失败"), APPLET_GET_OPENID_ERROR("7002", "获取小程序openid失败"),
UPDATE_USER_ACCOUNT_REPEAT("7003", "修改后的账户名已存在"), ADD_USER_ACCOUNT_NAME_EXISTS("7004", "新增账户名已经存在"), UPDATE_USER_ACCOUNT_REPEAT("7003", "修改后的账户名已存在"),
ADD_USER_ACCOUNT_NAME_EXISTS("7004", "新增账户名已经存在"),
ACCOUNT_NOT_FIND_ERROR("8000", "账号信息不存在"), ACCOUNT_NOT_FIND_ERROR("8000", "账号信息不存在"),
REPEAT_SOFT_DELETE("8001", "账号已删除"), REPEAT_SOFT_DELETE("8001", "账号已删除"),
ADMIN_ROLE_DELETE_ERROR("8002", "此账号为管理员账号,禁止删除"), ADMIN_ROLE_DELETE_ERROR("8002", "此账号为管理员账号,禁止删除"),
...@@ -186,7 +197,8 @@ public enum ResultEnum implements BaseErrorInfoInterface { ...@@ -186,7 +197,8 @@ public enum ResultEnum implements BaseErrorInfoInterface {
ROLE_AVL_USER_DELETE_ERROR("8005", "此角色尚有可用账号,请将所有账号移除后在进行操作"), ROLE_AVL_USER_DELETE_ERROR("8005", "此角色尚有可用账号,请将所有账号移除后在进行操作"),
ROLE_AVL_USER_STATUS_ERROR("8006", "此角色尚有可用账号,请将所有账号禁用后在进行操作"), ROLE_AVL_USER_STATUS_ERROR("8006", "此角色尚有可用账号,请将所有账号禁用后在进行操作"),
ROLE_SYSTEM_DELETE_ERROR("8007", "此角色为系统角色,禁止删除"), ROLE_SYSTEM_DELETE_ERROR("8007", "此角色为系统角色,禁止删除"),
ADMIN_ROLE_POWER_ERROR("8008", "禁止修改管理类角色权限"), SYSTEM_ROLE_POWER_ERROR("8009", "禁止修改系统类角色权限"), ADMIN_ROLE_POWER_ERROR("8008", "禁止修改管理类角色权限"),
SYSTEM_ROLE_POWER_ERROR("8009", "禁止修改系统类角色权限"),
ROLE_SELF_POWER_ERROR("8010", "禁止修改与当前登录账号角色相同的角色权限"), ROLE_SELF_POWER_ERROR("8010", "禁止修改与当前登录账号角色相同的角色权限"),
ADMIN_ACCOUNT_DISABLE_ERROR("8011", "此账号为管理员账号,禁用失败"), ADMIN_ACCOUNT_DISABLE_ERROR("8011", "此账号为管理员账号,禁用失败"),
...@@ -212,7 +224,6 @@ public enum ResultEnum implements BaseErrorInfoInterface { ...@@ -212,7 +224,6 @@ public enum ResultEnum implements BaseErrorInfoInterface {
SORT_PARAMETER_ERROR("28199", "排序参数错误"), SORT_PARAMETER_ERROR("28199", "排序参数错误"),
OPRATING_FREQUENCY_TOO_HIGH("28449", "更新频率过快,请重试"), OPRATING_FREQUENCY_TOO_HIGH("28449", "更新频率过快,请重试"),
INSERT_INDUSTRY_INSPECTION_SUCCESS("20011", "添加对应服务成功"), INSERT_INDUSTRY_INSPECTION_SUCCESS("20011", "添加对应服务成功"),
INSERT_INSPECTION_INDUSTRY_SUCCESS("20012", "添加对应行业成功"), INSERT_INSPECTION_INDUSTRY_SUCCESS("20012", "添加对应行业成功"),
DELETE_INDUSTRY_INSPECTION_SUCCESS("20013", "删除对应服务成功"), DELETE_INDUSTRY_INSPECTION_SUCCESS("20013", "删除对应服务成功"),
...@@ -249,8 +260,7 @@ public enum ResultEnum implements BaseErrorInfoInterface { ...@@ -249,8 +260,7 @@ public enum ResultEnum implements BaseErrorInfoInterface {
GET_ORDER_LIST_ERROR("22002", "获取订单列表失败"), GET_ORDER_LIST_ERROR("22002", "获取订单列表失败"),
COMMANT_CAR_NAME_EXIST("22003", "指挥车名字已存在,请重新输入"), COMMANT_CAR_NAME_EXIST("22003", "指挥车名字已存在,请重新输入"),
// 认证提示
//认证提示
APP_CODE_ERROR("30301", "appcode 错误"), APP_CODE_ERROR("30301", "appcode 错误"),
REQUE_ENVIROMENT_ERROR("30302", "请求的 Method、Path 或者环境错误"), REQUE_ENVIROMENT_ERROR("30302", "请求的 Method、Path 或者环境错误"),
REQUEST_PARAMETER_ERROR("30303", "请求参数错误"), REQUEST_PARAMETER_ERROR("30303", "请求参数错误"),
...@@ -275,7 +285,7 @@ public enum ResultEnum implements BaseErrorInfoInterface { ...@@ -275,7 +285,7 @@ public enum ResultEnum implements BaseErrorInfoInterface {
REAL_NAME_ACCOUNT_ID_ERROR("36771", "账户id错误"), REAL_NAME_ACCOUNT_ID_ERROR("36771", "账户id错误"),
REAL_NAME_FUSING_ERROR("36772", "认证失败,请重新认证"), REAL_NAME_FUSING_ERROR("36772", "认证失败,请重新认证"),
//企业认证 // 企业认证
BUSINESS_LICENSE_CHECK_ANALYSIS_ERROR("30400", "营业执照解析失败,请上传有效清晰的执照"), BUSINESS_LICENSE_CHECK_ANALYSIS_ERROR("30400", "营业执照解析失败,请上传有效清晰的执照"),
BUSINESS_LICENSE_CHECK_PARAMETER_ERROR("30401", "企业信息与营业执照信息不一致,请重新上传"), BUSINESS_LICENSE_CHECK_PARAMETER_ERROR("30401", "企业信息与营业执照信息不一致,请重新上传"),
BANK_ACCOUNT_CHECK1_ERROR("30402", "账号与开户名不符"), BANK_ACCOUNT_CHECK1_ERROR("30402", "账号与开户名不符"),
...@@ -283,7 +293,8 @@ public enum ResultEnum implements BaseErrorInfoInterface { ...@@ -283,7 +293,8 @@ public enum ResultEnum implements BaseErrorInfoInterface {
BANK_ACCOUNT_CHECK3_ERROR("30404", "仅支持对公账户验证,不支持个人卡"), BANK_ACCOUNT_CHECK3_ERROR("30404", "仅支持对公账户验证,不支持个人卡"),
BANK_ACCOUNT_CHECK4_ERROR("30405", "企业账号信息有误,请重新输入"), BANK_ACCOUNT_CHECK4_ERROR("30405", "企业账号信息有误,请重新输入"),
BANK_ACCOUNT_CHECK5_ERROR("30406", "24小时之内不能重复申请"), BANK_ACCOUNT_CHECK5_ERROR("30406", "24小时之内不能重复申请"),
BANK_ACCOUNT_CHECK6_ERROR("30407", "很抱歉,目前我们的企业认证次数已达上限,如需继续认证请及时联系相关负责人进行处理,联系方式:科比特管理人员,18938853647。"), BANK_ACCOUNT_CHECK6_ERROR(
"30407", "很抱歉,目前我们的企业认证次数已达上限,如需继续认证请及时联系相关负责人进行处理,联系方式:科比特管理人员,18938853647。"),
BANK_ACCOUNT_CHECK7_ERROR("30408", "企业名称与开户名称不一致,请确认一致后再提交认证"), BANK_ACCOUNT_CHECK7_ERROR("30408", "企业名称与开户名称不一致,请确认一致后再提交认证"),
ENTERPRISE_HAVE_VERIFIED("30409", "您输入的企业信息已被其他用户认证,请重新输入"), ENTERPRISE_HAVE_VERIFIED("30409", "您输入的企业信息已被其他用户认证,请重新输入"),
...@@ -298,29 +309,28 @@ public enum ResultEnum implements BaseErrorInfoInterface { ...@@ -298,29 +309,28 @@ public enum ResultEnum implements BaseErrorInfoInterface {
NOT_ENT_VERIFY_ERROR("30417", "机构未认证或认证未通过,请先进行机构认证"), NOT_ENT_VERIFY_ERROR("30417", "机构未认证或认证未通过,请先进行机构认证"),
NOT__VERIFY_ERROR("30418", "机构未认证或飞手认证未通过,请先进行认证"), NOT__VERIFY_ERROR("30418", "机构未认证或飞手认证未通过,请先进行认证"),
//渠道认证 // 渠道认证
NOT_ENT_USER("30501", "感谢您有意向成为我们的渠道商,请先完成企业认证。"), NOT_ENT_USER("30501", "感谢您有意向成为我们的渠道商,请先完成企业认证。"),
NEW_NOT_ENT_USER("30502", "此用户未进行企业认证,渠道变更失败!"), NEW_NOT_ENT_USER("30502", "此用户未进行企业认证,渠道变更失败!"),
BEFORE_NOT_CHANNEL_USER("30503", "此用户还不是渠道"), BEFORE_NOT_CHANNEL_USER("30503", "此用户还不是渠道"),
// 飞手端认证
//飞手端认证
NOT_AUTH_FLYER_ERROR("30600", "飞手未认证,请先完成飞手认证"), NOT_AUTH_FLYER_ERROR("30600", "飞手未认证,请先完成飞手认证"),
NOT_HAVE_AUTH_FLYER_ERROR("30601", "没有认证的飞手,暂不可接单"), NOT_HAVE_AUTH_FLYER_ERROR("30601", "没有认证的飞手,暂不可接单"),
//设备型号提醒 // 设备型号提醒
DEVICE_MODEL_REPEAT_ERROR("30700", "产品名称不可重复,请重新输入"), DEVICE_MODEL_REPEAT_ERROR("30700", "产品名称不可重复,请重新输入"),
DEVICE_MODEL_FAILURE_ERROR("30701", "设备添加失败"), DEVICE_MODEL_FAILURE_ERROR("30701", "设备添加失败"),
DEVICE_MODEL_REMOVE_ERROR("30702", "设备未在仓库,删除失败"), DEVICE_MODEL_REMOVE_ERROR("30702", "设备未在仓库,删除失败"),
DEVICE_MODEL_UPDATE_ERROR("30703", "设备修改失败"), DEVICE_MODEL_UPDATE_ERROR("30703", "设备修改失败"),
DEVICE_HAS_BEEN_RENT_ERROR("30704", "该设备不在仓库,不能出库"), DEVICE_HAS_BEEN_RENT_ERROR("30704", "该设备不在仓库,不能出库"),
//仓库提醒 // 仓库提醒
REPO_INFO_NAME("30800", "仓库名称不可重复,请重新输入"), REPO_INFO_NAME("30800", "仓库名称不可重复,请重新输入"),
REPO_INFO_FAILURE("30801", "仓库添加失败"), REPO_INFO_FAILURE("30801", "仓库添加失败"),
REPO_INFO_REMOVE("30702", "仓库删除失败"), REPO_INFO_REMOVE("30702", "仓库删除失败"),
//商品 // 商品
WARE_NAME_HAS_BEEN_EXIST("30900", "商品名称已存在"), WARE_NAME_HAS_BEEN_EXIST("30900", "商品名称已存在"),
WARE_TYPE_NAME_HAS_BEEN_EXIST("30901", "分类名称已存在"), WARE_TYPE_NAME_HAS_BEEN_EXIST("30901", "分类名称已存在"),
WARE_TYPE_ICON_NOT_NULL("30902", "一级分类图标不能为空"), WARE_TYPE_ICON_NOT_NULL("30902", "一级分类图标不能为空"),
...@@ -337,12 +347,12 @@ public enum ResultEnum implements BaseErrorInfoInterface { ...@@ -337,12 +347,12 @@ public enum ResultEnum implements BaseErrorInfoInterface {
GOODS_NAME_IS_NOT_NULL("30914", "商品名称不能为空或名字长度不能大于60"), GOODS_NAME_IS_NOT_NULL("30914", "商品名称不能为空或名字长度不能大于60"),
GOODS_DELETE_FAIL("30915", "批量删除商品失败,商品已被其他商品绑定"), GOODS_DELETE_FAIL("30915", "批量删除商品失败,商品已被其他商品绑定"),
BRAND_DELETE_FAIL("30916", "删除失败,产品管理中有产品绑定该品牌名称"), BRAND_DELETE_FAIL("30916", "删除失败,产品管理中有产品绑定该品牌名称"),
//返祖 // 返祖
RETURN_SHARE_ORDER_ERROR("40000", "设备返祖订单相关信息找不到,请重新输入订单号"), RETURN_SHARE_ORDER_ERROR("40000", "设备返祖订单相关信息找不到,请重新输入订单号"),
RETURN_SHARE_ORDER_NOT_FINISH_ERROR("40001", "此设备的订单未完成,请添加其他设备"), RETURN_SHARE_ORDER_NOT_FINISH_ERROR("40001", "此设备的订单未完成,请添加其他设备"),
RETURN_SHARE_ORDER_HAS_BEEN_ADD_ERROR("40002", "此订单的设备已经被添加过,不能重复添加"), RETURN_SHARE_ORDER_HAS_BEEN_ADD_ERROR("40002", "此订单的设备已经被添加过,不能重复添加"),
//宣传中心 // 宣传中心
EXIST_SAME_NAME_OF_MODULE_ERROR("40500", "所属产品中不能有相同名字的模块"), EXIST_SAME_NAME_OF_MODULE_ERROR("40500", "所属产品中不能有相同名字的模块"),
EXIST_SAME_NAME_OF_BANNER_ERROR("40501", "名称重复,请重新输入"), EXIST_SAME_NAME_OF_BANNER_ERROR("40501", "名称重复,请重新输入"),
EXIST_SAME_CODE_OF_MODULE_ERROR("40502", "moduleCode已重复,请输入其他moduleCode"), EXIST_SAME_CODE_OF_MODULE_ERROR("40502", "moduleCode已重复,请输入其他moduleCode"),
...@@ -381,21 +391,23 @@ public enum ResultEnum implements BaseErrorInfoInterface { ...@@ -381,21 +391,23 @@ public enum ResultEnum implements BaseErrorInfoInterface {
SCORE_ERROR("40177", "您输入的积分数量有误,请重新输入!"), SCORE_ERROR("40177", "您输入的积分数量有误,请重新输入!"),
PLEASE_FILL_IN_THE_CONTRACT_TEMPLATE_FIRST("40178", "请先填充合同模板!"), PLEASE_FILL_IN_THE_CONTRACT_TEMPLATE_FIRST("40178", "请先填充合同模板!"),
SCORE_NOT_GIVE_MYSELF("40179","积分不能转赠给本人,请重新操作"), SCORE_NOT_GIVE_MYSELF("40179", "积分不能转赠给本人,请重新操作"),
ALREADY_FINISH_ENT_AUTH_ERROR("2000", "助力已完成!"), ALREADY_FINISH_ENT_AUTH_ERROR("2000", "助力已完成!"),
SYSTEM_ERROR ("2001","系统错误,请稍后重试") , SYSTEM_ERROR("2001", "系统错误,请稍后重试"),
RULE_ERROR ("2002","当前兑换比例已失效,请刷新后重试"), RULE_ERROR("2002", "当前兑换比例已失效,请刷新后重试"),
COUNT_LIMIT_ERROR("2003", "参与次数已达上线"), COUNT_LIMIT_ERROR("2003", "参与次数已达上线"),
ALREADY_ENT_AUTH_ERROR("2004","助力失败,您已完成企业认证!"), ALREADY_ENT_AUTH_ERROR("2004", "助力失败,您已完成企业认证!"),
ALREADY_REAL_NAME_AUTH_ERROR("2005","助力失败,您已完成实名认证!"), ALREADY_REAL_NAME_AUTH_ERROR("2005", "助力失败,您已完成实名认证!"),
PARTICIPATE_BUT_NOT_AUTH_ERROR("2006", "待完成授权或认证"), PARTICIPATE_BUT_NOT_AUTH_ERROR("2006", "待完成授权或认证"),
ALREADY_HELP_ERROR("2007", "已助力"), ALREADY_HELP_ERROR("2007", "已助力"),
ALREADY_STOP_ERROR("2008", "活动已下线"), ALREADY_STOP_ERROR("2008", "活动已下线"),
HELP_FAIL_ERROR("2009", "不能给自己助力哦!"), HELP_FAIL_ERROR("2009", "不能给自己助力哦!"),
ALREADY_BINDING_ERROR("2010", "优惠券已被绑定"), ALREADY_BINDING_ERROR("2010", "优惠券已被绑定"),
ALREADY_DIVIDE_ERROR("2011", "订单已分成"), ALREADY_DIVIDE_ERROR("2011", "订单已分成"),
DIVIDE_OBJ_NOT_EXIST("2012", "先点击确认添加分成对象"); DIVIDE_OBJ_NOT_EXIST("2012", "先点击确认添加分成对象"),
DEFAULT_DIRECTORY("3001", "默认目录不可删除或修改名称!");
/** /**
* 错误码 * 错误码
* *
......
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,8 +26,7 @@ import java.util.List; ...@@ -28,8 +26,7 @@ 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")
...@@ -41,41 +38,48 @@ public class BackstageCategoriesController { ...@@ -41,41 +38,48 @@ public class BackstageCategoriesController {
@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(@RequestParam Integer pageNo, @RequestParam Integer pageSize, @RequestParam(required = false) Integer type) { public ResultBody directoryList(
@RequestParam Integer pageNo,
@RequestParam Integer pageSize,
@RequestParam(required = false) Integer type) {
return ResultBody.success(categoriesService.directoryList(pageNo, pageSize, type)); return ResultBody.success(categoriesService.directoryList(pageNo, pageSize, type));
} }
@ApiOperation(value = "删除目录") @ApiOperation(value = "删除目录")
@GetMapping("removeDirectory") @GetMapping("removeDirectory")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody removeDirectory(@ApiParam(value = "id") @RequestParam(value = "id") Integer id) { public ResultBody removeDirectory(
@ApiParam(value = "id") @RequestParam(value = "id") Integer id) {
return categoriesService.removeDirectory(id); return categoriesService.removeDirectory(id);
} }
@ApiOperation(value = "分类新增") @ApiOperation(value = "分类新增")
@PostMapping("addClassification") @PostMapping("addClassification")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addClassification(@Validated(Create.class) @RequestBody ClassifyInfoVO classifyInfoVO) { public ResultBody addClassification(
@Validated(Create.class) @RequestBody ClassifyInfoVO classifyInfoVO) {
return categoriesService.addClassification(classifyInfoVO); return categoriesService.addClassification(classifyInfoVO);
} }
@ApiOperation(value = "分类修改") @ApiOperation(value = "分类修改")
@PostMapping("updateClassification") @PostMapping("updateClassification")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody updateClassification(@Validated(Update.class) @RequestBody ClassifyInfoVO classifyInfoVO) { public ResultBody updateClassification(
@Validated(Update.class) @RequestBody ClassifyInfoVO classifyInfoVO) {
return categoriesService.updateClassification(classifyInfoVO); return categoriesService.updateClassification(classifyInfoVO);
} }
@ApiOperation(value = "分类信息-排序") @ApiOperation(value = "分类信息-排序")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("exchangeSortType") @GetMapping("exchangeSortType")
public ResultBody exchangeSortType(@ApiParam(value = "第一个分类id", required = true) @RequestParam(value = "firstId") Integer firstId, public ResultBody exchangeSortType(
@ApiParam(value = "第二个分类id", required = true) @RequestParam(value = "secondId") Integer secondId) { @ApiParam(value = "第一个分类id", required = true) @RequestParam(value = "firstId")
Integer firstId,
@ApiParam(value = "第二个分类id", required = true) @RequestParam(value = "secondId")
Integer secondId) {
return categoriesService.exchangeSortType(firstId, secondId); return categoriesService.exchangeSortType(firstId, secondId);
} }
@ApiOperation(value = "分类信息-列表") @ApiOperation(value = "分类信息-列表")
@PostMapping("getClassificationList") @PostMapping("getClassificationList")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ClassifyInfoDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ClassifyInfoDTO.class)})
...@@ -83,26 +87,30 @@ public class BackstageCategoriesController { ...@@ -83,26 +87,30 @@ public class BackstageCategoriesController {
return ResultBody.success(categoriesService.getClassificationList(queryClassifyVO)); return ResultBody.success(categoriesService.getClassificationList(queryClassifyVO));
} }
@ApiOperation(value = "分类详情") @ApiOperation(value = "分类详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ClassifyDetailsDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ClassifyDetailsDTO.class)})
@GetMapping("getClassifyDetails") @GetMapping("getClassifyDetails")
public ResultBody getClassifyDetails(@ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id) { public ResultBody getClassifyDetails(
@ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id) {
return categoriesService.getClassifyDetails(id); return categoriesService.getClassifyDetails(id);
} }
@ApiOperation(value = "分类详情") @ApiOperation(value = "分类详情下关联业务列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = RelevantBusinessVO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = RelevantBusinessVO.class)})
@GetMapping("queryRelevantBusiness") @GetMapping("queryRelevantBusiness")
public ResultBody queryRelevantBusiness(@ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id, public ResultBody queryRelevantBusiness(
@ApiParam(value = "业务类型", required = true) @Min(value = 0) @RequestParam(value = "type") Integer type) { @ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id,
@ApiParam(value = "业务类型", required = true) @Min(value = 0) @RequestParam(value = "type")
Integer type) {
return categoriesService.queryRelevantBusiness(id, type); return categoriesService.queryRelevantBusiness(id, type);
} }
@ApiOperation(value = "分类删除") @ApiOperation(value = "分类删除")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = RelevantBusinessVO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = RelevantBusinessVO.class)})
@GetMapping("deleteRelevantBusiness") @GetMapping("deleteRelevantBusiness")
public ResultBody deleteRelevantBusiness(@ApiParam(value = "分类id", required = true) @Min(value = 1) @RequestParam(value = "id") Integer id) { public ResultBody deleteRelevantBusiness(
@ApiParam(value = "分类id", required = true) @Min(value = 1) @RequestParam(value = "id")
Integer id) {
return categoriesService.deleteRelevantBusiness(id); return categoriesService.deleteRelevantBusiness(id);
} }
...@@ -113,4 +121,21 @@ public class BackstageCategoriesController { ...@@ -113,4 +121,21 @@ public class BackstageCategoriesController {
return categoriesService.getDirectoryList(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,47 +8,77 @@ import com.mmc.pms.model.order.dto.OrderGoodsProdDTO; ...@@ -8,47 +8,77 @@ import com.mmc.pms.model.order.dto.OrderGoodsProdDTO;
import com.mmc.pms.model.qo.MallOrderGoodsInfoQO; import com.mmc.pms.model.qo.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 = "新增(租赁/销售)商品") @ApiOperation(value = "新增(租赁/销售)商品")
@PostMapping("addGoodsInfo") @PostMapping("addGoodsInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addGoods(@ApiParam("商品信息VO") @Validated(Create.class) @RequestBody GoodsAddVO goodsAddVO) { public ResultBody addGoods(
@ApiParam("商品信息VO") @Validated(Create.class) @RequestBody GoodsAddVO goodsAddVO) {
return goodsInfoService.addGoods(goodsAddVO); return goodsInfoService.addGoods(goodsAddVO);
} }
@ApiOperation(value = "修改(租赁/销售)商品") @ApiOperation(value = "修改(租赁/销售)商品")
@PostMapping("editGoodsInfo") @PostMapping("editGoodsInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody editGoodsInfo(@ApiParam("商品信息VO") @Validated(Update.class) @RequestBody GoodsAddVO goodsAddVO) { public ResultBody editGoodsInfo(
@ApiParam("商品信息VO") @Validated(Update.class) @RequestBody GoodsAddVO goodsAddVO) {
return goodsInfoService.editGoodsInfo(goodsAddVO); return goodsInfoService.editGoodsInfo(goodsAddVO);
} }
@ApiOperation(value = "PC端-商品详情") @ApiOperation(value = "PC端-商品详情")
@GetMapping("getGoodsInfoDetail") @GetMapping("getGoodsInfoDetail")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = MallGoodsDetailDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = MallGoodsDetailDTO.class)})
public ResultBody getGoodsInfoDetail(@ApiParam("商品id") @RequestParam Integer goodsInfoId) { public ResultBody getGoodsInfoDetail(
return goodsInfoService.getGoodsInfoDetail(goodsInfoId); @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 = "单位信息") @ApiOperation(value = "单位信息")
...@@ -58,6 +88,13 @@ public class BackstageGoodsManageController { ...@@ -58,6 +88,13 @@ public class BackstageGoodsManageController {
return goodsInfoService.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) @ApiOperation(value = "feign根据购物车信息填充未知信息", hidden = true)
@PostMapping("fillGoodsInfo") @PostMapping("fillGoodsInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = MallGoodsShopCarDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = MallGoodsShopCarDTO.class)})
...@@ -68,14 +105,16 @@ public class BackstageGoodsManageController { ...@@ -68,14 +105,16 @@ public class BackstageGoodsManageController {
@ApiOperation(value = "feign根据渠道等级和产品规格id获取对应价格", hidden = true) @ApiOperation(value = "feign根据渠道等级和产品规格id获取对应价格", hidden = true)
@PostMapping("feignListProductSpecPrice") @PostMapping("feignListProductSpecPrice")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public List<MallProductSpecPriceDTO> feignListProductSpecPrice(@RequestBody ProductSpecPriceQO productSpecPriceQO) { public List<MallProductSpecPriceDTO> feignListProductSpecPrice(
@RequestBody ProductSpecPriceQO productSpecPriceQO) {
return goodsInfoService.feignListProductSpecPrice(productSpecPriceQO); return goodsInfoService.feignListProductSpecPrice(productSpecPriceQO);
} }
@ApiOperation(value = "feign根据渠道等级获取单价信息", hidden = true) @ApiOperation(value = "feign根据渠道等级获取单价信息", hidden = true)
@GetMapping("feignGetUnitPriceByTag") @GetMapping("feignGetUnitPriceByTag")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecPriceDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecPriceDTO.class)})
public ProductSpecPriceDTO feignGetUnitPriceByTag(@RequestParam(value = "specId") Integer specId, public ProductSpecPriceDTO feignGetUnitPriceByTag(
@RequestParam(value = "specId") Integer specId,
@RequestParam(value = "tagId") Integer tagId) { @RequestParam(value = "tagId") Integer tagId) {
return goodsInfoService.feignGetUnitPriceByTag(specId, tagId); return goodsInfoService.feignGetUnitPriceByTag(specId, tagId);
} }
...@@ -83,15 +122,16 @@ public class BackstageGoodsManageController { ...@@ -83,15 +122,16 @@ public class BackstageGoodsManageController {
@ApiOperation(value = "feign根据商品的产品规格id查询商品信息", hidden = true) @ApiOperation(value = "feign根据商品的产品规格id查询商品信息", hidden = true)
@PostMapping("feignListProdGoodsSkuInfo") @PostMapping("feignListProdGoodsSkuInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = OrderGoodsProdDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = OrderGoodsProdDTO.class)})
public List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(@RequestBody MallOrderGoodsInfoQO mallOrderGoodsInfoQO) { public List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(
@RequestBody MallOrderGoodsInfoQO mallOrderGoodsInfoQO) {
return goodsInfoService.feignListProdGoodsSkuInfo(mallOrderGoodsInfoQO); return goodsInfoService.feignListProdGoodsSkuInfo(mallOrderGoodsInfoQO);
} }
@ApiOperation(value = "feign根据商品的行业规格id查询商品清单信息", hidden = true) @ApiOperation(value = "feign根据商品的行业规格id查询商品清单信息", hidden = true)
@PostMapping("feignListIndstGoodsSkuInfo") @PostMapping("feignListIndstGoodsSkuInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = OrderGoodsProdDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = OrderGoodsProdDTO.class)})
public List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(@RequestBody MallOrderGoodsInfoQO mallOrderGoodsInfoQO) { public List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(
@RequestBody MallOrderGoodsInfoQO mallOrderGoodsInfoQO) {
return goodsInfoService.feignListIndstGoodsSkuInfo(mallOrderGoodsInfoQO); 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,20 +18,20 @@ import java.math.BigDecimal; ...@@ -17,20 +18,20 @@ 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(@Validated(Create.class) @ApiParam("产品skuVO") @RequestBody ProductSkuVO param) { public ResultBody addProductSku(
@Validated(Create.class) @ApiParam("产品skuVO") @RequestBody ProductSkuVO param) {
return productSkuService.addProductSku(param); return productSkuService.addProductSku(param);
} }
...@@ -44,10 +45,18 @@ public class BackstageProductSpecController { ...@@ -44,10 +45,18 @@ public class BackstageProductSpecController {
@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(
@Validated(Update.class) @ApiParam("产品skuVO") @RequestBody ProductSkuVO param) {
return productSkuService.editProductSku(param); return productSkuService.editProductSku(param);
} }
@ApiOperation(value = "产品目录列表")
@GetMapping("productDirectoryList")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = DirectoryInfoVO.class)})
public ResultBody<DirectoryInfoVO> productDirectoryList() {
return productSkuService.productDirectoryList();
}
@ApiOperation(value = "产品sku分页列表") @ApiOperation(value = "产品sku分页列表")
@PostMapping("listPageProductSku") @PostMapping("listPageProductSku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSkuDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSkuDTO.class)})
...@@ -65,7 +74,9 @@ public class BackstageProductSpecController { ...@@ -65,7 +74,9 @@ public class BackstageProductSpecController {
@ApiOperation(value = "新增or修改产品规格") @ApiOperation(value = "新增or修改产品规格")
@PostMapping("addOrEditProductSpec") @PostMapping("addOrEditProductSpec")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addOrEditProductSpec(@Validated({Create.class, Update.class}) @ApiParam("产品规格VO") @RequestBody ProductSpecVO param) { public ResultBody addOrEditProductSpec(
@Validated({Create.class, Update.class}) @ApiParam("产品规格VO") @RequestBody
ProductSpecVO param) {
return productSkuService.addOrEditProductSpec(param); return productSkuService.addOrEditProductSpec(param);
} }
...@@ -79,10 +90,12 @@ public class BackstageProductSpecController { ...@@ -79,10 +90,12 @@ public class BackstageProductSpecController {
@ApiOperation(value = "产品规格分页列表") @ApiOperation(value = "产品规格分页列表")
@GetMapping("listPageProductSpec") @GetMapping("listPageProductSpec")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecDTO.class)})
public ResultBody listPageProductSpec(@ApiParam(value = "页码") @RequestParam(value = "pageNo") Integer pageNo, public ResultBody listPageProductSpec(
@ApiParam(value = "页码") @RequestParam(value = "pageNo") Integer pageNo,
@ApiParam(value = "每页显示数") @RequestParam(value = "pageSize") Integer pageSize, @ApiParam(value = "每页显示数") @RequestParam(value = "pageSize") Integer pageSize,
@ApiParam(value = "产品skuId") @RequestParam(value = "productSkuId") Integer productSkuId) { @ApiParam(value = "产品skuId") @RequestParam(value = "productSkuId") Integer productSkuId,
return productSkuService.listPageProductSpec(pageNo, pageSize, productSkuId); @ApiParam(value = "关键字") @RequestParam(value = "keyword", required = false) String keyword) {
return productSkuService.listPageProductSpec(pageNo, pageSize, productSkuId, keyword);
} }
@ApiOperation(value = "产品规格管理-价格配置") @ApiOperation(value = "产品规格管理-价格配置")
...@@ -92,7 +105,6 @@ public class BackstageProductSpecController { ...@@ -92,7 +105,6 @@ public class BackstageProductSpecController {
return productSkuService.productSpecCPQ(productSpecCPQVO); return productSkuService.productSpecCPQ(productSpecCPQVO);
} }
@ApiOperation(value = "价格配置信息的修改") @ApiOperation(value = "价格配置信息的修改")
@PostMapping("updateProductSpecCPQ") @PostMapping("updateProductSpecCPQ")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
...@@ -108,28 +120,33 @@ public class BackstageProductSpecController { ...@@ -108,28 +120,33 @@ public class BackstageProductSpecController {
} }
// //
// @ApiOperation(value = "价格配置信息--恢复全局默认设置") // @ApiOperation(value = "价格配置信息--恢复全局默认设置")
// @GetMapping("getDefaultSettings") // @GetMapping("getDefaultSettings")
// @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecPriceDTO.class)}) // @ApiResponses({@ApiResponse(code = 200, message = "OK", response =
// public ResultBody getDefaultSettings(@ApiParam(value = "规格id") @RequestParam(value = "productSpecId") Integer productSpecId) { // ProductSpecPriceDTO.class)})
// return productSpecService.getDefaultSettings(productSpecId); // public ResultBody getDefaultSettings(@ApiParam(value = "规格id") @RequestParam(value =
// } // "productSpecId") Integer productSpecId) {
// // return productSpecService.getDefaultSettings(productSpecId);
// }
//
@ApiOperation(value = "产品规格管理---删除规格") @ApiOperation(value = "产品规格管理---删除规格")
@GetMapping("removeProductSpec") @GetMapping("removeProductSpec")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = RemoveSkuDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = RemoveSkuDTO.class)})
public ResultBody removeProductSpec(@ApiParam("id") @RequestParam(value = "id") Integer id) { public ResultBody removeProductSpec(@ApiParam("id") @RequestParam(value = "id") Integer id) {
return productSkuService.removeProductSpec(id); return productSkuService.removeProductSpec(id);
} }
// //
// @ApiOperation(value = "feign根据渠道等级获取单价信息") // @ApiOperation(value = "feign根据渠道等级获取单价信息")
// @GetMapping("feignGetUnitPriceByTag") // @GetMapping("feignGetUnitPriceByTag")
// @ApiIgnore // @ApiIgnore
// @ApiResponses({@ApiResponse(code = 200, message = "OK",response = ProductSpecPriceDTO.class)}) // @ApiResponses({@ApiResponse(code = 200, message = "OK",response =
// public ProductSpecPriceDTO feignGetUnitPriceByTag(@RequestParam(value = "specId")Integer specId, // ProductSpecPriceDTO.class)})
// @RequestParam(value = "tagId")Integer tagId) { // public ProductSpecPriceDTO feignGetUnitPriceByTag(@RequestParam(value = "specId")Integer
// return productSpecService.feignGetUnitPriceByTag(specId,tagId); // specId,
// } // @RequestParam(value = "tagId")Integer
// tagId) {
// return productSpecService.feignGetUnitPriceByTag(specId,tagId);
// }
@ApiOperation(value = "feign根据渠道等级获取单价信息") @ApiOperation(value = "feign根据渠道等级获取单价信息")
@PostMapping("feignGetSpecLeaseUnitPrice") @PostMapping("feignGetSpecLeaseUnitPrice")
......
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 = "新增作业服务") @ApiOperation(value = "新增作业服务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("addWorkService") @PostMapping("addWorkService")
public ResultBody addWorkService(@Validated(Create.class) @RequestBody ServiceVO param, HttpServletRequest request) { public ResultBody addWorkService(
return backstageTaskService.addWorkService(param, this.getUserLoginInfoFromRedis(request).getUserAccountId()); @Validated(Create.class) @RequestBody ServiceVO param, HttpServletRequest request) {
return backstageTaskService.addWorkService(
param, this.getUserLoginInfoFromRedis(request).getUserAccountId());
} }
@ApiOperation(value = "修改作业服务") @ApiOperation(value = "修改作业服务")
...@@ -42,24 +46,47 @@ public class BackstageTaskServiceController extends BaseController { ...@@ -42,24 +46,47 @@ public class BackstageTaskServiceController extends BaseController {
return backstageTaskService.updateById(param); return backstageTaskService.updateById(param);
} }
@ApiOperation(value = "删除作业服务") @ApiOperation(value = "批量删除作业服务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("deleteWorkService") @PostMapping("deleteWorkService")
public ResultBody deleteWorkService(@ApiParam("作业服务id") @RequestParam(value = "id") Integer id) { public ResultBody deleteWorkService(@ApiParam("作业服务id") @RequestBody List<Integer> ids) {
return backstageTaskService.deleteById(id); return backstageTaskService.deleteByIds(ids);
}
@ApiOperation(value = "批量上下架作业服务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("batchUpAndDownWorkService")
public ResultBody batchUpAndDownWorkService(@RequestBody UpAndDownServiceVO param) {
return backstageTaskService.batchUpAndDownWorkService(param);
} }
@ApiOperation(value = "查询作业服务") @ApiOperation(value = "查询作业服务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ServiceDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ServiceDTO.class)})
@GetMapping("queryWorkService") @GetMapping("queryWorkService")
public ResultBody queryWorkService(@ApiParam("作业服务id") @RequestParam(value = "id") Integer id) { public ResultBody<ServiceDTO> queryWorkService(@ApiParam("作业服务id") @RequestParam(value = "id") Integer id) {
return backstageTaskService.queryById(id); return backstageTaskService.queryById(id);
} }
@ApiOperation(value = "查询工作服务列表") @ApiOperation(value = "查询服务管理列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ServiceDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ServiceDTO.class)})
@PostMapping("queryServiceManagerList")
public ResultBody<ServiceDTO> queryServiceManagerList(
@Validated(Page.class) @RequestBody ServiceQO param, HttpServletRequest request) {
return ResultBody.success(backstageTaskService.queryServiceManagerList(param, this.getUserLoginInfoFromRedis(request).getUserAccountId()));
}
@ApiOperation(value = "web接口-条件查询作业服务列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = WorkServiceDTO.class)})
@PostMapping("queryWorkServiceList") @PostMapping("queryWorkServiceList")
public PageResult queryWorkServiceList(@Validated(Create.class) @RequestBody ServiceQO param, HttpServletRequest request) { public ResultBody<WorkServiceDTO> queryWorkServiceList(@Validated(Page.class) @RequestBody ServiceQO param, HttpServletRequest request) {
return backstageTaskService.queryWorkServiceList(param, this.getUserLoginInfoFromRedis(request).getUserAccountId()); return ResultBody.success(backstageTaskService.queryWorkServiceList(param,request));
}
@ApiOperation(value = "远程查询作业服务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ServiceDTO.class)})
@PostMapping("feignQueryWorkServiceListById")
@ApiIgnore
public List<ServiceDTO> feignQueryWorkServiceListById(@RequestBody List<Integer> ids) {
return backstageTaskService.feignQueryWorkServiceListById(ids);
} }
} }
...@@ -11,31 +11,31 @@ import org.springframework.data.redis.core.StringRedisTemplate; ...@@ -11,31 +11,31 @@ 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 * @param request
* @return * @return
*/ */
// public BaseAccountDTO getUserLoginInfo(HttpServletRequest request) { // public BaseAccountDTO getUserLoginInfo(HttpServletRequest request) {
// String token = request.getHeader("token"); // String token = request.getHeader("token");
// try { // try {
// Claims claims = JwtUtil.parseJwt(token); // Claims claims = JwtUtil.parseJwt(token);
// String userId = claims.get(JwtConstant.USER_ACCOUNT_ID).toString(); // String userId = claims.get(JwtConstant.USER_ACCOUNT_ID).toString();
//// String roleId = claims.get("").toString(); //// String roleId = claims.get("").toString();
// String tokenType = claims.get(JwtConstant.TOKEN_TYPE).toString(); // String tokenType = claims.get(JwtConstant.TOKEN_TYPE).toString();
// return BaseAccountDTO.builder().id(Integer.parseInt(userId)).tokenPort(tokenType).build(); // return
// }catch (Exception e){ // BaseAccountDTO.builder().id(Integer.parseInt(userId)).tokenPort(tokenType).build();
// throw new BizException("Invalid token"); // }catch (Exception e){
// } // throw new BizException("Invalid token");
// } // }
// }
/** /**
* 使用token从redis获取用户信息 * 使用token从redis获取用户信息
......
package com.mmc.pms.controller;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.entity.Categories;
import com.mmc.pms.model.categories.dto.CategoriesDTO;
import com.mmc.pms.model.group.Create;
import com.mmc.pms.model.qo.ServiceQO;
import com.mmc.pms.model.work.dto.ServiceDTO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.CategoriesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 前端控制器
* </p>
*
* @author Pika
* @since 2023-06-08
*/
@Api(tags = {"后台-目录管理-接口"})
@RestController
@RequestMapping("/directory")
public class DirectoryController {
private final String DIRECTORY_NAME_APPLICATION = "应用";
private final String DIRECTORY_NAME_INDUSTRY = "行业";
@Autowired
private CategoriesService categoriesService;
@ApiOperation(value = "获取应用类型列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = CategoriesDTO.class)})
@PostMapping("getApplicationList")
public ResultBody getApplicationList() {
return categoriesService.getApplicationList(DIRECTORY_NAME_APPLICATION);
}
@ApiOperation(value = "获取对应行业列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = CategoriesDTO.class)})
@PostMapping("getIndustryList")
public ResultBody getIndustryList() {
return categoriesService.getApplicationList(DIRECTORY_NAME_INDUSTRY);
}
}
...@@ -5,20 +5,16 @@ import com.mmc.pms.common.ResultEnum; ...@@ -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,8 +32,7 @@ import java.util.List; ...@@ -32,8 +32,7 @@ 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")
......
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.*;
...@@ -74,6 +81,83 @@ public class UploadController { ...@@ -74,6 +81,83 @@ public class UploadController {
return ResultBody.success(jsObj); 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") @ApiOperation(value = "V1.0.1-上传多个文件到阿里云oss")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam( @ApiImplicitParam(
......
package com.mmc.pms.controller;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author LW
* @date 2023/6/7 13:33
* 概要:
*/
@Api(tags = {"分类信息"})
@RestController
@RequestMapping("/category")
public class WebAndMiniProgramCategoryController {
// @ApiOperation(value = "web-分类信息")
// @PostMapping("queryCategoryByType")
// @ApiResponses({@ApiResponse(code = 200, message = "OK", response = GoodsInfoListDTO.class)})
// public ResultBody<GoodsInfoListDTO> listPageGoodsInfo(
// @ApiParam("商品查询条件QO") @RequestBody GoodsInfoQO param) {
// return ResultBody.success(webProductMallService.listPageGoodsInfo(param));
// }
}
package com.mmc.pms.controller; 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,8 +21,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -29,8 +21,7 @@ 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)})
...@@ -39,65 +30,9 @@ public class WebDeviceController { ...@@ -39,65 +30,9 @@ public class WebDeviceController {
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("设备广告位") @ApiOperation("设备广告位")
@GetMapping("/ad") @GetMapping("/ad")
public ResultBody<AdDTO> ad() { public ResultBody<AdDTO> ad() {
return webDeviceService.ad(); return webDeviceService.ad();
} }
@ApiOperation(value = "设备列表筛选")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = WareInfoItemDTO.class)})
@PostMapping("/deviceList")
public ResultBody<WareInfoItemDTO> listWareInfoPage(
@RequestBody @Validated(Page.class) WareInfoQO param) {
return webDeviceService.listWareInfoPage(param);
}
} }
package com.mmc.pms.controller.web;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author LW
* @date 2023/6/8 15:19
* 概要:
*/
@RestController
@RequestMapping("/lease/goods")
@Api(tags = {"web端-设备租赁-相关接口"})
public class WebLeaseGoodsController {
}
package com.mmc.pms.dao; 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 {
...@@ -17,11 +21,19 @@ public interface BackstageTaskServiceDao { ...@@ -17,11 +21,19 @@ public interface BackstageTaskServiceDao {
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,8 +14,7 @@ import java.util.Set; ...@@ -14,8 +14,7 @@ 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 {
...@@ -50,7 +49,7 @@ public interface CategoriesDao { ...@@ -50,7 +49,7 @@ public interface CategoriesDao {
int countListClassification(QueryClassifyVO queryClassifyVO); int countListClassification(QueryClassifyVO queryClassifyVO);
int selectDirectoryById(Integer id); DirectoryDO selectDirectoryById(Integer id);
int deleteById(Integer id); int deleteById(Integer id);
...@@ -59,8 +58,10 @@ public interface CategoriesDao { ...@@ -59,8 +58,10 @@ public interface CategoriesDao {
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,8 +13,7 @@ import java.util.Set; ...@@ -11,8 +13,7 @@ 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 {
...@@ -53,7 +54,7 @@ public interface GoodsInfoDao { ...@@ -53,7 +54,7 @@ public interface GoodsInfoDao {
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);
...@@ -83,7 +84,8 @@ public interface GoodsInfoDao { ...@@ -83,7 +84,8 @@ public interface GoodsInfoDao {
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);
...@@ -92,8 +94,24 @@ public interface GoodsInfoDao { ...@@ -92,8 +94,24 @@ public interface GoodsInfoDao {
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,8 +13,8 @@ import java.util.Set; ...@@ -13,8 +13,8 @@ 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 {
...@@ -54,7 +54,8 @@ public interface IndustrySpecDao { ...@@ -54,7 +54,8 @@ public interface IndustrySpecDao {
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);
...@@ -74,10 +75,10 @@ public interface IndustrySpecDao { ...@@ -74,10 +75,10 @@ public interface IndustrySpecDao {
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);
......
package com.mmc.pms.dao;
import com.mmc.pms.entity.InspComtDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* <p>
* 评论表 Mapper 接口
* </p>
*
* @author Pika
* @since 2023-06-09
*/
@Mapper
public interface InspComtDao {
List<InspComtDO> randomGetInspComtList(Integer size);
}
...@@ -19,8 +19,7 @@ import java.util.Set; ...@@ -19,8 +19,7 @@ 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 {
...@@ -49,13 +48,16 @@ public interface ProductDao { ...@@ -49,13 +48,16 @@ public interface ProductDao {
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);
...@@ -80,8 +82,6 @@ public interface ProductDao { ...@@ -80,8 +82,6 @@ public interface ProductDao {
void removeProductSku(Integer id); void removeProductSku(Integer id);
List<MallProdInfoDO> listMallProdInfo(String id);
void removeProductSpec(Integer id); void removeProductSpec(Integer id);
List<IndustrySpecDO> listIndustrySpec(@Param("industrySpecIds") Set<Integer> industrySpecIds); List<IndustrySpecDO> listIndustrySpec(@Param("industrySpecIds") Set<Integer> industrySpecIds);
...@@ -112,8 +112,10 @@ public interface ProductDao { ...@@ -112,8 +112,10 @@ public interface ProductDao {
List<OrderGoodsProdDTO> listProdGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO); 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;
...@@ -33,9 +34,15 @@ public interface WebDeviceDao { ...@@ -33,9 +34,15 @@ public interface WebDeviceDao {
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);
......
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,8 +13,7 @@ import java.io.Serializable; ...@@ -12,8 +13,7 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* @author lw * @author lw @TableName categories
* @TableName categories
*/ */
@Data @Data
@AllArgsConstructor @AllArgsConstructor
...@@ -53,16 +53,39 @@ public class Categories implements Serializable { ...@@ -53,16 +53,39 @@ public class Categories implements Serializable {
} }
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)
.createTime(createTime)
.directoryId(directoryId)
.type(type)
.build();
} }
public ClassifyDetailsDTO buildClassifyDetailsDTO() { public ClassifyDetailsDTO buildClassifyDetailsDTO() {
return ClassifyDetailsDTO.builder().id(id).description(description) return ClassifyDetailsDTO.builder()
.icon(icon).classifyName(name) .id(id)
.remark(remark).build(); .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)实体类
...@@ -19,46 +25,51 @@ import java.util.Date; ...@@ -19,46 +25,51 @@ import java.util.Date;
@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; private String directoryName;
/** /** 其他目录关联id */
* 其他目录关联id
*/
private Integer pid; private Integer pid;
/** /** 类型:(0:通用目录 1:作业服务目录 2:设备目录 3:飞手目录 4:商城目录) */
* 类型:(0:通用目录 1:作业服务目录 2:设备目录 3:飞手目录 4:商城目录)
*/
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 String show;
private String relevanceName; private String relevanceName;
public DirectoryDO(DirectoryInfoVO param) { public DirectoryDO(DirectoryInfoVO param) {
if (CollectionUtils.isNotEmpty(param.getShow())) {
String show = param.getShow().stream().map(Object::toString).collect(Collectors.joining(","));
this.show = show;
}
this.id = param.getId(); this.id = param.getId();
this.directoryName = param.getDirectoryName(); this.directoryName = param.getDirectoryName();
this.pid = param.getPid();
this.type = param.getType(); 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,8 +12,7 @@ import java.io.Serializable; ...@@ -10,8 +12,7 @@ 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
...@@ -55,6 +56,10 @@ public class GoodsInfo implements Serializable { ...@@ -55,6 +56,10 @@ public class GoodsInfo implements Serializable {
private String mainImg; private String mainImg;
private Integer isCoupons;
private String directoryName;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public GoodsInfo(GoodsAddVO goodsAddVO) { public GoodsInfo(GoodsAddVO goodsAddVO) {
...@@ -73,6 +78,28 @@ public class GoodsInfo implements Serializable { ...@@ -73,6 +78,28 @@ public class GoodsInfo implements Serializable {
} }
public RelevanceGoodsInfoVO buildRelevanceGoodsInfoVO() { public RelevanceGoodsInfoVO buildRelevanceGoodsInfoVO() {
return RelevanceGoodsInfoVO.builder().id(id).goodsName(goodsName).shelf(shelfStatus).mainImage(mainImg).build(); return RelevanceGoodsInfoVO.builder()
.id(id)
.goodsName(goodsName)
.shelf(shelfStatus)
.mainImage(mainImg)
.build();
}
public LeaseGoodsInfoDTO buildLeaseGoodsInfoDTO() {
return LeaseGoodsInfoDTO.builder().id(id).goodsName(goodsName).images(mainImg).build();
}
public GoodsInfoListDTO buildGoodsInfoListDTO() {
return GoodsInfoListDTO.builder()
.id(id)
.goodsName(goodsName)
.directoryName(directoryName)
.directoryId(directoryId)
.createTime(createTime)
.imgUrl(mainImg)
.status(shelfStatus)
.isCoupons(this.isCoupons)
.build();
} }
} }
package com.mmc.pms.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
* <p>
* 评论表
* </p>
*
* @author Pika
* @since 2023-06-09
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class InspComtDO implements Serializable {
private static final long serialVersionUID = 1896389867L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "头像")
private String userImg;
@ApiModelProperty(value = "昵称")
private String nickName;
@ApiModelProperty(value = "评价内容")
private String content;
@ApiModelProperty(value = "评价图片集合 1.jpg,2.jpg 使用逗号隔开")
private String contentImgs;
@ApiModelProperty(value = "评价视频")
private String contentVideo;
@ApiModelProperty(value = "评价星级")
private Integer star;
@ApiModelProperty(value = "关键字集合 深圳市,广州市,长沙市使用逗号隔开")
private String tags;
@ApiModelProperty(value = "是否带图 0:带图 1:不带图")
private Integer isImg;
@ApiModelProperty(value = "评价类型:0:好评 1:差评")
private Integer type;
@ApiModelProperty(value = "创建时间")
private Date createTime;
}
...@@ -31,20 +31,15 @@ public class MallProdInfoDO implements Serializable { ...@@ -31,20 +31,15 @@ public class MallProdInfoDO implements Serializable {
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;
/**
* 辅助字段 start
*/
private String typeName; private String typeName;
private String goodsName; private String goodsName;
private String unitName; private String unitName;
private String productSkuName; private String productSkuName;
private Integer brandInfoId; private Integer brandInfoId;
/** /** 辅助字段 end */
* 辅助字段 end
*/
public MallProdInfoDO(GoodsProdSpecVO goodsSpecVO) { public MallProdInfoDO(GoodsProdSpecVO goodsSpecVO) {
this.categoriesId = goodsSpecVO.getCategoryId(); this.categoriesId = goodsSpecVO.getCategoryId();
this.prodSkuSpecName = goodsSpecVO.getGoodsSpecName(); this.prodSkuSpecName = goodsSpecVO.getGoodsSpecName();
......
...@@ -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;
/** /**
...@@ -26,6 +27,7 @@ public class MallProdSkuInfoSpecDO implements Serializable { ...@@ -26,6 +27,7 @@ public class MallProdSkuInfoSpecDO implements Serializable {
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;
......
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
...@@ -62,15 +62,7 @@ public class ServiceDO implements Serializable { ...@@ -62,15 +62,7 @@ public class ServiceDO implements Serializable {
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.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; this.accountId = accountId;
} }
......
package com.mmc.pms.feign;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.mmc.pms.auth.dto.BUserAccountQO;
import com.mmc.pms.auth.dto.UserAccountSimpleDTO;
import com.mmc.pms.feign.hystrix.UserAppApiHystrix;
import io.swagger.annotations.ApiParam;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author: zj
* @Date: 2023/5/18 17:06
*/
//@FeignClient(name = "cms-svc", fallback = UserAppApiHystrix.class)
@FeignClient(url = "${iuav.userapp.url}", name = "cms-svc", fallback = UserAppApiHystrix.class)
public interface UserAppApi {
/**
* 根据用户id获取基本信息
*
* @param userAccountId
* @return
*/
@RequestMapping(value = "/userapp/user-account/feignGetUserSimpleInfo", method = RequestMethod.GET)
public UserAccountSimpleDTO feignGetUserSimpleInfo(@RequestParam Integer userAccountId, @RequestHeader("token") String token);
/**
* 根据地区信息查询用户id
*
* @param provinceCode
* @param cityCode
* @param districtCode
* @return
*/
@GetMapping("/userapp/user-account/feignListUserAccountIds")
List<Integer> feignListUserAccountIds(@RequestParam Integer provinceCode, @RequestParam(required = false) Integer cityCode,
@RequestParam(required = false) Integer districtCode, @RequestHeader(value = "token", required = false) String token);
/**
* 获取用户集合列表页面
*
* @param bUserAccountQO 问:b用户帐户
* @return {@link List}<{@link UserAccountSimpleDTO}>
*/
@PostMapping("/userapp/back-user/feignListBAccountPage")
List<UserAccountSimpleDTO> feignListBAccountPage(@ApiParam(value = "账号查询QO", required = true) @RequestBody BUserAccountQO bUserAccountQO, @RequestHeader("token") String token);
}
package com.mmc.pms.feign.config;
import com.mmc.pms.feign.hystrix.UserAppApiHystrix;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
/**
* @author: zj
* @Date: 2023/5/18 18:21
*/
@ComponentScan(basePackages = "com.mmc.pms.feign")
@Configuration
public class FeignConfiguration {
@Bean(name = "userAppApiHystrix")
public UserAppApiHystrix userAppApi() {
return new UserAppApiHystrix();
}
}
package com.mmc.pms.feign.hystrix;
import com.mmc.pms.auth.dto.BUserAccountQO;
import com.mmc.pms.auth.dto.UserAccountSimpleDTO;
import com.mmc.pms.feign.UserAppApi;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
/**
* @author: zj
* @Date: 2023/5/18 17:08
*/
@Slf4j
public class UserAppApiHystrix implements UserAppApi {
@Override
public UserAccountSimpleDTO feignGetUserSimpleInfo(Integer userAccountId, String token) {
log.error("熔断:feignGetUserSimpleInfo:{}", userAccountId);
return null;
}
@Override
public List<Integer> feignListUserAccountIds(Integer provinceCode, Integer cityCode, Integer districtCode, String token) {
log.error("熔断:feignListUserAccountIds:{}, {}, {}", provinceCode, cityCode, districtCode);
return null;
}
@Override
public List<UserAccountSimpleDTO> feignListBAccountPage(BUserAccountQO bUserAccountQO, String token) {
log.error("熔断:feignListBAccountPage:{}", bUserAccountQO);
return null;
}
}
/**
* Copyright 2023 bejson.com
*/
package com.mmc.pms.model.categories.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* Auto-generated: 2023-06-08 16:2:43
*
* @author 23214
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class AllCategoryDTO implements Serializable {
private static final long serialVersionUID = 1171841063641249397L;
private Integer directoryId;
private String name;
private List<CategoriesInfoListDTO> categoriesInfoListDTO;
}
\ No newline at end of file
/** Copyright 2023 bejson.com */
package com.mmc.pms.model.categories.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* Auto-generated: 2023-06-08 16:2:43
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class CategoriesInfoListDTO implements Serializable {
private static final long serialVersionUID = -8381856228953745772L;
private Integer id;
private Integer directoryId;
private String name;
private String icon;
}
package com.mmc.pms.model.categories.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @Author LW
*
* @date 2023/6/10 13:46 概要:
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class CategoryTypeDTO implements Serializable {
private Integer id;
private String categoryName;
}
...@@ -6,11 +6,12 @@ import lombok.Builder; ...@@ -6,11 +6,12 @@ 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
...@@ -19,12 +20,13 @@ import lombok.NoArgsConstructor; ...@@ -19,12 +20,13 @@ import lombok.NoArgsConstructor;
public class DirectoryInfoVO { public class DirectoryInfoVO {
@ApiModelProperty(value = "目录id") @ApiModelProperty(value = "目录id")
private Integer id; private Integer id;
@ApiModelProperty(value = "目录名称") @ApiModelProperty(value = "目录名称")
private String directoryName; private String directoryName;
@ApiModelProperty(value = "关联目录的id")
private Integer pid;
@ApiModelProperty(value = "关联目录名称")
private String relevanceName;
@ApiModelProperty(value = "分类模块:(0:通用分类 1:作业服务分类 2:设备分类 3:飞手分类 4:商城分类)") @ApiModelProperty(value = "分类模块:(0:通用分类 1:作业服务分类 2:设备分类 3:飞手分类 4:商城分类)")
private Integer type; 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
...@@ -33,22 +33,32 @@ public class ServiceQO implements Serializable { ...@@ -33,22 +33,32 @@ public class ServiceQO implements Serializable {
@Length(message = "最大不超过30字", max = 30) @Length(message = "最大不超过30字", max = 30)
private String serviceName; private String serviceName;
@ApiModelProperty(value = "应用", example = "1") @ApiModelProperty(value = "分类id集合(应用/行业等)")
private List<Integer> categoryId;
@ApiModelProperty(value = "应用id")
private Integer applicationId; private Integer applicationId;
@ApiModelProperty(value = "行业", example = "2") @ApiModelProperty(value = "行业id")
private Integer industryId; private Integer industryId;
@ApiModelProperty(value = "账号id") @ApiModelProperty(value = "省份编码", example = "440000")
private Integer accountId; private Integer provinceId;
@ApiModelProperty(value = "展示状态")
private Integer displayState;
@ApiModelProperty(value = "页码", required = true) @ApiModelProperty(value = "页码", required = true)
@NotNull(message = "页码不能为空", groups = {Page.class, Freeze.class}) @NotNull(
message = "页码不能为空",
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) @ApiModelProperty(value = "每页显示数", required = true)
@NotNull(message = "每页显示数不能为空", groups = {Page.class, Freeze.class}) @NotNull(
message = "每页显示数不能为空",
groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class) @Min(value = 1, groups = Page.class)
private Integer pageSize; private Integer 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,12 +7,13 @@ import lombok.NoArgsConstructor; ...@@ -7,12 +7,13 @@ 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
...@@ -20,30 +21,49 @@ import java.util.List; ...@@ -20,30 +21,49 @@ import java.util.List;
@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") @ApiModelProperty(value = "id")
private Integer id; private Integer id;
@ApiModelProperty(value = "商品图片") @ApiModelProperty(value = "商品图片")
private List<GoodsImgDTO> images; private List<GoodsImgDTO> images;
@ApiModelProperty(value = "商品视频") @ApiModelProperty(value = "商品视频")
private String goodsVideo; private String goodsVideo;
@ApiModelProperty(value = "商品视频id") @ApiModelProperty(value = "商品视频id")
private Integer goodsVideoId; private Integer goodsVideoId;
@ApiModelProperty(value = "商品名称") @ApiModelProperty(value = "商品名称")
private String goodsName; private String goodsName;
@ApiModelProperty(value = "商品编号")
private String goodsNo;
@ApiModelProperty(value = "商品详情") @ApiModelProperty(value = "商品详情")
private GoodsDetailInfoDTO goodsDetail; private GoodsDetailInfoDTO goodsDetail;
@ApiModelProperty(value = "所属目录") @ApiModelProperty(value = "所属目录")
private Integer directoryId; private Integer directoryId;
@ApiModelProperty(value = "一级分类id") @ApiModelProperty(value = "一级分类id")
private Integer categoryByOne; private Integer categoryByOne;
@ApiModelProperty(value = "二级分类id") @ApiModelProperty(value = "二级分类id")
private Integer categoryByTwo; private Integer categoryByTwo;
@ApiModelProperty(value = "商品标签") @ApiModelProperty(value = "商品标签")
private String tag; private String tag;
@ApiModelProperty(value = "商品状态 0:下架 1:上架") @ApiModelProperty(value = "商品状态 0:下架 1:上架")
private Integer shelfStatus; private Integer shelfStatus;
@ApiModelProperty(value = "规格信息") @ApiModelProperty(value = "规格信息")
private List<GoodsSpecDTO> goodsSpec; private List<GoodsSpecDTO> goodsSpec;
@ApiModelProperty(value = "其他服务: 1:免费配送,2:专业飞手培训2日, 3:半年保修, 4:一年保修 ") @ApiModelProperty(value = "其他服务: 1:免费配送,2:专业飞手培训2日, 3:半年保修, 4:一年保修 ")
private List<GoodsOtherServiceDTO> otherService; 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
...@@ -41,4 +42,7 @@ public class ProductSpecDTO implements Serializable { ...@@ -41,4 +42,7 @@ public class ProductSpecDTO implements Serializable {
@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(
message = "所属目录id不能为空",
groups = {Update.class, Create.class})
private Integer directoryId; private Integer directoryId;
@ApiModelProperty(value = "分类所属模块id(0:通用分类 1:作业服务分类 2:设备租赁分类 3:飞手培训分类 4:产品商城分类)")
private Integer type;
@ApiModelProperty(value = "页码", required = true) @ApiModelProperty(value = "页码", required = true)
@NotNull(message = "页码不能为空", groups = {Page.class, Freeze.class}) @NotNull(
message = "页码不能为空",
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) @ApiModelProperty(value = "每页显示数", required = true)
@NotNull(message = "每页显示数不能为空", groups = {Page.class, Freeze.class}) @NotNull(
message = "每页显示数不能为空",
groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class) @Min(value = 1, groups = Page.class)
private Integer pageSize; private Integer pageSize;
public void buildCurrentPage() { public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize; this.pageNo = (pageNo - 1) * pageSize;
} }
} }
...@@ -18,4 +18,6 @@ public class SpecPriceVO implements Serializable { ...@@ -18,4 +18,6 @@ public class SpecPriceVO implements Serializable {
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
...@@ -26,11 +26,15 @@ public class ServiceVO implements Serializable { ...@@ -26,11 +26,15 @@ public class ServiceVO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@NotNull(message = "修改服务id不能为空", groups = {Update.class}) @NotNull(
message = "修改服务id不能为空",
groups = {Update.class})
private Integer id; private Integer id;
@ApiModelProperty(value = "服务名称", example = "服务名称") @ApiModelProperty(value = "服务名称", example = "服务名称")
@NotBlank(message = "服务名称不能为空", groups = {Create.class, Update.class}) @NotBlank(
message = "服务名称不能为空",
groups = {Create.class})
@Length(message = "最大不超过30字", max = 30) @Length(message = "最大不超过30字", max = 30)
private String serviceName; private String serviceName;
...@@ -38,15 +42,21 @@ public class ServiceVO implements Serializable { ...@@ -38,15 +42,21 @@ public class ServiceVO implements Serializable {
private Integer applicationId; private Integer applicationId;
@ApiModelProperty(value = "行业", example = "2") @ApiModelProperty(value = "行业", example = "2")
@NotNull(message = "行业id不能为空", groups = {Create.class, Update.class}) @NotNull(
message = "行业id不能为空",
groups = {Create.class})
private Integer industryId; private Integer industryId;
@ApiModelProperty(value = "展示状态,0为上架,1下架", example = "0") @ApiModelProperty(value = "展示状态,0为上架,1下架", example = "0")
@NotNull(message = "展示状态不能为空", groups = {Create.class, Update.class}) @NotNull(
message = "展示状态不能为空",
groups = {Create.class})
private Integer displayState; private Integer displayState;
@ApiModelProperty(value = "封面图") @ApiModelProperty(value = "封面图")
@NotBlank(message = "封面图不能为空", groups = {Create.class, Update.class}) @NotBlank(
message = "封面图不能为空",
groups = {Create.class})
private String coverPlan; private String coverPlan;
@ApiModelProperty(value = "分享卡片") @ApiModelProperty(value = "分享卡片")
......
package com.mmc.pms.model.work.vo;
import com.mmc.pms.model.group.Update;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class UpAndDownServiceVO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id集合")
@Size(min = 1,message = "修改时id集合不能为空",groups = Update.class)
private List<Integer> ids;
@ApiModelProperty(value = "展示状态,0为上架,1下架", example = "0")
@NotNull(message = "修改时展示状态不能为空",groups = Update.class)
private Integer displayState;
}
package com.mmc.pms.page;
/**
* @Author small @Date 2023/5/16 10:09 @Version 1.0
*/
public interface Page {}
package com.mmc.pms.service; 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 updateById(ServiceVO param);
ResultBody deleteById(Integer id); ResultBody deleteByIds(List<Integer> ids);
ResultBody<ServiceDTO> queryById(Integer id);
PageResult queryServiceManagerList(ServiceQO param, Integer userAccountId);
PageResult queryWorkServiceList(ServiceQO param, HttpServletRequest request);
ResultBody queryById(Integer id); List<ServiceDTO> feignQueryWorkServiceListById(List<Integer> ids);
PageResult queryWorkServiceList(ServiceQO param, Integer userAccountId); ResultBody batchUpAndDownWorkService(UpAndDownServiceVO param);
} }
...@@ -4,13 +4,14 @@ import com.mmc.pms.common.ResultBody; ...@@ -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;
...@@ -23,10 +25,12 @@ public interface GoodsInfoService { ...@@ -23,10 +25,12 @@ public interface GoodsInfoService {
ResultBody editGoodsInfo(GoodsAddVO goodsAddVO); ResultBody editGoodsInfo(GoodsAddVO goodsAddVO);
ResultBody getGoodsInfoDetail(Integer goodsInfoId); ResultBody getGoodsInfoDetail(Integer goodsInfoId, Integer type, Integer leaseTerm);
ResultBody getSkuUnit(); ResultBody getSkuUnit();
ResultBody getSaleServiceInfoToList();
List<MallGoodsShopCarDTO> fillGoodsInfo(List<MallGoodsShopCarDTO> param); List<MallGoodsShopCarDTO> fillGoodsInfo(List<MallGoodsShopCarDTO> param);
List<MallProductSpecPriceDTO> feignListProductSpecPrice(ProductSpecPriceQO productSpecPriceQO); List<MallProductSpecPriceDTO> feignListProductSpecPrice(ProductSpecPriceQO productSpecPriceQO);
...@@ -36,4 +40,10 @@ public interface GoodsInfoService { ...@@ -36,4 +40,10 @@ public interface GoodsInfoService {
List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO); List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO);
List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO); List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO);
PageResult listPageGoodsInfo(MallGoodsQO param);
ResultBody batchOnShelfOrTakeDown(List<Integer> goodsIds, Integer status);
ResultBody batchRemoveWareInfo(List<Integer> ids);
} }
package com.mmc.pms.service.Impl; 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;
@Autowired private UserAppApi userAppApi;
@Autowired private InspComtService inspComtService;
@Autowired private RedisTemplate redisTemplate;
@Override @Override
public ResultBody addWorkService(ServiceVO param, Integer userAccountId) { public ResultBody addWorkService(ServiceVO param, Integer userAccountId) {
...@@ -48,25 +66,32 @@ public class BackstageTaskServiceImpl implements BackstageTaskService { ...@@ -48,25 +66,32 @@ public class BackstageTaskServiceImpl implements BackstageTaskService {
} }
@Override @Override
public ResultBody deleteById(Integer id) { public ResultBody deleteByIds(List<Integer> ids) {
backstageTaskServiceDao.deleteById(id); if(!CollectionUtils.isEmpty(ids)){
backstageTaskServiceDao.deleteByIds(ids);
}
return ResultBody.success(); return ResultBody.success();
} }
@Override @Override
public ResultBody queryById(Integer id) { public ResultBody<ServiceDTO> queryById(Integer id) {
ServiceDO serviceDO = backstageTaskServiceDao.queryById(id); ServiceDO serviceDO = backstageTaskServiceDao.queryById(id);
ServiceDTO serviceDTO = new ServiceDTO(serviceDO); ServiceDTO serviceDTO = new ServiceDTO(serviceDO);
Map<Integer, String> categoriesNameMap = getCategoriesNameByIds(Arrays.asList(serviceDTO.getApplicationId(),serviceDTO.getIndustryId())); Map<Integer, String> categoriesNameMap =
if(!CollectionUtils.isEmpty(categoriesNameMap)){ getCategoriesNameByIds(
Arrays.asList(serviceDTO.getApplicationId(), serviceDTO.getIndustryId()));
if (!CollectionUtils.isEmpty(categoriesNameMap)) {
serviceDTO.setApplicationName(categoriesNameMap.get(serviceDTO.getApplicationId())); serviceDTO.setApplicationName(categoriesNameMap.get(serviceDTO.getApplicationId()));
serviceDTO.setIndustryName(categoriesNameMap.get(serviceDTO.getIndustryId())); serviceDTO.setIndustryName(categoriesNameMap.get(serviceDTO.getIndustryId()));
} }
List<InspComtDO> inspComtList = RandomGetInspComt(id);
serviceDTO.setInspComtList(inspComtList);
serviceDTO.setInspComtAmount(inspComtList.size());
return ResultBody.success(serviceDTO); return ResultBody.success(serviceDTO);
} }
private Map<Integer,String> getCategoriesNameByIds(List<Integer> ids){ private Map<Integer, String> getCategoriesNameByIds(List<Integer> ids) {
if(CollectionUtils.isEmpty(ids)){ if (CollectionUtils.isEmpty(ids)) {
return new HashMap<>(); return new HashMap<>();
} }
Set<Integer> idSet = new HashSet<>(); Set<Integer> idSet = new HashSet<>();
...@@ -74,33 +99,114 @@ public class BackstageTaskServiceImpl implements BackstageTaskService { ...@@ -74,33 +99,114 @@ public class BackstageTaskServiceImpl implements BackstageTaskService {
idSet.add(id); idSet.add(id);
} }
List<Categories> categories = categoriesDao.getCategoriesListByIds(idSet); List<Categories> categories = categoriesDao.getCategoriesListByIds(idSet);
if(CollectionUtils.isEmpty(categories)){ if (CollectionUtils.isEmpty(categories)) {
return new HashMap<>(); return new HashMap<>();
} }
return categories.stream().collect(Collectors.toMap(Categories::getId, d -> d.getName(), (k1, k2) -> k1)); return categories.stream()
.collect(Collectors.toMap(Categories::getId, d -> d.getName(), (k1, k2) -> k1));
} }
@Override @Override
public PageResult queryWorkServiceList(ServiceQO param, Integer userAccountId) { public PageResult queryServiceManagerList(ServiceQO param, Integer userAccountId) {
int count = backstageTaskServiceDao.count(param); int count = backstageTaskServiceDao.count(param);
if(count == 0){ if (count == 0) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(),count); return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
} }
Integer pageNo = param.getPageNo(); Integer pageNo = param.getPageNo();
param.buildCurrentPage(); param.buildCurrentPage();
List<ServiceDO> services = backstageTaskServiceDao.queryAllByLimit(param); 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<>(); List<Integer> list = new ArrayList<>();
for (ServiceDO service : services) { for (ServiceDO service : services) {
list.add(service.getApplicationId()); list.add(service.getApplicationId());
list.add(service.getIndustryId()); list.add(service.getIndustryId());
} }
Map<Integer, String> categoriesNameMap = getCategoriesNameByIds(list); Map<Integer, String> categoriesNameMap = getCategoriesNameByIds(list);
List<ServiceDTO> pageList = services.stream().map(d->{ List<ServiceDTO> pageList =
services.stream()
.map(
d -> {
ServiceDTO serviceDTO = new ServiceDTO(d); ServiceDTO serviceDTO = new ServiceDTO(d);
serviceDTO.setApplicationName(categoriesNameMap.get(d.getApplicationId())); serviceDTO.setApplicationName(categoriesNameMap.get(d.getApplicationId()));
serviceDTO.setIndustryName(categoriesNameMap.get(d.getIndustryId())); serviceDTO.setIndustryName(categoriesNameMap.get(d.getIndustryId()));
return serviceDTO; return serviceDTO;
}).collect(Collectors.toList()); })
return PageResult.buildPage(pageNo, param.getPageSize(),count,pageList); .collect(Collectors.toList());
return pageList;
}
@Override
public PageResult queryWorkServiceList(ServiceQO param, HttpServletRequest request) {
log.info(
"开始queryWorkServiceList==>{}",
JSONObject.toJSONString(DateFormatUtils.format(new Date(), DateConstant.YYYYMMDDHHMMSS)));
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<Integer> userIds = null;
Integer provinceCode = param.getProvinceId();
if(provinceCode!=null){
userIds = userAppApi.feignListUserAccountIds(provinceCode, null, null, null);
if(userIds==null || userIds.size()==0){
userIds = Arrays.asList(-1);
}
}
List<Integer> categoriesIds = param.getCategoryId();
int count = backstageTaskServiceDao.conditionCount(param,categoriesIds,userIds);
if (count == 0) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
}
List<ServiceDO> pageList = backstageTaskServiceDao.queryPageByLimit(param,categoriesIds,userIds);
List<WorkServiceDTO> workServiceDTOList = getWorkServiceDTOS(pageList);
log.info(
"结束queryWorkServiceList==>{}",
JSONObject.toJSONString(DateFormatUtils.format(new Date(), DateConstant.YYYYMMDDHHMMSS)));
return PageResult.buildPage(pageNo, param.getPageSize(), count, workServiceDTOList);
}
@Override
public List<ServiceDTO> feignQueryWorkServiceListById(List<Integer> ids) {
return backstageTaskServiceDao.QueryWorkServiceListById(ids);
}
@Override
public ResultBody batchUpAndDownWorkService(UpAndDownServiceVO param) {
if(!CollectionUtils.isEmpty(param.getIds())){
backstageTaskServiceDao.batchUpAndDownWorkService(param);
}
return ResultBody.success();
}
private List<WorkServiceDTO> getWorkServiceDTOS(List<ServiceDO> pageList) {
// 用户暂时无关联公司数据,先用假数据展示
String companyName = "浙江科比特创新科技有限公司";
List<WorkServiceDTO> workServiceDTOList = new ArrayList<>();
for (ServiceDO item : pageList) {
WorkServiceDTO workServiceDTO = WorkServiceDTO.builder().id(item.getId()).serviceName(item.getServiceName()).companyName(companyName)
.coverPlan(item.getCoverPlan()).serviceIntroduction(item.getServiceIntroduction()).video(item.getVideo()).shareCard(item.getShareCard()).build();
workServiceDTOList.add(workServiceDTO);
}
return workServiceDTOList;
}
/**
* 根据id随机获取50条以上的评论
*/
private List<InspComtDO> RandomGetInspComt(Integer id) {
String listStr = (String) redisTemplate.opsForValue().get(id);
List<InspComtDO> inspComtRandomList = null;
if(StringUtils.isNotBlank(listStr)){
inspComtRandomList = JSONArray.parseArray(listStr, InspComtDO.class);
}else {
inspComtRandomList = inspComtService.randomGetInspComtList(RandomUtils.nextInt(50, 9999));
String toJSONString = JSONObject.toJSONString(inspComtRandomList);
redisTemplate.opsForValue().set(id, toJSONString, 2L, TimeUnit.DAYS);
}
return inspComtRandomList;
} }
} }
package com.mmc.pms.service.Impl; 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,12 +36,9 @@ import java.util.stream.Collectors; ...@@ -35,12 +36,9 @@ 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
private DirectoryDao directoryDao;
@Override @Override
public ResultBody addOrEditDirectory(DirectoryInfoVO param) { public ResultBody addOrEditDirectory(DirectoryInfoVO param) {
...@@ -52,9 +50,10 @@ public class CategoriesServiceImpl implements CategoriesService { ...@@ -52,9 +50,10 @@ public class CategoriesServiceImpl implements CategoriesService {
if (param.getId() == null) { if (param.getId() == null) {
categoriesDao.insertDirectory(directory); categoriesDao.insertDirectory(directory);
} else { } else {
int count = categoriesDao.selectDirectoryById(param.getId()); // 获取默认目录信息
if (count > 0) { DirectoryDO directoryDO = categoriesDao.selectDirectoryById(param.getId());
return ResultBody.error("默认目录不可修改!"); if (directoryDO != null && !directoryDO.getDirectoryName().equals(param.getDirectoryName())) {
return ResultBody.error(ResultEnum.DEFAULT_DIRECTORY);
} }
categoriesDao.updateDirectory(directory); categoriesDao.updateDirectory(directory);
} }
...@@ -67,8 +66,10 @@ public class CategoriesServiceImpl implements CategoriesService { ...@@ -67,8 +66,10 @@ public class CategoriesServiceImpl implements CategoriesService {
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<DirectoryDO> directoryList =
List<DirectoryInfoVO> list = directoryList.stream().map(DirectoryDO::buildDirectoryInfoVO).collect(Collectors.toList()); 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); return PageResult.buildPage(pageNo, pageSize, count, list);
} }
...@@ -79,6 +80,10 @@ public class CategoriesServiceImpl implements CategoriesService { ...@@ -79,6 +80,10 @@ public class CategoriesServiceImpl implements CategoriesService {
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);
} }
DirectoryDO defaultCount = categoriesDao.selectDirectoryById(id);
if (defaultCount != null) {
return ResultBody.error(ResultEnum.DEFAULT_DIRECTORY);
}
categoriesDao.removeDirectory(id); categoriesDao.removeDirectory(id);
return ResultBody.success(); return ResultBody.success();
} }
...@@ -142,13 +147,15 @@ public class CategoriesServiceImpl implements CategoriesService { ...@@ -142,13 +147,15 @@ public class CategoriesServiceImpl implements CategoriesService {
public PageResult getClassificationList(QueryClassifyVO queryClassifyVO) { public PageResult getClassificationList(QueryClassifyVO queryClassifyVO) {
int count = categoriesDao.countListClassification(queryClassifyVO); int count = categoriesDao.countListClassification(queryClassifyVO);
if (count == 0) { if (count == 0) {
return PageResult.buildPage(queryClassifyVO.getPageNo(), queryClassifyVO.getPageSize(), count); 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<>();
...@@ -173,8 +180,7 @@ public class CategoriesServiceImpl implements CategoriesService { ...@@ -173,8 +180,7 @@ public class CategoriesServiceImpl implements CategoriesService {
@Override @Override
public ResultBody getClassifyDetails(Integer id) { public ResultBody getClassifyDetails(Integer id) {
Categories goodsGroup = categoriesDao.getGoodsGroupById(id); Categories goodsGroup = categoriesDao.getGoodsGroupById(id);
return ResultBody.success(goodsGroup == null ? null : goodsGroup.buildClassifyDetailsDTO() return ResultBody.success(goodsGroup == null ? null : goodsGroup.buildClassifyDetailsDTO());
);
} }
@Override @Override
...@@ -184,7 +190,10 @@ public class CategoriesServiceImpl implements CategoriesService { ...@@ -184,7 +190,10 @@ public class CategoriesServiceImpl implements CategoriesService {
case 0: case 0:
List<GoodsInfo> goodsInfo = goodsInfoDao.ListGoodsInfoByCategoryId(id); List<GoodsInfo> goodsInfo = goodsInfoDao.ListGoodsInfoByCategoryId(id);
if (CollectionUtils.isNotEmpty(goodsInfo)) { if (CollectionUtils.isNotEmpty(goodsInfo)) {
relevantBusinessVO.setRelevanceGoodsInfoVOs(goodsInfo.stream().map(GoodsInfo::buildRelevanceGoodsInfoVO).collect(Collectors.toList())); relevantBusinessVO.setRelevanceGoodsInfoVOs(
goodsInfo.stream()
.map(GoodsInfo::buildRelevanceGoodsInfoVO)
.collect(Collectors.toList()));
return ResultBody.success(relevantBusinessVO); return ResultBody.success(relevantBusinessVO);
} }
break; break;
...@@ -197,7 +206,8 @@ public class CategoriesServiceImpl implements CategoriesService { ...@@ -197,7 +206,8 @@ public class CategoriesServiceImpl implements CategoriesService {
@Override @Override
public ResultBody getDirectoryList(Integer type) { public ResultBody getDirectoryList(Integer type) {
List<DirectoryDO> directoryList = categoriesDao.getDirectoryList(type); List<DirectoryDO> directoryList = categoriesDao.getDirectoryList(type);
List<DirectoryInfoVO> list = directoryList.stream().map(DirectoryDO::buildDirectoryInfoVO).collect(Collectors.toList()); List<DirectoryInfoVO> list =
directoryList.stream().map(DirectoryDO::buildDirectoryInfoVO).collect(Collectors.toList());
return ResultBody.success(list); return ResultBody.success(list);
} }
...@@ -211,31 +221,93 @@ public class CategoriesServiceImpl implements CategoriesService { ...@@ -211,31 +221,93 @@ public class CategoriesServiceImpl implements CategoriesService {
@Override @Override
public ResultBody getApplicationList(String directoryName) { public ResultBody getApplicationList(String directoryName) {
List<Categories> categories = getCategoriesListByDirectoryName(directoryName); List<Categories> categories = getCategoriesListByDirectoryName(directoryName);
if(org.springframework.util.CollectionUtils.isEmpty(categories)){ if (org.springframework.util.CollectionUtils.isEmpty(categories)) {
return ResultBody.success(); return ResultBody.success();
} }
List<CategoriesDTO> collect = categories.stream().map(CategoriesDTO::new).collect(Collectors.toList()); List<CategoriesDTO> collect =
categories.stream().map(CategoriesDTO::new).collect(Collectors.toList());
return ResultBody.success(collect); return ResultBody.success(collect);
} }
@Override @Override
public List<Categories> getCategoriesListByIds(Set<Integer> ids) { public List<Categories> getCategoriesListByIds(Set<Integer> ids) {
if(CollectionUtils.isEmpty(ids)){ if (CollectionUtils.isEmpty(ids)) {
return null; return null;
} }
return categoriesDao.getCategoriesListByIds(ids); 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 @Override
public ResultBody deleteRelevantBusiness(Integer id) { public ResultBody deleteRelevantBusiness(Integer id) {
int count = categoriesDao.deleteById(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(); 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,17 +34,13 @@ import java.util.stream.Collectors; ...@@ -32,17 +34,13 @@ 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)
...@@ -58,7 +56,8 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -58,7 +56,8 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
String YYYY_MM_DD_HH_MM_SS = "yyyyMMddHHmmss"; String YYYY_MM_DD_HH_MM_SS = "yyyyMMddHHmmss";
// 初始化商品对象,并构建对象 // 初始化商品对象,并构建对象
GoodsInfo goodsInfo = new GoodsInfo(goodsAddVO); GoodsInfo goodsInfo = new GoodsInfo(goodsAddVO);
goodsInfo.setGoodsNo("IUAV" + TDateUtil.getDateStr(new Date(), YYYY_MM_DD_HH_MM_SS) + CodeUtil.getRandomNum(4)); goodsInfo.setGoodsNo(
"IUAV" + TDateUtil.getDateStr(new Date(), YYYY_MM_DD_HH_MM_SS) + CodeUtil.getRandomNum(4));
// 暂未接入用户默认传1 // 暂未接入用户默认传1
goodsInfo.setAddGoodsUserId(1); goodsInfo.setAddGoodsUserId(1);
goodsInfo.setSort(goodsInfoDao.countGoodsInfo() + 1); goodsInfo.setSort(goodsInfoDao.countGoodsInfo() + 1);
...@@ -82,18 +81,18 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -82,18 +81,18 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
return ResultBody.success(); return ResultBody.success();
} }
/** /** 插入行业sku及规格信息 */
* 插入行业sku及规格信息
*/
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void industrySkuSpecOperation(GoodsInfo goodsInfo, List<GoodsProdSpecVO> productSpec) { public void industrySkuSpecOperation(GoodsInfo goodsInfo, List<GoodsProdSpecVO> productSpec) {
for (GoodsProdSpecVO goodsSpecVO : productSpec) { for (GoodsProdSpecVO goodsSpecVO : productSpec) {
MallIndustrySkuInfoDO mallIndustrySkuInfoDO = new MallIndustrySkuInfoDO(goodsSpecVO).setGoodsInfoId(goodsInfo.getId()); MallIndustrySkuInfoDO mallIndustrySkuInfoDO =
new MallIndustrySkuInfoDO(goodsSpecVO).setGoodsInfoId(goodsInfo.getId());
// 插入数据库商品对应的sku信息 // 插入数据库商品对应的sku信息
goodsInfoDao.insertMallIndustrySkuInfo(mallIndustrySkuInfoDO); goodsInfoDao.insertMallIndustrySkuInfo(mallIndustrySkuInfoDO);
for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) { for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) {
// 构建商品对应的规格信息 // 构建商品对应的规格信息
MallIndustrySkuInfoSpecDO mallIndustrySkuInfoSpecDO = new MallIndustrySkuInfoSpecDO() MallIndustrySkuInfoSpecDO mallIndustrySkuInfoSpecDO =
new MallIndustrySkuInfoSpecDO()
.setIndustrySpecId(mallProductSpecVO.getMallSpecId()) .setIndustrySpecId(mallProductSpecVO.getMallSpecId())
.setMallIndustrySkuInfoId(mallIndustrySkuInfoDO.getId()) .setMallIndustrySkuInfoId(mallIndustrySkuInfoDO.getId())
.setGoodsInfoId(goodsInfo.getId()); .setGoodsInfoId(goodsInfo.getId());
...@@ -106,20 +105,25 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -106,20 +105,25 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void productSkuSpecOperation(GoodsInfo goodsInfo, List<GoodsProdSpecVO> productSpec) { public void productSkuSpecOperation(GoodsInfo goodsInfo, List<GoodsProdSpecVO> productSpec) {
// 遍历规格信息,获取其中自定义的规格信息 // 遍历规格信息,获取其中自定义的规格信息
List<GoodsProdSpecVO> customGoodsSpecList = productSpec.stream().filter(spec -> spec.getFlag().equals(1)).collect(Collectors.toList()); List<GoodsProdSpecVO> customGoodsSpecList =
productSpec.stream().filter(spec -> spec.getFlag().equals(1)).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(customGoodsSpecList)) { if (CollectionUtils.isNotEmpty(customGoodsSpecList)) {
addCustomization(goodsInfo, customGoodsSpecList); addCustomization(goodsInfo, customGoodsSpecList);
} }
// 遍历规格信息,获取其中非自定义的规格信息 // 遍历规格信息,获取其中非自定义的规格信息
List<GoodsProdSpecVO> goodsSpecList = productSpec.stream().filter(spec -> spec.getFlag().equals(0)).collect(Collectors.toList()); List<GoodsProdSpecVO> goodsSpecList =
productSpec.stream().filter(spec -> spec.getFlag().equals(0)).collect(Collectors.toList());
for (GoodsProdSpecVO goodsSpecVO : goodsSpecList) { for (GoodsProdSpecVO goodsSpecVO : goodsSpecList) {
MallProdInfoDO mallProdSkuInfoDO = new MallProdInfoDO(goodsSpecVO) MallProdInfoDO mallProdSkuInfoDO =
.setProdSkuId(goodsSpecVO.getSkuId()).setGoodsInfoId(goodsInfo.getId()); new MallProdInfoDO(goodsSpecVO)
.setProdSkuId(goodsSpecVO.getSkuId())
.setGoodsInfoId(goodsInfo.getId());
// 插入数据库商品对应的sku信息 // 插入数据库商品对应的sku信息
goodsInfoDao.insertMallProdSkuInfo(mallProdSkuInfoDO); goodsInfoDao.insertMallProdSkuInfo(mallProdSkuInfoDO);
for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) { for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) {
// 构建商品对应的规格信息 // 构建商品对应的规格信息
MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO = new MallProdSkuInfoSpecDO() MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO =
new MallProdSkuInfoSpecDO()
.setProductSpecId(mallProductSpecVO.getMallSpecId()) .setProductSpecId(mallProductSpecVO.getMallSpecId())
.setMallProdSkuInfoId(mallProdSkuInfoDO.getId()) .setMallProdSkuInfoId(mallProdSkuInfoDO.getId())
.setGoodsInfoId(goodsInfo.getId()); .setGoodsInfoId(goodsInfo.getId());
...@@ -130,7 +134,8 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -130,7 +134,8 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public MallProdInfoDO buildMallProdSkuInfo(GoodsInfo goodsInfo, GoodsProdSpecVO goodsSpec, Integer id) { public MallProdInfoDO buildMallProdSkuInfo(
GoodsInfo goodsInfo, GoodsProdSpecVO goodsSpec, Integer id) {
MallProdInfoDO mallProdInfoDO = new MallProdInfoDO(); MallProdInfoDO mallProdInfoDO = new MallProdInfoDO();
mallProdInfoDO.setGoodsInfoId(goodsInfo.getId()); mallProdInfoDO.setGoodsInfoId(goodsInfo.getId());
mallProdInfoDO.setProdSkuId(id); mallProdInfoDO.setProdSkuId(id);
...@@ -148,19 +153,29 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -148,19 +153,29 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
// 遍历自定义规格信息 // 遍历自定义规格信息
for (GoodsProdSpecVO productSpec : customGoodsSpecList) { for (GoodsProdSpecVO productSpec : customGoodsSpecList) {
// 构建商品对应的sku信息 // 构建商品对应的sku信息
ProductSkuDO productSkuDO = new ProductSkuDO().setCategoriesId(productSpec.getCategoryId()) ProductSkuDO productSkuDO =
.setProductName(productSpec.getProductName()).setCustomize(1) new ProductSkuDO()
.setCategoriesId(productSpec.getCategoryId())
.setProductName(productSpec.getProductName())
.setCustomize(1)
.setDirectoryId(goodsInfo.getDirectoryId()); .setDirectoryId(goodsInfo.getDirectoryId());
// 插入产品sku信息 // 插入产品sku信息
productDao.insertProductSku(productSkuDO); productDao.insertProductSku(productSkuDO);
MallProdInfoDO mallProdInfoDO = buildMallProdSkuInfo(goodsInfo, productSpec, productSkuDO.getId()); MallProdInfoDO mallProdInfoDO =
buildMallProdSkuInfo(goodsInfo, productSpec, productSkuDO.getId());
// 插入数据库商品对应的sku信息 // 插入数据库商品对应的sku信息
productDao.insertMallProdSkuInfo(mallProdInfoDO); productDao.insertMallProdSkuInfo(mallProdInfoDO);
// 先将自定的信息存储到数据库中 // 先将自定的信息存储到数据库中
productSpec.getCustomizeInfo().stream().peek(param -> { productSpec.getCustomizeInfo().stream()
ProductSpecDO productSpecDO = new ProductSpecDO().setProductSkuId(productSkuDO.getId()) .peek(
.setVersionDesc("自定义").setSpecImage(param.getSpecImage()) param -> {
.setSpecName(param.getSpecName()).setPartNo(param.getPartNo()); 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);
// 批量配置价格信息 // 批量配置价格信息
...@@ -170,25 +185,31 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -170,25 +185,31 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
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 =
otherService.stream()
.map(
d -> {
GoodsServiceDO goodsServiceDO = new GoodsServiceDO(); GoodsServiceDO goodsServiceDO = new GoodsServiceDO();
goodsServiceDO.setGoodsInfoId(goodsId); goodsServiceDO.setGoodsInfoId(goodsId);
goodsServiceDO.setSaleServiceId(d); goodsServiceDO.setSaleServiceId(d);
return goodsServiceDO; return goodsServiceDO;
}).collect(Collectors.toList()); })
.collect(Collectors.toList());
goodsInfoDao.insertGoodsService(otherList); goodsInfoDao.insertGoodsService(otherList);
} }
...@@ -201,16 +222,21 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -201,16 +222,21 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void addGoodsImageInfo(Integer goodsId, GoodsAddVO goodsAddVO) { public void addGoodsImageInfo(Integer goodsId, GoodsAddVO goodsAddVO) {
List<GoodsImgDO> list = goodsAddVO.getImages().stream().map(d -> { List<GoodsImgDO> list =
goodsAddVO.getImages().stream()
.map(
d -> {
GoodsImgDO goodsImgDO = new GoodsImgDO(d); GoodsImgDO goodsImgDO = new GoodsImgDO(d);
goodsImgDO.setGoodsInfoId(goodsId); goodsImgDO.setGoodsInfoId(goodsId);
return goodsImgDO; return goodsImgDO;
}).collect(Collectors.toList()); })
.collect(Collectors.toList());
// 插入图片信息 // 插入图片信息
goodsInfoDao.insertGoodsImgInfo(list); goodsInfoDao.insertGoodsImgInfo(list);
// 插入商品视频信息 // 插入商品视频信息
if (goodsAddVO.getGoodsVideo() != null) { if (goodsAddVO.getGoodsVideo() != null) {
GoodsVideoDO goodsVideoDO = new GoodsVideoDO().setGoodsInfoId(goodsId).setVideoUrl(goodsAddVO.getGoodsVideo()); GoodsVideoDO goodsVideoDO =
new GoodsVideoDO().setGoodsInfoId(goodsId).setVideoUrl(goodsAddVO.getGoodsVideo());
goodsInfoDao.insertVideoInfo(goodsVideoDO); goodsInfoDao.insertVideoInfo(goodsVideoDO);
} }
} }
...@@ -247,49 +273,92 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -247,49 +273,92 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
} 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 =
goodsAddVO.getProductSpec().stream()
.map(GoodsProdSpecVO::getId)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
// 从数据库获取该商品对应绑定的skuId的集合 // 从数据库获取该商品对应绑定的skuId的集合
List<MallIndustrySkuInfoDO> mallIndusSkuInfoList = goodsInfoDao.getMallIndustrySkuInfo(goodsAddVO.getId()); List<MallIndustrySkuInfoDO> mallIndusSkuInfoList =
List<Integer> dbMallSkuIds = mallIndusSkuInfoList.stream().map(MallIndustrySkuInfoDO::getId).collect(Collectors.toList()); goodsInfoDao.getMallIndustrySkuInfo(goodsAddVO.getId());
List<Integer> dbMallSkuIds =
mallIndusSkuInfoList.stream()
.map(MallIndustrySkuInfoDO::getId)
.collect(Collectors.toList());
// 对比数据库id如果不在就删除 // 对比数据库id如果不在就删除
List<Integer> delIds = dbMallSkuIds.stream().filter(id -> !inputMallSkuIds.contains(id)).collect(Collectors.toList()); List<Integer> delIds =
dbMallSkuIds.stream()
.filter(id -> !inputMallSkuIds.contains(id))
.collect(Collectors.toList());
if (delIds.size() != 0) { if (delIds.size() != 0) {
// 先删除商品绑定sku下的spec信息 // 先删除商品绑定sku下的spec信息
industrySpecDao.batchUpdateMallIndustrySpec(delIds, goodsAddVO.getId()); industrySpecDao.batchUpdateMallIndustrySpec(delIds, goodsAddVO.getId());
industrySpecDao.batchUpdateMallIndustrySku(delIds); industrySpecDao.batchUpdateMallIndustrySku(delIds);
} }
// 修改商品绑定的sku信息 // 修改商品绑定的sku信息
List<GoodsProdSpecVO> updateGoodsSpec = goodsAddVO.getProductSpec().stream().filter(Objects::nonNull).collect(Collectors.toList()); List<GoodsProdSpecVO> updateGoodsSpec =
List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList = updateGoodsSpec.stream().map(d -> { goodsAddVO.getProductSpec().stream().filter(Objects::nonNull).collect(Collectors.toList());
List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList =
updateGoodsSpec.stream()
.map(
d -> {
MallIndustrySkuInfoDO mallIndustrySkuInfoDO = new MallIndustrySkuInfoDO(); MallIndustrySkuInfoDO mallIndustrySkuInfoDO = new MallIndustrySkuInfoDO();
mallIndustrySkuInfoDO.setId(d.getId()).setIndustrySkuId(d.getSkuId()) mallIndustrySkuInfoDO
.setCategoriesId(d.getCategoryId()).setIndustrySkuSpecName(d.getGoodsSpecName()) .setId(d.getId())
.setChooseType(d.getChooseType()).setSkuUnitId(d.getSkuUnitId()).setMust(d.getMust()); .setIndustrySkuId(d.getSkuId())
.setCategoriesId(d.getCategoryId())
.setIndustrySkuSpecName(d.getGoodsSpecName())
.setChooseType(d.getChooseType())
.setSkuUnitId(d.getSkuUnitId())
.setMust(d.getMust());
return mallIndustrySkuInfoDO; return mallIndustrySkuInfoDO;
}).collect(Collectors.toList()); })
.collect(Collectors.toList());
// 批量修改sku的信息 // 批量修改sku的信息
industrySpecDao.batchUpdateMallIndustrySkuInfo(mallIndustrySkuInfoList); industrySpecDao.batchUpdateMallIndustrySkuInfo(mallIndustrySkuInfoList);
// 获取新的sku信息 // 获取新的sku信息
List<GoodsProdSpecVO> list = goodsAddVO.getProductSpec().stream().filter(d -> d.getId() == null).collect(Collectors.toList()); List<GoodsProdSpecVO> list =
goodsAddVO.getProductSpec().stream()
.filter(d -> d.getId() == null)
.collect(Collectors.toList());
industrySkuSpecOperation(new GoodsInfo(goodsAddVO.getId()), list); industrySkuSpecOperation(new GoodsInfo(goodsAddVO.getId()), list);
// 获取商品对应的skuId // 获取商品对应的skuId
List<Integer> mallSkuIds = goodsAddVO.getProductSpec().stream().map(GoodsProdSpecVO::getId).filter(Objects::nonNull).collect(Collectors.toList()); List<Integer> mallSkuIds =
goodsAddVO.getProductSpec().stream()
.map(GoodsProdSpecVO::getId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
// 根据这些id查出下面对应的规格信息 // 根据这些id查出下面对应的规格信息
List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpecList = industrySpecDao.listMallIndustrySpecInfo(mallSkuIds); List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpecList =
industrySpecDao.listMallIndustrySpecInfo(mallSkuIds);
// 分组 // 分组
Map<Integer, List<MallIndustrySkuInfoSpecDO>> dbSpecMap = mallIndustrySkuInfoSpecList.stream().collect(Collectors.groupingBy(MallIndustrySkuInfoSpecDO::getMallIndustrySkuInfoId)); Map<Integer, List<MallIndustrySkuInfoSpecDO>> dbSpecMap =
List<GoodsProdSpecVO> goodsSpecList = goodsAddVO.getProductSpec().stream().filter(d -> d.getId() != null).collect(Collectors.toList()); 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) { for (GoodsProdSpecVO goodsSpecVO : goodsSpecList) {
// 分组后的每一条商品绑定的规格信息 // 分组后的每一条商品绑定的规格信息
List<MallIndustrySkuInfoSpecDO> dbMallIndustrySkuSpecList = dbSpecMap.get(goodsSpecVO.getId()); List<MallIndustrySkuInfoSpecDO> dbMallIndustrySkuSpecList =
Set<Integer> inputMallSpecIds = goodsSpecVO.getSpecIds().stream().map(MallProductSpecVO::getId).filter(Objects::nonNull).collect(Collectors.toSet()); dbSpecMap.get(goodsSpecVO.getId());
List<Integer> delSpecId = dbMallIndustrySkuSpecList.stream().map(MallIndustrySkuInfoSpecDO::getId).filter(id -> !inputMallSpecIds.contains(id)).collect(Collectors.toList()); 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) { if (delSpecId.size() != 0) {
// 删除多余的spec信息 // 删除多余的spec信息
industrySpecDao.batchUpdateMallIndustSpec(delSpecId, goodsAddVO.getId()); industrySpecDao.batchUpdateMallIndustSpec(delSpecId, goodsAddVO.getId());
...@@ -297,7 +366,8 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -297,7 +366,8 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
// 新增spec的信息 // 新增spec的信息
for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) { for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) {
if (mallProductSpecVO.getId() == null) { if (mallProductSpecVO.getId() == null) {
MallIndustrySkuInfoSpecDO mallIndustrySkuInfoSpecDO = new MallIndustrySkuInfoSpecDO() MallIndustrySkuInfoSpecDO mallIndustrySkuInfoSpecDO =
new MallIndustrySkuInfoSpecDO()
.setIndustrySpecId(mallProductSpecVO.getMallSpecId()) .setIndustrySpecId(mallProductSpecVO.getMallSpecId())
.setMallIndustrySkuInfoId(goodsSpecVO.getId()) .setMallIndustrySkuInfoId(goodsSpecVO.getId())
.setGoodsInfoId(goodsAddVO.getId()); .setGoodsInfoId(goodsAddVO.getId());
...@@ -310,47 +380,85 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -310,47 +380,85 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateMallProductSkuSpec(GoodsAddVO goodsAddVO) { public void updateMallProductSkuSpec(GoodsAddVO goodsAddVO) {
GoodsInfo goodsInfo = new GoodsInfo(goodsAddVO);
// 1、普通的sku修改逻辑 // 1、普通的sku修改逻辑
List<GoodsProdSpecVO> specInfo = goodsAddVO.getProductSpec().stream().filter(spec -> !spec.getFlag().equals(1)).collect(Collectors.toList()); List<GoodsProdSpecVO> specInfo =
goodsAddVO.getProductSpec().stream()
.filter(spec -> !spec.getFlag().equals(1))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(specInfo)) { if (CollectionUtils.isNotEmpty(specInfo)) {
// 1.1先获取用户输入的商品绑定sku的id集合 // 1.1先获取用户输入的商品绑定sku的id集合
List<GoodsProdSpecVO> updateGoodsSpec = specInfo.stream().filter(d -> d.getId() != null).collect(Collectors.toList()); List<GoodsProdSpecVO> updateGoodsSpec =
List<Integer> inputMallSkuIds = updateGoodsSpec.stream().map(GoodsProdSpecVO::getId).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的集合 // 1.2从数据库获取该商品对应绑定的skuId的集合
List<MallProdInfoDO> mallProSkuInfoList = goodsInfoDao.getMallProSkuInfo(goodsAddVO.getId()); List<MallProdInfoDO> mallProSkuInfoList = goodsInfoDao.getMallProSkuInfo(goodsAddVO.getId());
List<Integer> dbMallSkuIds = mallProSkuInfoList.stream().map(MallProdInfoDO::getId).collect(Collectors.toList()); List<Integer> dbMallSkuIds =
mallProSkuInfoList.stream().map(MallProdInfoDO::getId).collect(Collectors.toList());
// 对比数据库id如果不在就删除 // 对比数据库id如果不在就删除
List<Integer> delIds = dbMallSkuIds.stream().filter(id -> !inputMallSkuIds.contains(id)).collect(Collectors.toList()); List<Integer> delIds =
dbMallSkuIds.stream()
.filter(id -> !inputMallSkuIds.contains(id))
.collect(Collectors.toList());
if (delIds.size() != 0) { if (delIds.size() != 0) {
// 先删除商品绑定sku下的spec信息 // 先删除商品绑定sku下的spec信息
goodsInfoDao.batchUpdateMallProSpec(delIds, goodsAddVO.getId()); goodsInfoDao.batchUpdateMallProSpec(delIds, goodsAddVO.getId());
goodsInfoDao.batchUpdateMallProductSku(delIds); goodsInfoDao.batchUpdateMallProductSku(delIds);
} }
// 修改商品绑定的sku信息 // 修改商品绑定的sku信息
List<MallProdInfoDO> mallProdSkuInfoList = updateGoodsSpec.stream().map(d -> { List<MallProdInfoDO> mallProdSkuInfoList =
updateGoodsSpec.stream()
.map(
d -> {
MallProdInfoDO mallProdInfoDO = new MallProdInfoDO(); MallProdInfoDO mallProdInfoDO = new MallProdInfoDO();
mallProdInfoDO.setId(d.getId()).setProdSkuId(d.getSkuId()) mallProdInfoDO
.setCategoriesId(d.getCategoryId()).setProdSkuSpecName(d.getGoodsSpecName()) .setId(d.getId())
.setChooseType(d.getChooseType()).setSkuUnitId(d.getSkuUnitId()).setMust(d.getMust()); .setProdSkuId(d.getSkuId())
.setCategoriesId(d.getCategoryId())
.setProdSkuSpecName(d.getGoodsSpecName())
.setChooseType(d.getChooseType())
.setSkuUnitId(d.getSkuUnitId())
.setMust(d.getMust());
return mallProdInfoDO; return mallProdInfoDO;
}).collect(Collectors.toList()); })
.collect(Collectors.toList());
// 1.3批量修改sku的信息 // 1.3批量修改sku的信息
goodsInfoDao.batchUpdateMallProdSkuInfo(mallProdSkuInfoList); for (MallProdInfoDO mallProdInfoDO : mallProdSkuInfoList) {
goodsInfoDao.updateMallProdSkuInfo(mallProdInfoDO);
}
// goodsInfoDao.batchUpdateMallProdSkuInfo(mallProdSkuInfoList);
// 1.4对新的sku进行操作 // 1.4对新的sku进行操作
List<GoodsProdSpecVO> list = specInfo.stream().filter(d -> d.getId() == null).collect(Collectors.toList()); List<GoodsProdSpecVO> list =
productSkuSpecOperation(new GoodsInfo(goodsAddVO.getId()), list); specInfo.stream().filter(d -> d.getId() == null).collect(Collectors.toList());
productSkuSpecOperation(goodsInfo, list);
// 获取商品对应的skuId // 获取商品对应的skuId
List<Integer> mallSkuIds = goodsAddVO.getProductSpec().stream().filter(d -> d.getId() != null).map(GoodsProdSpecVO::getId).collect(Collectors.toList()); List<Integer> mallSkuIds =
goodsAddVO.getProductSpec().stream()
.filter(d -> d.getId() != null)
.map(GoodsProdSpecVO::getId)
.collect(Collectors.toList());
if (mallSkuIds.size() > 0) { if (mallSkuIds.size() > 0) {
// 根据这些id查出下面对应的规格信息 // 根据这些id查出下面对应的规格信息
List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpecList = goodsInfoDao.listMallProdSpecInfo(mallSkuIds); List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpecList =
goodsInfoDao.listMallProdSpecInfo(mallSkuIds);
// 分组 // 分组
Map<Integer, List<MallProdSkuInfoSpecDO>> dbSpecMap = mallProdSkuInfoSpecList.stream().collect(Collectors.groupingBy(MallProdSkuInfoSpecDO::getMallProdSkuInfoId)); Map<Integer, List<MallProdSkuInfoSpecDO>> dbSpecMap =
mallProdSkuInfoSpecList.stream()
.collect(Collectors.groupingBy(MallProdSkuInfoSpecDO::getMallProdSkuInfoId));
for (GoodsProdSpecVO goodsSpecVO : updateGoodsSpec) { for (GoodsProdSpecVO goodsSpecVO : updateGoodsSpec) {
// 分组后的每一条商品绑定的规格信息 // 分组后的每一条商品绑定的规格信息
List<MallProdSkuInfoSpecDO> dbMallProdSkuSpecList = dbSpecMap.get(goodsSpecVO.getId()); List<MallProdSkuInfoSpecDO> dbMallProdSkuSpecList = dbSpecMap.get(goodsSpecVO.getId());
Set<Integer> inputMallSpecIds = goodsSpecVO.getSpecIds().stream().map(MallProductSpecVO::getId).filter(Objects::nonNull).collect(Collectors.toSet()); Set<Integer> inputMallSpecIds =
List<Integer> delSpecId = dbMallProdSkuSpecList.stream().map(MallProdSkuInfoSpecDO::getId).filter(id -> !inputMallSpecIds.contains(id)).collect(Collectors.toList()); 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) { if (delSpecId.size() != 0) {
// 删除多余的spec信息 // 删除多余的spec信息
goodsInfoDao.batchUpdateMallProdSpec(delSpecId); goodsInfoDao.batchUpdateMallProdSpec(delSpecId);
...@@ -358,7 +466,8 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -358,7 +466,8 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
// 新增spec的信息 // 新增spec的信息
for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) { for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) {
if (mallProductSpecVO.getId() == null) { if (mallProductSpecVO.getId() == null) {
MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO = new MallProdSkuInfoSpecDO() MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO =
new MallProdSkuInfoSpecDO()
.setProductSpecId(mallProductSpecVO.getMallSpecId()) .setProductSpecId(mallProductSpecVO.getMallSpecId())
.setMallProdSkuInfoId(goodsSpecVO.getId()) .setMallProdSkuInfoId(goodsSpecVO.getId())
.setGoodsInfoId(goodsAddVO.getId()); .setGoodsInfoId(goodsAddVO.getId());
...@@ -368,33 +477,51 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -368,33 +477,51 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
} }
} }
} }
}
// 2、对自定义的sku进行操作 // 2、对自定义的sku进行操作
List<GoodsProdSpecVO> zdySpecInfo = goodsAddVO.getProductSpec().stream().filter(spec -> spec.getFlag().equals(1)).collect(Collectors.toList()); List<GoodsProdSpecVO> zdySpecInfo =
goodsAddVO.getProductSpec().stream()
.filter(spec -> spec.getFlag().equals(1))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(zdySpecInfo)) { if (CollectionUtils.isNotEmpty(zdySpecInfo)) {
updateCustomize(zdySpecInfo, goodsAddVO.getId()); updateCustomize(goodsInfo, 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 =
zdySpecInfo.stream().filter(d -> d.getId() != null).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(zdySpec)) { if (!CollectionUtils.isEmpty(zdySpec)) {
// 根据获取到的自定义sku及规格进行操作 // 根据获取到的自定义sku及规格进行操作
List<MallProdInfoDO> zdySpecList = zdySpec.stream().map(d -> { List<MallProdInfoDO> zdySpecList =
zdySpec.stream()
.map(
d -> {
// 构建商品对应的sku信息 // 构建商品对应的sku信息
ProductSkuDO productSkuDO = new ProductSkuDO().setId(d.getSkuId()).setCategoriesId(d.getCategoryId()).setProductName(d.getProductName()); ProductSkuDO productSkuDO =
new ProductSkuDO()
.setId(d.getSkuId())
.setCategoriesId(d.getCategoryId())
.setProductName(d.getProductName());
productDao.updateProductSku(productSkuDO); productDao.updateProductSku(productSkuDO);
return new MallProdInfoDO(d).setId(d.getId()).setProdSkuId(d.getSkuId()); return new MallProdInfoDO(d).setId(d.getId()).setProdSkuId(d.getSkuId());
}).collect(Collectors.toList()); })
.collect(Collectors.toList());
// 批量修改sku的信息 // 批量修改sku的信息
goodsInfoDao.batchUpdateMallProdSkuInfo(zdySpecList); for (MallProdInfoDO mallProdInfoDO : zdySpecList) {
goodsInfoDao.updateMallProdSkuInfo(mallProdInfoDO);
}
// goodsInfoDao.batchUpdateMallProdSkuInfo(zdySpecList);
} }
for (GoodsProdSpecVO goodsSpecVO : zdySpec) { for (GoodsProdSpecVO goodsSpecVO : zdySpec) {
// 【1】获取输入的自定义规格信息// id不为空则修改 // 【1】获取输入的自定义规格信息// id不为空则修改
List<ProductSpecVO> customizeInfoList = goodsSpecVO.getCustomizeInfo().stream().filter(d -> d.getId() != null).collect(Collectors.toList()); List<ProductSpecVO> customizeInfoList =
goodsSpecVO.getCustomizeInfo().stream()
.filter(d -> d.getId() != null)
.collect(Collectors.toList());
for (ProductSpecVO d : customizeInfoList) { for (ProductSpecVO d : customizeInfoList) {
// ①修改价格配置 // ①修改价格配置
ProductSpecCPQVO productSpecCPQVO = d.getProductSpecCPQVO(); ProductSpecCPQVO productSpecCPQVO = d.getProductSpecCPQVO();
...@@ -407,14 +534,18 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -407,14 +534,18 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
// 【2】删除多余的自定义规格 // 【2】删除多余的自定义规格
if (!CollectionUtils.isEmpty(goodsSpecVO.getDelProductSpecId())) { if (!CollectionUtils.isEmpty(goodsSpecVO.getDelProductSpecId())) {
// 批量查出spec的数据 // 批量查出spec的数据
List<MallProdSkuInfoSpecDO> prodSkuInfoSpecList = productDao.getProductSpecByIds(goodsSpecVO.getDelProductSpecId()); List<MallProdSkuInfoSpecDO> prodSkuInfoSpecList =
productDao.getProductSpecByIds(goodsSpecVO.getDelProductSpecId());
for (MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO : prodSkuInfoSpecList) { for (MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO : prodSkuInfoSpecList) {
productDao.removeProductSpec(mallProdSkuInfoSpecDO.getProductSpecId()); productDao.removeProductSpec(mallProdSkuInfoSpecDO.getProductSpecId());
} }
goodsInfoDao.batchUpdateMallProdSpec(goodsSpecVO.getDelProductSpecId()); goodsInfoDao.batchUpdateMallProdSpec(goodsSpecVO.getDelProductSpecId());
} }
// 【3】新增最新的自定义规格 // 【3】新增最新的自定义规格
List<ProductSpecVO> collect = goodsSpecVO.getCustomizeInfo().stream().filter(d -> d.getId() == null).collect(Collectors.toList()); List<ProductSpecVO> collect =
goodsSpecVO.getCustomizeInfo().stream()
.filter(d -> d.getId() == null)
.collect(Collectors.toList());
for (ProductSpecVO param : collect) { for (ProductSpecVO param : collect) {
ProductSpecDO productSpecDO = new ProductSpecDO(param); ProductSpecDO productSpecDO = new ProductSpecDO(param);
// 新增产品sku // 新增产品sku
...@@ -424,7 +555,8 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -424,7 +555,8 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
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(goodsSpecVO.getId()) .setMallProdSkuInfoId(goodsSpecVO.getId())
.setGoodsInfoId(id); .setGoodsInfoId(id);
...@@ -433,9 +565,10 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -433,9 +565,10 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
} }
} }
// 2.2 新增新的自定义规格信息 // 2.2 新增新的自定义规格信息
List<GoodsProdSpecVO> newZdySpec = zdySpecInfo.stream().filter(d -> d.getId() == null).collect(Collectors.toList()); List<GoodsProdSpecVO> newZdySpec =
zdySpecInfo.stream().filter(d -> d.getId() == null).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(newZdySpec)) { if (CollectionUtils.isNotEmpty(newZdySpec)) {
productSkuSpecOperation(new GoodsInfo(id), newZdySpec); productSkuSpecOperation(goodsInfo, newZdySpec);
} }
} }
...@@ -446,31 +579,48 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -446,31 +579,48 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
// 插入其他服务 // 插入其他服务
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 =
other.stream()
.map(
d -> {
GoodsServiceDO goodsServiceDO = new GoodsServiceDO(); GoodsServiceDO goodsServiceDO = new GoodsServiceDO();
goodsServiceDO.setGoodsInfoId(goodsAddVO.getId()); goodsServiceDO.setGoodsInfoId(goodsAddVO.getId());
goodsServiceDO.setSaleServiceId(d); goodsServiceDO.setSaleServiceId(d);
return goodsServiceDO; return goodsServiceDO;
}).collect(Collectors.toList()); })
.collect(Collectors.toList());
goodsInfoDao.insertGoodsService(otherList); 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 =
goodsAddVO.getImages().stream()
.map(GoodsImgVO::getId)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
List<GoodsImgDO> dbImgList = goodsInfoDao.listGoodsInfoByGoodsId(goodsAddVO.getId()); List<GoodsImgDO> dbImgList = goodsInfoDao.listGoodsInfoByGoodsId(goodsAddVO.getId());
List<Integer> deleteIds = dbImgList.stream().map(GoodsImgDO::getId).filter(id -> !imgIds.contains(id)).collect(Collectors.toList()); List<Integer> deleteIds =
dbImgList.stream()
.map(GoodsImgDO::getId)
.filter(id -> !imgIds.contains(id))
.collect(Collectors.toList());
if (deleteIds.size() != 0) { if (deleteIds.size() != 0) {
// 删除多余的图片 // 删除多余的图片
goodsInfoDao.deleteImgByIds(deleteIds); goodsInfoDao.deleteImgByIds(deleteIds);
} }
// 新增图片 // 新增图片
List<GoodsImgDO> imgDOList = goodsAddVO.getImages().stream().filter(d -> d.getId() == null).map(d -> { List<GoodsImgDO> imgDOList =
goodsAddVO.getImages().stream()
.filter(d -> d.getId() == null)
.map(
d -> {
GoodsImgDO goodsImgDO = new GoodsImgDO(d); GoodsImgDO goodsImgDO = new GoodsImgDO(d);
goodsImgDO.setGoodsInfoId(goodsAddVO.getId()); goodsImgDO.setGoodsInfoId(goodsAddVO.getId());
return goodsImgDO; return goodsImgDO;
}).collect(Collectors.toList()); })
.collect(Collectors.toList());
if (imgDOList.size() != 0) { if (imgDOList.size() != 0) {
goodsInfoDao.insertGoodsImgInfo(imgDOList); goodsInfoDao.insertGoodsImgInfo(imgDOList);
} }
...@@ -487,14 +637,14 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -487,14 +637,14 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
@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 @Override
public ResultBody getGoodsInfoDetail(Integer goodsInfoId) { public ResultBody getGoodsInfoDetail(Integer goodsInfoId, Integer type, Integer leaseTerm) {
// 判断此商品是否还存在 // 判断此商品是否还存在
int count = goodsInfoDao.countGoodsInfoById(goodsInfoId); int count = goodsInfoDao.countGoodsInfoById(goodsInfoId);
if (count <= 0) { if (count <= 0) {
...@@ -504,10 +654,16 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -504,10 +654,16 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
MallGoodsDetailDTO mallGoodsDetail = new MallGoodsDetailDTO(); MallGoodsDetailDTO mallGoodsDetail = new MallGoodsDetailDTO();
// 获取商品基本信息 // 获取商品基本信息
GoodsInfo goodsInfo = goodsInfoDao.getGoodsSimpleInfo(goodsInfoId); GoodsInfo goodsInfo = goodsInfoDao.getGoodsSimpleInfo(goodsInfoId);
mallGoodsDetail.setId(goodsInfo.getId()).setGoodsName(goodsInfo.getGoodsName()) mallGoodsDetail
.setCategoryByOne(goodsInfo.getCategoryByOne()).setGoodsVideo(goodsInfo.getVideoUrl()) .setId(goodsInfo.getId())
.setDirectoryId(goodsInfo.getDirectoryId()).setCategoryByTwo(goodsInfo.getCategoryByTwo()) .setGoodsNo(goodsInfo.getGoodsNo())
.setTag(goodsInfo.getEcoLabel()).setShelfStatus(goodsInfo.getShelfStatus()) .setGoodsName(goodsInfo.getGoodsName())
.setCategoryByOne(goodsInfo.getCategoryByOne())
.setGoodsVideo(goodsInfo.getVideoUrl())
.setDirectoryId(goodsInfo.getDirectoryId())
.setCategoryByTwo(goodsInfo.getCategoryByTwo())
.setTag(goodsInfo.getEcoLabel())
.setShelfStatus(goodsInfo.getShelfStatus())
.setGoodsVideoId(goodsInfo.getGoodsVideoId()); .setGoodsVideoId(goodsInfo.getGoodsVideoId());
// 获取商品图片信息 // 获取商品图片信息
mallGoodsDetail.setImages(getGoodsImageInfo(goodsInfoId)); mallGoodsDetail.setImages(getGoodsImageInfo(goodsInfoId));
...@@ -518,7 +674,7 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -518,7 +674,7 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
// 获取规格信息 // 获取规格信息
if (!goodsInfo.getDirectoryId().equals(2)) { if (!goodsInfo.getDirectoryId().equals(2)) {
// 获取产品规格信息 // 获取产品规格信息
mallGoodsDetail.setGoodsSpec(getProductSpecInfo(goodsInfoId)); mallGoodsDetail.setGoodsSpec(getProductSpecInfo(goodsInfoId, type, leaseTerm));
} else { } else {
// 获取行业规格信息 // 获取行业规格信息
mallGoodsDetail.setGoodsSpec(getIndustrySpecInfo(goodsInfoId)); mallGoodsDetail.setGoodsSpec(getIndustrySpecInfo(goodsInfoId));
...@@ -528,16 +684,25 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -528,16 +684,25 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
private List<GoodsSpecDTO> getIndustrySpecInfo(Integer goodsInfoId) { private List<GoodsSpecDTO> getIndustrySpecInfo(Integer goodsInfoId) {
// 获取商品对应绑定的行业sku信息 // 获取商品对应绑定的行业sku信息
List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList = goodsInfoDao.getMallIndustrySkuInfo(goodsInfoId); List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList =
List<GoodsSpecDTO> list = mallIndustrySkuInfoList.stream().map(MallIndustrySkuInfoDO::buildGoodsSpecDTO).collect(Collectors.toList()); goodsInfoDao.getMallIndustrySkuInfo(goodsInfoId);
List<GoodsSpecDTO> list =
mallIndustrySkuInfoList.stream()
.map(MallIndustrySkuInfoDO::buildGoodsSpecDTO)
.collect(Collectors.toList());
// 根据商品id查出该商品下绑定的规格信息 // 根据商品id查出该商品下绑定的规格信息
List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpec = industrySpecDao.getIndustrySkuInfoSpec(goodsInfoId); List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpec =
list = list.stream().peek(d -> { industrySpecDao.getIndustrySkuInfoSpec(goodsInfoId);
list =
list.stream()
.peek(
d -> {
List<MallIndustrySpecDTO> industrySpec = new ArrayList<>(); List<MallIndustrySpecDTO> industrySpec = new ArrayList<>();
for (MallIndustrySkuInfoSpecDO e : mallIndustrySkuInfoSpec) { for (MallIndustrySkuInfoSpecDO e : mallIndustrySkuInfoSpec) {
if (d.getId().equals(e.getMallIndustrySkuInfoId())) { if (d.getId().equals(e.getMallIndustrySkuInfoId())) {
IndustrySpecDO industrySpecDO = e.getIndustrySpecDO(); IndustrySpecDO industrySpecDO = e.getIndustrySpecDO();
MallIndustrySpecDTO industrySpecDTO = industrySpecDO.buildMallIndustrySpecDTO(); MallIndustrySpecDTO industrySpecDTO =
industrySpecDO.buildMallIndustrySpecDTO();
industrySpecDTO.setId(e.getId()); industrySpecDTO.setId(e.getId());
industrySpecDTO.setIndustrySpecId(e.getIndustrySpecId()); industrySpecDTO.setIndustrySpecId(e.getIndustrySpecId());
industrySpecDTO.setIndustrySkuId(d.getSkuId()); industrySpecDTO.setIndustrySkuId(d.getSkuId());
...@@ -545,18 +710,27 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -545,18 +710,27 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
} }
} }
d.setIndustrySpecList(industrySpec); d.setIndustrySpecList(industrySpec);
}).collect(Collectors.toList()); })
.collect(Collectors.toList());
return list; return list;
} }
private List<GoodsSpecDTO> getProductSpecInfo(Integer goodsInfoId) { private List<GoodsSpecDTO> getProductSpecInfo(
Integer goodsInfoId, Integer type, Integer leaseTerm) {
// 获取商品对应绑定sku的信息 // 获取商品对应绑定sku的信息
List<MallProdInfoDO> mallProdSkuInfoList = goodsInfoDao.getMallProSkuInfo(goodsInfoId); List<MallProdInfoDO> mallProdSkuInfoList = goodsInfoDao.getAllMallProSkuInfo(goodsInfoId);
List<GoodsSpecDTO> list = mallProdSkuInfoList.stream().map(MallProdInfoDO::buildGoodsSpecDTO).collect(Collectors.toList()); List<GoodsSpecDTO> list =
mallProdSkuInfoList.stream()
.map(MallProdInfoDO::buildGoodsSpecDTO)
.collect(Collectors.toList());
// 获取规格来源详细信息 // 获取规格来源详细信息
List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpec = goodsInfoDao.getMallProSkuInfoSpec(goodsInfoId); List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpec =
goodsInfoDao.getMallProSkuInfoSpec(goodsInfoId);
// 根据id查询出规格的具体信息 // 根据id查询出规格的具体信息
list = list.stream().peek(d -> { list =
list.stream()
.peek(
d -> {
List<MallProductSpecDTO> specList = new ArrayList<>(); List<MallProductSpecDTO> specList = new ArrayList<>();
for (MallProdSkuInfoSpecDO e : mallProdSkuInfoSpec) { for (MallProdSkuInfoSpecDO e : mallProdSkuInfoSpec) {
if (d.getId().equals(e.getMallProdSkuInfoId())) { if (d.getId().equals(e.getMallProdSkuInfoId())) {
...@@ -566,49 +740,68 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -566,49 +740,68 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
productSpecDTO.setProductSkuId(d.getSkuId()); productSpecDTO.setProductSkuId(d.getSkuId());
productSpecDTO.setId(e.getId()); productSpecDTO.setId(e.getId());
productSpecDTO.setProductSpec(e.getProductSpecId()); productSpecDTO.setProductSpec(e.getProductSpecId());
if (d.getFlag().equals(1)) {
// 获取自定义sku下规格的价格配置信息 // 获取自定义sku下规格的价格配置信息
ProductSpecCPQVO productSpecCPQVO = new ProductSpecCPQVO(); ProductSpecCPQVO productSpecCPQVO = new ProductSpecCPQVO();
productSpecCPQVO.setProductSpecId(e.getProductSpecId()); productSpecCPQVO.setProductSpecId(e.getProductSpecId());
List<ProductSpecPriceDO> productSpecPrice = productDao.getProductSpecPrice(productSpecCPQVO); productSpecCPQVO.setType(type);
List<SpecPriceVO> collect = productSpecPrice.stream().map(m -> { if (type.equals(1)) {
productSpecCPQVO.setLeaseTerm(leaseTerm);
}
List<ProductSpecPriceDO> productSpecPrice =
productDao.getProductSpecPrice(productSpecCPQVO);
List<SpecPriceVO> collect =
productSpecPrice.stream()
.map(
m -> {
SpecPriceVO specPriceVO = new SpecPriceVO(); SpecPriceVO specPriceVO = new SpecPriceVO();
specPriceVO.setId(m.getId()); specPriceVO.setId(m.getId());
specPriceVO.setPrice(m.getPrice()); specPriceVO.setPrice(m.getPrice());
specPriceVO.setCooperationTag(m.getCooperationTag()); specPriceVO.setCooperationTag(m.getCooperationTag());
return specPriceVO; return specPriceVO;
}).collect(Collectors.toList()); })
.collect(Collectors.toList());
productSpecCPQVO.setSpecPrice(collect); productSpecCPQVO.setSpecPrice(collect);
productSpecDTO.setProductSpecCPQVO(productSpecCPQVO); productSpecDTO.setProductSpecCPQVO(productSpecCPQVO);
}
specList.add(productSpecDTO); 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 =
skuUnitList.stream().map(SkuUnitDO::buildSkuUnitDTO).collect(Collectors.toList());
return ResultBody.success(list); return ResultBody.success(list);
} }
...@@ -621,11 +814,11 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -621,11 +814,11 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
@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) {
...@@ -639,7 +832,7 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -639,7 +832,7 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
} }
} }
//对产品和行业的规格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) {
...@@ -653,7 +846,7 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -653,7 +846,7 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
} }
} }
} }
//根据规格id查找规格信息 // 根据规格id查找规格信息
List<MallGoodsSpecInfoDO> goodsSpecInfoDOList = new ArrayList<>(); List<MallGoodsSpecInfoDO> goodsSpecInfoDOList = new ArrayList<>();
if (!CollectionUtils.isEmpty(prodIds)) { if (!CollectionUtils.isEmpty(prodIds)) {
List<MallGoodsSpecInfoDO> goodsProdSpecInfoDOList = goodsInfoDao.listProdSpecInfo(prodIds); List<MallGoodsSpecInfoDO> goodsProdSpecInfoDOList = goodsInfoDao.listProdSpecInfo(prodIds);
...@@ -663,19 +856,29 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -663,19 +856,29 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
List<MallGoodsSpecInfoDO> goodsIndstSpecInfoDOList = goodsInfoDao.listIndstSpecInfo(indstIds); List<MallGoodsSpecInfoDO> goodsIndstSpecInfoDOList = goodsInfoDao.listIndstSpecInfo(indstIds);
goodsSpecInfoDOList.addAll(goodsIndstSpecInfoDOList); goodsSpecInfoDOList.addAll(goodsIndstSpecInfoDOList);
} }
//根据查出来的sku,填充到MallGoodsShopCarDTO里面 // 根据查出来的sku,填充到MallGoodsShopCarDTO里面
for (MallGoodsShopCarDTO mallGoodsShopCarDTO : param) { for (MallGoodsShopCarDTO mallGoodsShopCarDTO : param) {
for (MallGoodsSpecInfoDO mallGoodsSpecInfoDO : goodsSpecInfoDOList) { for (MallGoodsSpecInfoDO mallGoodsSpecInfoDO : goodsSpecInfoDOList) {
//找到对应商品 // 找到对应商品
if (mallGoodsShopCarDTO.getGoodsInfoId().toString().equals(mallGoodsSpecInfoDO.getId().toString()) if (mallGoodsShopCarDTO
&& mallGoodsShopCarDTO.getDirectoryId().toString().equals(mallGoodsSpecInfoDO.getDirectoryId().toString())) { .getGoodsInfoId()
.toString()
.equals(mallGoodsSpecInfoDO.getId().toString())
&& mallGoodsShopCarDTO
.getDirectoryId()
.toString()
.equals(mallGoodsSpecInfoDO.getDirectoryId().toString())) {
for (SkuSpecDO skuSpecDO : mallGoodsSpecInfoDO.getSkuSpecDOList()) { for (SkuSpecDO skuSpecDO : mallGoodsSpecInfoDO.getSkuSpecDOList()) {
for (MallSkuInfoSpecDTO mallSkuInfoSpecDTO : mallGoodsShopCarDTO.getSkuList()) { for (MallSkuInfoSpecDTO mallSkuInfoSpecDTO : mallGoodsShopCarDTO.getSkuList()) {
//根据对应规格进行填充 // 根据对应规格进行填充
if (skuSpecDO.getId().toString().equals(mallSkuInfoSpecDTO.getMallSkuInfoSpecId().toString())) { if (skuSpecDO
.getId()
.toString()
.equals(mallSkuInfoSpecDTO.getMallSkuInfoSpecId().toString())) {
mallSkuInfoSpecDTO.setSpecName(skuSpecDO.getSpecName()); mallSkuInfoSpecDTO.setSpecName(skuSpecDO.getSpecName());
mallSkuInfoSpecDTO.setDeleted(skuSpecDO.getSkuSpecDeleted()); mallSkuInfoSpecDTO.setDeleted(skuSpecDO.getSkuSpecDeleted());
mallSkuInfoSpecDTO.setValid(skuSpecDO.getSkuSpecDeleted() == 0 && skuSpecDO.getSpecDeleted() == 0); mallSkuInfoSpecDTO.setValid(
skuSpecDO.getSkuSpecDeleted() == 0 && skuSpecDO.getSpecDeleted() == 0);
break; break;
} }
} }
...@@ -688,29 +891,39 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -688,29 +891,39 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
} }
@Override @Override
public List<MallProductSpecPriceDTO> feignListProductSpecPrice(ProductSpecPriceQO productSpecPriceQO) { public List<MallProductSpecPriceDTO> feignListProductSpecPrice(
ProductSpecPriceQO productSpecPriceQO) {
Set<Integer> ids = new HashSet<>(productSpecPriceQO.getProductSpecIds()); Set<Integer> ids = new HashSet<>(productSpecPriceQO.getProductSpecIds());
List<MallProductSpecPriceDTO> mallProductSpecPriceDTOS = productSpecPriceQO.getProductSpecIds().stream().map(d -> { List<MallProductSpecPriceDTO> mallProductSpecPriceDTOS =
productSpecPriceQO.getProductSpecIds().stream()
.map(
d -> {
MallProductSpecPriceDTO mallProductSpecPriceDTO = new MallProductSpecPriceDTO(); MallProductSpecPriceDTO mallProductSpecPriceDTO = new MallProductSpecPriceDTO();
mallProductSpecPriceDTO.setProductSpecId(d); mallProductSpecPriceDTO.setProductSpecId(d);
return mallProductSpecPriceDTO; return mallProductSpecPriceDTO;
}).collect(Collectors.toList()); })
//分别找出渠道价格和市场价格 .collect(Collectors.toList());
List<ProductSpecPriceDO> productSpecPriceDOS = productDao.listProductSpecPrice(productSpecPriceQO.getChannelClass(), ids); // 分别找出渠道价格和市场价格
List<ProductSpecPriceDO> productSpecPriceDOS =
productDao.listProductSpecPrice(productSpecPriceQO.getChannelClass(), ids);
List<ProductSpecPriceDO> productSpecPriceDOS1 = productDao.listProductSpecPrice(0, ids); List<ProductSpecPriceDO> productSpecPriceDOS1 = productDao.listProductSpecPrice(0, ids);
//设置合作价格 // 设置合作价格
for (ProductSpecPriceDO productSpecPriceDO : productSpecPriceDOS) { for (ProductSpecPriceDO productSpecPriceDO : productSpecPriceDOS) {
for (MallProductSpecPriceDTO mallProductSpecPriceDTO : mallProductSpecPriceDTOS) { for (MallProductSpecPriceDTO mallProductSpecPriceDTO : mallProductSpecPriceDTOS) {
if (mallProductSpecPriceDTO.getProductSpecId().equals(productSpecPriceDO.getProductSpecId())) { if (mallProductSpecPriceDTO
.getProductSpecId()
.equals(productSpecPriceDO.getProductSpecId())) {
mallProductSpecPriceDTO.setOpPrice(productSpecPriceDO.getPrice()); mallProductSpecPriceDTO.setOpPrice(productSpecPriceDO.getPrice());
break; break;
} }
} }
} }
//设置市场价格 // 设置市场价格
for (ProductSpecPriceDO productSpecPriceDO : productSpecPriceDOS1) { for (ProductSpecPriceDO productSpecPriceDO : productSpecPriceDOS1) {
for (MallProductSpecPriceDTO mallProductSpecPriceDTO : mallProductSpecPriceDTOS) { for (MallProductSpecPriceDTO mallProductSpecPriceDTO : mallProductSpecPriceDTOS) {
if (mallProductSpecPriceDTO.getProductSpecId().equals(productSpecPriceDO.getProductSpecId())) { if (mallProductSpecPriceDTO
.getProductSpecId()
.equals(productSpecPriceDO.getProductSpecId())) {
mallProductSpecPriceDTO.setMkPrice(productSpecPriceDO.getPrice()); mallProductSpecPriceDTO.setMkPrice(productSpecPriceDO.getPrice());
break; break;
} }
...@@ -725,37 +938,57 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -725,37 +938,57 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
return price; return price;
} }
@Override @Override
public List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO) { public List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(
//查询渠道等级对应的商品价格 MallOrderGoodsInfoQO mallOrderGoodsInfoQO) {
Set<Integer> prodSkuSpecIds = productDao.listProductSpecIds(mallOrderGoodsInfoQO.getMallProdSkuSpecIds()); // 查询渠道等级对应的商品价格
List<ProductSpecPriceDO> productSpecPriceDOS = productDao.listProductSpecPrice(mallOrderGoodsInfoQO.getCooperationTagId(), prodSkuSpecIds); Set<Integer> prodSkuSpecIds =
//查询商品信息 productDao.listProductSpecIds(mallOrderGoodsInfoQO.getMallProdSkuSpecIds());
List<OrderGoodsProdDTO> orderGoodsProdDTOList = productDao.listProdGoodsSkuInfo(mallOrderGoodsInfoQO); List<ProductSpecPriceDO> productSpecPriceDOS =
productDao.listProductSpecPrice(mallOrderGoodsInfoQO.getCooperationTagId(), prodSkuSpecIds);
// 查询商品信息
List<OrderGoodsProdDTO> orderGoodsProdDTOList =
productDao.listProdGoodsSkuInfo(mallOrderGoodsInfoQO);
if (!CollectionUtils.isEmpty(productSpecPriceDOS)) { if (!CollectionUtils.isEmpty(productSpecPriceDOS)) {
//填充渠道价格 // 填充渠道价格
this.fillOrderGoodsProdPrice(orderGoodsProdDTOList, productSpecPriceDOS, prodSkuSpecIds); this.fillOrderGoodsProdPrice(orderGoodsProdDTOList, productSpecPriceDOS, prodSkuSpecIds);
} }
//还需配置商品规格金额, 单个商品skuSpecAmount, 全部小sku金额 // 商品没有设置渠道价格的,按照市场价设置
List<Integer> goodsIds = orderGoodsProdDTOList.stream().map(OrderGoodsProdDTO::getGoodsInfoId).collect(Collectors.toList()); 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()); List<GoodsServiceDTO> services =
Map<Integer, List<GoodsServiceDTO>> mapGoodsService = org.springframework.util.CollectionUtils.isEmpty(services) ? null goodsInfoDao.listGoodsService(goodsIds).stream()
: services.stream() .map(d -> d.buildGoodsServiceDTO())
.collect(Collectors.groupingBy(GoodsServiceDTO::getGoodsInfoId)); .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 -> { List<OrderGoodsProdDTO> collect =
orderGoodsProdDTOList.stream()
.map(
d -> {
OrderGoodsProdDTO orderGoodsProdDTO = d; OrderGoodsProdDTO orderGoodsProdDTO = d;
if (mapGoodsService != null && mapGoodsService.containsKey(d.getGoodsInfoId())) { if (mapGoodsService != null && mapGoodsService.containsKey(d.getGoodsInfoId())) {
orderGoodsProdDTO.setServices(mapGoodsService.get(d.getGoodsInfoId())); orderGoodsProdDTO.setServices(mapGoodsService.get(d.getGoodsInfoId()));
} }
return orderGoodsProdDTO; return orderGoodsProdDTO;
}).collect(Collectors.toList()); })
.collect(Collectors.toList());
return collect; return collect;
} }
/** /**
* 填充产品规格价格 * 填充产品规格价格
* *
...@@ -764,16 +997,24 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -764,16 +997,24 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
* @param prodSkuSpecIds * @param prodSkuSpecIds
* @return * @return
*/ */
private List<OrderGoodsProdDTO> fillOrderGoodsProdPrice(List<OrderGoodsProdDTO> orderGoodsProdDTOList, List<ProductSpecPriceDO> productSpecPriceDOS, Set<Integer> prodSkuSpecIds) { private List<OrderGoodsProdDTO> fillOrderGoodsProdPrice(
List<OrderGoodsProdDTO> orderGoodsProdDTOList,
List<ProductSpecPriceDO> productSpecPriceDOS,
Set<Integer> prodSkuSpecIds) {
for (OrderGoodsProdDTO orderGoodsProdDTO : orderGoodsProdDTOList) { for (OrderGoodsProdDTO orderGoodsProdDTO : orderGoodsProdDTOList) {
for (OrderGoodsProdDetailDTO orderGoodsProdDetailDTO : orderGoodsProdDTO.getOrderGoodsProdDetailDTOS()) { for (OrderGoodsProdDetailDTO orderGoodsProdDetailDTO :
//配置价格 orderGoodsProdDTO.getOrderGoodsProdDetailDTOS()) {
// 配置价格
for (ProductSpecPriceDO productSpecPriceDO : productSpecPriceDOS) { for (ProductSpecPriceDO productSpecPriceDO : productSpecPriceDOS) {
//找到规格对应的价格 // 找到规格对应的价格
if (productSpecPriceDO.getProductSpecId().toString().equals(orderGoodsProdDetailDTO.getProductSpecId().toString())) { if (productSpecPriceDO
.getProductSpecId()
.toString()
.equals(orderGoodsProdDetailDTO.getProductSpecId().toString())) {
orderGoodsProdDetailDTO.setUnitPrice(productSpecPriceDO.getPrice()); orderGoodsProdDetailDTO.setUnitPrice(productSpecPriceDO.getPrice());
//配置价格后移除,剩余没有配置的 // 配置价格后移除,剩余没有配置的
prodSkuSpecIds.removeIf(d -> d.toString().equals(orderGoodsProdDetailDTO.getProductSpecId().toString())); prodSkuSpecIds.removeIf(
d -> d.toString().equals(orderGoodsProdDetailDTO.getProductSpecId().toString()));
break; break;
} }
} }
...@@ -782,62 +1023,92 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -782,62 +1023,92 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
return orderGoodsProdDTOList; return orderGoodsProdDTOList;
} }
@Override @Override
public List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO) { public List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(
//查询商品信息 MallOrderGoodsInfoQO mallOrderGoodsInfoQO) {
List<MallGoodsInfoSimpleDO> mallGoodsInfoSimpleDOS = goodsInfoDao.listMallGoodsIndstSimpleInfo(mallOrderGoodsInfoQO.getMallIndstSkuSpecIds()); // 查询商品信息
List<Integer> industrySpecIds = goodsInfoDao.listIndustrySpecIds(mallOrderGoodsInfoQO.getMallIndstSkuSpecIds()); List<MallGoodsInfoSimpleDO> mallGoodsInfoSimpleDOS =
//查询商品价格 goodsInfoDao.listMallGoodsIndstSimpleInfo(mallOrderGoodsInfoQO.getMallIndstSkuSpecIds());
List<IndustrySpecPriceDO> industrySpecPriceDOS = industrySpecDao.listIndustrySpecPrice(mallOrderGoodsInfoQO.getCooperationTagId(), industrySpecIds); List<Integer> industrySpecIds =
//查询商品行业规格对应的产品清单 goodsInfoDao.listIndustrySpecIds(mallOrderGoodsInfoQO.getMallIndstSkuSpecIds());
List<MallGoodsProductDO> mallGoodsProductDOS = goodsInfoDao.listIndustryProductList(industrySpecIds); // 查询商品价格
//配置商品行业规格价格 List<IndustrySpecPriceDO> industrySpecPriceDOS =
industrySpecDao.listIndustrySpecPrice(
mallOrderGoodsInfoQO.getCooperationTagId(), industrySpecIds);
// 查询商品行业规格对应的产品清单
List<MallGoodsProductDO> mallGoodsProductDOS =
goodsInfoDao.listIndustryProductList(industrySpecIds);
// 配置商品行业规格价格
this.fillOrderGoodsIndstPrice(mallGoodsInfoSimpleDOS, industrySpecPriceDOS, industrySpecIds); this.fillOrderGoodsIndstPrice(mallGoodsInfoSimpleDOS, industrySpecPriceDOS, industrySpecIds);
if (!CollectionUtils.isEmpty(industrySpecIds)) { if (!CollectionUtils.isEmpty(industrySpecIds)) {
//查询商品价格,找出市场价 // 查询商品价格,找出市场价
List<IndustrySpecPriceDO> industryMarketPrice = industrySpecDao.listIndustrySpecPrice(0, industrySpecIds); List<IndustrySpecPriceDO> industryMarketPrice =
industrySpecDao.listIndustrySpecPrice(0, industrySpecIds);
this.fillOrderGoodsIndstPrice(mallGoodsInfoSimpleDOS, industryMarketPrice, industrySpecIds); this.fillOrderGoodsIndstPrice(mallGoodsInfoSimpleDOS, industryMarketPrice, industrySpecIds);
} }
//配置产品清单 // 配置产品清单
for (MallGoodsInfoSimpleDO mallGoodsInfoSimpleDO : mallGoodsInfoSimpleDOS) { for (MallGoodsInfoSimpleDO mallGoodsInfoSimpleDO : mallGoodsInfoSimpleDOS) {
for (MallGoodsSpecSimpleDO mallGoodsSpecSimpleDO : mallGoodsInfoSimpleDO.getMallGoodsSpecSimpleDOS()) { for (MallGoodsSpecSimpleDO mallGoodsSpecSimpleDO :
mallGoodsInfoSimpleDO.getMallGoodsSpecSimpleDOS()) {
mallGoodsSpecSimpleDO.setMallGoodsProductDOS(new ArrayList<MallGoodsProductDO>()); mallGoodsSpecSimpleDO.setMallGoodsProductDOS(new ArrayList<MallGoodsProductDO>());
//从产品清单中拿出对应的方案规格里面 // 从产品清单中拿出对应的方案规格里面
for (MallGoodsProductDO mallGoodsProductDO : mallGoodsProductDOS) { for (MallGoodsProductDO mallGoodsProductDO : mallGoodsProductDOS) {
if (mallGoodsProductDO.getIndustrySpecId().toString().equals(mallGoodsSpecSimpleDO.getIndustrySpecId().toString())) { if (mallGoodsProductDO
.getIndustrySpecId()
.toString()
.equals(mallGoodsSpecSimpleDO.getIndustrySpecId().toString())) {
mallGoodsSpecSimpleDO.getMallGoodsProductDOS().add(mallGoodsProductDO); mallGoodsSpecSimpleDO.getMallGoodsProductDOS().add(mallGoodsProductDO);
} }
} }
} }
} }
//转换对象 // 转换对象
List<OrderGoodsIndstDTO> collect = mallGoodsInfoSimpleDOS.stream().map(d -> d.buildOrderGoodsIndstDTO()).collect(Collectors.toList()); List<OrderGoodsIndstDTO> collect =
mallGoodsInfoSimpleDOS.stream()
.map(d -> d.buildOrderGoodsIndstDTO())
.collect(Collectors.toList());
// 拼装商品服务 // 拼装商品服务
List<Integer> goodsIds = collect.stream().map(OrderGoodsIndstDTO::getGoodsInfoId).collect(Collectors.toList()); List<Integer> goodsIds =
List<GoodsServiceDTO> services = goodsInfoDao.listGoodsService(goodsIds).stream().map(d -> d.buildGoodsServiceDTO()).collect(Collectors.toList()); collect.stream().map(OrderGoodsIndstDTO::getGoodsInfoId).collect(Collectors.toList());
Map<Integer, List<GoodsServiceDTO>> mapGoodsService = org.springframework.util.CollectionUtils.isEmpty(services) ? null List<GoodsServiceDTO> services =
: services.stream() goodsInfoDao.listGoodsService(goodsIds).stream()
.collect(Collectors.groupingBy(GoodsServiceDTO::getGoodsInfoId)); .map(d -> d.buildGoodsServiceDTO())
List<OrderGoodsIndstDTO> resultList = collect.stream().map(d -> { .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; OrderGoodsIndstDTO orderGoodsIndstDTO = d;
if (mapGoodsService != null && mapGoodsService.containsKey(d.getGoodsInfoId())) { if (mapGoodsService != null && mapGoodsService.containsKey(d.getGoodsInfoId())) {
orderGoodsIndstDTO.setServices(mapGoodsService.get(d.getGoodsInfoId())); orderGoodsIndstDTO.setServices(mapGoodsService.get(d.getGoodsInfoId()));
} }
return orderGoodsIndstDTO; return orderGoodsIndstDTO;
}).collect(Collectors.toList()); })
.collect(Collectors.toList());
return resultList; return resultList;
} }
private List<MallGoodsInfoSimpleDO> fillOrderGoodsIndstPrice(List<MallGoodsInfoSimpleDO> mallGoodsInfoSimpleDOS, List<IndustrySpecPriceDO> industrySpecPriceDOS, List<Integer> industrySpecIds) { private List<MallGoodsInfoSimpleDO> fillOrderGoodsIndstPrice(
//配置商品行业规格价格 List<MallGoodsInfoSimpleDO> mallGoodsInfoSimpleDOS,
List<IndustrySpecPriceDO> industrySpecPriceDOS,
List<Integer> industrySpecIds) {
// 配置商品行业规格价格
for (MallGoodsInfoSimpleDO mallGoodsInfoSimpleDO : mallGoodsInfoSimpleDOS) { for (MallGoodsInfoSimpleDO mallGoodsInfoSimpleDO : mallGoodsInfoSimpleDOS) {
for (MallGoodsSpecSimpleDO mallGoodsSpecSimpleDO : mallGoodsInfoSimpleDO.getMallGoodsSpecSimpleDOS()) { for (MallGoodsSpecSimpleDO mallGoodsSpecSimpleDO :
//查询规格进行配置 mallGoodsInfoSimpleDO.getMallGoodsSpecSimpleDOS()) {
// 查询规格进行配置
for (IndustrySpecPriceDO industrySpecPriceDO : industrySpecPriceDOS) { for (IndustrySpecPriceDO industrySpecPriceDO : industrySpecPriceDOS) {
if (mallGoodsSpecSimpleDO.getIndustrySpecId().toString().equals(industrySpecPriceDO.getIndustrySpecId().toString())) { if (mallGoodsSpecSimpleDO
.getIndustrySpecId()
.toString()
.equals(industrySpecPriceDO.getIndustrySpecId().toString())) {
mallGoodsSpecSimpleDO.setUnitPrice(industrySpecPriceDO.getPrice()); mallGoodsSpecSimpleDO.setUnitPrice(industrySpecPriceDO.getPrice());
industrySpecIds.removeIf(d -> d.toString().equals(industrySpecPriceDO.getIndustrySpecId().toString())); industrySpecIds.removeIf(
d -> d.toString().equals(industrySpecPriceDO.getIndustrySpecId().toString()));
break; break;
} }
} }
...@@ -845,8 +1116,30 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -845,8 +1116,30 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
} }
return mallGoodsInfoSimpleDOS; 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,10 +23,7 @@ import java.util.stream.Collectors; ...@@ -26,10 +23,7 @@ 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) {
...@@ -127,68 +121,44 @@ public class MiniProgramProductMallServiceImpl implements MiniProgramProductMall ...@@ -127,68 +121,44 @@ public class MiniProgramProductMallServiceImpl implements MiniProgramProductMall
return ResultBody.success(appGoodsInfoDetailDTO); return ResultBody.success(appGoodsInfoDetailDTO);
} }
@Override
public ResultBody listGoodsByQO(GoodsInfoQO param) {
int count = goodsInfoDao.countListGoodsByQO(param);
if (count == 0) {
return ResultBody.success(
PageResult.buildPage(param.getPageNo(), param.getPageSize(), count));
}
int pageNo = param.getPageNo();
param.buildCurrentPage();
List<GoodsInfoDO> list = goodsInfoDao.listGoodsByQO(param);
// 找出行业对应的序号
List<GoodsTypeDO> ids = goodsInfoDao.listIndustryIdBySort();
int order = 0;
/*if (param.getMasterTypeId() != null) {
for (int i = 0; i < ids.size(); i++) {
if (param.getMasterTypeId().toString().equals(ids.get(i).getId().toString())) {
order = i + 1;
break;
}
}
}*/
List<AppGoodsInfoDTO> pageList = new ArrayList<>();
for (GoodsInfoDO d : list) {
AppGoodsInfoDTO appGoodsInfoDTO = d.buildAppGoodsInfoDTO();
// 直接看该服务在当前行业对应所有服务中在第几个
for (int j = 0; j < list.size(); j++) {
if (appGoodsInfoDTO.getId().toString().equals(list.get(j).getId().toString())) {
if (j < 9) {
appGoodsInfoDTO.setCode(order + "0" + (j + 1));
} else {
appGoodsInfoDTO.setCode(order + "" + (j + 1));
}
break;
}
}
if (appGoodsInfoDTO.getShelfStatus() == 1) {
pageList.add(appGoodsInfoDTO);
}
}
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, pageList));
}
private List<GoodsSpecDTO> getIndustrySpecInfo(Integer goodsInfoId) { private List<GoodsSpecDTO> getIndustrySpecInfo(Integer goodsInfoId) {
// 获取商品对应绑定的行业sku信息 // 获取商品对应绑定的行业sku信息
List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList = goodsInfoDao.getMallIndustrySkuInfo(goodsInfoId); List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList =
List<GoodsSpecDTO> list = mallIndustrySkuInfoList.stream().map(MallIndustrySkuInfoDO::buildGoodsSpecDTO).collect(Collectors.toList()); goodsInfoDao.getMallIndustrySkuInfo(goodsInfoId);
List<GoodsSpecDTO> list =
mallIndustrySkuInfoList.stream()
.map(MallIndustrySkuInfoDO::buildGoodsSpecDTO)
.collect(Collectors.toList());
// 根据商品id查出该商品下绑定的规格信息 // 根据商品id查出该商品下绑定的规格信息
List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpec = goodsInfoDao.getIndustrySkuInfoSpec(goodsInfoId); List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpec =
list = list.stream().peek(d -> { goodsInfoDao.getIndustrySkuInfoSpec(goodsInfoId);
list =
list.stream()
.peek(
d -> {
List<MallIndustrySpecDTO> industrySpec = new ArrayList<>(); List<MallIndustrySpecDTO> industrySpec = new ArrayList<>();
for (MallIndustrySkuInfoSpecDO e : mallIndustrySkuInfoSpec) { for (MallIndustrySkuInfoSpecDO e : mallIndustrySkuInfoSpec) {
if (d.getId().equals(e.getMallIndustrySkuInfoId())) { if (d.getId().equals(e.getMallIndustrySkuInfoId())) {
IndustrySpecDO industrySpecDO = e.getIndustrySpecDO(); IndustrySpecDO industrySpecDO = e.getIndustrySpecDO();
// 获取商品清单信息 // 获取商品清单信息
List<IndustryProductInventoryDO> industryProdInventory = goodsInfoDao.getIndustryProductInventory(e.getIndustrySpecId()); List<IndustryProductInventoryDO> industryProdInventory =
goodsInfoDao.getIndustryProductInventory(e.getIndustrySpecId());
List<ProductInventoryVO> productInventoryList = new ArrayList<>(); List<ProductInventoryVO> productInventoryList = new ArrayList<>();
// 获取行业规格绑定的产品规格信息 // 获取行业规格绑定的产品规格信息
List<InventorySpecDO> inventorySpecDOList = goodsInfoDao.listInventorySpec(industryProdInventory.stream().map(IndustryProductInventoryDO::getId).collect(Collectors.toList())); List<InventorySpecDO> inventorySpecDOList =
Map<Integer, List<InventorySpecDO>> inventoryMap = inventorySpecDOList.stream().collect(Collectors.groupingBy(InventorySpecDO::getIndustryProductInventoryId)); goodsInfoDao.listInventorySpec(
getIndustrySpecOnProdSpecInfo(industryProdInventory, productInventoryList, inventoryMap); industryProdInventory.stream()
MallIndustrySpecDTO industrySpecDTO = industrySpecDO.buildMallIndustrySpecDTO(); .map(IndustryProductInventoryDO::getId)
.collect(Collectors.toList()));
Map<Integer, List<InventorySpecDO>> inventoryMap =
inventorySpecDOList.stream()
.collect(
Collectors.groupingBy(
InventorySpecDO::getIndustryProductInventoryId));
getIndustrySpecOnProdSpecInfo(
industryProdInventory, productInventoryList, inventoryMap);
MallIndustrySpecDTO industrySpecDTO =
industrySpecDO.buildMallIndustrySpecDTO();
industrySpecDTO.setId(e.getId()); industrySpecDTO.setId(e.getId());
industrySpecDTO.setIndustrySpecId(e.getIndustrySpecId()); industrySpecDTO.setIndustrySpecId(e.getIndustrySpecId());
industrySpecDTO.setIndustrySkuId(d.getSkuId()); industrySpecDTO.setIndustrySkuId(d.getSkuId());
...@@ -197,7 +167,8 @@ public class MiniProgramProductMallServiceImpl implements MiniProgramProductMall ...@@ -197,7 +167,8 @@ public class MiniProgramProductMallServiceImpl implements MiniProgramProductMall
} }
} }
d.setIndustrySpecList(industrySpec); d.setIndustrySpecList(industrySpec);
}).collect(Collectors.toList()); })
.collect(Collectors.toList());
return list; return list;
} }
......
...@@ -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,10 +27,8 @@ import java.util.stream.Collectors; ...@@ -27,10 +27,8 @@ 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) {
...@@ -40,6 +38,7 @@ public class ProductServiceImpl implements ProductSkuService { ...@@ -40,6 +38,7 @@ public class ProductServiceImpl implements ProductSkuService {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR); return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
} }
ProductSkuDO productSkuDO = new ProductSkuDO(param); ProductSkuDO productSkuDO = new ProductSkuDO(param);
productSkuDO.setCustomize(0);
// 新增产品sku // 新增产品sku
int status = productDao.insertProductSku(productSkuDO); int status = productDao.insertProductSku(productSkuDO);
if (status <= 0) { if (status <= 0) {
...@@ -78,26 +77,35 @@ public class ProductServiceImpl implements ProductSkuService { ...@@ -78,26 +77,35 @@ public class ProductServiceImpl implements ProductSkuService {
public ResultBody listPageProductSku(ProductSkuQO productSkuQO) { public ResultBody listPageProductSku(ProductSkuQO productSkuQO) {
int count = productDao.countListPageProductSku(productSkuQO); int count = productDao.countListPageProductSku(productSkuQO);
if (count == 0) { if (count == 0) {
return ResultBody.success(PageResult.buildPage(productSkuQO.getPageNo(), productSkuQO.getPageSize(), count)); return ResultBody.success(
PageResult.buildPage(productSkuQO.getPageNo(), productSkuQO.getPageSize(), count));
} }
Integer pageNo = productSkuQO.getPageNo(); Integer pageNo = productSkuQO.getPageNo();
productSkuQO.buildCurrentPage(); productSkuQO.buildCurrentPage();
List<ProductSkuDO> productSkuList = productDao.listPageProductSku(productSkuQO); List<ProductSkuDO> productSkuList = productDao.listPageProductSku(productSkuQO);
List<Integer> productSkuIds = productSkuList.stream().map(ProductSkuDO::getId).collect(Collectors.toList()); List<Integer> productSkuIds =
productSkuList.stream().map(ProductSkuDO::getId).collect(Collectors.toList());
List<ProductSpecDO> productSpecList = productDao.getProductSpecList(productSkuIds); List<ProductSpecDO> productSpecList = productDao.getProductSpecList(productSkuIds);
Map<Integer, List<ProductSpecDO>> productSpecMap = productSpecList.stream().collect(Collectors.groupingBy(ProductSpecDO::getProductSkuId)); Map<Integer, List<ProductSpecDO>> productSpecMap =
List<ProductSkuDTO> list = productSkuList.stream() productSpecList.stream().collect(Collectors.groupingBy(ProductSpecDO::getProductSkuId));
.map(ProductSkuDO::buildProductSkuDTO) List<ProductSkuDTO> list =
.collect(Collectors.toList()); productSkuList.stream().map(ProductSkuDO::buildProductSkuDTO).collect(Collectors.toList());
list.stream().peek(d -> { list.stream()
.peek(
d -> {
List<ProductSpecDO> productSpecDOS = productSpecMap.get(d.getId()); List<ProductSpecDO> productSpecDOS = productSpecMap.get(d.getId());
if (CollectionUtils.isEmpty(productSpecDOS)) { if (CollectionUtils.isEmpty(productSpecDOS)) {
d.setProductSpecList(null); d.setProductSpecList(null);
} else { } else {
d.setProductSpecList(productSpecDOS.stream().map(ProductSpecDO::buildProductSpecDTO).collect(Collectors.toList())); d.setProductSpecList(
productSpecDOS.stream()
.map(ProductSpecDO::buildProductSpecDTO)
.collect(Collectors.toList()));
} }
}).collect(Collectors.toList()); })
return ResultBody.success(PageResult.buildPage(pageNo, productSkuQO.getPageSize(), count, list)); .collect(Collectors.toList());
return ResultBody.success(
PageResult.buildPage(pageNo, productSkuQO.getPageSize(), count, list));
} }
@Override @Override
...@@ -136,13 +144,34 @@ public class ProductServiceImpl implements ProductSkuService { ...@@ -136,13 +144,34 @@ public class ProductServiceImpl implements ProductSkuService {
} }
@Override @Override
public ResultBody listPageProductSpec(Integer pageNo, Integer pageSize, Integer productSkuId) { public ResultBody listPageProductSpec(
int count = productDao.countListPageProductSpec(productSkuId); Integer pageNo, Integer pageSize, Integer productSkuId, String keyword) {
int count = productDao.countListPageProductSpec(productSkuId, keyword);
if (count == 0) { if (count == 0) {
return ResultBody.success(PageResult.buildPage(pageNo, pageSize, count)); return ResultBody.success(PageResult.buildPage(pageNo, pageSize, count));
} }
List<ProductSpecDO> productSpecList = productDao.listPageProductSpec((pageNo - 1) * pageSize, pageSize, productSkuId); List<ProductSpecDO> productSpecList =
List<ProductSpecDTO> list = productSpecList.stream().map(ProductSpecDO::buildProductSpecDTO).collect(Collectors.toList()); 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)); return ResultBody.success(PageResult.buildPage(pageNo, pageSize, count, list));
} }
...@@ -160,7 +189,9 @@ public class ProductServiceImpl implements ProductSkuService { ...@@ -160,7 +189,9 @@ public class ProductServiceImpl implements ProductSkuService {
@Override @Override
public List<ProductSpecPriceDO> getProductSpecPriceDOS(ProductSpecCPQVO productSpecCPQVO) { public List<ProductSpecPriceDO> getProductSpecPriceDOS(ProductSpecCPQVO productSpecCPQVO) {
// 批量插入规格价格 // 批量插入规格价格
return productSpecCPQVO.getSpecPrice().stream().map(d -> { return productSpecCPQVO.getSpecPrice().stream()
.map(
d -> {
ProductSpecPriceDO productSpecPriceDO = new ProductSpecPriceDO(); ProductSpecPriceDO productSpecPriceDO = new ProductSpecPriceDO();
productSpecPriceDO.setCooperationTag(d.getCooperationTag()); productSpecPriceDO.setCooperationTag(d.getCooperationTag());
productSpecPriceDO.setPrice(d.getPrice()); productSpecPriceDO.setPrice(d.getPrice());
...@@ -170,7 +201,8 @@ public class ProductServiceImpl implements ProductSkuService { ...@@ -170,7 +201,8 @@ public class ProductServiceImpl implements ProductSkuService {
productSpecPriceDO.setLeaseTerm(productSpecCPQVO.getLeaseTerm()); productSpecPriceDO.setLeaseTerm(productSpecCPQVO.getLeaseTerm());
} }
return productSpecPriceDO; return productSpecPriceDO;
}).collect(Collectors.toList()); })
.collect(Collectors.toList());
} }
@Override @Override
...@@ -184,12 +216,12 @@ public class ProductServiceImpl implements ProductSkuService { ...@@ -184,12 +216,12 @@ public class ProductServiceImpl implements ProductSkuService {
@NotNull @NotNull
public ResultBody insertSpecPrice(ProductSpecCPQVO productSpecCPQVO) { public ResultBody insertSpecPrice(ProductSpecCPQVO productSpecCPQVO) {
List<ProductSpecPriceDO> list = getProductSpecPriceDOS(productSpecCPQVO); List<ProductSpecPriceDO> list = getProductSpecPriceDOS(productSpecCPQVO);
if (productSpecCPQVO.getType().equals(1) && productSpecCPQVO.getLeaseTerm() == null) {
return ResultBody.error("租赁期限不能为空!");
}
// 批量插入规格销售价格 // 批量插入规格销售价格
if (productSpecCPQVO.getType().equals(0)) { if (productSpecCPQVO.getType().equals(0)) {
int status = productDao.batchInsertSpecPrice(list); productDao.batchInsertSpecPrice(list);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_ADD_DATA);
}
} else { } else {
// 批量插入租赁价格 // 批量插入租赁价格
productDao.batchInsertLeaseSpecPrice(list); productDao.batchInsertLeaseSpecPrice(list);
...@@ -197,15 +229,17 @@ public class ProductServiceImpl implements ProductSkuService { ...@@ -197,15 +229,17 @@ public class ProductServiceImpl implements ProductSkuService {
return ResultBody.success(); return ResultBody.success();
} }
@Override @Override
public ResultBody getProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO) { public ResultBody getProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO) {
if (productSpecCPQVO.getType().equals(1) && productSpecCPQVO.getLeaseTerm() == null) { if (productSpecCPQVO.getType().equals(1) && productSpecCPQVO.getLeaseTerm() == null) {
return ResultBody.error("租赁期限不能为空!"); return ResultBody.error("租赁期限不能为空!");
} }
List<ProductSpecPriceDO> productSpecPriceList = productDao.getProductSpecPrice(productSpecCPQVO); List<ProductSpecPriceDO> productSpecPriceList =
List<ProductSpecPriceDTO> list = productSpecPriceList.stream() productDao.getProductSpecPrice(productSpecCPQVO);
.map(ProductSpecPriceDO::buildProductSpecPriceDTO).collect(Collectors.toList()); List<ProductSpecPriceDTO> list =
productSpecPriceList.stream()
.map(ProductSpecPriceDO::buildProductSpecPriceDTO)
.collect(Collectors.toList());
return ResultBody.success(list); return ResultBody.success(list);
} }
...@@ -232,19 +266,29 @@ public class ProductServiceImpl implements ProductSkuService { ...@@ -232,19 +266,29 @@ public class ProductServiceImpl implements ProductSkuService {
if (mallProdSkuInfoSpecList.size() != 0 || inventorySpecList.size() != 0) { if (mallProdSkuInfoSpecList.size() != 0 || inventorySpecList.size() != 0) {
if (inventorySpecList.size() != 0) { if (inventorySpecList.size() != 0) {
// 根据清单id 获取行业规格id // 根据清单id 获取行业规格id
Set<Integer> inventoryIds = inventorySpecList.stream().map(InventorySpecDO::getIndustryProductInventoryId).collect(Collectors.toSet()); Set<Integer> inventoryIds =
List<IndustryProductInventoryDO> industryProductInventoryList = industrySpecDao.listIndustryProdInventory(inventoryIds); inventorySpecList.stream()
.map(InventorySpecDO::getIndustryProductInventoryId)
.collect(Collectors.toSet());
List<IndustryProductInventoryDO> industryProductInventoryList =
industrySpecDao.listIndustryProdInventory(inventoryIds);
// 获取行业规格id // 获取行业规格id
Set<Integer> industrySpecIds = industryProductInventoryList.stream().map(IndustryProductInventoryDO::getIndustrySpecId).collect(Collectors.toSet()); Set<Integer> industrySpecIds =
industryProductInventoryList.stream()
.map(IndustryProductInventoryDO::getIndustrySpecId)
.collect(Collectors.toSet());
// 分别获取规格对应的sku信息 // 分别获取规格对应的sku信息
List<IndustrySpecDO> industrySpecList = industrySpecDao.listIndustrySpec(industrySpecIds); List<IndustrySpecDO> industrySpecList = industrySpecDao.listIndustrySpec(industrySpecIds);
List<SkuAndSpecDTO> industrySkuNameList = new ArrayList<>(); List<SkuAndSpecDTO> industrySkuNameList = new ArrayList<>();
industrySpecList.stream().peek(d -> { industrySpecList.stream()
.peek(
d -> {
SkuAndSpecDTO skuAndSpecDTO = new SkuAndSpecDTO(); SkuAndSpecDTO skuAndSpecDTO = new SkuAndSpecDTO();
skuAndSpecDTO.setIndustrySkuName(d.getSolutionName()); skuAndSpecDTO.setIndustrySkuName(d.getSolutionName());
skuAndSpecDTO.setIndustrySpecNames(d.getSpecName()); skuAndSpecDTO.setIndustrySpecNames(d.getSpecName());
industrySkuNameList.add(skuAndSpecDTO); industrySkuNameList.add(skuAndSpecDTO);
}).collect(Collectors.toList()); })
.collect(Collectors.toList());
removeSkuDTO.setIndustrySkuName(industrySkuNameList); removeSkuDTO.setIndustrySkuName(industrySkuNameList);
} }
if (mallProdSkuInfoSpecList.size() != 0) { if (mallProdSkuInfoSpecList.size() != 0) {
...@@ -268,7 +312,8 @@ public class ProductServiceImpl implements ProductSkuService { ...@@ -268,7 +312,8 @@ public class ProductServiceImpl implements ProductSkuService {
dayMap.put(16, 30); dayMap.put(16, 30);
dayMap.put(31, Integer.MAX_VALUE); dayMap.put(31, Integer.MAX_VALUE);
Integer dayRange = dayMap.entrySet().stream() Integer dayRange =
dayMap.entrySet().stream()
.filter(entry -> priceAcquisition.getDay() <= entry.getKey()) .filter(entry -> priceAcquisition.getDay() <= entry.getKey())
.findFirst() .findFirst()
.map(Map.Entry::getValue) .map(Map.Entry::getValue)
...@@ -276,8 +321,16 @@ public class ProductServiceImpl implements ProductSkuService { ...@@ -276,8 +321,16 @@ public class ProductServiceImpl implements ProductSkuService {
priceAcquisition.setDay(dayRange); priceAcquisition.setDay(dayRange);
return productDao.feignGetUnitPriceByTag(priceAcquisition); 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,19 +39,23 @@ import java.util.stream.Collectors; ...@@ -24,19 +39,23 @@ import java.util.stream.Collectors;
@Service @Service
public class WebDeviceServiceImpl implements WebDeviceService { public class WebDeviceServiceImpl implements WebDeviceService {
@Autowired @Autowired WebDeviceDao webDeviceDao;
WebDeviceDao webDeviceDao;
@Autowired UserAppApi userAppApi;
@Autowired ProductDao productDao;
@Autowired GoodsInfoDao goodsInfoDao;
@Autowired GoodsInfoServiceImpl goodsInfoService;
@Autowired private CategoriesDao categoriesDao;
@Override @Override
public ResultBody listSecondDistrict() { public ResultBody listSecondDistrict() {
List<DistrictDO> list = webDeviceDao.listSecondDistrict(); List<DistrictDO> list = webDeviceDao.listSecondDistrict();
List<DistrictInfoDTO> dtoList = List<DistrictInfoDTO> dtoList =
list.stream() list.stream().map(DistrictDO::builderDistrictInfoDTO).collect(Collectors.toList());
.map(
d -> {
return d.builderDistrictInfoDTO();
})
.collect(Collectors.toList());
return ResultBody.success(dtoList); return ResultBody.success(dtoList);
} }
...@@ -144,26 +163,75 @@ public class WebDeviceServiceImpl implements WebDeviceService { ...@@ -144,26 +163,75 @@ public class WebDeviceServiceImpl implements WebDeviceService {
} }
@Override @Override
public ResultBody listWareInfoPage(WareInfoQO param) { public ResultBody listWareInfoPage(
int count = webDeviceDao.countListWareInfoPage(param); 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) { if (count == 0) {
return ResultBody.success( return ResultBody.success(
PageResult.buildPage(param.getPageNo(), param.getPageSize(), count)); PageResult.buildPage(param.getPageNo(), param.getPageSize(), count));
} }
int pageNo = param.getPageNo(); int pageNo = param.getPageNo();
param.buildCurrentPage(); param.buildCurrentPage();
List<WareInfoDO> list = webDeviceDao.listWareInfoPage(param); List<GoodsInfo> list = webDeviceDao.listWareInfoPage(param, userIds, param.getType());
List<WareInfoItemDTO> pageList = List<LeaseGoodsInfoDTO> pageList =
list.stream() list.stream().map(GoodsInfo::buildLeaseGoodsInfoDTO).collect(Collectors.toList());
.map( if (StringUtils.isBlank(request.getHeader(TokenConstant.TOKEN))) {
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, pageList));
}
UserAccountSimpleDTO userAccountSimpleDTO =
userAppApi.feignGetUserSimpleInfo(userAccountId, request.getHeader(TokenConstant.TOKEN));
if (userAccountSimpleDTO == null) {
return ResultBody.error(ResultEnum.INTERNAL_SERVER_ERROR);
}
if (userAccountSimpleDTO.getCooperationTagId() == null) {
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, pageList));
}
List<Integer> goodsId =
pageList.stream().map(LeaseGoodsInfoDTO::getId).collect(Collectors.toList());
List<MallProdSkuInfoSpecDO> mallProSkuInfoSpec = goodsInfoDao.listMallprodSpecById(goodsId);
Map<Integer, MallProdSkuInfoSpecDO> specMap =
mallProSkuInfoSpec.stream()
.collect(
Collectors.toMap(MallProdSkuInfoSpecDO::getGoodsInfoId, d -> d, (k1, k2) -> k1));
pageList.stream()
.peek(
d -> { d -> {
return d.buildWareInfoItemDTO(); MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO = specMap.get(d.getId());
d.setPrice(mallProdSkuInfoSpecDO.getPrice());
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, pageList)); return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, pageList));
} }
@Override @Override
public ResultBody getLeaseGoodsDetail(
Integer goodsInfoId, Integer userAccountId, HttpServletRequest request, Integer type) {
int count = goodsInfoDao.countGoodsInfoById(goodsInfoId);
if (count <= 0) {
return ResultBody.error(ResultEnum.GOODS_NOT_EXIST_OR_ALREADY_DOWN_SHELF);
}
// 初始化商品返回信息的对象
ResultBody goodsInfoDetail = goodsInfoService.getGoodsInfoDetail(goodsInfoId, type, 0);
MallGoodsDetailDTO result = (MallGoodsDetailDTO) goodsInfoDetail.getResult();
return ResultBody.success(result);
}
@Override
public WareInfoDTO getWareInfoById(Integer id) { public WareInfoDTO getWareInfoById(Integer id) {
WareInfoDO wareInfoDO = webDeviceDao.getWareInfoById(id); WareInfoDO wareInfoDO = webDeviceDao.getWareInfoById(id);
WareDetailDO wareDetailDO = webDeviceDao.getWareDetailById(id); WareDetailDO wareDetailDO = webDeviceDao.getWareDetailById(id);
...@@ -174,6 +242,21 @@ public class WebDeviceServiceImpl implements WebDeviceService { ...@@ -174,6 +242,21 @@ public class WebDeviceServiceImpl implements WebDeviceService {
} }
@Override @Override
public ResultBody getPageHomeCategories(Integer type) {
List<DirectoryDO> directoryList = categoriesDao.getDirectoryList(type);
if (CollectionUtils.isNotEmpty(directoryList)) {
List<Integer> directoryIds =
directoryList.stream().map(DirectoryDO::getId).collect(Collectors.toList());
List<Categories> categoriesList = categoriesDao.getCategoriesListByDirectoryIds(directoryIds);
return ResultBody.success(
categoriesList.stream()
.map(Categories::buildCategoryTypeDTO)
.collect(Collectors.toList()));
}
return ResultBody.success();
}
@Override
public ResultBody<AdDTO> ad() { public ResultBody<AdDTO> ad() {
List<AdDO> ad = webDeviceDao.ad(); List<AdDO> ad = webDeviceDao.ad();
List<AdDTO> collect = List<AdDTO> collect =
...@@ -189,9 +272,24 @@ public class WebDeviceServiceImpl implements WebDeviceService { ...@@ -189,9 +272,24 @@ public class WebDeviceServiceImpl implements WebDeviceService {
@Override @Override
public List<SkuInfoDTO> listWareSkuById(Integer id) { public List<SkuInfoDTO> listWareSkuById(Integer id) {
List<SkuInfoDO> skuInfoDOS = webDeviceDao.listSkuInfo(id); List<SkuInfoDO> skuInfoDOS = webDeviceDao.listSkuInfo(id);
return skuInfoDOS.isEmpty() ? null : skuInfoDOS.stream().map(d -> { return skuInfoDOS.isEmpty()
? null
: skuInfoDOS.stream()
.map(
d -> {
return d.buildSkuInfoDTO(); return d.buildSkuInfoDTO();
}).collect(Collectors.toList()); })
.collect(Collectors.toList());
} }
@Override
public ResultBody<ProductSpecCPQVO> getLeaseGoodsPriceDetail(
Integer productSpecId, Integer leaseTerm) {
ProductSpecCPQVO productSpecCPQVO = new ProductSpecCPQVO();
List<SpecPriceVO> specPriceList = goodsInfoDao.getPriceBySpecId(productSpecId, leaseTerm);
productSpecCPQVO.setProductSpecId(productSpecId);
productSpecCPQVO.setLeaseTerm(leaseTerm);
productSpecCPQVO.setSpecPrice(specPriceList);
return ResultBody.success(productSpecCPQVO);
}
} }
...@@ -6,9 +6,10 @@ import com.mmc.pms.entity.AdDO; ...@@ -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,8 +24,7 @@ import java.util.stream.Collectors; ...@@ -23,8 +24,7 @@ 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() {
...@@ -66,6 +66,19 @@ public class WebProductMallServiceImpl implements WebProductMallService { ...@@ -66,6 +66,19 @@ public class WebProductMallServiceImpl implements WebProductMallService {
} }
@Override @Override
public ResultBody<AdDTO> ad() {
List<AdDO> ad = webProductMallDao.ad();
List<AdDTO> collect =
ad.stream()
.map(
t -> {
return t.adDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public PageResult listPageGoodsInfo(GoodsInfoQO param) { public PageResult listPageGoodsInfo(GoodsInfoQO param) {
int count = webProductMallDao.countListGoodsInfo(param); int count = webProductMallDao.countListGoodsInfo(param);
if (count == 0) { if (count == 0) {
...@@ -84,17 +97,4 @@ public class WebProductMallServiceImpl implements WebProductMallService { ...@@ -84,17 +97,4 @@ public class WebProductMallServiceImpl implements WebProductMallService {
goodsInfo.stream().map(GoodsInfoDO::buildGoodsInfoListDTO).collect(Collectors.toList()); goodsInfo.stream().map(GoodsInfoDO::buildGoodsInfoListDTO).collect(Collectors.toList());
return PageResult.buildPage(pageNo, param.getPageSize(), count, pageList); return PageResult.buildPage(pageNo, param.getPageSize(), count, pageList);
} }
@Override
public ResultBody<AdDTO> ad() {
List<AdDO> ad = webProductMallDao.ad();
List<AdDTO> collect =
ad.stream()
.map(
t -> {
return t.adDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
} }
package com.mmc.pms.service;
import com.mmc.pms.entity.InspComtDO;
import java.util.List;
/**
* <p>
* 评论表 服务类
* </p>
*
* @author Pika
* @since 2023-06-09
*/
public interface InspComtService {
List<InspComtDO> randomGetInspComtList(Integer size);
}
package com.mmc.pms.service; 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;
...@@ -30,7 +31,8 @@ public interface ProductSkuService { ...@@ -30,7 +31,8 @@ public interface ProductSkuService {
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);
...@@ -46,4 +48,5 @@ public interface ProductSkuService { ...@@ -46,4 +48,5 @@ public interface ProductSkuService {
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;
/** /**
...@@ -31,11 +34,18 @@ public interface WebDeviceService { ...@@ -31,11 +34,18 @@ public interface WebDeviceService {
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
...@@ -13,13 +12,9 @@ public class BizException extends RuntimeException { ...@@ -13,13 +12,9 @@ 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; protected String errorMsg;
public BizException() { public BizException() {
......
package com.mmc.pms.util;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.util.UUID;
/**
* @Author small
* @Date 2023/6/12 19:36
* @Version 1.0
*/
public class XmlUtil {
public static File ossUpload(MultipartFile file) throws IOException {
// 获取文件名
String fileName = file.getOriginalFilename();
// 获取文件后缀
String prefix = fileName.substring(fileName.lastIndexOf("."));
// 用uuid作为文件名,防止生成的临时文件重复
File excelFile = File.createTempFile(UUID.randomUUID().toString(), prefix);
// MultipartFile to File
file.transferTo(excelFile);
//程序结束时,删除临时文件
return excelFile;
}
}
...@@ -15,8 +15,8 @@ spring: ...@@ -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 id = #{d} where is_deleted = 0
and is_deleted = 0 <foreach collection="list" item="d" separator="," index="index" open="and id in (" close=")">
#{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.flag,
mi.create_time createTime, mi.create_time createTime,
c.type_name typeName, c.name typeName,
su.id skuUnitId, su.id skuUnitId,
su.unit_name unitName, su.unit_name unitName,
ps.product_name productSkuName 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,8 +178,13 @@ ...@@ -178,8 +178,13 @@
<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>
is_deleted = 0
and product_id = #{id} 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,
...@@ -190,8 +195,13 @@ ...@@ -190,8 +195,13 @@
version_desc versionDesc, version_desc versionDesc,
create_time createTime create_time createTime
from product_spec from product_spec
where is_deleted = 0 <where>
is_deleted = 0
and product_id = #{productSkuId} 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>
...@@ -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 test="categoryId != null ">
and wi.ware_type_id = #{categoryId}
</if>
<if test="brandId != null ">
and wi.brand_id = #{brandId}
</if> </if>
<if test="modelId != null and modelId != '' "> <if test="userIds != null">
and wi.model_id = #{modelId} <foreach collection="userIds" item="user" index="index" open="and gi.add_goods_user_id IN (" close=")"
separator=",">
#{user}
</foreach>
</if> </if>
order by wi.create_time DESC </where>
limit #{pageNo},#{pageSize} order by gi.create_time asc
limit #{param.pageNo},#{param.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 FROM device_ad
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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论