提交 121e5a29 作者: panda

Merge remote-tracking branch 'origin/master'

......@@ -32,3 +32,4 @@ build/
### VS Code ###
.vscode/
kustomization/overlays/prod/kustomize
*.log
\ No newline at end of file
FROM openjdk:8-jdk-alpine
#VOLUME ["/tmp","/files","/var/logs/"]
VOLUME ["/var/log/app/"]
ARG JAVA_OPTS
ENV JAVA_OPTS=$JAVA_OPTS
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
......
......@@ -5,3 +5,5 @@ metadata:
namespace: default
data:
SPRING_PROFILES_ACTIVE: default
SW_AGENT_COLLECTOR_BACKEND_SERVICES: "default-oap.default:11800"
SW_AGENT_NAME: pms
......@@ -14,10 +14,14 @@ spec:
metadata:
labels:
app: pms
swck-java-agent-injected: 'true'
spec:
containers:
- name: pms
image: REGISTRY/NAMESPACE/IMAGE:TAG
volumeMounts:
- name: log-of-app
mountPath: /var/log/app
resources:
limits:
memory: 1024Mi
......@@ -29,4 +33,18 @@ spec:
valueFrom:
configMapKeyRef:
name: pms-map
key: SPRING_PROFILES_ACTIVE
\ No newline at end of file
key: SPRING_PROFILES_ACTIVE
- name: SW_AGENT_COLLECTOR_BACKEND_SERVICES
valueFrom:
configMapKeyRef:
name: pms-map
key: SW_AGENT_COLLECTOR_BACKEND_SERVICES
- name: SW_AGENT_NAME
valueFrom:
configMapKeyRef:
name: pms-map
key: SW_AGENT_NAME
volumes:
- name: log-of-app
hostPath:
path: /var/log/app
\ No newline at end of file
......@@ -18,4 +18,4 @@ patches:
images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/pms
newTag: 506594e8af493b698ecb2e75c3f5b291e2f83181
newTag: ccc7c809c80517b9c27c53b03fafcb3feefd04b6
......@@ -18,4 +18,4 @@ patches:
images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly/pms
newTag: f481d859358f8a8bfbd8b127a3c25a05fc288fa3
newTag: 5e9165eda0f547dc245accbd881d1cbdcf00f20d
......@@ -5,7 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableFeignClients
@EnableFeignClients(basePackages = "com.mmc.pms.feign")
public class PmsApplication {
public static void main(String[] args) {
......
......@@ -6,18 +6,16 @@ import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* @author: zj
* @Date: 2023/5/28 10:52
* @author: zj @Date: 2023/5/28 10:52
*/
@Configuration
public class MvcConfiguration implements WebMvcConfigurer {
@Autowired
private TokenCheckHandleInterceptor tokenCheckHandleInterceptor;
@Autowired private TokenCheckHandleInterceptor tokenCheckHandleInterceptor;
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(tokenCheckHandleInterceptor);
WebMvcConfigurer.super.addInterceptors(registry);
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(tokenCheckHandleInterceptor);
WebMvcConfigurer.super.addInterceptors(registry);
}
}
......@@ -8,16 +8,15 @@ import org.springframework.context.annotation.PropertySource;
import java.util.List;
/**
* @author: zj
* @Date: 2023/5/28 13:54
* @author: zj @Date: 2023/5/28 13:54
*/
@Data
@Configuration
@ConfigurationProperties(prefix = "data-filter", ignoreUnknownFields = false)
@PropertySource("classpath:not-check.yml")
public class NotCheckUriConfig {
// 不需要验证token的请求地址
private List<String> notAuthPath;
// 不需要验证token的请求地址;// 不需要验证token的请求地址
private List<String> uploadPath;
// 不需要验证token的请求地址
private List<String> notAuthPath;
// 不需要验证token的请求地址;// 不需要验证token的请求地址
private List<String> uploadPath;
}
package com.mmc.pms.auth;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.util.PathUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
/**
* @author: zj
* @Date: 2023/5/28 10:46
* @author: zj @Date: 2023/5/28 10:46
*/
@Slf4j
@Component
public class TokenCheckHandleInterceptor implements HandlerInterceptor {
@Autowired
private StringRedisTemplate stringRedisTemplate;
@Autowired private StringRedisTemplate stringRedisTemplate;
@Autowired
private NotCheckUriConfig notCheckUriConfig;
@Autowired private NotCheckUriConfig notCheckUriConfig;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String requestURI = request.getRequestURI();
// //根据uri确认是否要拦截
if (!shouldFilter(requestURI)) {
return true;
}
String token = request.getHeader("token");
if (StringUtils.isBlank(token)) {
exceptionProcess(response);
return false;
}
String tokenJson = stringRedisTemplate.opsForValue().get(token);
if (StringUtils.isBlank(tokenJson)) {
exceptionProcess(response);
return false;
}
//
// String serverName = request.getServerName();
// String remoteHost = request.getRemoteHost();
// log.info("hostName: {}", hostName);
// log.info("serverName: {}", serverName);
// log.info("remoteHost: {}", remoteHost);
// log.info("forwardedFor: {}", forwardedFor);
// log.info("forwardedHost: {}", forwardedHost);
// if (hostName.equals("iuav.mmcuav.cn") || hostName.equals("test.iuav.mmcuav.cn") || hostName.equals("www.iuav.shop") || hostName.equals("test.iuav.shop")){
// String token = request.getHeader("token");
// if (StringUtils.isBlank(token)){
// exceptionProcess(response);
// return false;
// }
// String tokenJson = stringRedisTemplate.opsForValue().get(token);
// if (StringUtils.isBlank(tokenJson)){
// exceptionProcess(response);
// return false;
// }
// return true;
// }
//测试-打印请求信息
return true;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
String requestURI = request.getRequestURI();
// //根据uri确认是否要拦截
if (!shouldFilter(requestURI)) {
return true;
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
String token = request.getHeader("token");
if (StringUtils.isBlank(token)) {
exceptionProcess(response);
return false;
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
String tokenJson = stringRedisTemplate.opsForValue().get(token);
if (StringUtils.isBlank(tokenJson)) {
exceptionProcess(response);
return false;
}
//
// String serverName = request.getServerName();
// String remoteHost = request.getRemoteHost();
// log.info("hostName: {}", hostName);
// log.info("serverName: {}", serverName);
// log.info("remoteHost: {}", remoteHost);
// log.info("forwardedFor: {}", forwardedFor);
// log.info("forwardedHost: {}", forwardedHost);
// if (hostName.equals("iuav.mmcuav.cn") || hostName.equals("test.iuav.mmcuav.cn") ||
// hostName.equals("www.iuav.shop") || hostName.equals("test.iuav.shop")){
// String token = request.getHeader("token");
// if (StringUtils.isBlank(token)){
// exceptionProcess(response);
// return false;
// }
// String tokenJson = stringRedisTemplate.opsForValue().get(token);
// if (StringUtils.isBlank(tokenJson)){
// exceptionProcess(response);
// return false;
// }
// return true;
// }
// 测试-打印请求信息
return true;
}
public void exceptionProcess(HttpServletResponse response) throws Exception {
response.setContentType("application/json;charset=utf-8");
PrintWriter writer = response.getWriter();
writer.write(ResultBody.error(ResultEnum.LOGIN_ACCOUNT_STATUS_ERROR).toString());
writer.close();
}
@Override
public void postHandle(
HttpServletRequest request,
HttpServletResponse response,
Object handler,
ModelAndView modelAndView)
throws Exception {}
@Override
public void afterCompletion(
HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
throws Exception {}
public void exceptionProcess(HttpServletResponse response) throws Exception {
response.setContentType("application/json;charset=utf-8");
PrintWriter writer = response.getWriter();
writer.write(ResultBody.error(ResultEnum.LOGIN_ACCOUNT_STATUS_ERROR).toString());
writer.close();
}
private boolean shouldFilter(String path) {
// 路径与配置的相匹配,则执行过滤
for (String pathPattern : notCheckUriConfig.getNotAuthPath()) {
if (PathUtil.isPathMatch(pathPattern, path)) {
// 如果匹配
return false;
}
}
return true;
private boolean shouldFilter(String path) {
// 路径与配置的相匹配,则执行过滤
for (String pathPattern : notCheckUriConfig.getNotAuthPath()) {
if (PathUtil.isPathMatch(pathPattern, path)) {
// 如果匹配
return false;
}
}
return true;
}
}
package com.mmc.pms.auth.dto;
import com.mmc.pms.common.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @author: zj
* @Date: 2023/5/25 13:32
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BUserAccountQO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "关键字", required = false)
private String keyword;
@ApiModelProperty(value = "地区", required = false)
private String area;
@ApiModelProperty(value = "省份编码", required = false)
private Integer provinceCode;
@ApiModelProperty(value = "城市编码", required = false)
private Integer cityCode;
@ApiModelProperty(value = "县区编码", required = false)
private Integer districtCode;
@ApiModelProperty(value = "角色id", required = false)
private Integer roleId;
@ApiModelProperty(value = "账号状态:0禁用 1可用")
private Integer accountStatus;
@ApiModelProperty(value = "账号状态:0合伙人 1员工")
private Integer userType;
@ApiModelProperty(value = "用户id集合")
private List<Integer> userIds;
@ApiModelProperty(value = "推荐单位id")
private Integer rcdCompanyId;
@ApiModelProperty(value = "单位集合", hidden = true)
private List<Integer> companys;
@ApiModelProperty(value = "页码", required = true)
@NotNull(message = "页码不能为空", groups = Page.class)
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true)
@NotNull(message = "每页显示数不能为空", groups = Page.class)
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
}
......@@ -7,24 +7,24 @@ import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author 作者 geDuo
* @version 创建时间:2021年8月31日 下午8:06:14
* @explain 类说明
*/
/**
* @author 作者 geDuo
* @version 创建时间:2021年8月31日 下午8:06:14
* @explain 类说明
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LoginSuccessDTO implements Serializable {
private static final long serialVersionUID = -1200834589953161925L;
private String token;
private Integer userAccountId;
private String accountNo;
private Integer portType;
private String uid;
private String phoneNum;
private String userName;
private String nickName;
// private RoleInfoDTO roleInfo;
private static final long serialVersionUID = -1200834589953161925L;
private String token;
private Integer userAccountId;
private String accountNo;
private Integer portType;
private String uid;
private String phoneNum;
private String userName;
private String nickName;
// 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;
/**
* @Author small
* @Date 2023/5/15 14:30
* @Version 1.0
* @Author small @Date 2023/5/15 14:30 @Version 1.0
*/
public enum ResultEnum implements BaseErrorInfoInterface {
// 数据操作错误定义
SUCCESS("200", "success"), BODY_NOT_MATCH("400", "请求的数据格式不符!"), SIGNATURE_NOT_MATCH("401", "请求的数字签名不匹配!"),
NOT_FOUND("404", "未找到该资源!"), INTERNAL_SERVER_ERROR("500", "服务器内部错误!"), 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不是最新的"),
SCHEDULE_SYS_ERROR("703", "系统定时任务执行错误"),
FORM_REPEAT_ERROR("704", "操作次数频繁,请稍后重试"), DATA_VERSION_ERROR("705", "数据写入版本不一致,请稍后重试。"),
REQUEST_PARAM_ILLEGAL_ERROR("706", "请求参数非法"),
DATA_INSERT_ERROR("707", "数据插入失败"),
SCORE_RELEASE_ERROR("708", "积分发放失败,请重试或联系管理员!"),
ENTRY_INTO_FORCE_TIME_SET_ERROR("709", "生效时间不能小于当前时间!"),
INFO_NO_EXISTENCE_OR_STATUS_ERROR("710", "信息不存在或状态有误!"),
// 业务操作错误定义
CUSTOM_ERROR("-1", "自定义业务错误消息"),
FEIGN_ORDER_SERVLET_ERROR("4001", "访问订单服务失败"), FEIGN_USER_SERVLET_ERROR("4002", "访问用户服务失败"),
FEIGN_PAY_SERVLET_ERROR("4003", "访问消耗服务失败"),
DISABLE_ACCOUNT_TOKEN_ERROR("4004", "账号信息变更,登录失效"),
FEIGN_OPERATION_SERVLET_ERROR("4005", "访问行业服务失败"),
ADMIN_ROLE_REPEAT_ERROR("4006", "操作失败,超级管理员和运营管理员有且只有一个"),
FEIGN_FLYER_SERVLET_ERROR("4007", "访问飞手服务失败"),
FEIGN_REPOORDER_SERVLET_ERROR("4008", "访问订单服务失败"),
FEIGN_REPOPAY_SERVLET_ERROR("4009", "访问云仓消耗服务失败"),
FEIGN_REPOUSER_SERVLET_ERROR("4010", "访问云仓用户服务失败"),
FEIGN_WARE_SERVLET_ERROR("4010", "访问云仓商品服务失败"),
FEIGN_DEVICE_SERVLET_ERROR("4011", "访问云仓设备服务失败"),
CENTER_USER_SERVLET_ERROR("4012", "访问用户中心服务失败"), GATEWAY_HYSRIX_ERROR("4013", "服务器貌似在开小差~"),
FEIGN_FLYER_PAY_SERVLET_ERROR("4014", "访问飞手消耗服务失败"),
MALL_USER_SERVLET_ERROR("4015", "访问机城用户服务失败"),
PRIMARY_KEY_DEFECT("5001", "主键ID缺失"),
WALLET_NOT_FIND_ERROR("5002", "钱包账户不存在"),
PARAM_DEFECT("5004", "参数缺失"),
LOGIN_ACCOUNT_NOT_EXIT_ERROR("5005", "账号不存在"),
LOGIN_PASSWORD_ERROR("5006", "密码错误"),
LOGIN_ACCOUNT_STATUS_ERROR("5008", "外部访问"),
OPERATE_USER_ORDERCOUNT_ERROR("5007", "当前账号有存在相关订单未关闭"),
WALLET_CASH_NOT_ENOUGH_ERROR("5009", "现金余额不足"),
AMT_PAID_VERITY_ERROR("5010", "变更额度不在有效范围"),
CREDIT_NOT_ENOUGH_ERROR("5011", "信用余额不足,当前信用余额:"),
CREDIT_METHOD_ERROR("5012", "变更类型有误"),
CREDIT_OWED_BEGGER_ERROR("5013", "归还额度不可超过剩余欠款,当前剩余欠款:"),
CASH_ADD_OWED_ERROR("5014", "该账号仍有剩余欠款,请先将全部欠款归还后,再进行充值。"),
WALLET_CREDIT_NOT_ENOUGH_ERROR("5015", "信用余额不足"),
ORDER_PAY_FORMAT_ERROR("5016", "现金和信用金额不能同时为空"),
WALLET_CASH_FREEZE_NOT_ENOUGH_ERROR("5017", "现金的冻结余额不足"),
WALLET_CREDIT_FREEZE_NOT_ENOUGH_ERROR("5018", "信用的冻结余额不足"),
ORDER_CASH_FREEZE_NOT_FIND_ERROR("5019", "现金的冻结余额不存在"),
ORDER_CREDIT_FREEZE_NOT_FIND_ERROR("5019", "信用的冻结余额不存在"),
WALLET_BANLANCE_NOT_ENOUGH_ERROR("5020", "现金和信用的余额不足"),
WALLET_FREEZE_NOT_ENOUGH_ERROR("5020", "现金和信用的冻结余额不足"),
CREDIT_REPEAT_NULL_ERROR("5021", "欠款归还不能为空"),
CREDIT_CHANGE_NULL_ERROR("5021", "信用余额变更不能为空"),
ORDER_TOTAL_COST_ERROR("5022", "结算金额不能大于预支付的金额"),
ORDER_PAY_NOT_ENOUGH_ERROR("5023", "总余额不足,订单无法结算"),
NOT_MENU_POWER_ERROR("5024", "当前账号无平台使用权限"),
OPENID_NOT_FIND_ERROR("5025", "OPENID未注册,请登录授权后调用"),
PASSWORD_INCONSISTENT("5026", "新密码与确认密码不一致,请确认一致"),
WX_ACCESS_TOKEN_ERROR("5027", "获取微信AccessToken失败"),
WX_NOT_REL_ERROR("5028", "获取微信公众号用户信息失败"),
WX_NOT_SEND_MSG_PARAM_ERROR("5029", "userId和openId至少一个不为空"),
APPLET_QR_CODE_CREATE_ERROR("5030", "生成小程序码错误:"),
APPLET_USER_ACCESS_TOKE_ERROR("5031", "获取accessToken签名校验失败"),
REBATE_AMT_NOT_MIN_ERROR("5032", "金额不足300元无法提现,300元为最低门槛"),
REBATE_AMT_NOT_ENOUGH_ERROR("5033", "申请失败,超过可提现的金额"),
BANK_INFO_NOT_SAVE_ERROR("5034", "请先完善收款账号,才可以申请提现"),
REBATE_APPLY_STATUS_ERROR("5035", "提现状态有误"),
REBATE_INFO_NOT_FIND_ERROR("5036", "提现申请单信息不存在"),
REBATE_FAIL_EXIT_ERROR("5037", "你的收款账号信息有误,请修改信息后重新申请提现。"),
REBATE_AMT_FORMAT_ERROR("5038", "提现金额必须大于0元"),
REBATE_REPEAT_CHECK_ERROR("5039", "提现申请单已被审批,切勿重复审批。"),
CHOOSE_FLYER_NUM_ERROR("5040", "请至少选中一个飞手。"),
CHOOSE_FLYER_MORE_NUM_ERROR("5041", "暂只支持一个订单只能指派一个飞手。"),
ORDER_NO_EXIT_ERROR("5042", "订单信息不存在。"),
ORDER_STATUS_ERROR("5043", "订单状态流程有误。"),
INTERFACE_NOT_INVAILD("5044", "接口已废弃或不存在"),
PAPER_CODE_NOT_INVAILD("5045", "接口已废弃或不存在"),
PHONE_INVAILD_ERROR("5046", "无效的手机号"),
TIME_CODE_INVAILD_ERROR("5047", "无效的时间编码"),
REPEACT_COMMIT_ERROR("5048", "已提交,切勿重复提交"),
IMPORT_EXCEL_ERROR("5049", "excel导入失败"),
REQ_SMS_CODE_ERROR("5050", "注册码格式有误"),
SKU_NOT_PRICE_ERROR("5051", "当前SKU未配置价格"),
SKU_NOT_ENOUGH_ERROR("5052", "套餐(sku)数量不足"),
LEASE_DATE_MATH_ERROR("5053", "租期开始日不能大于结束日"),
ADD_LEASE_ADDR_ERROR("5054", "请选择收货方式"),
SHOP_NEED_PHONE_ERROR("5055", "门店自取需要您的联系电话,请填写联系电话"),
ORDER_POWER_ERROR("5056", "订单不存在或你无权操作该订单"),
ORDER_AUTH_ERROR("5057", "请完成认证再下单"),
EXPRESS_RETURN_ERROR("5058", "请完善物流单号和物流公司"),
SHOP_RETURN_ERROR("5059", "请选择门店"),
ORDER_REFUND_EXIT_ERROR("5060", "该订单已提交过退款申请,请勿重复申请。"),
ORDER_EXPRESS_ERROR("5061", "获取订单物流信息有误。"),
ORDER_PAY_JOB_ERROR("5062", "执行定时任务有误"),
NO_AUTH_ORDER_ERROR("5063", "请完成企业认证或实名认证后再进行下单"),
WARE_NOT_ENOUGH_ERROR("5064", "商品数量不足"),
EX_INFO_ERROR("5065", "物流信息不完善"),
NOT_REAL_AUTH_ERROR("5066", "请完成实名认证后再进行操作"),
REBATE_NOT_ENOUGH_ERROR("5067", "提现申请金额需在10至8000元范围之内"),
MORE_THAN_LIMIT_ERROR("5067", "提现申请金额需在0.1至98000元范围之内"),
FLYER_ENT_MORE_THAN_LIMIT_ERROR("50670", "飞手机构用户银行卡单笔最低10元,最高100,000元"),
FLYER_MORE_THAN_LIMIT_ERROR("50671", "飞手个人用户银行卡单笔最低10元,最高5,000元"),
MORE_THAN_LIMIT_TODAY_ERROR("50672", "单个账户每月提现额度为100,000元"),
SYSTEM_AMT_NOT_ENOUGH_ERROR("5068", "系统处理中,请稍后再试。"),
FEIGN_XZH_SERVLET_ERROR("5069", "访问线上支付接口服务失败"),
XZH_SERVLET_ERROR("5070", "调用线上支付失败:"),
XZH_FAIL_ERROR("5071", "支付服务失败:"),
REFUSE_COUNT_ERROR("5072", "今日拒绝的次数已达上限,暂不可参与抢单"),
APPLY_ORDER_COUNT_ERROR("5073", "请勿重复接单"),
ORDER_ARRIVE_ERROR("5074", "抢单失败,订单已被指派"),
REST_APPLY_ORDER_ERROR("5075", "请先开启接单状态后再进行抢单"),
EVALUATED_ERROR("5076", "您已经评价过啦!"),
BACKET_TYPE_ERROR("5077", "红包类型有误"),
BACKET_NOT_ENOUGH_ERROR("5078", "红包已被抢光"),
USER_PHONE_AUTH_ERROR("5079", "请授权登录后领取"),
TOKEN_REQUIRED_ERROR("5080", "Please bring a token"),
UNIONID_NOT_ERROR("5081", "UnionId不能为空"),
OPENID_NOT_ERROR("5081", "云享飞openid、云飞手openid、云仓openid、无人机城openid至少要有一个"),
NO_EVALUATED_ERROR("5090", "暂无评价信息!"),
DAY_NUM_ERROR("5091", "天数有误"),
TASK_TYPE_ERROR("5092", "您的账号类型为个人飞手,只能抢任务人数1人的订单。"),
TASK_FLYER_COUNT_LESS_ERROR("5093", "机构认证的飞手多于任务需要的飞手才可以抢单。"),
FLYER_REBATE_ERROR("5094", "提现失败,请稍后重试"),
OPERATION_SYS_ERROR("5095", "操作失败,请稍后重试"),
WAG_CHECK_STATUS_ERROR("5096", "操作失败,未通过或待确认状态才能进行重新编辑"),
EXPORT_NO_DATA_ERROR("5097", "查询到当前符合条件的数据为0条"),
WAG_ZERO_ERROR("5098", "工资抵扣后当月工资不能少于0元"),
WAG_REPEAT_DATE_ERROR("5099", "操作失败,工资日期重复:"),
BUY_NUM_ERROR("5100", "购买数量必须大于0"),
SHOP_CAR_ERROR("5101", "购物车信息不存在"),
GOODS_VERSION_ERROR("5102", "操作失败,当前商品已经发生信息变更,请刷新后重试"),
WAG_DETAIL_COUNT_ERROR("5103", "账单天数必须大于0"),
WAG_TERM_PARAM_ERROR("5104", "飞手工资、结算基数、操作三个选项必须填一个"),
IMPORT_PARAM_ERROR("5105", "导入的数据行不能为空或者格式错误"),
SHOP_GOODS_NOT_ERROR("5106", "当前商品已下架或已删除"),
ALL_PAY_ERROR("5107", "当前订单为分期付款,请先上传尾款凭证"),
FLYER_EVLT_PARAM_ERROR("5108", "飞手评分参数有误,请检查"),
FLYER_REPEAT_BIND_ERROR("5108", "飞手已被绑定过,请勿重复绑定"),
FLYER_NUM_BIND_ERROR("5108", "飞手数量有误,本任务需要的飞手人数为:"),
FLYER_ORDER_TYPE_ERROR("5110", "飞手类型有误,该订单只允许个人飞手接单"),
FLYER_ENT_ORDER_TYPE_ERROR("5111", "飞手类型有误,该订单只允许飞手机构接单"),
PHONE_NUM_EXIT_ERROR("5112", "手机号已存在"),
FLYER_UN_BIND_ERROR("5113", "飞手已被解绑,请勿重复解绑"),
REPEAT_NOTIFICATION("5114", "您已对此订单进行过催付款操作"),
FLYER_WORK_ERROR("5115", "指派飞手失败,飞手休息中:"),
DISABLE_APPLY_ORDER_ERROR("5116", "当前时间此订单不可抢"),
COMPANY_EXIT_ERROR("5117", "单位名称已存在"),
COMPANY_NOT_BIND_ERROR("5118", "未绑定单位,请先绑定单位"),
COMPANY_REMOVE_ERROR("5119", "删除失败,请先移除该单位的账号信息"),
COMPANY_REMOVE_CHILD_ERROR("5120", "删除失败,请先移除该单位的子级单位"),
EXIST_THE_SAME_GOODS_ERROR("5121", "购物车已存在您选择的商品"),
// clientOAuth
OAUTH_CLIENT_NOT_FOUND("6404", "client_id不存在或已注销"),
OAUTH_SECRET_ERROR("6405", "client_secret有误"),
OAUTH_AUTHORIZE_ERROR("6406", "当前账号未获得任何授权,请确认"),
OAUTH_API_AUTH_ERROR("6407", "当前资源未被授权"),
OAUTH_CREATE_TOKEN_ERROR("6408", "系统内部错误,获取accessToken失败,"),
PWD_CREATE_ERROR("6001", "创建密码失败"),
PWD_CONPARED_ERROR("6002", "密码错误"), PWD_ALERT_ERROR("6003", "密码不一致"),
PWD_REQUEST_AUTH_ERROR("6003", "密码请求验证"),
APPLET_PORT_TYPE_ERROR("7001", "小程序端口类型错误"),
APPLET_GET_OPENID_ERROR("7002", "获取小程序openid失败"),
UPDATE_USER_ACCOUNT_REPEAT("7003", "修改后的账户名已存在"), ADD_USER_ACCOUNT_NAME_EXISTS("7004", "新增账户名已经存在"),
ACCOUNT_NOT_FIND_ERROR("8000", "账号信息不存在"),
REPEAT_SOFT_DELETE("8001", "账号已删除"),
ADMIN_ROLE_DELETE_ERROR("8002", "此账号为管理员账号,禁止删除"),
ROLE_ADMIN_DELETE_ERROR("8003", "此角色为管理员角色,禁止删除"),
ROLE_NAME_REPEAT_ERROR("8004", "角色名已存在"),
ROLE_AVL_USER_DELETE_ERROR("8005", "此角色尚有可用账号,请将所有账号移除后在进行操作"),
ROLE_AVL_USER_STATUS_ERROR("8006", "此角色尚有可用账号,请将所有账号禁用后在进行操作"),
ROLE_SYSTEM_DELETE_ERROR("8007", "此角色为系统角色,禁止删除"),
ADMIN_ROLE_POWER_ERROR("8008", "禁止修改管理类角色权限"), SYSTEM_ROLE_POWER_ERROR("8009", "禁止修改系统类角色权限"),
ROLE_SELF_POWER_ERROR("8010", "禁止修改与当前登录账号角色相同的角色权限"),
ADMIN_ACCOUNT_DISABLE_ERROR("8011", "此账号为管理员账号,禁用失败"),
OPERATE_USER_DEL_ERROR("8012", "该账号仍有进行中的订单需要负责,请先移交订单后再删除。"),
OPERATE_USER_DISABLED_ERROR("8013", "该账号仍有进行中的订单需要负责,请先移交订单后再禁用。"),
DELETE_USER_UNFILLED_ORDER_EXIST("9001", "平台中有此账号相关的订单,不可删除此账号"),
STOP_UNFILLED_ORDER_EXIST("9002", "平台中有此账号相关的订单正在进行中,不可停用此账号"),
ACCOUNT_ALREADY_DELETED("10001", "此账号已经被删除"),
ACCOUNT_ALREADY_STOP("10002", "此账号已经被停用,不能登录此小程序,详情请联系管理员"),
INDUSTRY_NAME_CREATE_ERROR("20001", "行业名称请勿重复,请重新输入"),
INSPECTION_NAME_CREATE_ERROR("20002", "服务名称请勿重复,请重新输入"),
INSPECTION_REPEAT("20003", "绑定服务重复"),
INDUSTRY_REPEAT("20004", "绑定行业重复"),
INSERT_INDUSTRY_SUCCESS("20005", "新增行业成功"),
UPDATE_INDUSTRY_SUCCESS("20006", "修改行业成功"),
DELETE_INDUSTRY_SUCCESS("20007", "删除行业成功"),
INSERT_INSPECTION_SUCCESS("20008", "新增服务成功"),
UPDATE_INSPECTION_SUCCESS("20009", "修改服务成功"),
DELETE_INSPECTION_SUCCESS("20010", "删除服务成功"),
SORT_PARAMETER_ERROR("28199", "排序参数错误"),
OPRATING_FREQUENCY_TOO_HIGH("28449", "更新频率过快,请重试"),
INSERT_INDUSTRY_INSPECTION_SUCCESS("20011", "添加对应服务成功"),
INSERT_INSPECTION_INDUSTRY_SUCCESS("20012", "添加对应行业成功"),
DELETE_INDUSTRY_INSPECTION_SUCCESS("20013", "删除对应服务成功"),
DELETE_INSPECTION_INDUSTRY_SUCCESS("20014", "删除对应行业成功"),
INSERT_INDUSTRY_SHELF_SUCCESS("20015", "行业上架成功"),
DELETE_INDUSTRY_SHELF_SUCCESS("20016", "行业下架成功"),
INSERT_INSPECTION_SHELF_SUCCESS("20017", "服务上架成功"),
DELETE_INSPECTION_SHELF_SUCCESS("20018", "服务下架成功"),
DELETE_INSPECTION_ERROR("20022", "该服务仍有未完成的订单,不可删除"),
INSPECTION_NOT_EXIST("20023", "很抱歉,目前该服务已下架"),
FAKE_NUM_CREATE_ERROR("20024", "输入的数据有误,请重新输入!"),
WORK_TYPE_NAME_ERROR("20026", "服务作业类型重复,请重新输入"),
EXIST_BINDING_INSPECTION_ERROR("20027", "此作业类型被服务绑定,删除失败!"),
UPLOAD_IMG_ERROR("20019", "请选择jpg,png,jpeg格式的图片"),
UPLOAD_VIDEO_ERROR("20020", "请选择MP4,avi,mov,mkv格式的视频"),
UPLOAD_DOC_ERROR("20021", "请选择doc,ppt,pdf,xls格式的文件"),
UPLOAD_IMG_LESS_3M_ERROR("20022", "请上传小于3M的图片"),
INSERT_ORDER_SUCCESS("21000", "新增订单成功"),
UPDATE_ORDER_SUCCESS("21001", "修改订单成功"),
ORDER_TRANS_SUCCESS("21002", "订单移交成功"),
ORDER_EVALUATE_SUCCESS("21003", "订单评价完成"),
ORDER_BEFORE_PAY_ERROR("21004", "订单预支付失败"),
ORDER_CLOSE_PAY_ERROR("21005", "订单结算支付失败"),
INSERT_ORDER_DETAIL_SUCCESS("21006", "新增订单动态成功"),
CHECK_USER_ERROR("22001", "用户未通过验证"),
GET_ORDER_LIST_ERROR("22002", "获取订单列表失败"),
COMMANT_CAR_NAME_EXIST("22003", "指挥车名字已存在,请重新输入"),
//认证提示
APP_CODE_ERROR("30301", "appcode 错误"),
REQUE_ENVIROMENT_ERROR("30302", "请求的 Method、Path 或者环境错误"),
REQUEST_PARAMETER_ERROR("30303", "请求参数错误"),
SERVICE_NOT_AUTHORIZED("30304", "服务未被授权(或URL和Path不正确)"),
TIMES_USED_UP("30305", "很抱歉,目前我们的实名认证次数已达上限,正在处理中,请稍后再进行认证。"),
OTHER_ERROR("30306", "其他错误/服务次数用完"),
LIVE_AUTHENTICATION_FAILED("3824", "活体认证失败"),
ID_INFO_AND_ID_card_MISMATCH("3904", "身份信息与身份证不匹配"),
LIVE_AUTHENTICATION_SUCESS("3999", "活体验证成功"),
NO_REAL_NAME("3854", "用户未实名认证"),
URL_FORMAT_ERROR("37462", "URL格式错误"),
URL_ADDRESS_ERROR("36752", "URL地址错误"),
INTERFACE_ACCESS_EXCEPTION("36894", "接口访问异常/次数用尽"),
FRONT_BACK_VAGUE("35556", "身份证正反面不明确"),
ID_CARD_THOTO_MESSAGE_ERROR("36651", "身份照信息错误"),
EXPTION_ID_CARD_THOTO_MESSAGE_ERROR("36651", "信息异常"),
PHOTO_FORMAT_ERROR("12138", "身份证图片格式错误"),
VALIDATION_INFO_EXPIRED("32815", "认证时间过长信息过期或认证信息不完整,请重新开始认证"),
REAL_IMAGE_AUTHENTICATION_SUCESS("38844", "验证成功"),
REAL_IMAGE_AUTHENTICATION_FAILED("38855", "验证失败,请再次进行人脸识别"),
IDENTITY_HAS_BEEN_AUTHENTICATED("34444", "此身份证信息已经被认证,请重试"),
REAL_NAME_ACCOUNT_ID_ERROR("36771", "账户id错误"),
REAL_NAME_FUSING_ERROR("36772", "认证失败,请重新认证"),
//企业认证
BUSINESS_LICENSE_CHECK_ANALYSIS_ERROR("30400", "营业执照解析失败,请上传有效清晰的执照"),
BUSINESS_LICENSE_CHECK_PARAMETER_ERROR("30401", "企业信息与营业执照信息不一致,请重新上传"),
BANK_ACCOUNT_CHECK1_ERROR("30402", "账号与开户名不符"),
BANK_ACCOUNT_CHECK2_ERROR("30403", "开户行名称错误"),
BANK_ACCOUNT_CHECK3_ERROR("30404", "仅支持对公账户验证,不支持个人卡"),
BANK_ACCOUNT_CHECK4_ERROR("30405", "企业账号信息有误,请重新输入"),
BANK_ACCOUNT_CHECK5_ERROR("30406", "24小时之内不能重复申请"),
BANK_ACCOUNT_CHECK6_ERROR("30407", "很抱歉,目前我们的企业认证次数已达上限,如需继续认证请及时联系相关负责人进行处理,联系方式:科比特管理人员,18938853647。"),
BANK_ACCOUNT_CHECK7_ERROR("30408", "企业名称与开户名称不一致,请确认一致后再提交认证"),
ENTERPRISE_HAVE_VERIFIED("30409", "您输入的企业信息已被其他用户认证,请重新输入"),
ID_NUMBER_PARA_ERROR("30410", "身份证号码有错,请重新输入"),
DEAL_ERROR("30411", "有报错,请联系平台客服。"),
NOT_DATA_ERROR("30412", "查无数据"),
API_STOP_USE_ERROR("30413", "接口停用"),
OFFICE_DATA_SUSTAIN_ERROR("30414", "官方数据源维护,请稍候再试"),
SERVER_SUSTAIN_ERROR("30415", "服务商维护,请稍候再试"),
PARA_ERROR("30416", "参数错误,请重新输入"),
VERIFY_COUNT_ERROR("30416", "认证次数上限,请联系管理员"),
NOT_ENT_VERIFY_ERROR("30417", "机构未认证或认证未通过,请先进行机构认证"),
NOT__VERIFY_ERROR("30418", "机构未认证或飞手认证未通过,请先进行认证"),
//渠道认证
NOT_ENT_USER("30501", "感谢您有意向成为我们的渠道商,请先完成企业认证。"),
NEW_NOT_ENT_USER("30502", "此用户未进行企业认证,渠道变更失败!"),
BEFORE_NOT_CHANNEL_USER("30503", "此用户还不是渠道"),
//飞手端认证
NOT_AUTH_FLYER_ERROR("30600", "飞手未认证,请先完成飞手认证"),
NOT_HAVE_AUTH_FLYER_ERROR("30601", "没有认证的飞手,暂不可接单"),
//设备型号提醒
DEVICE_MODEL_REPEAT_ERROR("30700", "产品名称不可重复,请重新输入"),
DEVICE_MODEL_FAILURE_ERROR("30701", "设备添加失败"),
DEVICE_MODEL_REMOVE_ERROR("30702", "设备未在仓库,删除失败"),
DEVICE_MODEL_UPDATE_ERROR("30703", "设备修改失败"),
DEVICE_HAS_BEEN_RENT_ERROR("30704", "该设备不在仓库,不能出库"),
//仓库提醒
REPO_INFO_NAME("30800", "仓库名称不可重复,请重新输入"),
REPO_INFO_FAILURE("30801", "仓库添加失败"),
REPO_INFO_REMOVE("30702", "仓库删除失败"),
//商品
WARE_NAME_HAS_BEEN_EXIST("30900", "商品名称已存在"),
WARE_TYPE_NAME_HAS_BEEN_EXIST("30901", "分类名称已存在"),
WARE_TYPE_ICON_NOT_NULL("30902", "一级分类图标不能为空"),
GROUP_DONT_DELETE("30903", "该分类下尚有商品存在"),
GOODS_STATUS_ERROR("30904", "状态有误"),
GOODS_ON_SHELF_SUCCESS("30905", "商品上架成功"),
GOODS_DOWN_SHELF_SUCCESS("30906", "商品下架成功"),
GOODS_SKU_IS_NOT_NULL("30907", "商品规格不能为空"),
GOODS_PIC_IS_NOT_NULL("30908", "主图不能为空"),
GOODS_DESC_IS_NOT_NULL("30910", "商品描述不能为空"),
GOODS_GROUP_IS_NOT_NULL("30911", "商品类型不能为空"),
GROUP_DONT_DELETE_BY_CHILD("30912", "该分类下尚有子分类存在"),
GOODS_NOT_EXIST_OR_ALREADY_DOWN_SHELF("30913", "商品不存在或已下架"),
GOODS_NAME_IS_NOT_NULL("30914", "商品名称不能为空或名字长度不能大于60"),
GOODS_DELETE_FAIL("30915", "批量删除商品失败,商品已被其他商品绑定"),
BRAND_DELETE_FAIL("30916", "删除失败,产品管理中有产品绑定该品牌名称"),
//返祖
RETURN_SHARE_ORDER_ERROR("40000", "设备返祖订单相关信息找不到,请重新输入订单号"),
RETURN_SHARE_ORDER_NOT_FINISH_ERROR("40001", "此设备的订单未完成,请添加其他设备"),
RETURN_SHARE_ORDER_HAS_BEEN_ADD_ERROR("40002", "此订单的设备已经被添加过,不能重复添加"),
//宣传中心
EXIST_SAME_NAME_OF_MODULE_ERROR("40500", "所属产品中不能有相同名字的模块"),
EXIST_SAME_NAME_OF_BANNER_ERROR("40501", "名称重复,请重新输入"),
EXIST_SAME_CODE_OF_MODULE_ERROR("40502", "moduleCode已重复,请输入其他moduleCode"),
HAS_BEEN_USE_ERROR("40503", "此标签有用户在使用,不能删除!"),
FILE_PARSE_ERROR("40600", "上传文件无数据或内容识别失败,请重新上传"),
HAS_BEEN_APPLY_ERROR("40601", "已提交申请!将有客服人员与你联系"),
PRICE_TO_HIGH_ERROR("40602", "标价确认在0-10000000万元内"),
EXIST_SAME_NAME_ERROR("40603", "快讯名称重复,请重新上传"),
TENDER_FORMAT_ERROR("40604", "招标序号或内容不能为空,请补全后上传"),
TENDER_CONTENT_TOO_LONG_ERROR("40605", "存在招标内容字符过长"),
GOODS_CATEGORY_NAME_EXIST_ERROR("40605", "名称重复,请重新输入!"),
CONTRACT_STATUS_MISTAKEN("40607", "当前合同状态不可进行编辑!"),
CONTRACT_STATUS_CANNOT_BE_DELETED("40607", "当前合同状态不可进行删除!"),
CONTRACT_NOT_EXIST("40608", "合同不存在或已删除!"),
CONTRACT_STATUS_DOES_NOT_ALLOW_FILE("40609", "该状态合同不允许归档!"),
SEAL_INFO_NOT_EXIST("40610", "请前往印章管理上传印章或设置默认印章!"),
AGENCY_NO_FLYER("40611", "机构下暂无飞手,快去招募吧~"),
NO_FLYER_WORK("40612", "现在没有飞手上班哦~"),
TEMPORARY_NOT_SUPPORT_TRANSFER_ORDER("40613", "个人订单暂不支持转单操作~"),
ELECTRONIC_SIGNATURE_NOT_REAL_NAME_AUTHENTICATION("40614", "请完成电子签约实名认证后再进行操作"),
DIRECTORY_DOES_NOT_EXIST("40615", "目录不存在或已删除"),
DEFAULT_DIRECTORY_CANNOT_BE_DEL("40616", "默认目录不可删除"),
THERE_ARE_CATEGORIES_IN_THE_DIRECTORY("40167", "该目录下有分类存在不可删除"),
DIRECTORY_NAME_HAS_BEEN_EXIST("40168", "目录名称已存在"),
FAILED_TO_ADD_DATA("40169", "数据新增失败,请稍后重试"),
FAILED_TO_EDIT_DATA("40170", "数据修改失败,请稍后重试"),
SKU_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED("40171", "sku不存在或已删除,请刷新后重试!"),
SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED("40172", "规格不存在或已删除,请刷新后重试!"),
SKU_ALREADY_EXIST_IN_THIS_INDUSTRY("40173", "该所属行业下已经存在sku,请检查后重试!"),
SPEC_EXIST_UNDER_THE_SKU("40174", "该sku下有规格存在,无法删除!"),
SPEC_NOT_CONFIG_PRICE("40175", "存在规格没有配置价格,请联系客服获取报价!"),
SHOP_CAR_SIZE_MORE_2("40176", "行业购物车下单数量仅限一个"),
CONTRACT_TEMPLATE_NOT_EXIST_OR_DELETED("40177", "合同模板不存在或已删除!"),
SCORE_ERROR("40177", "您输入的积分数量有误,请重新输入!"),
PLEASE_FILL_IN_THE_CONTRACT_TEMPLATE_FIRST("40178", "请先填充合同模板!"),
SCORE_NOT_GIVE_MYSELF("40179","积分不能转赠给本人,请重新操作"),
ALREADY_FINISH_ENT_AUTH_ERROR("2000", "助力已完成!"),
SYSTEM_ERROR ("2001","系统错误,请稍后重试") ,
RULE_ERROR ("2002","当前兑换比例已失效,请刷新后重试"),
COUNT_LIMIT_ERROR("2003", "参与次数已达上线"),
ALREADY_ENT_AUTH_ERROR("2004","助力失败,您已完成企业认证!"),
ALREADY_REAL_NAME_AUTH_ERROR("2005","助力失败,您已完成实名认证!"),
PARTICIPATE_BUT_NOT_AUTH_ERROR("2006", "待完成授权或认证"),
ALREADY_HELP_ERROR("2007", "已助力"),
ALREADY_STOP_ERROR("2008", "活动已下线"),
HELP_FAIL_ERROR("2009", "不能给自己助力哦!"),
ALREADY_BINDING_ERROR("2010", "优惠券已被绑定"),
ALREADY_DIVIDE_ERROR("2011", "订单已分成"),
DIVIDE_OBJ_NOT_EXIST("2012", "先点击确认添加分成对象");
/**
* 错误码
*
* @return
*/
String resultCode;
/**
* 错误描述
*
* @return
*/
String resultMsg;
ResultEnum(String resultCode, String resultMsg) {
this.resultCode = resultCode;
this.resultMsg = resultMsg;
}
@Override
public String getResultCode() {
return resultCode;
}
@Override
public String getResultMsg() {
return resultMsg;
}
// 数据操作错误定义
SUCCESS("200", "success"),
BODY_NOT_MATCH("400", "请求的数据格式不符!"),
SIGNATURE_NOT_MATCH("401", "请求的数字签名不匹配!"),
NOT_FOUND("404", "未找到该资源!"),
INTERNAL_SERVER_ERROR("500", "服务器内部错误!"),
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不是最新的"),
SCHEDULE_SYS_ERROR("703", "系统定时任务执行错误"),
FORM_REPEAT_ERROR("704", "操作次数频繁,请稍后重试"),
DATA_VERSION_ERROR("705", "数据写入版本不一致,请稍后重试。"),
REQUEST_PARAM_ILLEGAL_ERROR("706", "请求参数非法"),
DATA_INSERT_ERROR("707", "数据插入失败"),
SCORE_RELEASE_ERROR("708", "积分发放失败,请重试或联系管理员!"),
ENTRY_INTO_FORCE_TIME_SET_ERROR("709", "生效时间不能小于当前时间!"),
INFO_NO_EXISTENCE_OR_STATUS_ERROR("710", "信息不存在或状态有误!"),
// 业务操作错误定义
CUSTOM_ERROR("-1", "自定义业务错误消息"),
FEIGN_ORDER_SERVLET_ERROR("4001", "访问订单服务失败"),
FEIGN_USER_SERVLET_ERROR("4002", "访问用户服务失败"),
FEIGN_PAY_SERVLET_ERROR("4003", "访问消耗服务失败"),
DISABLE_ACCOUNT_TOKEN_ERROR("4004", "账号信息变更,登录失效"),
FEIGN_OPERATION_SERVLET_ERROR("4005", "访问行业服务失败"),
ADMIN_ROLE_REPEAT_ERROR("4006", "操作失败,超级管理员和运营管理员有且只有一个"),
FEIGN_FLYER_SERVLET_ERROR("4007", "访问飞手服务失败"),
FEIGN_REPOORDER_SERVLET_ERROR("4008", "访问订单服务失败"),
FEIGN_REPOPAY_SERVLET_ERROR("4009", "访问云仓消耗服务失败"),
FEIGN_REPOUSER_SERVLET_ERROR("4010", "访问云仓用户服务失败"),
FEIGN_WARE_SERVLET_ERROR("4010", "访问云仓商品服务失败"),
FEIGN_DEVICE_SERVLET_ERROR("4011", "访问云仓设备服务失败"),
CENTER_USER_SERVLET_ERROR("4012", "访问用户中心服务失败"),
GATEWAY_HYSRIX_ERROR("4013", "服务器貌似在开小差~"),
FEIGN_FLYER_PAY_SERVLET_ERROR("4014", "访问飞手消耗服务失败"),
MALL_USER_SERVLET_ERROR("4015", "访问机城用户服务失败"),
PRIMARY_KEY_DEFECT("5001", "主键ID缺失"),
WALLET_NOT_FIND_ERROR("5002", "钱包账户不存在"),
PARAM_DEFECT("5004", "参数缺失"),
LOGIN_ACCOUNT_NOT_EXIT_ERROR("5005", "账号不存在"),
LOGIN_PASSWORD_ERROR("5006", "密码错误"),
LOGIN_ACCOUNT_STATUS_ERROR("5008", "外部访问"),
OPERATE_USER_ORDERCOUNT_ERROR("5007", "当前账号有存在相关订单未关闭"),
WALLET_CASH_NOT_ENOUGH_ERROR("5009", "现金余额不足"),
AMT_PAID_VERITY_ERROR("5010", "变更额度不在有效范围"),
CREDIT_NOT_ENOUGH_ERROR("5011", "信用余额不足,当前信用余额:"),
CREDIT_METHOD_ERROR("5012", "变更类型有误"),
CREDIT_OWED_BEGGER_ERROR("5013", "归还额度不可超过剩余欠款,当前剩余欠款:"),
CASH_ADD_OWED_ERROR("5014", "该账号仍有剩余欠款,请先将全部欠款归还后,再进行充值。"),
WALLET_CREDIT_NOT_ENOUGH_ERROR("5015", "信用余额不足"),
ORDER_PAY_FORMAT_ERROR("5016", "现金和信用金额不能同时为空"),
WALLET_CASH_FREEZE_NOT_ENOUGH_ERROR("5017", "现金的冻结余额不足"),
WALLET_CREDIT_FREEZE_NOT_ENOUGH_ERROR("5018", "信用的冻结余额不足"),
ORDER_CASH_FREEZE_NOT_FIND_ERROR("5019", "现金的冻结余额不存在"),
ORDER_CREDIT_FREEZE_NOT_FIND_ERROR("5019", "信用的冻结余额不存在"),
WALLET_BANLANCE_NOT_ENOUGH_ERROR("5020", "现金和信用的余额不足"),
WALLET_FREEZE_NOT_ENOUGH_ERROR("5020", "现金和信用的冻结余额不足"),
CREDIT_REPEAT_NULL_ERROR("5021", "欠款归还不能为空"),
CREDIT_CHANGE_NULL_ERROR("5021", "信用余额变更不能为空"),
ORDER_TOTAL_COST_ERROR("5022", "结算金额不能大于预支付的金额"),
ORDER_PAY_NOT_ENOUGH_ERROR("5023", "总余额不足,订单无法结算"),
NOT_MENU_POWER_ERROR("5024", "当前账号无平台使用权限"),
OPENID_NOT_FIND_ERROR("5025", "OPENID未注册,请登录授权后调用"),
PASSWORD_INCONSISTENT("5026", "新密码与确认密码不一致,请确认一致"),
WX_ACCESS_TOKEN_ERROR("5027", "获取微信AccessToken失败"),
WX_NOT_REL_ERROR("5028", "获取微信公众号用户信息失败"),
WX_NOT_SEND_MSG_PARAM_ERROR("5029", "userId和openId至少一个不为空"),
APPLET_QR_CODE_CREATE_ERROR("5030", "生成小程序码错误:"),
APPLET_USER_ACCESS_TOKE_ERROR("5031", "获取accessToken签名校验失败"),
REBATE_AMT_NOT_MIN_ERROR("5032", "金额不足300元无法提现,300元为最低门槛"),
REBATE_AMT_NOT_ENOUGH_ERROR("5033", "申请失败,超过可提现的金额"),
BANK_INFO_NOT_SAVE_ERROR("5034", "请先完善收款账号,才可以申请提现"),
REBATE_APPLY_STATUS_ERROR("5035", "提现状态有误"),
REBATE_INFO_NOT_FIND_ERROR("5036", "提现申请单信息不存在"),
REBATE_FAIL_EXIT_ERROR("5037", "你的收款账号信息有误,请修改信息后重新申请提现。"),
REBATE_AMT_FORMAT_ERROR("5038", "提现金额必须大于0元"),
REBATE_REPEAT_CHECK_ERROR("5039", "提现申请单已被审批,切勿重复审批。"),
CHOOSE_FLYER_NUM_ERROR("5040", "请至少选中一个飞手。"),
CHOOSE_FLYER_MORE_NUM_ERROR("5041", "暂只支持一个订单只能指派一个飞手。"),
ORDER_NO_EXIT_ERROR("5042", "订单信息不存在。"),
ORDER_STATUS_ERROR("5043", "订单状态流程有误。"),
INTERFACE_NOT_INVAILD("5044", "接口已废弃或不存在"),
PAPER_CODE_NOT_INVAILD("5045", "接口已废弃或不存在"),
PHONE_INVAILD_ERROR("5046", "无效的手机号"),
TIME_CODE_INVAILD_ERROR("5047", "无效的时间编码"),
REPEACT_COMMIT_ERROR("5048", "已提交,切勿重复提交"),
IMPORT_EXCEL_ERROR("5049", "excel导入失败"),
REQ_SMS_CODE_ERROR("5050", "注册码格式有误"),
SKU_NOT_PRICE_ERROR("5051", "当前SKU未配置价格"),
SKU_NOT_ENOUGH_ERROR("5052", "套餐(sku)数量不足"),
LEASE_DATE_MATH_ERROR("5053", "租期开始日不能大于结束日"),
ADD_LEASE_ADDR_ERROR("5054", "请选择收货方式"),
SHOP_NEED_PHONE_ERROR("5055", "门店自取需要您的联系电话,请填写联系电话"),
ORDER_POWER_ERROR("5056", "订单不存在或你无权操作该订单"),
ORDER_AUTH_ERROR("5057", "请完成认证再下单"),
EXPRESS_RETURN_ERROR("5058", "请完善物流单号和物流公司"),
SHOP_RETURN_ERROR("5059", "请选择门店"),
ORDER_REFUND_EXIT_ERROR("5060", "该订单已提交过退款申请,请勿重复申请。"),
ORDER_EXPRESS_ERROR("5061", "获取订单物流信息有误。"),
ORDER_PAY_JOB_ERROR("5062", "执行定时任务有误"),
NO_AUTH_ORDER_ERROR("5063", "请完成企业认证或实名认证后再进行下单"),
WARE_NOT_ENOUGH_ERROR("5064", "商品数量不足"),
EX_INFO_ERROR("5065", "物流信息不完善"),
NOT_REAL_AUTH_ERROR("5066", "请完成实名认证后再进行操作"),
REBATE_NOT_ENOUGH_ERROR("5067", "提现申请金额需在10至8000元范围之内"),
MORE_THAN_LIMIT_ERROR("5067", "提现申请金额需在0.1至98000元范围之内"),
FLYER_ENT_MORE_THAN_LIMIT_ERROR("50670", "飞手机构用户银行卡单笔最低10元,最高100,000元"),
FLYER_MORE_THAN_LIMIT_ERROR("50671", "飞手个人用户银行卡单笔最低10元,最高5,000元"),
MORE_THAN_LIMIT_TODAY_ERROR("50672", "单个账户每月提现额度为100,000元"),
SYSTEM_AMT_NOT_ENOUGH_ERROR("5068", "系统处理中,请稍后再试。"),
FEIGN_XZH_SERVLET_ERROR("5069", "访问线上支付接口服务失败"),
XZH_SERVLET_ERROR("5070", "调用线上支付失败:"),
XZH_FAIL_ERROR("5071", "支付服务失败:"),
REFUSE_COUNT_ERROR("5072", "今日拒绝的次数已达上限,暂不可参与抢单"),
APPLY_ORDER_COUNT_ERROR("5073", "请勿重复接单"),
ORDER_ARRIVE_ERROR("5074", "抢单失败,订单已被指派"),
REST_APPLY_ORDER_ERROR("5075", "请先开启接单状态后再进行抢单"),
EVALUATED_ERROR("5076", "您已经评价过啦!"),
BACKET_TYPE_ERROR("5077", "红包类型有误"),
BACKET_NOT_ENOUGH_ERROR("5078", "红包已被抢光"),
USER_PHONE_AUTH_ERROR("5079", "请授权登录后领取"),
TOKEN_REQUIRED_ERROR("5080", "Please bring a token"),
UNIONID_NOT_ERROR("5081", "UnionId不能为空"),
OPENID_NOT_ERROR("5081", "云享飞openid、云飞手openid、云仓openid、无人机城openid至少要有一个"),
NO_EVALUATED_ERROR("5090", "暂无评价信息!"),
DAY_NUM_ERROR("5091", "天数有误"),
TASK_TYPE_ERROR("5092", "您的账号类型为个人飞手,只能抢任务人数1人的订单。"),
TASK_FLYER_COUNT_LESS_ERROR("5093", "机构认证的飞手多于任务需要的飞手才可以抢单。"),
FLYER_REBATE_ERROR("5094", "提现失败,请稍后重试"),
OPERATION_SYS_ERROR("5095", "操作失败,请稍后重试"),
WAG_CHECK_STATUS_ERROR("5096", "操作失败,未通过或待确认状态才能进行重新编辑"),
EXPORT_NO_DATA_ERROR("5097", "查询到当前符合条件的数据为0条"),
WAG_ZERO_ERROR("5098", "工资抵扣后当月工资不能少于0元"),
WAG_REPEAT_DATE_ERROR("5099", "操作失败,工资日期重复:"),
BUY_NUM_ERROR("5100", "购买数量必须大于0"),
SHOP_CAR_ERROR("5101", "购物车信息不存在"),
GOODS_VERSION_ERROR("5102", "操作失败,当前商品已经发生信息变更,请刷新后重试"),
WAG_DETAIL_COUNT_ERROR("5103", "账单天数必须大于0"),
WAG_TERM_PARAM_ERROR("5104", "飞手工资、结算基数、操作三个选项必须填一个"),
IMPORT_PARAM_ERROR("5105", "导入的数据行不能为空或者格式错误"),
SHOP_GOODS_NOT_ERROR("5106", "当前商品已下架或已删除"),
ALL_PAY_ERROR("5107", "当前订单为分期付款,请先上传尾款凭证"),
FLYER_EVLT_PARAM_ERROR("5108", "飞手评分参数有误,请检查"),
FLYER_REPEAT_BIND_ERROR("5108", "飞手已被绑定过,请勿重复绑定"),
FLYER_NUM_BIND_ERROR("5108", "飞手数量有误,本任务需要的飞手人数为:"),
FLYER_ORDER_TYPE_ERROR("5110", "飞手类型有误,该订单只允许个人飞手接单"),
FLYER_ENT_ORDER_TYPE_ERROR("5111", "飞手类型有误,该订单只允许飞手机构接单"),
PHONE_NUM_EXIT_ERROR("5112", "手机号已存在"),
FLYER_UN_BIND_ERROR("5113", "飞手已被解绑,请勿重复解绑"),
REPEAT_NOTIFICATION("5114", "您已对此订单进行过催付款操作"),
FLYER_WORK_ERROR("5115", "指派飞手失败,飞手休息中:"),
DISABLE_APPLY_ORDER_ERROR("5116", "当前时间此订单不可抢"),
COMPANY_EXIT_ERROR("5117", "单位名称已存在"),
COMPANY_NOT_BIND_ERROR("5118", "未绑定单位,请先绑定单位"),
COMPANY_REMOVE_ERROR("5119", "删除失败,请先移除该单位的账号信息"),
COMPANY_REMOVE_CHILD_ERROR("5120", "删除失败,请先移除该单位的子级单位"),
EXIST_THE_SAME_GOODS_ERROR("5121", "购物车已存在您选择的商品"),
// clientOAuth
OAUTH_CLIENT_NOT_FOUND("6404", "client_id不存在或已注销"),
OAUTH_SECRET_ERROR("6405", "client_secret有误"),
OAUTH_AUTHORIZE_ERROR("6406", "当前账号未获得任何授权,请确认"),
OAUTH_API_AUTH_ERROR("6407", "当前资源未被授权"),
OAUTH_CREATE_TOKEN_ERROR("6408", "系统内部错误,获取accessToken失败,"),
PWD_CREATE_ERROR("6001", "创建密码失败"),
PWD_CONPARED_ERROR("6002", "密码错误"),
PWD_ALERT_ERROR("6003", "密码不一致"),
PWD_REQUEST_AUTH_ERROR("6003", "密码请求验证"),
APPLET_PORT_TYPE_ERROR("7001", "小程序端口类型错误"),
APPLET_GET_OPENID_ERROR("7002", "获取小程序openid失败"),
UPDATE_USER_ACCOUNT_REPEAT("7003", "修改后的账户名已存在"),
ADD_USER_ACCOUNT_NAME_EXISTS("7004", "新增账户名已经存在"),
ACCOUNT_NOT_FIND_ERROR("8000", "账号信息不存在"),
REPEAT_SOFT_DELETE("8001", "账号已删除"),
ADMIN_ROLE_DELETE_ERROR("8002", "此账号为管理员账号,禁止删除"),
ROLE_ADMIN_DELETE_ERROR("8003", "此角色为管理员角色,禁止删除"),
ROLE_NAME_REPEAT_ERROR("8004", "角色名已存在"),
ROLE_AVL_USER_DELETE_ERROR("8005", "此角色尚有可用账号,请将所有账号移除后在进行操作"),
ROLE_AVL_USER_STATUS_ERROR("8006", "此角色尚有可用账号,请将所有账号禁用后在进行操作"),
ROLE_SYSTEM_DELETE_ERROR("8007", "此角色为系统角色,禁止删除"),
ADMIN_ROLE_POWER_ERROR("8008", "禁止修改管理类角色权限"),
SYSTEM_ROLE_POWER_ERROR("8009", "禁止修改系统类角色权限"),
ROLE_SELF_POWER_ERROR("8010", "禁止修改与当前登录账号角色相同的角色权限"),
ADMIN_ACCOUNT_DISABLE_ERROR("8011", "此账号为管理员账号,禁用失败"),
OPERATE_USER_DEL_ERROR("8012", "该账号仍有进行中的订单需要负责,请先移交订单后再删除。"),
OPERATE_USER_DISABLED_ERROR("8013", "该账号仍有进行中的订单需要负责,请先移交订单后再禁用。"),
DELETE_USER_UNFILLED_ORDER_EXIST("9001", "平台中有此账号相关的订单,不可删除此账号"),
STOP_UNFILLED_ORDER_EXIST("9002", "平台中有此账号相关的订单正在进行中,不可停用此账号"),
ACCOUNT_ALREADY_DELETED("10001", "此账号已经被删除"),
ACCOUNT_ALREADY_STOP("10002", "此账号已经被停用,不能登录此小程序,详情请联系管理员"),
INDUSTRY_NAME_CREATE_ERROR("20001", "行业名称请勿重复,请重新输入"),
INSPECTION_NAME_CREATE_ERROR("20002", "服务名称请勿重复,请重新输入"),
INSPECTION_REPEAT("20003", "绑定服务重复"),
INDUSTRY_REPEAT("20004", "绑定行业重复"),
INSERT_INDUSTRY_SUCCESS("20005", "新增行业成功"),
UPDATE_INDUSTRY_SUCCESS("20006", "修改行业成功"),
DELETE_INDUSTRY_SUCCESS("20007", "删除行业成功"),
INSERT_INSPECTION_SUCCESS("20008", "新增服务成功"),
UPDATE_INSPECTION_SUCCESS("20009", "修改服务成功"),
DELETE_INSPECTION_SUCCESS("20010", "删除服务成功"),
SORT_PARAMETER_ERROR("28199", "排序参数错误"),
OPRATING_FREQUENCY_TOO_HIGH("28449", "更新频率过快,请重试"),
INSERT_INDUSTRY_INSPECTION_SUCCESS("20011", "添加对应服务成功"),
INSERT_INSPECTION_INDUSTRY_SUCCESS("20012", "添加对应行业成功"),
DELETE_INDUSTRY_INSPECTION_SUCCESS("20013", "删除对应服务成功"),
DELETE_INSPECTION_INDUSTRY_SUCCESS("20014", "删除对应行业成功"),
INSERT_INDUSTRY_SHELF_SUCCESS("20015", "行业上架成功"),
DELETE_INDUSTRY_SHELF_SUCCESS("20016", "行业下架成功"),
INSERT_INSPECTION_SHELF_SUCCESS("20017", "服务上架成功"),
DELETE_INSPECTION_SHELF_SUCCESS("20018", "服务下架成功"),
DELETE_INSPECTION_ERROR("20022", "该服务仍有未完成的订单,不可删除"),
INSPECTION_NOT_EXIST("20023", "很抱歉,目前该服务已下架"),
FAKE_NUM_CREATE_ERROR("20024", "输入的数据有误,请重新输入!"),
WORK_TYPE_NAME_ERROR("20026", "服务作业类型重复,请重新输入"),
EXIST_BINDING_INSPECTION_ERROR("20027", "此作业类型被服务绑定,删除失败!"),
UPLOAD_IMG_ERROR("20019", "请选择jpg,png,jpeg格式的图片"),
UPLOAD_VIDEO_ERROR("20020", "请选择MP4,avi,mov,mkv格式的视频"),
UPLOAD_DOC_ERROR("20021", "请选择doc,ppt,pdf,xls格式的文件"),
UPLOAD_IMG_LESS_3M_ERROR("20022", "请上传小于3M的图片"),
INSERT_ORDER_SUCCESS("21000", "新增订单成功"),
UPDATE_ORDER_SUCCESS("21001", "修改订单成功"),
ORDER_TRANS_SUCCESS("21002", "订单移交成功"),
ORDER_EVALUATE_SUCCESS("21003", "订单评价完成"),
ORDER_BEFORE_PAY_ERROR("21004", "订单预支付失败"),
ORDER_CLOSE_PAY_ERROR("21005", "订单结算支付失败"),
INSERT_ORDER_DETAIL_SUCCESS("21006", "新增订单动态成功"),
CHECK_USER_ERROR("22001", "用户未通过验证"),
GET_ORDER_LIST_ERROR("22002", "获取订单列表失败"),
COMMANT_CAR_NAME_EXIST("22003", "指挥车名字已存在,请重新输入"),
// 认证提示
APP_CODE_ERROR("30301", "appcode 错误"),
REQUE_ENVIROMENT_ERROR("30302", "请求的 Method、Path 或者环境错误"),
REQUEST_PARAMETER_ERROR("30303", "请求参数错误"),
SERVICE_NOT_AUTHORIZED("30304", "服务未被授权(或URL和Path不正确)"),
TIMES_USED_UP("30305", "很抱歉,目前我们的实名认证次数已达上限,正在处理中,请稍后再进行认证。"),
OTHER_ERROR("30306", "其他错误/服务次数用完"),
LIVE_AUTHENTICATION_FAILED("3824", "活体认证失败"),
ID_INFO_AND_ID_card_MISMATCH("3904", "身份信息与身份证不匹配"),
LIVE_AUTHENTICATION_SUCESS("3999", "活体验证成功"),
NO_REAL_NAME("3854", "用户未实名认证"),
URL_FORMAT_ERROR("37462", "URL格式错误"),
URL_ADDRESS_ERROR("36752", "URL地址错误"),
INTERFACE_ACCESS_EXCEPTION("36894", "接口访问异常/次数用尽"),
FRONT_BACK_VAGUE("35556", "身份证正反面不明确"),
ID_CARD_THOTO_MESSAGE_ERROR("36651", "身份照信息错误"),
EXPTION_ID_CARD_THOTO_MESSAGE_ERROR("36651", "信息异常"),
PHOTO_FORMAT_ERROR("12138", "身份证图片格式错误"),
VALIDATION_INFO_EXPIRED("32815", "认证时间过长信息过期或认证信息不完整,请重新开始认证"),
REAL_IMAGE_AUTHENTICATION_SUCESS("38844", "验证成功"),
REAL_IMAGE_AUTHENTICATION_FAILED("38855", "验证失败,请再次进行人脸识别"),
IDENTITY_HAS_BEEN_AUTHENTICATED("34444", "此身份证信息已经被认证,请重试"),
REAL_NAME_ACCOUNT_ID_ERROR("36771", "账户id错误"),
REAL_NAME_FUSING_ERROR("36772", "认证失败,请重新认证"),
// 企业认证
BUSINESS_LICENSE_CHECK_ANALYSIS_ERROR("30400", "营业执照解析失败,请上传有效清晰的执照"),
BUSINESS_LICENSE_CHECK_PARAMETER_ERROR("30401", "企业信息与营业执照信息不一致,请重新上传"),
BANK_ACCOUNT_CHECK1_ERROR("30402", "账号与开户名不符"),
BANK_ACCOUNT_CHECK2_ERROR("30403", "开户行名称错误"),
BANK_ACCOUNT_CHECK3_ERROR("30404", "仅支持对公账户验证,不支持个人卡"),
BANK_ACCOUNT_CHECK4_ERROR("30405", "企业账号信息有误,请重新输入"),
BANK_ACCOUNT_CHECK5_ERROR("30406", "24小时之内不能重复申请"),
BANK_ACCOUNT_CHECK6_ERROR(
"30407", "很抱歉,目前我们的企业认证次数已达上限,如需继续认证请及时联系相关负责人进行处理,联系方式:科比特管理人员,18938853647。"),
BANK_ACCOUNT_CHECK7_ERROR("30408", "企业名称与开户名称不一致,请确认一致后再提交认证"),
ENTERPRISE_HAVE_VERIFIED("30409", "您输入的企业信息已被其他用户认证,请重新输入"),
ID_NUMBER_PARA_ERROR("30410", "身份证号码有错,请重新输入"),
DEAL_ERROR("30411", "有报错,请联系平台客服。"),
NOT_DATA_ERROR("30412", "查无数据"),
API_STOP_USE_ERROR("30413", "接口停用"),
OFFICE_DATA_SUSTAIN_ERROR("30414", "官方数据源维护,请稍候再试"),
SERVER_SUSTAIN_ERROR("30415", "服务商维护,请稍候再试"),
PARA_ERROR("30416", "参数错误,请重新输入"),
VERIFY_COUNT_ERROR("30416", "认证次数上限,请联系管理员"),
NOT_ENT_VERIFY_ERROR("30417", "机构未认证或认证未通过,请先进行机构认证"),
NOT__VERIFY_ERROR("30418", "机构未认证或飞手认证未通过,请先进行认证"),
// 渠道认证
NOT_ENT_USER("30501", "感谢您有意向成为我们的渠道商,请先完成企业认证。"),
NEW_NOT_ENT_USER("30502", "此用户未进行企业认证,渠道变更失败!"),
BEFORE_NOT_CHANNEL_USER("30503", "此用户还不是渠道"),
// 飞手端认证
NOT_AUTH_FLYER_ERROR("30600", "飞手未认证,请先完成飞手认证"),
NOT_HAVE_AUTH_FLYER_ERROR("30601", "没有认证的飞手,暂不可接单"),
// 设备型号提醒
DEVICE_MODEL_REPEAT_ERROR("30700", "产品名称不可重复,请重新输入"),
DEVICE_MODEL_FAILURE_ERROR("30701", "设备添加失败"),
DEVICE_MODEL_REMOVE_ERROR("30702", "设备未在仓库,删除失败"),
DEVICE_MODEL_UPDATE_ERROR("30703", "设备修改失败"),
DEVICE_HAS_BEEN_RENT_ERROR("30704", "该设备不在仓库,不能出库"),
// 仓库提醒
REPO_INFO_NAME("30800", "仓库名称不可重复,请重新输入"),
REPO_INFO_FAILURE("30801", "仓库添加失败"),
REPO_INFO_REMOVE("30702", "仓库删除失败"),
// 商品
WARE_NAME_HAS_BEEN_EXIST("30900", "商品名称已存在"),
WARE_TYPE_NAME_HAS_BEEN_EXIST("30901", "分类名称已存在"),
WARE_TYPE_ICON_NOT_NULL("30902", "一级分类图标不能为空"),
GROUP_DONT_DELETE("30903", "该分类下尚有商品存在"),
GOODS_STATUS_ERROR("30904", "状态有误"),
GOODS_ON_SHELF_SUCCESS("30905", "商品上架成功"),
GOODS_DOWN_SHELF_SUCCESS("30906", "商品下架成功"),
GOODS_SKU_IS_NOT_NULL("30907", "商品规格不能为空"),
GOODS_PIC_IS_NOT_NULL("30908", "主图不能为空"),
GOODS_DESC_IS_NOT_NULL("30910", "商品描述不能为空"),
GOODS_GROUP_IS_NOT_NULL("30911", "商品类型不能为空"),
GROUP_DONT_DELETE_BY_CHILD("30912", "该分类下尚有子分类存在"),
GOODS_NOT_EXIST_OR_ALREADY_DOWN_SHELF("30913", "商品不存在或已下架"),
GOODS_NAME_IS_NOT_NULL("30914", "商品名称不能为空或名字长度不能大于60"),
GOODS_DELETE_FAIL("30915", "批量删除商品失败,商品已被其他商品绑定"),
BRAND_DELETE_FAIL("30916", "删除失败,产品管理中有产品绑定该品牌名称"),
// 返祖
RETURN_SHARE_ORDER_ERROR("40000", "设备返祖订单相关信息找不到,请重新输入订单号"),
RETURN_SHARE_ORDER_NOT_FINISH_ERROR("40001", "此设备的订单未完成,请添加其他设备"),
RETURN_SHARE_ORDER_HAS_BEEN_ADD_ERROR("40002", "此订单的设备已经被添加过,不能重复添加"),
// 宣传中心
EXIST_SAME_NAME_OF_MODULE_ERROR("40500", "所属产品中不能有相同名字的模块"),
EXIST_SAME_NAME_OF_BANNER_ERROR("40501", "名称重复,请重新输入"),
EXIST_SAME_CODE_OF_MODULE_ERROR("40502", "moduleCode已重复,请输入其他moduleCode"),
HAS_BEEN_USE_ERROR("40503", "此标签有用户在使用,不能删除!"),
FILE_PARSE_ERROR("40600", "上传文件无数据或内容识别失败,请重新上传"),
HAS_BEEN_APPLY_ERROR("40601", "已提交申请!将有客服人员与你联系"),
PRICE_TO_HIGH_ERROR("40602", "标价确认在0-10000000万元内"),
EXIST_SAME_NAME_ERROR("40603", "快讯名称重复,请重新上传"),
TENDER_FORMAT_ERROR("40604", "招标序号或内容不能为空,请补全后上传"),
TENDER_CONTENT_TOO_LONG_ERROR("40605", "存在招标内容字符过长"),
GOODS_CATEGORY_NAME_EXIST_ERROR("40605", "名称重复,请重新输入!"),
CONTRACT_STATUS_MISTAKEN("40607", "当前合同状态不可进行编辑!"),
CONTRACT_STATUS_CANNOT_BE_DELETED("40607", "当前合同状态不可进行删除!"),
CONTRACT_NOT_EXIST("40608", "合同不存在或已删除!"),
CONTRACT_STATUS_DOES_NOT_ALLOW_FILE("40609", "该状态合同不允许归档!"),
SEAL_INFO_NOT_EXIST("40610", "请前往印章管理上传印章或设置默认印章!"),
AGENCY_NO_FLYER("40611", "机构下暂无飞手,快去招募吧~"),
NO_FLYER_WORK("40612", "现在没有飞手上班哦~"),
TEMPORARY_NOT_SUPPORT_TRANSFER_ORDER("40613", "个人订单暂不支持转单操作~"),
ELECTRONIC_SIGNATURE_NOT_REAL_NAME_AUTHENTICATION("40614", "请完成电子签约实名认证后再进行操作"),
DIRECTORY_DOES_NOT_EXIST("40615", "目录不存在或已删除"),
DEFAULT_DIRECTORY_CANNOT_BE_DEL("40616", "默认目录不可删除"),
THERE_ARE_CATEGORIES_IN_THE_DIRECTORY("40167", "该目录下有分类存在不可删除"),
DIRECTORY_NAME_HAS_BEEN_EXIST("40168", "目录名称已存在"),
FAILED_TO_ADD_DATA("40169", "数据新增失败,请稍后重试"),
FAILED_TO_EDIT_DATA("40170", "数据修改失败,请稍后重试"),
SKU_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED("40171", "sku不存在或已删除,请刷新后重试!"),
SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED("40172", "规格不存在或已删除,请刷新后重试!"),
SKU_ALREADY_EXIST_IN_THIS_INDUSTRY("40173", "该所属行业下已经存在sku,请检查后重试!"),
SPEC_EXIST_UNDER_THE_SKU("40174", "该sku下有规格存在,无法删除!"),
SPEC_NOT_CONFIG_PRICE("40175", "存在规格没有配置价格,请联系客服获取报价!"),
SHOP_CAR_SIZE_MORE_2("40176", "行业购物车下单数量仅限一个"),
CONTRACT_TEMPLATE_NOT_EXIST_OR_DELETED("40177", "合同模板不存在或已删除!"),
SCORE_ERROR("40177", "您输入的积分数量有误,请重新输入!"),
PLEASE_FILL_IN_THE_CONTRACT_TEMPLATE_FIRST("40178", "请先填充合同模板!"),
SCORE_NOT_GIVE_MYSELF("40179", "积分不能转赠给本人,请重新操作"),
ALREADY_FINISH_ENT_AUTH_ERROR("2000", "助力已完成!"),
SYSTEM_ERROR("2001", "系统错误,请稍后重试"),
RULE_ERROR("2002", "当前兑换比例已失效,请刷新后重试"),
COUNT_LIMIT_ERROR("2003", "参与次数已达上线"),
ALREADY_ENT_AUTH_ERROR("2004", "助力失败,您已完成企业认证!"),
ALREADY_REAL_NAME_AUTH_ERROR("2005", "助力失败,您已完成实名认证!"),
PARTICIPATE_BUT_NOT_AUTH_ERROR("2006", "待完成授权或认证"),
ALREADY_HELP_ERROR("2007", "已助力"),
ALREADY_STOP_ERROR("2008", "活动已下线"),
HELP_FAIL_ERROR("2009", "不能给自己助力哦!"),
ALREADY_BINDING_ERROR("2010", "优惠券已被绑定"),
ALREADY_DIVIDE_ERROR("2011", "订单已分成"),
DIVIDE_OBJ_NOT_EXIST("2012", "先点击确认添加分成对象"),
DEFAULT_DIRECTORY("3001", "默认目录不可删除或修改名称!");
/**
* 错误码
*
* @return
*/
String resultCode;
/**
* 错误描述
*
* @return
*/
String resultMsg;
ResultEnum(String resultCode, String resultMsg) {
this.resultCode = resultCode;
this.resultMsg = resultMsg;
}
@Override
public String getResultCode() {
return resultCode;
}
@Override
public String getResultMsg() {
return resultMsg;
}
}
package com.mmc.pms.config;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
//Converter<S,T> S: 代表的是源,将要转换的数据类型 T:目标类型,将会转成什么数据类型
@Component
public class GlobalFormDateConvert implements Converter<String, Date> {
// 静态初始化定义日期字符串参数列表(需要转换的)
private static final List<String> paramList = new ArrayList<>();
// 静态初始化可能初夏你的日期格式
private static final String param1 = "yyyy-MM";
private static final String param2 = "yyyy-MM-dd";
private static final String param3 = "yyyy-MM-dd HH:mm";
private static final String param4 = "yyyy-MM-dd HH:mm:ss";
// 静态代码块,将日期参数加入到列表中
static {
paramList.add(param1);
paramList.add(param2);
paramList.add(param3);
paramList.add(param4);
}
// 自定义函数,将字符串转Date 参1:传入的日期字符串 参2:格式参数
public Date parseDate(String source, String format) {
System.out.println("parseDate转换日期");
Date date = null;
try {
// 日期格式转换器
DateFormat dateFormat = new SimpleDateFormat(format);
date = dateFormat.parse(source);
} catch (Exception e) {
e.printStackTrace();
}
return date;
}
// convert转换方法 ,s是将会传递过来的日期的字符串
@Override
public Date convert(String source) {
System.out.println("convert日期格式转换器");
if (StringUtils.isEmpty(source)) {
return null;
}
source = source.trim(); // 去除首尾空格
// 正则表达式判断是哪一种格式参数
if (source.matches("^\\d{4}-\\d{1,2}$")) {
return parseDate(source, paramList.get(0));
} else if (source.matches("^\\d{4}-\\d{1,2}-\\d{1,2}$")) {
return parseDate(source, paramList.get(1));
} else if (source.matches("^\\d{4}-\\d{1,2}-\\d{1,2} {1}\\d{1,2}:\\d{1,2}$")) {
return parseDate(source, paramList.get(2));
} else if (source.matches("^\\d{4}-\\d{1,2}-\\d{1,2} {1}\\d{1,2}:\\d{1,2}:\\d{1,2}$")) {
return parseDate(source, paramList.get(3));
} else {
throw new IllegalArgumentException("还未定义该种字符串转Date的日期转换格式 --> 【日期格式】:" + source);
}
}
}
package com.mmc.pms.config;
import com.fasterxml.jackson.databind.util.StdDateFormat;
import org.springframework.util.StringUtils;
import java.text.FieldPosition;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;
public class GlobalJsonDateConvert extends StdDateFormat {
private static final long serialVersionUID = -6738131740618766141L;
// 静态初始化final,共享
public static final GlobalJsonDateConvert instance = new GlobalJsonDateConvert();
// 覆盖parse(String)这个方法即可实现
@Override
public Date parse(String dateStr, ParsePosition pos) {
return getDate(dateStr, pos);
}
@Override
public Date parse(String dateStr) {
ParsePosition pos = new ParsePosition(0);
return getDate(dateStr, pos);
}
private Date getDate(String dateStr, ParsePosition pos) {
SimpleDateFormat sdf = null;
if (StringUtils.isEmpty(dateStr)) {
return null;
} else if (dateStr.matches("^\\d{4}-\\d{1,2}$")) {
sdf = new SimpleDateFormat("yyyy-MM");
return sdf.parse(dateStr, pos);
} else if (dateStr.matches("^\\d{4}-\\d{1,2}-\\d{1,2}$")) {
sdf = new SimpleDateFormat("yyyy-MM-dd");
return sdf.parse(dateStr, pos);
} else if (dateStr.matches("^\\d{4}-\\d{1,2}-\\d{1,2} {1}\\d{1,2}:\\d{1,2}$")) {
sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
return sdf.parse(dateStr, pos);
} else if (dateStr.matches("^\\d{4}-\\d{1,2}-\\d{1,2} {1}\\d{1,2}:\\d{1,2}:\\d{1,2}$")) {
sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdf.parse(dateStr, pos);
} else if (dateStr.length() == 23) {
sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
return sdf.parse(dateStr, pos);
}
return super.parse(dateStr, pos);
}
@Override
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdf.format(date, toAppendTo, fieldPosition);
}
@Override
public GlobalJsonDateConvert clone() {
return new GlobalJsonDateConvert();
}
}
package com.mmc.pms.config;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ConversionServiceFactoryBean;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.converter.Converter;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@Configuration
public class WebConfig {
// JSON格式 全局日期转换器配置
@Bean
public MappingJackson2HttpMessageConverter getMappingJackson2HttpMessageConverter() {
MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter();
// 设置日期格式
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.setDateFormat(GlobalJsonDateConvert.instance);
objectMapper.setSerializationInclusion(JsonInclude.Include.ALWAYS);
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mappingJackson2HttpMessageConverter.setObjectMapper(objectMapper);
// 设置中文编码格式
List<MediaType> list = new ArrayList<MediaType>();
list.add(MediaType.APPLICATION_JSON_UTF8);
mappingJackson2HttpMessageConverter.setSupportedMediaTypes(list);
return mappingJackson2HttpMessageConverter;
}
// 表单格式 全局日期转换器
@Bean
@Autowired
public ConversionService getConversionService(GlobalFormDateConvert globalDateConvert) {
ConversionServiceFactoryBean factoryBean = new ConversionServiceFactoryBean();
Set<Converter> converters = new HashSet<>();
converters.add(globalDateConvert);
factoryBean.setConverters(converters);
return factoryBean.getObject();
}
}
package com.mmc.pms.constant;
public interface DateConstant {
String YYYYMMDDHHMMSS = "yyyy-MM-dd HH:mm:ss";
}
package com.mmc.pms.constant;
/**
* @author: zj
* @Date: 2023/5/31 20:07
*/
public class TokenConstant {
public static final String TOKEN = "token";
}
package com.mmc.pms.controller;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.entity.Categories;
import com.mmc.pms.model.categories.dto.AllCategoryDTO;
import com.mmc.pms.model.categories.dto.ClassifyDetailsDTO;
import com.mmc.pms.model.categories.dto.ClassifyInfoDTO;
import com.mmc.pms.model.categories.vo.CategoriesInfoVO;
import com.mmc.pms.model.categories.vo.ClassifyInfoVO;
import com.mmc.pms.model.categories.vo.DirectoryInfoVO;
import com.mmc.pms.model.categories.vo.RelevantBusinessVO;
......@@ -16,7 +15,6 @@ import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.constraints.Min;
import java.util.List;
......@@ -28,89 +26,116 @@ import java.util.List;
@RestController
@RequestMapping("/classify")
public class BackstageCategoriesController {
@Autowired
private CategoriesService categoriesService;
@ApiOperation(value = "新增or修改目录")
@PostMapping("addOrEditDirectory")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addOrEditDirectory(@RequestBody DirectoryInfoVO param) {
return categoriesService.addOrEditDirectory(param);
}
@ApiOperation(value = "目录列表")
@GetMapping("directoryList")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = DirectoryInfoVO.class)})
public ResultBody directoryList(@RequestParam Integer pageNo, @RequestParam Integer pageSize, @RequestParam(required = false) Integer type) {
return ResultBody.success(categoriesService.directoryList(pageNo, pageSize, type));
}
@ApiOperation(value = "删除目录")
@GetMapping("removeDirectory")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody removeDirectory(@ApiParam(value = "id") @RequestParam(value = "id") Integer id) {
return categoriesService.removeDirectory(id);
}
@ApiOperation(value = "分类新增")
@PostMapping("addClassification")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addClassification(@Validated(Create.class) @RequestBody ClassifyInfoVO classifyInfoVO) {
return categoriesService.addClassification(classifyInfoVO);
}
@ApiOperation(value = "分类修改")
@PostMapping("updateClassification")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody updateClassification(@Validated(Update.class) @RequestBody ClassifyInfoVO classifyInfoVO) {
return categoriesService.updateClassification(classifyInfoVO);
}
@ApiOperation(value = "分类信息-排序")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("exchangeSortType")
public ResultBody exchangeSortType(@ApiParam(value = "第一个分类id", required = true) @RequestParam(value = "firstId") Integer firstId,
@ApiParam(value = "第二个分类id", required = true) @RequestParam(value = "secondId") Integer secondId) {
return categoriesService.exchangeSortType(firstId, secondId);
}
@ApiOperation(value = "分类信息-列表")
@PostMapping("getClassificationList")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ClassifyInfoDTO.class)})
public ResultBody getClassificationList(@RequestBody QueryClassifyVO queryClassifyVO) {
return ResultBody.success(categoriesService.getClassificationList(queryClassifyVO));
}
@ApiOperation(value = "分类详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ClassifyDetailsDTO.class)})
@GetMapping("getClassifyDetails")
public ResultBody getClassifyDetails(@ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id) {
return categoriesService.getClassifyDetails(id);
}
@ApiOperation(value = "分类详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = RelevantBusinessVO.class)})
@GetMapping("queryRelevantBusiness")
public ResultBody queryRelevantBusiness(@ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id,
@ApiParam(value = "业务类型", required = true) @Min(value = 0) @RequestParam(value = "type") Integer type) {
return categoriesService.queryRelevantBusiness(id, type);
}
@ApiOperation(value = "分类删除")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = RelevantBusinessVO.class)})
@GetMapping("deleteRelevantBusiness")
public ResultBody deleteRelevantBusiness(@ApiParam(value = "分类id", required = true) @Min(value = 1) @RequestParam(value = "id") Integer id) {
return categoriesService.deleteRelevantBusiness(id);
}
@ApiOperation(value = "目录列表不含分页")
@GetMapping("getDirectoryList")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = DirectoryInfoVO.class)})
public ResultBody getDirectoryList(Integer type) {
return categoriesService.getDirectoryList(type);
}
@Autowired private CategoriesService categoriesService;
@ApiOperation(value = "新增or修改目录")
@PostMapping("addOrEditDirectory")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addOrEditDirectory(@RequestBody DirectoryInfoVO param) {
return categoriesService.addOrEditDirectory(param);
}
@ApiOperation(value = "目录列表")
@GetMapping("directoryList")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = DirectoryInfoVO.class)})
public ResultBody directoryList(
@RequestParam Integer pageNo,
@RequestParam Integer pageSize,
@RequestParam(required = false) Integer type) {
return ResultBody.success(categoriesService.directoryList(pageNo, pageSize, type));
}
@ApiOperation(value = "删除目录")
@GetMapping("removeDirectory")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody removeDirectory(
@ApiParam(value = "id") @RequestParam(value = "id") Integer id) {
return categoriesService.removeDirectory(id);
}
@ApiOperation(value = "分类新增")
@PostMapping("addClassification")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addClassification(
@Validated(Create.class) @RequestBody ClassifyInfoVO classifyInfoVO) {
return categoriesService.addClassification(classifyInfoVO);
}
@ApiOperation(value = "分类修改")
@PostMapping("updateClassification")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody updateClassification(
@Validated(Update.class) @RequestBody ClassifyInfoVO classifyInfoVO) {
return categoriesService.updateClassification(classifyInfoVO);
}
@ApiOperation(value = "分类信息-排序")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("exchangeSortType")
public ResultBody exchangeSortType(
@ApiParam(value = "第一个分类id", required = true) @RequestParam(value = "firstId")
Integer firstId,
@ApiParam(value = "第二个分类id", required = true) @RequestParam(value = "secondId")
Integer secondId) {
return categoriesService.exchangeSortType(firstId, secondId);
}
@ApiOperation(value = "分类信息-列表")
@PostMapping("getClassificationList")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ClassifyInfoDTO.class)})
public ResultBody getClassificationList(@RequestBody QueryClassifyVO queryClassifyVO) {
return ResultBody.success(categoriesService.getClassificationList(queryClassifyVO));
}
@ApiOperation(value = "分类详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ClassifyDetailsDTO.class)})
@GetMapping("getClassifyDetails")
public ResultBody getClassifyDetails(
@ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id) {
return categoriesService.getClassifyDetails(id);
}
@ApiOperation(value = "分类详情下关联业务列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = RelevantBusinessVO.class)})
@GetMapping("queryRelevantBusiness")
public ResultBody queryRelevantBusiness(
@ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id,
@ApiParam(value = "业务类型", required = true) @Min(value = 0) @RequestParam(value = "type")
Integer type) {
return categoriesService.queryRelevantBusiness(id, type);
}
@ApiOperation(value = "分类删除")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = RelevantBusinessVO.class)})
@GetMapping("deleteRelevantBusiness")
public ResultBody deleteRelevantBusiness(
@ApiParam(value = "分类id", required = true) @Min(value = 1) @RequestParam(value = "id")
Integer id) {
return categoriesService.deleteRelevantBusiness(id);
}
@ApiOperation(value = "目录列表不含分页")
@GetMapping("getDirectoryList")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = DirectoryInfoVO.class)})
public ResultBody getDirectoryList(Integer type) {
return categoriesService.getDirectoryList(type);
}
@ApiOperation(value = "根据类型获取各个目录及分类信息")
@GetMapping("queryCategoryInfoByType")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = AllCategoryDTO.class)})
public ResultBody queryCategoryInfoByType(
@ApiParam(value = "类型:1:作业服务 2:设备 3:培训 4:产品商城", required = true) @RequestParam(value = "type")
Integer type) {
return categoriesService.queryCategoryInfoByType(type);
}
@ApiOperation(value = "feign根据类型获取各个目录及分类信息", hidden = true)
@GetMapping("feignQqueryCategoryInfoByType")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = AllCategoryDTO.class)})
public List<AllCategoryDTO> feignQqueryCategoryInfoByType(
@ApiParam(value = "类型:1:作业服务 2:设备 3:培训 4:产品商城", required = true) @RequestParam(value = "type")
Integer type) {
return categoriesService.feigQqueryCategoryInfoByType(type);
}
}
......@@ -8,90 +8,130 @@ import com.mmc.pms.model.order.dto.OrderGoodsProdDTO;
import com.mmc.pms.model.qo.MallOrderGoodsInfoQO;
import com.mmc.pms.model.qo.ProductSpecPriceQO;
import com.mmc.pms.model.sale.dto.*;
import com.mmc.pms.model.sale.qo.MallGoodsQO;
import com.mmc.pms.model.sale.vo.BatchShelfVO;
import com.mmc.pms.model.sale.vo.GoodsAddVO;
import com.mmc.pms.service.GoodsInfoService;
import io.swagger.annotations.*;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author LW
* @date 2023/3/14 13:22
* 概要:
*
* @date 2023/3/14 13:22 概要:
*/
@RestController
@RequestMapping("/goods")
@Api(tags = {"后台-商品管理-相关接口"})
public class BackstageGoodsManageController {
@Resource
private GoodsInfoService goodsInfoService;
@ApiOperation(value = "新增(租赁/销售)商品")
@PostMapping("addGoodsInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addGoods(@ApiParam("商品信息VO") @Validated(Create.class) @RequestBody GoodsAddVO goodsAddVO) {
return goodsInfoService.addGoods(goodsAddVO);
}
@ApiOperation(value = "修改(租赁/销售)商品")
@PostMapping("editGoodsInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody editGoodsInfo(@ApiParam("商品信息VO") @Validated(Update.class) @RequestBody GoodsAddVO goodsAddVO) {
return goodsInfoService.editGoodsInfo(goodsAddVO);
}
@ApiOperation(value = "PC端-商品详情")
@GetMapping("getGoodsInfoDetail")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = MallGoodsDetailDTO.class)})
public ResultBody getGoodsInfoDetail(@ApiParam("商品id") @RequestParam Integer goodsInfoId) {
return goodsInfoService.getGoodsInfoDetail(goodsInfoId);
}
@ApiOperation(value = "单位信息")
@GetMapping("getSkuUnit")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = SkuUnitDTO.class)})
public ResultBody getSkuUnit() {
return goodsInfoService.getSkuUnit();
}
@ApiOperation(value = "feign根据购物车信息填充未知信息", hidden = true)
@PostMapping("fillGoodsInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = MallGoodsShopCarDTO.class)})
public List<MallGoodsShopCarDTO> fillGoodsInfo(@RequestBody List<MallGoodsShopCarDTO> param) {
return goodsInfoService.fillGoodsInfo(param);
}
@ApiOperation(value = "feign根据渠道等级和产品规格id获取对应价格", hidden = true)
@PostMapping("feignListProductSpecPrice")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public List<MallProductSpecPriceDTO> feignListProductSpecPrice(@RequestBody ProductSpecPriceQO productSpecPriceQO) {
return goodsInfoService.feignListProductSpecPrice(productSpecPriceQO);
}
@ApiOperation(value = "feign根据渠道等级获取单价信息", hidden = true)
@GetMapping("feignGetUnitPriceByTag")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecPriceDTO.class)})
public ProductSpecPriceDTO feignGetUnitPriceByTag(@RequestParam(value = "specId") Integer specId,
@RequestParam(value = "tagId") Integer tagId) {
return goodsInfoService.feignGetUnitPriceByTag(specId, tagId);
}
@ApiOperation(value = "feign根据商品的产品规格id查询商品信息", hidden = true)
@PostMapping("feignListProdGoodsSkuInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = OrderGoodsProdDTO.class)})
public List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(@RequestBody MallOrderGoodsInfoQO mallOrderGoodsInfoQO) {
return goodsInfoService.feignListProdGoodsSkuInfo(mallOrderGoodsInfoQO);
}
@ApiOperation(value = "feign根据商品的行业规格id查询商品清单信息", hidden = true)
@PostMapping("feignListIndstGoodsSkuInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = OrderGoodsProdDTO.class)})
public List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(@RequestBody MallOrderGoodsInfoQO mallOrderGoodsInfoQO) {
return goodsInfoService.feignListIndstGoodsSkuInfo(mallOrderGoodsInfoQO);
}
@Resource private GoodsInfoService goodsInfoService;
@ApiOperation(value = "新增(租赁/销售)商品")
@PostMapping("addGoodsInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addGoods(
@ApiParam("商品信息VO") @Validated(Create.class) @RequestBody GoodsAddVO goodsAddVO) {
return goodsInfoService.addGoods(goodsAddVO);
}
@ApiOperation(value = "修改(租赁/销售)商品")
@PostMapping("editGoodsInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody editGoodsInfo(
@ApiParam("商品信息VO") @Validated(Update.class) @RequestBody GoodsAddVO goodsAddVO) {
return goodsInfoService.editGoodsInfo(goodsAddVO);
}
@ApiOperation(value = "PC端-商品详情")
@GetMapping("getGoodsInfoDetail")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = MallGoodsDetailDTO.class)})
public ResultBody getGoodsInfoDetail(
@ApiParam("商品id") @RequestParam Integer goodsInfoId,
@RequestParam Integer type,
@RequestParam(required = false) @ApiParam("租赁时限:(输入0:1-7天、输入1:8-15天、输入2:16-30天、输入3:30天以上)")
Integer leaseTerm) {
return goodsInfoService.getGoodsInfoDetail(goodsInfoId, type, leaseTerm);
}
@ApiOperation(value = "商品列表-分页")
@PostMapping("listPageGoodsInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = GoodsInfoListDTO.class)})
public ResultBody listPageGoodsInfo(@ApiParam("商品查询条件QO") @RequestBody MallGoodsQO param) {
return ResultBody.success(goodsInfoService.listPageGoodsInfo(param));
}
@ApiOperation(value = "商品批量上下架")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("batchOnShelfOrTakeDown")
public ResultBody batchOnShelfOrTakeDown(
@ApiParam(value = "商品上下架参数", required = true) @RequestBody BatchShelfVO batchOnShelfVO) {
return goodsInfoService.batchOnShelfOrTakeDown(
batchOnShelfVO.getGoodsIds(), batchOnShelfVO.getStatus());
}
@ApiOperation(value = "商品批量删除")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("batchRemoveWareInfo")
public ResultBody batchRemoveWareInfo(
@ApiParam(value = "商品id数组", required = true) @RequestBody List<Integer> ids) {
return goodsInfoService.batchRemoveWareInfo(ids);
}
@ApiOperation(value = "单位信息")
@GetMapping("getSkuUnit")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = SkuUnitDTO.class)})
public ResultBody getSkuUnit() {
return goodsInfoService.getSkuUnit();
}
@ApiOperation(value = "PC端-其他服务-列表")
@GetMapping("listOtherService")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = SaleServiceDTO.class)})
public ResultBody listOtherService() {
return goodsInfoService.getSaleServiceInfoToList();
}
@ApiOperation(value = "feign根据购物车信息填充未知信息", hidden = true)
@PostMapping("fillGoodsInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = MallGoodsShopCarDTO.class)})
public List<MallGoodsShopCarDTO> fillGoodsInfo(@RequestBody List<MallGoodsShopCarDTO> param) {
return goodsInfoService.fillGoodsInfo(param);
}
@ApiOperation(value = "feign根据渠道等级和产品规格id获取对应价格", hidden = true)
@PostMapping("feignListProductSpecPrice")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public List<MallProductSpecPriceDTO> feignListProductSpecPrice(
@RequestBody ProductSpecPriceQO productSpecPriceQO) {
return goodsInfoService.feignListProductSpecPrice(productSpecPriceQO);
}
@ApiOperation(value = "feign根据渠道等级获取单价信息", hidden = true)
@GetMapping("feignGetUnitPriceByTag")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecPriceDTO.class)})
public ProductSpecPriceDTO feignGetUnitPriceByTag(
@RequestParam(value = "specId") Integer specId,
@RequestParam(value = "tagId") Integer tagId) {
return goodsInfoService.feignGetUnitPriceByTag(specId, tagId);
}
@ApiOperation(value = "feign根据商品的产品规格id查询商品信息", hidden = true)
@PostMapping("feignListProdGoodsSkuInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = OrderGoodsProdDTO.class)})
public List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(
@RequestBody MallOrderGoodsInfoQO mallOrderGoodsInfoQO) {
return goodsInfoService.feignListProdGoodsSkuInfo(mallOrderGoodsInfoQO);
}
@ApiOperation(value = "feign根据商品的行业规格id查询商品清单信息", hidden = true)
@PostMapping("feignListIndstGoodsSkuInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = OrderGoodsProdDTO.class)})
public List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(
@RequestBody MallOrderGoodsInfoQO mallOrderGoodsInfoQO) {
return goodsInfoService.feignListIndstGoodsSkuInfo(mallOrderGoodsInfoQO);
}
}
package com.mmc.pms.controller;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.categories.vo.DirectoryInfoVO;
import com.mmc.pms.model.group.Create;
import com.mmc.pms.model.group.Update;
import com.mmc.pms.model.lease.vo.PriceAcquisition;
......@@ -17,124 +18,140 @@ import java.math.BigDecimal;
/**
* @Author LW
* @date 2022/9/22 10:28
* 概要:
*
* @date 2022/9/22 10:28 概要:
*/
@RestController
@RequestMapping("/product/spec/")
@Api(tags = {"产品管理模块-相关接口"})
public class BackstageProductSpecController {
@Autowired
private ProductSkuService productSkuService;
@ApiOperation(value = "新增产品sku")
@PostMapping("addProductSku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addProductSku(@Validated(Create.class) @ApiParam("产品skuVO") @RequestBody ProductSkuVO param) {
return productSkuService.addProductSku(param);
}
@ApiOperation(value = "产品sku详情")
@GetMapping("getProductSkuDetail")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSkuDTO.class)})
public ResultBody getProductSkuDetail(@ApiParam("id") @RequestParam(value = "id") Integer id) {
return productSkuService.getProductSkuDetail(id);
}
@ApiOperation(value = "编辑产品sku")
@PostMapping("editProductSku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody editProductSku(@Validated(Update.class) @ApiParam("产品skuVO") @RequestBody ProductSkuVO param) {
return productSkuService.editProductSku(param);
}
@ApiOperation(value = "产品sku分页列表")
@PostMapping("listPageProductSku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSkuDTO.class)})
public ResultBody listPageProductSku(@ApiParam("条件参数") @RequestBody ProductSkuQO productSkuQO) {
return productSkuService.listPageProductSku(productSkuQO);
}
@ApiOperation(value = "删除产品sku")
@GetMapping("removeProductSku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody removeProductSku(@ApiParam("id") @RequestParam(value = "id") Integer id) {
return productSkuService.removeProductSku(id);
}
@ApiOperation(value = "新增or修改产品规格")
@PostMapping("addOrEditProductSpec")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addOrEditProductSpec(@Validated({Create.class, Update.class}) @ApiParam("产品规格VO") @RequestBody ProductSpecVO param) {
return productSkuService.addOrEditProductSpec(param);
}
@ApiOperation(value = "产品规格编辑回显")
@GetMapping("getProductSpecDetail")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecDTO.class)})
public ResultBody getProductSpecDetail(@ApiParam("id") @RequestParam(value = "id") Integer id) {
return productSkuService.getProductSpecDetail(id);
}
@ApiOperation(value = "产品规格分页列表")
@GetMapping("listPageProductSpec")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecDTO.class)})
public ResultBody listPageProductSpec(@ApiParam(value = "页码") @RequestParam(value = "pageNo") Integer pageNo,
@ApiParam(value = "每页显示数") @RequestParam(value = "pageSize") Integer pageSize,
@ApiParam(value = "产品skuId") @RequestParam(value = "productSkuId") Integer productSkuId) {
return productSkuService.listPageProductSpec(pageNo, pageSize, productSkuId);
}
@ApiOperation(value = "产品规格管理-价格配置")
@PostMapping("productSpecCPQ")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody productSpecCPQ(@RequestBody ProductSpecCPQVO productSpecCPQVO) {
return productSkuService.productSpecCPQ(productSpecCPQVO);
}
@ApiOperation(value = "价格配置信息的修改")
@PostMapping("updateProductSpecCPQ")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody updateProductSpecCPQ(@RequestBody ProductSpecCPQVO productSpecCPQVO) {
return productSkuService.updateProductSpecCPQ(productSpecCPQVO);
}
@ApiOperation(value = "产品规格管理---获取价格配置信息")
@PostMapping("getProductSpecCPQ")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecPriceDTO.class)})
public ResultBody getProductSpecCPQ(@RequestBody ProductSpecCPQVO productSpecCPQVO) {
return productSkuService.getProductSpecCPQ(productSpecCPQVO);
}
//
// @ApiOperation(value = "价格配置信息--恢复全局默认设置")
// @GetMapping("getDefaultSettings")
// @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecPriceDTO.class)})
// public ResultBody getDefaultSettings(@ApiParam(value = "规格id") @RequestParam(value = "productSpecId") Integer productSpecId) {
// return productSpecService.getDefaultSettings(productSpecId);
// }
//
@ApiOperation(value = "产品规格管理---删除规格")
@GetMapping("removeProductSpec")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = RemoveSkuDTO.class)})
public ResultBody removeProductSpec(@ApiParam("id") @RequestParam(value = "id") Integer id) {
return productSkuService.removeProductSpec(id);
}
//
// @ApiOperation(value = "feign根据渠道等级获取单价信息")
// @GetMapping("feignGetUnitPriceByTag")
// @ApiIgnore
// @ApiResponses({@ApiResponse(code = 200, message = "OK",response = ProductSpecPriceDTO.class)})
// public ProductSpecPriceDTO feignGetUnitPriceByTag(@RequestParam(value = "specId")Integer specId,
// @RequestParam(value = "tagId")Integer tagId) {
// return productSpecService.feignGetUnitPriceByTag(specId,tagId);
// }
@ApiOperation(value = "feign根据渠道等级获取单价信息")
@PostMapping("feignGetSpecLeaseUnitPrice")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public BigDecimal feignGetUnitPriceByTag(@RequestBody PriceAcquisition priceAcquisition) {
return productSkuService.feignGetUnitPriceByTag(priceAcquisition);
}
@Autowired private ProductSkuService productSkuService;
@ApiOperation(value = "新增产品sku")
@PostMapping("addProductSku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addProductSku(
@Validated(Create.class) @ApiParam("产品skuVO") @RequestBody ProductSkuVO param) {
return productSkuService.addProductSku(param);
}
@ApiOperation(value = "产品sku详情")
@GetMapping("getProductSkuDetail")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSkuDTO.class)})
public ResultBody getProductSkuDetail(@ApiParam("id") @RequestParam(value = "id") Integer id) {
return productSkuService.getProductSkuDetail(id);
}
@ApiOperation(value = "编辑产品sku")
@PostMapping("editProductSku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody editProductSku(
@Validated(Update.class) @ApiParam("产品skuVO") @RequestBody ProductSkuVO param) {
return productSkuService.editProductSku(param);
}
@ApiOperation(value = "产品目录列表")
@GetMapping("productDirectoryList")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = DirectoryInfoVO.class)})
public ResultBody<DirectoryInfoVO> productDirectoryList() {
return productSkuService.productDirectoryList();
}
@ApiOperation(value = "产品sku分页列表")
@PostMapping("listPageProductSku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSkuDTO.class)})
public ResultBody listPageProductSku(@ApiParam("条件参数") @RequestBody ProductSkuQO productSkuQO) {
return productSkuService.listPageProductSku(productSkuQO);
}
@ApiOperation(value = "删除产品sku")
@GetMapping("removeProductSku")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody removeProductSku(@ApiParam("id") @RequestParam(value = "id") Integer id) {
return productSkuService.removeProductSku(id);
}
@ApiOperation(value = "新增or修改产品规格")
@PostMapping("addOrEditProductSpec")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addOrEditProductSpec(
@Validated({Create.class, Update.class}) @ApiParam("产品规格VO") @RequestBody
ProductSpecVO param) {
return productSkuService.addOrEditProductSpec(param);
}
@ApiOperation(value = "产品规格编辑回显")
@GetMapping("getProductSpecDetail")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecDTO.class)})
public ResultBody getProductSpecDetail(@ApiParam("id") @RequestParam(value = "id") Integer id) {
return productSkuService.getProductSpecDetail(id);
}
@ApiOperation(value = "产品规格分页列表")
@GetMapping("listPageProductSpec")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecDTO.class)})
public ResultBody listPageProductSpec(
@ApiParam(value = "页码") @RequestParam(value = "pageNo") Integer pageNo,
@ApiParam(value = "每页显示数") @RequestParam(value = "pageSize") Integer pageSize,
@ApiParam(value = "产品skuId") @RequestParam(value = "productSkuId") Integer productSkuId,
@ApiParam(value = "关键字") @RequestParam(value = "keyword", required = false) String keyword) {
return productSkuService.listPageProductSpec(pageNo, pageSize, productSkuId, keyword);
}
@ApiOperation(value = "产品规格管理-价格配置")
@PostMapping("productSpecCPQ")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody productSpecCPQ(@RequestBody ProductSpecCPQVO productSpecCPQVO) {
return productSkuService.productSpecCPQ(productSpecCPQVO);
}
@ApiOperation(value = "价格配置信息的修改")
@PostMapping("updateProductSpecCPQ")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody updateProductSpecCPQ(@RequestBody ProductSpecCPQVO productSpecCPQVO) {
return productSkuService.updateProductSpecCPQ(productSpecCPQVO);
}
@ApiOperation(value = "产品规格管理---获取价格配置信息")
@PostMapping("getProductSpecCPQ")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecPriceDTO.class)})
public ResultBody getProductSpecCPQ(@RequestBody ProductSpecCPQVO productSpecCPQVO) {
return productSkuService.getProductSpecCPQ(productSpecCPQVO);
}
//
// @ApiOperation(value = "价格配置信息--恢复全局默认设置")
// @GetMapping("getDefaultSettings")
// @ApiResponses({@ApiResponse(code = 200, message = "OK", response =
// ProductSpecPriceDTO.class)})
// public ResultBody getDefaultSettings(@ApiParam(value = "规格id") @RequestParam(value =
// "productSpecId") Integer productSpecId) {
// return productSpecService.getDefaultSettings(productSpecId);
// }
//
@ApiOperation(value = "产品规格管理---删除规格")
@GetMapping("removeProductSpec")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = RemoveSkuDTO.class)})
public ResultBody removeProductSpec(@ApiParam("id") @RequestParam(value = "id") Integer id) {
return productSkuService.removeProductSpec(id);
}
//
// @ApiOperation(value = "feign根据渠道等级获取单价信息")
// @GetMapping("feignGetUnitPriceByTag")
// @ApiIgnore
// @ApiResponses({@ApiResponse(code = 200, message = "OK",response =
// ProductSpecPriceDTO.class)})
// public ProductSpecPriceDTO feignGetUnitPriceByTag(@RequestParam(value = "specId")Integer
// specId,
// @RequestParam(value = "tagId")Integer
// tagId) {
// return productSpecService.feignGetUnitPriceByTag(specId,tagId);
// }
@ApiOperation(value = "feign根据渠道等级获取单价信息")
@PostMapping("feignGetSpecLeaseUnitPrice")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public BigDecimal feignGetUnitPriceByTag(@RequestBody PriceAcquisition priceAcquisition) {
return productSkuService.feignGetUnitPriceByTag(priceAcquisition);
}
}
package com.mmc.pms.controller;
import com.mmc.pms.common.Page;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.group.Create;
import com.mmc.pms.model.group.Update;
import com.mmc.pms.model.qo.ServiceQO;
import com.mmc.pms.model.work.dto.ServiceDTO;
import com.mmc.pms.model.work.dto.WorkServiceDTO;
import com.mmc.pms.model.work.vo.ServiceVO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.model.work.vo.UpAndDownServiceVO;
import com.mmc.pms.service.BackstageTaskService;
import io.swagger.annotations.*;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* @Author LW
* @date 2023/6/6 10:41
* 概要:
*
* @date 2023/6/6 10:41 概要:
*/
@Api(tags = {"后台-服务管理-模块"})
@RestController
@RequestMapping("/backstage/work")
public class BackstageTaskServiceController extends BaseController {
@Resource
private BackstageTaskService backstageTaskService;
@Resource private BackstageTaskService backstageTaskService;
@ApiOperation(value = "新增作业服务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("addWorkService")
public ResultBody addWorkService(
@Validated(Create.class) @RequestBody ServiceVO param, HttpServletRequest request) {
return backstageTaskService.addWorkService(
param, this.getUserLoginInfoFromRedis(request).getUserAccountId());
}
@ApiOperation(value = "修改作业服务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("updateWorkService")
public ResultBody updateWorkService(@Validated(Update.class) @RequestBody ServiceVO param) {
return backstageTaskService.updateById(param);
}
@ApiOperation(value = "批量删除作业服务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("deleteWorkService")
public ResultBody deleteWorkService(@ApiParam("作业服务id") @RequestBody List<Integer> ids) {
return backstageTaskService.deleteByIds(ids);
}
@ApiOperation(value = "新增作业服务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("addWorkService")
public ResultBody addWorkService(@Validated(Create.class) @RequestBody ServiceVO param, HttpServletRequest request) {
return backstageTaskService.addWorkService(param, this.getUserLoginInfoFromRedis(request).getUserAccountId());
}
@ApiOperation(value = "批量上下架作业服务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("batchUpAndDownWorkService")
public ResultBody batchUpAndDownWorkService(@RequestBody UpAndDownServiceVO param) {
return backstageTaskService.batchUpAndDownWorkService(param);
}
@ApiOperation(value = "修改作业服务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("updateWorkService")
public ResultBody updateWorkService(@Validated(Update.class) @RequestBody ServiceVO param) {
return backstageTaskService.updateById(param);
}
@ApiOperation(value = "查询作业服务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ServiceDTO.class)})
@GetMapping("queryWorkService")
public ResultBody<ServiceDTO> queryWorkService(@ApiParam("作业服务id") @RequestParam(value = "id") Integer id) {
return backstageTaskService.queryById(id);
}
@ApiOperation(value = "删除作业服务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("deleteWorkService")
public ResultBody deleteWorkService(@ApiParam("作业服务id") @RequestParam(value = "id") Integer id) {
return backstageTaskService.deleteById(id);
}
@ApiOperation(value = "查询服务管理列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ServiceDTO.class)})
@PostMapping("queryServiceManagerList")
public ResultBody<ServiceDTO> queryServiceManagerList(
@Validated(Page.class) @RequestBody ServiceQO param, HttpServletRequest request) {
return ResultBody.success(backstageTaskService.queryServiceManagerList(param, this.getUserLoginInfoFromRedis(request).getUserAccountId()));
}
@ApiOperation(value = "查询作业服务")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ServiceDTO.class)})
@GetMapping("queryWorkService")
public ResultBody queryWorkService(@ApiParam("作业服务id") @RequestParam(value = "id") Integer id) {
return backstageTaskService.queryById(id);
}
@ApiOperation(value = "web接口-条件查询作业服务列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = WorkServiceDTO.class)})
@PostMapping("queryWorkServiceList")
public ResultBody<WorkServiceDTO> queryWorkServiceList(@Validated(Page.class) @RequestBody ServiceQO param, HttpServletRequest request) {
return ResultBody.success(backstageTaskService.queryWorkServiceList(param,request));
}
@ApiOperation(value = "查询工作服务列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ServiceDTO.class)})
@PostMapping("queryWorkServiceList")
public PageResult queryWorkServiceList(@Validated(Create.class) @RequestBody ServiceQO param, HttpServletRequest request) {
return backstageTaskService.queryWorkServiceList(param, this.getUserLoginInfoFromRedis(request).getUserAccountId());
}
@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,48 +11,48 @@ import org.springframework.data.redis.core.StringRedisTemplate;
import javax.servlet.http.HttpServletRequest;
/**
* @author: zj
* @Date: 2023/5/25 18:11
* @author: zj @Date: 2023/5/25 18:11
*/
public abstract class BaseController {
@Autowired
private StringRedisTemplate stringRedisTemplate;
@Autowired private StringRedisTemplate stringRedisTemplate;
/**
* 解析token,获取用户信息
* @param request
* @return
*/
// public BaseAccountDTO getUserLoginInfo(HttpServletRequest request) {
// String token = request.getHeader("token");
// try {
// Claims claims = JwtUtil.parseJwt(token);
// String userId = claims.get(JwtConstant.USER_ACCOUNT_ID).toString();
//// String roleId = claims.get("").toString();
// String tokenType = claims.get(JwtConstant.TOKEN_TYPE).toString();
// return BaseAccountDTO.builder().id(Integer.parseInt(userId)).tokenPort(tokenType).build();
// }catch (Exception e){
// throw new BizException("Invalid token");
// }
// }
/**
* 解析token,获取用户信息
*
* @param request
* @return
*/
// public BaseAccountDTO getUserLoginInfo(HttpServletRequest request) {
// String token = request.getHeader("token");
// try {
// Claims claims = JwtUtil.parseJwt(token);
// String userId = claims.get(JwtConstant.USER_ACCOUNT_ID).toString();
//// String roleId = claims.get("").toString();
// String tokenType = claims.get(JwtConstant.TOKEN_TYPE).toString();
// return
// BaseAccountDTO.builder().id(Integer.parseInt(userId)).tokenPort(tokenType).build();
// }catch (Exception e){
// throw new BizException("Invalid token");
// }
// }
/**
* 使用token从redis获取用户信息
*
* @param request
* @return
*/
public LoginSuccessDTO getUserLoginInfoFromRedis(HttpServletRequest request) {
String token = request.getHeader("token");
if (StringUtils.isBlank(token)) {
throw new BizException(ResultEnum.LOGIN_ACCOUNT_STATUS_ERROR);
}
String json = stringRedisTemplate.opsForValue().get(token);
if (StringUtils.isBlank(json)) {
throw new BizException(ResultEnum.LOGIN_ACCOUNT_STATUS_ERROR);
}
LoginSuccessDTO loginSuccessDTO = JSONObject.parseObject(json, LoginSuccessDTO.class);
return loginSuccessDTO;
/**
* 使用token从redis获取用户信息
*
* @param request
* @return
*/
public LoginSuccessDTO getUserLoginInfoFromRedis(HttpServletRequest request) {
String token = request.getHeader("token");
if (StringUtils.isBlank(token)) {
throw new BizException(ResultEnum.LOGIN_ACCOUNT_STATUS_ERROR);
}
String json = stringRedisTemplate.opsForValue().get(token);
if (StringUtils.isBlank(json)) {
throw new BizException(ResultEnum.LOGIN_ACCOUNT_STATUS_ERROR);
}
LoginSuccessDTO loginSuccessDTO = JSONObject.parseObject(json, LoginSuccessDTO.class);
return loginSuccessDTO;
}
}
package com.mmc.pms.controller;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.entity.Categories;
import com.mmc.pms.model.categories.dto.CategoriesDTO;
import com.mmc.pms.model.group.Create;
import com.mmc.pms.model.qo.ServiceQO;
import com.mmc.pms.model.work.dto.ServiceDTO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.CategoriesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 前端控制器
* </p>
*
* @author Pika
* @since 2023-06-08
*/
@Api(tags = {"后台-目录管理-接口"})
@RestController
@RequestMapping("/directory")
public class DirectoryController {
private final String DIRECTORY_NAME_APPLICATION = "应用";
private final String DIRECTORY_NAME_INDUSTRY = "行业";
@Autowired
private CategoriesService categoriesService;
@ApiOperation(value = "获取应用类型列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = CategoriesDTO.class)})
@PostMapping("getApplicationList")
public ResultBody getApplicationList() {
return categoriesService.getApplicationList(DIRECTORY_NAME_APPLICATION);
}
@ApiOperation(value = "获取对应行业列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = CategoriesDTO.class)})
@PostMapping("getIndustryList")
public ResultBody getIndustryList() {
return categoriesService.getApplicationList(DIRECTORY_NAME_INDUSTRY);
}
}
......@@ -5,20 +5,16 @@ import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.model.lease.dto.BrandDTO;
import com.mmc.pms.model.lease.dto.DeviceCategoryDTO;
import com.mmc.pms.model.lease.dto.WareInfoDTO;
import com.mmc.pms.model.lease.dto.WareInfoItemDTO;
import com.mmc.pms.model.lease.vo.LeaseVo;
import com.mmc.pms.model.other.dto.DistrictInfoDTO;
import com.mmc.pms.model.other.dto.ModelDTO;
import com.mmc.pms.model.qo.WareInfoQO;
import com.mmc.pms.model.sale.dto.SkuInfoDTO;
import com.mmc.pms.page.Page;
import com.mmc.pms.service.WebDeviceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
......@@ -57,13 +53,13 @@ public class MiniProgramDeviceController {
return webDeviceService.model();
}
@ApiOperation(value = "设备列表筛选")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = WareInfoItemDTO.class)})
@PostMapping("/deviceList")
public ResultBody<WareInfoItemDTO> listWareInfoPage(
@RequestBody @Validated(Page.class) WareInfoQO param) {
return webDeviceService.listWareInfoPage(param);
}
// @ApiOperation(value = "设备列表筛选")
// @ApiResponses({@ApiResponse(code = 200, message = "OK", response = WareInfoItemDTO.class)})
// @PostMapping("/deviceList")
// public ResultBody<WareInfoItemDTO> listWareInfoPage(
// @RequestBody @Validated(Page.class) WareInfoQO param) {
// return webDeviceService.listWareInfoPage(param, request);
// }
@ApiOperation(value = "设备详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
......
......@@ -32,197 +32,196 @@ import java.util.List;
@RequestMapping("/partupload")
public class PartUploadController {
@Autowired
private StringRedisTemplate stringRedisTemplate;
@ApiOperation(value = "初始化分片上传")
@GetMapping("/initPartUpload")
public ResultBody initPartUpload(@RequestParam String fileName, HttpServletRequest httpRequest) {
// 创建OSSClient实例。
OSS ossClient =
new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
StringBuffer objectName = new StringBuffer();
objectName.append(OssConstant.BUCKET);
objectName.append("/");
objectName.append(fileName);
objectName.append("-");
objectName.append(TDateUtil.getCurrentDateByType("yyyyMMddHHmm"));
// 创建InitiateMultipartUploadRequest对象。
InitiateMultipartUploadRequest request =
new InitiateMultipartUploadRequest(OssConstant.BUCKET, objectName.toString());
// 如果需要在初始化分片时设置文件存储类型,请参考以下示例代码。
// ObjectMetadata metadata = new ObjectMetadata();
// metadata.setHeader(OSSHeaders.OSS_STORAGE_CLASS,
// StorageClass.Standard.toString());
// request.setObjectMetadata(metadata);
// 初始化分片。
InitiateMultipartUploadResult upresult = ossClient.initiateMultipartUpload(request);
// 返回uploadId,它是分片上传事件的唯一标识。您可以根据该uploadId发起相关的操作,例如取消分片上传、查询分片上传等。
String uploadId = upresult.getUploadId();
// 记录缓存信息
PartUploadInfo pinfo = new PartUploadInfo();
pinfo.setBucketName(OssConstant.BUCKET);
pinfo.setObjectName(objectName.toString());
pinfo.setUploadId(uploadId);
stringRedisTemplate
.opsForValue()
.set(RedisConstant.createPartUploadKey(uploadId), JsonUtil.parseObjToJson(pinfo));
return ResultBody.success(uploadId);
@Autowired private StringRedisTemplate stringRedisTemplate;
@ApiOperation(value = "初始化分片上传")
@GetMapping("/initPartUpload")
public ResultBody initPartUpload(@RequestParam String fileName, HttpServletRequest httpRequest) {
// 创建OSSClient实例。
OSS ossClient =
new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
StringBuffer objectName = new StringBuffer();
objectName.append(OssConstant.BUCKET);
objectName.append("/");
objectName.append(fileName);
objectName.append("-");
objectName.append(TDateUtil.getCurrentDateByType("yyyyMMddHHmm"));
// 创建InitiateMultipartUploadRequest对象。
InitiateMultipartUploadRequest request =
new InitiateMultipartUploadRequest(OssConstant.BUCKET, objectName.toString());
// 如果需要在初始化分片时设置文件存储类型,请参考以下示例代码。
// ObjectMetadata metadata = new ObjectMetadata();
// metadata.setHeader(OSSHeaders.OSS_STORAGE_CLASS,
// StorageClass.Standard.toString());
// request.setObjectMetadata(metadata);
// 初始化分片。
InitiateMultipartUploadResult upresult = ossClient.initiateMultipartUpload(request);
// 返回uploadId,它是分片上传事件的唯一标识。您可以根据该uploadId发起相关的操作,例如取消分片上传、查询分片上传等。
String uploadId = upresult.getUploadId();
// 记录缓存信息
PartUploadInfo pinfo = new PartUploadInfo();
pinfo.setBucketName(OssConstant.BUCKET);
pinfo.setObjectName(objectName.toString());
pinfo.setUploadId(uploadId);
stringRedisTemplate
.opsForValue()
.set(RedisConstant.createPartUploadKey(uploadId), JsonUtil.parseObjToJson(pinfo));
return ResultBody.success(uploadId);
}
@ApiOperation(value = "进行片段上传")
@PostMapping("/partUpload")
public ResultBody partUpload(
@RequestParam("partFile") MultipartFile partFile, @RequestParam("uploadId") String uploadId)
throws IOException {
PartUploadInfo pinfo =
JsonUtil.parseJsonToObj(
stringRedisTemplate.opsForValue().get(RedisConstant.createPartUploadKey(uploadId)),
PartUploadInfo.class);
// 创建OSSClient实例。
OSS ossClient =
new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
// partETags是PartETag的集合。PartETag由分片的ETag和分片号组成。
List<PartETag> partETags = new ArrayList<PartETag>();
// 每个分片的大小,用于计算文件有多少个分片。单位为字节。
final long partSize = 1 * 1024 * 1024L; // 1 MB。
// 填写本地文件的完整路径。如果未指定本地路径,则默认从示例程序所属项目对应本地路径中上传文件。
final File sampleFile = new File("D:\\localpath\\examplefile.txt");
long fileLength = sampleFile.length();
int partCount = (int) (fileLength / partSize);
if (fileLength % partSize != 0) {
partCount++;
}
@ApiOperation(value = "进行片段上传")
@PostMapping("/partUpload")
public ResultBody partUpload(
@RequestParam("partFile") MultipartFile partFile, @RequestParam("uploadId") String uploadId)
throws IOException {
PartUploadInfo pinfo =
JsonUtil.parseJsonToObj(
stringRedisTemplate.opsForValue().get(RedisConstant.createPartUploadKey(uploadId)),
PartUploadInfo.class);
// 创建OSSClient实例。
OSS ossClient =
new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
// partETags是PartETag的集合。PartETag由分片的ETag和分片号组成。
List<PartETag> partETags = new ArrayList<PartETag>();
// 每个分片的大小,用于计算文件有多少个分片。单位为字节。
final long partSize = 1 * 1024 * 1024L; // 1 MB。
// 填写本地文件的完整路径。如果未指定本地路径,则默认从示例程序所属项目对应本地路径中上传文件。
final File sampleFile = new File("D:\\localpath\\examplefile.txt");
long fileLength = sampleFile.length();
int partCount = (int) (fileLength / partSize);
if (fileLength % partSize != 0) {
partCount++;
}
// 遍历分片上传。
for (int i = 0; i < partCount; i++) {
long startPos = i * partSize;
long curPartSize = (i + 1 == partCount) ? (fileLength - startPos) : partSize;
InputStream instream = new FileInputStream(sampleFile);
// 跳过已经上传的分片。
instream.skip(startPos);
UploadPartRequest uploadPartRequest = new UploadPartRequest();
uploadPartRequest.setBucketName(pinfo.getBucketName());
uploadPartRequest.setKey(pinfo.getObjectName());
uploadPartRequest.setUploadId(uploadId);
uploadPartRequest.setInputStream(instream);
// 设置分片大小。除了最后一个分片没有大小限制,其他的分片最小为100 KB。
uploadPartRequest.setPartSize(curPartSize);
// 设置分片号。每一个上传的分片都有一个分片号,取值范围是1~10000,如果超出此范围,OSS将返回InvalidArgument错误码。
uploadPartRequest.setPartNumber(i + 1);
// 每个分片不需要按顺序上传,甚至可以在不同客户端上传,OSS会按照分片号排序组成完整的文件。
UploadPartResult uploadPartResult = ossClient.uploadPart(uploadPartRequest);
// 每次上传分片之后,OSS的返回结果包含PartETag。PartETag将被保存在partETags中。
partETags.add(uploadPartResult.getPartETag());
}
// 创建CompleteMultipartUploadRequest对象。
// 在执行完成分片上传操作时,需要提供所有有效的partETags。OSS收到提交的partETags后,会逐一验证每个分片的有效性。当所有的数据分片验证通过后,OSS将把这些分片组合成一个完整的文件。
CompleteMultipartUploadRequest completeMultipartUploadRequest =
new CompleteMultipartUploadRequest(
pinfo.getBucketName(), pinfo.getObjectName(), uploadId, partETags);
// 如果需要在完成文件上传的同时设置文件访问权限,请参考以下示例代码。
// completeMultipartUploadRequest.setObjectACL(CannedAccessControlList.PublicRead);
// 完成上传。
CompleteMultipartUploadResult completeMultipartUploadResult =
ossClient.completeMultipartUpload(completeMultipartUploadRequest);
System.out.println(completeMultipartUploadResult.getETag());
// 关闭OSSClient。
ossClient.shutdown();
return ResultBody.success();
// 遍历分片上传。
for (int i = 0; i < partCount; i++) {
long startPos = i * partSize;
long curPartSize = (i + 1 == partCount) ? (fileLength - startPos) : partSize;
InputStream instream = new FileInputStream(sampleFile);
// 跳过已经上传的分片。
instream.skip(startPos);
UploadPartRequest uploadPartRequest = new UploadPartRequest();
uploadPartRequest.setBucketName(pinfo.getBucketName());
uploadPartRequest.setKey(pinfo.getObjectName());
uploadPartRequest.setUploadId(uploadId);
uploadPartRequest.setInputStream(instream);
// 设置分片大小。除了最后一个分片没有大小限制,其他的分片最小为100 KB。
uploadPartRequest.setPartSize(curPartSize);
// 设置分片号。每一个上传的分片都有一个分片号,取值范围是1~10000,如果超出此范围,OSS将返回InvalidArgument错误码。
uploadPartRequest.setPartNumber(i + 1);
// 每个分片不需要按顺序上传,甚至可以在不同客户端上传,OSS会按照分片号排序组成完整的文件。
UploadPartResult uploadPartResult = ossClient.uploadPart(uploadPartRequest);
// 每次上传分片之后,OSS的返回结果包含PartETag。PartETag将被保存在partETags中。
partETags.add(uploadPartResult.getPartETag());
}
@ApiOperation(value = "上传到阿里云oss")
@PostMapping("/oss")
public ResultBody oss(
@RequestPart("uploadFile") MultipartFile uploadFile, HttpServletRequest httpRequest)
throws Exception {
// yourEndpoint填写Bucket所在地域对应的Endpoint。以华东1(杭州)为例,Endpoint填写为https://oss-cn-hangzhou.aliyuncs.com。
String endpoint = "yourEndpoint";
// 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。
String accessKeyId = "yourAccessKeyId";
String accessKeySecret = "yourAccessKeySecret";
// 填写Bucket名称,例如examplebucket。
String bucketName = "examplebucket";
// 填写Object完整路径,例如exampledir/exampleobject.txt。Object完整路径中不能包含Bucket名称。
String objectName = "exampledir/exampleobject.txt";
// 创建OSSClient实例。
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
// 创建InitiateMultipartUploadRequest对象。
InitiateMultipartUploadRequest request =
new InitiateMultipartUploadRequest(bucketName, objectName);
// 如果需要在初始化分片时设置文件存储类型,请参考以下示例代码。
// ObjectMetadata metadata = new ObjectMetadata();
// metadata.setHeader(OSSHeaders.OSS_STORAGE_CLASS,
// StorageClass.Standard.toString());
// request.setObjectMetadata(metadata);
// 初始化分片。
InitiateMultipartUploadResult upresult = ossClient.initiateMultipartUpload(request);
// 返回uploadId,它是分片上传事件的唯一标识。您可以根据该uploadId发起相关的操作,例如取消分片上传、查询分片上传等。
String uploadId = upresult.getUploadId();
// partETags是PartETag的集合。PartETag由分片的ETag和分片号组成。
List<PartETag> partETags = new ArrayList<PartETag>();
// 每个分片的大小,用于计算文件有多少个分片。单位为字节。
final long partSize = 1 * 1024 * 1024L; // 1 MB。
// 填写本地文件的完整路径。如果未指定本地路径,则默认从示例程序所属项目对应本地路径中上传文件。
final File sampleFile = new File("D:\\localpath\\examplefile.txt");
long fileLength = sampleFile.length();
int partCount = (int) (fileLength / partSize);
if (fileLength % partSize != 0) {
partCount++;
}
// 遍历分片上传。
for (int i = 0; i < partCount; i++) {
long startPos = i * partSize;
long curPartSize = (i + 1 == partCount) ? (fileLength - startPos) : partSize;
InputStream instream = new FileInputStream(sampleFile);
// 跳过已经上传的分片。
instream.skip(startPos);
UploadPartRequest uploadPartRequest = new UploadPartRequest();
uploadPartRequest.setBucketName(bucketName);
uploadPartRequest.setKey(objectName);
uploadPartRequest.setUploadId(uploadId);
uploadPartRequest.setInputStream(instream);
// 设置分片大小。除了最后一个分片没有大小限制,其他的分片最小为100 KB。
uploadPartRequest.setPartSize(curPartSize);
// 设置分片号。每一个上传的分片都有一个分片号,取值范围是1~10000,如果超出此范围,OSS将返回InvalidArgument错误码。
uploadPartRequest.setPartNumber(i + 1);
// 每个分片不需要按顺序上传,甚至可以在不同客户端上传,OSS会按照分片号排序组成完整的文件。
UploadPartResult uploadPartResult = ossClient.uploadPart(uploadPartRequest);
// 每次上传分片之后,OSS的返回结果包含PartETag。PartETag将被保存在partETags中。
partETags.add(uploadPartResult.getPartETag());
}
// 创建CompleteMultipartUploadRequest对象。
// 在执行完成分片上传操作时,需要提供所有有效的partETags。OSS收到提交的partETags后,会逐一验证每个分片的有效性。当所有的数据分片验证通过后,OSS将把这些分片组合成一个完整的文件。
CompleteMultipartUploadRequest completeMultipartUploadRequest =
new CompleteMultipartUploadRequest(bucketName, objectName, uploadId, partETags);
// 如果需要在完成文件上传的同时设置文件访问权限,请参考以下示例代码。
// completeMultipartUploadRequest.setObjectACL(CannedAccessControlList.PublicRead);
// 完成上传。
CompleteMultipartUploadResult completeMultipartUploadResult =
ossClient.completeMultipartUpload(completeMultipartUploadRequest);
System.out.println(completeMultipartUploadResult.getETag());
// 关闭OSSClient。
ossClient.shutdown();
return ResultBody.success();
// 创建CompleteMultipartUploadRequest对象。
// 在执行完成分片上传操作时,需要提供所有有效的partETags。OSS收到提交的partETags后,会逐一验证每个分片的有效性。当所有的数据分片验证通过后,OSS将把这些分片组合成一个完整的文件。
CompleteMultipartUploadRequest completeMultipartUploadRequest =
new CompleteMultipartUploadRequest(
pinfo.getBucketName(), pinfo.getObjectName(), uploadId, partETags);
// 如果需要在完成文件上传的同时设置文件访问权限,请参考以下示例代码。
// completeMultipartUploadRequest.setObjectACL(CannedAccessControlList.PublicRead);
// 完成上传。
CompleteMultipartUploadResult completeMultipartUploadResult =
ossClient.completeMultipartUpload(completeMultipartUploadRequest);
System.out.println(completeMultipartUploadResult.getETag());
// 关闭OSSClient。
ossClient.shutdown();
return ResultBody.success();
}
@ApiOperation(value = "上传到阿里云oss")
@PostMapping("/oss")
public ResultBody oss(
@RequestPart("uploadFile") MultipartFile uploadFile, HttpServletRequest httpRequest)
throws Exception {
// yourEndpoint填写Bucket所在地域对应的Endpoint。以华东1(杭州)为例,Endpoint填写为https://oss-cn-hangzhou.aliyuncs.com。
String endpoint = "yourEndpoint";
// 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。
String accessKeyId = "yourAccessKeyId";
String accessKeySecret = "yourAccessKeySecret";
// 填写Bucket名称,例如examplebucket。
String bucketName = "examplebucket";
// 填写Object完整路径,例如exampledir/exampleobject.txt。Object完整路径中不能包含Bucket名称。
String objectName = "exampledir/exampleobject.txt";
// 创建OSSClient实例。
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
// 创建InitiateMultipartUploadRequest对象。
InitiateMultipartUploadRequest request =
new InitiateMultipartUploadRequest(bucketName, objectName);
// 如果需要在初始化分片时设置文件存储类型,请参考以下示例代码。
// ObjectMetadata metadata = new ObjectMetadata();
// metadata.setHeader(OSSHeaders.OSS_STORAGE_CLASS,
// StorageClass.Standard.toString());
// request.setObjectMetadata(metadata);
// 初始化分片。
InitiateMultipartUploadResult upresult = ossClient.initiateMultipartUpload(request);
// 返回uploadId,它是分片上传事件的唯一标识。您可以根据该uploadId发起相关的操作,例如取消分片上传、查询分片上传等。
String uploadId = upresult.getUploadId();
// partETags是PartETag的集合。PartETag由分片的ETag和分片号组成。
List<PartETag> partETags = new ArrayList<PartETag>();
// 每个分片的大小,用于计算文件有多少个分片。单位为字节。
final long partSize = 1 * 1024 * 1024L; // 1 MB。
// 填写本地文件的完整路径。如果未指定本地路径,则默认从示例程序所属项目对应本地路径中上传文件。
final File sampleFile = new File("D:\\localpath\\examplefile.txt");
long fileLength = sampleFile.length();
int partCount = (int) (fileLength / partSize);
if (fileLength % partSize != 0) {
partCount++;
}
// 遍历分片上传。
for (int i = 0; i < partCount; i++) {
long startPos = i * partSize;
long curPartSize = (i + 1 == partCount) ? (fileLength - startPos) : partSize;
InputStream instream = new FileInputStream(sampleFile);
// 跳过已经上传的分片。
instream.skip(startPos);
UploadPartRequest uploadPartRequest = new UploadPartRequest();
uploadPartRequest.setBucketName(bucketName);
uploadPartRequest.setKey(objectName);
uploadPartRequest.setUploadId(uploadId);
uploadPartRequest.setInputStream(instream);
// 设置分片大小。除了最后一个分片没有大小限制,其他的分片最小为100 KB。
uploadPartRequest.setPartSize(curPartSize);
// 设置分片号。每一个上传的分片都有一个分片号,取值范围是1~10000,如果超出此范围,OSS将返回InvalidArgument错误码。
uploadPartRequest.setPartNumber(i + 1);
// 每个分片不需要按顺序上传,甚至可以在不同客户端上传,OSS会按照分片号排序组成完整的文件。
UploadPartResult uploadPartResult = ossClient.uploadPart(uploadPartRequest);
// 每次上传分片之后,OSS的返回结果包含PartETag。PartETag将被保存在partETags中。
partETags.add(uploadPartResult.getPartETag());
}
// 创建CompleteMultipartUploadRequest对象。
// 在执行完成分片上传操作时,需要提供所有有效的partETags。OSS收到提交的partETags后,会逐一验证每个分片的有效性。当所有的数据分片验证通过后,OSS将把这些分片组合成一个完整的文件。
CompleteMultipartUploadRequest completeMultipartUploadRequest =
new CompleteMultipartUploadRequest(bucketName, objectName, uploadId, partETags);
// 如果需要在完成文件上传的同时设置文件访问权限,请参考以下示例代码。
// completeMultipartUploadRequest.setObjectACL(CannedAccessControlList.PublicRead);
// 完成上传。
CompleteMultipartUploadResult completeMultipartUploadResult =
ossClient.completeMultipartUpload(completeMultipartUploadRequest);
System.out.println(completeMultipartUploadResult.getETag());
// 关闭OSSClient。
ossClient.shutdown();
return ResultBody.success();
}
}
package com.mmc.pms.controller;
import com.mmc.pms.common.Page;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.constant.TokenConstant;
import com.mmc.pms.model.categories.dto.CategoryTypeDTO;
import com.mmc.pms.model.lease.dto.LeaseGoodsInfoDTO;
import com.mmc.pms.model.qo.WareInfoQO;
import com.mmc.pms.model.sale.dto.MallGoodsDetailDTO;
import com.mmc.pms.model.sale.vo.ProductSpecCPQVO;
import com.mmc.pms.service.WebDeviceService;
import io.swagger.annotations.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
/**
* @Author LW
*
* @date 2023/6/8 17:16 概要:
*/
@Api(tags = {"v1.0.1-租赁销售-相关接口"})
@RestController
@RequestMapping("/product/mall")
public class ProductMallController extends BaseController {
@Autowired private WebDeviceService webDeviceService;
@ApiOperation(value = "设备列表筛选")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = LeaseGoodsInfoDTO.class)})
@PostMapping("/deviceList")
public ResultBody<LeaseGoodsInfoDTO> listWareInfoPage(
@RequestBody @Validated(Page.class) WareInfoQO param, HttpServletRequest request) {
return webDeviceService.listWareInfoPage(
param,
request,
StringUtils.isBlank(request.getHeader(TokenConstant.TOKEN))
? null
: this.getUserLoginInfoFromRedis(request).getUserAccountId());
}
@ApiOperation(value = "设备商品详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = MallGoodsDetailDTO.class)})
@GetMapping("/getLeaseGoodsDetail")
public ResultBody<MallGoodsDetailDTO> getLeaseGoodsDetail(
Integer goodsId,
HttpServletRequest request,
@ApiParam(value = "租赁:1 销售商品:0") @RequestParam(value = "type") Integer type) {
return webDeviceService.getLeaseGoodsDetail(
goodsId,
StringUtils.isBlank(request.getHeader(TokenConstant.TOKEN))
? null
: this.getUserLoginInfoFromRedis(request).getUserAccountId(),
request,
type);
}
@ApiOperation(value = "web-首页分类数据-展示")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = CategoryTypeDTO.class)})
@GetMapping("/getPageHomeCategories")
public ResultBody<CategoryTypeDTO> getPageHomeCategories(
@ApiParam(value = "类型:1:作业服务 2:设备 3:培训 4:产品商城") @RequestParam(value = "type") Integer type) {
return webDeviceService.getPageHomeCategories(type);
}
@ApiOperation(value = "获取设备商品规格价格详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ProductSpecCPQVO.class)})
@GetMapping("/getLeaseGoodsPriceDetail")
public ResultBody<ProductSpecCPQVO> getLeaseGoodsPriceDetail(
@ApiParam(value = "商品id") @RequestParam(value = "productSpecId") Integer productSpecId,
@ApiParam(value = "租赁时限:(输入0:1-7天、输入1:8-15天、输入2:16-30天、输入3:30天以上)")
@RequestParam(value = "leaseTerm")
Integer leaseTerm) {
return webDeviceService.getLeaseGoodsPriceDetail(productSpecId, leaseTerm);
}
}
......@@ -4,10 +4,16 @@ import com.alibaba.fastjson2.JSONObject;
import com.aliyun.oss.ClientBuilderConfiguration;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.OSSException;
import com.aliyun.oss.model.ObjectMetadata;
import com.aliyun.oss.model.PutObjectRequest;
import com.aliyun.oss.model.UploadFileRequest;
import com.aliyun.oss.model.UploadFileResult;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.util.FileLoadUtil;
import com.mmc.pms.util.OssConstant;
import com.mmc.pms.util.XmlUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
......@@ -20,6 +26,7 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -30,527 +37,604 @@ import java.util.*;
@RestController
@RequestMapping("/upload")
public class UploadController {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd/");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd/");
@ApiOperation(value = "V1.0.1-上传一个图片或者文件到阿里云oss")
@ApiImplicitParams({
@ApiImplicitParam(
paramType = "header",
name = "mmc-identity",
dataTypeClass = java.lang.String.class,
dataType = "String",
required = false,
value = "token"),
@ApiImplicitParam(
name = "uploadFile",
dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true,
value = "文件/图片/后缀无限制"),
})
@PostMapping("/oss")
public ResultBody oss(
@RequestParam("uploadFile") MultipartFile uploadFile, HttpServletRequest request) {
OSS ossClient =
new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
@ApiOperation(value = "V1.0.1-上传一个图片或者文件到阿里云oss")
@ApiImplicitParams({
@ApiImplicitParam(
paramType = "header",
name = "mmc-identity",
dataTypeClass = java.lang.String.class,
dataType = "String",
required = false,
value = "token"),
@ApiImplicitParam(
name = "uploadFile",
dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true,
value = "文件/图片/后缀无限制"),
})
@PostMapping("/oss")
public ResultBody oss(
@RequestParam("uploadFile") MultipartFile uploadFile, HttpServletRequest request) {
OSS ossClient =
new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
InputStream inputStream = null;
try {
inputStream = uploadFile.getInputStream();
} catch (IOException e) {
return ResultBody.error(e.getMessage());
}
String oldName = uploadFile.getOriginalFilename();
String newName =
"file/"
+ UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, inputStream);
ossClient.shutdown();
String filePath = "https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName;
JSONObject jsObj = new JSONObject();
jsObj.put("filePath", filePath);
return ResultBody.success(jsObj);
}
@PostMapping("/breakpoint")
public ResultBody breakpoint(
@RequestParam("uploadFile") MultipartFile uploadFile, HttpServletRequest request) throws IOException {
OSS ossClient =
new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
File file = XmlUtil.ossUpload(uploadFile);
String location =null;
try {
ObjectMetadata meta = new ObjectMetadata();
// 指定上传的内容类型。
// meta.setContentType("text/plain");
// 文件上传时设置访问权限ACL。
// meta.setObjectAcl(CannedAccessControlList.Private);
String oldName = uploadFile.getOriginalFilename();
String newName =
"file/"
+ UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
// 通过UploadFileRequest设置多个参数。
// 依次填写Bucket名称(例如examplebucket)以及Object完整路径(例如exampledir/exampleobject.txt),Object完整路径中不能包含Bucket名称。
UploadFileRequest uploadFileRequest = new UploadFileRequest("pad-video-x",newName);
// 通过UploadFileRequest设置单个参数。
// 填写本地文件的完整路径,例如D:\\localpath\\examplefile.txt。如果未指定本地路径,则默认从示例程序所属项目对应本地路径中上传文件。
uploadFileRequest.setUploadFile(file.toString());
// 指定上传并发线程数,默认值为1。
uploadFileRequest.setTaskNum(15);
// 指定上传的分片大小,单位为字节,取值范围为100 KB~5 GB。默认值为100 KB。
uploadFileRequest.setPartSize(1 * 1024 * 1024);
// 开启断点续传,默认关闭。
uploadFileRequest.setEnableCheckpoint(true);
// 记录本地分片上传结果的文件。上传过程中的进度信息会保存在该文件中,如果某一分片上传失败,再次上传时会根据文件中记录的点继续上传。上传完成后,该文件会被删除。
// 如果未设置该值,默认与待上传的本地文件同路径,名称为${uploadFile}.ucp。
uploadFileRequest.setCheckpointFile("uploadFile.ucp");
// 文件的元数据。
uploadFileRequest.setObjectMetadata(meta);
// 设置上传回调,参数为Callback类型。
//uploadFileRequest.setCallback("yourCallbackEvent");
// 断点续传上传。
UploadFileResult uploadFileResult = ossClient.uploadFile(uploadFileRequest);
location = uploadFileResult.getMultipartUploadResult().getLocation();
System.out.println(uploadFileResult);
} catch (OSSException oe) {
System.out.println("Caught an OSSException, which means your request made it to OSS, "
+ "but was rejected with an error response for some reason.");
System.out.println("Error Message:" + oe.getErrorMessage());
System.out.println("Error Code:" + oe.getErrorCode());
System.out.println("Request ID:" + oe.getRequestId());
System.out.println("Host ID:" + oe.getHostId());
} catch (Throwable ce) {
System.out.println("Caught an ClientException, which means the client encountered "
+ "a serious internal problem while trying to communicate with OSS, "
+ "such as not being able to access the network.");
System.out.println("Error Message:" + ce.getMessage());
} finally {
// 关闭OSSClient。
if (ossClient != null) {
ossClient.shutdown();
}
}
deleteFile(file);
return ResultBody.success(location);
}
private void deleteFile(File... files) {
for (File file : files) {
if (file.exists()) {
file.delete();
}
}
}
@ApiOperation(value = "V1.0.1-上传多个文件到阿里云oss")
@ApiImplicitParams({
@ApiImplicitParam(
paramType = "header",
name = "mmc-identity",
dataTypeClass = java.lang.String.class,
dataType = "String",
required = false,
value = "token"),
@ApiImplicitParam(
name = "uploadFile",
dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true,
value = "文件/图片"),
})
@PostMapping("/osses")
public ResultBody osses(
@RequestParam("uploadFile") MultipartFile[] uploadFile, HttpServletRequest request)
throws IOException {
OSS ossClient =
new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
List list = new LinkedList();
if (uploadFile != null && uploadFile.length > 0) {
System.out.println("osses文件数量" + uploadFile.length);
for (int i = 0; i < uploadFile.length; i++) {
MultipartFile file = uploadFile[i];
InputStream inputStream = null;
try {
inputStream = uploadFile.getInputStream();
inputStream = file.getInputStream();
} catch (IOException e) {
return ResultBody.error(e.getMessage());
return ResultBody.error(e.getMessage());
}
String oldName = uploadFile.getOriginalFilename();
String oldName = file.getOriginalFilename();
String newName =
"file/"
+ UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
"file/"
+ UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, inputStream);
ossClient.shutdown();
String filePath = "https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName;
JSONObject jsObj = new JSONObject();
jsObj.put("filePath", filePath);
return ResultBody.success(jsObj);
// ossClient.shutdown();
// String filePath = "https://" + OssConstant.BUCKET + '.' +
// OssConstant.ENDPOINT + "/" +
// newName;
list.add("https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName);
}
}
ossClient.shutdown(); // 关流
return ResultBody.success(list);
}
@ApiOperation(value = "V1.0.1-上传多个文件到阿里云oss")
@ApiImplicitParams({
@ApiImplicitParam(
paramType = "header",
name = "mmc-identity",
dataTypeClass = java.lang.String.class,
dataType = "String",
required = false,
value = "token"),
@ApiImplicitParam(
name = "uploadFile",
dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true,
value = "文件/图片"),
})
@PostMapping("/osses")
public ResultBody osses(
@RequestParam("uploadFile") MultipartFile[] uploadFile, HttpServletRequest request)
throws IOException {
OSS ossClient =
new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
List list = new LinkedList();
if (uploadFile != null && uploadFile.length > 0) {
System.out.println("osses文件数量" + uploadFile.length);
for (int i = 0; i < uploadFile.length; i++) {
MultipartFile file = uploadFile[i];
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
} catch (IOException e) {
return ResultBody.error(e.getMessage());
}
String oldName = file.getOriginalFilename();
@ApiOperation(value = "V1.0.1-上传多个视频文件到阿里云oss")
@ApiImplicitParams({
@ApiImplicitParam(
paramType = "header",
name = "mmc-identity",
dataTypeClass = java.lang.String.class,
dataType = "String",
required = false,
value = "token"),
@ApiImplicitParam(
name = "uploadFile",
dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true,
value = "视频不能超过1MB/mkv/avi/mov/mp4"),
})
@PostMapping("/videoOss")
public ResultBody videoOss(
@RequestParam("uploadFile") MultipartFile[] uploadFile, HttpServletRequest request)
throws IOException {
ClientBuilderConfiguration clientBuilderConfiguration = new ClientBuilderConfiguration();
clientBuilderConfiguration.setRequestTimeoutEnabled(true);
clientBuilderConfiguration.setConnectionRequestTimeout(600000 * 20);
clientBuilderConfiguration.setConnectionTimeout(600000 * 20);
String newName =
"file/"
+ UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, inputStream);
// ossClient.shutdown();
// String filePath = "https://" + OssConstant.BUCKET + '.' +
// OssConstant.ENDPOINT + "/" +
// newName;
list.add("https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName);
}
OSS ossClient =
new OSSClientBuilder()
.build(
OssConstant.ENDPOINT,
OssConstant.ACCESSKEYID,
OssConstant.ACCESSKEYSECRET,
clientBuilderConfiguration);
List list = new LinkedList();
if (uploadFile != null && uploadFile.length > 0) {
System.out.println("osses文件数量" + uploadFile.length);
for (int i = 0; i < uploadFile.length; i++) {
MultipartFile file = uploadFile[i];
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
} catch (IOException e) {
return ResultBody.error(e.getMessage());
}
ossClient.shutdown(); // 关流
return ResultBody.success(list);
}
@ApiOperation(value = "V1.0.1-上传多个视频文件到阿里云oss")
@ApiImplicitParams({
@ApiImplicitParam(
paramType = "header",
name = "mmc-identity",
dataTypeClass = java.lang.String.class,
dataType = "String",
required = false,
value = "token"),
@ApiImplicitParam(
name = "uploadFile",
dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true,
value = "视频不能超过1MB/mkv/avi/mov/mp4"),
})
@PostMapping("/videoOss")
public ResultBody videoOss(
@RequestParam("uploadFile") MultipartFile[] uploadFile, HttpServletRequest request)
throws IOException {
ClientBuilderConfiguration clientBuilderConfiguration = new ClientBuilderConfiguration();
clientBuilderConfiguration.setRequestTimeoutEnabled(true);
clientBuilderConfiguration.setConnectionRequestTimeout(600000 * 20);
clientBuilderConfiguration.setConnectionTimeout(600000 * 20);
OSS ossClient =
new OSSClientBuilder()
.build(
OssConstant.ENDPOINT,
OssConstant.ACCESSKEYID,
OssConstant.ACCESSKEYSECRET,
clientBuilderConfiguration);
List list = new LinkedList();
if (uploadFile != null && uploadFile.length > 0) {
System.out.println("osses文件数量" + uploadFile.length);
for (int i = 0; i < uploadFile.length; i++) {
MultipartFile file = uploadFile[i];
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
} catch (IOException e) {
return ResultBody.error(e.getMessage());
}
try (final BufferedInputStream bis = new BufferedInputStream(inputStream)) {
// 校验
int typeNum = FileLoadUtil.checkFileType(FileLoadUtil.getType(bis));
if (typeNum != 3) {
return ResultBody.error(ResultEnum.UPLOAD_VIDEO_ERROR);
}
String oldName = file.getOriginalFilename();
String newName =
"file/"
+ UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, bis);
System.out.println("视频名称:" + newName);
list.add("https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName);
}
}
try (final BufferedInputStream bis = new BufferedInputStream(inputStream)) {
// 校验
int typeNum = FileLoadUtil.checkFileType(FileLoadUtil.getType(bis));
if (typeNum != 3) {
return ResultBody.error(ResultEnum.UPLOAD_VIDEO_ERROR);
}
String oldName = file.getOriginalFilename();
String newName =
"file/"
+ UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, bis);
System.out.println("视频名称:" + newName);
list.add("https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName);
}
ossClient.shutdown(); // 关流
return ResultBody.success(list);
}
}
ossClient.shutdown(); // 关流
return ResultBody.success(list);
}
@ApiOperation(value = "V1.0.1-上传一个视频文件到阿里云oss")
@ApiImplicitParams({
@ApiImplicitParam(
paramType = "header",
name = "mmc-identity",
dataTypeClass = java.lang.String.class,
dataType = "String",
required = false,
value = "token"),
@ApiImplicitParam(
name = "uploadFile",
dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true,
value = "视频不能超过1MB/mkv/avi/mov/mp4"),
})
@PostMapping("/videoOsses")
public ResultBody videoOsses(
@RequestParam("uploadFile") MultipartFile[] uploadFile, HttpServletRequest request)
throws IOException {
ClientBuilderConfiguration clientBuilderConfiguration = new ClientBuilderConfiguration();
clientBuilderConfiguration.setRequestTimeoutEnabled(true);
clientBuilderConfiguration.setConnectionRequestTimeout(600000 * 20);
clientBuilderConfiguration.setConnectionTimeout(600000 * 20);
@ApiOperation(value = "V1.0.1-上传一个视频文件到阿里云oss")
@ApiImplicitParams({
@ApiImplicitParam(
paramType = "header",
name = "mmc-identity",
dataTypeClass = java.lang.String.class,
dataType = "String",
required = false,
value = "token"),
@ApiImplicitParam(
name = "uploadFile",
dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true,
value = "视频不能超过1MB/mkv/avi/mov/mp4"),
})
@PostMapping("/videoOsses")
public ResultBody videoOsses(
@RequestParam("uploadFile") MultipartFile[] uploadFile, HttpServletRequest request)
throws IOException {
ClientBuilderConfiguration clientBuilderConfiguration = new ClientBuilderConfiguration();
clientBuilderConfiguration.setRequestTimeoutEnabled(true);
clientBuilderConfiguration.setConnectionRequestTimeout(600000 * 20);
clientBuilderConfiguration.setConnectionTimeout(600000 * 20);
OSS ossClient =
new OSSClientBuilder()
.build(
OssConstant.ENDPOINT,
OssConstant.ACCESSKEYID,
OssConstant.ACCESSKEYSECRET,
clientBuilderConfiguration);
Map map = new HashMap();
if (uploadFile != null && uploadFile.length > 0) {
System.out.println("osses文件数量" + uploadFile.length);
for (int i = 0; i < uploadFile.length; i++) {
MultipartFile file = uploadFile[i];
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
} catch (IOException e) {
return ResultBody.error(e.getMessage());
}
try (final BufferedInputStream bis = new BufferedInputStream(inputStream)) {
// 校验
int typeNum = FileLoadUtil.checkFileType(FileLoadUtil.getType(bis));
if (typeNum != 3) {
return ResultBody.error(ResultEnum.UPLOAD_VIDEO_ERROR);
}
String oldName = file.getOriginalFilename();
String newName =
"file/"
+ UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, bis);
System.out.println("视频名称:" + newName);
map.put(
"filePath",
"https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName);
map.put("fileName", oldName);
map.put("fileSize", file.getSize());
map.put("fileType", oldName.substring(oldName.lastIndexOf(".")).replace(".", ""));
}
}
OSS ossClient =
new OSSClientBuilder()
.build(
OssConstant.ENDPOINT,
OssConstant.ACCESSKEYID,
OssConstant.ACCESSKEYSECRET,
clientBuilderConfiguration);
Map map = new HashMap();
if (uploadFile != null && uploadFile.length > 0) {
System.out.println("osses文件数量" + uploadFile.length);
for (int i = 0; i < uploadFile.length; i++) {
MultipartFile file = uploadFile[i];
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
} catch (IOException e) {
return ResultBody.error(e.getMessage());
}
ossClient.shutdown(); // 关流
return ResultBody.success(map);
try (final BufferedInputStream bis = new BufferedInputStream(inputStream)) {
// 校验
int typeNum = FileLoadUtil.checkFileType(FileLoadUtil.getType(bis));
if (typeNum != 3) {
return ResultBody.error(ResultEnum.UPLOAD_VIDEO_ERROR);
}
String oldName = file.getOriginalFilename();
String newName =
"file/"
+ UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, bis);
System.out.println("视频名称:" + newName);
map.put(
"filePath",
"https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName);
map.put("fileName", oldName);
map.put("fileSize", file.getSize());
map.put("fileType", oldName.substring(oldName.lastIndexOf(".")).replace(".", ""));
}
}
}
ossClient.shutdown(); // 关流
return ResultBody.success(map);
}
@ApiOperation(value = "V1.0.1-上传多张图片文件到阿里云oss")
@ApiImplicitParams({
@ApiImplicitParam(
paramType = "header",
name = "mmc-identity",
dataTypeClass = java.lang.String.class,
dataType = "String",
required = false,
value = "token"),
@ApiImplicitParam(
name = "uploadFile",
dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true,
value = "图片"),
})
@PostMapping("/imgOss")
public ResultBody imgOss(
@RequestParam("uploadFile") MultipartFile[] uploadFile, HttpServletRequest request)
throws IOException {
OSS ossClient =
new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
List list = new LinkedList();
if (uploadFile != null && uploadFile.length > 0) {
System.out.println("osses文件数量" + uploadFile.length);
for (int i = 0; i < uploadFile.length; i++) {
MultipartFile file = uploadFile[i];
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
} catch (IOException e) {
@ApiOperation(value = "V1.0.1-上传多张图片文件到阿里云oss")
@ApiImplicitParams({
@ApiImplicitParam(
paramType = "header",
name = "mmc-identity",
dataTypeClass = java.lang.String.class,
dataType = "String",
required = false,
value = "token"),
@ApiImplicitParam(
name = "uploadFile",
dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true,
value = "图片"),
})
@PostMapping("/imgOss")
public ResultBody imgOss(
@RequestParam("uploadFile") MultipartFile[] uploadFile, HttpServletRequest request)
throws IOException {
OSS ossClient =
new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
List list = new LinkedList();
if (uploadFile != null && uploadFile.length > 0) {
System.out.println("osses文件数量" + uploadFile.length);
for (int i = 0; i < uploadFile.length; i++) {
MultipartFile file = uploadFile[i];
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
} catch (IOException e) {
return ResultBody.error(e.getMessage());
}
try (final BufferedInputStream bis = new BufferedInputStream(inputStream)) {
// 校验
int typeNum = FileLoadUtil.checkFileType(FileLoadUtil.getType(bis));
if (typeNum != 1) {
return ResultBody.error(ResultEnum.UPLOAD_IMG_ERROR);
}
String oldName = file.getOriginalFilename();
String newName =
"file/"
+ UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, bis);
System.out.println("图片名称:" + newName);
list.add("https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName);
}
}
return ResultBody.error(e.getMessage());
}
try (final BufferedInputStream bis = new BufferedInputStream(inputStream)) {
// 校验
int typeNum = FileLoadUtil.checkFileType(FileLoadUtil.getType(bis));
if (typeNum != 1) {
return ResultBody.error(ResultEnum.UPLOAD_IMG_ERROR);
}
String oldName = file.getOriginalFilename();
String newName =
"file/"
+ UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, bis);
System.out.println("图片名称:" + newName);
list.add("https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName);
}
ossClient.shutdown(); // 关流
return ResultBody.success(list);
}
}
ossClient.shutdown(); // 关流
return ResultBody.success(list);
}
@ApiOperation(value = "V1.0.1-上传一张图片文件到阿里云oss ")
@ApiImplicitParams({
@ApiImplicitParam(
paramType = "header",
name = "mmc-identity",
dataTypeClass = java.lang.String.class,
dataType = "String",
required = false,
value = "token"),
@ApiImplicitParam(
name = "uploadFile",
dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true,
value = "文件"),
})
@PostMapping("/singleImgOss")
public ResultBody singleImgOss(
@RequestParam("uploadFile") MultipartFile uploadFile, HttpServletRequest request)
throws IOException {
OSS ossClient =
new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
List list = new LinkedList();
if (uploadFile != null) {
if (uploadFile.getSize() / 1024 > 3096) {
return ResultBody.error("请上传小于3M的图片");
}
InputStream inputStream = null;
try {
inputStream = uploadFile.getInputStream();
} catch (IOException e) {
@ApiOperation(value = "V1.0.1-上传一张图片文件到阿里云oss ")
@ApiImplicitParams({
@ApiImplicitParam(
paramType = "header",
name = "mmc-identity",
dataTypeClass = java.lang.String.class,
dataType = "String",
required = false,
value = "token"),
@ApiImplicitParam(
name = "uploadFile",
dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true,
value = "文件"),
})
@PostMapping("/singleImgOss")
public ResultBody singleImgOss(
@RequestParam("uploadFile") MultipartFile uploadFile, HttpServletRequest request)
throws IOException {
OSS ossClient =
new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
List list = new LinkedList();
if (uploadFile != null) {
if (uploadFile.getSize() / 1024 > 3096) {
return ResultBody.error("请上传小于3M的图片");
}
InputStream inputStream = null;
try {
inputStream = uploadFile.getInputStream();
} catch (IOException e) {
return ResultBody.error(e.getMessage());
}
try (final BufferedInputStream bis = new BufferedInputStream(inputStream)) {
// 校验
int typeNum = FileLoadUtil.checkFileType(FileLoadUtil.getType(bis));
if (typeNum != 1) {
return ResultBody.error(ResultEnum.UPLOAD_IMG_ERROR);
}
String oldName = uploadFile.getOriginalFilename();
String newName =
"file/"
+ UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, bis);
System.out.println("图片名称:" + newName);
list.add("https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName);
}
return ResultBody.error(e.getMessage());
}
try (final BufferedInputStream bis = new BufferedInputStream(inputStream)) {
// 校验
int typeNum = FileLoadUtil.checkFileType(FileLoadUtil.getType(bis));
if (typeNum != 1) {
return ResultBody.error(ResultEnum.UPLOAD_IMG_ERROR);
}
ossClient.shutdown(); // 关流
return ResultBody.success(list);
String oldName = uploadFile.getOriginalFilename();
String newName =
"file/"
+ UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, bis);
System.out.println("图片名称:" + newName);
list.add("https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName);
}
}
ossClient.shutdown(); // 关流
return ResultBody.success(list);
}
@ApiOperation(value = "V1.0.1-上传一张图片文件到阿里云oss ")
@ApiImplicitParams({
@ApiImplicitParam(
paramType = "header",
name = "mmc-identity",
dataTypeClass = java.lang.String.class,
dataType = "String",
required = false,
value = "token"),
@ApiImplicitParam(
name = "uploadFile",
dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true,
value = "图片/返回图片名称及图片大小"),
})
@PostMapping("/imgOsses")
public ResultBody imgOsses(
@RequestParam("uploadFile") MultipartFile[] uploadFile, HttpServletRequest request)
throws IOException {
OSS ossClient =
new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
Map map = new HashMap();
if (uploadFile != null && uploadFile.length > 0) {
System.out.println("osses文件数量" + uploadFile.length);
for (int i = 0; i < uploadFile.length; i++) {
MultipartFile file = uploadFile[i];
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
} catch (IOException e) {
@ApiOperation(value = "V1.0.1-上传一张图片文件到阿里云oss ")
@ApiImplicitParams({
@ApiImplicitParam(
paramType = "header",
name = "mmc-identity",
dataTypeClass = java.lang.String.class,
dataType = "String",
required = false,
value = "token"),
@ApiImplicitParam(
name = "uploadFile",
dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true,
value = "图片/返回图片名称及图片大小"),
})
@PostMapping("/imgOsses")
public ResultBody imgOsses(
@RequestParam("uploadFile") MultipartFile[] uploadFile, HttpServletRequest request)
throws IOException {
OSS ossClient =
new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
Map map = new HashMap();
if (uploadFile != null && uploadFile.length > 0) {
System.out.println("osses文件数量" + uploadFile.length);
for (int i = 0; i < uploadFile.length; i++) {
MultipartFile file = uploadFile[i];
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
} catch (IOException e) {
return ResultBody.error(e.getMessage());
}
try (final BufferedInputStream bis = new BufferedInputStream(inputStream)) {
// 校验
int typeNum = FileLoadUtil.checkFileType(FileLoadUtil.getType(bis));
if (typeNum != 1) {
return ResultBody.error(ResultEnum.UPLOAD_IMG_ERROR);
}
String oldName = file.getOriginalFilename();
String newName =
"file/"
+ UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, bis);
System.out.println("图片名称:" + newName);
map.put(
"filePath",
"https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName);
map.put("fileName", oldName);
map.put("fileSize", file.getSize());
map.put("fileType", oldName.substring(oldName.lastIndexOf(".")).replace(".", ""));
}
}
return ResultBody.error(e.getMessage());
}
try (final BufferedInputStream bis = new BufferedInputStream(inputStream)) {
// 校验
int typeNum = FileLoadUtil.checkFileType(FileLoadUtil.getType(bis));
if (typeNum != 1) {
return ResultBody.error(ResultEnum.UPLOAD_IMG_ERROR);
}
String oldName = file.getOriginalFilename();
String newName =
"file/"
+ UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, bis);
System.out.println("图片名称:" + newName);
map.put(
"filePath",
"https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName);
map.put("fileName", oldName);
map.put("fileSize", file.getSize());
map.put("fileType", oldName.substring(oldName.lastIndexOf(".")).replace(".", ""));
}
ossClient.shutdown(); // 关流
return ResultBody.success(map);
}
}
ossClient.shutdown(); // 关流
return ResultBody.success(map);
}
private byte[] readByte(final InputStream is) throws IOException {
try (BufferedInputStream bis = new BufferedInputStream(is);
ByteArrayOutputStream bas = new ByteArrayOutputStream(4096);
BufferedOutputStream bos = new BufferedOutputStream(bas)) {
byte[] bytes = new byte[4096];
int size;
while ((size = bis.read(bytes)) != -1) {
bos.write(bytes, 0, size);
}
return bas.toByteArray();
}
private byte[] readByte(final InputStream is) throws IOException {
try (BufferedInputStream bis = new BufferedInputStream(is);
ByteArrayOutputStream bas = new ByteArrayOutputStream(4096);
BufferedOutputStream bos = new BufferedOutputStream(bas)) {
byte[] bytes = new byte[4096];
int size;
while ((size = bis.read(bytes)) != -1) {
bos.write(bytes, 0, size);
}
return bas.toByteArray();
}
}
@ApiOperation(value = "V1.0.1-上传文档文件到阿里云oss")
@ApiImplicitParams({
@ApiImplicitParam(
paramType = "header",
name = "mmc-identity",
dataTypeClass = java.lang.String.class,
dataType = "String",
required = true,
value = "token"),
@ApiImplicitParam(
name = "uploadFile",
dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true,
value = "文件 doc,ppt,pdf,xls结尾"),
})
@PostMapping("/docOss")
public ResultBody docOss(
@RequestParam("uploadFile") MultipartFile[] uploadFile, HttpServletRequest request)
throws IOException {
OSS ossClient =
new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
Map map = new HashMap();
if (uploadFile != null && uploadFile.length > 0) {
System.out.println("osses文件数量" + uploadFile.length);
for (int i = 0; i < uploadFile.length; i++) {
MultipartFile file = uploadFile[i];
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
} catch (IOException e) {
@ApiOperation(value = "V1.0.1-上传文档文件到阿里云oss")
@ApiImplicitParams({
@ApiImplicitParam(
paramType = "header",
name = "mmc-identity",
dataTypeClass = java.lang.String.class,
dataType = "String",
required = true,
value = "token"),
@ApiImplicitParam(
name = "uploadFile",
dataType = "MultipartFile",
dataTypeClass = org.springframework.web.multipart.MultipartFile.class,
required = true,
value = "文件 doc,ppt,pdf,xls结尾"),
})
@PostMapping("/docOss")
public ResultBody docOss(
@RequestParam("uploadFile") MultipartFile[] uploadFile, HttpServletRequest request)
throws IOException {
OSS ossClient =
new OSSClientBuilder()
.build(OssConstant.ENDPOINT, OssConstant.ACCESSKEYID, OssConstant.ACCESSKEYSECRET);
Map map = new HashMap();
if (uploadFile != null && uploadFile.length > 0) {
System.out.println("osses文件数量" + uploadFile.length);
for (int i = 0; i < uploadFile.length; i++) {
MultipartFile file = uploadFile[i];
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
} catch (IOException e) {
return ResultBody.error(e.getMessage());
}
try (final BufferedInputStream bis = new BufferedInputStream(inputStream)) {
// 校验
int typeNum = FileLoadUtil.checkFileType(FileLoadUtil.getType(bis));
if (typeNum != 2) {
return ResultBody.error(ResultEnum.UPLOAD_DOC_ERROR);
}
String oldName = file.getOriginalFilename();
String newName =
"file/"
+ UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, bis);
System.out.println("文档名称:" + newName);
return ResultBody.error(e.getMessage());
}
try (final BufferedInputStream bis = new BufferedInputStream(inputStream)) {
// 校验
int typeNum = FileLoadUtil.checkFileType(FileLoadUtil.getType(bis));
if (typeNum != 2) {
return ResultBody.error(ResultEnum.UPLOAD_DOC_ERROR);
}
String oldName = file.getOriginalFilename();
String newName =
"file/"
+ UUID.randomUUID().toString()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
ossClient.putObject(OssConstant.BUCKET, newName, bis);
System.out.println("文档名称:" + newName);
map.put(
"filePath",
"https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName);
map.put("fileName", oldName);
map.put("fileSize", file.getSize());
map.put("fileType", oldName.substring(oldName.lastIndexOf(".")).replace(".", ""));
}
}
map.put(
"filePath",
"https://" + OssConstant.BUCKET + '.' + OssConstant.ENDPOINT + "/" + newName);
map.put("fileName", oldName);
map.put("fileSize", file.getSize());
map.put("fileType", oldName.substring(oldName.lastIndexOf(".")).replace(".", ""));
}
ossClient.shutdown(); // 关流
return ResultBody.success(map);
}
}
ossClient.shutdown(); // 关流
return ResultBody.success(map);
}
/**
* 上传文件
*
* @param uploadFile
* @return
*/
@ApiIgnore
@RequestMapping(value = "/local", method = RequestMethod.POST)
public ResultBody local(
@RequestParam(value = "uploadFile", required = false) MultipartFile[] uploadFile,
@RequestParam(value = "directory", required = false, defaultValue = "upload")
String directory,
HttpServletRequest request)
throws IOException {
return FileLoadUtil.bathCreateFile(directory, uploadFile);
}
/**
* 上传文件
*
* @param uploadFile
* @return
*/
@ApiIgnore
@RequestMapping(value = "/local", method = RequestMethod.POST)
public ResultBody local(
@RequestParam(value = "uploadFile", required = false) MultipartFile[] uploadFile,
@RequestParam(value = "directory", required = false, defaultValue = "upload")
String directory,
HttpServletRequest request)
throws IOException {
return FileLoadUtil.bathCreateFile(directory, uploadFile);
}
/**
* 下载文件
*
* @param path
* @param response
* @throws IOException
*/
@ApiIgnore
@RequestMapping(value = "/download/{path}", method = RequestMethod.GET)
public void getDownloadFile(@PathVariable("path") String path, HttpServletResponse response)
throws IOException {
response.setContentType("application/x-001");
path = FileLoadUtil.explainLoadPath(path);
ServletOutputStream out = response.getOutputStream();
FileInputStream in = new FileInputStream(new File(path));
byte buffer[] = new byte[1024];
int length = 0;
while ((length = in.read(buffer)) != -1) {
out.write(buffer, 0, length);
}
in.close();
out.close();
/**
* 下载文件
*
* @param path
* @param response
* @throws IOException
*/
@ApiIgnore
@RequestMapping(value = "/download/{path}", method = RequestMethod.GET)
public void getDownloadFile(@PathVariable("path") String path, HttpServletResponse response)
throws IOException {
response.setContentType("application/x-001");
path = FileLoadUtil.explainLoadPath(path);
ServletOutputStream out = response.getOutputStream();
FileInputStream in = new FileInputStream(new File(path));
byte buffer[] = new byte[1024];
int length = 0;
while ((length = in.read(buffer)) != -1) {
out.write(buffer, 0, length);
}
in.close();
out.close();
}
@ApiIgnore
@RequestMapping(value = "/heart", method = RequestMethod.GET)
public ResultBody heart() {
return ResultBody.success("heart");
}
@ApiIgnore
@RequestMapping(value = "/heart", method = RequestMethod.GET)
public ResultBody heart() {
return ResultBody.success("heart");
}
}
package com.mmc.pms.controller;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author LW
* @date 2023/6/7 13:33
* 概要:
*/
@Api(tags = {"分类信息"})
@RestController
@RequestMapping("/category")
public class WebAndMiniProgramCategoryController {
// @ApiOperation(value = "web-分类信息")
// @PostMapping("queryCategoryByType")
// @ApiResponses({@ApiResponse(code = 200, message = "OK", response = GoodsInfoListDTO.class)})
// public ResultBody<GoodsInfoListDTO> listPageGoodsInfo(
// @ApiParam("商品查询条件QO") @RequestBody GoodsInfoQO param) {
// return ResultBody.success(webProductMallService.listPageGoodsInfo(param));
// }
}
package com.mmc.pms.controller;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.model.lease.dto.BrandDTO;
import com.mmc.pms.model.lease.dto.DeviceCategoryDTO;
import com.mmc.pms.model.lease.dto.WareInfoDTO;
import com.mmc.pms.model.lease.dto.WareInfoItemDTO;
import com.mmc.pms.model.lease.vo.LeaseVo;
import com.mmc.pms.model.other.dto.AdDTO;
import com.mmc.pms.model.other.dto.DistrictInfoDTO;
import com.mmc.pms.model.other.dto.ModelDTO;
import com.mmc.pms.model.qo.WareInfoQO;
import com.mmc.pms.page.Page;
import com.mmc.pms.service.WebDeviceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author small @Date 2023/5/15 13:25 @Version 1.0
......@@ -29,75 +21,18 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping("/webDevice")
public class WebDeviceController {
@Autowired
private WebDeviceService webDeviceService;
@Autowired private WebDeviceService webDeviceService;
@ApiOperation(value = "地域")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("/getSecondDistrictInfo")
public ResultBody<DistrictInfoDTO> getSecondDistrictInfo() {
return webDeviceService.listSecondDistrict();
}
@ApiOperation("设备类目")
@GetMapping("/category")
public ResultBody<DeviceCategoryDTO> category() {
return webDeviceService.category();
}
@ApiOperation("品牌")
@GetMapping("/brand")
public ResultBody<BrandDTO> brand() {
return webDeviceService.brand();
}
@ApiOperation("型号")
@GetMapping("/model")
public ResultBody<ModelDTO> model() {
return webDeviceService.model();
}
@ApiOperation("设备品牌")
@GetMapping("/deviceBrand")
public ResultBody<BrandDTO> deviceBrand() {
return webDeviceService.deviceBrand();
}
@ApiOperation("设备型号")
@GetMapping("/deviceModel")
public ResultBody<ModelDTO> deviceModel() {
return webDeviceService.deviceModel();
}
@ApiOperation(value = "设备详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("/detail")
public ResultBody<WareInfoDTO> detail(@RequestParam(value = "id", required = true) Integer id) {
WareInfoDTO wareInfoDTO = webDeviceService.getWareInfoById(id);
return wareInfoDTO == null
? ResultBody.error(ResultEnum.NOT_FOUND)
: ResultBody.success(wareInfoDTO);
}
@ApiOperation(value = "立即租赁")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("/update")
public ResultBody update(@RequestBody LeaseVo param) {
return webDeviceService.update(param);
}
@ApiOperation("设备广告位")
@GetMapping("/ad")
public ResultBody<AdDTO> ad() {
return webDeviceService.ad();
}
@ApiOperation(value = "设备列表筛选")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = WareInfoItemDTO.class)})
@PostMapping("/deviceList")
public ResultBody<WareInfoItemDTO> listWareInfoPage(
@RequestBody @Validated(Page.class) WareInfoQO param) {
return webDeviceService.listWareInfoPage(param);
}
@ApiOperation(value = "地域")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("/getSecondDistrictInfo")
public ResultBody<DistrictInfoDTO> getSecondDistrictInfo() {
return webDeviceService.listSecondDistrict();
}
@ApiOperation("设备广告位")
@GetMapping("/ad")
public ResultBody<AdDTO> ad() {
return webDeviceService.ad();
}
}
package com.mmc.pms.controller.web;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author LW
* @date 2023/6/8 15:19
* 概要:
*/
@RestController
@RequestMapping("/lease/goods")
@Api(tags = {"web端-设备租赁-相关接口"})
public class WebLeaseGoodsController {
}
package com.mmc.pms.dao;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.entity.ServiceDO;
import com.mmc.pms.model.qo.ServiceQO;
import com.mmc.pms.model.work.dto.ServiceDTO;
import com.mmc.pms.model.work.vo.UpAndDownServiceVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Author LW
* @date 2023/6/6 10:48
* 概要:
*
* @date 2023/6/6 10:48 概要:
*/
@Mapper
public interface BackstageTaskServiceDao {
Integer insert(ServiceDO serviceDO);
Integer insert(ServiceDO serviceDO);
Integer update(ServiceDO serviceDO);
Integer update(ServiceDO serviceDO);
Integer deleteById(Integer id);
Integer deleteByIds(@Param("ids") List<Integer> ids);
ServiceDO queryById(Integer id);
ServiceDO queryById(Integer id);
List<ServiceDO> queryAllByLimit(ServiceQO param);
List<ServiceDO> queryAllByLimit(ServiceQO param);
Integer count(ServiceQO param);
Integer count(ServiceQO param);
int conditionCount(@Param("param") ServiceQO param, @Param("categoriesIds") List<Integer> categoriesIds, @Param("userIds") List<Integer> userIds);
List<ServiceDO> queryPageByLimit(@Param("param") ServiceQO param,@Param("categoriesIds") List<Integer> categoriesIds, @Param("userIds") List<Integer> userIds);
List<ServiceDTO> QueryWorkServiceListById(@Param("ids") List<Integer> ids);
Integer batchUpAndDownWorkService(@Param("param") UpAndDownServiceVO param);
}
......@@ -14,53 +14,54 @@ import java.util.Set;
/**
* @author 23214
* @description 针对表【categories(通用分类表)】的数据库操作Mapper
* @createDate 2023-05-24 10:29:28
* @Entity com.mmc.pms.entity.Categories
* @createDate 2023-05-24 10:29:28 @Entity com.mmc.pms.entity.Categories
*/
@Mapper
public interface CategoriesDao {
int countUpdateDirectoryName(DirectoryInfoVO param);
int countUpdateDirectoryName(DirectoryInfoVO param);
void insertDirectory(DirectoryDO directory);
void insertDirectory(DirectoryDO directory);
void updateDirectory(DirectoryDO directory);
void updateDirectory(DirectoryDO directory);
int countDirectoryList();
int countDirectoryList();
List<DirectoryDO> directoryList(int pageNo, Integer pageSize, Integer type);
List<DirectoryDO> directoryList(int pageNo, Integer pageSize, Integer type);
int countDirectory(Integer id);
int countDirectory(Integer id);
void removeDirectory(Integer id);
void removeDirectory(Integer id);
int countClassificationByName(ClassifyInfoVO classifyInfoVO);
int countClassificationByName(ClassifyInfoVO classifyInfoVO);
int getCountCategoriesByPid(Integer pid, Integer type);
int getCountCategoriesByPid(Integer pid, Integer type);
void insertClassification(Categories categories);
void insertClassification(Categories categories);
void updateClassification(ClassifyInfoVO classifyInfoVO);
void updateClassification(ClassifyInfoVO classifyInfoVO);
Categories getGoodsGroupById(Integer id);
Categories getGoodsGroupById(Integer id);
int updateTypeSort(Integer id, Integer sort);
int updateTypeSort(Integer id, Integer sort);
List<Categories> selectAllClassification(QueryClassifyVO queryClassifyVO);
List<Categories> selectAllClassification(QueryClassifyVO queryClassifyVO);
int countListClassification(QueryClassifyVO queryClassifyVO);
int countListClassification(QueryClassifyVO queryClassifyVO);
int selectDirectoryById(Integer id);
DirectoryDO selectDirectoryById(Integer id);
int deleteById(Integer id);
int deleteById(Integer id);
List<DirectoryDO> getDirectoryList(Integer type);
List<DirectoryDO> getDirectoryList(Integer type);
List<Categories> getCategoriesByDirectoryId(Integer directoryId);
List<Categories> getCategoriesListByIds(@Param("ids") Set<Integer> ids);
}
List<Categories> getCategoriesByDirectoryId(Integer directoryId);
List<Categories> getCategoriesListByIds(@Param("ids") Set<Integer> ids);
List<Categories> selectCategoryByDirectoryId(List<Integer> directoryIds);
List<Categories> getCategoriesListByDirectoryIds(List<Integer> directoryIds);
int countChildById(Integer id);
}
package com.mmc.pms.dao;
import com.mmc.pms.entity.*;
import com.mmc.pms.model.sale.qo.MallGoodsQO;
import com.mmc.pms.model.sale.vo.GoodsAddVO;
import com.mmc.pms.model.sale.vo.SpecPriceVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -11,89 +13,105 @@ import java.util.Set;
/**
* @author 23214
* @description 针对表【goods_info(商品基本信息)】的数据库操作Mapper
* @createDate 2023-05-27 14:08:45
* @Entity com.mmc.pms.entity.GoodsInfo
* @createDate 2023-05-27 14:08:45 @Entity com.mmc.pms.entity.GoodsInfo
*/
@Mapper
public interface GoodsInfoDao {
int countGoodsInfoByName(GoodsAddVO goodsAddVO);
int countGoodsInfoByName(GoodsAddVO goodsAddVO);
void insertGoodsInfo(GoodsInfo goodsInfo);
void insertGoodsInfo(GoodsInfo goodsInfo);
int countGoodsInfo();
int countGoodsInfo();
void insertGoodsImgInfo(List<GoodsImgDO> list);
void insertGoodsImgInfo(List<GoodsImgDO> list);
void insertVideoInfo(GoodsVideoDO goodsVideoDO);
void insertVideoInfo(GoodsVideoDO goodsVideoDO);
void insertGoodsDetail(GoodsDetailDO goodsDetailDO);
void insertGoodsDetail(GoodsDetailDO goodsDetailDO);
void insertGoodsService(List<GoodsServiceDO> otherList);
void insertGoodsService(List<GoodsServiceDO> otherList);
int countGoodsInfoById(Integer id);
int countGoodsInfoById(Integer id);
void updateGoodsInfo(GoodsInfo goodsInfo);
void updateGoodsInfo(GoodsInfo goodsInfo);
void updateGoodsDetail(GoodsDetailDO goodsDetailDO);
void updateGoodsDetail(GoodsDetailDO goodsDetailDO);
List<GoodsImgDO> listGoodsInfoByGoodsId(Integer id);
List<GoodsImgDO> listGoodsInfoByGoodsId(Integer id);
void deleteImgByIds(List<Integer> deleteIds);
void deleteImgByIds(List<Integer> deleteIds);
void deleteGoodsVideoById(Integer id);
void deleteGoodsVideoById(Integer id);
void deleteGoodsServiceByGoodsId(Integer id);
void deleteGoodsServiceByGoodsId(Integer id);
void insertMallIndustrySkuInfo(MallIndustrySkuInfoDO mallIndustrySkuInfoDO);
void insertMallIndustrySkuInfo(MallIndustrySkuInfoDO mallIndustrySkuInfoDO);
void insertMallIndustrySkuInfoSpec(MallIndustrySkuInfoSpecDO mallIndustrySkuInfoSpecDO);
void insertMallIndustrySkuInfoSpec(MallIndustrySkuInfoSpecDO mallIndustrySkuInfoSpecDO);
List<MallProdInfoDO> getMallProSkuInfo(Integer id);
List<MallProdInfoDO> getMallProSkuInfo(Integer id);
void batchUpdateMallProductSku(List<Integer> delIds);
void batchUpdateMallProductSku(List<Integer> delIds);
void batchUpdateMallProdSkuInfo(List<MallProdInfoDO> mallProdSkuInfoList);
void batchUpdateMallProdSkuInfo(List<MallProdInfoDO> list);
List<MallIndustrySkuInfoDO> getMallIndustrySkuInfo(Integer id);
List<MallIndustrySkuInfoDO> getMallIndustrySkuInfo(Integer id);
GoodsInfo getGoodsSimpleInfo(Integer goodsInfoId);
GoodsInfo getGoodsSimpleInfo(Integer goodsInfoId);
GoodsDetailDO getGoodsDetailByGoodsId(Integer goodsInfoId);
GoodsDetailDO getGoodsDetailByGoodsId(Integer goodsInfoId);
List<GoodsServiceDO> listGoodsServiceByGoodsId(Integer goodsInfoId);
List<GoodsServiceDO> listGoodsServiceByGoodsId(Integer goodsInfoId);
List<SkuUnitDO> getSkuUnit();
List<SkuUnitDO> getSkuUnit();
List<GoodsInfo> listSimpleGoodsInfoByIds(@Param("ids") Set<Integer> ids);
List<GoodsInfo> listSimpleGoodsInfoByIds(@Param("ids") Set<Integer> ids);
void insertMallProdSkuInfo(MallProdInfoDO mallProdSkuInfoDO);
void insertMallProdSkuInfo(MallProdInfoDO mallProdSkuInfoDO);
void insertMallProdSkuInfoSpec(MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO);
void insertMallProdSkuInfoSpec(MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO);
void batchUpdateMallProSpec(@Param("list") List<Integer> list, @Param("id") Integer id);
void batchUpdateMallProSpec(@Param("list") List<Integer> list, @Param("id") Integer id);
List<MallProdSkuInfoSpecDO> listMallProdSpecInfo(List<Integer> mallSkuIds);
List<MallProdSkuInfoSpecDO> listMallProdSpecInfo(List<Integer> mallSkuIds);
void batchUpdateMallProdSpec(List<Integer> delSpecId);
void batchUpdateMallProdSpec(List<Integer> delSpecId);
List<MallGoodsSpecInfoDO> listProdSpecInfo(@Param("prodIds") Set<Integer> prodIds);
List<MallGoodsSpecInfoDO> listProdSpecInfo(@Param("prodIds") Set<Integer> prodIds);
List<MallGoodsSpecInfoDO> listIndstSpecInfo(@Param("indstIds") Set<Integer> indstIds);
List<MallGoodsSpecInfoDO> listIndstSpecInfo(@Param("indstIds") Set<Integer> indstIds);
List<GoodsServiceDO> listGoodsService(List<Integer> goodsIds);
List<GoodsServiceDO> listGoodsService(List<Integer> goodsIds);
List<MallGoodsInfoSimpleDO> listMallGoodsIndstSimpleInfo(@Param("indstSkuSpecIds") Set<Integer> indstSkuSpecIds);
List<MallGoodsInfoSimpleDO> listMallGoodsIndstSimpleInfo(
@Param("indstSkuSpecIds") Set<Integer> indstSkuSpecIds);
List<Integer> listIndustrySpecIds(Set<Integer> mallIndstSkuSpecIds);
List<Integer> listIndustrySpecIds(Set<Integer> mallIndstSkuSpecIds);
List<MallGoodsProductDO> listIndustryProductList(List<Integer> industrySpecIds);
List<MallGoodsProductDO> listIndustryProductList(List<Integer> industrySpecIds);
List<GoodsInfo> ListGoodsInfoByCategoryId(Integer id);
List<GoodsInfo> ListGoodsInfoByCategoryId(Integer id);
List<MallProdSkuInfoSpecDO> getMallProSkuInfoSpec(Integer goodsInfoId);
}
List<MallProdSkuInfoSpecDO> getMallProSkuInfoSpec(Integer goodsInfoId);
List<MallProdSkuInfoSpecDO> listMallprodSpecById(List<Integer> goodsIds);
List<SaleServiceDO> listSaleServiceInfo();
int countListGoodsInfo(MallGoodsQO param);
List<GoodsInfo> listGoodsInfo(MallGoodsQO param);
void batchUpOrDownWare(@Param("ids") List<Integer> ids, @Param("status") Integer status);
void removeWareInfo(List<Integer> ids);
List<SpecPriceVO> getPriceBySpecId(Integer productSpecId, Integer leaseTerm);
int countGoodsInfoByCategoryId(Integer id);
void updateMallProdSkuInfo(MallProdInfoDO mallProdInfoDO);
List<MallProdInfoDO> getAllMallProSkuInfo(Integer goodsInfoId);
}
......@@ -13,89 +13,90 @@ import java.util.Set;
/**
* @Author LW
* @date 2022/10/8 10:58
* 概要:
*
* @date 2022/10/8 10:58 概要:
*/
@Mapper
public interface IndustrySpecDao {
int countSkuName(IndustrySkuVO param);
int countSkuName(IndustrySkuVO param);
int insertIndustrySku(IndustrySku industrySku);
int insertIndustrySku(IndustrySku industrySku);
int countIndustrySkuById(Integer id);
int countIndustrySkuById(Integer id);
IndustrySku getIndustrySkuById(Integer id);
IndustrySku getIndustrySkuById(Integer id);
int updateIndustrySku(IndustrySku industrySku);
int updateIndustrySku(IndustrySku industrySku);
int countListPageIndustrySku(IndustrySkuQO param);
int countListPageIndustrySku(IndustrySkuQO param);
List<IndustrySku> listPageIndustrySku(IndustrySkuQO param);
List<IndustrySku> listPageIndustrySku(IndustrySkuQO param);
int countSpecName(IndustrySpecVO param);
int countSpecName(IndustrySpecVO param);
int insertIndustrySpec(IndustrySpecDO industrySpecDO);
int insertIndustrySpec(IndustrySpecDO industrySpecDO);
void insertIndustryProductInventory(IndustryProductInventoryDO industryProductInventoryDO);
void insertIndustryProductInventory(IndustryProductInventoryDO industryProductInventoryDO);
void insertInventorySpec(InventorySpecDO inventorySpecDO);
void insertInventorySpec(InventorySpecDO inventorySpecDO);
int countIndustrySpec(Integer industrySpecId);
int countIndustrySpec(Integer industrySpecId);
IndustrySpecDO getIndustrySpecById(Integer industrySpecId);
IndustrySpecDO getIndustrySpecById(Integer industrySpecId);
List<IndustryProductInventoryDO> getIndustryProductInventory(Integer industrySpecId);
List<IndustryProductInventoryDO> getIndustryProductInventory(Integer industrySpecId);
int updateIndustrySpec(IndustrySpecDO industrySpecDO);
int updateIndustrySpec(IndustrySpecDO industrySpecDO);
void batchDeleteInventorySpec(List<Integer> industryProductInventoryIds);
void batchDeleteInventorySpec(List<Integer> industryProductInventoryIds);
void deleteIndustryProductInventory(Integer id);
void deleteIndustryProductInventory(Integer id);
int countListPageIndustrySpec(Integer id, String keyword);
int countListPageIndustrySpec(Integer id, String keyword);
List<IndustrySpecDO> listPageIndustrySpec(int pageNo, Integer pageSize, Integer industrySkuId, String keyword);
List<IndustrySpecDO> listPageIndustrySpec(
int pageNo, Integer pageSize, Integer industrySkuId, String keyword);
int batchInsertSpecPrice(List<IndustrySpecPriceDO> list);
int batchInsertSpecPrice(List<IndustrySpecPriceDO> list);
void removeIndustrySpecCPQ(IndustrySpecCPQVO industrySpecCPQQ);
void removeIndustrySpecCPQ(IndustrySpecCPQVO industrySpecCPQQ);
void batchInsertLeaseSpecPrice(List<IndustrySpecPriceDO> list);
void batchInsertLeaseSpecPrice(List<IndustrySpecPriceDO> list);
List<IndustrySpecPriceDO> getIndustrySpecCPQ(IndustrySpecCPQVO industrySpecCPQQ);
List<IndustrySpecPriceDO> getIndustrySpecCPQ(IndustrySpecCPQVO industrySpecCPQQ);
void batchUpdateMallIndustrySpec(@Param("list") List<Integer> list, @Param("id") Integer id);
void batchUpdateMallIndustrySpec(@Param("list") List<Integer> list, @Param("id") Integer id);
void batchUpdateMallIndustrySku(@Param("list") List<Integer> list);
void batchUpdateMallIndustrySku(@Param("list") List<Integer> list);
void batchUpdateMallIndustrySkuInfo(List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList);
void batchUpdateMallIndustrySkuInfo(List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList);
List<MallIndustrySkuInfoSpecDO> listMallIndustrySpecInfo(List<Integer> mallSkuIds);
List<MallIndustrySkuInfoSpecDO> listMallIndustrySpecInfo(List<Integer> mallSkuIds);
void batchUpdateMallIndustSpec(@Param("list") List<Integer> list, @Param("id") Integer id);
void batchUpdateMallIndustSpec(@Param("list") List<Integer> list, @Param("id") Integer id);
List<IndustryProductInventoryDO> listIndustryProdInventory(
@Param("inventoryIds") Set<Integer> inventoryIds);
List<IndustryProductInventoryDO> listIndustryProdInventory(Set<Integer> inventoryIds);
List<IndustrySpecDO> listIndustrySpec(@Param("industrySpecIds") Set<Integer> industrySpecIds);
List<IndustrySpecDO> listIndustrySpec(Set<Integer> industrySpecIds);
int countIndustrySpecBySkuId(Integer id);
int countIndustrySpecBySkuId(Integer id);
void removeIndustrySku(Integer id);
void removeIndustrySku(Integer id);
List<MallIndustrySkuInfoSpecDO> listMallIndustrySpec(Integer id);
List<MallIndustrySkuInfoSpecDO> listMallIndustrySpec(Integer id);
void removeIndustryProductInventory(List<Integer> collect);
void removeIndustryProductInventory(List<Integer> collect);
List<InventorySpecDO> listInventorySpec(List<Integer> ids);
List<InventorySpecDO> listInventorySpec(List<Integer> ids);
void removeInventorySpec(List<Integer> ids);
void removeInventorySpec(List<Integer> ids);
void removeIndustrySpec(Integer id);
void removeIndustrySpec(Integer id);
List<MallIndustrySkuInfoSpecDO> getIndustrySkuInfoSpec(Integer goodsInfoId);
List<MallIndustrySkuInfoSpecDO> getIndustrySkuInfoSpec(Integer goodsInfoId);
List<IndustrySpecPriceDO> listIndustrySpecPrice(Integer tagInfoId, List<Integer> industrySpecIds);
List<IndustrySpecPriceDO> listIndustrySpecPrice(Integer tagInfoId, List<Integer> industrySpecIds);
List<IndustrySpecPriceDO> getIndustrySpecPriceList(List<Integer> specIds);
List<IndustrySpecPriceDO> getIndustrySpecPriceList(List<Integer> specIds);
}
package com.mmc.pms.dao;
import com.mmc.pms.entity.InspComtDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* <p>
* 评论表 Mapper 接口
* </p>
*
* @author Pika
* @since 2023-06-09
*/
@Mapper
public interface InspComtDao {
List<InspComtDO> randomGetInspComtList(Integer size);
}
......@@ -19,101 +19,103 @@ import java.util.Set;
/**
* @author 23214
* @description 针对表【product_sku(产品sku表)】的数据库操作Mapper
* @createDate 2023-05-25 14:55:56
* @Entity com.mmc.pms.entity.ProductSku
* @createDate 2023-05-25 14:55:56 @Entity com.mmc.pms.entity.ProductSku
*/
@Mapper
public interface ProductDao {
int countSkuName(ProductSkuVO param);
int countSkuName(ProductSkuVO param);
int insertProductSku(ProductSkuDO productSkuDO);
int insertProductSku(ProductSkuDO productSkuDO);
int countSkuIsExist(Integer id);
int countSkuIsExist(Integer id);
ProductSkuDO getProductSkuDetail(Integer id);
ProductSkuDO getProductSkuDetail(Integer id);
int updateProductSku(ProductSkuDO productSkuDO);
int updateProductSku(ProductSkuDO productSkuDO);
int countListPageProductSku(ProductSkuQO productSkuQO);
int countListPageProductSku(ProductSkuQO productSkuQO);
List<ProductSkuDO> listPageProductSku(ProductSkuQO productSkuQO);
List<ProductSkuDO> listPageProductSku(ProductSkuQO productSkuQO);
int countSpecName(ProductSpecVO param);
int countSpecName(ProductSpecVO param);
int insertProductSpec(ProductSpecDO productSpecDO);
int insertProductSpec(ProductSpecDO productSpecDO);
int updateProductSpec(ProductSpecDO productSpecDO);
int updateProductSpec(ProductSpecDO productSpecDO);
int countSpecIsExist(Integer id);
int countSpecIsExist(Integer id);
ProductSpecDO getProductSpecDetail(Integer id);
ProductSpecDO getProductSpecDetail(Integer id);
int countListPageProductSpec(Integer productSkuId);
int countListPageProductSpec(@Param("id") Integer id, @Param("keyword") String keyword);
List<ProductSpecDO> listPageProductSpec(int pageNo, Integer pageSize, Integer productSkuId);
List<ProductSpecDO> listPageProductSpec(
@Param(value = "pageNo") Integer pageNo,
@Param(value = "pageSize") Integer pageSize,
@Param(value = "productSkuId") Integer productSkuId,
@Param(value = "keyword") String keyword);
int batchInsertSpecPrice(List<ProductSpecPriceDO> list);
int batchInsertSpecPrice(List<ProductSpecPriceDO> list);
void batchInsertLeaseSpecPrice(List<ProductSpecPriceDO> list);
void batchInsertLeaseSpecPrice(List<ProductSpecPriceDO> list);
void removeProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO);
void removeProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO);
List<ProductSpecPriceDO> getProductSpecPrice(ProductSpecCPQVO productSpecCPQVO);
List<ProductSpecPriceDO> getProductSpecPrice(ProductSpecCPQVO productSpecCPQVO);
void insertMallProdSkuInfo(MallProdInfoDO mallProdInfoDO);
void insertMallProdSkuInfo(MallProdInfoDO mallProdInfoDO);
List<ProductSpecDO> listProductSpec(Integer id);
List<ProductSpecDO> listProductSpec(Integer id);
List<ProductSkuDO> listProductSkuDO(List<Integer> productSkuId);
List<ProductSkuDO> listProductSkuDO(List<Integer> productSkuId);
List<InventorySpecDO> listInventorySpecInfo(List<Integer> industryProductInventoryIds);
List<InventorySpecDO> listInventorySpecInfo(List<Integer> industryProductInventoryIds);
List<ProductSpecDO> listProductSpecInfo(List<Integer> productSpecIds);
List<ProductSpecDO> listProductSpecInfo(List<Integer> productSpecIds);
void batchUpdateMallProdSpec(List<Integer> delProductSpecId);
void batchUpdateMallProdSpec(List<Integer> delProductSpecId);
int countProductSpecByBrandId(Integer id);
int countProductSpecByBrandId(Integer id);
int countSpecByProdSkuId(Integer id);
int countSpecByProdSkuId(Integer id);
void removeProductSku(Integer id);
void removeProductSku(Integer id);
void removeProductSpec(Integer id);
List<MallProdInfoDO> listMallProdInfo(String id);
List<IndustrySpecDO> listIndustrySpec(@Param("industrySpecIds") Set<Integer> industrySpecIds);
void removeProductSpec(Integer id);
List<InventorySpecDO> listInventorySpec(Integer id);
List<IndustrySpecDO> listIndustrySpec(@Param("industrySpecIds") Set<Integer> industrySpecIds);
BigDecimal feignGetUnitPriceByTag(PriceAcquisition priceAcquisition);
List<InventorySpecDO> listInventorySpec(Integer id);
List<MallGoodsSpecInfoDO> listProdSpecInfo(@Param("prodIds") Set<Integer> prodIds);
BigDecimal feignGetUnitPriceByTag(PriceAcquisition priceAcquisition);
/**
* 根据渠道等级、商品specId获取price信息
*
* @param tagInfoId
* @param prodSkuSpecIds
* @return
*/
List<ProductSpecPriceDO> listProductSpecPrice(Integer tagInfoId, Set<Integer> prodSkuSpecIds);
List<MallGoodsSpecInfoDO> listProdSpecInfo(@Param("prodIds") Set<Integer> prodIds);
ProductSpecPriceDTO feignGetUnitPrice(Integer id, Integer tagId);
/**
* 根据渠道等级、商品specId获取price信息
*
* @param tagInfoId
* @param prodSkuSpecIds
* @return
*/
List<ProductSpecPriceDO> listProductSpecPrice(Integer tagInfoId, Set<Integer> prodSkuSpecIds);
List<ProductSpecDO> getProductSpecList(List<Integer> productSkuIds);
ProductSpecPriceDTO feignGetUnitPrice(Integer id, Integer tagId);
List<MallProdSkuInfoSpecDO> getProductSpecByIds(List<Integer> delProductSpecId);
List<ProductSpecDO> getProductSpecList(List<Integer> productSkuIds);
Set<Integer> listProductSpecIds(@Param("mallProdSkuSpecIds") Set<Integer> mallProdSkuSpecIds);
List<MallProdSkuInfoSpecDO> getProductSpecByIds(List<Integer> delProductSpecId);
Set<Integer> listProductSpecIds(@Param("mallProdSkuSpecIds") Set<Integer> mallProdSkuSpecIds);
List<OrderGoodsProdDTO> listProdGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO);
List<MallProdSkuInfoSpecDO> listMallProductSpec(Integer id);
}
List<OrderGoodsProdDTO> listProdGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO);
List<MallProdSkuInfoSpecDO> listMallProductSpec(Integer id);
List<ProductSpecPriceDO> getProductSpecPriceList(List<Integer> specIds);
ProductSpecPriceDO getProductSpecPriceById(Integer id);
List<DirectoryDO> productDirectoryList();
}
......@@ -4,6 +4,7 @@ import com.mmc.pms.entity.*;
import com.mmc.pms.model.lease.vo.LeaseVo;
import com.mmc.pms.model.qo.WareInfoQO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -12,36 +13,42 @@ import java.util.List;
*/
@Mapper
public interface WebDeviceDao {
List<DistrictDO> listSecondDistrict();
List<DistrictDO> listSecondDistrict();
List<DeviceCategory> category();
List<DeviceCategory> category();
List<Brand> brand();
List<Brand> brand();
List<Brand> deviceBrand();
List<Brand> deviceBrand();
List<Model> model();
List<Model> model();
List<Model> deviceModel();
List<Model> deviceModel();
List<DeviceListDO> deviceList(
Integer districtId, Integer categoryId, Integer brandId, Integer modelId);
List<DeviceListDO> deviceList(
Integer districtId, Integer categoryId, Integer brandId, Integer modelId);
int update(LeaseVo param);
int update(LeaseVo param);
InventoryDO findInventory(Integer inventoryId);
InventoryDO findInventory(Integer inventoryId);
List<WareInfoDO> detail(Integer id);
List<WareInfoDO> detail(Integer id);
int countListWareInfoPage(WareInfoQO param);
int countListWareInfoPage(
@Param("categoryIds") List<Integer> categoryIds,
@Param("userIds") List<Integer> userIds,
@Param("type") Integer type);
List<WareInfoDO> listWareInfoPage(WareInfoQO param);
List<GoodsInfo> listWareInfoPage(
@Param("param") WareInfoQO param,
@Param("userIds") List<Integer> userIds,
@Param("type") Integer type);
WareInfoDO getWareInfoById(Integer id);
WareInfoDO getWareInfoById(Integer id);
WareDetailDO getWareDetailById(Integer id);
WareDetailDO getWareDetailById(Integer id);
List<AdDO> ad();
List<AdDO> ad();
List<SkuInfoDO> listSkuInfo(Integer id);
List<SkuInfoDO> listSkuInfo(Integer id);
}
package com.mmc.pms.entity;
import com.mmc.pms.model.categories.dto.CategoriesInfoListDTO;
import com.mmc.pms.model.categories.dto.CategoryTypeDTO;
import com.mmc.pms.model.categories.dto.ClassifyDetailsDTO;
import com.mmc.pms.model.categories.dto.ClassifyInfoDTO;
import com.mmc.pms.model.categories.vo.ClassifyInfoVO;
......@@ -12,57 +13,79 @@ import java.io.Serializable;
import java.util.Date;
/**
* @author lw
* @TableName categories
* @author lw @TableName categories
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Categories implements Serializable {
private Integer id;
private Integer parentId;
private String name;
private String icon;
private String description;
private Integer sort;
private Integer type;
private Date createTime;
private Date updateTime;
private Integer deleted;
private Integer directoryId;
private String remark;
public Categories(ClassifyInfoVO classifyInfoVO) {
this.id = classifyInfoVO.getId();
this.parentId = classifyInfoVO.getPid();
this.name = classifyInfoVO.getClassifyName();
this.icon = classifyInfoVO.getIcon();
this.description = classifyInfoVO.getDescription();
this.type = classifyInfoVO.getType();
this.directoryId = classifyInfoVO.getDirectoryId();
this.remark = classifyInfoVO.getRemark();
}
public ClassifyInfoDTO buildClassifyInfoDTO() {
return ClassifyInfoDTO.builder().id(id).description(description)
.icon(icon).pid(parentId).classifyName(name)
.remark(remark).createTime(createTime)
.directoryId(directoryId).type(type).build();
}
public ClassifyDetailsDTO buildClassifyDetailsDTO() {
return ClassifyDetailsDTO.builder().id(id).description(description)
.icon(icon).classifyName(name)
.remark(remark).build();
}
}
\ No newline at end of file
private Integer id;
private Integer parentId;
private String name;
private String icon;
private String description;
private Integer sort;
private Integer type;
private Date createTime;
private Date updateTime;
private Integer deleted;
private Integer directoryId;
private String remark;
public Categories(ClassifyInfoVO classifyInfoVO) {
this.id = classifyInfoVO.getId();
this.parentId = classifyInfoVO.getPid();
this.name = classifyInfoVO.getClassifyName();
this.icon = classifyInfoVO.getIcon();
this.description = classifyInfoVO.getDescription();
this.type = classifyInfoVO.getType();
this.directoryId = classifyInfoVO.getDirectoryId();
this.remark = classifyInfoVO.getRemark();
}
public ClassifyInfoDTO buildClassifyInfoDTO() {
return ClassifyInfoDTO.builder()
.id(id)
.description(description)
.icon(icon)
.pid(parentId)
.classifyName(name)
.remark(remark)
.createTime(createTime)
.directoryId(directoryId)
.type(type)
.build();
}
public ClassifyDetailsDTO buildClassifyDetailsDTO() {
return ClassifyDetailsDTO.builder()
.id(id)
.description(description)
.icon(icon)
.classifyName(name)
.remark(remark)
.build();
}
public CategoriesInfoListDTO buildCategoriesInfoListDTO() {
return CategoriesInfoListDTO.builder()
.id(id)
.directoryId(directoryId)
.icon(icon)
.name(name)
.build();
}
public CategoryTypeDTO buildCategoryTypeDTO() {
return CategoryTypeDTO.builder().id(id).categoryName(name).build();
}
}
package com.mmc.pms.entity;
import com.mmc.pms.model.categories.dto.AllCategoryDTO;
import com.mmc.pms.model.categories.vo.DirectoryInfoVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 目录管理表(Directory)实体类
......@@ -18,47 +24,52 @@ import java.util.Date;
@AllArgsConstructor
@NoArgsConstructor
public class DirectoryDO implements Serializable {
private static final long serialVersionUID = 713939370607409336L;
/**
* 主键id
*/
private Integer id;
/**
* 目录名称
*/
private String directoryName;
/**
* 其他目录关联id
*/
private Integer pid;
/**
* 类型:(0:通用目录 1:作业服务目录 2:设备目录 3:飞手目录 4:商城目录)
*/
private Integer type;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date updateTime;
/**
* 是否删除
*/
private Integer deleted;
private static final long serialVersionUID = 713939370607409336L;
/** 主键id */
private Integer id;
/** 目录名称 */
private String directoryName;
/** 其他目录关联id */
private Integer pid;
/** 类型:(0:通用目录 1:作业服务目录 2:设备目录 3:飞手目录 4:商城目录) */
private Integer type;
/** 创建时间 */
private Date createTime;
/** 修改时间 */
private Date updateTime;
/** 是否删除 */
private Integer deleted;
private String relevanceName;
private String show;
public DirectoryDO(DirectoryInfoVO param) {
this.id = param.getId();
this.directoryName = param.getDirectoryName();
this.pid = param.getPid();
this.type = param.getType();
private String relevanceName;
public DirectoryDO(DirectoryInfoVO param) {
if (CollectionUtils.isNotEmpty(param.getShow())) {
String show = param.getShow().stream().map(Object::toString).collect(Collectors.joining(","));
this.show = show;
}
this.id = param.getId();
this.directoryName = param.getDirectoryName();
this.type = param.getType();
}
public DirectoryInfoVO buildDirectoryInfoVO() {
return DirectoryInfoVO.builder().id(id).directoryName(directoryName).pid(pid).relevanceName(relevanceName).type(type).build();
public DirectoryInfoVO buildDirectoryInfoVO() {
List<Integer> show = null;
if (!StringUtils.isBlank(this.show)) {
String[] split = this.show.split(",");
show = Arrays.stream(split).map(Integer::parseInt).collect(Collectors.toList());
}
}
return DirectoryInfoVO.builder()
.id(id)
.directoryName(directoryName)
.show(show)
.type(type)
.build();
}
public AllCategoryDTO buildAllCategoryDTO() {
return AllCategoryDTO.builder().directoryId(id).name(directoryName).build();
}
}
package com.mmc.pms.entity;
import com.mmc.pms.model.categories.vo.RelevanceGoodsInfoVO;
import com.mmc.pms.model.lease.dto.LeaseGoodsInfoDTO;
import com.mmc.pms.model.sale.dto.GoodsInfoListDTO;
import com.mmc.pms.model.sale.vo.GoodsAddVO;
import lombok.AllArgsConstructor;
import lombok.Data;
......@@ -10,69 +12,94 @@ import java.io.Serializable;
import java.util.Date;
/**
* @author 23214
* @TableName goods_info
* @author 23214 @TableName goods_info
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class GoodsInfo implements Serializable {
private Integer id;
private Integer id;
private Integer pid;
private Integer pid;
private String goodsNo;
private String goodsNo;
private String goodsName;
private String goodsName;
private Integer directoryId;
private Integer directoryId;
private Integer addGoodsUserId;
private Integer addGoodsUserId;
private Integer categoryByOne;
private Integer categoryByOne;
private Integer categoryByTwo;
private Integer categoryByTwo;
private String ecoLabel;
private String ecoLabel;
private Integer shelfStatus;
private Integer shelfStatus;
private Integer showCode;
private Integer showCode;
private Integer sort;
private Integer sort;
private Date createTime;
private Date createTime;
private Integer goodsType;
private Integer goodsType;
private Date updateTime;
private Date updateTime;
private Integer deleted;
private Integer deleted;
private Integer goodsVideoId;
private Integer goodsVideoId;
private String videoUrl;
private String videoUrl;
private String mainImg;
private String mainImg;
private static final long serialVersionUID = 1L;
private Integer isCoupons;
public GoodsInfo(GoodsAddVO goodsAddVO) {
this.id = goodsAddVO.getId();
this.goodsName = goodsAddVO.getGoodsName();
this.shelfStatus = goodsAddVO.getShelfStatus();
this.categoryByOne = goodsAddVO.getCategoryByOne();
this.categoryByTwo = goodsAddVO.getCategoryByTwo();
this.directoryId = goodsAddVO.getDirectoryId();
this.ecoLabel = goodsAddVO.getTag();
this.goodsType = goodsAddVO.getGoodsType();
}
private String directoryName;
public GoodsInfo(Integer id) {
this.id = id;
}
private static final long serialVersionUID = 1L;
public RelevanceGoodsInfoVO buildRelevanceGoodsInfoVO() {
return RelevanceGoodsInfoVO.builder().id(id).goodsName(goodsName).shelf(shelfStatus).mainImage(mainImg).build();
}
}
\ No newline at end of file
public GoodsInfo(GoodsAddVO goodsAddVO) {
this.id = goodsAddVO.getId();
this.goodsName = goodsAddVO.getGoodsName();
this.shelfStatus = goodsAddVO.getShelfStatus();
this.categoryByOne = goodsAddVO.getCategoryByOne();
this.categoryByTwo = goodsAddVO.getCategoryByTwo();
this.directoryId = goodsAddVO.getDirectoryId();
this.ecoLabel = goodsAddVO.getTag();
this.goodsType = goodsAddVO.getGoodsType();
}
public GoodsInfo(Integer id) {
this.id = id;
}
public RelevanceGoodsInfoVO buildRelevanceGoodsInfoVO() {
return RelevanceGoodsInfoVO.builder()
.id(id)
.goodsName(goodsName)
.shelf(shelfStatus)
.mainImage(mainImg)
.build();
}
public LeaseGoodsInfoDTO buildLeaseGoodsInfoDTO() {
return LeaseGoodsInfoDTO.builder().id(id).goodsName(goodsName).images(mainImg).build();
}
public GoodsInfoListDTO buildGoodsInfoListDTO() {
return GoodsInfoListDTO.builder()
.id(id)
.goodsName(goodsName)
.directoryName(directoryName)
.directoryId(directoryId)
.createTime(createTime)
.imgUrl(mainImg)
.status(shelfStatus)
.isCoupons(this.isCoupons)
.build();
}
}
package com.mmc.pms.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
* <p>
* 评论表
* </p>
*
* @author Pika
* @since 2023-06-09
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class InspComtDO implements Serializable {
private static final long serialVersionUID = 1896389867L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "头像")
private String userImg;
@ApiModelProperty(value = "昵称")
private String nickName;
@ApiModelProperty(value = "评价内容")
private String content;
@ApiModelProperty(value = "评价图片集合 1.jpg,2.jpg 使用逗号隔开")
private String contentImgs;
@ApiModelProperty(value = "评价视频")
private String contentVideo;
@ApiModelProperty(value = "评价星级")
private Integer star;
@ApiModelProperty(value = "关键字集合 深圳市,广州市,长沙市使用逗号隔开")
private String tags;
@ApiModelProperty(value = "是否带图 0:带图 1:不带图")
private Integer isImg;
@ApiModelProperty(value = "评价类型:0:好评 1:差评")
private Integer type;
@ApiModelProperty(value = "创建时间")
private Date createTime;
}
......@@ -18,56 +18,51 @@ import java.util.Date;
@AllArgsConstructor
@Accessors(chain = true)
public class MallProdInfoDO implements Serializable {
private static final long serialVersionUID = 3667714765929443857L;
private Integer id;
private Integer goodsInfoId;
private Integer prodSkuId;
private String prodSkuSpecName;
private Integer categoriesId;
private Integer chooseType;
private Integer must;
private Integer skuUnitId;
private Integer deleted;
private Date createTime;
private Date updateTime;
private Integer flag;
private String productSpecIdList;
private String beforeUpdateSpec;
/**
* 辅助字段 start
*/
private String typeName;
private String goodsName;
private String unitName;
private String productSkuName;
private Integer brandInfoId;
private static final long serialVersionUID = 3667714765929443857L;
private Integer id;
private Integer goodsInfoId;
private Integer prodSkuId;
private String prodSkuSpecName;
private Integer categoriesId;
private Integer chooseType;
private Integer must;
private Integer skuUnitId;
private Integer deleted;
private Date createTime;
private Date updateTime;
private Integer flag;
/** 辅助字段 start */
private String typeName;
/**
* 辅助字段 end
*/
public MallProdInfoDO(GoodsProdSpecVO goodsSpecVO) {
this.categoriesId = goodsSpecVO.getCategoryId();
this.prodSkuSpecName = goodsSpecVO.getGoodsSpecName();
this.chooseType = goodsSpecVO.getChooseType();
this.skuUnitId = goodsSpecVO.getSkuUnitId();
this.must = goodsSpecVO.getMust();
this.flag = goodsSpecVO.getFlag();
}
private String goodsName;
private String unitName;
private String productSkuName;
private Integer brandInfoId;
public GoodsSpecDTO buildGoodsSpecDTO() {
return GoodsSpecDTO.builder()
.id(this.id)
.goodsSpecName(this.prodSkuSpecName)
.categoryId(this.categoriesId)
.chooseType(this.chooseType)
.skuUnitId(skuUnitId)
.unitName(this.unitName)
.skuId(this.prodSkuId)
.typeName(this.typeName)
.must(must)
.skuName(this.productSkuName)
.brandInfoId(brandInfoId)
.flag(flag)
.build();
}
/** 辅助字段 end */
public MallProdInfoDO(GoodsProdSpecVO goodsSpecVO) {
this.categoriesId = goodsSpecVO.getCategoryId();
this.prodSkuSpecName = goodsSpecVO.getGoodsSpecName();
this.chooseType = goodsSpecVO.getChooseType();
this.skuUnitId = goodsSpecVO.getSkuUnitId();
this.must = goodsSpecVO.getMust();
this.flag = goodsSpecVO.getFlag();
}
public GoodsSpecDTO buildGoodsSpecDTO() {
return GoodsSpecDTO.builder()
.id(this.id)
.goodsSpecName(this.prodSkuSpecName)
.categoryId(this.categoriesId)
.chooseType(this.chooseType)
.skuUnitId(skuUnitId)
.unitName(this.unitName)
.skuId(this.prodSkuId)
.typeName(this.typeName)
.must(must)
.skuName(this.productSkuName)
.brandInfoId(brandInfoId)
.flag(flag)
.build();
}
}
......@@ -6,6 +6,7 @@ import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
......@@ -16,16 +17,17 @@ import java.util.Date;
@AllArgsConstructor
@Accessors(chain = true)
public class MallProdSkuInfoSpecDO implements Serializable {
private static final long serialVersionUID = -8247363408322497387L;
private Integer id;
private Integer mallProdSkuInfoId;
private Integer goodsInfoId;
private Integer productSpecId;
private Integer deleted;
private Date createTime;
private Date updateTime;
private static final long serialVersionUID = -8247363408322497387L;
private Integer id;
private Integer mallProdSkuInfoId;
private Integer goodsInfoId;
private Integer productSpecId;
private Integer deleted;
private Date createTime;
private Date updateTime;
private String goodsName;
private String goodsName;
private BigDecimal price;
private ProductSpecDO productSpecDO;
private ProductSpecDO productSpecDO;
}
package com.mmc.pms.entity;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.mmc.pms.model.other.dto.RepoCashDTO;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import java.math.BigDecimal;
......@@ -20,53 +20,53 @@ import java.util.Date;
@AllArgsConstructor
@NoArgsConstructor
public class RepoCashDO implements Serializable {
private static final long serialVersionUID = -7930603317037474755L;
private Integer id;
private Integer repoAccountId;
private String uid;
private String accountName;
private Integer orderInfoId;
private String orderNo;
private Integer skuInfoId;
private String skuTitle;
private Integer wareInfoId;
private String wareNo;
private String wareTitle;
private String payNo;
private Integer payMethod;
private BigDecimal amtPaid;
private BigDecimal cashAmt;
private Date payTime;
private String refundNo;
private String voucher;
private String remark;
private Integer createUser;
private Date createTime;
private Integer updateUser;
private Date updateTime;
private static final long serialVersionUID = -7930603317037474755L;
private Integer id;
private Integer repoAccountId;
private String uid;
private String accountName;
private Integer orderInfoId;
private String orderNo;
private Integer skuInfoId;
private String skuTitle;
private Integer wareInfoId;
private String wareNo;
private String wareTitle;
private String payNo;
private Integer payMethod;
private BigDecimal amtPaid;
private BigDecimal cashAmt;
private Date payTime;
private String refundNo;
private String voucher;
private String remark;
private Integer createUser;
private Date createTime;
private Integer updateUser;
private Date updateTime;
public RepoCashDTO buildRepoCashDTO() {
return RepoCashDTO.builder()
.id(this.id)
.repoAccountId(this.repoAccountId)
.uid(this.uid)
.accountName(this.accountName)
.orderInfoId(this.orderInfoId)
.orderNo(this.orderNo)
.skuInfoId(this.skuInfoId)
.skuTitle(this.skuTitle)
.wareInfoId(this.wareInfoId)
.wareNo(this.wareNo)
.wareTitle(this.wareTitle)
.payNo(this.payNo)
.payMethod(this.payMethod)
.amtPaid(this.amtPaid)
.refundNo(this.refundNo)
.createUser(this.createUser)
.voucher(StringUtils.isBlank(this.voucher) ? null : Arrays.asList(this.voucher.split(",")))
.cashAmt(this.cashAmt)
.payTime(this.payTime)
.remark(this.remark)
.build();
}
public RepoCashDTO buildRepoCashDTO() {
return RepoCashDTO.builder()
.id(this.id)
.repoAccountId(this.repoAccountId)
.uid(this.uid)
.accountName(this.accountName)
.orderInfoId(this.orderInfoId)
.orderNo(this.orderNo)
.skuInfoId(this.skuInfoId)
.skuTitle(this.skuTitle)
.wareInfoId(this.wareInfoId)
.wareNo(this.wareNo)
.wareTitle(this.wareTitle)
.payNo(this.payNo)
.payMethod(this.payMethod)
.amtPaid(this.amtPaid)
.refundNo(this.refundNo)
.createUser(this.createUser)
.voucher(StringUtils.isBlank(this.voucher) ? null : Arrays.asList(this.voucher.split(",")))
.cashAmt(this.cashAmt)
.payTime(this.payTime)
.remark(this.remark)
.build();
}
}
package com.mmc.pms.entity;
import com.mmc.pms.model.sale.dto.SaleServiceDTO;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* @Author LW
*
* @date 2022/3/28 10:24 概要:
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class SaleServiceDO implements Serializable {
private Integer id;
private String serviceName;
private String remark;
private Integer deleted;
private Date updateTime;
private Date createTime;
public SaleServiceDTO buildSaleServiceDTO() {
return SaleServiceDTO.builder().id(this.id).saleServiceName(this.serviceName).build();
}
}
......@@ -12,8 +12,8 @@ import java.util.Date;
/**
* @Author LW
* @date 2023/6/8 10:33
* 概要:
*
* @date 2023/6/8 10:33 概要:
*/
@Data
@AllArgsConstructor
......@@ -21,73 +21,65 @@ import java.util.Date;
@Builder
public class ServiceDO implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
private Integer id;
private Integer id;
@ApiModelProperty(value = "服务名称")
private String serviceName;
@ApiModelProperty(value = "服务名称")
private String serviceName;
@ApiModelProperty(value = "应用")
private Integer applicationId;
@ApiModelProperty(value = "应用")
private Integer applicationId;
@ApiModelProperty(value = "行业")
private Integer industryId;
@ApiModelProperty(value = "行业")
private Integer industryId;
@ApiModelProperty(value = "展示状态")
private Integer displayState;
@ApiModelProperty(value = "展示状态")
private Integer displayState;
@ApiModelProperty(value = "封面图")
private String coverPlan;
@ApiModelProperty(value = "封面图")
private String coverPlan;
@ApiModelProperty(value = "分享卡片")
private String shareCard;
@ApiModelProperty(value = "分享卡片")
private String shareCard;
@ApiModelProperty(value = "视频")
private String video;
@ApiModelProperty(value = "视频")
private String video;
@ApiModelProperty(value = "服务介绍")
private String serviceIntroduction;
@ApiModelProperty(value = "服务介绍")
private String serviceIntroduction;
@ApiModelProperty(value = "创建人id")
private Integer accountId;
@ApiModelProperty(value = "创建人id")
private Integer accountId;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "修改时间")
private Date updateTime;
@ApiModelProperty(value = "修改时间")
private Date updateTime;
@ApiModelProperty(value = "逻辑删除字段")
private Integer isDeleted;
@ApiModelProperty(value = "逻辑删除字段")
private Integer isDeleted;
public ServiceDO(ServiceVO param, Integer accountId) {
this.id = param.getId();
this.serviceName = param.getServiceName();
this.applicationId = param.getApplicationId();
this.industryId = param.getIndustryId();
this.displayState = param.getDisplayState();
this.coverPlan = param.getCoverPlan();
this.shareCard = param.getShareCard();
this.video = param.getVideo();
this.serviceIntroduction = param.getServiceIntroduction();
this.accountId = accountId;
}
public ServiceDO(ServiceVO param, Integer accountId) {
this(param);
this.accountId = accountId;
}
public ServiceDO(ServiceVO param) {
this.id = param.getId();
this.serviceName = param.getServiceName();
this.applicationId = param.getApplicationId();
this.industryId = param.getIndustryId();
this.displayState = param.getDisplayState();
this.coverPlan = param.getCoverPlan();
this.shareCard = param.getShareCard();
this.video = param.getVideo();
this.serviceIntroduction = param.getServiceIntroduction();
}
public ServiceDO(ServiceVO param) {
this.id = param.getId();
this.serviceName = param.getServiceName();
this.applicationId = param.getApplicationId();
this.industryId = param.getIndustryId();
this.displayState = param.getDisplayState();
this.coverPlan = param.getCoverPlan();
this.shareCard = param.getShareCard();
this.video = param.getVideo();
this.serviceIntroduction = param.getServiceIntroduction();
}
public ServiceDO(Integer id, Integer accountId) {
this.id = id;
this.accountId = accountId;
}
public ServiceDO(Integer id, Integer accountId) {
this.id = id;
this.accountId = accountId;
}
}
package com.mmc.pms.feign;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.mmc.pms.auth.dto.BUserAccountQO;
import com.mmc.pms.auth.dto.UserAccountSimpleDTO;
import com.mmc.pms.feign.hystrix.UserAppApiHystrix;
import io.swagger.annotations.ApiParam;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author: zj
* @Date: 2023/5/18 17:06
*/
//@FeignClient(name = "cms-svc", fallback = UserAppApiHystrix.class)
@FeignClient(url = "${iuav.userapp.url}", name = "cms-svc", fallback = UserAppApiHystrix.class)
public interface UserAppApi {
/**
* 根据用户id获取基本信息
*
* @param userAccountId
* @return
*/
@RequestMapping(value = "/userapp/user-account/feignGetUserSimpleInfo", method = RequestMethod.GET)
public UserAccountSimpleDTO feignGetUserSimpleInfo(@RequestParam Integer userAccountId, @RequestHeader("token") String token);
/**
* 根据地区信息查询用户id
*
* @param provinceCode
* @param cityCode
* @param districtCode
* @return
*/
@GetMapping("/userapp/user-account/feignListUserAccountIds")
List<Integer> feignListUserAccountIds(@RequestParam Integer provinceCode, @RequestParam(required = false) Integer cityCode,
@RequestParam(required = false) Integer districtCode, @RequestHeader(value = "token", required = false) String token);
/**
* 获取用户集合列表页面
*
* @param bUserAccountQO 问:b用户帐户
* @return {@link List}<{@link UserAccountSimpleDTO}>
*/
@PostMapping("/userapp/back-user/feignListBAccountPage")
List<UserAccountSimpleDTO> feignListBAccountPage(@ApiParam(value = "账号查询QO", required = true) @RequestBody BUserAccountQO bUserAccountQO, @RequestHeader("token") String token);
}
package com.mmc.pms.feign.config;
import com.mmc.pms.feign.hystrix.UserAppApiHystrix;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
/**
* @author: zj
* @Date: 2023/5/18 18:21
*/
@ComponentScan(basePackages = "com.mmc.pms.feign")
@Configuration
public class FeignConfiguration {
@Bean(name = "userAppApiHystrix")
public UserAppApiHystrix userAppApi() {
return new UserAppApiHystrix();
}
}
package com.mmc.pms.feign.hystrix;
import com.mmc.pms.auth.dto.BUserAccountQO;
import com.mmc.pms.auth.dto.UserAccountSimpleDTO;
import com.mmc.pms.feign.UserAppApi;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
/**
* @author: zj
* @Date: 2023/5/18 17:08
*/
@Slf4j
public class UserAppApiHystrix implements UserAppApi {
@Override
public UserAccountSimpleDTO feignGetUserSimpleInfo(Integer userAccountId, String token) {
log.error("熔断:feignGetUserSimpleInfo:{}", userAccountId);
return null;
}
@Override
public List<Integer> feignListUserAccountIds(Integer provinceCode, Integer cityCode, Integer districtCode, String token) {
log.error("熔断:feignListUserAccountIds:{}, {}, {}", provinceCode, cityCode, districtCode);
return null;
}
@Override
public List<UserAccountSimpleDTO> feignListBAccountPage(BUserAccountQO bUserAccountQO, String token) {
log.error("熔断:feignListBAccountPage:{}", bUserAccountQO);
return null;
}
}
......@@ -13,107 +13,107 @@ import java.util.List;
*/
public class JsonUtil {
public static void main(String[] args) {
String array = "[1,24,23]";
List<Integer> list = JSONArray.parseArray(array, Integer.class);
System.out.println(list.get(2));
}
public static void main(String[] args) {
String array = "[1,24,23]";
List<Integer> list = JSONArray.parseArray(array, Integer.class);
System.out.println(list.get(2));
}
/**
* 把Java对象转换成json字符串
*
* @param object 待转化为JSON字符串的Java对象
* @return json 串 or null
*/
public static String parseObjToJson(Object object) {
String string = null;
try {
string = JSONObject.toJSONString(object);
} catch (Exception e) {
// LOGGER.error(e.getMessage());
}
return string;
/**
* 把Java对象转换成json字符串
*
* @param object 待转化为JSON字符串的Java对象
* @return json 串 or null
*/
public static String parseObjToJson(Object object) {
String string = null;
try {
string = JSONObject.toJSONString(object);
} catch (Exception e) {
// LOGGER.error(e.getMessage());
}
return string;
}
/**
* 将Json字符串信息转换成对应的Java对象
*
* @param json json字符串对象
* @param c 对应的类型
*/
public static <T> T parseJsonToObj(String json, Class<T> c) {
try {
JSONObject jsonObject = JSON.parseObject(json);
return JSON.toJavaObject(jsonObject, c);
} catch (Exception e) {
// LOGGER.error(e.getMessage());
}
return null;
/**
* 将Json字符串信息转换成对应的Java对象
*
* @param json json字符串对象
* @param c 对应的类型
*/
public static <T> T parseJsonToObj(String json, Class<T> c) {
try {
JSONObject jsonObject = JSON.parseObject(json);
return JSON.toJavaObject(jsonObject, c);
} catch (Exception e) {
// LOGGER.error(e.getMessage());
}
return null;
}
/**
* 读取json文件
*
* @param fileName
* @return
*/
public static String readJsonFile(String fileName) {
String jsonStr = "";
try {
File jsonFile = new File(fileName);
FileReader fileReader = new FileReader(jsonFile);
Reader reader = new InputStreamReader(new FileInputStream(jsonFile), "utf-8");
int ch = 0;
StringBuffer sb = new StringBuffer();
while ((ch = reader.read()) != -1) {
sb.append((char) ch);
}
fileReader.close();
reader.close();
jsonStr = sb.toString();
return jsonStr;
} catch (IOException e) {
e.printStackTrace();
return null;
}
/**
* 读取json文件
*
* @param fileName
* @return
*/
public static String readJsonFile(String fileName) {
String jsonStr = "";
try {
File jsonFile = new File(fileName);
FileReader fileReader = new FileReader(jsonFile);
Reader reader = new InputStreamReader(new FileInputStream(jsonFile), "utf-8");
int ch = 0;
StringBuffer sb = new StringBuffer();
while ((ch = reader.read()) != -1) {
sb.append((char) ch);
}
fileReader.close();
reader.close();
jsonStr = sb.toString();
return jsonStr;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
/**
* 将JSON数据格式化并保存到文件中
*
* @param jsonData 需要输出的json数
* @param filePath 输出的文件地址
* @return
*/
public static boolean createJsonFile(Object jsonData, String filePath) {
String content =
JSON.toJSONString(
jsonData,
SerializerFeature.PrettyFormat,
SerializerFeature.WriteMapNullValue,
SerializerFeature.WriteDateUseDateFormat);
// 标记文件生成是否成功
boolean flag = true;
// 生成json格式文件
try {
// 保证创建一个新文件
File file = new File(filePath);
if (!file.getParentFile().exists()) { // 如果父目录不存在,创建父目录
file.getParentFile().mkdirs();
}
if (file.exists()) { // 如果已存在,删除旧文件
file.delete();
}
file.createNewFile();
// 将格式化后的字符串写入文件
Writer write = new OutputStreamWriter(new FileOutputStream(file), "UTF-8");
write.write(content);
write.flush();
write.close();
} catch (Exception e) {
flag = false;
e.printStackTrace();
}
return flag;
/**
* 将JSON数据格式化并保存到文件中
*
* @param jsonData 需要输出的json数
* @param filePath 输出的文件地址
* @return
*/
public static boolean createJsonFile(Object jsonData, String filePath) {
String content =
JSON.toJSONString(
jsonData,
SerializerFeature.PrettyFormat,
SerializerFeature.WriteMapNullValue,
SerializerFeature.WriteDateUseDateFormat);
// 标记文件生成是否成功
boolean flag = true;
// 生成json格式文件
try {
// 保证创建一个新文件
File file = new File(filePath);
if (!file.getParentFile().exists()) { // 如果父目录不存在,创建父目录
file.getParentFile().mkdirs();
}
if (file.exists()) { // 如果已存在,删除旧文件
file.delete();
}
file.createNewFile();
// 将格式化后的字符串写入文件
Writer write = new OutputStreamWriter(new FileOutputStream(file), "UTF-8");
write.write(content);
write.flush();
write.close();
} catch (Exception e) {
flag = false;
e.printStackTrace();
}
return flag;
}
}
/**
* Copyright 2023 bejson.com
*/
package com.mmc.pms.model.categories.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* Auto-generated: 2023-06-08 16:2:43
*
* @author 23214
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class AllCategoryDTO implements Serializable {
private static final long serialVersionUID = 1171841063641249397L;
private Integer directoryId;
private String name;
private List<CategoriesInfoListDTO> categoriesInfoListDTO;
}
\ No newline at end of file
/** Copyright 2023 bejson.com */
package com.mmc.pms.model.categories.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* Auto-generated: 2023-06-08 16:2:43
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class CategoriesInfoListDTO implements Serializable {
private static final long serialVersionUID = -8381856228953745772L;
private Integer id;
private Integer directoryId;
private String name;
private String icon;
}
package com.mmc.pms.model.categories.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @Author LW
*
* @date 2023/6/10 13:46 概要:
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class CategoryTypeDTO implements Serializable {
private Integer id;
private String categoryName;
}
......@@ -6,25 +6,27 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @Author LW
* @date 2023/5/24 11:06
* 概要:
*
* @date 2023/5/24 11:06 概要:
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class DirectoryInfoVO {
@ApiModelProperty(value = "目录id")
private Integer id;
@ApiModelProperty(value = "目录名称")
private String directoryName;
@ApiModelProperty(value = "关联目录的id")
private Integer pid;
@ApiModelProperty(value = "关联目录名称")
private String relevanceName;
@ApiModelProperty(value = "分类模块:(0:通用分类 1:作业服务分类 2:设备分类 3:飞手分类 4:商城分类)")
private Integer type;
@ApiModelProperty(value = "目录id")
private Integer id;
@ApiModelProperty(value = "目录名称")
private String directoryName;
@ApiModelProperty(value = "分类模块:(0:通用分类 1:作业服务分类 2:设备分类 3:飞手分类 4:商城分类)")
private Integer type;
@ApiModelProperty(value = "显示:1:作业服务分类 2:设备分类 3:飞手分类 4:商城分类")
private List<Integer> show;
}
package com.mmc.pms.model.lease.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Author small @Date 2023/5/16 9:53 @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LeaseGoodsInfoDTO implements Serializable {
private static final long serialVersionUID = -4354269497656808831L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "商品名称")
private String goodsName;
@ApiModelProperty(value = "商品图片")
private String images;
@ApiModelProperty(value = "价格")
private BigDecimal price;
}
package com.mmc.pms.model.qo;
import com.mmc.pms.common.Page;
import com.mmc.pms.model.group.Freeze;
import com.mmc.pms.page.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
......
package com.mmc.pms.model.qo;
import com.mmc.pms.common.Page;
import com.mmc.pms.model.group.Freeze;
import com.mmc.pms.page.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
......
package com.mmc.pms.model.qo;
import com.mmc.pms.common.Page;
import com.mmc.pms.model.group.Freeze;
import com.mmc.pms.page.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
......
package com.mmc.pms.model.qo;
import com.mmc.pms.common.Page;
import com.mmc.pms.model.group.Freeze;
import io.swagger.annotations.ApiModelProperty;
......@@ -13,11 +12,12 @@ import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @Author LW
* @date 2023/6/8 10:33
* 概要:
*
* @date 2023/6/8 10:33 概要:
*/
@Data
@AllArgsConstructor
......@@ -25,34 +25,44 @@ import java.io.Serializable;
@Builder
public class ServiceQO implements Serializable {
private static final long serialVersionUID = 1L;
private Integer id;
private static final long serialVersionUID = 1L;
private Integer id;
@ApiModelProperty(value = "服务名称", example = "服务名称")
@Length(message = "最大不超过30字", max = 30)
private String serviceName;
@ApiModelProperty(value = "分类id集合(应用/行业等)")
private List<Integer> categoryId;
@ApiModelProperty(value = "服务名称", example = "服务名称")
@Length(message = "最大不超过30字", max = 30)
private String serviceName;
@ApiModelProperty(value = "应用id")
private Integer applicationId;
@ApiModelProperty(value = "应用", example = "1")
private Integer applicationId;
@ApiModelProperty(value = "行业id")
private Integer industryId;
@ApiModelProperty(value = "行业", example = "2")
private Integer industryId;
@ApiModelProperty(value = "省份编码", example = "440000")
private Integer provinceId;
@ApiModelProperty(value = "账号id")
private Integer accountId;
@ApiModelProperty(value = "展示状态")
private Integer displayState;
@ApiModelProperty(value = "页码", required = true)
@NotNull(message = "页码不能为空", groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "页码", required = true)
@NotNull(
message = "页码不能为空",
groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true)
@NotNull(message = "每页显示数不能为空", groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
@ApiModelProperty(value = "每页显示数", required = true)
@NotNull(
message = "每页显示数不能为空",
groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
}
package com.mmc.pms.model.qo;
import com.mmc.pms.page.Page;
import com.mmc.pms.common.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
......@@ -9,6 +9,7 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @Author small @Date 2023/5/16 9:55 @Version 1.0
......@@ -16,42 +17,24 @@ import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
// @ApiModel(value = "com.mmc.csf.model.qo.WareInfoQO", description = "model")
public class WareInfoQO implements Serializable {
private static final long serialVersionUID = -2953141525621912414L;
@ApiModelProperty(name = "id", value = "设备id", example = "1", required = false)
private Integer id;
@ApiModelProperty(name = "districtId", value = "地域id", example = "440000")
private Integer provinceId;
@ApiModelProperty(name = "districtId", value = "地域id", example = "1", required = false)
private Integer districtId;
@ApiModelProperty(name = "categoryId", value = "分类id")
private List<Integer> categoryId;
@ApiModelProperty(name = "categoryId", value = "类目id", example = "类目id")
private Integer categoryId;
@ApiModelProperty(name = "产品类型:0商城 1租赁")
private Integer type;
@ApiModelProperty(name = "brandIdl", value = "品牌id", example = "品牌id")
private Integer brandId;
@ApiModelProperty(name = "modelId", value = "型号id", example = "型号id")
private Integer modelId;
/*@ApiModelProperty(value = "关键字")
private String keyword;
@ApiModelProperty(value = "商品状态,出租中或仓库中")
private Integer wareStatus;
@ApiModelProperty(value = "商品类型")
private Integer wareTypeId;
@ApiModelProperty(value = "活动属性")
private Integer propInfoId;*/
@ApiModelProperty(value = "页码", required = true)
@ApiModelProperty(value = "页码", required = true, example = "1")
@NotNull(message = "页码不能为空", groups = Page.class)
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true)
@ApiModelProperty(value = "每页显示数", required = true, example = "10")
@NotNull(message = "每页显示数不能为空", groups = Page.class)
@Min(value = 1, groups = Page.class)
private Integer pageSize;
......
......@@ -7,43 +7,63 @@ import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* @Author LW
* @date 2022/10/14 11:30
* 概要:
*
* @date 2022/10/14 11:30 概要:
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class MallGoodsDetailDTO implements Serializable {
private static final long serialVersionUID = 7041502536618388167L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "商品图片")
private List<GoodsImgDTO> images;
@ApiModelProperty(value = "商品视频")
private String goodsVideo;
@ApiModelProperty(value = "商品视频id")
private Integer goodsVideoId;
@ApiModelProperty(value = "商品名称")
private String goodsName;
@ApiModelProperty(value = "商品详情")
private GoodsDetailInfoDTO goodsDetail;
@ApiModelProperty(value = "所属目录")
private Integer directoryId;
@ApiModelProperty(value = "一级分类id")
private Integer categoryByOne;
@ApiModelProperty(value = "二级分类id")
private Integer categoryByTwo;
@ApiModelProperty(value = "商品标签")
private String tag;
@ApiModelProperty(value = "商品状态 0:下架 1:上架")
private Integer shelfStatus;
@ApiModelProperty(value = "规格信息")
private List<GoodsSpecDTO> goodsSpec;
@ApiModelProperty(value = "其他服务: 1:免费配送,2:专业飞手培训2日, 3:半年保修, 4:一年保修 ")
private List<GoodsOtherServiceDTO> otherService;
private static final long serialVersionUID = 7041502536618388167L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "商品图片")
private List<GoodsImgDTO> images;
@ApiModelProperty(value = "商品视频")
private String goodsVideo;
@ApiModelProperty(value = "商品视频id")
private Integer goodsVideoId;
@ApiModelProperty(value = "商品名称")
private String goodsName;
@ApiModelProperty(value = "商品编号")
private String goodsNo;
@ApiModelProperty(value = "商品详情")
private GoodsDetailInfoDTO goodsDetail;
@ApiModelProperty(value = "所属目录")
private Integer directoryId;
@ApiModelProperty(value = "一级分类id")
private Integer categoryByOne;
@ApiModelProperty(value = "二级分类id")
private Integer categoryByTwo;
@ApiModelProperty(value = "商品标签")
private String tag;
@ApiModelProperty(value = "商品状态 0:下架 1:上架")
private Integer shelfStatus;
@ApiModelProperty(value = "规格信息")
private List<GoodsSpecDTO> goodsSpec;
@ApiModelProperty(value = "其他服务: 1:免费配送,2:专业飞手培训2日, 3:半年保修, 4:一年保修 ")
private List<GoodsOtherServiceDTO> otherService;
@ApiModelProperty(value = "price(用于租赁商品)")
private BigDecimal price;
}
......@@ -9,6 +9,7 @@ import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Author small @Date 2023/5/16 15:30 @Version 1.0
......@@ -19,26 +20,29 @@ import java.util.Date;
@Builder
@Accessors
public class ProductSpecDTO implements Serializable {
private static final long serialVersionUID = -2681122778843398310L;
private static final long serialVersionUID = -2681122778843398310L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "productSkuId")
private Integer productSkuId;
@ApiModelProperty(value = "productSkuId")
private Integer productSkuId;
@ApiModelProperty(value = "规格名称")
private String specName;
@ApiModelProperty(value = "规格名称")
private String specName;
@ApiModelProperty(value = "规格图片")
private String specImage;
@ApiModelProperty(value = "规格图片")
private String specImage;
@ApiModelProperty(value = "料号")
private String partNo;
@ApiModelProperty(value = "料号")
private String partNo;
@ApiModelProperty(value = "版本描述")
private String versionDesc;
@ApiModelProperty(value = "版本描述")
private String versionDesc;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "价格配置")
private List<ProductSpecPriceDTO> priceList;
}
package com.mmc.pms.model.sale.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author LW
* @date 2022/3/28 10:48
* 概要:
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "com.mmc.csf.mall.dto.SaleServiceDTO", description = "其他服务信息DTO")
public class SaleServiceDTO {
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "其他服务名称")
private String saleServiceName;
}
package com.mmc.pms.model.sale.qo;
import com.mmc.pms.common.Page;
import com.mmc.pms.model.group.Freeze;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/**
* @Author LW
*
* @date 2022/3/22 9:44 概要:商品列表查询QO
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MallGoodsQO {
@ApiModelProperty(value = "商品名称", example = "商品名称")
private String goodsName;
@ApiModelProperty(value = "商品类型 0:销售 1:租赁", example = "0")
private Integer goodsType;
@ApiModelProperty(value = "开始时间", example = "2023-06-09 00:00:00")
private String startTime;
@ApiModelProperty(value = "结束时间", example = "2023-06-11 23:59:59")
private String endTime;
@ApiModelProperty(value = "状态 0:下架(仓库中)1:上架", example = "1")
private Integer status;
@ApiModelProperty(value = "目录id", example = "1")
private Integer directoryId;
@ApiModelProperty(value = "页码", required = true, example = "1")
@NotNull(
message = "页码不能为空",
groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true, example = "10")
@NotNull(
message = "每页显示数不能为空",
groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
}
package com.mmc.pms.model.sale.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @Author LW
*
* @date 2022/4/1 20:22 概要:
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "com.mmc.csf.model.vo.BatchShelfVO", description = "商品上下架参数")
public class BatchShelfVO implements Serializable {
@ApiModelProperty(value = "商品id")
private List<Integer> goodsIds;
@ApiModelProperty(value = "状态:上架:1,下架:0")
private Integer status;
}
package com.mmc.pms.model.sale.vo;
import com.mmc.pms.common.Page;
import com.mmc.pms.model.group.Create;
import com.mmc.pms.model.group.Freeze;
import com.mmc.pms.model.group.Update;
import com.mmc.pms.page.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
......@@ -15,30 +15,34 @@ import java.io.Serializable;
/**
* @Author LW
* @date 2023/5/25 11:25
* 概要:
*
* @date 2023/5/25 11:25 概要:
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class QueryClassifyVO implements Serializable {
@ApiModelProperty(value = "所属目录id")
@NotNull(message = "所属目录id不能为空", groups = {Update.class, Create.class})
private Integer directoryId;
@ApiModelProperty(value = "所属目录id")
@NotNull(
message = "所属目录id不能为空",
groups = {Update.class, Create.class})
private Integer directoryId;
@ApiModelProperty(value = "分类所属模块id(0:通用分类 1:作业服务分类 2:设备租赁分类 3:飞手培训分类 4:产品商城分类)")
private Integer type;
@ApiModelProperty(value = "页码", required = true)
@NotNull(message = "页码不能为空", groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true)
@NotNull(message = "每页显示数不能为空", groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
@ApiModelProperty(value = "页码", required = true)
@NotNull(
message = "页码不能为空",
groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageNo;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
@ApiModelProperty(value = "每页显示数", required = true)
@NotNull(
message = "每页显示数不能为空",
groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
}
......@@ -14,8 +14,10 @@ import java.math.BigDecimal;
@NoArgsConstructor
@AllArgsConstructor
public class SpecPriceVO implements Serializable {
private static final long serialVersionUID = -8976672168410262190L;
private Integer id;
private Integer cooperationTag;
private BigDecimal price;
private static final long serialVersionUID = -8976672168410262190L;
private Integer id;
private Integer cooperationTag;
private BigDecimal price;
private Integer productSpecId;
private Integer leaseTerm;
}
package com.mmc.pms.model.work.dto;
import com.mmc.pms.entity.InspComtDO;
import com.mmc.pms.entity.ServiceDO;
import com.mmc.pms.model.work.vo.ServiceVO;
import io.swagger.annotations.ApiModelProperty;
......@@ -10,6 +11,7 @@ import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Author LW
......@@ -59,6 +61,12 @@ public class ServiceDTO implements Serializable {
@ApiModelProperty(value = "账号id")
private Integer accountId;
@ApiModelProperty(value = "评论列表")
private List<InspComtDO> inspComtList;
@ApiModelProperty(value = "评论数量")
private Integer inspComtAmount;
@ApiModelProperty(value = "创建时间")
private Date createTime;
......
package com.mmc.pms.model.work.dto;
import com.mmc.pms.entity.InspComtDO;
import com.mmc.pms.model.group.Create;
import com.mmc.pms.model.group.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class WorkServiceDTO implements Serializable {
private static final long serialVersionUID = -15752785758L;
private Integer id;
@ApiModelProperty(value = "服务名称")
private String serviceName;
@ApiModelProperty(value = "服务价格")
private BigDecimal servicePrice;
@ApiModelProperty(value = "封面图")
private String coverPlan;
@ApiModelProperty(value = "分享卡片")
private String shareCard;
@ApiModelProperty(value = "视频")
private String video;
@ApiModelProperty(value = "服务介绍")
private String serviceIntroduction;
@ApiModelProperty(value = "公司名称")
private String companyName;
@ApiModelProperty(value = "评论列表")
private List<InspComtDO> inspComtList;
@ApiModelProperty(value = "评论数量")
private Integer inspComtAmount;
}
......@@ -15,8 +15,8 @@ import java.io.Serializable;
/**
* @Author LW
* @date 2023/6/8 10:33
* 概要:
*
* @date 2023/6/8 10:33 概要:
*/
@Data
@AllArgsConstructor
......@@ -24,37 +24,47 @@ import java.io.Serializable;
@Builder
public class ServiceVO implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
@NotNull(message = "修改服务id不能为空", groups = {Update.class})
private Integer id;
@NotNull(
message = "修改服务id不能为空",
groups = {Update.class})
private Integer id;
@ApiModelProperty(value = "服务名称", example = "服务名称")
@NotBlank(message = "服务名称不能为空", groups = {Create.class, Update.class})
@Length(message = "最大不超过30字", max = 30)
private String serviceName;
@ApiModelProperty(value = "服务名称", example = "服务名称")
@NotBlank(
message = "服务名称不能为空",
groups = {Create.class})
@Length(message = "最大不超过30字", max = 30)
private String serviceName;
@ApiModelProperty(value = "应用", example = "1")
private Integer applicationId;
@ApiModelProperty(value = "应用", example = "1")
private Integer applicationId;
@ApiModelProperty(value = "行业", example = "2")
@NotNull(message = "行业id不能为空", groups = {Create.class, Update.class})
private Integer industryId;
@ApiModelProperty(value = "行业", example = "2")
@NotNull(
message = "行业id不能为空",
groups = {Create.class})
private Integer industryId;
@ApiModelProperty(value = "展示状态,0为上架,1下架", example = "0")
@NotNull(message = "展示状态不能为空", groups = {Create.class, Update.class})
private Integer displayState;
@ApiModelProperty(value = "展示状态,0为上架,1下架", example = "0")
@NotNull(
message = "展示状态不能为空",
groups = {Create.class})
private Integer displayState;
@ApiModelProperty(value = "封面图")
@NotBlank(message = "封面图不能为空", groups = {Create.class, Update.class})
private String coverPlan;
@ApiModelProperty(value = "封面图")
@NotBlank(
message = "封面图不能为空",
groups = {Create.class})
private String coverPlan;
@ApiModelProperty(value = "分享卡片")
private String shareCard;
@ApiModelProperty(value = "分享卡片")
private String shareCard;
@ApiModelProperty(value = "视频")
private String video;
@ApiModelProperty(value = "视频")
private String video;
@ApiModelProperty(value = "服务介绍")
private String serviceIntroduction;
@ApiModelProperty(value = "服务介绍")
private String serviceIntroduction;
}
package com.mmc.pms.model.work.vo;
import com.mmc.pms.model.group.Update;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class UpAndDownServiceVO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id集合")
@Size(min = 1,message = "修改时id集合不能为空",groups = Update.class)
private List<Integer> ids;
@ApiModelProperty(value = "展示状态,0为上架,1下架", example = "0")
@NotNull(message = "修改时展示状态不能为空",groups = Update.class)
private Integer displayState;
}
package com.mmc.pms.page;
/**
* @Author small @Date 2023/5/16 10:09 @Version 1.0
*/
public interface Page {}
package com.mmc.pms.service;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.qo.ServiceQO;
import com.mmc.pms.model.work.dto.ServiceDTO;
import com.mmc.pms.model.work.vo.ServiceVO;
import com.mmc.pms.model.work.vo.UpAndDownServiceVO;
import com.mmc.pms.page.PageResult;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* @Author LW
* @date 2023/6/6 10:46
* 概要:
*
* @date 2023/6/6 10:46 概要:
*/
public interface BackstageTaskService {
ResultBody addWorkService(ServiceVO param, Integer userAccountId);
ResultBody addWorkService(ServiceVO param, Integer userAccountId);
ResultBody updateById(ServiceVO param);
ResultBody deleteByIds(List<Integer> ids);
ResultBody<ServiceDTO> queryById(Integer id);
ResultBody updateById(ServiceVO param);
PageResult queryServiceManagerList(ServiceQO param, Integer userAccountId);
ResultBody deleteById(Integer id);
PageResult queryWorkServiceList(ServiceQO param, HttpServletRequest request);
ResultBody queryById(Integer id);
List<ServiceDTO> feignQueryWorkServiceListById(List<Integer> ids);
PageResult queryWorkServiceList(ServiceQO param, Integer userAccountId);
ResultBody batchUpAndDownWorkService(UpAndDownServiceVO param);
}
......@@ -4,13 +4,14 @@ import com.mmc.pms.common.ResultBody;
import com.mmc.pms.entity.Categories;
import com.mmc.pms.entity.DirectoryDO;
import com.mmc.pms.entity.DistrictDO;
import com.mmc.pms.model.categories.vo.CategoriesInfoVO;
import com.mmc.pms.model.categories.dto.AllCategoryDTO;
import com.mmc.pms.model.categories.vo.ClassifyInfoVO;
import com.mmc.pms.model.categories.vo.DirectoryInfoVO;
import com.mmc.pms.model.sale.vo.QueryClassifyVO;
import com.mmc.pms.page.PageResult;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
......@@ -42,10 +43,13 @@ public interface CategoriesService {
ResultBody getDirectoryList(Integer type);
ResultBody queryCategoryInfoByType(Integer type);
List<Categories> getCategoriesListByDirectoryName(String directoryName);
ResultBody getApplicationList(String directoryName);
List<Categories> getCategoriesListByIds(Set<Integer> ids);
List<AllCategoryDTO> feigQqueryCategoryInfoByType(Integer type);
}
package com.mmc.pms.service;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.sale.dto.ProductSpecPriceDTO;
import com.mmc.pms.model.order.dto.OrderGoodsIndstDTO;
import com.mmc.pms.model.order.dto.OrderGoodsProdDTO;
import com.mmc.pms.model.qo.MallOrderGoodsInfoQO;
import com.mmc.pms.model.qo.ProductSpecPriceQO;
import com.mmc.pms.model.sale.dto.MallGoodsShopCarDTO;
import com.mmc.pms.model.sale.dto.MallProductSpecPriceDTO;
import com.mmc.pms.model.sale.dto.ProductSpecPriceDTO;
import com.mmc.pms.model.sale.qo.MallGoodsQO;
import com.mmc.pms.model.sale.vo.GoodsAddVO;
import com.mmc.pms.page.PageResult;
import java.util.List;
......@@ -19,21 +21,29 @@ import java.util.List;
*/
public interface GoodsInfoService {
ResultBody addGoods(GoodsAddVO goodsAddVO);
ResultBody addGoods(GoodsAddVO goodsAddVO);
ResultBody editGoodsInfo(GoodsAddVO goodsAddVO);
ResultBody getGoodsInfoDetail(Integer goodsInfoId, Integer type, Integer leaseTerm);
ResultBody getSkuUnit();
ResultBody getSaleServiceInfoToList();
ResultBody editGoodsInfo(GoodsAddVO goodsAddVO);
List<MallGoodsShopCarDTO> fillGoodsInfo(List<MallGoodsShopCarDTO> param);
ResultBody getGoodsInfoDetail(Integer goodsInfoId);
List<MallProductSpecPriceDTO> feignListProductSpecPrice(ProductSpecPriceQO productSpecPriceQO);
ResultBody getSkuUnit();
ProductSpecPriceDTO feignGetUnitPriceByTag(Integer specId, Integer tagId);
List<MallGoodsShopCarDTO> fillGoodsInfo(List<MallGoodsShopCarDTO> param);
List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO);
List<MallProductSpecPriceDTO> feignListProductSpecPrice(ProductSpecPriceQO productSpecPriceQO);
List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO);
ProductSpecPriceDTO feignGetUnitPriceByTag(Integer specId, Integer tagId);
PageResult listPageGoodsInfo(MallGoodsQO param);
List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO);
ResultBody batchOnShelfOrTakeDown(List<Integer> goodsIds, Integer status);
List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO);
ResultBody batchRemoveWareInfo(List<Integer> ids);
}
package com.mmc.pms.service.Impl;
import com.google.common.collect.Lists;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.constant.DateConstant;
import com.mmc.pms.dao.BackstageTaskServiceDao;
import com.mmc.pms.dao.CategoriesDao;
import com.mmc.pms.entity.Categories;
import com.mmc.pms.entity.InspComtDO;
import com.mmc.pms.entity.ServiceDO;
import com.mmc.pms.feign.UserAppApi;
import com.mmc.pms.model.qo.ServiceQO;
import com.mmc.pms.model.work.dto.ServiceDTO;
import com.mmc.pms.model.work.dto.WorkServiceDTO;
import com.mmc.pms.model.work.vo.ServiceVO;
import com.mmc.pms.model.work.vo.UpAndDownServiceVO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.BackstageTaskService;
import com.mmc.pms.service.CategoriesService;
import com.mmc.pms.service.InspComtService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* @Author LW
* @date 2023/6/8 9:59
* 概要:
*
* @date 2023/6/8 9:59 概要:
*/
@Service
@Slf4j
public class BackstageTaskServiceImpl implements BackstageTaskService {
@Autowired
private BackstageTaskServiceDao backstageTaskServiceDao;
@Autowired private BackstageTaskServiceDao backstageTaskServiceDao;
@Autowired
private CategoriesDao categoriesDao;
@Autowired private CategoriesDao categoriesDao;
@Override
public ResultBody addWorkService(ServiceVO param, Integer userAccountId) {
ServiceDO serviceDO = new ServiceDO(param, userAccountId);
backstageTaskServiceDao.insert(serviceDO);
return ResultBody.success();
@Autowired private UserAppApi userAppApi;
@Autowired private InspComtService inspComtService;
@Autowired private RedisTemplate redisTemplate;
@Override
public ResultBody addWorkService(ServiceVO param, Integer userAccountId) {
ServiceDO serviceDO = new ServiceDO(param, userAccountId);
backstageTaskServiceDao.insert(serviceDO);
return ResultBody.success();
}
@Override
public ResultBody updateById(ServiceVO param) {
ServiceDO serviceDO = new ServiceDO(param);
backstageTaskServiceDao.update(serviceDO);
return ResultBody.success();
}
@Override
public ResultBody deleteByIds(List<Integer> ids) {
if(!CollectionUtils.isEmpty(ids)){
backstageTaskServiceDao.deleteByIds(ids);
}
return ResultBody.success();
}
@Override
public ResultBody updateById(ServiceVO param) {
ServiceDO serviceDO = new ServiceDO(param);
backstageTaskServiceDao.update(serviceDO);
return ResultBody.success();
@Override
public ResultBody<ServiceDTO> queryById(Integer id) {
ServiceDO serviceDO = backstageTaskServiceDao.queryById(id);
ServiceDTO serviceDTO = new ServiceDTO(serviceDO);
Map<Integer, String> categoriesNameMap =
getCategoriesNameByIds(
Arrays.asList(serviceDTO.getApplicationId(), serviceDTO.getIndustryId()));
if (!CollectionUtils.isEmpty(categoriesNameMap)) {
serviceDTO.setApplicationName(categoriesNameMap.get(serviceDTO.getApplicationId()));
serviceDTO.setIndustryName(categoriesNameMap.get(serviceDTO.getIndustryId()));
}
List<InspComtDO> inspComtList = RandomGetInspComt(id);
serviceDTO.setInspComtList(inspComtList);
serviceDTO.setInspComtAmount(inspComtList.size());
return ResultBody.success(serviceDTO);
}
private Map<Integer, String> getCategoriesNameByIds(List<Integer> ids) {
if (CollectionUtils.isEmpty(ids)) {
return new HashMap<>();
}
Set<Integer> idSet = new HashSet<>();
for (Integer id : ids) {
idSet.add(id);
}
List<Categories> categories = categoriesDao.getCategoriesListByIds(idSet);
if (CollectionUtils.isEmpty(categories)) {
return new HashMap<>();
}
return categories.stream()
.collect(Collectors.toMap(Categories::getId, d -> d.getName(), (k1, k2) -> k1));
}
@Override
public ResultBody deleteById(Integer id) {
backstageTaskServiceDao.deleteById(id);
return ResultBody.success();
@Override
public PageResult queryServiceManagerList(ServiceQO param, Integer userAccountId) {
int count = backstageTaskServiceDao.count(param);
if (count == 0) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
}
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<ServiceDO> services = backstageTaskServiceDao.queryAllByLimit(param);
List<ServiceDTO> pageList = setApplicationNameAndIndustryName(services);
return PageResult.buildPage(pageNo, param.getPageSize(), count, pageList);
}
private List<ServiceDTO> setApplicationNameAndIndustryName(List<ServiceDO> services) {
List<Integer> list = new ArrayList<>();
for (ServiceDO service : services) {
list.add(service.getApplicationId());
list.add(service.getIndustryId());
}
Map<Integer, String> categoriesNameMap = getCategoriesNameByIds(list);
List<ServiceDTO> pageList =
services.stream()
.map(
d -> {
ServiceDTO serviceDTO = new ServiceDTO(d);
serviceDTO.setApplicationName(categoriesNameMap.get(d.getApplicationId()));
serviceDTO.setIndustryName(categoriesNameMap.get(d.getIndustryId()));
return serviceDTO;
})
.collect(Collectors.toList());
return pageList;
}
@Override
public PageResult queryWorkServiceList(ServiceQO param, HttpServletRequest request) {
log.info(
"开始queryWorkServiceList==>{}",
JSONObject.toJSONString(DateFormatUtils.format(new Date(), DateConstant.YYYYMMDDHHMMSS)));
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<Integer> userIds = null;
Integer provinceCode = param.getProvinceId();
if(provinceCode!=null){
userIds = userAppApi.feignListUserAccountIds(provinceCode, null, null, null);
if(userIds==null || userIds.size()==0){
userIds = Arrays.asList(-1);
}
}
List<Integer> categoriesIds = param.getCategoryId();
int count = backstageTaskServiceDao.conditionCount(param,categoriesIds,userIds);
if (count == 0) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
}
List<ServiceDO> pageList = backstageTaskServiceDao.queryPageByLimit(param,categoriesIds,userIds);
List<WorkServiceDTO> workServiceDTOList = getWorkServiceDTOS(pageList);
log.info(
"结束queryWorkServiceList==>{}",
JSONObject.toJSONString(DateFormatUtils.format(new Date(), DateConstant.YYYYMMDDHHMMSS)));
return PageResult.buildPage(pageNo, param.getPageSize(), count, workServiceDTOList);
}
@Override
public List<ServiceDTO> feignQueryWorkServiceListById(List<Integer> ids) {
return backstageTaskServiceDao.QueryWorkServiceListById(ids);
}
@Override
public ResultBody queryById(Integer id) {
ServiceDO serviceDO = backstageTaskServiceDao.queryById(id);
ServiceDTO serviceDTO = new ServiceDTO(serviceDO);
Map<Integer, String> categoriesNameMap = getCategoriesNameByIds(Arrays.asList(serviceDTO.getApplicationId(),serviceDTO.getIndustryId()));
if(!CollectionUtils.isEmpty(categoriesNameMap)){
serviceDTO.setApplicationName(categoriesNameMap.get(serviceDTO.getApplicationId()));
serviceDTO.setIndustryName(categoriesNameMap.get(serviceDTO.getIndustryId()));
}
return ResultBody.success(serviceDTO);
@Override
public ResultBody batchUpAndDownWorkService(UpAndDownServiceVO param) {
if(!CollectionUtils.isEmpty(param.getIds())){
backstageTaskServiceDao.batchUpAndDownWorkService(param);
}
return ResultBody.success();
}
private Map<Integer,String> getCategoriesNameByIds(List<Integer> ids){
if(CollectionUtils.isEmpty(ids)){
return new HashMap<>();
}
Set<Integer> idSet = new HashSet<>();
for (Integer id : ids) {
idSet.add(id);
}
List<Categories> categories = categoriesDao.getCategoriesListByIds(idSet);
if(CollectionUtils.isEmpty(categories)){
return new HashMap<>();
}
return categories.stream().collect(Collectors.toMap(Categories::getId, d -> d.getName(), (k1, k2) -> k1));
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;
}
@Override
public PageResult queryWorkServiceList(ServiceQO param, Integer userAccountId) {
int count = backstageTaskServiceDao.count(param);
if(count == 0){
return PageResult.buildPage(param.getPageNo(), param.getPageSize(),count);
}
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<ServiceDO> services = backstageTaskServiceDao.queryAllByLimit(param);
List<Integer> list = new ArrayList<>();
for (ServiceDO service : services) {
list.add(service.getApplicationId());
list.add(service.getIndustryId());
}
Map<Integer, String> categoriesNameMap = getCategoriesNameByIds(list);
List<ServiceDTO> pageList = services.stream().map(d->{
ServiceDTO serviceDTO = new ServiceDTO(d);
serviceDTO.setApplicationName(categoriesNameMap.get(d.getApplicationId()));
serviceDTO.setIndustryName(categoriesNameMap.get(d.getIndustryId()));
return serviceDTO;
}).collect(Collectors.toList());
return PageResult.buildPage(pageNo, param.getPageSize(),count,pageList);
/**
* 根据id随机获取50条以上的评论
*/
private List<InspComtDO> RandomGetInspComt(Integer id) {
String listStr = (String) redisTemplate.opsForValue().get(id);
List<InspComtDO> inspComtRandomList = null;
if(StringUtils.isNotBlank(listStr)){
inspComtRandomList = JSONArray.parseArray(listStr, InspComtDO.class);
}else {
inspComtRandomList = inspComtService.randomGetInspComtList(RandomUtils.nextInt(50, 9999));
String toJSONString = JSONObject.toJSONString(inspComtRandomList);
redisTemplate.opsForValue().set(id, toJSONString, 2L, TimeUnit.DAYS);
}
return inspComtRandomList;
}
}
package com.mmc.pms.service.Impl;
import com.google.common.collect.Lists;
import com.alibaba.fastjson.JSONObject;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.dao.CategoriesDao;
......@@ -9,9 +9,10 @@ import com.mmc.pms.dao.GoodsInfoDao;
import com.mmc.pms.entity.Categories;
import com.mmc.pms.entity.DirectoryDO;
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.CategoriesInfoListDTO;
import com.mmc.pms.model.categories.dto.ClassifyInfoDTO;
import com.mmc.pms.model.categories.vo.CategoriesInfoVO;
import com.mmc.pms.model.categories.vo.ClassifyInfoVO;
import com.mmc.pms.model.categories.vo.DirectoryInfoVO;
import com.mmc.pms.model.categories.vo.RelevantBusinessVO;
......@@ -35,207 +36,278 @@ import java.util.stream.Collectors;
*/
@Service
public class CategoriesServiceImpl implements CategoriesService {
@Autowired
private CategoriesDao categoriesDao;
@Resource
private GoodsInfoDao goodsInfoDao;
@Autowired
private DirectoryDao directoryDao;
@Override
public ResultBody addOrEditDirectory(DirectoryInfoVO param) {
int type = categoriesDao.countUpdateDirectoryName(param);
if (type > 0) {
return ResultBody.error(ResultEnum.DIRECTORY_NAME_HAS_BEEN_EXIST);
}
DirectoryDO directory = new DirectoryDO(param);
if (param.getId() == null) {
categoriesDao.insertDirectory(directory);
} else {
int count = categoriesDao.selectDirectoryById(param.getId());
if (count > 0) {
return ResultBody.error("默认目录不可修改!");
}
categoriesDao.updateDirectory(directory);
}
return ResultBody.success();
@Autowired private CategoriesDao categoriesDao;
@Resource private GoodsInfoDao goodsInfoDao;
@Autowired private DirectoryDao directoryDao;
@Override
public ResultBody addOrEditDirectory(DirectoryInfoVO param) {
int type = categoriesDao.countUpdateDirectoryName(param);
if (type > 0) {
return ResultBody.error(ResultEnum.DIRECTORY_NAME_HAS_BEEN_EXIST);
}
DirectoryDO directory = new DirectoryDO(param);
if (param.getId() == null) {
categoriesDao.insertDirectory(directory);
} else {
// 获取默认目录信息
DirectoryDO directoryDO = categoriesDao.selectDirectoryById(param.getId());
if (directoryDO != null && !directoryDO.getDirectoryName().equals(param.getDirectoryName())) {
return ResultBody.error(ResultEnum.DEFAULT_DIRECTORY);
}
categoriesDao.updateDirectory(directory);
}
return ResultBody.success();
}
@Override
public PageResult directoryList(Integer pageNo, Integer pageSize, Integer type) {
int count = categoriesDao.countDirectoryList();
if (count == 0) {
return PageResult.buildPage(pageNo, pageSize, count);
}
List<DirectoryDO> directoryList = categoriesDao.directoryList((pageNo - 1) * pageSize, pageSize, type);
List<DirectoryInfoVO> list = directoryList.stream().map(DirectoryDO::buildDirectoryInfoVO).collect(Collectors.toList());
return PageResult.buildPage(pageNo, pageSize, count, list);
@Override
public PageResult directoryList(Integer pageNo, Integer pageSize, Integer type) {
int count = categoriesDao.countDirectoryList();
if (count == 0) {
return PageResult.buildPage(pageNo, pageSize, count);
}
List<DirectoryDO> directoryList =
categoriesDao.directoryList((pageNo - 1) * pageSize, pageSize, type);
List<DirectoryInfoVO> list =
directoryList.stream().map(DirectoryDO::buildDirectoryInfoVO).collect(Collectors.toList());
return PageResult.buildPage(pageNo, pageSize, count, list);
}
@Override
public ResultBody removeDirectory(Integer id) {
// 查询该目录下是否有分类有的话就不给删除
int count = categoriesDao.countDirectory(id);
if (count > 0) {
return ResultBody.error(ResultEnum.THERE_ARE_CATEGORIES_IN_THE_DIRECTORY);
}
categoriesDao.removeDirectory(id);
return ResultBody.success();
@Override
public ResultBody removeDirectory(Integer id) {
// 查询该目录下是否有分类有的话就不给删除
int count = categoriesDao.countDirectory(id);
if (count > 0) {
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);
return ResultBody.success();
}
@Override
public ResultBody addClassification(ClassifyInfoVO classifyInfoVO) {
int count = categoriesDao.countClassificationByName(classifyInfoVO);
if (count > 0) {
return ResultBody.error(ResultEnum.WARE_TYPE_NAME_HAS_BEEN_EXIST);
}
Categories categories = new Categories(classifyInfoVO);
if (classifyInfoVO.getPid() == 0) {
if (classifyInfoVO.getIcon() != null) {
int typeCount = categoriesDao.getCountCategoriesByPid(0, classifyInfoVO.getType());
categories.setSort(typeCount + 1);
categoriesDao.insertClassification(categories);
} else {
return ResultBody.error(ResultEnum.WARE_TYPE_ICON_NOT_NULL);
}
} else {
categoriesDao.insertClassification(categories);
}
return ResultBody.success();
@Override
public ResultBody addClassification(ClassifyInfoVO classifyInfoVO) {
int count = categoriesDao.countClassificationByName(classifyInfoVO);
if (count > 0) {
return ResultBody.error(ResultEnum.WARE_TYPE_NAME_HAS_BEEN_EXIST);
}
Categories categories = new Categories(classifyInfoVO);
if (classifyInfoVO.getPid() == 0) {
if (classifyInfoVO.getIcon() != null) {
int typeCount = categoriesDao.getCountCategoriesByPid(0, classifyInfoVO.getType());
categories.setSort(typeCount + 1);
categoriesDao.insertClassification(categories);
} else {
return ResultBody.error(ResultEnum.WARE_TYPE_ICON_NOT_NULL);
}
} else {
categoriesDao.insertClassification(categories);
}
return ResultBody.success();
}
@Override
@Transactional(rollbackFor = Exception.class)
public ResultBody updateClassification(ClassifyInfoVO classifyInfoVO) {
int count = categoriesDao.countClassificationByName(classifyInfoVO);
if (count > 0) {
return ResultBody.error(ResultEnum.WARE_TYPE_NAME_HAS_BEEN_EXIST);
}
if (classifyInfoVO.getPid() == 0) {
if (classifyInfoVO.getIcon() != null) {
categoriesDao.updateClassification(classifyInfoVO);
} else {
return ResultBody.error(ResultEnum.WARE_TYPE_ICON_NOT_NULL);
}
} else {
categoriesDao.updateClassification(classifyInfoVO);
}
return ResultBody.success();
}
@Override
@Transactional(rollbackFor = Exception.class)
public ResultBody exchangeSortType(Integer firstId, Integer secondId) {
Categories firstCategories = categoriesDao.getGoodsGroupById(firstId);
Categories secondCategories = categoriesDao.getGoodsGroupById(secondId);
int updateCount1 = categoriesDao.updateTypeSort(firstId, secondCategories.getSort());
int updateCount2 = categoriesDao.updateTypeSort(secondId, firstCategories.getSort());
if (updateCount1 == updateCount2) {
return ResultBody.success();
} else {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return ResultBody.error("排序失败");
}
@Override
@Transactional(rollbackFor = Exception.class)
public ResultBody updateClassification(ClassifyInfoVO classifyInfoVO) {
int count = categoriesDao.countClassificationByName(classifyInfoVO);
if (count > 0) {
return ResultBody.error(ResultEnum.WARE_TYPE_NAME_HAS_BEEN_EXIST);
}
if (classifyInfoVO.getPid() == 0) {
if (classifyInfoVO.getIcon() != null) {
categoriesDao.updateClassification(classifyInfoVO);
} else {
return ResultBody.error(ResultEnum.WARE_TYPE_ICON_NOT_NULL);
}
} else {
categoriesDao.updateClassification(classifyInfoVO);
}
return ResultBody.success();
}
@Override
public PageResult getClassificationList(QueryClassifyVO queryClassifyVO) {
int count = categoriesDao.countListClassification(queryClassifyVO);
if (count == 0) {
return PageResult.buildPage(queryClassifyVO.getPageNo(), queryClassifyVO.getPageSize(), count);
}
@Override
@Transactional(rollbackFor = Exception.class)
public ResultBody exchangeSortType(Integer firstId, Integer secondId) {
Categories firstCategories = categoriesDao.getGoodsGroupById(firstId);
Categories secondCategories = categoriesDao.getGoodsGroupById(secondId);
int updateCount1 = categoriesDao.updateTypeSort(firstId, secondCategories.getSort());
int updateCount2 = categoriesDao.updateTypeSort(secondId, firstCategories.getSort());
if (updateCount1 == updateCount2) {
return ResultBody.success();
} else {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return ResultBody.error("排序失败");
}
}
@Override
public PageResult getClassificationList(QueryClassifyVO queryClassifyVO) {
int count = categoriesDao.countListClassification(queryClassifyVO);
if (count == 0) {
return PageResult.buildPage(
queryClassifyVO.getPageNo(), queryClassifyVO.getPageSize(), count);
}
int pageNo = queryClassifyVO.getPageNo();
queryClassifyVO.buildCurrentPage();
List<Categories> categories = categoriesDao.selectAllClassification(queryClassifyVO);
List<ClassifyInfoDTO> categoriesList = categories.stream().map(Categories::buildClassifyInfoDTO).collect(Collectors.toList());
int pageNo = queryClassifyVO.getPageNo();
queryClassifyVO.buildCurrentPage();
List<Categories> categories = categoriesDao.selectAllClassification(queryClassifyVO);
List<ClassifyInfoDTO> categoriesList =
categories.stream().map(Categories::buildClassifyInfoDTO).collect(Collectors.toList());
List<ClassifyInfoDTO> topLevelCategories = new ArrayList<>();
Map<Integer, ClassifyInfoDTO> categoriesMap = new HashMap<>();
List<ClassifyInfoDTO> topLevelCategories = new ArrayList<>();
Map<Integer, ClassifyInfoDTO> categoriesMap = new HashMap<>();
// 将每个数据模型对象添加到Map中,以便在递归过程中查找它们的父母
for (ClassifyInfoDTO category : categoriesList) {
category.setChildren(new ArrayList<>());
categoriesMap.put(category.getId(), category);
}
// 构建树结构
for (ClassifyInfoDTO category : categoriesList) {
if (category.getPid() == 0) {
topLevelCategories.add(category);
} else {
ClassifyInfoDTO parent = categoriesMap.get(category.getPid());
parent.getChildren().add(category);
}
}
return PageResult.buildPage(pageNo, queryClassifyVO.getPageSize(), count, topLevelCategories);
}
@Override
public ResultBody getClassifyDetails(Integer id) {
Categories goodsGroup = categoriesDao.getGoodsGroupById(id);
return ResultBody.success(goodsGroup == null ? null : goodsGroup.buildClassifyDetailsDTO()
);
}
@Override
public ResultBody queryRelevantBusiness(Integer id, Integer type) {
RelevantBusinessVO relevantBusinessVO = new RelevantBusinessVO();
switch (type) {
case 0:
List<GoodsInfo> goodsInfo = goodsInfoDao.ListGoodsInfoByCategoryId(id);
if (CollectionUtils.isNotEmpty(goodsInfo)) {
relevantBusinessVO.setRelevanceGoodsInfoVOs(goodsInfo.stream().map(GoodsInfo::buildRelevanceGoodsInfoVO).collect(Collectors.toList()));
return ResultBody.success(relevantBusinessVO);
}
break;
default:
return ResultBody.error("输入类型有误!");
}
return ResultBody.success();
// 将每个数据模型对象添加到Map中,以便在递归过程中查找它们的父母
for (ClassifyInfoDTO category : categoriesList) {
category.setChildren(new ArrayList<>());
categoriesMap.put(category.getId(), category);
}
@Override
public ResultBody getDirectoryList(Integer type) {
List<DirectoryDO> directoryList = categoriesDao.getDirectoryList(type);
List<DirectoryInfoVO> list = directoryList.stream().map(DirectoryDO::buildDirectoryInfoVO).collect(Collectors.toList());
return ResultBody.success(list);
// 构建树结构
for (ClassifyInfoDTO category : categoriesList) {
if (category.getPid() == 0) {
topLevelCategories.add(category);
} else {
ClassifyInfoDTO parent = categoriesMap.get(category.getPid());
parent.getChildren().add(category);
}
}
return PageResult.buildPage(pageNo, queryClassifyVO.getPageSize(), count, topLevelCategories);
}
@Override
public List<Categories> getCategoriesListByDirectoryName(String directoryName) {
DirectoryDO directoryDO = directoryDao.getDirectoryByName(directoryName);
List<Categories> categories = categoriesDao.getCategoriesByDirectoryId(directoryDO.getId());
return categories;
}
@Override
public ResultBody getClassifyDetails(Integer id) {
Categories goodsGroup = categoriesDao.getGoodsGroupById(id);
return ResultBody.success(goodsGroup == null ? null : goodsGroup.buildClassifyDetailsDTO());
}
@Override
public ResultBody getApplicationList(String directoryName) {
List<Categories> categories = getCategoriesListByDirectoryName(directoryName);
if(org.springframework.util.CollectionUtils.isEmpty(categories)){
return ResultBody.success();
@Override
public ResultBody queryRelevantBusiness(Integer id, Integer type) {
RelevantBusinessVO relevantBusinessVO = new RelevantBusinessVO();
switch (type) {
case 0:
List<GoodsInfo> goodsInfo = goodsInfoDao.ListGoodsInfoByCategoryId(id);
if (CollectionUtils.isNotEmpty(goodsInfo)) {
relevantBusinessVO.setRelevanceGoodsInfoVOs(
goodsInfo.stream()
.map(GoodsInfo::buildRelevanceGoodsInfoVO)
.collect(Collectors.toList()));
return ResultBody.success(relevantBusinessVO);
}
List<CategoriesDTO> collect = categories.stream().map(CategoriesDTO::new).collect(Collectors.toList());
return ResultBody.success(collect);
break;
default:
return ResultBody.error("输入类型有误!");
}
return ResultBody.success();
}
@Override
public List<Categories> getCategoriesListByIds(Set<Integer> ids) {
if(CollectionUtils.isEmpty(ids)){
return null;
}
return categoriesDao.getCategoriesListByIds(ids);
}
@Override
public ResultBody getDirectoryList(Integer type) {
List<DirectoryDO> directoryList = categoriesDao.getDirectoryList(type);
List<DirectoryInfoVO> list =
directoryList.stream().map(DirectoryDO::buildDirectoryInfoVO).collect(Collectors.toList());
return ResultBody.success(list);
}
@Override
public List<Categories> getCategoriesListByDirectoryName(String directoryName) {
DirectoryDO directoryDO = directoryDao.getDirectoryByName(directoryName);
List<Categories> categories = categoriesDao.getCategoriesByDirectoryId(directoryDO.getId());
return categories;
}
@Override
public ResultBody deleteRelevantBusiness(Integer id) {
int count = categoriesDao.deleteById(id);
return ResultBody.success();
@Override
public ResultBody getApplicationList(String directoryName) {
List<Categories> categories = getCategoriesListByDirectoryName(directoryName);
if (org.springframework.util.CollectionUtils.isEmpty(categories)) {
return ResultBody.success();
}
List<CategoriesDTO> collect =
categories.stream().map(CategoriesDTO::new).collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public List<Categories> getCategoriesListByIds(Set<Integer> ids) {
if (CollectionUtils.isEmpty(ids)) {
return null;
}
return categoriesDao.getCategoriesListByIds(ids);
}
}
@Override
public List<AllCategoryDTO> feigQqueryCategoryInfoByType(Integer type) {
List<DirectoryDO> categoryDirectoryList = getCategoryDirectoryList(type);
if (CollectionUtils.isNotEmpty(categoryDirectoryList)) {
List<AllCategoryDTO> allCategoryDTOList =
categoryDirectoryList.stream()
.map(DirectoryDO::buildAllCategoryDTO)
.collect(Collectors.toList());
Map<Integer, List<CategoriesInfoListDTO>> categoryMap = getCategoryMap(allCategoryDTOList);
addSubCategories(allCategoryDTOList, categoryMap);
System.out.println("Res: " + JSONObject.toJSON(allCategoryDTOList));
return allCategoryDTOList;
}
return null;
}
@Override
public ResultBody deleteRelevantBusiness(Integer id) {
int count = goodsInfoDao.countGoodsInfoByCategoryId(id);
if (count > 0) {
return ResultBody.error(ResultEnum.GROUP_DONT_DELETE);
}
// 获取分类信息
Categories categories = categoriesDao.getGoodsGroupById(id);
if (categories != null && categories.getParentId().equals(0)) {
int childCount = categoriesDao.countChildById(id);
if (childCount > 0) {
return ResultBody.error(ResultEnum.GROUP_DONT_DELETE_BY_CHILD);
}
}
categoriesDao.deleteById(id);
return ResultBody.success();
}
@Override
public ResultBody queryCategoryInfoByType(Integer type) {
List<DirectoryDO> categoryDirectoryList = getCategoryDirectoryList(type);
if (CollectionUtils.isNotEmpty(categoryDirectoryList)) {
List<AllCategoryDTO> allCategoryDTOList =
categoryDirectoryList.stream()
.map(DirectoryDO::buildAllCategoryDTO)
.collect(Collectors.toList());
Map<Integer, List<CategoriesInfoListDTO>> categoryMap = getCategoryMap(allCategoryDTOList);
addSubCategories(allCategoryDTOList, categoryMap);
return ResultBody.success(allCategoryDTOList);
}
return ResultBody.success();
}
private List<DirectoryDO> getCategoryDirectoryList(Integer type) {
return categoriesDao.getDirectoryList(type);
}
private Map<Integer, List<CategoriesInfoListDTO>> getCategoryMap(
List<AllCategoryDTO> allCategoryDTOList) {
List<Integer> directoryIdIds =
allCategoryDTOList.stream()
.map(AllCategoryDTO::getDirectoryId)
.collect(Collectors.toList());
List<Categories> categoriesList = categoriesDao.selectCategoryByDirectoryId(directoryIdIds);
return categoriesList.stream()
.map(Categories::buildCategoriesInfoListDTO)
.collect(Collectors.groupingBy(CategoriesInfoListDTO::getDirectoryId));
}
private void addSubCategories(
List<AllCategoryDTO> allCategoryDTOList,
Map<Integer, List<CategoriesInfoListDTO>> categoryMap) {
for (AllCategoryDTO allCategoryDTO : allCategoryDTOList) {
Optional.ofNullable(categoryMap.get(allCategoryDTO.getDirectoryId()))
.ifPresent(allCategoryDTO::setCategoriesInfoListDTO);
}
}
}
......@@ -12,7 +12,9 @@ import com.mmc.pms.model.order.dto.OrderGoodsProdDetailDTO;
import com.mmc.pms.model.qo.MallOrderGoodsInfoQO;
import com.mmc.pms.model.qo.ProductSpecPriceQO;
import com.mmc.pms.model.sale.dto.*;
import com.mmc.pms.model.sale.qo.MallGoodsQO;
import com.mmc.pms.model.sale.vo.*;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.GoodsInfoService;
import com.mmc.pms.util.CodeUtil;
import com.mmc.pms.util.TDateUtil;
......@@ -32,821 +34,1112 @@ import java.util.stream.Collectors;
@Service
public class GoodsInfoServiceImpl implements GoodsInfoService {
@Resource
private GoodsInfoDao goodsInfoDao;
@Resource private GoodsInfoDao goodsInfoDao;
@Resource
private ProductDao productDao;
@Resource private ProductDao productDao;
@Resource
private ProductServiceImpl productSkuService;
@Resource private ProductServiceImpl productSkuService;
@Resource
private IndustrySpecDao industrySpecDao;
@Resource private IndustrySpecDao industrySpecDao;
@Override
@Transactional(rollbackFor = Exception.class)
public ResultBody addGoods(GoodsAddVO goodsAddVO) {
// 判断商品名称是否存在
if (goodsInfoDao.countGoodsInfoByName(goodsAddVO) > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
// 判断商品详情中描述是否为空
if (goodsAddVO.getGoodsDetailVO().getGoodsDesc() == null) {
return ResultBody.error(ResultEnum.GOODS_DESC_IS_NOT_NULL);
}
String YYYY_MM_DD_HH_MM_SS = "yyyyMMddHHmmss";
// 初始化商品对象,并构建对象
GoodsInfo goodsInfo = new GoodsInfo(goodsAddVO);
goodsInfo.setGoodsNo("IUAV" + TDateUtil.getDateStr(new Date(), YYYY_MM_DD_HH_MM_SS) + CodeUtil.getRandomNum(4));
// 暂未接入用户默认传1
goodsInfo.setAddGoodsUserId(1);
goodsInfo.setSort(goodsInfoDao.countGoodsInfo() + 1);
// 插入商品基本信息
goodsInfoDao.insertGoodsInfo(goodsInfo);
// 调用图片视频插入信息方法
addGoodsImageInfo(goodsInfo.getId(), goodsAddVO);
// 调用商品详情信息方法
addGoodsDetail(goodsInfo.getId(), goodsAddVO.getGoodsDetailVO());
// 判断其他服务是否为空,不为空则插入
if (!CollectionUtils.isEmpty(goodsAddVO.getOtherService())) {
addOtherService(goodsAddVO.getOtherService(), goodsInfo.getId());
}
// 调用产品规格的新增方法
if (!goodsAddVO.getDirectoryId().equals(2)) {
// 添加产品规格信息
productSkuSpecOperation(goodsInfo, goodsAddVO.getProductSpec());
} else {
industrySkuSpecOperation(goodsInfo, goodsAddVO.getProductSpec());
}
return ResultBody.success();
}
/**
* 插入行业sku及规格信息
*/
@Transactional(rollbackFor = Exception.class)
public void industrySkuSpecOperation(GoodsInfo goodsInfo, List<GoodsProdSpecVO> productSpec) {
for (GoodsProdSpecVO goodsSpecVO : productSpec) {
MallIndustrySkuInfoDO mallIndustrySkuInfoDO = new MallIndustrySkuInfoDO(goodsSpecVO).setGoodsInfoId(goodsInfo.getId());
// 插入数据库商品对应的sku信息
goodsInfoDao.insertMallIndustrySkuInfo(mallIndustrySkuInfoDO);
for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) {
// 构建商品对应的规格信息
MallIndustrySkuInfoSpecDO mallIndustrySkuInfoSpecDO = new MallIndustrySkuInfoSpecDO()
.setIndustrySpecId(mallProductSpecVO.getMallSpecId())
.setMallIndustrySkuInfoId(mallIndustrySkuInfoDO.getId())
.setGoodsInfoId(goodsInfo.getId());
// 插入数据库商品对应的规格信息
goodsInfoDao.insertMallIndustrySkuInfoSpec(mallIndustrySkuInfoSpecDO);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public ResultBody addGoods(GoodsAddVO goodsAddVO) {
// 判断商品名称是否存在
if (goodsInfoDao.countGoodsInfoByName(goodsAddVO) > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
// 判断商品详情中描述是否为空
if (goodsAddVO.getGoodsDetailVO().getGoodsDesc() == null) {
return ResultBody.error(ResultEnum.GOODS_DESC_IS_NOT_NULL);
}
String YYYY_MM_DD_HH_MM_SS = "yyyyMMddHHmmss";
// 初始化商品对象,并构建对象
GoodsInfo goodsInfo = new GoodsInfo(goodsAddVO);
goodsInfo.setGoodsNo(
"IUAV" + TDateUtil.getDateStr(new Date(), YYYY_MM_DD_HH_MM_SS) + CodeUtil.getRandomNum(4));
// 暂未接入用户默认传1
goodsInfo.setAddGoodsUserId(1);
goodsInfo.setSort(goodsInfoDao.countGoodsInfo() + 1);
// 插入商品基本信息
goodsInfoDao.insertGoodsInfo(goodsInfo);
// 调用图片视频插入信息方法
addGoodsImageInfo(goodsInfo.getId(), goodsAddVO);
// 调用商品详情信息方法
addGoodsDetail(goodsInfo.getId(), goodsAddVO.getGoodsDetailVO());
// 判断其他服务是否为空,不为空则插入
if (!CollectionUtils.isEmpty(goodsAddVO.getOtherService())) {
addOtherService(goodsAddVO.getOtherService(), goodsInfo.getId());
}
// 调用产品规格的新增方法
if (!goodsAddVO.getDirectoryId().equals(2)) {
// 添加产品规格信息
productSkuSpecOperation(goodsInfo, goodsAddVO.getProductSpec());
} else {
industrySkuSpecOperation(goodsInfo, goodsAddVO.getProductSpec());
}
return ResultBody.success();
}
@Transactional(rollbackFor = Exception.class)
public void productSkuSpecOperation(GoodsInfo goodsInfo, List<GoodsProdSpecVO> productSpec) {
// 遍历规格信息,获取其中自定义的规格信息
List<GoodsProdSpecVO> customGoodsSpecList = productSpec.stream().filter(spec -> spec.getFlag().equals(1)).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(customGoodsSpecList)) {
addCustomization(goodsInfo, customGoodsSpecList);
}
// 遍历规格信息,获取其中非自定义的规格信息
List<GoodsProdSpecVO> goodsSpecList = productSpec.stream().filter(spec -> spec.getFlag().equals(0)).collect(Collectors.toList());
for (GoodsProdSpecVO goodsSpecVO : goodsSpecList) {
MallProdInfoDO mallProdSkuInfoDO = new MallProdInfoDO(goodsSpecVO)
.setProdSkuId(goodsSpecVO.getSkuId()).setGoodsInfoId(goodsInfo.getId());
// 插入数据库商品对应的sku信息
goodsInfoDao.insertMallProdSkuInfo(mallProdSkuInfoDO);
for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) {
// 构建商品对应的规格信息
MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO = new MallProdSkuInfoSpecDO()
.setProductSpecId(mallProductSpecVO.getMallSpecId())
.setMallProdSkuInfoId(mallProdSkuInfoDO.getId())
.setGoodsInfoId(goodsInfo.getId());
// 插入数据库商品对应的规格信息
goodsInfoDao.insertMallProdSkuInfoSpec(mallProdSkuInfoSpecDO);
}
}
/** 插入行业sku及规格信息 */
@Transactional(rollbackFor = Exception.class)
public void industrySkuSpecOperation(GoodsInfo goodsInfo, List<GoodsProdSpecVO> productSpec) {
for (GoodsProdSpecVO goodsSpecVO : productSpec) {
MallIndustrySkuInfoDO mallIndustrySkuInfoDO =
new MallIndustrySkuInfoDO(goodsSpecVO).setGoodsInfoId(goodsInfo.getId());
// 插入数据库商品对应的sku信息
goodsInfoDao.insertMallIndustrySkuInfo(mallIndustrySkuInfoDO);
for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) {
// 构建商品对应的规格信息
MallIndustrySkuInfoSpecDO mallIndustrySkuInfoSpecDO =
new MallIndustrySkuInfoSpecDO()
.setIndustrySpecId(mallProductSpecVO.getMallSpecId())
.setMallIndustrySkuInfoId(mallIndustrySkuInfoDO.getId())
.setGoodsInfoId(goodsInfo.getId());
// 插入数据库商品对应的规格信息
goodsInfoDao.insertMallIndustrySkuInfoSpec(mallIndustrySkuInfoSpecDO);
}
}
}
@Transactional(rollbackFor = Exception.class)
public void productSkuSpecOperation(GoodsInfo goodsInfo, List<GoodsProdSpecVO> productSpec) {
// 遍历规格信息,获取其中自定义的规格信息
List<GoodsProdSpecVO> customGoodsSpecList =
productSpec.stream().filter(spec -> spec.getFlag().equals(1)).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(customGoodsSpecList)) {
addCustomization(goodsInfo, customGoodsSpecList);
}
// 遍历规格信息,获取其中非自定义的规格信息
List<GoodsProdSpecVO> goodsSpecList =
productSpec.stream().filter(spec -> spec.getFlag().equals(0)).collect(Collectors.toList());
for (GoodsProdSpecVO goodsSpecVO : goodsSpecList) {
MallProdInfoDO mallProdSkuInfoDO =
new MallProdInfoDO(goodsSpecVO)
.setProdSkuId(goodsSpecVO.getSkuId())
.setGoodsInfoId(goodsInfo.getId());
// 插入数据库商品对应的sku信息
goodsInfoDao.insertMallProdSkuInfo(mallProdSkuInfoDO);
for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) {
// 构建商品对应的规格信息
MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO =
new MallProdSkuInfoSpecDO()
.setProductSpecId(mallProductSpecVO.getMallSpecId())
.setMallProdSkuInfoId(mallProdSkuInfoDO.getId())
.setGoodsInfoId(goodsInfo.getId());
// 插入数据库商品对应的规格信息
goodsInfoDao.insertMallProdSkuInfoSpec(mallProdSkuInfoSpecDO);
}
}
}
@Transactional(rollbackFor = Exception.class)
public MallProdInfoDO buildMallProdSkuInfo(GoodsInfo goodsInfo, GoodsProdSpecVO goodsSpec, Integer id) {
MallProdInfoDO mallProdInfoDO = new MallProdInfoDO();
mallProdInfoDO.setGoodsInfoId(goodsInfo.getId());
mallProdInfoDO.setProdSkuId(id);
mallProdInfoDO.setProdSkuSpecName(goodsSpec.getGoodsSpecName());
mallProdInfoDO.setCategoriesId(goodsSpec.getCategoryId());
mallProdInfoDO.setChooseType(goodsSpec.getChooseType());
mallProdInfoDO.setMust(goodsSpec.getMust());
mallProdInfoDO.setFlag(goodsSpec.getFlag());
mallProdInfoDO.setSkuUnitId(goodsSpec.getSkuUnitId());
return mallProdInfoDO;
}
@Transactional(rollbackFor = Exception.class)
public void addCustomization(GoodsInfo goodsInfo, List<GoodsProdSpecVO> customGoodsSpecList) {
// 遍历自定义规格信息
for (GoodsProdSpecVO productSpec : customGoodsSpecList) {
// 构建商品对应的sku信息
ProductSkuDO productSkuDO = new ProductSkuDO().setCategoriesId(productSpec.getCategoryId())
.setProductName(productSpec.getProductName()).setCustomize(1)
.setDirectoryId(goodsInfo.getDirectoryId());
// 插入产品sku信息
productDao.insertProductSku(productSkuDO);
MallProdInfoDO mallProdInfoDO = buildMallProdSkuInfo(goodsInfo, productSpec, productSkuDO.getId());
// 插入数据库商品对应的sku信息
productDao.insertMallProdSkuInfo(mallProdInfoDO);
// 先将自定的信息存储到数据库中
productSpec.getCustomizeInfo().stream().peek(param -> {
ProductSpecDO productSpecDO = new ProductSpecDO().setProductSkuId(productSkuDO.getId())
.setVersionDesc("自定义").setSpecImage(param.getSpecImage())
.setSpecName(param.getSpecName()).setPartNo(param.getPartNo());
@Transactional(rollbackFor = Exception.class)
public MallProdInfoDO buildMallProdSkuInfo(
GoodsInfo goodsInfo, GoodsProdSpecVO goodsSpec, Integer id) {
MallProdInfoDO mallProdInfoDO = new MallProdInfoDO();
mallProdInfoDO.setGoodsInfoId(goodsInfo.getId());
mallProdInfoDO.setProdSkuId(id);
mallProdInfoDO.setProdSkuSpecName(goodsSpec.getGoodsSpecName());
mallProdInfoDO.setCategoriesId(goodsSpec.getCategoryId());
mallProdInfoDO.setChooseType(goodsSpec.getChooseType());
mallProdInfoDO.setMust(goodsSpec.getMust());
mallProdInfoDO.setFlag(goodsSpec.getFlag());
mallProdInfoDO.setSkuUnitId(goodsSpec.getSkuUnitId());
return mallProdInfoDO;
}
@Transactional(rollbackFor = Exception.class)
public void addCustomization(GoodsInfo goodsInfo, List<GoodsProdSpecVO> customGoodsSpecList) {
// 遍历自定义规格信息
for (GoodsProdSpecVO productSpec : customGoodsSpecList) {
// 构建商品对应的sku信息
ProductSkuDO productSkuDO =
new ProductSkuDO()
.setCategoriesId(productSpec.getCategoryId())
.setProductName(productSpec.getProductName())
.setCustomize(1)
.setDirectoryId(goodsInfo.getDirectoryId());
// 插入产品sku信息
productDao.insertProductSku(productSkuDO);
MallProdInfoDO mallProdInfoDO =
buildMallProdSkuInfo(goodsInfo, productSpec, productSkuDO.getId());
// 插入数据库商品对应的sku信息
productDao.insertMallProdSkuInfo(mallProdInfoDO);
// 先将自定的信息存储到数据库中
productSpec.getCustomizeInfo().stream()
.peek(
param -> {
ProductSpecDO productSpecDO =
new ProductSpecDO()
.setProductSkuId(productSkuDO.getId())
.setVersionDesc("自定义")
.setSpecImage(param.getSpecImage())
.setSpecName(param.getSpecName())
.setPartNo(param.getPartNo());
// 新增产品sku
productDao.insertProductSpec(productSpecDO);
// 批量配置价格信息
ProductSpecCPQVO productSpecCPQVO = param.getProductSpecCPQVO();
if (productSpecCPQVO != null) {
productSpecCPQVO.setProductSpecId(productSpecDO.getId());
productSkuService.insertSpecPrice(productSpecCPQVO);
productSpecCPQVO.setProductSpecId(productSpecDO.getId());
productSkuService.insertSpecPrice(productSpecCPQVO);
}
// 构建商品对应的规格信息
MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO = new MallProdSkuInfoSpecDO()
MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO =
new MallProdSkuInfoSpecDO()
.setProductSpecId(productSpecDO.getId())
.setMallProdSkuInfoId(mallProdInfoDO.getId())
.setGoodsInfoId(goodsInfo.getId());
// 插入数据库商品对应的规格信息
goodsInfoDao.insertMallProdSkuInfoSpec(mallProdSkuInfoSpecDO);
}).collect(Collectors.toList());
}
})
.collect(Collectors.toList());
}
}
@Transactional(rollbackFor = Exception.class)
public void addOtherService(List<Integer> otherService, Integer goodsId) {
// 插入其他服务
List<GoodsServiceDO> otherList = otherService.stream().map(d -> {
GoodsServiceDO goodsServiceDO = new GoodsServiceDO();
goodsServiceDO.setGoodsInfoId(goodsId);
goodsServiceDO.setSaleServiceId(d);
return goodsServiceDO;
}).collect(Collectors.toList());
goodsInfoDao.insertGoodsService(otherList);
}
@Transactional(rollbackFor = Exception.class)
public void addGoodsDetail(Integer goodsId, GoodsDetailVO goodsDetailVO) {
GoodsDetailDO goodsDetailDO = new GoodsDetailDO(goodsDetailVO);
goodsDetailDO.setGoodsInfoId(goodsId);
goodsInfoDao.insertGoodsDetail(goodsDetailDO);
}
@Transactional(rollbackFor = Exception.class)
public void addGoodsImageInfo(Integer goodsId, GoodsAddVO goodsAddVO) {
List<GoodsImgDO> list = goodsAddVO.getImages().stream().map(d -> {
GoodsImgDO goodsImgDO = new GoodsImgDO(d);
goodsImgDO.setGoodsInfoId(goodsId);
return goodsImgDO;
}).collect(Collectors.toList());
// 插入图片信息
goodsInfoDao.insertGoodsImgInfo(list);
// 插入商品视频信息
if (goodsAddVO.getGoodsVideo() != null) {
GoodsVideoDO goodsVideoDO = new GoodsVideoDO().setGoodsInfoId(goodsId).setVideoUrl(goodsAddVO.getGoodsVideo());
goodsInfoDao.insertVideoInfo(goodsVideoDO);
}
@Transactional(rollbackFor = Exception.class)
public void addOtherService(List<Integer> otherService, Integer goodsId) {
// 插入其他服务
List<GoodsServiceDO> otherList =
otherService.stream()
.map(
d -> {
GoodsServiceDO goodsServiceDO = new GoodsServiceDO();
goodsServiceDO.setGoodsInfoId(goodsId);
goodsServiceDO.setSaleServiceId(d);
return goodsServiceDO;
})
.collect(Collectors.toList());
goodsInfoDao.insertGoodsService(otherList);
}
@Transactional(rollbackFor = Exception.class)
public void addGoodsDetail(Integer goodsId, GoodsDetailVO goodsDetailVO) {
GoodsDetailDO goodsDetailDO = new GoodsDetailDO(goodsDetailVO);
goodsDetailDO.setGoodsInfoId(goodsId);
goodsInfoDao.insertGoodsDetail(goodsDetailDO);
}
@Transactional(rollbackFor = Exception.class)
public void addGoodsImageInfo(Integer goodsId, GoodsAddVO goodsAddVO) {
List<GoodsImgDO> list =
goodsAddVO.getImages().stream()
.map(
d -> {
GoodsImgDO goodsImgDO = new GoodsImgDO(d);
goodsImgDO.setGoodsInfoId(goodsId);
return goodsImgDO;
})
.collect(Collectors.toList());
// 插入图片信息
goodsInfoDao.insertGoodsImgInfo(list);
// 插入商品视频信息
if (goodsAddVO.getGoodsVideo() != null) {
GoodsVideoDO goodsVideoDO =
new GoodsVideoDO().setGoodsInfoId(goodsId).setVideoUrl(goodsAddVO.getGoodsVideo());
goodsInfoDao.insertVideoInfo(goodsVideoDO);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public ResultBody editGoodsInfo(GoodsAddVO goodsAddVO) {
// 判断商品是否还存在
int count = goodsInfoDao.countGoodsInfoById(goodsAddVO.getId());
if (count <= 0) {
return ResultBody.error(ResultEnum.GOODS_NOT_EXIST_OR_ALREADY_DOWN_SHELF);
}
// 判断商品名称是否存在
if (goodsInfoDao.countGoodsInfoByName(goodsAddVO) > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
// 判断商品详情中描述是否为空
if (goodsAddVO.getGoodsDetailVO().getGoodsDesc() == null) {
return ResultBody.error(ResultEnum.GOODS_DESC_IS_NOT_NULL);
}
// 初始化商品对象,并构建对象
GoodsInfo goodsInfo = new GoodsInfo(goodsAddVO);
// 插入商品基本信息
goodsInfoDao.updateGoodsInfo(goodsInfo);
// 修改商品详情信息
updateGoodsDetail(goodsAddVO);
// 修改商品图片及视频信息
updateImageInfo(goodsAddVO);
// 修改其他服务信息
updateOtherService(goodsAddVO);
// 修改规格信息
if (!goodsAddVO.getDirectoryId().equals(2)) {
updateMallProductSkuSpec(goodsAddVO);
} else {
updateMallIndustrySkuSpec(goodsAddVO);
}
return null;
}
@Transactional(rollbackFor = Exception.class)
public void updateMallIndustrySkuSpec(GoodsAddVO goodsAddVO) {
// 先获取用户输入的商品绑定sku的id集合
Set<Integer> inputMallSkuIds = goodsAddVO.getProductSpec().stream().map(GoodsProdSpecVO::getId).filter(Objects::nonNull).collect(Collectors.toSet());
// 从数据库获取该商品对应绑定的skuId的集合
List<MallIndustrySkuInfoDO> mallIndusSkuInfoList = goodsInfoDao.getMallIndustrySkuInfo(goodsAddVO.getId());
List<Integer> dbMallSkuIds = mallIndusSkuInfoList.stream().map(MallIndustrySkuInfoDO::getId).collect(Collectors.toList());
// 对比数据库id如果不在就删除
List<Integer> delIds = dbMallSkuIds.stream().filter(id -> !inputMallSkuIds.contains(id)).collect(Collectors.toList());
if (delIds.size() != 0) {
// 先删除商品绑定sku下的spec信息
industrySpecDao.batchUpdateMallIndustrySpec(delIds, goodsAddVO.getId());
industrySpecDao.batchUpdateMallIndustrySku(delIds);
@Override
@Transactional(rollbackFor = Exception.class)
public ResultBody editGoodsInfo(GoodsAddVO goodsAddVO) {
// 判断商品是否还存在
int count = goodsInfoDao.countGoodsInfoById(goodsAddVO.getId());
if (count <= 0) {
return ResultBody.error(ResultEnum.GOODS_NOT_EXIST_OR_ALREADY_DOWN_SHELF);
}
// 判断商品名称是否存在
if (goodsInfoDao.countGoodsInfoByName(goodsAddVO) > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
// 判断商品详情中描述是否为空
if (goodsAddVO.getGoodsDetailVO().getGoodsDesc() == null) {
return ResultBody.error(ResultEnum.GOODS_DESC_IS_NOT_NULL);
}
// 初始化商品对象,并构建对象
GoodsInfo goodsInfo = new GoodsInfo(goodsAddVO);
// 插入商品基本信息
goodsInfoDao.updateGoodsInfo(goodsInfo);
// 修改商品详情信息
updateGoodsDetail(goodsAddVO);
// 修改商品图片及视频信息
updateImageInfo(goodsAddVO);
// 修改其他服务信息
updateOtherService(goodsAddVO);
// 修改规格信息
if (!goodsAddVO.getDirectoryId().equals(2)) {
updateMallProductSkuSpec(goodsAddVO);
} else {
updateMallIndustrySkuSpec(goodsAddVO);
}
return ResultBody.success();
}
@Transactional(rollbackFor = Exception.class)
public void updateMallIndustrySkuSpec(GoodsAddVO goodsAddVO) {
// 先获取用户输入的商品绑定sku的id集合
Set<Integer> inputMallSkuIds =
goodsAddVO.getProductSpec().stream()
.map(GoodsProdSpecVO::getId)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
// 从数据库获取该商品对应绑定的skuId的集合
List<MallIndustrySkuInfoDO> mallIndusSkuInfoList =
goodsInfoDao.getMallIndustrySkuInfo(goodsAddVO.getId());
List<Integer> dbMallSkuIds =
mallIndusSkuInfoList.stream()
.map(MallIndustrySkuInfoDO::getId)
.collect(Collectors.toList());
// 对比数据库id如果不在就删除
List<Integer> delIds =
dbMallSkuIds.stream()
.filter(id -> !inputMallSkuIds.contains(id))
.collect(Collectors.toList());
if (delIds.size() != 0) {
// 先删除商品绑定sku下的spec信息
industrySpecDao.batchUpdateMallIndustrySpec(delIds, goodsAddVO.getId());
industrySpecDao.batchUpdateMallIndustrySku(delIds);
}
// 修改商品绑定的sku信息
List<GoodsProdSpecVO> updateGoodsSpec =
goodsAddVO.getProductSpec().stream().filter(Objects::nonNull).collect(Collectors.toList());
List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList =
updateGoodsSpec.stream()
.map(
d -> {
MallIndustrySkuInfoDO mallIndustrySkuInfoDO = new MallIndustrySkuInfoDO();
mallIndustrySkuInfoDO
.setId(d.getId())
.setIndustrySkuId(d.getSkuId())
.setCategoriesId(d.getCategoryId())
.setIndustrySkuSpecName(d.getGoodsSpecName())
.setChooseType(d.getChooseType())
.setSkuUnitId(d.getSkuUnitId())
.setMust(d.getMust());
return mallIndustrySkuInfoDO;
})
.collect(Collectors.toList());
// 批量修改sku的信息
industrySpecDao.batchUpdateMallIndustrySkuInfo(mallIndustrySkuInfoList);
// 获取新的sku信息
List<GoodsProdSpecVO> list =
goodsAddVO.getProductSpec().stream()
.filter(d -> d.getId() == null)
.collect(Collectors.toList());
industrySkuSpecOperation(new GoodsInfo(goodsAddVO.getId()), list);
// 获取商品对应的skuId
List<Integer> mallSkuIds =
goodsAddVO.getProductSpec().stream()
.map(GoodsProdSpecVO::getId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
// 根据这些id查出下面对应的规格信息
List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpecList =
industrySpecDao.listMallIndustrySpecInfo(mallSkuIds);
// 分组
Map<Integer, List<MallIndustrySkuInfoSpecDO>> dbSpecMap =
mallIndustrySkuInfoSpecList.stream()
.collect(Collectors.groupingBy(MallIndustrySkuInfoSpecDO::getMallIndustrySkuInfoId));
List<GoodsProdSpecVO> goodsSpecList =
goodsAddVO.getProductSpec().stream()
.filter(d -> d.getId() != null)
.collect(Collectors.toList());
for (GoodsProdSpecVO goodsSpecVO : goodsSpecList) {
// 分组后的每一条商品绑定的规格信息
List<MallIndustrySkuInfoSpecDO> dbMallIndustrySkuSpecList =
dbSpecMap.get(goodsSpecVO.getId());
Set<Integer> inputMallSpecIds =
goodsSpecVO.getSpecIds().stream()
.map(MallProductSpecVO::getId)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
List<Integer> delSpecId =
dbMallIndustrySkuSpecList.stream()
.map(MallIndustrySkuInfoSpecDO::getId)
.filter(id -> !inputMallSpecIds.contains(id))
.collect(Collectors.toList());
if (delSpecId.size() != 0) {
// 删除多余的spec信息
industrySpecDao.batchUpdateMallIndustSpec(delSpecId, goodsAddVO.getId());
}
// 新增spec的信息
for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) {
if (mallProductSpecVO.getId() == null) {
MallIndustrySkuInfoSpecDO mallIndustrySkuInfoSpecDO =
new MallIndustrySkuInfoSpecDO()
.setIndustrySpecId(mallProductSpecVO.getMallSpecId())
.setMallIndustrySkuInfoId(goodsSpecVO.getId())
.setGoodsInfoId(goodsAddVO.getId());
// 插入数据库商品对应的规格信息
goodsInfoDao.insertMallIndustrySkuInfoSpec(mallIndustrySkuInfoSpecDO);
}
// 修改商品绑定的sku信息
List<GoodsProdSpecVO> updateGoodsSpec = goodsAddVO.getProductSpec().stream().filter(Objects::nonNull).collect(Collectors.toList());
List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList = updateGoodsSpec.stream().map(d -> {
MallIndustrySkuInfoDO mallIndustrySkuInfoDO = new MallIndustrySkuInfoDO();
mallIndustrySkuInfoDO.setId(d.getId()).setIndustrySkuId(d.getSkuId())
.setCategoriesId(d.getCategoryId()).setIndustrySkuSpecName(d.getGoodsSpecName())
.setChooseType(d.getChooseType()).setSkuUnitId(d.getSkuUnitId()).setMust(d.getMust());
return mallIndustrySkuInfoDO;
}).collect(Collectors.toList());
// 批量修改sku的信息
industrySpecDao.batchUpdateMallIndustrySkuInfo(mallIndustrySkuInfoList);
// 获取新的sku信息
List<GoodsProdSpecVO> list = goodsAddVO.getProductSpec().stream().filter(d -> d.getId() == null).collect(Collectors.toList());
industrySkuSpecOperation(new GoodsInfo(goodsAddVO.getId()), list);
// 获取商品对应的skuId
List<Integer> mallSkuIds = goodsAddVO.getProductSpec().stream().map(GoodsProdSpecVO::getId).filter(Objects::nonNull).collect(Collectors.toList());
}
}
}
@Transactional(rollbackFor = Exception.class)
public void updateMallProductSkuSpec(GoodsAddVO goodsAddVO) {
GoodsInfo goodsInfo = new GoodsInfo(goodsAddVO);
// 1、普通的sku修改逻辑
List<GoodsProdSpecVO> specInfo =
goodsAddVO.getProductSpec().stream()
.filter(spec -> !spec.getFlag().equals(1))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(specInfo)) {
// 1.1先获取用户输入的商品绑定sku的id集合
List<GoodsProdSpecVO> updateGoodsSpec =
specInfo.stream().filter(d -> d.getId() != null).collect(Collectors.toList());
List<Integer> inputMallSkuIds =
updateGoodsSpec.stream().map(GoodsProdSpecVO::getId).collect(Collectors.toList());
// 1.2从数据库获取该商品对应绑定的skuId的集合
List<MallProdInfoDO> mallProSkuInfoList = goodsInfoDao.getMallProSkuInfo(goodsAddVO.getId());
List<Integer> dbMallSkuIds =
mallProSkuInfoList.stream().map(MallProdInfoDO::getId).collect(Collectors.toList());
// 对比数据库id如果不在就删除
List<Integer> delIds =
dbMallSkuIds.stream()
.filter(id -> !inputMallSkuIds.contains(id))
.collect(Collectors.toList());
if (delIds.size() != 0) {
// 先删除商品绑定sku下的spec信息
goodsInfoDao.batchUpdateMallProSpec(delIds, goodsAddVO.getId());
goodsInfoDao.batchUpdateMallProductSku(delIds);
}
// 修改商品绑定的sku信息
List<MallProdInfoDO> mallProdSkuInfoList =
updateGoodsSpec.stream()
.map(
d -> {
MallProdInfoDO mallProdInfoDO = new MallProdInfoDO();
mallProdInfoDO
.setId(d.getId())
.setProdSkuId(d.getSkuId())
.setCategoriesId(d.getCategoryId())
.setProdSkuSpecName(d.getGoodsSpecName())
.setChooseType(d.getChooseType())
.setSkuUnitId(d.getSkuUnitId())
.setMust(d.getMust());
return mallProdInfoDO;
})
.collect(Collectors.toList());
// 1.3批量修改sku的信息
for (MallProdInfoDO mallProdInfoDO : mallProdSkuInfoList) {
goodsInfoDao.updateMallProdSkuInfo(mallProdInfoDO);
}
// goodsInfoDao.batchUpdateMallProdSkuInfo(mallProdSkuInfoList);
// 1.4对新的sku进行操作
List<GoodsProdSpecVO> list =
specInfo.stream().filter(d -> d.getId() == null).collect(Collectors.toList());
productSkuSpecOperation(goodsInfo, list);
// 获取商品对应的skuId
List<Integer> mallSkuIds =
goodsAddVO.getProductSpec().stream()
.filter(d -> d.getId() != null)
.map(GoodsProdSpecVO::getId)
.collect(Collectors.toList());
if (mallSkuIds.size() > 0) {
// 根据这些id查出下面对应的规格信息
List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpecList = industrySpecDao.listMallIndustrySpecInfo(mallSkuIds);
List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpecList =
goodsInfoDao.listMallProdSpecInfo(mallSkuIds);
// 分组
Map<Integer, List<MallIndustrySkuInfoSpecDO>> dbSpecMap = mallIndustrySkuInfoSpecList.stream().collect(Collectors.groupingBy(MallIndustrySkuInfoSpecDO::getMallIndustrySkuInfoId));
List<GoodsProdSpecVO> goodsSpecList = goodsAddVO.getProductSpec().stream().filter(d -> d.getId() != null).collect(Collectors.toList());
for (GoodsProdSpecVO goodsSpecVO : goodsSpecList) {
// 分组后的每一条商品绑定的规格信息
List<MallIndustrySkuInfoSpecDO> dbMallIndustrySkuSpecList = dbSpecMap.get(goodsSpecVO.getId());
Set<Integer> inputMallSpecIds = goodsSpecVO.getSpecIds().stream().map(MallProductSpecVO::getId).filter(Objects::nonNull).collect(Collectors.toSet());
List<Integer> delSpecId = dbMallIndustrySkuSpecList.stream().map(MallIndustrySkuInfoSpecDO::getId).filter(id -> !inputMallSpecIds.contains(id)).collect(Collectors.toList());
if (delSpecId.size() != 0) {
// 删除多余的spec信息
industrySpecDao.batchUpdateMallIndustSpec(delSpecId, goodsAddVO.getId());
}
// 新增spec的信息
for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) {
if (mallProductSpecVO.getId() == null) {
MallIndustrySkuInfoSpecDO mallIndustrySkuInfoSpecDO = new MallIndustrySkuInfoSpecDO()
.setIndustrySpecId(mallProductSpecVO.getMallSpecId())
.setMallIndustrySkuInfoId(goodsSpecVO.getId())
.setGoodsInfoId(goodsAddVO.getId());
// 插入数据库商品对应的规格信息
goodsInfoDao.insertMallIndustrySkuInfoSpec(mallIndustrySkuInfoSpecDO);
}
Map<Integer, List<MallProdSkuInfoSpecDO>> dbSpecMap =
mallProdSkuInfoSpecList.stream()
.collect(Collectors.groupingBy(MallProdSkuInfoSpecDO::getMallProdSkuInfoId));
for (GoodsProdSpecVO goodsSpecVO : updateGoodsSpec) {
// 分组后的每一条商品绑定的规格信息
List<MallProdSkuInfoSpecDO> dbMallProdSkuSpecList = dbSpecMap.get(goodsSpecVO.getId());
Set<Integer> inputMallSpecIds =
goodsSpecVO.getSpecIds().stream()
.map(MallProductSpecVO::getId)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
List<Integer> delSpecId =
dbMallProdSkuSpecList.stream()
.map(MallProdSkuInfoSpecDO::getId)
.filter(id -> !inputMallSpecIds.contains(id))
.collect(Collectors.toList());
if (delSpecId.size() != 0) {
// 删除多余的spec信息
goodsInfoDao.batchUpdateMallProdSpec(delSpecId);
}
// 新增spec的信息
for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) {
if (mallProductSpecVO.getId() == null) {
MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO =
new MallProdSkuInfoSpecDO()
.setProductSpecId(mallProductSpecVO.getMallSpecId())
.setMallProdSkuInfoId(goodsSpecVO.getId())
.setGoodsInfoId(goodsAddVO.getId());
// 插入数据库商品对应的规格信息
goodsInfoDao.insertMallProdSkuInfoSpec(mallProdSkuInfoSpecDO);
}
}
}
}
}
@Transactional(rollbackFor = Exception.class)
public void updateMallProductSkuSpec(GoodsAddVO goodsAddVO) {
// 1、普通的sku修改逻辑
List<GoodsProdSpecVO> specInfo = goodsAddVO.getProductSpec().stream().filter(spec -> !spec.getFlag().equals(1)).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(specInfo)) {
// 1.1先获取用户输入的商品绑定sku的id集合
List<GoodsProdSpecVO> updateGoodsSpec = specInfo.stream().filter(d -> d.getId() != null).collect(Collectors.toList());
List<Integer> inputMallSkuIds = updateGoodsSpec.stream().map(GoodsProdSpecVO::getId).collect(Collectors.toList());
// 1.2从数据库获取该商品对应绑定的skuId的集合
List<MallProdInfoDO> mallProSkuInfoList = goodsInfoDao.getMallProSkuInfo(goodsAddVO.getId());
List<Integer> dbMallSkuIds = mallProSkuInfoList.stream().map(MallProdInfoDO::getId).collect(Collectors.toList());
// 对比数据库id如果不在就删除
List<Integer> delIds = dbMallSkuIds.stream().filter(id -> !inputMallSkuIds.contains(id)).collect(Collectors.toList());
if (delIds.size() != 0) {
// 先删除商品绑定sku下的spec信息
goodsInfoDao.batchUpdateMallProSpec(delIds, goodsAddVO.getId());
goodsInfoDao.batchUpdateMallProductSku(delIds);
}
// 修改商品绑定的sku信息
List<MallProdInfoDO> mallProdSkuInfoList = updateGoodsSpec.stream().map(d -> {
MallProdInfoDO mallProdInfoDO = new MallProdInfoDO();
mallProdInfoDO.setId(d.getId()).setProdSkuId(d.getSkuId())
.setCategoriesId(d.getCategoryId()).setProdSkuSpecName(d.getGoodsSpecName())
.setChooseType(d.getChooseType()).setSkuUnitId(d.getSkuUnitId()).setMust(d.getMust());
return mallProdInfoDO;
}).collect(Collectors.toList());
// 1.3批量修改sku的信息
goodsInfoDao.batchUpdateMallProdSkuInfo(mallProdSkuInfoList);
// 1.4对新的sku进行操作
List<GoodsProdSpecVO> list = specInfo.stream().filter(d -> d.getId() == null).collect(Collectors.toList());
productSkuSpecOperation(new GoodsInfo(goodsAddVO.getId()), list);
// 获取商品对应的skuId
List<Integer> mallSkuIds = goodsAddVO.getProductSpec().stream().filter(d -> d.getId() != null).map(GoodsProdSpecVO::getId).collect(Collectors.toList());
if (mallSkuIds.size() > 0) {
// 根据这些id查出下面对应的规格信息
List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpecList = goodsInfoDao.listMallProdSpecInfo(mallSkuIds);
// 分组
Map<Integer, List<MallProdSkuInfoSpecDO>> dbSpecMap = mallProdSkuInfoSpecList.stream().collect(Collectors.groupingBy(MallProdSkuInfoSpecDO::getMallProdSkuInfoId));
for (GoodsProdSpecVO goodsSpecVO : updateGoodsSpec) {
// 分组后的每一条商品绑定的规格信息
List<MallProdSkuInfoSpecDO> dbMallProdSkuSpecList = dbSpecMap.get(goodsSpecVO.getId());
Set<Integer> inputMallSpecIds = goodsSpecVO.getSpecIds().stream().map(MallProductSpecVO::getId).filter(Objects::nonNull).collect(Collectors.toSet());
List<Integer> delSpecId = dbMallProdSkuSpecList.stream().map(MallProdSkuInfoSpecDO::getId).filter(id -> !inputMallSpecIds.contains(id)).collect(Collectors.toList());
if (delSpecId.size() != 0) {
// 删除多余的spec信息
goodsInfoDao.batchUpdateMallProdSpec(delSpecId);
}
// 新增spec的信息
for (MallProductSpecVO mallProductSpecVO : goodsSpecVO.getSpecIds()) {
if (mallProductSpecVO.getId() == null) {
MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO = new MallProdSkuInfoSpecDO()
.setProductSpecId(mallProductSpecVO.getMallSpecId())
.setMallProdSkuInfoId(goodsSpecVO.getId())
.setGoodsInfoId(goodsAddVO.getId());
// 插入数据库商品对应的规格信息
goodsInfoDao.insertMallProdSkuInfoSpec(mallProdSkuInfoSpecDO);
}
}
}
}
// 2、对自定义的sku进行操作
List<GoodsProdSpecVO> zdySpecInfo = goodsAddVO.getProductSpec().stream().filter(spec -> spec.getFlag().equals(1)).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(zdySpecInfo)) {
updateCustomize(zdySpecInfo, goodsAddVO.getId());
}
}
// 2、对自定义的sku进行操作
List<GoodsProdSpecVO> zdySpecInfo =
goodsAddVO.getProductSpec().stream()
.filter(spec -> spec.getFlag().equals(1))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(zdySpecInfo)) {
updateCustomize(goodsInfo, zdySpecInfo, goodsAddVO.getId());
}
}
@Transactional(rollbackFor = Exception.class)
public void updateCustomize(List<GoodsProdSpecVO> zdySpecInfo, Integer id) {
// 先获取自定义的sku及规格(原来有的)
List<GoodsProdSpecVO> zdySpec = zdySpecInfo.stream().filter(d -> d.getId() != null).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(zdySpec)) {
// 根据获取到的自定义sku及规格进行操作
List<MallProdInfoDO> zdySpecList = zdySpec.stream().map(d -> {
// 构建商品对应的sku信息
ProductSkuDO productSkuDO = new ProductSkuDO().setId(d.getSkuId()).setCategoriesId(d.getCategoryId()).setProductName(d.getProductName());
productDao.updateProductSku(productSkuDO);
return new MallProdInfoDO(d).setId(d.getId()).setProdSkuId(d.getSkuId());
}).collect(Collectors.toList());
// 批量修改sku的信息
goodsInfoDao.batchUpdateMallProdSkuInfo(zdySpecList);
}
for (GoodsProdSpecVO goodsSpecVO : zdySpec) {
// 【1】获取输入的自定义规格信息// id不为空则修改
List<ProductSpecVO> customizeInfoList = goodsSpecVO.getCustomizeInfo().stream().filter(d -> d.getId() != null).collect(Collectors.toList());
for (ProductSpecVO d : customizeInfoList) {
// ①修改价格配置
ProductSpecCPQVO productSpecCPQVO = d.getProductSpecCPQVO();
// 删除所有的随后在新增
productDao.removeProductSpecCPQ(productSpecCPQVO);
productSkuService.insertSpecPrice(productSpecCPQVO);
// ②在修改自定义的数据
productDao.updateProductSpec(new ProductSpecDO(d));
}
// 【2】删除多余的自定义规格
if (!CollectionUtils.isEmpty(goodsSpecVO.getDelProductSpecId())) {
// 批量查出spec的数据
List<MallProdSkuInfoSpecDO> prodSkuInfoSpecList = productDao.getProductSpecByIds(goodsSpecVO.getDelProductSpecId());
for (MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO : prodSkuInfoSpecList) {
productDao.removeProductSpec(mallProdSkuInfoSpecDO.getProductSpecId());
}
goodsInfoDao.batchUpdateMallProdSpec(goodsSpecVO.getDelProductSpecId());
}
// 【3】新增最新的自定义规格
List<ProductSpecVO> collect = goodsSpecVO.getCustomizeInfo().stream().filter(d -> d.getId() == null).collect(Collectors.toList());
for (ProductSpecVO param : collect) {
ProductSpecDO productSpecDO = new ProductSpecDO(param);
// 新增产品sku
productDao.insertProductSpec(productSpecDO);
// 批量配置价格信息
ProductSpecCPQVO productSpecCPQVO = param.getProductSpecCPQVO();
productSpecCPQVO.setProductSpecId(productSpecDO.getId());
productSkuService.insertSpecPrice(productSpecCPQVO);
// 构建商品对应的规格信息
MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO = new MallProdSkuInfoSpecDO()
.setProductSpecId(productSpecDO.getId())
.setMallProdSkuInfoId(goodsSpecVO.getId())
.setGoodsInfoId(id);
// 插入数据库商品对应的规格信息
goodsInfoDao.insertMallProdSkuInfoSpec(mallProdSkuInfoSpecDO);
}
}
// 2.2 新增新的自定义规格信息
List<GoodsProdSpecVO> newZdySpec = zdySpecInfo.stream().filter(d -> d.getId() == null).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(newZdySpec)) {
productSkuSpecOperation(new GoodsInfo(id), newZdySpec);
@Transactional(rollbackFor = Exception.class)
public void updateCustomize(GoodsInfo goodsInfo, List<GoodsProdSpecVO> zdySpecInfo, Integer id) {
// 先获取自定义的sku及规格(原来有的)
List<GoodsProdSpecVO> zdySpec =
zdySpecInfo.stream().filter(d -> d.getId() != null).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(zdySpec)) {
// 根据获取到的自定义sku及规格进行操作
List<MallProdInfoDO> zdySpecList =
zdySpec.stream()
.map(
d -> {
// 构建商品对应的sku信息
ProductSkuDO productSkuDO =
new ProductSkuDO()
.setId(d.getSkuId())
.setCategoriesId(d.getCategoryId())
.setProductName(d.getProductName());
productDao.updateProductSku(productSkuDO);
return new MallProdInfoDO(d).setId(d.getId()).setProdSkuId(d.getSkuId());
})
.collect(Collectors.toList());
// 批量修改sku的信息
for (MallProdInfoDO mallProdInfoDO : zdySpecList) {
goodsInfoDao.updateMallProdSkuInfo(mallProdInfoDO);
}
// goodsInfoDao.batchUpdateMallProdSkuInfo(zdySpecList);
}
for (GoodsProdSpecVO goodsSpecVO : zdySpec) {
// 【1】获取输入的自定义规格信息// id不为空则修改
List<ProductSpecVO> customizeInfoList =
goodsSpecVO.getCustomizeInfo().stream()
.filter(d -> d.getId() != null)
.collect(Collectors.toList());
for (ProductSpecVO d : customizeInfoList) {
// ①修改价格配置
ProductSpecCPQVO productSpecCPQVO = d.getProductSpecCPQVO();
// 删除所有的随后在新增
productDao.removeProductSpecCPQ(productSpecCPQVO);
productSkuService.insertSpecPrice(productSpecCPQVO);
// ②在修改自定义的数据
productDao.updateProductSpec(new ProductSpecDO(d));
}
// 【2】删除多余的自定义规格
if (!CollectionUtils.isEmpty(goodsSpecVO.getDelProductSpecId())) {
// 批量查出spec的数据
List<MallProdSkuInfoSpecDO> prodSkuInfoSpecList =
productDao.getProductSpecByIds(goodsSpecVO.getDelProductSpecId());
for (MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO : prodSkuInfoSpecList) {
productDao.removeProductSpec(mallProdSkuInfoSpecDO.getProductSpecId());
}
goodsInfoDao.batchUpdateMallProdSpec(goodsSpecVO.getDelProductSpecId());
}
// 【3】新增最新的自定义规格
List<ProductSpecVO> collect =
goodsSpecVO.getCustomizeInfo().stream()
.filter(d -> d.getId() == null)
.collect(Collectors.toList());
for (ProductSpecVO param : collect) {
ProductSpecDO productSpecDO = new ProductSpecDO(param);
// 新增产品sku
productDao.insertProductSpec(productSpecDO);
// 批量配置价格信息
ProductSpecCPQVO productSpecCPQVO = param.getProductSpecCPQVO();
productSpecCPQVO.setProductSpecId(productSpecDO.getId());
productSkuService.insertSpecPrice(productSpecCPQVO);
// 构建商品对应的规格信息
MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO =
new MallProdSkuInfoSpecDO()
.setProductSpecId(productSpecDO.getId())
.setMallProdSkuInfoId(goodsSpecVO.getId())
.setGoodsInfoId(id);
// 插入数据库商品对应的规格信息
goodsInfoDao.insertMallProdSkuInfoSpec(mallProdSkuInfoSpecDO);
}
}
// 2.2 新增新的自定义规格信息
List<GoodsProdSpecVO> newZdySpec =
zdySpecInfo.stream().filter(d -> d.getId() == null).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(newZdySpec)) {
productSkuSpecOperation(goodsInfo, newZdySpec);
}
}
@Transactional(rollbackFor = Exception.class)
public void updateOtherService(GoodsAddVO goodsAddVO) {
// 删除其他服务
goodsInfoDao.deleteGoodsServiceByGoodsId(goodsAddVO.getId());
// 插入其他服务
if (!CollectionUtils.isEmpty(goodsAddVO.getOtherService())) {
List<Integer> other = goodsAddVO.getOtherService();
List<GoodsServiceDO> otherList = other.stream().map(d -> {
GoodsServiceDO goodsServiceDO = new GoodsServiceDO();
goodsServiceDO.setGoodsInfoId(goodsAddVO.getId());
goodsServiceDO.setSaleServiceId(d);
return goodsServiceDO;
}).collect(Collectors.toList());
goodsInfoDao.insertGoodsService(otherList);
}
@Transactional(rollbackFor = Exception.class)
public void updateOtherService(GoodsAddVO goodsAddVO) {
// 删除其他服务
goodsInfoDao.deleteGoodsServiceByGoodsId(goodsAddVO.getId());
// 插入其他服务
if (!CollectionUtils.isEmpty(goodsAddVO.getOtherService())) {
List<Integer> other = goodsAddVO.getOtherService();
List<GoodsServiceDO> otherList =
other.stream()
.map(
d -> {
GoodsServiceDO goodsServiceDO = new GoodsServiceDO();
goodsServiceDO.setGoodsInfoId(goodsAddVO.getId());
goodsServiceDO.setSaleServiceId(d);
return goodsServiceDO;
})
.collect(Collectors.toList());
goodsInfoDao.insertGoodsService(otherList);
}
}
@Transactional(rollbackFor = Exception.class)
public void updateImageInfo(GoodsAddVO goodsAddVO) {
Set<Integer> imgIds = goodsAddVO.getImages().stream().map(GoodsImgVO::getId).filter(Objects::nonNull).collect(Collectors.toSet());
List<GoodsImgDO> dbImgList = goodsInfoDao.listGoodsInfoByGoodsId(goodsAddVO.getId());
List<Integer> deleteIds = dbImgList.stream().map(GoodsImgDO::getId).filter(id -> !imgIds.contains(id)).collect(Collectors.toList());
if (deleteIds.size() != 0) {
// 删除多余的图片
goodsInfoDao.deleteImgByIds(deleteIds);
}
// 新增图片
List<GoodsImgDO> imgDOList = goodsAddVO.getImages().stream().filter(d -> d.getId() == null).map(d -> {
GoodsImgDO goodsImgDO = new GoodsImgDO(d);
goodsImgDO.setGoodsInfoId(goodsAddVO.getId());
return goodsImgDO;
}).collect(Collectors.toList());
if (imgDOList.size() != 0) {
goodsInfoDao.insertGoodsImgInfo(imgDOList);
}
// 删除视频
goodsInfoDao.deleteGoodsVideoById(goodsAddVO.getId());
// 插入视频
if (goodsAddVO.getGoodsVideo() != null) {
GoodsVideoDO goodsVideoDO = new GoodsVideoDO();
goodsVideoDO.setGoodsInfoId(goodsAddVO.getId());
goodsVideoDO.setVideoUrl(goodsAddVO.getGoodsVideo());
goodsInfoDao.insertVideoInfo(goodsVideoDO);
}
@Transactional(rollbackFor = Exception.class)
public void updateImageInfo(GoodsAddVO goodsAddVO) {
Set<Integer> imgIds =
goodsAddVO.getImages().stream()
.map(GoodsImgVO::getId)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
List<GoodsImgDO> dbImgList = goodsInfoDao.listGoodsInfoByGoodsId(goodsAddVO.getId());
List<Integer> deleteIds =
dbImgList.stream()
.map(GoodsImgDO::getId)
.filter(id -> !imgIds.contains(id))
.collect(Collectors.toList());
if (deleteIds.size() != 0) {
// 删除多余的图片
goodsInfoDao.deleteImgByIds(deleteIds);
}
// 新增图片
List<GoodsImgDO> imgDOList =
goodsAddVO.getImages().stream()
.filter(d -> d.getId() == null)
.map(
d -> {
GoodsImgDO goodsImgDO = new GoodsImgDO(d);
goodsImgDO.setGoodsInfoId(goodsAddVO.getId());
return goodsImgDO;
})
.collect(Collectors.toList());
if (imgDOList.size() != 0) {
goodsInfoDao.insertGoodsImgInfo(imgDOList);
}
// 删除视频
goodsInfoDao.deleteGoodsVideoById(goodsAddVO.getId());
// 插入视频
if (goodsAddVO.getGoodsVideo() != null) {
GoodsVideoDO goodsVideoDO = new GoodsVideoDO();
goodsVideoDO.setGoodsInfoId(goodsAddVO.getId());
goodsVideoDO.setVideoUrl(goodsAddVO.getGoodsVideo());
goodsInfoDao.insertVideoInfo(goodsVideoDO);
}
}
@Transactional(rollbackFor = Exception.class)
public void updateGoodsDetail(GoodsAddVO goodsAddVO) {
GoodsDetailDO goodsDetailDO = new GoodsDetailDO(goodsAddVO.getGoodsDetailVO()).setGoodsInfoId(goodsAddVO.getId());
// 商品详情修改
goodsInfoDao.updateGoodsDetail(goodsDetailDO);
@Transactional(rollbackFor = Exception.class)
public void updateGoodsDetail(GoodsAddVO goodsAddVO) {
GoodsDetailDO goodsDetailDO =
new GoodsDetailDO(goodsAddVO.getGoodsDetailVO()).setGoodsInfoId(goodsAddVO.getId());
// 商品详情修改
goodsInfoDao.updateGoodsDetail(goodsDetailDO);
}
@Override
public ResultBody getGoodsInfoDetail(Integer goodsInfoId, Integer type, Integer leaseTerm) {
// 判断此商品是否还存在
int count = goodsInfoDao.countGoodsInfoById(goodsInfoId);
if (count <= 0) {
return ResultBody.error(ResultEnum.GOODS_NOT_EXIST_OR_ALREADY_DOWN_SHELF);
}
// 初始化商品返回信息的对象
MallGoodsDetailDTO mallGoodsDetail = new MallGoodsDetailDTO();
// 获取商品基本信息
GoodsInfo goodsInfo = goodsInfoDao.getGoodsSimpleInfo(goodsInfoId);
mallGoodsDetail
.setId(goodsInfo.getId())
.setGoodsNo(goodsInfo.getGoodsNo())
.setGoodsName(goodsInfo.getGoodsName())
.setCategoryByOne(goodsInfo.getCategoryByOne())
.setGoodsVideo(goodsInfo.getVideoUrl())
.setDirectoryId(goodsInfo.getDirectoryId())
.setCategoryByTwo(goodsInfo.getCategoryByTwo())
.setTag(goodsInfo.getEcoLabel())
.setShelfStatus(goodsInfo.getShelfStatus())
.setGoodsVideoId(goodsInfo.getGoodsVideoId());
// 获取商品图片信息
mallGoodsDetail.setImages(getGoodsImageInfo(goodsInfoId));
// 获取商品详细信息
mallGoodsDetail.setGoodsDetail(getGoodsDetail(goodsInfoId));
// 获取其他服务信息
mallGoodsDetail.setOtherService(getOtherServiceInfo(goodsInfoId));
// 获取规格信息
if (!goodsInfo.getDirectoryId().equals(2)) {
// 获取产品规格信息
mallGoodsDetail.setGoodsSpec(getProductSpecInfo(goodsInfoId, type, leaseTerm));
} else {
// 获取行业规格信息
mallGoodsDetail.setGoodsSpec(getIndustrySpecInfo(goodsInfoId));
}
return ResultBody.success(mallGoodsDetail);
}
private List<GoodsSpecDTO> getIndustrySpecInfo(Integer goodsInfoId) {
// 获取商品对应绑定的行业sku信息
List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList =
goodsInfoDao.getMallIndustrySkuInfo(goodsInfoId);
List<GoodsSpecDTO> list =
mallIndustrySkuInfoList.stream()
.map(MallIndustrySkuInfoDO::buildGoodsSpecDTO)
.collect(Collectors.toList());
// 根据商品id查出该商品下绑定的规格信息
List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpec =
industrySpecDao.getIndustrySkuInfoSpec(goodsInfoId);
list =
list.stream()
.peek(
d -> {
List<MallIndustrySpecDTO> industrySpec = new ArrayList<>();
for (MallIndustrySkuInfoSpecDO e : mallIndustrySkuInfoSpec) {
if (d.getId().equals(e.getMallIndustrySkuInfoId())) {
IndustrySpecDO industrySpecDO = e.getIndustrySpecDO();
MallIndustrySpecDTO industrySpecDTO =
industrySpecDO.buildMallIndustrySpecDTO();
industrySpecDTO.setId(e.getId());
industrySpecDTO.setIndustrySpecId(e.getIndustrySpecId());
industrySpecDTO.setIndustrySkuId(d.getSkuId());
industrySpec.add(industrySpecDTO);
}
}
d.setIndustrySpecList(industrySpec);
})
.collect(Collectors.toList());
return list;
}
@Override
public ResultBody getGoodsInfoDetail(Integer goodsInfoId) {
// 判断此商品是否还存在
int count = goodsInfoDao.countGoodsInfoById(goodsInfoId);
if (count <= 0) {
return ResultBody.error(ResultEnum.GOODS_NOT_EXIST_OR_ALREADY_DOWN_SHELF);
}
// 初始化商品返回信息的对象
MallGoodsDetailDTO mallGoodsDetail = new MallGoodsDetailDTO();
// 获取商品基本信息
GoodsInfo goodsInfo = goodsInfoDao.getGoodsSimpleInfo(goodsInfoId);
mallGoodsDetail.setId(goodsInfo.getId()).setGoodsName(goodsInfo.getGoodsName())
.setCategoryByOne(goodsInfo.getCategoryByOne()).setGoodsVideo(goodsInfo.getVideoUrl())
.setDirectoryId(goodsInfo.getDirectoryId()).setCategoryByTwo(goodsInfo.getCategoryByTwo())
.setTag(goodsInfo.getEcoLabel()).setShelfStatus(goodsInfo.getShelfStatus())
.setGoodsVideoId(goodsInfo.getGoodsVideoId());
// 获取商品图片信息
mallGoodsDetail.setImages(getGoodsImageInfo(goodsInfoId));
// 获取商品详细信息
mallGoodsDetail.setGoodsDetail(getGoodsDetail(goodsInfoId));
// 获取其他服务信息
mallGoodsDetail.setOtherService(getOtherServiceInfo(goodsInfoId));
// 获取规格信息
if (!goodsInfo.getDirectoryId().equals(2)) {
// 获取产品规格信息
mallGoodsDetail.setGoodsSpec(getProductSpecInfo(goodsInfoId));
} else {
// 获取行业规格信息
mallGoodsDetail.setGoodsSpec(getIndustrySpecInfo(goodsInfoId));
}
return ResultBody.success(mallGoodsDetail);
}
private List<GoodsSpecDTO> getIndustrySpecInfo(Integer goodsInfoId) {
// 获取商品对应绑定的行业sku信息
List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList = goodsInfoDao.getMallIndustrySkuInfo(goodsInfoId);
List<GoodsSpecDTO> list = mallIndustrySkuInfoList.stream().map(MallIndustrySkuInfoDO::buildGoodsSpecDTO).collect(Collectors.toList());
// 根据商品id查出该商品下绑定的规格信息
List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpec = industrySpecDao.getIndustrySkuInfoSpec(goodsInfoId);
list = list.stream().peek(d -> {
List<MallIndustrySpecDTO> industrySpec = new ArrayList<>();
for (MallIndustrySkuInfoSpecDO e : mallIndustrySkuInfoSpec) {
if (d.getId().equals(e.getMallIndustrySkuInfoId())) {
IndustrySpecDO industrySpecDO = e.getIndustrySpecDO();
MallIndustrySpecDTO industrySpecDTO = industrySpecDO.buildMallIndustrySpecDTO();
industrySpecDTO.setId(e.getId());
industrySpecDTO.setIndustrySpecId(e.getIndustrySpecId());
industrySpecDTO.setIndustrySkuId(d.getSkuId());
industrySpec.add(industrySpecDTO);
}
}
d.setIndustrySpecList(industrySpec);
}).collect(Collectors.toList());
return list;
}
private List<GoodsSpecDTO> getProductSpecInfo(Integer goodsInfoId) {
// 获取商品对应绑定sku的信息
List<MallProdInfoDO> mallProdSkuInfoList = goodsInfoDao.getMallProSkuInfo(goodsInfoId);
List<GoodsSpecDTO> list = mallProdSkuInfoList.stream().map(MallProdInfoDO::buildGoodsSpecDTO).collect(Collectors.toList());
// 获取规格来源详细信息
List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpec = goodsInfoDao.getMallProSkuInfoSpec(goodsInfoId);
// 根据id查询出规格的具体信息
list = list.stream().peek(d -> {
List<MallProductSpecDTO> specList = new ArrayList<>();
for (MallProdSkuInfoSpecDO e : mallProdSkuInfoSpec) {
if (d.getId().equals(e.getMallProdSkuInfoId())) {
// 构建规格对象
ProductSpecDO productSpecDO = e.getProductSpecDO();
MallProductSpecDTO productSpecDTO = productSpecDO.buildMallProductSpecDTO();
productSpecDTO.setProductSkuId(d.getSkuId());
productSpecDTO.setId(e.getId());
productSpecDTO.setProductSpec(e.getProductSpecId());
if (d.getFlag().equals(1)) {
// 获取自定义sku下规格的价格配置信息
ProductSpecCPQVO productSpecCPQVO = new ProductSpecCPQVO();
productSpecCPQVO.setProductSpecId(e.getProductSpecId());
List<ProductSpecPriceDO> productSpecPrice = productDao.getProductSpecPrice(productSpecCPQVO);
List<SpecPriceVO> collect = productSpecPrice.stream().map(m -> {
SpecPriceVO specPriceVO = new SpecPriceVO();
specPriceVO.setId(m.getId());
specPriceVO.setPrice(m.getPrice());
specPriceVO.setCooperationTag(m.getCooperationTag());
return specPriceVO;
}).collect(Collectors.toList());
productSpecCPQVO.setSpecPrice(collect);
productSpecDTO.setProductSpecCPQVO(productSpecCPQVO);
private List<GoodsSpecDTO> getProductSpecInfo(
Integer goodsInfoId, Integer type, Integer leaseTerm) {
// 获取商品对应绑定sku的信息
List<MallProdInfoDO> mallProdSkuInfoList = goodsInfoDao.getAllMallProSkuInfo(goodsInfoId);
List<GoodsSpecDTO> list =
mallProdSkuInfoList.stream()
.map(MallProdInfoDO::buildGoodsSpecDTO)
.collect(Collectors.toList());
// 获取规格来源详细信息
List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpec =
goodsInfoDao.getMallProSkuInfoSpec(goodsInfoId);
// 根据id查询出规格的具体信息
list =
list.stream()
.peek(
d -> {
List<MallProductSpecDTO> specList = new ArrayList<>();
for (MallProdSkuInfoSpecDO e : mallProdSkuInfoSpec) {
if (d.getId().equals(e.getMallProdSkuInfoId())) {
// 构建规格对象
ProductSpecDO productSpecDO = e.getProductSpecDO();
MallProductSpecDTO productSpecDTO = productSpecDO.buildMallProductSpecDTO();
productSpecDTO.setProductSkuId(d.getSkuId());
productSpecDTO.setId(e.getId());
productSpecDTO.setProductSpec(e.getProductSpecId());
// 获取自定义sku下规格的价格配置信息
ProductSpecCPQVO productSpecCPQVO = new ProductSpecCPQVO();
productSpecCPQVO.setProductSpecId(e.getProductSpecId());
productSpecCPQVO.setType(type);
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.setId(m.getId());
specPriceVO.setPrice(m.getPrice());
specPriceVO.setCooperationTag(m.getCooperationTag());
return specPriceVO;
})
.collect(Collectors.toList());
productSpecCPQVO.setSpecPrice(collect);
productSpecDTO.setProductSpecCPQVO(productSpecCPQVO);
specList.add(productSpecDTO);
}
specList.add(productSpecDTO);
}
}
d.setProductSpecList(specList);
}).collect(Collectors.toList());
return list;
}
}
d.setProductSpecList(specList);
})
.collect(Collectors.toList());
return list;
}
private List<GoodsOtherServiceDTO> getOtherServiceInfo(Integer goodsInfoId) {
List<GoodsServiceDO> goodsServiceDO = goodsInfoDao.listGoodsServiceByGoodsId(goodsInfoId);
return goodsServiceDO.stream().map(GoodsServiceDO::buildGoodsOtherServiceDTO).collect(Collectors.toList());
}
public List<GoodsOtherServiceDTO> getOtherServiceInfo(Integer goodsInfoId) {
List<GoodsServiceDO> goodsServiceDO = goodsInfoDao.listGoodsServiceByGoodsId(goodsInfoId);
return goodsServiceDO.stream()
.map(GoodsServiceDO::buildGoodsOtherServiceDTO)
.collect(Collectors.toList());
}
private GoodsDetailInfoDTO getGoodsDetail(Integer goodsInfoId) {
GoodsDetailDO goodsDetail = goodsInfoDao.getGoodsDetailByGoodsId(goodsInfoId);
return goodsDetail.buildGoodsDetailInfoDTO();
}
public GoodsDetailInfoDTO getGoodsDetail(Integer goodsInfoId) {
GoodsDetailDO goodsDetail = goodsInfoDao.getGoodsDetailByGoodsId(goodsInfoId);
return goodsDetail.buildGoodsDetailInfoDTO();
}
private List<GoodsImgDTO> getGoodsImageInfo(Integer goodsInfoId) {
List<GoodsImgDO> goodsImgList = goodsInfoDao.listGoodsInfoByGoodsId(goodsInfoId);
return goodsImgList.stream().map(GoodsImgDO::buildGoodsImgDTO).collect(Collectors.toList());
}
public List<GoodsImgDTO> getGoodsImageInfo(Integer goodsInfoId) {
List<GoodsImgDO> goodsImgList = goodsInfoDao.listGoodsInfoByGoodsId(goodsInfoId);
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
public ResultBody getSkuUnit() {
List<SkuUnitDO> skuUnitList = goodsInfoDao.getSkuUnit();
List<SkuUnitDTO> list = skuUnitList.stream().map(SkuUnitDO::buildSkuUnitDTO).collect(Collectors.toList());
return ResultBody.success(list);
}
@Override
public ResultBody getSkuUnit() {
List<SkuUnitDO> skuUnitList = goodsInfoDao.getSkuUnit();
List<SkuUnitDTO> list =
skuUnitList.stream().map(SkuUnitDO::buildSkuUnitDTO).collect(Collectors.toList());
return ResultBody.success(list);
}
/**
* 根据商品id,商品规格id查询并填充相关信息
*
* @param param
* @return
*/
@Override
public List<MallGoodsShopCarDTO> fillGoodsInfo(List<MallGoodsShopCarDTO> param) {
Set<Integer> goodsIds = new HashSet<>();
//获取商品id
for (MallGoodsShopCarDTO mallGoodsShopCarDTO : param) {
goodsIds.add(mallGoodsShopCarDTO.getGoodsInfoId());
}
//查询出商品信息后进行填充
List<GoodsInfo> goodsInfoDOList = goodsInfoDao.listSimpleGoodsInfoByIds(goodsIds);
for (MallGoodsShopCarDTO mallGoodsShopCarDTO : param) {
for (GoodsInfo goodsInfo : goodsInfoDOList) {
if (mallGoodsShopCarDTO.getGoodsInfoId().toString().equals(goodsInfo.getId().toString())) {
mallGoodsShopCarDTO.setDirectoryId(goodsInfo.getDirectoryId());
mallGoodsShopCarDTO.setShelfStatus(goodsInfo.getShelfStatus());
mallGoodsShopCarDTO.setGoodsName(goodsInfo.getGoodsName());
mallGoodsShopCarDTO.setMainImg(goodsInfo.getMainImg());
break;
}
}
/**
* 根据商品id,商品规格id查询并填充相关信息
*
* @param param
* @return
*/
@Override
public List<MallGoodsShopCarDTO> fillGoodsInfo(List<MallGoodsShopCarDTO> param) {
Set<Integer> goodsIds = new HashSet<>();
// 获取商品id
for (MallGoodsShopCarDTO mallGoodsShopCarDTO : param) {
goodsIds.add(mallGoodsShopCarDTO.getGoodsInfoId());
}
// 查询出商品信息后进行填充
List<GoodsInfo> goodsInfoDOList = goodsInfoDao.listSimpleGoodsInfoByIds(goodsIds);
for (MallGoodsShopCarDTO mallGoodsShopCarDTO : param) {
for (GoodsInfo goodsInfo : goodsInfoDOList) {
if (mallGoodsShopCarDTO.getGoodsInfoId().toString().equals(goodsInfo.getId().toString())) {
mallGoodsShopCarDTO.setDirectoryId(goodsInfo.getDirectoryId());
mallGoodsShopCarDTO.setShelfStatus(goodsInfo.getShelfStatus());
mallGoodsShopCarDTO.setGoodsName(goodsInfo.getGoodsName());
mallGoodsShopCarDTO.setMainImg(goodsInfo.getMainImg());
break;
}
}
}
//对产品和行业的规格id进行分类
Set<Integer> prodIds = new HashSet<>();
Set<Integer> indstIds = new HashSet<>();
for (MallGoodsShopCarDTO mallGoodsShopCarDTO : param) {
if (mallGoodsShopCarDTO.getDirectoryId().equals(1)) {
for (MallSkuInfoSpecDTO mallSkuInfoSpecDTO : mallGoodsShopCarDTO.getSkuList()) {
prodIds.add(mallSkuInfoSpecDTO.getMallSkuInfoSpecId());
}
} else if (mallGoodsShopCarDTO.getDirectoryId().equals(2)) {
for (MallSkuInfoSpecDTO mallSkuInfoSpecDTO : mallGoodsShopCarDTO.getSkuList()) {
indstIds.add(mallSkuInfoSpecDTO.getMallSkuInfoSpecId());
}
}
// 对产品和行业的规格id进行分类
Set<Integer> prodIds = new HashSet<>();
Set<Integer> indstIds = new HashSet<>();
for (MallGoodsShopCarDTO mallGoodsShopCarDTO : param) {
if (mallGoodsShopCarDTO.getDirectoryId().equals(1)) {
for (MallSkuInfoSpecDTO mallSkuInfoSpecDTO : mallGoodsShopCarDTO.getSkuList()) {
prodIds.add(mallSkuInfoSpecDTO.getMallSkuInfoSpecId());
}
//根据规格id查找规格信息
List<MallGoodsSpecInfoDO> goodsSpecInfoDOList = new ArrayList<>();
if (!CollectionUtils.isEmpty(prodIds)) {
List<MallGoodsSpecInfoDO> goodsProdSpecInfoDOList = goodsInfoDao.listProdSpecInfo(prodIds);
goodsSpecInfoDOList.addAll(goodsProdSpecInfoDOList);
} else if (mallGoodsShopCarDTO.getDirectoryId().equals(2)) {
for (MallSkuInfoSpecDTO mallSkuInfoSpecDTO : mallGoodsShopCarDTO.getSkuList()) {
indstIds.add(mallSkuInfoSpecDTO.getMallSkuInfoSpecId());
}
if (!CollectionUtils.isEmpty(indstIds)) {
List<MallGoodsSpecInfoDO> goodsIndstSpecInfoDOList = goodsInfoDao.listIndstSpecInfo(indstIds);
goodsSpecInfoDOList.addAll(goodsIndstSpecInfoDOList);
}
//根据查出来的sku,填充到MallGoodsShopCarDTO里面
for (MallGoodsShopCarDTO mallGoodsShopCarDTO : param) {
for (MallGoodsSpecInfoDO mallGoodsSpecInfoDO : goodsSpecInfoDOList) {
//找到对应商品
if (mallGoodsShopCarDTO.getGoodsInfoId().toString().equals(mallGoodsSpecInfoDO.getId().toString())
&& mallGoodsShopCarDTO.getDirectoryId().toString().equals(mallGoodsSpecInfoDO.getDirectoryId().toString())) {
for (SkuSpecDO skuSpecDO : mallGoodsSpecInfoDO.getSkuSpecDOList()) {
for (MallSkuInfoSpecDTO mallSkuInfoSpecDTO : mallGoodsShopCarDTO.getSkuList()) {
//根据对应规格进行填充
if (skuSpecDO.getId().toString().equals(mallSkuInfoSpecDTO.getMallSkuInfoSpecId().toString())) {
mallSkuInfoSpecDTO.setSpecName(skuSpecDO.getSpecName());
mallSkuInfoSpecDTO.setDeleted(skuSpecDO.getSkuSpecDeleted());
mallSkuInfoSpecDTO.setValid(skuSpecDO.getSkuSpecDeleted() == 0 && skuSpecDO.getSpecDeleted() == 0);
break;
}
}
}
break;
}
}
}
// 根据规格id查找规格信息
List<MallGoodsSpecInfoDO> goodsSpecInfoDOList = new ArrayList<>();
if (!CollectionUtils.isEmpty(prodIds)) {
List<MallGoodsSpecInfoDO> goodsProdSpecInfoDOList = goodsInfoDao.listProdSpecInfo(prodIds);
goodsSpecInfoDOList.addAll(goodsProdSpecInfoDOList);
}
if (!CollectionUtils.isEmpty(indstIds)) {
List<MallGoodsSpecInfoDO> goodsIndstSpecInfoDOList = goodsInfoDao.listIndstSpecInfo(indstIds);
goodsSpecInfoDOList.addAll(goodsIndstSpecInfoDOList);
}
// 根据查出来的sku,填充到MallGoodsShopCarDTO里面
for (MallGoodsShopCarDTO mallGoodsShopCarDTO : param) {
for (MallGoodsSpecInfoDO mallGoodsSpecInfoDO : goodsSpecInfoDOList) {
// 找到对应商品
if (mallGoodsShopCarDTO
.getGoodsInfoId()
.toString()
.equals(mallGoodsSpecInfoDO.getId().toString())
&& mallGoodsShopCarDTO
.getDirectoryId()
.toString()
.equals(mallGoodsSpecInfoDO.getDirectoryId().toString())) {
for (SkuSpecDO skuSpecDO : mallGoodsSpecInfoDO.getSkuSpecDOList()) {
for (MallSkuInfoSpecDTO mallSkuInfoSpecDTO : mallGoodsShopCarDTO.getSkuList()) {
// 根据对应规格进行填充
if (skuSpecDO
.getId()
.toString()
.equals(mallSkuInfoSpecDTO.getMallSkuInfoSpecId().toString())) {
mallSkuInfoSpecDTO.setSpecName(skuSpecDO.getSpecName());
mallSkuInfoSpecDTO.setDeleted(skuSpecDO.getSkuSpecDeleted());
mallSkuInfoSpecDTO.setValid(
skuSpecDO.getSkuSpecDeleted() == 0 && skuSpecDO.getSpecDeleted() == 0);
break;
}
}
}
break;
}
return param;
}
@Override
public List<MallProductSpecPriceDTO> feignListProductSpecPrice(ProductSpecPriceQO productSpecPriceQO) {
Set<Integer> ids = new HashSet<>(productSpecPriceQO.getProductSpecIds());
List<MallProductSpecPriceDTO> mallProductSpecPriceDTOS = productSpecPriceQO.getProductSpecIds().stream().map(d -> {
MallProductSpecPriceDTO mallProductSpecPriceDTO = new MallProductSpecPriceDTO();
mallProductSpecPriceDTO.setProductSpecId(d);
return mallProductSpecPriceDTO;
}).collect(Collectors.toList());
//分别找出渠道价格和市场价格
List<ProductSpecPriceDO> productSpecPriceDOS = productDao.listProductSpecPrice(productSpecPriceQO.getChannelClass(), ids);
List<ProductSpecPriceDO> productSpecPriceDOS1 = productDao.listProductSpecPrice(0, ids);
//设置合作价格
for (ProductSpecPriceDO productSpecPriceDO : productSpecPriceDOS) {
for (MallProductSpecPriceDTO mallProductSpecPriceDTO : mallProductSpecPriceDTOS) {
if (mallProductSpecPriceDTO.getProductSpecId().equals(productSpecPriceDO.getProductSpecId())) {
mallProductSpecPriceDTO.setOpPrice(productSpecPriceDO.getPrice());
break;
}
}
}
}
return param;
}
@Override
public List<MallProductSpecPriceDTO> feignListProductSpecPrice(
ProductSpecPriceQO productSpecPriceQO) {
Set<Integer> ids = new HashSet<>(productSpecPriceQO.getProductSpecIds());
List<MallProductSpecPriceDTO> mallProductSpecPriceDTOS =
productSpecPriceQO.getProductSpecIds().stream()
.map(
d -> {
MallProductSpecPriceDTO mallProductSpecPriceDTO = new MallProductSpecPriceDTO();
mallProductSpecPriceDTO.setProductSpecId(d);
return mallProductSpecPriceDTO;
})
.collect(Collectors.toList());
// 分别找出渠道价格和市场价格
List<ProductSpecPriceDO> productSpecPriceDOS =
productDao.listProductSpecPrice(productSpecPriceQO.getChannelClass(), ids);
List<ProductSpecPriceDO> productSpecPriceDOS1 = productDao.listProductSpecPrice(0, ids);
// 设置合作价格
for (ProductSpecPriceDO productSpecPriceDO : productSpecPriceDOS) {
for (MallProductSpecPriceDTO mallProductSpecPriceDTO : mallProductSpecPriceDTOS) {
if (mallProductSpecPriceDTO
.getProductSpecId()
.equals(productSpecPriceDO.getProductSpecId())) {
mallProductSpecPriceDTO.setOpPrice(productSpecPriceDO.getPrice());
break;
}
//设置市场价格
for (ProductSpecPriceDO productSpecPriceDO : productSpecPriceDOS1) {
for (MallProductSpecPriceDTO mallProductSpecPriceDTO : mallProductSpecPriceDTOS) {
if (mallProductSpecPriceDTO.getProductSpecId().equals(productSpecPriceDO.getProductSpecId())) {
mallProductSpecPriceDTO.setMkPrice(productSpecPriceDO.getPrice());
break;
}
}
}
}
// 设置市场价格
for (ProductSpecPriceDO productSpecPriceDO : productSpecPriceDOS1) {
for (MallProductSpecPriceDTO mallProductSpecPriceDTO : mallProductSpecPriceDTOS) {
if (mallProductSpecPriceDTO
.getProductSpecId()
.equals(productSpecPriceDO.getProductSpecId())) {
mallProductSpecPriceDTO.setMkPrice(productSpecPriceDO.getPrice());
break;
}
return mallProductSpecPriceDTOS;
}
}
return mallProductSpecPriceDTOS;
}
@Override
public ProductSpecPriceDTO feignGetUnitPriceByTag(Integer id, Integer tagId) {
ProductSpecPriceDTO price = productDao.feignGetUnitPrice(id, tagId);
return price;
}
@Override
public ProductSpecPriceDTO feignGetUnitPriceByTag(Integer id, Integer tagId) {
ProductSpecPriceDTO price = productDao.feignGetUnitPrice(id, tagId);
return price;
@Override
public List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(
MallOrderGoodsInfoQO mallOrderGoodsInfoQO) {
// 查询渠道等级对应的商品价格
Set<Integer> prodSkuSpecIds =
productDao.listProductSpecIds(mallOrderGoodsInfoQO.getMallProdSkuSpecIds());
List<ProductSpecPriceDO> productSpecPriceDOS =
productDao.listProductSpecPrice(mallOrderGoodsInfoQO.getCooperationTagId(), prodSkuSpecIds);
// 查询商品信息
List<OrderGoodsProdDTO> orderGoodsProdDTOList =
productDao.listProdGoodsSkuInfo(mallOrderGoodsInfoQO);
if (!CollectionUtils.isEmpty(productSpecPriceDOS)) {
// 填充渠道价格
this.fillOrderGoodsProdPrice(orderGoodsProdDTOList, productSpecPriceDOS, prodSkuSpecIds);
}
// 商品没有设置渠道价格的,按照市场价设置
if (!CollectionUtils.isEmpty(prodSkuSpecIds)) {
// 查询市场价格,tagInfoId为0
List<ProductSpecPriceDO> prodMarketPrice = productDao.listProductSpecPrice(0, prodSkuSpecIds);
// 填充市场价格
this.fillOrderGoodsProdPrice(orderGoodsProdDTOList, prodMarketPrice, prodSkuSpecIds);
}
// 还需配置商品规格金额, 单个商品skuSpecAmount, 全部小sku金额
List<Integer> goodsIds =
orderGoodsProdDTOList.stream()
.map(OrderGoodsProdDTO::getGoodsInfoId)
.collect(Collectors.toList());
// 拼装商品服务
List<GoodsServiceDTO> services =
goodsInfoDao.listGoodsService(goodsIds).stream()
.map(d -> d.buildGoodsServiceDTO())
.collect(Collectors.toList());
Map<Integer, List<GoodsServiceDTO>> mapGoodsService =
org.springframework.util.CollectionUtils.isEmpty(services)
? null
: services.stream().collect(Collectors.groupingBy(GoodsServiceDTO::getGoodsInfoId));
List<OrderGoodsProdDTO> collect =
orderGoodsProdDTOList.stream()
.map(
d -> {
OrderGoodsProdDTO orderGoodsProdDTO = d;
if (mapGoodsService != null && mapGoodsService.containsKey(d.getGoodsInfoId())) {
orderGoodsProdDTO.setServices(mapGoodsService.get(d.getGoodsInfoId()));
}
return orderGoodsProdDTO;
})
.collect(Collectors.toList());
return collect;
}
@Override
public List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO) {
//查询渠道等级对应的商品价格
Set<Integer> prodSkuSpecIds = productDao.listProductSpecIds(mallOrderGoodsInfoQO.getMallProdSkuSpecIds());
List<ProductSpecPriceDO> productSpecPriceDOS = productDao.listProductSpecPrice(mallOrderGoodsInfoQO.getCooperationTagId(), prodSkuSpecIds);
//查询商品信息
List<OrderGoodsProdDTO> orderGoodsProdDTOList = productDao.listProdGoodsSkuInfo(mallOrderGoodsInfoQO);
if (!CollectionUtils.isEmpty(productSpecPriceDOS)) {
//填充渠道价格
this.fillOrderGoodsProdPrice(orderGoodsProdDTOList, productSpecPriceDOS, prodSkuSpecIds);
}
//还需配置商品规格金额, 单个商品skuSpecAmount, 全部小sku金额
List<Integer> goodsIds = orderGoodsProdDTOList.stream().map(OrderGoodsProdDTO::getGoodsInfoId).collect(Collectors.toList());
// 拼装商品服务
List<GoodsServiceDTO> services = goodsInfoDao.listGoodsService(goodsIds).stream().map(d -> d.buildGoodsServiceDTO()).collect(Collectors.toList());
Map<Integer, List<GoodsServiceDTO>> mapGoodsService = org.springframework.util.CollectionUtils.isEmpty(services) ? null
: services.stream()
.collect(Collectors.groupingBy(GoodsServiceDTO::getGoodsInfoId));
List<OrderGoodsProdDTO> collect = orderGoodsProdDTOList.stream().map(d -> {
OrderGoodsProdDTO orderGoodsProdDTO = d;
if (mapGoodsService != null && mapGoodsService.containsKey(d.getGoodsInfoId())) {
orderGoodsProdDTO.setServices(mapGoodsService.get(d.getGoodsInfoId()));
}
return orderGoodsProdDTO;
}).collect(Collectors.toList());
return collect;
}
/**
* 填充产品规格价格
*
* @param orderGoodsProdDTOList
* @param productSpecPriceDOS
* @param prodSkuSpecIds
* @return
*/
private List<OrderGoodsProdDTO> fillOrderGoodsProdPrice(List<OrderGoodsProdDTO> orderGoodsProdDTOList, List<ProductSpecPriceDO> productSpecPriceDOS, Set<Integer> prodSkuSpecIds) {
for (OrderGoodsProdDTO orderGoodsProdDTO : orderGoodsProdDTOList) {
for (OrderGoodsProdDetailDTO orderGoodsProdDetailDTO : orderGoodsProdDTO.getOrderGoodsProdDetailDTOS()) {
//配置价格
for (ProductSpecPriceDO productSpecPriceDO : productSpecPriceDOS) {
//找到规格对应的价格
if (productSpecPriceDO.getProductSpecId().toString().equals(orderGoodsProdDetailDTO.getProductSpecId().toString())) {
orderGoodsProdDetailDTO.setUnitPrice(productSpecPriceDO.getPrice());
//配置价格后移除,剩余没有配置的
prodSkuSpecIds.removeIf(d -> d.toString().equals(orderGoodsProdDetailDTO.getProductSpecId().toString()));
break;
}
}
}
}
return orderGoodsProdDTOList;
}
@Override
public List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO) {
//查询商品信息
List<MallGoodsInfoSimpleDO> mallGoodsInfoSimpleDOS = goodsInfoDao.listMallGoodsIndstSimpleInfo(mallOrderGoodsInfoQO.getMallIndstSkuSpecIds());
List<Integer> industrySpecIds = goodsInfoDao.listIndustrySpecIds(mallOrderGoodsInfoQO.getMallIndstSkuSpecIds());
//查询商品价格
List<IndustrySpecPriceDO> industrySpecPriceDOS = industrySpecDao.listIndustrySpecPrice(mallOrderGoodsInfoQO.getCooperationTagId(), industrySpecIds);
//查询商品行业规格对应的产品清单
List<MallGoodsProductDO> mallGoodsProductDOS = goodsInfoDao.listIndustryProductList(industrySpecIds);
//配置商品行业规格价格
this.fillOrderGoodsIndstPrice(mallGoodsInfoSimpleDOS, industrySpecPriceDOS, industrySpecIds);
if (!CollectionUtils.isEmpty(industrySpecIds)) {
//查询商品价格,找出市场价
List<IndustrySpecPriceDO> industryMarketPrice = industrySpecDao.listIndustrySpecPrice(0, industrySpecIds);
this.fillOrderGoodsIndstPrice(mallGoodsInfoSimpleDOS, industryMarketPrice, industrySpecIds);
}
//配置产品清单
for (MallGoodsInfoSimpleDO mallGoodsInfoSimpleDO : mallGoodsInfoSimpleDOS) {
for (MallGoodsSpecSimpleDO mallGoodsSpecSimpleDO : mallGoodsInfoSimpleDO.getMallGoodsSpecSimpleDOS()) {
mallGoodsSpecSimpleDO.setMallGoodsProductDOS(new ArrayList<MallGoodsProductDO>());
//从产品清单中拿出对应的方案规格里面
for (MallGoodsProductDO mallGoodsProductDO : mallGoodsProductDOS) {
if (mallGoodsProductDO.getIndustrySpecId().toString().equals(mallGoodsSpecSimpleDO.getIndustrySpecId().toString())) {
mallGoodsSpecSimpleDO.getMallGoodsProductDOS().add(mallGoodsProductDO);
}
}
}
/**
* 填充产品规格价格
*
* @param orderGoodsProdDTOList
* @param productSpecPriceDOS
* @param prodSkuSpecIds
* @return
*/
private List<OrderGoodsProdDTO> fillOrderGoodsProdPrice(
List<OrderGoodsProdDTO> orderGoodsProdDTOList,
List<ProductSpecPriceDO> productSpecPriceDOS,
Set<Integer> prodSkuSpecIds) {
for (OrderGoodsProdDTO orderGoodsProdDTO : orderGoodsProdDTOList) {
for (OrderGoodsProdDetailDTO orderGoodsProdDetailDTO :
orderGoodsProdDTO.getOrderGoodsProdDetailDTOS()) {
// 配置价格
for (ProductSpecPriceDO productSpecPriceDO : productSpecPriceDOS) {
// 找到规格对应的价格
if (productSpecPriceDO
.getProductSpecId()
.toString()
.equals(orderGoodsProdDetailDTO.getProductSpecId().toString())) {
orderGoodsProdDetailDTO.setUnitPrice(productSpecPriceDO.getPrice());
// 配置价格后移除,剩余没有配置的
prodSkuSpecIds.removeIf(
d -> d.toString().equals(orderGoodsProdDetailDTO.getProductSpecId().toString()));
break;
}
}
//转换对象
List<OrderGoodsIndstDTO> collect = mallGoodsInfoSimpleDOS.stream().map(d -> d.buildOrderGoodsIndstDTO()).collect(Collectors.toList());
// 拼装商品服务
List<Integer> goodsIds = collect.stream().map(OrderGoodsIndstDTO::getGoodsInfoId).collect(Collectors.toList());
List<GoodsServiceDTO> services = goodsInfoDao.listGoodsService(goodsIds).stream().map(d -> d.buildGoodsServiceDTO()).collect(Collectors.toList());
Map<Integer, List<GoodsServiceDTO>> mapGoodsService = org.springframework.util.CollectionUtils.isEmpty(services) ? null
: services.stream()
.collect(Collectors.groupingBy(GoodsServiceDTO::getGoodsInfoId));
List<OrderGoodsIndstDTO> resultList = collect.stream().map(d -> {
OrderGoodsIndstDTO orderGoodsIndstDTO = d;
if (mapGoodsService != null && mapGoodsService.containsKey(d.getGoodsInfoId())) {
orderGoodsIndstDTO.setServices(mapGoodsService.get(d.getGoodsInfoId()));
}
return orderGoodsIndstDTO;
}).collect(Collectors.toList());
return resultList;
}
private List<MallGoodsInfoSimpleDO> fillOrderGoodsIndstPrice(List<MallGoodsInfoSimpleDO> mallGoodsInfoSimpleDOS, List<IndustrySpecPriceDO> industrySpecPriceDOS, List<Integer> industrySpecIds) {
//配置商品行业规格价格
for (MallGoodsInfoSimpleDO mallGoodsInfoSimpleDO : mallGoodsInfoSimpleDOS) {
for (MallGoodsSpecSimpleDO mallGoodsSpecSimpleDO : mallGoodsInfoSimpleDO.getMallGoodsSpecSimpleDOS()) {
//查询规格进行配置
for (IndustrySpecPriceDO industrySpecPriceDO : industrySpecPriceDOS) {
if (mallGoodsSpecSimpleDO.getIndustrySpecId().toString().equals(industrySpecPriceDO.getIndustrySpecId().toString())) {
mallGoodsSpecSimpleDO.setUnitPrice(industrySpecPriceDO.getPrice());
industrySpecIds.removeIf(d -> d.toString().equals(industrySpecPriceDO.getIndustrySpecId().toString()));
break;
}
}
}
}
}
return orderGoodsProdDTOList;
}
@Override
public List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(
MallOrderGoodsInfoQO mallOrderGoodsInfoQO) {
// 查询商品信息
List<MallGoodsInfoSimpleDO> mallGoodsInfoSimpleDOS =
goodsInfoDao.listMallGoodsIndstSimpleInfo(mallOrderGoodsInfoQO.getMallIndstSkuSpecIds());
List<Integer> industrySpecIds =
goodsInfoDao.listIndustrySpecIds(mallOrderGoodsInfoQO.getMallIndstSkuSpecIds());
// 查询商品价格
List<IndustrySpecPriceDO> industrySpecPriceDOS =
industrySpecDao.listIndustrySpecPrice(
mallOrderGoodsInfoQO.getCooperationTagId(), industrySpecIds);
// 查询商品行业规格对应的产品清单
List<MallGoodsProductDO> mallGoodsProductDOS =
goodsInfoDao.listIndustryProductList(industrySpecIds);
// 配置商品行业规格价格
this.fillOrderGoodsIndstPrice(mallGoodsInfoSimpleDOS, industrySpecPriceDOS, industrySpecIds);
if (!CollectionUtils.isEmpty(industrySpecIds)) {
// 查询商品价格,找出市场价
List<IndustrySpecPriceDO> industryMarketPrice =
industrySpecDao.listIndustrySpecPrice(0, industrySpecIds);
this.fillOrderGoodsIndstPrice(mallGoodsInfoSimpleDOS, industryMarketPrice, industrySpecIds);
}
// 配置产品清单
for (MallGoodsInfoSimpleDO mallGoodsInfoSimpleDO : mallGoodsInfoSimpleDOS) {
for (MallGoodsSpecSimpleDO mallGoodsSpecSimpleDO :
mallGoodsInfoSimpleDO.getMallGoodsSpecSimpleDOS()) {
mallGoodsSpecSimpleDO.setMallGoodsProductDOS(new ArrayList<MallGoodsProductDO>());
// 从产品清单中拿出对应的方案规格里面
for (MallGoodsProductDO mallGoodsProductDO : mallGoodsProductDOS) {
if (mallGoodsProductDO
.getIndustrySpecId()
.toString()
.equals(mallGoodsSpecSimpleDO.getIndustrySpecId().toString())) {
mallGoodsSpecSimpleDO.getMallGoodsProductDOS().add(mallGoodsProductDO);
}
}
return mallGoodsInfoSimpleDOS;
}
}
}
// 转换对象
List<OrderGoodsIndstDTO> collect =
mallGoodsInfoSimpleDOS.stream()
.map(d -> d.buildOrderGoodsIndstDTO())
.collect(Collectors.toList());
// 拼装商品服务
List<Integer> goodsIds =
collect.stream().map(OrderGoodsIndstDTO::getGoodsInfoId).collect(Collectors.toList());
List<GoodsServiceDTO> services =
goodsInfoDao.listGoodsService(goodsIds).stream()
.map(d -> d.buildGoodsServiceDTO())
.collect(Collectors.toList());
Map<Integer, List<GoodsServiceDTO>> mapGoodsService =
org.springframework.util.CollectionUtils.isEmpty(services)
? null
: services.stream().collect(Collectors.groupingBy(GoodsServiceDTO::getGoodsInfoId));
List<OrderGoodsIndstDTO> resultList =
collect.stream()
.map(
d -> {
OrderGoodsIndstDTO orderGoodsIndstDTO = d;
if (mapGoodsService != null && mapGoodsService.containsKey(d.getGoodsInfoId())) {
orderGoodsIndstDTO.setServices(mapGoodsService.get(d.getGoodsInfoId()));
}
return orderGoodsIndstDTO;
})
.collect(Collectors.toList());
return resultList;
}
private List<MallGoodsInfoSimpleDO> fillOrderGoodsIndstPrice(
List<MallGoodsInfoSimpleDO> mallGoodsInfoSimpleDOS,
List<IndustrySpecPriceDO> industrySpecPriceDOS,
List<Integer> industrySpecIds) {
// 配置商品行业规格价格
for (MallGoodsInfoSimpleDO mallGoodsInfoSimpleDO : mallGoodsInfoSimpleDOS) {
for (MallGoodsSpecSimpleDO mallGoodsSpecSimpleDO :
mallGoodsInfoSimpleDO.getMallGoodsSpecSimpleDOS()) {
// 查询规格进行配置
for (IndustrySpecPriceDO industrySpecPriceDO : industrySpecPriceDOS) {
if (mallGoodsSpecSimpleDO
.getIndustrySpecId()
.toString()
.equals(industrySpecPriceDO.getIndustrySpecId().toString())) {
mallGoodsSpecSimpleDO.setUnitPrice(industrySpecPriceDO.getPrice());
industrySpecIds.removeIf(
d -> d.toString().equals(industrySpecPriceDO.getIndustrySpecId().toString()));
break;
}
}
}
}
return mallGoodsInfoSimpleDOS;
}
@Override
public PageResult listPageGoodsInfo(MallGoodsQO param) {
int count = goodsInfoDao.countListGoodsInfo(param);
if (count == 0) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
}
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<GoodsInfo> goodsInfo = goodsInfoDao.listGoodsInfo(param);
List<GoodsInfoListDTO> pageList =
goodsInfo.stream().map(GoodsInfo::buildGoodsInfoListDTO).collect(Collectors.toList());
return PageResult.buildPage(pageNo, param.getPageSize(), count, pageList);
}
@Override
public ResultBody batchOnShelfOrTakeDown(List<Integer> ids, Integer status) {
goodsInfoDao.batchUpOrDownWare(ids, status);
return ResultBody.success();
}
@Override
public ResultBody batchRemoveWareInfo(List<Integer> ids) {
goodsInfoDao.removeWareInfo(ids);
return ResultBody.success();
}
}
package com.mmc.pms.service.Impl;
import com.mmc.pms.dao.InspComtDao;
import com.mmc.pms.entity.InspComtDO;
import com.mmc.pms.service.InspComtService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 评论表 服务实现类
* </p>
*
* @author Pika
* @since 2023-06-09
*/
@Service
public class InspComtServiceImpl implements InspComtService {
@Autowired
private InspComtDao inspComtDao;
@Override
public List<InspComtDO> randomGetInspComtList(Integer size) {
return inspComtDao.randomGetInspComtList(size);
}
}
......@@ -3,12 +3,9 @@ package com.mmc.pms.service.Impl;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.dao.MiniProgramProductMallDao;
import com.mmc.pms.dao.WebDeviceDao;
import com.mmc.pms.entity.*;
import com.mmc.pms.model.qo.GoodsInfoQO;
import com.mmc.pms.model.sale.dto.*;
import com.mmc.pms.model.sale.vo.GoodsProductSkuVO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.MiniProgramProductMallService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -26,210 +23,184 @@ import java.util.stream.Collectors;
@Service
public class MiniProgramProductMallServiceImpl implements MiniProgramProductMallService {
@Autowired
private MiniProgramProductMallDao goodsInfoDao;
@Autowired
private WebDeviceDao webDeviceDao;
@Autowired private MiniProgramProductMallDao goodsInfoDao;
@Override
public ResultBody getAppGoodsInfoDetail(Integer goodsId) {
// 查询此商品是否下架或删除
GoodsInfoDO goodsInfoDO = goodsInfoDao.getGoodsInfoByGoodsId(goodsId);
if (goodsInfoDO == null || goodsInfoDO.getShelfStatus().equals(0)) {
return ResultBody.error(ResultEnum.SHOP_GOODS_NOT_ERROR);
}
AppGoodsInfoDetailDTO appGoodsInfoDetailDTO = new AppGoodsInfoDetailDTO();
appGoodsInfoDetailDTO
.setId(goodsInfoDO.getId())
.setGoodsName(goodsInfoDO.getGoodsName())
.setGoodsVideoId(goodsInfoDO.getGoodsVideoId())
.setMasterTypeId(goodsInfoDO.getMasterTypeId())
.setRepoId(goodsInfoDO.getRepoId())
.setSortTypeId(goodsInfoDO.getSortTypeId())
.setShelfStatus(goodsInfoDO.getShelfStatus())
.setSlaveTypeId(goodsInfoDO.getSlaveTypeId())
.setShareFlyServiceId(goodsInfoDO.getShareFlyServiceId())
.setGoodsVideo(goodsInfoDO.getVideoUrl())
.setTag(goodsInfoDO.getTag())
.setPid(goodsInfoDO.getPid());
// 获取商品图片信息
List<GoodsImgDO> goodsImgDO = goodsInfoDao.listGoodsInfoByGoodsId(goodsId);
appGoodsInfoDetailDTO.setImages(
goodsImgDO.stream().map(GoodsImgDO::buildGoodsImgDTO).collect(Collectors.toList()));
// 获取商品详情信息
GoodsDetailDO goodsDetailDO = goodsInfoDao.getGoodsDetailByGoodsId(goodsId);
appGoodsInfoDetailDTO.setGoodsDetail(goodsDetailDO.buildGoodsDetailInfoDTO());
// 获取其他服务信息
List<GoodsServiceDO> goodsServiceDO = goodsInfoDao.listGoodsServiceByGoodsId(goodsId);
appGoodsInfoDetailDTO.setOtherService(
goodsServiceDO.stream()
.map(GoodsServiceDO::buildGoodsOtherServiceDTO)
.collect(Collectors.toList()));
// 判断商品是什么类型
if (!goodsInfoDO.getSortTypeId().equals(2)) {
// 获取该商品绑定的sku信息
List<MallProdInfoDO> mallProdSkuInfo = goodsInfoDao.getMallProdInfoByGoodsId(goodsId);
// 获取该商品绑定的规格信息
List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpecList =
goodsInfoDao.listMallProdSkuInfoSpec(goodsId);
Map<Integer, List<MallProdSkuInfoSpecDO>> specMap =
mallProdSkuInfoSpecList.stream()
.collect(Collectors.groupingBy(MallProdSkuInfoSpecDO::getMallProdSkuInfoId));
List<GoodsSpecDTO> list =
mallProdSkuInfo.stream()
.map(
d -> {
// 获取sku下规格信息
List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpecDOList = specMap.get(d.getId());
List<ProductSpecDO> productSpecList =
goodsInfoDao.listProductSpecInfo(
mallProdSkuInfoSpecDOList.stream()
.map(MallProdSkuInfoSpecDO::getProductSpecId)
.collect(Collectors.toList()));
List<MallProductSpecDTO> collect =
productSpecList.stream()
.map(ProductSpecDO::buildMallProductSpecDTO)
.collect(Collectors.toList());
collect.stream()
.peek(
m -> {
for (MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO :
mallProdSkuInfoSpecDOList) {
if (m.getProductSpec()
.equals(mallProdSkuInfoSpecDO.getProductSpecId())) {
m.setId(mallProdSkuInfoSpecDO.getId());
break;
}
}
})
.collect(Collectors.toList());
GoodsSpecDTO goodsSpecDTO = new GoodsSpecDTO();
goodsSpecDTO
.setId(d.getId())
.setSkuId(d.getProdSkuId())
.setGoodsSpecName(d.getProdSkuSpecName())
.setSkuName(d.getProductSkuName())
.setBrandInfoId(d.getBrandInfoId())
.setCategoryId(d.getCategoriesId())
.setTypeName(d.getTypeName())
.setChooseType(d.getChooseType())
.setSkuUnitId(d.getSkuUnitId())
.setUnitName(d.getUnitName())
.setMust(d.getMust())
.setProductSpecList(collect);
return goodsSpecDTO;
})
@Override
public ResultBody getAppGoodsInfoDetail(Integer goodsId) {
// 查询此商品是否下架或删除
GoodsInfoDO goodsInfoDO = goodsInfoDao.getGoodsInfoByGoodsId(goodsId);
if (goodsInfoDO == null || goodsInfoDO.getShelfStatus().equals(0)) {
return ResultBody.error(ResultEnum.SHOP_GOODS_NOT_ERROR);
}
AppGoodsInfoDetailDTO appGoodsInfoDetailDTO = new AppGoodsInfoDetailDTO();
appGoodsInfoDetailDTO
.setId(goodsInfoDO.getId())
.setGoodsName(goodsInfoDO.getGoodsName())
.setGoodsVideoId(goodsInfoDO.getGoodsVideoId())
.setMasterTypeId(goodsInfoDO.getMasterTypeId())
.setRepoId(goodsInfoDO.getRepoId())
.setSortTypeId(goodsInfoDO.getSortTypeId())
.setShelfStatus(goodsInfoDO.getShelfStatus())
.setSlaveTypeId(goodsInfoDO.getSlaveTypeId())
.setShareFlyServiceId(goodsInfoDO.getShareFlyServiceId())
.setGoodsVideo(goodsInfoDO.getVideoUrl())
.setTag(goodsInfoDO.getTag())
.setPid(goodsInfoDO.getPid());
// 获取商品图片信息
List<GoodsImgDO> goodsImgDO = goodsInfoDao.listGoodsInfoByGoodsId(goodsId);
appGoodsInfoDetailDTO.setImages(
goodsImgDO.stream().map(GoodsImgDO::buildGoodsImgDTO).collect(Collectors.toList()));
// 获取商品详情信息
GoodsDetailDO goodsDetailDO = goodsInfoDao.getGoodsDetailByGoodsId(goodsId);
appGoodsInfoDetailDTO.setGoodsDetail(goodsDetailDO.buildGoodsDetailInfoDTO());
// 获取其他服务信息
List<GoodsServiceDO> goodsServiceDO = goodsInfoDao.listGoodsServiceByGoodsId(goodsId);
appGoodsInfoDetailDTO.setOtherService(
goodsServiceDO.stream()
.map(GoodsServiceDO::buildGoodsOtherServiceDTO)
.collect(Collectors.toList()));
// 判断商品是什么类型
if (!goodsInfoDO.getSortTypeId().equals(2)) {
// 获取该商品绑定的sku信息
List<MallProdInfoDO> mallProdSkuInfo = goodsInfoDao.getMallProdInfoByGoodsId(goodsId);
// 获取该商品绑定的规格信息
List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpecList =
goodsInfoDao.listMallProdSkuInfoSpec(goodsId);
Map<Integer, List<MallProdSkuInfoSpecDO>> specMap =
mallProdSkuInfoSpecList.stream()
.collect(Collectors.groupingBy(MallProdSkuInfoSpecDO::getMallProdSkuInfoId));
List<GoodsSpecDTO> list =
mallProdSkuInfo.stream()
.map(
d -> {
// 获取sku下规格信息
List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpecDOList = specMap.get(d.getId());
List<ProductSpecDO> productSpecList =
goodsInfoDao.listProductSpecInfo(
mallProdSkuInfoSpecDOList.stream()
.map(MallProdSkuInfoSpecDO::getProductSpecId)
.collect(Collectors.toList()));
List<MallProductSpecDTO> collect =
productSpecList.stream()
.map(ProductSpecDO::buildMallProductSpecDTO)
.collect(Collectors.toList());
appGoodsInfoDetailDTO.setGoodsSpec(list);
} else {
appGoodsInfoDetailDTO.setGoodsSpec(getIndustrySpecInfo(goodsId));
}
return ResultBody.success(appGoodsInfoDetailDTO);
collect.stream()
.peek(
m -> {
for (MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO :
mallProdSkuInfoSpecDOList) {
if (m.getProductSpec()
.equals(mallProdSkuInfoSpecDO.getProductSpecId())) {
m.setId(mallProdSkuInfoSpecDO.getId());
break;
}
}
})
.collect(Collectors.toList());
GoodsSpecDTO goodsSpecDTO = new GoodsSpecDTO();
goodsSpecDTO
.setId(d.getId())
.setSkuId(d.getProdSkuId())
.setGoodsSpecName(d.getProdSkuSpecName())
.setSkuName(d.getProductSkuName())
.setBrandInfoId(d.getBrandInfoId())
.setCategoryId(d.getCategoriesId())
.setTypeName(d.getTypeName())
.setChooseType(d.getChooseType())
.setSkuUnitId(d.getSkuUnitId())
.setUnitName(d.getUnitName())
.setMust(d.getMust())
.setProductSpecList(collect);
return goodsSpecDTO;
})
.collect(Collectors.toList());
appGoodsInfoDetailDTO.setGoodsSpec(list);
} else {
appGoodsInfoDetailDTO.setGoodsSpec(getIndustrySpecInfo(goodsId));
}
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));
private List<GoodsSpecDTO> getIndustrySpecInfo(Integer goodsInfoId) {
// 获取商品对应绑定的行业sku信息
List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList =
goodsInfoDao.getMallIndustrySkuInfo(goodsInfoId);
List<GoodsSpecDTO> list =
mallIndustrySkuInfoList.stream()
.map(MallIndustrySkuInfoDO::buildGoodsSpecDTO)
.collect(Collectors.toList());
// 根据商品id查出该商品下绑定的规格信息
List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpec =
goodsInfoDao.getIndustrySkuInfoSpec(goodsInfoId);
list =
list.stream()
.peek(
d -> {
List<MallIndustrySpecDTO> industrySpec = new ArrayList<>();
for (MallIndustrySkuInfoSpecDO e : mallIndustrySkuInfoSpec) {
if (d.getId().equals(e.getMallIndustrySkuInfoId())) {
IndustrySpecDO industrySpecDO = e.getIndustrySpecDO();
// 获取商品清单信息
List<IndustryProductInventoryDO> industryProdInventory =
goodsInfoDao.getIndustryProductInventory(e.getIndustrySpecId());
List<ProductInventoryVO> productInventoryList = new ArrayList<>();
// 获取行业规格绑定的产品规格信息
List<InventorySpecDO> inventorySpecDOList =
goodsInfoDao.listInventorySpec(
industryProdInventory.stream()
.map(IndustryProductInventoryDO::getId)
.collect(Collectors.toList()));
Map<Integer, List<InventorySpecDO>> inventoryMap =
inventorySpecDOList.stream()
.collect(
Collectors.groupingBy(
InventorySpecDO::getIndustryProductInventoryId));
getIndustrySpecOnProdSpecInfo(
industryProdInventory, productInventoryList, inventoryMap);
MallIndustrySpecDTO industrySpecDTO =
industrySpecDO.buildMallIndustrySpecDTO();
industrySpecDTO.setId(e.getId());
industrySpecDTO.setIndustrySpecId(e.getIndustrySpecId());
industrySpecDTO.setIndustrySkuId(d.getSkuId());
industrySpecDTO.setProductInventoryList(productInventoryList);
industrySpec.add(industrySpecDTO);
}
break;
}
}
if (appGoodsInfoDTO.getShelfStatus() == 1) {
pageList.add(appGoodsInfoDTO);
}
}
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, pageList));
}
}
d.setIndustrySpecList(industrySpec);
})
.collect(Collectors.toList());
return list;
}
private List<GoodsSpecDTO> getIndustrySpecInfo(Integer goodsInfoId) {
// 获取商品对应绑定的行业sku信息
List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList = goodsInfoDao.getMallIndustrySkuInfo(goodsInfoId);
List<GoodsSpecDTO> list = mallIndustrySkuInfoList.stream().map(MallIndustrySkuInfoDO::buildGoodsSpecDTO).collect(Collectors.toList());
// 根据商品id查出该商品下绑定的规格信息
List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpec = goodsInfoDao.getIndustrySkuInfoSpec(goodsInfoId);
list = list.stream().peek(d -> {
List<MallIndustrySpecDTO> industrySpec = new ArrayList<>();
for (MallIndustrySkuInfoSpecDO e : mallIndustrySkuInfoSpec) {
if (d.getId().equals(e.getMallIndustrySkuInfoId())) {
IndustrySpecDO industrySpecDO = e.getIndustrySpecDO();
// 获取商品清单信息
List<IndustryProductInventoryDO> industryProdInventory = goodsInfoDao.getIndustryProductInventory(e.getIndustrySpecId());
List<ProductInventoryVO> productInventoryList = new ArrayList<>();
// 获取行业规格绑定的产品规格信息
List<InventorySpecDO> inventorySpecDOList = goodsInfoDao.listInventorySpec(industryProdInventory.stream().map(IndustryProductInventoryDO::getId).collect(Collectors.toList()));
Map<Integer, List<InventorySpecDO>> inventoryMap = inventorySpecDOList.stream().collect(Collectors.groupingBy(InventorySpecDO::getIndustryProductInventoryId));
getIndustrySpecOnProdSpecInfo(industryProdInventory, productInventoryList, inventoryMap);
MallIndustrySpecDTO industrySpecDTO = industrySpecDO.buildMallIndustrySpecDTO();
industrySpecDTO.setId(e.getId());
industrySpecDTO.setIndustrySpecId(e.getIndustrySpecId());
industrySpecDTO.setIndustrySkuId(d.getSkuId());
industrySpecDTO.setProductInventoryList(productInventoryList);
industrySpec.add(industrySpecDTO);
}
}
d.setIndustrySpecList(industrySpec);
}).collect(Collectors.toList());
return list;
}
private void getIndustrySpecOnProdSpecInfo(
List<IndustryProductInventoryDO> industryProdInventory,
List<ProductInventoryVO> productInventoryList,
Map<Integer, List<InventorySpecDO>> inventoryMap) {
for (IndustryProductInventoryDO industryProductInventoryDO : industryProdInventory) {
List<InventorySpecDO> inventorySpec = inventoryMap.get(industryProductInventoryDO.getId());
if (!CollectionUtils.isEmpty(inventorySpec)) {
List<ProductSpecVO> productSpecList =
inventorySpec.stream()
.map(
in -> {
ProductSpecDO productSpecDetail =
goodsInfoDao.getProductSpecDetail(in.getProductSpecId());
ProductSpecVO productSpecVO = new ProductSpecVO();
BeanUtils.copyProperties(productSpecDetail, productSpecVO);
return productSpecVO;
})
.collect(Collectors.toList());
ProductSkuDO productSkuDetail =
goodsInfoDao.getProductSkuDetail(industryProductInventoryDO.getProductSkuId());
GoodsProductSkuVO goodsProductSkuVO = new GoodsProductSkuVO();
BeanUtils.copyProperties(productSkuDetail, goodsProductSkuVO);
// 添加数据
ProductInventoryVO productInventoryVO = new ProductInventoryVO();
productInventoryVO.setSelect(industryProductInventoryDO.getSelected());
productInventoryVO.setProductSku(goodsProductSkuVO);
productInventoryVO.setProductSpecList(productSpecList);
productInventoryList.add(productInventoryVO);
}
}
private void getIndustrySpecOnProdSpecInfo(
List<IndustryProductInventoryDO> industryProdInventory,
List<ProductInventoryVO> productInventoryList,
Map<Integer, List<InventorySpecDO>> inventoryMap) {
for (IndustryProductInventoryDO industryProductInventoryDO : industryProdInventory) {
List<InventorySpecDO> inventorySpec = inventoryMap.get(industryProductInventoryDO.getId());
if (!CollectionUtils.isEmpty(inventorySpec)) {
List<ProductSpecVO> productSpecList =
inventorySpec.stream()
.map(
in -> {
ProductSpecDO productSpecDetail =
goodsInfoDao.getProductSpecDetail(in.getProductSpecId());
ProductSpecVO productSpecVO = new ProductSpecVO();
BeanUtils.copyProperties(productSpecDetail, productSpecVO);
return productSpecVO;
})
.collect(Collectors.toList());
ProductSkuDO productSkuDetail =
goodsInfoDao.getProductSkuDetail(industryProductInventoryDO.getProductSkuId());
GoodsProductSkuVO goodsProductSkuVO = new GoodsProductSkuVO();
BeanUtils.copyProperties(productSkuDetail, goodsProductSkuVO);
// 添加数据
ProductInventoryVO productInventoryVO = new ProductInventoryVO();
productInventoryVO.setSelect(industryProductInventoryDO.getSelected());
productInventoryVO.setProductSku(goodsProductSkuVO);
productInventoryVO.setProductSpecList(productSpecList);
productInventoryList.add(productInventoryVO);
}
}
}
}
......@@ -11,9 +11,9 @@ import com.mmc.pms.model.sale.dto.*;
import com.mmc.pms.model.sale.vo.ProductSpecCPQVO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.ProductSkuService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
......@@ -27,257 +27,310 @@ import java.util.stream.Collectors;
*/
@Service
public class ProductServiceImpl implements ProductSkuService {
@Autowired
private ProductDao productDao;
@Autowired
private IndustrySpecDao industrySpecDao;
@Autowired private ProductDao productDao;
@Autowired private IndustrySpecDao industrySpecDao;
@Override
public ResultBody addProductSku(ProductSkuVO param) {
// 获取名称判断此前是否已经存在
int count = productDao.countSkuName(param);
if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
ProductSkuDO productSkuDO = new ProductSkuDO(param);
// 新增产品sku
int status = productDao.insertProductSku(productSkuDO);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_ADD_DATA);
}
return ResultBody.success();
@Override
public ResultBody addProductSku(ProductSkuVO param) {
// 获取名称判断此前是否已经存在
int count = productDao.countSkuName(param);
if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
@Override
public ResultBody getProductSkuDetail(Integer id) {
// 校验此sku是否还存在或已删除
int count = productDao.countSkuIsExist(id);
if (count <= 0) {
return ResultBody.error(ResultEnum.SKU_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
}
ProductSkuDO productSkuDO = productDao.getProductSkuDetail(id);
return ResultBody.success(productSkuDO.buildProductSkuDTO());
ProductSkuDO productSkuDO = new ProductSkuDO(param);
productSkuDO.setCustomize(0);
// 新增产品sku
int status = productDao.insertProductSku(productSkuDO);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_ADD_DATA);
}
return ResultBody.success();
}
@Override
public ResultBody editProductSku(ProductSkuVO param) {
// 获取名称判断此前是否已经存在
int count = productDao.countSkuName(param);
if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
ProductSkuDO productSkuDO = new ProductSkuDO(param);
int status = productDao.updateProductSku(productSkuDO);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_EDIT_DATA);
}
return ResultBody.success();
@Override
public ResultBody getProductSkuDetail(Integer id) {
// 校验此sku是否还存在或已删除
int count = productDao.countSkuIsExist(id);
if (count <= 0) {
return ResultBody.error(ResultEnum.SKU_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
}
ProductSkuDO productSkuDO = productDao.getProductSkuDetail(id);
return ResultBody.success(productSkuDO.buildProductSkuDTO());
}
@Override
public ResultBody listPageProductSku(ProductSkuQO productSkuQO) {
int count = productDao.countListPageProductSku(productSkuQO);
if (count == 0) {
return ResultBody.success(PageResult.buildPage(productSkuQO.getPageNo(), productSkuQO.getPageSize(), count));
}
Integer pageNo = productSkuQO.getPageNo();
productSkuQO.buildCurrentPage();
List<ProductSkuDO> productSkuList = productDao.listPageProductSku(productSkuQO);
List<Integer> productSkuIds = productSkuList.stream().map(ProductSkuDO::getId).collect(Collectors.toList());
List<ProductSpecDO> productSpecList = productDao.getProductSpecList(productSkuIds);
Map<Integer, List<ProductSpecDO>> productSpecMap = productSpecList.stream().collect(Collectors.groupingBy(ProductSpecDO::getProductSkuId));
List<ProductSkuDTO> list = productSkuList.stream()
.map(ProductSkuDO::buildProductSkuDTO)
.collect(Collectors.toList());
list.stream().peek(d -> {
List<ProductSpecDO> productSpecDOS = productSpecMap.get(d.getId());
if (CollectionUtils.isEmpty(productSpecDOS)) {
d.setProductSpecList(null);
} else {
d.setProductSpecList(productSpecDOS.stream().map(ProductSpecDO::buildProductSpecDTO).collect(Collectors.toList()));
}
}).collect(Collectors.toList());
return ResultBody.success(PageResult.buildPage(pageNo, productSkuQO.getPageSize(), count, list));
@Override
public ResultBody editProductSku(ProductSkuVO param) {
// 获取名称判断此前是否已经存在
int count = productDao.countSkuName(param);
if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
@Override
public ResultBody addOrEditProductSpec(ProductSpecVO param) {
// 获取名称判断此前是否已经存在
int count = productDao.countSpecName(param);
if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
if (param.getId() == null) {
ProductSpecDO productSpecDO = new ProductSpecDO(param);
// 新增产品sku
int status = productDao.insertProductSpec(productSpecDO);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_ADD_DATA);
}
} else {
ProductSpecDO productSpecDO = new ProductSpecDO(param);
int status = productDao.updateProductSpec(productSpecDO);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_EDIT_DATA);
}
}
return ResultBody.success();
ProductSkuDO productSkuDO = new ProductSkuDO(param);
int status = productDao.updateProductSku(productSkuDO);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_EDIT_DATA);
}
return ResultBody.success();
}
@Override
public ResultBody getProductSpecDetail(Integer id) {
// 校验此sku是否还存在或已删除
int count = productDao.countSpecIsExist(id);
if (count <= 0) {
return ResultBody.error(ResultEnum.SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
}
ProductSpecDO productSpecDO = productDao.getProductSpecDetail(id);
return ResultBody.success(productSpecDO.buildProductSpecDTO());
@Override
public ResultBody listPageProductSku(ProductSkuQO productSkuQO) {
int count = productDao.countListPageProductSku(productSkuQO);
if (count == 0) {
return ResultBody.success(
PageResult.buildPage(productSkuQO.getPageNo(), productSkuQO.getPageSize(), count));
}
Integer pageNo = productSkuQO.getPageNo();
productSkuQO.buildCurrentPage();
List<ProductSkuDO> productSkuList = productDao.listPageProductSku(productSkuQO);
List<Integer> productSkuIds =
productSkuList.stream().map(ProductSkuDO::getId).collect(Collectors.toList());
List<ProductSpecDO> productSpecList = productDao.getProductSpecList(productSkuIds);
Map<Integer, List<ProductSpecDO>> productSpecMap =
productSpecList.stream().collect(Collectors.groupingBy(ProductSpecDO::getProductSkuId));
List<ProductSkuDTO> list =
productSkuList.stream().map(ProductSkuDO::buildProductSkuDTO).collect(Collectors.toList());
list.stream()
.peek(
d -> {
List<ProductSpecDO> productSpecDOS = productSpecMap.get(d.getId());
if (CollectionUtils.isEmpty(productSpecDOS)) {
d.setProductSpecList(null);
} else {
d.setProductSpecList(
productSpecDOS.stream()
.map(ProductSpecDO::buildProductSpecDTO)
.collect(Collectors.toList()));
}
})
.collect(Collectors.toList());
return ResultBody.success(
PageResult.buildPage(pageNo, productSkuQO.getPageSize(), count, list));
}
@Override
public ResultBody listPageProductSpec(Integer pageNo, Integer pageSize, Integer productSkuId) {
int count = productDao.countListPageProductSpec(productSkuId);
if (count == 0) {
return ResultBody.success(PageResult.buildPage(pageNo, pageSize, count));
}
List<ProductSpecDO> productSpecList = productDao.listPageProductSpec((pageNo - 1) * pageSize, pageSize, productSkuId);
List<ProductSpecDTO> list = productSpecList.stream().map(ProductSpecDO::buildProductSpecDTO).collect(Collectors.toList());
return ResultBody.success(PageResult.buildPage(pageNo, pageSize, count, list));
@Override
public ResultBody addOrEditProductSpec(ProductSpecVO param) {
// 获取名称判断此前是否已经存在
int count = productDao.countSpecName(param);
if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
@Override
public ResultBody productSpecCPQ(ProductSpecCPQVO productSpecCPQVO) {
// 判断该规格是否存在
int count = productDao.countSpecIsExist(productSpecCPQVO.getProductSpecId());
if (count <= 0) {
return ResultBody.error(ResultEnum.SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
}
// 批量插入规格销售或租赁价格
return insertSpecPrice(productSpecCPQVO);
if (param.getId() == null) {
ProductSpecDO productSpecDO = new ProductSpecDO(param);
// 新增产品sku
int status = productDao.insertProductSpec(productSpecDO);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_ADD_DATA);
}
} else {
ProductSpecDO productSpecDO = new ProductSpecDO(param);
int status = productDao.updateProductSpec(productSpecDO);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_EDIT_DATA);
}
}
return ResultBody.success();
}
@Override
public List<ProductSpecPriceDO> getProductSpecPriceDOS(ProductSpecCPQVO productSpecCPQVO) {
// 批量插入规格价格
return productSpecCPQVO.getSpecPrice().stream().map(d -> {
ProductSpecPriceDO productSpecPriceDO = new ProductSpecPriceDO();
productSpecPriceDO.setCooperationTag(d.getCooperationTag());
productSpecPriceDO.setPrice(d.getPrice());
productSpecPriceDO.setType(productSpecCPQVO.getType());
productSpecPriceDO.setProductSpecId(productSpecCPQVO.getProductSpecId());
if (productSpecCPQVO.getType().equals(1)) {
productSpecPriceDO.setLeaseTerm(productSpecCPQVO.getLeaseTerm());
}
return productSpecPriceDO;
}).collect(Collectors.toList());
@Override
public ResultBody getProductSpecDetail(Integer id) {
// 校验此sku是否还存在或已删除
int count = productDao.countSpecIsExist(id);
if (count <= 0) {
return ResultBody.error(ResultEnum.SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
}
ProductSpecDO productSpecDO = productDao.getProductSpecDetail(id);
return ResultBody.success(productSpecDO.buildProductSpecDTO());
}
@Override
public ResultBody updateProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO) {
// 先删除原来该规格下的所有价格配置信息
productDao.removeProductSpecCPQ(productSpecCPQVO);
// 批量插入规格销售或租赁价格
return insertSpecPrice(productSpecCPQVO);
@Override
public ResultBody listPageProductSpec(
Integer pageNo, Integer pageSize, Integer productSkuId, String keyword) {
int count = productDao.countListPageProductSpec(productSkuId, keyword);
if (count == 0) {
return ResultBody.success(PageResult.buildPage(pageNo, pageSize, count));
}
List<ProductSpecDO> productSpecList =
productDao.listPageProductSpec((pageNo - 1) * pageSize, pageSize, productSkuId, keyword);
List<Integer> specIds =
productSpecList.stream().map(ProductSpecDO::getId).collect(Collectors.toList());
List<ProductSpecPriceDO> productSpecPrice = productDao.getProductSpecPriceList(specIds);
Map<Integer, List<ProductSpecPriceDO>> priceMap =
productSpecPrice.stream()
.collect(Collectors.groupingBy(ProductSpecPriceDO::getProductSpecId));
List<ProductSpecDTO> list =
productSpecList.stream()
.map(
d -> {
ProductSpecDTO productSpecDTO = d.buildProductSpecDTO();
if (!org.springframework.util.CollectionUtils.isEmpty(priceMap.get(d.getId()))) {
productSpecDTO.setPriceList(
priceMap.get(d.getId()).stream()
.map(ProductSpecPriceDO::buildProductSpecPriceDTO)
.collect(Collectors.toList()));
}
return productSpecDTO;
})
.collect(Collectors.toList());
return ResultBody.success(PageResult.buildPage(pageNo, pageSize, count, list));
}
@NotNull
public ResultBody insertSpecPrice(ProductSpecCPQVO productSpecCPQVO) {
List<ProductSpecPriceDO> list = getProductSpecPriceDOS(productSpecCPQVO);
// 批量插入规格销售价格
if (productSpecCPQVO.getType().equals(0)) {
int status = productDao.batchInsertSpecPrice(list);
if (status <= 0) {
return ResultBody.error(ResultEnum.FAILED_TO_ADD_DATA);
}
} else {
// 批量插入租赁价格
productDao.batchInsertLeaseSpecPrice(list);
}
return ResultBody.success();
@Override
public ResultBody productSpecCPQ(ProductSpecCPQVO productSpecCPQVO) {
// 判断该规格是否存在
int count = productDao.countSpecIsExist(productSpecCPQVO.getProductSpecId());
if (count <= 0) {
return ResultBody.error(ResultEnum.SPEC_DOES_NOT_EXIST_OR_HAS_BEEN_DELETED);
}
// 批量插入规格销售或租赁价格
return insertSpecPrice(productSpecCPQVO);
}
@Override
public List<ProductSpecPriceDO> getProductSpecPriceDOS(ProductSpecCPQVO productSpecCPQVO) {
// 批量插入规格价格
return productSpecCPQVO.getSpecPrice().stream()
.map(
d -> {
ProductSpecPriceDO productSpecPriceDO = new ProductSpecPriceDO();
productSpecPriceDO.setCooperationTag(d.getCooperationTag());
productSpecPriceDO.setPrice(d.getPrice());
productSpecPriceDO.setType(productSpecCPQVO.getType());
productSpecPriceDO.setProductSpecId(productSpecCPQVO.getProductSpecId());
if (productSpecCPQVO.getType().equals(1)) {
productSpecPriceDO.setLeaseTerm(productSpecCPQVO.getLeaseTerm());
}
return productSpecPriceDO;
})
.collect(Collectors.toList());
}
@Override
public ResultBody updateProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO) {
// 先删除原来该规格下的所有价格配置信息
productDao.removeProductSpecCPQ(productSpecCPQVO);
// 批量插入规格销售或租赁价格
return insertSpecPrice(productSpecCPQVO);
}
@Override
public ResultBody getProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO) {
if (productSpecCPQVO.getType().equals(1) && productSpecCPQVO.getLeaseTerm() == null) {
return ResultBody.error("租赁期限不能为空!");
}
List<ProductSpecPriceDO> productSpecPriceList = productDao.getProductSpecPrice(productSpecCPQVO);
List<ProductSpecPriceDTO> list = productSpecPriceList.stream()
.map(ProductSpecPriceDO::buildProductSpecPriceDTO).collect(Collectors.toList());
return ResultBody.success(list);
@NotNull
public ResultBody insertSpecPrice(ProductSpecCPQVO productSpecCPQVO) {
List<ProductSpecPriceDO> list = getProductSpecPriceDOS(productSpecCPQVO);
if (productSpecCPQVO.getType().equals(1) && productSpecCPQVO.getLeaseTerm() == null) {
return ResultBody.error("租赁期限不能为空!");
}
@Override
public ResultBody removeProductSku(Integer id) {
// 判断该sku下是否有规格,没有则删除,有则不能删除
int specCount = productDao.countSpecByProdSkuId(id);
if (specCount <= 0) {
// 删除
productDao.removeProductSku(id);
return ResultBody.success();
} else {
return ResultBody.error(ResultEnum.SPEC_EXIST_UNDER_THE_SKU);
}
// 批量插入规格销售价格
if (productSpecCPQVO.getType().equals(0)) {
productDao.batchInsertSpecPrice(list);
} else {
// 批量插入租赁价格
productDao.batchInsertLeaseSpecPrice(list);
}
return ResultBody.success();
}
@Override
public ResultBody removeProductSpec(Integer id) {
// 根据规格id查询绑定的商品或者行业的sku
RemoveSkuDTO removeSkuDTO = new RemoveSkuDTO();
List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpecList = productDao.listMallProductSpec(id);
// 拿到清单的id
List<InventorySpecDO> inventorySpecList = productDao.listInventorySpec(id);
if (mallProdSkuInfoSpecList.size() != 0 || inventorySpecList.size() != 0) {
if (inventorySpecList.size() != 0) {
// 根据清单id 获取行业规格id
Set<Integer> inventoryIds = inventorySpecList.stream().map(InventorySpecDO::getIndustryProductInventoryId).collect(Collectors.toSet());
List<IndustryProductInventoryDO> industryProductInventoryList = industrySpecDao.listIndustryProdInventory(inventoryIds);
// 获取行业规格id
Set<Integer> industrySpecIds = industryProductInventoryList.stream().map(IndustryProductInventoryDO::getIndustrySpecId).collect(Collectors.toSet());
// 分别获取规格对应的sku信息
List<IndustrySpecDO> industrySpecList = industrySpecDao.listIndustrySpec(industrySpecIds);
List<SkuAndSpecDTO> industrySkuNameList = new ArrayList<>();
industrySpecList.stream().peek(d -> {
SkuAndSpecDTO skuAndSpecDTO = new SkuAndSpecDTO();
skuAndSpecDTO.setIndustrySkuName(d.getSolutionName());
skuAndSpecDTO.setIndustrySpecNames(d.getSpecName());
industrySkuNameList.add(skuAndSpecDTO);
}).collect(Collectors.toList());
removeSkuDTO.setIndustrySkuName(industrySkuNameList);
}
if (mallProdSkuInfoSpecList.size() != 0) {
// 获取商品名称
List<String> goodsNameList = new ArrayList<>();
mallProdSkuInfoSpecList.forEach(d -> goodsNameList.add(d.getGoodsName()));
removeSkuDTO.setGoodsName(goodsNameList);
}
return ResultBody.success(removeSkuDTO);
} else {
productDao.removeProductSpec(id);
return ResultBody.success();
}
@Override
public ResultBody getProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO) {
if (productSpecCPQVO.getType().equals(1) && productSpecCPQVO.getLeaseTerm() == null) {
return ResultBody.error("租赁期限不能为空!");
}
List<ProductSpecPriceDO> productSpecPriceList =
productDao.getProductSpecPrice(productSpecCPQVO);
List<ProductSpecPriceDTO> list =
productSpecPriceList.stream()
.map(ProductSpecPriceDO::buildProductSpecPriceDTO)
.collect(Collectors.toList());
return ResultBody.success(list);
}
@Override
public BigDecimal feignGetUnitPriceByTag(PriceAcquisition priceAcquisition) {
Map<Integer, Integer> dayMap = new HashMap<>();
dayMap.put(0, 7);
dayMap.put(8, 15);
dayMap.put(16, 30);
dayMap.put(31, Integer.MAX_VALUE);
Integer dayRange = dayMap.entrySet().stream()
.filter(entry -> priceAcquisition.getDay() <= entry.getKey())
.findFirst()
.map(Map.Entry::getValue)
.orElseThrow(() -> new RuntimeException("租赁期限错误错误!"));
priceAcquisition.setDay(dayRange);
return productDao.feignGetUnitPriceByTag(priceAcquisition);
@Override
public ResultBody removeProductSku(Integer id) {
// 判断该sku下是否有规格,没有则删除,有则不能删除
int specCount = productDao.countSpecByProdSkuId(id);
if (specCount <= 0) {
// 删除
productDao.removeProductSku(id);
return ResultBody.success();
} else {
return ResultBody.error(ResultEnum.SPEC_EXIST_UNDER_THE_SKU);
}
}
}
@Override
public ResultBody removeProductSpec(Integer id) {
// 根据规格id查询绑定的商品或者行业的sku
RemoveSkuDTO removeSkuDTO = new RemoveSkuDTO();
List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpecList = productDao.listMallProductSpec(id);
// 拿到清单的id
List<InventorySpecDO> inventorySpecList = productDao.listInventorySpec(id);
if (mallProdSkuInfoSpecList.size() != 0 || inventorySpecList.size() != 0) {
if (inventorySpecList.size() != 0) {
// 根据清单id 获取行业规格id
Set<Integer> inventoryIds =
inventorySpecList.stream()
.map(InventorySpecDO::getIndustryProductInventoryId)
.collect(Collectors.toSet());
List<IndustryProductInventoryDO> industryProductInventoryList =
industrySpecDao.listIndustryProdInventory(inventoryIds);
// 获取行业规格id
Set<Integer> industrySpecIds =
industryProductInventoryList.stream()
.map(IndustryProductInventoryDO::getIndustrySpecId)
.collect(Collectors.toSet());
// 分别获取规格对应的sku信息
List<IndustrySpecDO> industrySpecList = industrySpecDao.listIndustrySpec(industrySpecIds);
List<SkuAndSpecDTO> industrySkuNameList = new ArrayList<>();
industrySpecList.stream()
.peek(
d -> {
SkuAndSpecDTO skuAndSpecDTO = new SkuAndSpecDTO();
skuAndSpecDTO.setIndustrySkuName(d.getSolutionName());
skuAndSpecDTO.setIndustrySpecNames(d.getSpecName());
industrySkuNameList.add(skuAndSpecDTO);
})
.collect(Collectors.toList());
removeSkuDTO.setIndustrySkuName(industrySkuNameList);
}
if (mallProdSkuInfoSpecList.size() != 0) {
// 获取商品名称
List<String> goodsNameList = new ArrayList<>();
mallProdSkuInfoSpecList.forEach(d -> goodsNameList.add(d.getGoodsName()));
removeSkuDTO.setGoodsName(goodsNameList);
}
return ResultBody.success(removeSkuDTO);
} else {
productDao.removeProductSpec(id);
return ResultBody.success();
}
}
@Override
public BigDecimal feignGetUnitPriceByTag(PriceAcquisition priceAcquisition) {
Map<Integer, Integer> dayMap = new HashMap<>();
dayMap.put(0, 7);
dayMap.put(8, 15);
dayMap.put(16, 30);
dayMap.put(31, Integer.MAX_VALUE);
Integer dayRange =
dayMap.entrySet().stream()
.filter(entry -> priceAcquisition.getDay() <= entry.getKey())
.findFirst()
.map(Map.Entry::getValue)
.orElseThrow(() -> new RuntimeException("租赁期限错误错误!"));
priceAcquisition.setDay(dayRange);
return productDao.feignGetUnitPriceByTag(priceAcquisition);
}
@Override
public ResultBody productDirectoryList() {
List<DirectoryDO> directoryList = productDao.productDirectoryList();
if (CollectionUtils.isNotEmpty(directoryList)) {
return ResultBody.success(
directoryList.stream()
.map(DirectoryDO::buildDirectoryInfoVO)
.collect(Collectors.toList()));
}
return ResultBody.success();
}
}
package com.mmc.pms.service.Impl;
import com.mmc.pms.auth.dto.UserAccountSimpleDTO;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.constant.TokenConstant;
import com.mmc.pms.dao.CategoriesDao;
import com.mmc.pms.dao.GoodsInfoDao;
import com.mmc.pms.dao.ProductDao;
import com.mmc.pms.dao.WebDeviceDao;
import com.mmc.pms.entity.*;
import com.mmc.pms.feign.UserAppApi;
import com.mmc.pms.model.lease.dto.*;
import com.mmc.pms.model.lease.vo.LeaseVo;
import com.mmc.pms.model.other.dto.AdDTO;
import com.mmc.pms.model.other.dto.DistrictInfoDTO;
import com.mmc.pms.model.other.dto.ModelDTO;
import com.mmc.pms.model.qo.WareInfoQO;
import com.mmc.pms.model.sale.dto.MallGoodsDetailDTO;
import com.mmc.pms.model.sale.dto.SkuInfoDTO;
import com.mmc.pms.model.sale.vo.ProductSpecCPQVO;
import com.mmc.pms.model.sale.vo.SpecPriceVO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.WebDeviceService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
......@@ -24,174 +39,257 @@ import java.util.stream.Collectors;
@Service
public class WebDeviceServiceImpl implements WebDeviceService {
@Autowired
WebDeviceDao webDeviceDao;
@Override
public ResultBody listSecondDistrict() {
List<DistrictDO> list = webDeviceDao.listSecondDistrict();
List<DistrictInfoDTO> dtoList =
list.stream()
.map(
d -> {
return d.builderDistrictInfoDTO();
})
.collect(Collectors.toList());
return ResultBody.success(dtoList);
}
@Autowired WebDeviceDao webDeviceDao;
@Override
public ResultBody category() {
List<DeviceCategory> category = webDeviceDao.category();
List<DeviceCategoryDTO> collect =
category.stream()
.map(
t -> {
return t.deviceCategory();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Autowired UserAppApi userAppApi;
@Override
public ResultBody brand() {
List<Brand> brand = webDeviceDao.brand();
List<BrandDTO> collect =
brand.stream()
.map(
t -> {
return t.brandDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Autowired ProductDao productDao;
@Override
public ResultBody deviceBrand() {
List<Brand> brand = webDeviceDao.deviceBrand();
List<BrandDTO> collect =
brand.stream()
.map(
t -> {
return t.brandDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Autowired GoodsInfoDao goodsInfoDao;
@Override
public ResultBody model() {
List<Model> model = webDeviceDao.model();
List<ModelDTO> collect =
model.stream()
.map(
t -> {
return t.modelDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Autowired GoodsInfoServiceImpl goodsInfoService;
@Override
public ResultBody deviceModel() {
List<Model> model = webDeviceDao.deviceModel();
List<ModelDTO> collect =
model.stream()
.map(
t -> {
return t.modelDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Autowired private CategoriesDao categoriesDao;
@Override
public ResultBody deviceList(
Integer districtId, Integer categoryId, Integer brandId, Integer modelId) {
List<DeviceListDO> deviceList =
webDeviceDao.deviceList(districtId, categoryId, brandId, modelId);
List<DeviceListDTO> collect =
deviceList.stream()
.map(
t -> {
return t.deviceListDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public ResultBody listSecondDistrict() {
List<DistrictDO> list = webDeviceDao.listSecondDistrict();
List<DistrictInfoDTO> dtoList =
list.stream().map(DistrictDO::builderDistrictInfoDTO).collect(Collectors.toList());
return ResultBody.success(dtoList);
}
@Override
public ResultBody update(LeaseVo param) {
InventoryDO inventory = webDeviceDao.findInventory(param.getInventoryId());
Integer residueCount = inventory.getResidueCount();
Integer count = residueCount - param.getInventoryUsage();
param.setInventoryUsage(count);
int update = webDeviceDao.update(param);
return ResultBody.success(update);
}
@Override
public ResultBody category() {
List<DeviceCategory> category = webDeviceDao.category();
List<DeviceCategoryDTO> collect =
category.stream()
.map(
t -> {
return t.deviceCategory();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public ResultBody brand() {
List<Brand> brand = webDeviceDao.brand();
List<BrandDTO> collect =
brand.stream()
.map(
t -> {
return t.brandDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public ResultBody deviceBrand() {
List<Brand> brand = webDeviceDao.deviceBrand();
List<BrandDTO> collect =
brand.stream()
.map(
t -> {
return t.brandDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public ResultBody detail(Integer id) {
List<WareInfoDO> list = webDeviceDao.detail(id);
List<WareInfoItemDTO> pageList =
list.stream()
.map(
d -> {
return d.buildWareInfoItemDTO();
})
.collect(Collectors.toList());
return ResultBody.success(pageList);
@Override
public ResultBody model() {
List<Model> model = webDeviceDao.model();
List<ModelDTO> collect =
model.stream()
.map(
t -> {
return t.modelDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public ResultBody deviceModel() {
List<Model> model = webDeviceDao.deviceModel();
List<ModelDTO> collect =
model.stream()
.map(
t -> {
return t.modelDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public ResultBody deviceList(
Integer districtId, Integer categoryId, Integer brandId, Integer modelId) {
List<DeviceListDO> deviceList =
webDeviceDao.deviceList(districtId, categoryId, brandId, modelId);
List<DeviceListDTO> collect =
deviceList.stream()
.map(
t -> {
return t.deviceListDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public ResultBody update(LeaseVo param) {
InventoryDO inventory = webDeviceDao.findInventory(param.getInventoryId());
Integer residueCount = inventory.getResidueCount();
Integer count = residueCount - param.getInventoryUsage();
param.setInventoryUsage(count);
int update = webDeviceDao.update(param);
return ResultBody.success(update);
}
@Override
public ResultBody detail(Integer id) {
List<WareInfoDO> list = webDeviceDao.detail(id);
List<WareInfoItemDTO> pageList =
list.stream()
.map(
d -> {
return d.buildWareInfoItemDTO();
})
.collect(Collectors.toList());
return ResultBody.success(pageList);
}
@Override
public ResultBody listWareInfoPage(
WareInfoQO param, HttpServletRequest request, Integer userAccountId) {
List<Integer> userIds = null;
if (param.getProvinceId() != null) {
userIds =
userAppApi.feignListUserAccountIds(
param.getProvinceId(),
null,
null,
StringUtils.isBlank(request.getHeader(TokenConstant.TOKEN))
? null
: request.getHeader(TokenConstant.TOKEN));
if (userIds == null || userIds.size() == 0) {
userIds = Collections.singletonList(-1);
}
}
int count = webDeviceDao.countListWareInfoPage(param.getCategoryId(), userIds, param.getType());
if (count == 0) {
return ResultBody.success(
PageResult.buildPage(param.getPageNo(), param.getPageSize(), count));
}
int pageNo = param.getPageNo();
param.buildCurrentPage();
List<GoodsInfo> list = webDeviceDao.listWareInfoPage(param, userIds, param.getType());
List<LeaseGoodsInfoDTO> pageList =
list.stream().map(GoodsInfo::buildLeaseGoodsInfoDTO).collect(Collectors.toList());
if (StringUtils.isBlank(request.getHeader(TokenConstant.TOKEN))) {
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, pageList));
}
@Override
public ResultBody listWareInfoPage(WareInfoQO param) {
int count = webDeviceDao.countListWareInfoPage(param);
if (count == 0) {
return ResultBody.success(
PageResult.buildPage(param.getPageNo(), param.getPageSize(), count));
}
int pageNo = param.getPageNo();
param.buildCurrentPage();
List<WareInfoDO> list = webDeviceDao.listWareInfoPage(param);
List<WareInfoItemDTO> pageList =
list.stream()
.map(
d -> {
return d.buildWareInfoItemDTO();
})
.collect(Collectors.toList());
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 -> {
MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO = specMap.get(d.getId());
d.setPrice(mallProdSkuInfoSpecDO.getPrice());
})
.collect(Collectors.toList());
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, pageList));
}
@Override
public WareInfoDTO getWareInfoById(Integer id) {
WareInfoDO wareInfoDO = webDeviceDao.getWareInfoById(id);
WareDetailDO wareDetailDO = webDeviceDao.getWareDetailById(id);
if (wareInfoDO != null) {
wareInfoDO.setWareDetailContent(wareDetailDO.getContent());
}
return wareInfoDO == null ? null : wareInfoDO.buildWareInfoDTO();
@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 ResultBody<AdDTO> ad() {
List<AdDO> ad = webDeviceDao.ad();
List<AdDTO> collect =
ad.stream()
.map(
t -> {
return t.adDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
@Override
public WareInfoDTO getWareInfoById(Integer id) {
WareInfoDO wareInfoDO = webDeviceDao.getWareInfoById(id);
WareDetailDO wareDetailDO = webDeviceDao.getWareDetailById(id);
if (wareInfoDO != null) {
wareInfoDO.setWareDetailContent(wareDetailDO.getContent());
}
return wareInfoDO == null ? null : wareInfoDO.buildWareInfoDTO();
}
@Override
public List<SkuInfoDTO> listWareSkuById(Integer id) {
List<SkuInfoDO> skuInfoDOS = webDeviceDao.listSkuInfo(id);
return skuInfoDOS.isEmpty() ? null : skuInfoDOS.stream().map(d -> {
return d.buildSkuInfoDTO();
}).collect(Collectors.toList());
@Override
public ResultBody getPageHomeCategories(Integer type) {
List<DirectoryDO> directoryList = categoriesDao.getDirectoryList(type);
if (CollectionUtils.isNotEmpty(directoryList)) {
List<Integer> directoryIds =
directoryList.stream().map(DirectoryDO::getId).collect(Collectors.toList());
List<Categories> categoriesList = categoriesDao.getCategoriesListByDirectoryIds(directoryIds);
return ResultBody.success(
categoriesList.stream()
.map(Categories::buildCategoryTypeDTO)
.collect(Collectors.toList()));
}
return ResultBody.success();
}
@Override
public ResultBody<AdDTO> ad() {
List<AdDO> ad = webDeviceDao.ad();
List<AdDTO> collect =
ad.stream()
.map(
t -> {
return t.adDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public List<SkuInfoDTO> listWareSkuById(Integer id) {
List<SkuInfoDO> skuInfoDOS = webDeviceDao.listSkuInfo(id);
return skuInfoDOS.isEmpty()
? null
: skuInfoDOS.stream()
.map(
d -> {
return d.buildSkuInfoDTO();
})
.collect(Collectors.toList());
}
@Override
public ResultBody<ProductSpecCPQVO> getLeaseGoodsPriceDetail(
Integer productSpecId, Integer leaseTerm) {
ProductSpecCPQVO productSpecCPQVO = new ProductSpecCPQVO();
List<SpecPriceVO> specPriceList = goodsInfoDao.getPriceBySpecId(productSpecId, leaseTerm);
productSpecCPQVO.setProductSpecId(productSpecId);
productSpecCPQVO.setLeaseTerm(leaseTerm);
productSpecCPQVO.setSpecPrice(specPriceList);
return ResultBody.success(productSpecCPQVO);
}
}
......@@ -6,9 +6,10 @@ import com.mmc.pms.entity.AdDO;
import com.mmc.pms.entity.GoodsInfoDO;
import com.mmc.pms.entity.ProductCategory;
import com.mmc.pms.model.other.dto.AdDTO;
import com.mmc.pms.model.sale.dto.ProductCategoryDTO;
import com.mmc.pms.model.qo.GoodsInfoQO;
import com.mmc.pms.model.sale.dto.GoodsInfoListDTO;
import com.mmc.pms.model.qo.GoodsInfoQO;
import com.mmc.pms.model.sale.dto.ProductCategoryDTO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.WebProductMallService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -23,78 +24,77 @@ import java.util.stream.Collectors;
@Service
public class WebProductMallServiceImpl implements WebProductMallService {
@Autowired
private WebProductMallDao webProductMallDao;
@Autowired private WebProductMallDao webProductMallDao;
@Override
public ResultBody productCategory() {
List<ProductCategory> category = webProductMallDao.productCategory();
List<ProductCategoryDTO> collect =
category.stream()
.map(
t -> {
return t.productCategoryDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public ResultBody productCategory() {
List<ProductCategory> category = webProductMallDao.productCategory();
List<ProductCategoryDTO> collect =
category.stream()
.map(
t -> {
return t.productCategoryDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public ResultBody productParts() {
List<ProductCategory> category = webProductMallDao.productParts();
List<ProductCategoryDTO> collect =
category.stream()
.map(
t -> {
return t.productCategoryDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public ResultBody productParts() {
List<ProductCategory> category = webProductMallDao.productParts();
List<ProductCategoryDTO> collect =
category.stream()
.map(
t -> {
return t.productCategoryDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public ResultBody productQuality() {
List<ProductCategory> category = webProductMallDao.productQuality();
List<ProductCategoryDTO> collect =
category.stream()
.map(
t -> {
return t.productCategoryDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public ResultBody productQuality() {
List<ProductCategory> category = webProductMallDao.productQuality();
List<ProductCategoryDTO> collect =
category.stream()
.map(
t -> {
return t.productCategoryDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
}
@Override
public PageResult listPageGoodsInfo(GoodsInfoQO param) {
int count = webProductMallDao.countListGoodsInfo(param);
if (count == 0) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
}
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<GoodsInfoDO> goodsInfo = webProductMallDao.listGoodsInfo(param);
goodsInfo.stream()
.forEach(
t -> {
Integer product = webProductMallDao.findProduct(t.getId());
t.setIsCoupons(product);
});
List<GoodsInfoListDTO> pageList =
goodsInfo.stream().map(GoodsInfoDO::buildGoodsInfoListDTO).collect(Collectors.toList());
return PageResult.buildPage(pageNo, param.getPageSize(), count, pageList);
}
@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 ResultBody<AdDTO> ad() {
List<AdDO> ad = webProductMallDao.ad();
List<AdDTO> collect =
ad.stream()
.map(
t -> {
return t.adDTO();
})
.collect(Collectors.toList());
return ResultBody.success(collect);
@Override
public PageResult listPageGoodsInfo(GoodsInfoQO param) {
int count = webProductMallDao.countListGoodsInfo(param);
if (count == 0) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
}
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<GoodsInfoDO> goodsInfo = webProductMallDao.listGoodsInfo(param);
goodsInfo.stream()
.forEach(
t -> {
Integer product = webProductMallDao.findProduct(t.getId());
t.setIsCoupons(product);
});
List<GoodsInfoListDTO> pageList =
goodsInfo.stream().map(GoodsInfoDO::buildGoodsInfoListDTO).collect(Collectors.toList());
return PageResult.buildPage(pageNo, param.getPageSize(), count, pageList);
}
}
package com.mmc.pms.service;
import com.mmc.pms.entity.InspComtDO;
import java.util.List;
/**
* <p>
* 评论表 服务类
* </p>
*
* @author Pika
* @since 2023-06-09
*/
public interface InspComtService {
List<InspComtDO> randomGetInspComtList(Integer size);
}
package com.mmc.pms.service;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.qo.GoodsInfoQO;
/**
* @Author small @Date 2023/5/16 15:08 @Version 1.0
*/
public interface MiniProgramProductMallService {
ResultBody getAppGoodsInfoDetail(Integer id);
ResultBody listGoodsByQO(GoodsInfoQO param);
}
......@@ -2,6 +2,7 @@ package com.mmc.pms.service;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.entity.ProductSpecPriceDO;
import com.mmc.pms.model.categories.vo.DirectoryInfoVO;
import com.mmc.pms.model.lease.vo.PriceAcquisition;
import com.mmc.pms.model.qo.ProductSkuQO;
import com.mmc.pms.model.sale.dto.ProductSkuVO;
......@@ -18,32 +19,34 @@ import java.util.List;
*/
public interface ProductSkuService {
ResultBody addProductSku(ProductSkuVO param);
ResultBody addProductSku(ProductSkuVO param);
ResultBody getProductSkuDetail(Integer id);
ResultBody getProductSkuDetail(Integer id);
ResultBody editProductSku(ProductSkuVO param);
ResultBody editProductSku(ProductSkuVO param);
ResultBody listPageProductSku(ProductSkuQO productSkuQO);
ResultBody listPageProductSku(ProductSkuQO productSkuQO);
ResultBody addOrEditProductSpec(ProductSpecVO param);
ResultBody addOrEditProductSpec(ProductSpecVO param);
ResultBody getProductSpecDetail(Integer id);
ResultBody getProductSpecDetail(Integer id);
ResultBody listPageProductSpec(Integer pageNo, Integer pageSize, Integer productSkuId);
ResultBody listPageProductSpec(
Integer pageNo, Integer pageSize, Integer productSkuId, String keyword);
ResultBody productSpecCPQ(ProductSpecCPQVO productSpecCPQVO);
ResultBody productSpecCPQ(ProductSpecCPQVO productSpecCPQVO);
List<ProductSpecPriceDO> getProductSpecPriceDOS(ProductSpecCPQVO productSpecCPQVO);
List<ProductSpecPriceDO> getProductSpecPriceDOS(ProductSpecCPQVO productSpecCPQVO);
ResultBody updateProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO);
ResultBody updateProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO);
ResultBody getProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO);
ResultBody getProductSpecCPQ(ProductSpecCPQVO productSpecCPQVO);
ResultBody removeProductSku(Integer id);
ResultBody removeProductSku(Integer id);
ResultBody removeProductSpec(Integer id);
ResultBody removeProductSpec(Integer id);
BigDecimal feignGetUnitPriceByTag(PriceAcquisition priceAcquisition);
BigDecimal feignGetUnitPriceByTag(PriceAcquisition priceAcquisition);
ResultBody<DirectoryInfoVO> productDirectoryList();
}
package com.mmc.pms.service;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.categories.dto.CategoryTypeDTO;
import com.mmc.pms.model.lease.dto.WareInfoDTO;
import com.mmc.pms.model.lease.vo.LeaseVo;
import com.mmc.pms.model.other.dto.AdDTO;
import com.mmc.pms.model.qo.WareInfoQO;
import com.mmc.pms.model.sale.dto.SkuInfoDTO;
import com.mmc.pms.model.sale.vo.ProductSpecCPQVO;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* @Author small @Date 2023/5/15 14:28 @Version 1.0
*/
public interface WebDeviceService {
ResultBody listSecondDistrict();
ResultBody listSecondDistrict();
ResultBody category();
ResultBody category();
ResultBody brand();
ResultBody brand();
ResultBody deviceBrand();
ResultBody deviceBrand();
ResultBody model();
ResultBody model();
ResultBody deviceModel();
ResultBody deviceModel();
ResultBody deviceList(Integer districtId, Integer categoryId, Integer brandId, Integer modelId);
ResultBody deviceList(Integer districtId, Integer categoryId, Integer brandId, Integer modelId);
ResultBody update(LeaseVo param);
ResultBody update(LeaseVo param);
ResultBody detail(Integer id);
ResultBody detail(Integer id);
ResultBody listWareInfoPage(WareInfoQO param);
ResultBody listWareInfoPage(WareInfoQO param, HttpServletRequest request, Integer userAccountId);
WareInfoDTO getWareInfoById(Integer id);
WareInfoDTO getWareInfoById(Integer id);
ResultBody<AdDTO> ad();
ResultBody<AdDTO> ad();
List<SkuInfoDTO> listWareSkuById(Integer id);
List<SkuInfoDTO> listWareSkuById(Integer id);
ResultBody getLeaseGoodsDetail(
Integer goodsId, Integer userAccountId, HttpServletRequest request, Integer type);
ResultBody<CategoryTypeDTO> getPageHomeCategories(Integer type);
ResultBody<ProductSpecCPQVO> getLeaseGoodsPriceDetail(Integer productSpecId, Integer leaseTerm);
}
package com.mmc.pms.util;
import org.springframework.beans.BeanUtils;
import java.util.Objects;
/**
* @author 作者 dahang
* @version 创建时间:2022年7月23日
* @explain 同名属性拷贝值
*/
public class BeanCopyUtils {
public static <T> T properties(Object source, T target) {
if (Objects.isNull(source)) {
return target;
}
BeanUtils.copyProperties(source, target);
return target;
}
public static <T> T properties(Object source, Class<T> target) {
T t = null;
try {
t = target.newInstance();
if (Objects.isNull(source)) {
return t;
}
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
BeanUtils.copyProperties(source, t);
return t;
}
}
......@@ -3,7 +3,6 @@ package com.mmc.pms.util;
import com.mmc.pms.common.BaseErrorInfoInterface;
import com.mmc.pms.common.ResultEnum;
/**
* @author 作者 geDuo
* @version 创建时间:2021年8月13日 上午9:25:43
......@@ -11,80 +10,76 @@ import com.mmc.pms.common.ResultEnum;
*/
public class BizException extends RuntimeException {
private static final long serialVersionUID = 1L;
/**
* 错误码
*/
protected String errorCode;
/**
* 错误信息
*/
protected String errorMsg;
public BizException() {
super();
}
public BizException(BaseErrorInfoInterface errorInfoInterface) {
super(errorInfoInterface.getResultCode());
this.errorCode = errorInfoInterface.getResultCode();
this.errorMsg = errorInfoInterface.getResultMsg();
}
public BizException(BaseErrorInfoInterface errorInfoInterface, Throwable cause) {
super(errorInfoInterface.getResultCode(), cause);
this.errorCode = errorInfoInterface.getResultCode();
this.errorMsg = errorInfoInterface.getResultMsg();
}
public BizException(ResultEnum enums) {
super(enums.getResultCode());
this.errorCode = enums.getResultCode();
this.errorMsg = enums.getResultMsg();
}
public BizException(String errorMsg) {
super(errorMsg);
this.errorCode = "-1";
this.errorMsg = errorMsg;
}
public BizException(String errorCode, String errorMsg) {
super(errorCode);
this.errorCode = errorCode;
this.errorMsg = errorMsg;
}
public BizException(String errorCode, String errorMsg, Throwable cause) {
super(errorCode, cause);
this.errorCode = errorCode;
this.errorMsg = errorMsg;
}
public String getErrorCode() {
return errorCode;
}
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
@Override
public String getMessage() {
return errorMsg;
}
@Override
public Throwable fillInStackTrace() {
return this;
}
private static final long serialVersionUID = 1L;
/** 错误码 */
protected String errorCode;
/** 错误信息 */
protected String errorMsg;
public BizException() {
super();
}
public BizException(BaseErrorInfoInterface errorInfoInterface) {
super(errorInfoInterface.getResultCode());
this.errorCode = errorInfoInterface.getResultCode();
this.errorMsg = errorInfoInterface.getResultMsg();
}
public BizException(BaseErrorInfoInterface errorInfoInterface, Throwable cause) {
super(errorInfoInterface.getResultCode(), cause);
this.errorCode = errorInfoInterface.getResultCode();
this.errorMsg = errorInfoInterface.getResultMsg();
}
public BizException(ResultEnum enums) {
super(enums.getResultCode());
this.errorCode = enums.getResultCode();
this.errorMsg = enums.getResultMsg();
}
public BizException(String errorMsg) {
super(errorMsg);
this.errorCode = "-1";
this.errorMsg = errorMsg;
}
public BizException(String errorCode, String errorMsg) {
super(errorCode);
this.errorCode = errorCode;
this.errorMsg = errorMsg;
}
public BizException(String errorCode, String errorMsg, Throwable cause) {
super(errorCode, cause);
this.errorCode = errorCode;
this.errorMsg = errorMsg;
}
public String getErrorCode() {
return errorCode;
}
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
@Override
public String getMessage() {
return errorMsg;
}
@Override
public Throwable fillInStackTrace() {
return this;
}
}
......@@ -8,9 +8,9 @@ import org.springframework.util.AntPathMatcher;
* @explain 解析地址类
*/
public class PathUtil {
private static AntPathMatcher matcher = new AntPathMatcher();
private static AntPathMatcher matcher = new AntPathMatcher();
public static boolean isPathMatch(String pattern, String path) {
return matcher.match(pattern, path);
}
public static boolean isPathMatch(String pattern, String path) {
return matcher.match(pattern, path);
}
}
package com.mmc.pms.util;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.util.UUID;
/**
* @Author small
* @Date 2023/6/12 19:36
* @Version 1.0
*/
public class XmlUtil {
public static File ossUpload(MultipartFile file) throws IOException {
// 获取文件名
String fileName = file.getOriginalFilename();
// 获取文件后缀
String prefix = fileName.substring(fileName.lastIndexOf("."));
// 用uuid作为文件名,防止生成的临时文件重复
File excelFile = File.createTempFile(UUID.randomUUID().toString(), prefix);
// MultipartFile to File
file.transferTo(excelFile);
//程序结束时,删除临时文件
return excelFile;
}
}
......@@ -15,8 +15,8 @@ spring:
max-active: 2
servlet:
multipart:
max-file-size: 200MB
max-request-size: 200MB
max-file-size: 512MB
max-request-size: 512MB
springfox:
documentation:
......@@ -37,4 +37,8 @@ mmcflying:
mount:
directory: D:@javaVolume@
iuav:
userapp:
url: https://test.iuav.shop
......@@ -22,6 +22,10 @@ spring:
max-idle: 8
#初始化最小
min-idle: 1
servlet:
multipart:
max-file-size: 512MB
max-request-size: 512MB
#mybatis-plus
mybatis-plus:
global-config:
......@@ -54,4 +58,8 @@ mmcflying:
mount:
directory: D:@javaVolume@
iuav:
userapp:
url: http://127.0.0.1:35150
......@@ -15,8 +15,8 @@ spring:
max-active: 2
servlet:
multipart:
max-file-size: 200MB
max-request-size: 200MB
max-file-size: 512MB
max-request-size: 512MB
springfox:
documentation:
......@@ -36,3 +36,7 @@ mmcflying:
path: /ossservlet/upload/download/
mount:
directory: D:@javaVolume@
iuav:
userapp:
url: https://www.iuav.shop
......@@ -15,8 +15,8 @@ spring:
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
main:
banner-mode: off
logging:
level:
com:
mmc:
pms: DEBUG
file:
name: "/var/log/app/${spring.application.name}.log"
\ No newline at end of file
......@@ -25,9 +25,8 @@
is_deleted
</sql>
<insert id="insertDirectory">
insert into directory(directory_name, pid,
`type`)
values (#{directoryName}, #{pid}, #{type})
insert into directory (directory_name, `type`, `show`)
values (#{directoryName}, #{type}, #{show})
</insert>
<insert id="insertClassification">
insert into categories (parent_id,
......@@ -42,8 +41,8 @@
<update id="updateDirectory">
update directory
set directory_name = #{directoryName},
pid = #{pid},
`type` = #{type}
`type` = #{type},
`show` = #{show}
where id = #{id}
</update>
<update id="removeDirectory">
......@@ -87,12 +86,10 @@
<select id="directoryList" resultType="com.mmc.pms.entity.DirectoryDO">
SELECT d.id,
d.directory_name,
d.pid,
d.`type`,
d.create_time,
dt.directory_name relevanceName
d.show
FROM `directory` d
LEFT JOIN `directory` dt ON dt.id = d.pid
<where>
d.is_deleted = 0
<if test="type != null">
......@@ -151,7 +148,6 @@
FROM categories
WHERE is_deleted = 0
AND directory_id = #{directoryId}
AND type = #{type}
ORDER BY sort asc
LIMIT #{pageNo}, #{pageSize}
</select>
......@@ -160,30 +156,37 @@
FROM categories
WHERE is_deleted = 0
AND directory_id = #{directoryId}
AND `type` = #{type}
</select>
<select id="selectDirectoryById" resultType="java.lang.Integer">
select count(*)
from directory
where id = #{id}
and is_default = 0
</select>
<select id="getDirectoryList" resultType="com.mmc.pms.entity.DirectoryDO">
SELECT d.id,
d.directory_name,
d.pid,
d.`type`,
d.create_time
FROM `directory` d
WHERE d.is_deleted = 0
AND d.type = #{type}
OR d.type = 0
AND d.pid IS NULL
or (d.type = 0 and d.`show` like CONCAT('%', #{type}, '%') and d.is_deleted = 0)
ORDER BY create_time DESC
</select>
<select id="selectCategoryByDirectoryId" resultType="com.mmc.pms.entity.Categories">
select id, `name`, icon,directory_id
from categories
<where>
is_deleted = 0 and parent_id = 0
<foreach collection="list" separator="," open="and directory_id in(" close=")" index="index" item="d">
#{d}
</foreach>
</where>
order by sort asc
</select>
<select id="getCategoriesByDirectoryId" resultType="com.mmc.pms.entity.Categories" parameterType="java.lang.Integer">
SELECT id,`name` from categories where directory_id = #{directoryId} and is_deleted = 0 order by create_time desc
<select id="getCategoriesByDirectoryId" resultType="com.mmc.pms.entity.Categories"
parameterType="java.lang.Integer">
SELECT id, `name`
from categories
where directory_id = #{directoryId}
and is_deleted = 0
order by create_time desc
</select>
<select id="getCategoriesListByIds" resultType="com.mmc.pms.entity.Categories">
......@@ -194,6 +197,32 @@
</foreach>
and is_deleted = 0
</select>
<select id="selectDirectoryById" resultType="com.mmc.pms.entity.DirectoryDO">
select id, directory_name
from directory
where id = #{id}
and is_default = 0
</select>
<select id="getCategoriesListByDirectoryIds" resultType="com.mmc.pms.entity.Categories">
SELECT
id,
`name`
FROM
categories
<where>
is_deleted = 0
<foreach collection="list" item="d" index="index" open=" and directory_id IN (" close=")" separator=",">
#{d}
</foreach>
</where>
</select>
<select id="countChildById" resultType="java.lang.Integer">
SELECT COUNT(*)
FROM categories c1
INNER JOIN categories c2 ON c1.id = c2.parent_id
AND c2.is_deleted = 0
WHERE c1.id = #{id}
</select>
<update id="deleteById">
UPDATE `categories`
......
......@@ -65,10 +65,10 @@
</insert>
<insert id="insertMallProdSkuInfo" parameterType="com.mmc.pms.entity.MallProdInfoDO" useGeneratedKeys="true"
keyProperty="id">
insert into mall_prod_sku_info (goods_info_id, product_id, prod_sku_spec_name, categories_id, choose_type,
sku_unit_id, is_must, flag)
insert into mall_prod_info (goods_info_id, product_id, prod_spec_name, categories_id, choose_type,
sku_unit_id, is_must, flag)
values (#{goodsInfoId}, #{prodSkuId}, #{prodSkuSpecName}, #{categoriesId}, #{chooseType}, #{skuUnitId}, #{must},
#{flag}) >
#{flag})
</insert>
<insert id="insertMallProdSkuInfoSpec">
insert into mall_prod_info_spec (goods_info_id, mall_prod_info_id, product_spec_id)
......@@ -103,7 +103,7 @@
where goods_info_id = #{goodsId}
</update>
<update id="batchUpdateMallProductSku">
<foreach collection="list" item="d" separator=";">
<foreach collection="list" item="d" separator=";" index="index">
update mall_prod_info
set is_deleted = 1
where id = #{d}
......@@ -111,10 +111,10 @@
</foreach>
</update>
<update id="batchUpdateMallProdSkuInfo">
<foreach collection="list" item="d" separator=";">
<foreach collection="list" item="d" separator=";" index="index">
update mall_prod_info
<set>
prod_sku_id = #{d.prodSkuId},
product_id = #{d.prodSkuId},
categories_id = #{d.categoriesId},
prod_spec_name = #{d.prodSkuSpecName},
choose_type = #{d.chooseType},
......@@ -127,8 +127,8 @@
</foreach>
</update>
<update id="batchUpdateMallProSpec">
<foreach collection="list" separator=";" item="d">
update mall_prod_sku_info_spec
<foreach collection="list" separator=";" item="d" index="index">
update mall_prod_info_spec
set is_deleted = 1
where mall_prod_info_id = #{d}
and goods_info_id =#{id}
......@@ -136,13 +136,41 @@
</foreach>
</update>
<update id="batchUpdateMallProdSpec">
<foreach collection="list" item="d" separator=";">
update mall_prod_info_spec
set is_deleted = 1
where id = #{d}
and is_deleted = 0
update mall_prod_info_spec
set is_deleted = 1
where 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>
</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
from goods_service
......@@ -154,6 +182,7 @@
from goods_info
where is_deleted = 0
and goods_name = #{goodsName}
and goods_type = #{goodsType}
<if test="id!=null and id!=''">
and id <![CDATA[<>]]> #{id}
</if>
......@@ -179,26 +208,25 @@
<select id="getMallProSkuInfo" resultType="com.mmc.pms.entity.MallProdInfoDO">
SELECT mi.id,
mi.goods_info_id,
mi.prod_sku_id,
mi.prod_spec_name,
mi.categories_id,
mi.choose_type,
mi.sku_unit_id,
mi.is_must,
mi.product_spec_id_list,
mi.before_update_spec,
mi.flag,
mi.create_time createTime,
c.type_name typeName,
su.id skuUnitId,
su.unit_name unitName,
ps.product_name productSkuName
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.prod_sku_id
INNER JOIN product ps ON ps.id = mi.product_id
WHERE mi.goods_info_id = #{id}
AND mi.is_deleted = 0
and flag = 0
</select>
<select id="getMallIndustrySkuInfo" resultType="com.mmc.pms.entity.MallIndustrySkuInfoDO">
SELECT mi.id,
......@@ -440,7 +468,19 @@
AND im.img_type = 0
WHERE gi.category_by_one = #{id}
</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,
mp.mall_prod_info_id,
mp.product_spec_id,
......@@ -452,5 +492,133 @@
INNER JOIN product_spec ps ON mp.product_spec_id = ps.id
WHERE mp.goods_info_id = #{id}
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>
</mapper>
......@@ -311,12 +311,10 @@
industry_spec ins
INNER JOIN industry_sku inds ON ins.industry_sku_id = inds.id
WHERE
ins.id IN (
<foreach collection="industrySpecIds" separator="," item="id" index="index">
ins.is_deleted = 0
<foreach collection="industrySpecIds" separator="," item="id" index="index" open="AND ins.id IN (" close=")">
#{id}
</foreach>
)
AND ins.is_deleted = 0
</select>
<select id="countIndustrySpecBySkuId" resultType="java.lang.Integer">
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 @@
<select id="getMallProdInfoByGoodsId" resultType="com.mmc.pms.entity.MallProdInfoDO">
SELECT mp.id,
mp.prod_sku_id prodSkuId,
mp.product_id prodSkuId,
mp.prod_spec_name prodSkuSpecName,
mp.goods_type_id goodsTypeId,
mp.choose_type chooseType,
......@@ -133,9 +133,9 @@
ps.product_name productSkuName,
ps.brand_info_id brandInfoId,
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 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
WHERE mp.goods_info_id = #{goodsId}
AND mp.is_deleted = 0
......@@ -143,9 +143,9 @@
<select id="listMallProdSkuInfoSpec" resultType="com.mmc.pms.entity.MallProdSkuInfoSpecDO">
SELECT id,
mall_prod_sku_info_id mallProdSkuInfoId,
product_spec_id productSpecId
FROM mall_prod_sku_info_spec
mall_prod_info_id mallProdSkuInfoId,
product_spec_id productSpecId
FROM mall_prod_info_spec
WHERE goods_info_id = #{goodsId}
AND is_deleted = 0
</select>
......
......@@ -5,8 +5,8 @@
<mapper namespace="com.mmc.pms.dao.ProductDao">
<insert id="insertProductSku" parameterType="com.mmc.pms.entity.ProductSkuDO"
useGeneratedKeys="true" keyProperty="id">
insert into product (product_name, categories_id, model, brand_info_id, directory_id)
values (#{productName}, #{categoriesId}, #{model}, #{brandInfoId}, #{directoryId})
insert into product (product_name, categories_id, model, brand_info_id, directory_id, customize)
values (#{productName}, #{categoriesId}, #{model}, #{brandInfoId}, #{directoryId}, #{customize})
</insert>
<insert id="insertProductSpec" keyProperty="id" useGeneratedKeys="true"
parameterType="com.mmc.pms.entity.ProductSpecDO">
......@@ -30,9 +30,9 @@
</insert>
<insert id="insertMallProdSkuInfo" parameterType="com.mmc.pms.entity.MallProdInfoDO"
keyProperty="id" useGeneratedKeys="true">
insert into mall_prod_info (goods_info_id, prod_sku_id, prod_spec_name, category_id, choose_type,
sku_unit_id, is_must, product_spec_id_list, flag)
values (#{goodsInfoId}, #{prodSkuId}, #{prodSkuSpecName}, #{categoryId}, #{chooseType}, #{skuUnitId}, #{must},
insert into mall_prod_info (goods_info_id, product_id, prod_spec_name, categories_id, choose_type,
sku_unit_id, is_must, flag)
values (#{goodsInfoId}, #{prodSkuId}, #{prodSkuSpecName}, #{categoriesId}, #{chooseType}, #{skuUnitId}, #{must},
#{flag})
</insert>
<update id="updateProductSku">
......@@ -71,7 +71,7 @@
<delete id="removeProductSpecCPQ">
DELETE
FROM product_spec_price
WHERE product_spec_id = #{id}
WHERE product_spec_id = #{productSpecId}
and `type` = #{type}
</delete>
......@@ -111,7 +111,7 @@
and product_name like CONCAT ('%',#{productName},'%')
</if>
<if test="categoryId != null">
and categories = #{categoryId}
and categories_id = #{categoryId}
</if>
<if test="directoryId != null">
and directory_id = #{directoryId}
......@@ -178,22 +178,32 @@
<select id="countListPageProductSpec" resultType="java.lang.Integer">
select count(*)
from product_spec
where is_deleted = 0
and product_id = #{id}
<where>
is_deleted = 0
and product_id = #{id}
<if test="keyword != null and keyword != ''">
and spec_name like CONCAT('%',#{keyword},'%')
</if>
</where>
</select>
<select id="listPageProductSpec" resultType="com.mmc.pms.entity.ProductSpecDO">
select id,
product_id productSkuId,
spec_name specName,
spec_image specImage,
part_no partNo,
version_desc versionDesc,
create_time createTime
product_id productSkuId,
spec_name specName,
spec_image specImage,
part_no partNo,
version_desc versionDesc,
create_time createTime
from product_spec
where is_deleted = 0
and product_id = #{productSkuId}
<where>
is_deleted = 0
and product_id = #{productSkuId}
<if test="keyword != null and keyword != ''">
and spec_name like CONCAT('%',#{keyword},'%')
</if>
</where>
order by create_time desc
limit #{pageNo}, #{pageSize}
limit #{pageNo}, #{pageSize}
</select>
<select id="getProductSpecPrice" resultType="com.mmc.pms.entity.ProductSpecPriceDO">
select id,
......@@ -414,7 +424,7 @@
<result property="shelfStatus" column="shelf_status"/>
<result property="deleted" column="is_deleted"/>
<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="mallProdSkuInfoSpecId" column="mall_prod_info_spec_id"/>
<result property="productSpecId" column="product_spec_id"/>
......@@ -479,4 +489,36 @@
AND mp.is_deleted = 0
AND gi.is_deleted = 0
</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>
......@@ -152,52 +152,50 @@
order by wi.create_time DESC
</select>
<select id="countListWareInfoPage" parameterType="com.mmc.pms.model.qo.WareInfoQO" resultType="int">
select count(*)
from ware_info wi INNER JOIN ware_img img ON wi.id=img.ware_info_id LEFT JOIN ware_prop wp on
wi.id=wp.ware_info_id
where wi.is_deleted = 0 and img.img_type = 0
<if test="districtId != null ">
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 test="modelId != null and modelId != '' ">
and wi.model_id = #{modelId}
</if>
<select id="countListWareInfoPage" parameterType="com.mmc.pms.entity.GoodsInfo" resultType="int">
SELECT count(*)
FROM goods_info gi
<where>
gi.is_deleted = 0 and gi.shelf_status = 1 and gi.goods_type = #{type}
<if test="categoryIds != null and categoryIds.size != 0">
<foreach collection="categoryIds" item="item" index="index" open="and gi.category_by_one IN (" close=")"
separator=",">
#{item}
</foreach>
</if>
<if test="userIds != null">
<foreach collection="userIds" item="user" index="index" open="and gi.add_goods_user_id IN (" close=")"
separator=",">
#{user}
</foreach>
</if>
</where>
</select>
<select id="listWareInfoPage" parameterType="com.mmc.pms.model.qo.WareInfoQO" resultMap="wareInfoResultMap">
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,
wi.max_rent,wi.total_stock,wi.total_sale,wi.sku_num,wi.tags,wi.district_id,
wi.brand_id,
wi.model_id,wi.create_time,wi.update_time,img.id as
ware_img_id,img.ware_info_id,img.img_url,img.img_type,wp.prop_info_id
from ware_info wi INNER JOIN ware_img img ON wi.id=img.ware_info_id LEFT JOIN ware_prop wp on
wi.id=wp.ware_info_id
where wi.is_deleted = 0 and img.img_type = 0
<if test="id != null ">
and wi.id = #{id}
</if>
<if test="districtId != null ">
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 test="modelId != null and modelId != '' ">
and wi.model_id = #{modelId}
</if>
order by wi.create_time DESC
limit #{pageNo},#{pageSize}
<select id="listWareInfoPage" resultType="com.mmc.pms.entity.GoodsInfo">
SELECT
gi.id,gi.goods_name,img.img_url mainImg
FROM
goods_info gi
INNER JOIN goods_img img ON gi.id = img.goods_info_id and img.img_type = 0 AND img.is_deleted = 0
<where>
gi.is_deleted = 0 and gi.shelf_status = 1 and gi.goods_type = #{type}
<if test="param.categoryId != null">
<foreach collection="param.categoryId" item="item" index="index" open="and gi.category_by_one IN ("
close=")"
separator=",">
#{item}
</foreach>
</if>
<if test="userIds != null">
<foreach collection="userIds" item="user" index="index" open="and gi.add_goods_user_id IN (" close=")"
separator=",">
#{user}
</foreach>
</if>
</where>
order by gi.create_time asc
limit #{param.pageNo},#{param.pageSize}
</select>
<select id="getWareInfoById" resultMap="wareInfoResultMap" parameterType="java.lang.Integer">
select wi.id,
......@@ -243,37 +241,48 @@
where ware_info_id = #{wareInfoId}
</select>
<select id="ad" resultType="com.mmc.pms.entity.AdDO">
SELECT
id,
image_url AS imageUrl
FROM
device_ad
SELECT id,
image_url AS imageUrl
FROM device_ad
</select>
<resultMap type="com.mmc.pms.entity.SkuInfoDO"
id="skuInfoDoResultMap">
<id property="id" column="sku_info_id" />
<result property="wareInfoId" column="ware_info_id" />
<result property="skuTitle" column="sku_title" />
<result property="rentDeposit" column="rent_deposit" />
<result property="stockNum" column="stock_num" />
<result property="saleNum" column="sale_num" />
<result property="rentDeposit" column="rent_deposit" />
<result property="updateTime" column="update_time" />
<result property="createTime" column="create_time" />
<id property="id" column="sku_info_id"/>
<result property="wareInfoId" column="ware_info_id"/>
<result property="skuTitle" column="sku_title"/>
<result property="rentDeposit" column="rent_deposit"/>
<result property="stockNum" column="stock_num"/>
<result property="saleNum" column="sale_num"/>
<result property="rentDeposit" column="rent_deposit"/>
<result property="updateTime" column="update_time"/>
<result property="createTime" column="create_time"/>
<collection property="skuPriceDOList" javaType="java.util.List"
ofType="com.mmc.pms.entity.SkuPriceDO">
<id property="id" column="sku_price_id" />
<result property="wareInfoId" column="ware_info_id" />
<result property="skuInfoId" column="sku_info_id" />
<result property="rentPrice" column="rent_price" />
<result property="minDay" column="min_day" />
<result property="maxDay" column="max_day" />
<id property="id" column="sku_price_id"/>
<result property="wareInfoId" column="ware_info_id"/>
<result property="skuInfoId" column="sku_info_id"/>
<result property="rentPrice" column="rent_price"/>
<result property="minDay" column="min_day"/>
<result property="maxDay" column="max_day"/>
</collection>
</resultMap>
<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,
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 si.id as sku_info_id,
si.ware_info_id,
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>
</mapper>
......@@ -167,7 +167,7 @@
SELECT count(1)
FROM goods_info gi
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
INNER JOIN brand_info bi ON ps.brand_info_id = bi.id
AND bi.is_delete = 0
......
......@@ -64,6 +64,7 @@
service_introduction, create_time, update_time, account_id
from service
<where>
is_deleted = 0
<if test="serviceName != null and serviceName != ''">
and service_name LIKE CONCAT('%',#{serviceName},'%')
</if>
......@@ -73,11 +74,9 @@
<if test="industryId != null">
and industry_id = #{industryId}
</if>
<if test="accountId != null">
and account_id = #{accountId}
<if test="displayState != null">
and display_state = #{displayState}
</if>
and is_deleted = 0
and display_state = 0
</where>
order by create_time desc
limit #{pageNo}, #{pageSize}
......@@ -88,6 +87,7 @@
select count(*)
from service
<where>
is_deleted = 0
<if test="serviceName != null and serviceName != ''">
and service_name LIKE CONCAT('%',#{serviceName},'%')
</if>
......@@ -97,11 +97,9 @@
<if test="industryId != null">
and industry_id = #{industryId}
</if>
<if test="accountId != null">
and account_id = #{accountId}
<if test="displayState != null">
and display_state = #{displayState}
</if>
and is_deleted = 0
and display_state = 0
</where>
</select>
......@@ -155,9 +153,117 @@
</update>
<!--通过主键删除-->
<update id="deleteById" parameterType="java.lang.Integer">
<update id="deleteByIds" parameterType="java.lang.Integer">
update service
set is_deleted = 1
where id = #{id}
where
<foreach collection="ids" open="id in (" close=")" item="item" separator=",">
#{item}
</foreach>
</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>
\ No newline at end of file
......@@ -7,3 +7,13 @@ data-filter:
- /pms/swagger-resources/**
- /pms/webjars/**
- /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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论