parent
a0a568ba55
commit
0dfac960fe
879 changed files with 14050 additions and 74049 deletions
@ -0,0 +1,38 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
package com.huoran.common.bo; |
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
/** |
||||||
|
* token信息,该信息存在redis中 |
||||||
|
* |
||||||
|
* @author 菠萝凤梨 |
||||||
|
* @date 2022/3/25 17:33 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class TokenInfoBO { |
||||||
|
|
||||||
|
/** |
||||||
|
* 保存在token信息里面的用户信息 |
||||||
|
*/ |
||||||
|
private UserInfoInTokenBO userInfoInToken; |
||||||
|
|
||||||
|
private String accessToken; |
||||||
|
|
||||||
|
private String refreshToken; |
||||||
|
|
||||||
|
/** |
||||||
|
* 在多少秒后过期 |
||||||
|
*/ |
||||||
|
private Integer expiresIn; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,67 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
package com.huoran.common.bo; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.util.Set; |
||||||
|
|
||||||
|
/** |
||||||
|
* 保存在token信息里面的用户信息 |
||||||
|
* |
||||||
|
* @author 菠萝凤梨 |
||||||
|
* @date 2022/3/25 17:33 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class UserInfoInTokenBO { |
||||||
|
|
||||||
|
/** |
||||||
|
* 用户在自己系统的用户id |
||||||
|
*/ |
||||||
|
private String userId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 租户id (商家id) |
||||||
|
*/ |
||||||
|
private Long shopId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 昵称 |
||||||
|
*/ |
||||||
|
private String nickName; |
||||||
|
|
||||||
|
/** |
||||||
|
* 系统类型 |
||||||
|
*/ |
||||||
|
private Integer sysType; |
||||||
|
|
||||||
|
/** |
||||||
|
* 是否是管理员 |
||||||
|
*/ |
||||||
|
private Integer isAdmin; |
||||||
|
|
||||||
|
private String bizUserId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 权限列表 |
||||||
|
*/ |
||||||
|
private Set<String> perms; |
||||||
|
|
||||||
|
/** |
||||||
|
* 状态 1 正常 0 无效 |
||||||
|
*/ |
||||||
|
private Boolean enabled; |
||||||
|
|
||||||
|
/** |
||||||
|
* 其他Id |
||||||
|
*/ |
||||||
|
private Long otherId; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,66 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.common.exception; |
||||||
|
|
||||||
|
|
||||||
|
import com.huoran.common.response.ResponseEnum; |
||||||
|
import com.huoran.common.response.ServerResponseEntity; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author lanhai |
||||||
|
*/ |
||||||
|
@Getter |
||||||
|
public class YamiShopBindException extends RuntimeException{ |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
*/ |
||||||
|
private static final long serialVersionUID = -4137688758944857209L; |
||||||
|
|
||||||
|
/** |
||||||
|
* http状态码 |
||||||
|
*/ |
||||||
|
private String code; |
||||||
|
|
||||||
|
private Object object; |
||||||
|
|
||||||
|
private ServerResponseEntity<?> serverResponseEntity; |
||||||
|
|
||||||
|
public YamiShopBindException(ResponseEnum responseEnum) { |
||||||
|
super(responseEnum.getMsg()); |
||||||
|
this.code = responseEnum.value(); |
||||||
|
} |
||||||
|
/** |
||||||
|
* @param responseEnum |
||||||
|
*/ |
||||||
|
public YamiShopBindException(ResponseEnum responseEnum, String msg) { |
||||||
|
super(msg); |
||||||
|
this.code = responseEnum.value(); |
||||||
|
} |
||||||
|
|
||||||
|
public YamiShopBindException(ServerResponseEntity<?> serverResponseEntity) { |
||||||
|
this.serverResponseEntity = serverResponseEntity; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public YamiShopBindException(String msg) { |
||||||
|
super(msg); |
||||||
|
this.code = ResponseEnum.SHOW_FAIL.value(); |
||||||
|
} |
||||||
|
|
||||||
|
public YamiShopBindException(String msg, Object object) { |
||||||
|
super(msg); |
||||||
|
this.code = ResponseEnum.SHOW_FAIL.value(); |
||||||
|
this.object = object; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
package com.huoran.common.response; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author lanhai |
||||||
|
*/ |
||||||
|
public interface ResponseCode { |
||||||
|
|
||||||
|
int SUCCESS = 1; |
||||||
|
int FAIL = -1; |
||||||
|
} |
@ -0,0 +1,69 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
package com.huoran.common.response; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author FrozenWatermelon |
||||||
|
* @date 2020/7/9 |
||||||
|
*/ |
||||||
|
public enum ResponseEnum { |
||||||
|
|
||||||
|
/** |
||||||
|
* ok |
||||||
|
*/ |
||||||
|
OK("00000", "ok"), |
||||||
|
SHOW_FAIL("A00001", ""), |
||||||
|
|
||||||
|
/** |
||||||
|
* 用于直接显示提示用户的错误,内容由输入内容决定 |
||||||
|
*/ |
||||||
|
|
||||||
|
/** |
||||||
|
* 用于直接显示提示系统的成功,内容由输入内容决定 |
||||||
|
*/ |
||||||
|
SHOW_SUCCESS("A00002", ""), |
||||||
|
|
||||||
|
/** |
||||||
|
* 未授权 |
||||||
|
*/ |
||||||
|
UNAUTHORIZED("A00004", "Unauthorized"), |
||||||
|
|
||||||
|
/** |
||||||
|
* 服务器出了点小差 |
||||||
|
*/ |
||||||
|
EXCEPTION("A00005", "服务器出了点小差"), |
||||||
|
/** |
||||||
|
* 方法参数没有校验,内容由输入内容决定 |
||||||
|
*/ |
||||||
|
METHOD_ARGUMENT_NOT_VALID("A00014", "方法参数没有校验"); |
||||||
|
|
||||||
|
private final String code; |
||||||
|
|
||||||
|
private final String msg; |
||||||
|
|
||||||
|
public String value() { |
||||||
|
return code; |
||||||
|
} |
||||||
|
|
||||||
|
public String getMsg() { |
||||||
|
return msg; |
||||||
|
} |
||||||
|
|
||||||
|
ResponseEnum(String code, String msg) { |
||||||
|
this.code = code; |
||||||
|
this.msg = msg; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String toString() { |
||||||
|
return "ResponseEnum{" + "code='" + code + '\'' + ", msg='" + msg + '\'' + "} " + super.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,36 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.common.response; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.util.Objects; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author lanhai |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class ServerResponse<T> implements Serializable { |
||||||
|
|
||||||
|
|
||||||
|
private int code; |
||||||
|
|
||||||
|
private String msg; |
||||||
|
|
||||||
|
private T obj; |
||||||
|
|
||||||
|
public boolean isSuccess(){ |
||||||
|
return Objects.equals(ResponseCode.SUCCESS, this.code); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,198 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.common.response; |
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.util.Objects; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author lanhai |
||||||
|
*/ |
||||||
|
@Slf4j |
||||||
|
public class ServerResponseEntity<T> implements Serializable { |
||||||
|
|
||||||
|
/** |
||||||
|
* 状态码 |
||||||
|
*/ |
||||||
|
private String code; |
||||||
|
|
||||||
|
/** |
||||||
|
* 信息 |
||||||
|
*/ |
||||||
|
private String msg; |
||||||
|
|
||||||
|
/** |
||||||
|
* 数据 |
||||||
|
*/ |
||||||
|
private T data; |
||||||
|
|
||||||
|
/** |
||||||
|
* 版本 |
||||||
|
*/ |
||||||
|
private String version; |
||||||
|
|
||||||
|
/** |
||||||
|
* 时间 |
||||||
|
*/ |
||||||
|
private Long timestamp; |
||||||
|
|
||||||
|
private String sign; |
||||||
|
|
||||||
|
public String getSign() { |
||||||
|
return sign; |
||||||
|
} |
||||||
|
|
||||||
|
public void setSign(String sign) { |
||||||
|
this.sign = sign; |
||||||
|
} |
||||||
|
|
||||||
|
public String getCode() { |
||||||
|
return code; |
||||||
|
} |
||||||
|
|
||||||
|
public void setCode(String code) { |
||||||
|
this.code = code; |
||||||
|
} |
||||||
|
|
||||||
|
public String getMsg() { |
||||||
|
return msg; |
||||||
|
} |
||||||
|
|
||||||
|
public void setMsg(String msg) { |
||||||
|
this.msg = msg; |
||||||
|
} |
||||||
|
|
||||||
|
public T getData() { |
||||||
|
return data; |
||||||
|
} |
||||||
|
|
||||||
|
public ServerResponseEntity setData(T data) { |
||||||
|
this.data = data; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public String getVersion() { |
||||||
|
return version; |
||||||
|
} |
||||||
|
|
||||||
|
public void setVersion(String version) { |
||||||
|
this.version = version; |
||||||
|
} |
||||||
|
|
||||||
|
public Long getTimestamp() { |
||||||
|
return timestamp; |
||||||
|
} |
||||||
|
|
||||||
|
public void setTimestamp(Long timestamp) { |
||||||
|
this.timestamp = timestamp; |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isSuccess() { |
||||||
|
return Objects.equals(ResponseEnum.OK.value(), this.code); |
||||||
|
} |
||||||
|
public boolean isFail() { |
||||||
|
return !Objects.equals(ResponseEnum.OK.value(), this.code); |
||||||
|
} |
||||||
|
|
||||||
|
public ServerResponseEntity() { |
||||||
|
// 版本号
|
||||||
|
this.version = "mall4j.v230424"; |
||||||
|
} |
||||||
|
|
||||||
|
public static <T> ServerResponseEntity<T> success(T data) { |
||||||
|
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>(); |
||||||
|
serverResponseEntity.setData(data); |
||||||
|
serverResponseEntity.setCode(ResponseEnum.OK.value()); |
||||||
|
return serverResponseEntity; |
||||||
|
} |
||||||
|
|
||||||
|
public static <T> ServerResponseEntity<T> success() { |
||||||
|
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>(); |
||||||
|
serverResponseEntity.setCode(ResponseEnum.OK.value()); |
||||||
|
serverResponseEntity.setMsg(ResponseEnum.OK.getMsg()); |
||||||
|
return serverResponseEntity; |
||||||
|
} |
||||||
|
|
||||||
|
public static <T> ServerResponseEntity<T> success(Integer code, T data) { |
||||||
|
return success(String.valueOf(code), data); |
||||||
|
} |
||||||
|
|
||||||
|
public static <T> ServerResponseEntity<T> success(String code, T data) { |
||||||
|
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>(); |
||||||
|
serverResponseEntity.setCode(code); |
||||||
|
serverResponseEntity.setData(data); |
||||||
|
return serverResponseEntity; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 前端显示失败消息 |
||||||
|
* @param msg 失败消息 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static <T> ServerResponseEntity<T> showFailMsg(String msg) { |
||||||
|
log.error(msg); |
||||||
|
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>(); |
||||||
|
serverResponseEntity.setMsg(msg); |
||||||
|
serverResponseEntity.setCode(ResponseEnum.SHOW_FAIL.value()); |
||||||
|
return serverResponseEntity; |
||||||
|
} |
||||||
|
|
||||||
|
public static <T> ServerResponseEntity<T> fail(ResponseEnum responseEnum) { |
||||||
|
log.error(responseEnum.toString()); |
||||||
|
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>(); |
||||||
|
serverResponseEntity.setMsg(responseEnum.getMsg()); |
||||||
|
serverResponseEntity.setCode(responseEnum.value()); |
||||||
|
return serverResponseEntity; |
||||||
|
} |
||||||
|
|
||||||
|
public static <T> ServerResponseEntity<T> fail(ResponseEnum responseEnum, T data) { |
||||||
|
log.error(responseEnum.toString()); |
||||||
|
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>(); |
||||||
|
serverResponseEntity.setMsg(responseEnum.getMsg()); |
||||||
|
serverResponseEntity.setCode(responseEnum.value()); |
||||||
|
serverResponseEntity.setData(data); |
||||||
|
return serverResponseEntity; |
||||||
|
} |
||||||
|
|
||||||
|
public static <T> ServerResponseEntity<T> fail(String code, String msg, T data) { |
||||||
|
log.error(msg); |
||||||
|
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>(); |
||||||
|
serverResponseEntity.setMsg(msg); |
||||||
|
serverResponseEntity.setCode(code); |
||||||
|
serverResponseEntity.setData(data); |
||||||
|
return serverResponseEntity; |
||||||
|
} |
||||||
|
|
||||||
|
public static <T> ServerResponseEntity<T> fail(String code, String msg) { |
||||||
|
return fail(code, msg, null); |
||||||
|
} |
||||||
|
|
||||||
|
public static <T> ServerResponseEntity<T> fail(Integer code, T data) { |
||||||
|
ServerResponseEntity<T> serverResponseEntity = new ServerResponseEntity<>(); |
||||||
|
serverResponseEntity.setCode(String.valueOf(code)); |
||||||
|
serverResponseEntity.setData(data); |
||||||
|
return serverResponseEntity; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String toString() { |
||||||
|
return "ServerResponseEntity{" + |
||||||
|
"code='" + code + '\'' + |
||||||
|
", msg='" + msg + '\'' + |
||||||
|
", data=" + data + |
||||||
|
", version='" + version + '\'' + |
||||||
|
", timestamp=" + timestamp + |
||||||
|
", sign='" + sign + '\'' + |
||||||
|
'}'; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,31 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.nakadai.config; |
||||||
|
|
||||||
|
import cn.hutool.core.lang.Snowflake; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import org.springframework.context.annotation.Bean; |
||||||
|
import org.springframework.context.annotation.Configuration; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author lanhai |
||||||
|
*/ |
||||||
|
@Configuration |
||||||
|
@AllArgsConstructor |
||||||
|
public class AdminBeanConfig { |
||||||
|
|
||||||
|
private final AdminConfig adminConfig; |
||||||
|
|
||||||
|
@Bean |
||||||
|
public Snowflake snowflake() { |
||||||
|
return new Snowflake(adminConfig.getWorkerId(), adminConfig.getDatacenterId()); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,39 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.nakadai.config; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties; |
||||||
|
import org.springframework.context.annotation.PropertySource; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 商城配置文件 |
||||||
|
* @author lgh |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@Component |
||||||
|
@PropertySource("classpath:admin.properties") |
||||||
|
@ConfigurationProperties(prefix = "admin") |
||||||
|
public class AdminConfig { |
||||||
|
|
||||||
|
/** |
||||||
|
* 数据中心ID |
||||||
|
*/ |
||||||
|
private Integer datacenterId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 终端ID |
||||||
|
*/ |
||||||
|
private Integer workerId; |
||||||
|
|
||||||
|
} |
@ -1,132 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.common.constant.DelConstant; |
|
||||||
import com.huoran.common.exception.ExceptionEnum; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.PageUtils; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.*; |
|
||||||
import com.huoran.nakadai.entity.req.CustomerListReq; |
|
||||||
import com.huoran.nakadai.entity.req.CustomerReq; |
|
||||||
import com.huoran.nakadai.entity.req.ListOfClientCommercialManagersReq; |
|
||||||
import com.huoran.nakadai.entity.res.*; |
|
||||||
import com.huoran.nakadai.mapper.CustomerMapper; |
|
||||||
import com.huoran.nakadai.mapper.HrStaffMapper; |
|
||||||
import com.huoran.nakadai.service.*; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import javax.validation.Valid; |
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.List; |
|
||||||
import java.util.UUID; |
|
||||||
import java.util.concurrent.ExecutionException; |
|
||||||
|
|
||||||
|
|
||||||
@Api(value = "小程序-客户管理", tags = "小程序-客户管理") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/applets/customer") |
|
||||||
public class AppletsCustomerController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private ICustomerService iCustomerService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private PartnerAccountService partnerAccountService; |
|
||||||
|
|
||||||
|
|
||||||
@Autowired |
|
||||||
private PartnerTeamService partnerTeamService; |
|
||||||
|
|
||||||
|
|
||||||
@Autowired |
|
||||||
private PartnerClassificationService partnerClassificationService; |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "我的客户/团队全部客户",response = AppletsMyClientsForBusinessResp.class) |
|
||||||
@PostMapping("/customerList") |
|
||||||
public R allClientsOfTheTeam(@RequestBody ListOfClientCommercialManagersReq req) { |
|
||||||
return iCustomerService.getCustomerListBasedOnBusinessManagerId(req); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* @ApiOperation(value = "根据商务经理id获取客户列表", notes = "根据商务经理id获取客户列表",response = AppletsMyClientsForBusinessResp.class) |
|
||||||
@PostMapping("/getCustomerListBasedOnBusinessManagerId") |
|
||||||
public R getCustomerListBasedOnBusinessManagerId(@RequestBody ListOfClientCommercialManagersReq req) { |
|
||||||
return iCustomerService.getCustomerListBasedOnBusinessManagerId(req); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "团队全部客户", notes = "团队全部客户所需参数:(businessManagerIds、keywords、customerType及分页参数)",response = AppletsMyClientsForBusinessResp.class) |
|
||||||
@PostMapping("/allClientsOfTheTeam") |
|
||||||
public R allClientsOfTheTeam(@RequestBody ListOfClientCommercialManagersReq req) { |
|
||||||
//根据团队id获取团队下所有成员的商务经理id
|
|
||||||
List<Integer> getMembersUnderTheSameTeam = partnerTeamService.getMembersUnderTheSameTeam(req.getClassificationId()); |
|
||||||
req.setBusinessManagerIds(getMembersUnderTheSameTeam); |
|
||||||
|
|
||||||
return iCustomerService.getCustomerListBasedOnBusinessManagerId(req); |
|
||||||
}*/ |
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "根据token获取当前用户的团队信息", notes = "根据token获取当前用户的团队信息",response = PartnerAccountResp.class) |
|
||||||
@PostMapping("/getTeamsByAccountId") |
|
||||||
public R getTeamsByAccountId(HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
if (accountId.equals("")){ |
|
||||||
return R.error("Token不存在"); |
|
||||||
} |
|
||||||
return partnerAccountService.getTeamsByAccountId(Integer.valueOf(accountId)); |
|
||||||
} |
|
||||||
|
|
||||||
/*@ApiOperation("依据团队id查询团队下的全部商务经理(集合)") |
|
||||||
@PostMapping("/getTheBusinessManagerIdsUnderTheTeam") |
|
||||||
public List<Integer> selectCategoryChildById(Integer id) { |
|
||||||
List<Integer> businessManagerIds = new ArrayList<>(); |
|
||||||
//1 创建list集合,用于封装所有删除菜单id值
|
|
||||||
List<Integer> idList = new ArrayList<>(); |
|
||||||
//2 向idList集合设置删除菜单id
|
|
||||||
this.selectCategoryChildById(id + "", idList);//找到当前菜单的子菜单 把结果id封装到idlist里面去
|
|
||||||
//把当前id封装到list里面
|
|
||||||
idList.add(id);//现在把当前id封装进去 之前都是子菜单的id
|
|
||||||
String str = ""; |
|
||||||
for (Integer idstr : idList) { |
|
||||||
str += idstr + ","; |
|
||||||
} |
|
||||||
|
|
||||||
if (!str.equals("")){ |
|
||||||
//依据团队id查询商务经理id(集合)
|
|
||||||
businessManagerIds = partnerClassificationService.queryBusinessManagerIdBasedOnTeamId(str.substring(0,str.length()-1)); |
|
||||||
} |
|
||||||
return businessManagerIds; |
|
||||||
} |
|
||||||
|
|
||||||
//2 根据当前菜单id,查询菜单里面子菜单id,封装到list集合
|
|
||||||
public void selectCategoryChildById(String id, List<Integer> idList) { |
|
||||||
//查询菜单里面子菜单id
|
|
||||||
QueryWrapper<PartnerClassification> wrapper = new QueryWrapper<PartnerClassification>(); |
|
||||||
wrapper.eq("parent_id", id); |
|
||||||
wrapper.eq("is_del", 0); |
|
||||||
wrapper.eq("is_team", 0); |
|
||||||
wrapper.select("id");//我们只想查询id 所以只需要查询指定列的值
|
|
||||||
List<PartnerClassification> childIdList = partnerClassificationService.list(wrapper);//当前菜单的所有子菜单
|
|
||||||
//把childIdList里面菜单id值获取出来,封装idList里面,做递归查询
|
|
||||||
childIdList.stream().forEach(item -> {//遍历集合得到每一个对象item
|
|
||||||
//封装idList里面
|
|
||||||
idList.add(item.getId()); |
|
||||||
//递归查询
|
|
||||||
this.selectCategoryChildById(item.getId() + "", idList); |
|
||||||
}); |
|
||||||
}*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} |
|
@ -1,56 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.nakadai.entity.Order; |
|
||||||
import com.huoran.nakadai.entity.req.DeleteIds; |
|
||||||
import com.huoran.nakadai.entity.req.ListOfClientCommercialManagersReq; |
|
||||||
import com.huoran.nakadai.entity.req.OrderListReq; |
|
||||||
import com.huoran.nakadai.entity.req.OrderRecordParametersReq; |
|
||||||
import com.huoran.nakadai.entity.res.AppletsMyClientsForBusinessResp; |
|
||||||
import com.huoran.nakadai.entity.res.ExportSubscribedRecordsResp; |
|
||||||
import com.huoran.nakadai.entity.vo.OrderVo; |
|
||||||
import com.huoran.nakadai.service.IOrderService; |
|
||||||
import com.huoran.nakadai.service.PartnerTeamService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import javax.servlet.http.HttpServletResponse; |
|
||||||
import javax.validation.Valid; |
|
||||||
import javax.validation.constraints.NotNull; |
|
||||||
import java.util.HashMap; |
|
||||||
import java.util.List; |
|
||||||
import java.util.concurrent.ExecutionException; |
|
||||||
|
|
||||||
|
|
||||||
@Api(value = "小程序-订单", tags = "小程序-订单") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/applets/order") |
|
||||||
public class AppletsOrderController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private IOrderService orderService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private PartnerTeamService partnerTeamService; |
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "我的订单/团队订单",response = Order.class) |
|
||||||
@PostMapping("/orderList") |
|
||||||
public R allTeamOrders(@RequestBody ListOfClientCommercialManagersReq req) { |
|
||||||
return orderService.getOrderBasedOnBusinessManagerId(req); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "小程序订单记录",response = Order.class) |
|
||||||
@PostMapping("/miniProgramOrderRecord") |
|
||||||
public R miniProgramOrderRecord(@RequestBody OrderRecordParametersReq req) { |
|
||||||
return orderService.miniProgramOrderRecord(req); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,118 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.PartnerArticleFile; |
|
||||||
import com.huoran.nakadai.entity.PartnerArticleManagement; |
|
||||||
import com.huoran.nakadai.entity.PartnerArticleStatistic; |
|
||||||
import com.huoran.nakadai.entity.req.SalesProgressReq; |
|
||||||
import com.huoran.nakadai.entity.res.AnnualOperatingAnalysisResp; |
|
||||||
import com.huoran.nakadai.service.*; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate; |
|
||||||
import org.springframework.data.redis.core.ValueOperations; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
|
|
||||||
@Api(value = "小程序-合伙人", tags = "小程序-合伙人") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/applets/partner") |
|
||||||
public class AppletsPartnerController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private ICustomerService iCustomerService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private PartnerAccountService partnerAccountService; |
|
||||||
|
|
||||||
|
|
||||||
@Autowired |
|
||||||
private PartnerTeamService partnerTeamService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public PartnerArticleManagementService articleManagementService; |
|
||||||
@Autowired |
|
||||||
public PartnerArticleFileService fileService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public PartnerArticleLabelService labelService; |
|
||||||
|
|
||||||
|
|
||||||
@Autowired |
|
||||||
public PartnerArticleStatisticService articleStatisticService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public PartnerArticleClassificationService articleClassificationService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private StringRedisTemplate redisTemplate; |
|
||||||
@Autowired |
|
||||||
private PartnerClassificationService partnerClassificationService; |
|
||||||
|
|
||||||
@ApiOperation(value = "销售进展") |
|
||||||
@PostMapping("/salesProgress") |
|
||||||
public R salesProgress(@RequestBody SalesProgressReq req) { |
|
||||||
|
|
||||||
//customerType 客户类型(1、正式 2、试用 3、到期
|
|
||||||
req.setCustomerType(2); |
|
||||||
//试用产品
|
|
||||||
Integer trialProduct = iCustomerService.newProductAddedToOrder(req); |
|
||||||
//试用用户
|
|
||||||
Integer trialUser = iCustomerService.newCustomerOnOrder(req); |
|
||||||
req.setCustomerType(1); |
|
||||||
//正式用户
|
|
||||||
Integer regularUser = iCustomerService.newCustomerOnOrder(req); |
|
||||||
//正式产品
|
|
||||||
Integer officialProduct = iCustomerService.newProductAddedToOrder(req); |
|
||||||
|
|
||||||
return R.ok().put("trialUser", trialUser). |
|
||||||
put("regularUser", regularUser). |
|
||||||
put("trialProduct", trialProduct). |
|
||||||
put("officialProduct", officialProduct); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "预览学习(增加浏览次数)") |
|
||||||
@PostMapping("/browse") |
|
||||||
public R browse(@ApiParam(name = "contentId", value = "文章id", required = true) @RequestParam Integer contentId, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
List<PartnerArticleFile> fileList = fileService.getFileByContentId(contentId); |
|
||||||
PartnerArticleManagement partnerArticleManagement = articleManagementService.getById(contentId); |
|
||||||
partnerArticleManagement.setFileList(fileList); |
|
||||||
partnerArticleManagement.setClassificationNameList(articleClassificationService.categoryIdsQueriesCategoryInformation(partnerArticleManagement.getClassificationId() + "")); |
|
||||||
partnerArticleManagement.setLabelNameList((labelService.idsQueriesLabelInformation(partnerArticleManagement.getLableId() + ""))); |
|
||||||
partnerArticleManagement.setTotalBrowsing(articleStatisticService.statisticsOfVisitors(contentId)); |
|
||||||
|
|
||||||
//存浏览的文章 用于返回上次浏览的文章
|
|
||||||
ValueOperations<String, String> opsForString = redisTemplate.opsForValue(); |
|
||||||
String key = "browse:accountId=" + accountId; |
|
||||||
//将数据存入缓存
|
|
||||||
opsForString.set(key, contentId + ""); |
|
||||||
|
|
||||||
//增加浏览记录
|
|
||||||
PartnerArticleStatistic statistic = new PartnerArticleStatistic(); |
|
||||||
statistic.setAccountId(Integer.valueOf(accountId)); |
|
||||||
statistic.setContentId(contentId); |
|
||||||
//判断是否存在浏览记录过 返回true表示可新增 需求:已学习人数即一个用户点多次只算一次,不重复计算
|
|
||||||
boolean flag = articleStatisticService.checkForExistence(statistic); |
|
||||||
if (flag) { |
|
||||||
articleStatisticService.save(statistic); |
|
||||||
} |
|
||||||
return R.ok(partnerArticleManagement); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "年度经营分析", response = AnnualOperatingAnalysisResp.class) |
|
||||||
@PostMapping("/annualOperatingAnalysis") |
|
||||||
public R annualOperatingAnalysis(@RequestBody SalesProgressReq req, HttpServletRequest request) { |
|
||||||
String jwtToken = request.getHeader("token"); |
|
||||||
System.out.println("token:{}{}{}{}{}"+jwtToken); |
|
||||||
return R.ok().put("data", iCustomerService.annualOperatingAnalysis(req)); |
|
||||||
} |
|
||||||
} |
|
@ -1,121 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil; |
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.api.UserClient; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.config.filter.SensitiveFilter; |
|
||||||
import com.huoran.nakadai.entity.Comment; |
|
||||||
import com.huoran.nakadai.entity.Notify; |
|
||||||
import com.huoran.nakadai.entity.res.CommentRes; |
|
||||||
import com.huoran.nakadai.service.CommentService; |
|
||||||
import com.huoran.nakadai.service.NotifyService; |
|
||||||
|
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import java.io.IOException; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 课程评论回复表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2023-05-25 |
|
||||||
*/ |
|
||||||
@Api(value = "C-课程评论回复管理", tags = "C-课程评论回复管理") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/comment") |
|
||||||
public class CommentController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private CommentService commentService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private NotifyService notifyService; |
|
||||||
|
|
||||||
// @Autowired
|
|
||||||
// private WebsocketService webSocketService;
|
|
||||||
|
|
||||||
@Autowired |
|
||||||
private UserClient userClient; |
|
||||||
|
|
||||||
@ApiOperation(value = "课程评论树列表", response = CommentRes.class) |
|
||||||
@GetMapping("/commentTreeList") |
|
||||||
public R commentTreeList( |
|
||||||
@ApiParam(name = "mallId", value = "商品id", required = true) |
|
||||||
@RequestParam Integer mallId, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
return commentService.commentTreeList(mallId,schoolId,accountId); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "添加课程评论") |
|
||||||
@PostMapping("/addComment") |
|
||||||
public R addComment( |
|
||||||
@ApiParam(name = "comment", value = "评论内容", required = true) |
|
||||||
@RequestBody Comment comment, HttpServletRequest request) throws IOException { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
comment.setSchoolId(schoolId); |
|
||||||
comment.setCreateAccountId(Integer.valueOf(accountId)); |
|
||||||
SensitiveFilter filter = SensitiveFilter.getInstance(); |
|
||||||
//需要过滤则用“”替换,如果需要屏蔽,则用“*”替换
|
|
||||||
String content = filter.replaceSensitiveWord(comment.getContent(), 2, "*"); |
|
||||||
comment.setContent(content); |
|
||||||
boolean save = commentService.save(comment); |
|
||||||
|
|
||||||
if (save && comment.getReplyAccountId()!=null && !comment.getReplyAccountId().equals(Integer.valueOf(accountId))){ |
|
||||||
//添加回复通知
|
|
||||||
if (comment.getStatus()==2){ |
|
||||||
//同一条评论消息未读,再次评论不通知
|
|
||||||
QueryWrapper<Notify> wrapper = new QueryWrapper<>(); |
|
||||||
wrapper.eq("is_read",0); |
|
||||||
wrapper.eq("comment_id",comment.getReplyCommentId()); |
|
||||||
wrapper.eq("account_id",comment.getReplyAccountId()); |
|
||||||
wrapper.eq("comment_account_id",Integer.valueOf(accountId)); |
|
||||||
Notify one = notifyService.getOne(wrapper); |
|
||||||
if (ObjectUtil.isNull(one)){ |
|
||||||
Notify notify = new Notify(); |
|
||||||
notify.setType(2); |
|
||||||
notify.setAccountId(comment.getReplyAccountId()); |
|
||||||
notify.setCommentId(comment.getReplyCommentId()); |
|
||||||
notify.setCommentAccountId(Integer.valueOf(accountId)); |
|
||||||
notifyService.save(notify); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
// 发送webSocket消息
|
|
||||||
// if (comment.getReplyAccountId()!=null){
|
|
||||||
// WebsocketMsgDTO websocketMsgDTO = new WebsocketMsgDTO();
|
|
||||||
// websocketMsgDTO.setForm(accountId);
|
|
||||||
// websocketMsgDTO.setUsername(accountId);
|
|
||||||
// websocketMsgDTO.setTo(comment.getReplyAccountId().toString());
|
|
||||||
// websocketMsgDTO.setContent(comment.getContent());
|
|
||||||
// websocketMsgDTO.setExtras(null);
|
|
||||||
// webSocketService.send(websocketMsgDTO);
|
|
||||||
// }
|
|
||||||
|
|
||||||
return save ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "删除评论") |
|
||||||
@PostMapping("/deleteAComment") |
|
||||||
public R deleteAComment( |
|
||||||
@ApiParam(name = "commentId", value = "评论id", required = true) |
|
||||||
@RequestParam Integer commentId) { |
|
||||||
return commentService.removeChildById(commentId); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,87 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.Comment; |
|
||||||
import com.huoran.nakadai.entity.CommentLike; |
|
||||||
import com.huoran.nakadai.entity.Notify; |
|
||||||
import com.huoran.nakadai.service.CommentLikeService; |
|
||||||
import com.huoran.nakadai.service.CommentService; |
|
||||||
import com.huoran.nakadai.service.NotifyService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.PostMapping; |
|
||||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||||
import org.springframework.web.bind.annotation.RequestParam; |
|
||||||
import org.springframework.web.bind.annotation.RestController; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 课程评论点赞表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2023-05-25 |
|
||||||
*/ |
|
||||||
@Api(value = "C-课程评论点赞管理", tags = "C-课程评论点赞管理") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/commentLike") |
|
||||||
public class CommentLikeController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private CommentLikeService commentLikeService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private CommentService commentService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private NotifyService notifyService; |
|
||||||
|
|
||||||
@ApiOperation(value = "评论点赞") |
|
||||||
@PostMapping("/commentAndLike") |
|
||||||
public R commentAndLike( |
|
||||||
@ApiParam(name = "commentId", value = "评论id", required = true) |
|
||||||
@RequestParam Integer commentId, HttpServletRequest request) { |
|
||||||
CommentLike commentLike = new CommentLike(); |
|
||||||
commentLike.setCommentId(commentId); |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
commentLike.setAccountId(Integer.valueOf(accountId)); |
|
||||||
boolean save = commentLikeService.save(commentLike); |
|
||||||
|
|
||||||
if (save){ |
|
||||||
Comment comment = commentService.getById(commentId); |
|
||||||
//添加点赞通知
|
|
||||||
Notify notify = new Notify(); |
|
||||||
notify.setType(1); |
|
||||||
notify.setAccountId(comment.getCreateAccountId()); |
|
||||||
notify.setCommentId(comment.getCommentId()); |
|
||||||
notify.setCommentAccountId(Integer.valueOf(accountId)); |
|
||||||
notifyService.save(notify); |
|
||||||
|
|
||||||
} |
|
||||||
return save ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "取消点赞") |
|
||||||
@PostMapping("/unlike") |
|
||||||
public R unlike( |
|
||||||
@ApiParam(name = "commentId", value = "评论id", required = true) |
|
||||||
@RequestParam Integer commentId, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
boolean remove = commentLikeService.remove(new QueryWrapper<CommentLike>().eq("comment_id", commentId). |
|
||||||
eq("account_id", accountId)); |
|
||||||
|
|
||||||
//删除点赞通知
|
|
||||||
notifyService.remove(new QueryWrapper<Notify>().eq("comment_id", commentId). |
|
||||||
eq("comment_account_id", accountId)); |
|
||||||
return remove ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,84 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.nakadai.entity.CurriculumChapter; |
|
||||||
import com.huoran.nakadai.entity.vo.ChapterVO; |
|
||||||
import com.huoran.nakadai.entity.vo.SortVO; |
|
||||||
import com.huoran.nakadai.service.CurriculumChapterService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import java.util.Date; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 企业课程章节表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author lr |
|
||||||
* @since 2021-09-26 |
|
||||||
*/ |
|
||||||
@Api(description = "课程章节管理", tags = "课程章节管理") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/curriculum/chapter") |
|
||||||
public class CurriculumChapterController { |
|
||||||
@Autowired |
|
||||||
private CurriculumChapterService curriculumChapterService; |
|
||||||
|
|
||||||
@ApiOperation(value = "根据课程id查询章节小节,树状结构") |
|
||||||
@GetMapping("/queryChaptersAndSubsections/{courseId}") |
|
||||||
public R queryChaptersAndSubsections( |
|
||||||
@ApiParam(name = "courseId", value = "课程ID", required = true) |
|
||||||
@PathVariable String courseId) { |
|
||||||
List<ChapterVO> chapterList = curriculumChapterService.getChapterTree(courseId); |
|
||||||
return R.ok().put("chapterList", chapterList); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "编辑排序") |
|
||||||
@PostMapping("/reorder") |
|
||||||
public R chapterReorder( |
|
||||||
@ApiParam(name = "sortVO", value = "章节小节重排序对象", required = true) |
|
||||||
@RequestBody SortVO sortVO) { |
|
||||||
boolean update = curriculumChapterService.updateSort(sortVO); |
|
||||||
return update ? R.ok() : R.error(); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "添加章节") |
|
||||||
@PostMapping("/addChapter") |
|
||||||
public R addChapter( |
|
||||||
@ApiParam(name = "courseChapter", value = "章节对象", required = true) |
|
||||||
@RequestBody CurriculumChapter chapter) { |
|
||||||
//判重
|
|
||||||
boolean isRepeat = curriculumChapterService.repeat(chapter); |
|
||||||
if (isRepeat) { |
|
||||||
return R.error("章节已存在"); |
|
||||||
} |
|
||||||
boolean save = curriculumChapterService.saveChapter(chapter); |
|
||||||
return save ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "修改章节") |
|
||||||
@PutMapping("/editChapter") |
|
||||||
public R editChapter( |
|
||||||
@ApiParam(name = "courseChapter", value = "章节对象", required = true) |
|
||||||
@RequestBody CurriculumChapter chapter) { |
|
||||||
boolean update = curriculumChapterService.updateById(chapter); |
|
||||||
return update ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "根据id删除章节") |
|
||||||
@DeleteMapping("/deleteChapter/{chapterId}") |
|
||||||
public R deleteChapter( |
|
||||||
@ApiParam(name = "chapterId", value = "章节ID", required = true) |
|
||||||
@PathVariable Integer chapterId) { |
|
||||||
boolean remove = curriculumChapterService.removeChapter(chapterId); |
|
||||||
return remove ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
@ -1,246 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.api.UserClient; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.Curriculum; |
|
||||||
import com.huoran.nakadai.entity.CurriculumConfigure; |
|
||||||
import com.huoran.nakadai.entity.CurriculumRecentUse; |
|
||||||
import com.huoran.nakadai.entity.req.AddCurriculumReq; |
|
||||||
import com.huoran.nakadai.entity.req.ModifyCurriculumReq; |
|
||||||
import com.huoran.nakadai.entity.req.PageCurriculumRecentUseReq; |
|
||||||
import com.huoran.nakadai.entity.req.PageCurriculumReq; |
|
||||||
import com.huoran.nakadai.service.CurriculumRecentUseService; |
|
||||||
import com.huoran.nakadai.service.ICurriculumConfigureService; |
|
||||||
import com.huoran.nakadai.service.ICurriculumService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.apache.ibatis.annotations.Param; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import javax.validation.Valid; |
|
||||||
import javax.validation.constraints.NotNull; |
|
||||||
import java.util.Date; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* @描述:课程管理控制类 |
|
||||||
* @作者: Rong |
|
||||||
* @日期: 2021-09-16 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/curriculum") |
|
||||||
@Api(value = "API - 课程管理", tags = "课程管理") |
|
||||||
public class CurriculumController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public ICurriculumService service; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public ICurriculumConfigureService configureService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private UserClient userClient; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private CurriculumRecentUseService restoreUseService; |
|
||||||
|
|
||||||
/** |
|
||||||
* @Description: 创建课程 |
|
||||||
* @auther: Rong |
|
||||||
* @date: 2021/9/17 10:42 |
|
||||||
*/ |
|
||||||
@PostMapping("/createCurriculum") |
|
||||||
@ApiOperation(value = "创建课程", response = Curriculum.class) |
|
||||||
public R createCurriculum(@RequestBody @Valid AddCurriculumReq curriculum, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
curriculum.setAccountId(Integer.valueOf(accountId)); |
|
||||||
curriculum.setSchoolId(schoolId); |
|
||||||
return service.createCurriculum(curriculum); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @Description: 编辑课程 |
|
||||||
* @auther: Rong |
|
||||||
* @date: 2021/9/22 14:54 |
|
||||||
*/ |
|
||||||
@PostMapping("/modifyCourse") |
|
||||||
@ApiOperation(value = "编辑课程", response = Curriculum.class) |
|
||||||
public R modifyCourse(@RequestBody @Valid ModifyCurriculumReq curriculum, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
curriculum.setAccountId(Integer.valueOf(accountId)); |
|
||||||
return service.modifyCourse(curriculum); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/isDisable") |
|
||||||
@ApiOperation(value = "禁启用课程", response = Curriculum.class) |
|
||||||
public R isDisable(@RequestParam @Param(value = "课程id") Integer cid, @RequestParam @Param(value = "是否启用(0启用,1未启用)") Integer isEnable, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
boolean ret = service.updateById(new Curriculum().setIsEnable(isEnable).setCid(cid)); |
|
||||||
return ret ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/isShelves") |
|
||||||
@ApiOperation(value = "上下架课程", response = Curriculum.class) |
|
||||||
public R isShelves(@RequestParam @Param(value = "课程id") Integer cid, @RequestParam @Param(value = "上下架(0下架 1上架 默认 1)") Integer isShelves, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
boolean ret = service.updateById(new Curriculum().setIsShelves(isShelves).setCid(cid)); |
|
||||||
return ret ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @Description: 删除课程 |
|
||||||
* @auther: Rong |
|
||||||
* @date: 2021/9/22 14:54 |
|
||||||
*/ |
|
||||||
@PostMapping("/delCourse") |
|
||||||
@ApiOperation(value = "单个、批量删除课程", response = Curriculum.class) |
|
||||||
public R delCourse(@RequestParam List<Integer> cids, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
return service.delCourse(cids); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/deleteCoursePrompt") |
|
||||||
@ApiOperation(value = "删除课程提示", response = Curriculum.class) |
|
||||||
public R deleteCoursePrompt(@RequestParam List<Integer> cids) { |
|
||||||
return service.deleteCoursePrompt(cids); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/curriculumList") |
|
||||||
@ApiOperation(value = "课程列表", response = Curriculum.class) |
|
||||||
public R createCourse(@RequestBody @Valid PageCurriculumReq req, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
req.setAccountId(Integer.valueOf(accountId)); |
|
||||||
req.setSchoolId(schoolId); |
|
||||||
return service.curriculumList(req); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/curriculumListForBeforeLogin") |
|
||||||
@ApiOperation(value = "课程列表", response = Curriculum.class) |
|
||||||
public R curriculumListForBeforeLogin(@RequestBody @Valid PageCurriculumReq req) { |
|
||||||
return service.curriculumList(req); |
|
||||||
} |
|
||||||
|
|
||||||
@GetMapping("/schoolCourse") |
|
||||||
@ApiOperation(value = "获取学校购买订单后的课程", response = Curriculum.class) |
|
||||||
public R schoolCourse(HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
return service.schoolCourse(schoolId); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/getSchoolEffectiveCourse") |
|
||||||
@ApiOperation(value = "获取学校有效期内购买订单后的课程(变更后为产品)", response = Curriculum.class) |
|
||||||
public R getSchoolEffectiveCourse(HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
return service.getSchoolEffectiveCourse(schoolId); |
|
||||||
} |
|
||||||
|
|
||||||
@GetMapping("/schoolCourseByAchievement") |
|
||||||
@ApiOperation(value = "仅用于教师端成绩管理及学生端实验记录下拉框-获取学校购买订单后的课程", response = Curriculum.class) |
|
||||||
public R schoolCourseByAchievement(HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
return service.schoolCourseByAchievement(schoolId); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* |
|
||||||
* @param request |
|
||||||
* @param mallId |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
@GetMapping("/whetherToRenewTheFee") |
|
||||||
@ApiOperation(value = "根据商品id查询是否要续费(原:根据课程id查询是否要续费)", response = Curriculum.class) |
|
||||||
public R whetherToRenewTheFee(HttpServletRequest request, @RequestParam @Param(value = "商品id(mallId)") Integer mallId) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
return service.whetherToRenewTheFee(schoolId, mallId); |
|
||||||
} |
|
||||||
|
|
||||||
@GetMapping("/projectListByCourseId") |
|
||||||
@ApiOperation(value = "根据课程id获取实训项目列表", response = Curriculum.class) |
|
||||||
public R projectListByCourseId(@RequestParam @Param(value = "课程id(cid)") Integer cid, |
|
||||||
@RequestParam @Param(value = "项目权限(0、练习 1、考核)") Integer permissions, |
|
||||||
@RequestParam(required = false) @Param(value = "项目名称") String projectName, |
|
||||||
HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
return configureService.projectListByCourseId(cid, permissions, projectName); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/curriculumDetail") |
|
||||||
@ApiOperation(value = "课程详情", response = Curriculum.class) |
|
||||||
public R curriculumDetail(@RequestParam @Param(value = "课程id(cid)") Integer cid, |
|
||||||
@RequestParam(required = false) Integer mallId, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
|
|
||||||
return service.curriculumDetail(cid, mallId); |
|
||||||
} |
|
||||||
|
|
||||||
@GetMapping("/getSystemIdByCustomerId") |
|
||||||
@ApiOperation("得到客户所有的系统id openfeign") |
|
||||||
public List<Integer> getSystemIdByCustomerId(@RequestParam Integer customerId) { |
|
||||||
return service.getSystemIdByCustomerId(customerId); |
|
||||||
} |
|
||||||
|
|
||||||
@GetMapping("/getSchoolCourse") |
|
||||||
@ApiOperation(value = "获取学校购买订单下的产品所绑定的课程(该接口为远程调用接口)", response = Curriculum.class) |
|
||||||
public String getSchoolCourse(@RequestParam @Param(value = "schoolId") Integer schoolId) { |
|
||||||
return service.getSchoolCourse(schoolId); |
|
||||||
} |
|
||||||
|
|
||||||
@GetMapping("/checkConfig") |
|
||||||
@ApiOperation(value = "校验某个项目是否包含在课程配置中", response = CurriculumConfigure.class) |
|
||||||
public R checkConfig(@RequestParam @Param(value = "projectId") Integer projectId) { |
|
||||||
return configureService.checkConfig(projectId); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/recordRecentUsage") |
|
||||||
@ApiOperation(value = "记录最近使用", response = CurriculumRecentUse.class) |
|
||||||
public R recordRecentUsage(@RequestParam("mallId") @ApiParam(value = "商品id", required = true) @NotNull(message = "商品id不能为空") Integer mallId, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
QueryWrapper<CurriculumRecentUse> queryWrapper = new QueryWrapper<>(); |
|
||||||
queryWrapper.eq("mall_id", mallId); |
|
||||||
queryWrapper.eq("account_id", accountId); |
|
||||||
CurriculumRecentUse details = restoreUseService.getOne(queryWrapper); |
|
||||||
|
|
||||||
if (details == null) { |
|
||||||
//新增
|
|
||||||
CurriculumRecentUse recentUse = new CurriculumRecentUse(); |
|
||||||
recentUse.setEntryTime(new Date()); |
|
||||||
recentUse.setMallId(mallId); |
|
||||||
recentUse.setAccountId(Integer.valueOf(accountId)); |
|
||||||
restoreUseService.save(recentUse); |
|
||||||
} else { |
|
||||||
details.setEntryTime(new Date()); |
|
||||||
restoreUseService.updateById(details); |
|
||||||
} |
|
||||||
return R.ok(); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/recentUse") |
|
||||||
@ApiOperation(value = "实验台最近使用", response = CurriculumRecentUse.class) |
|
||||||
public R recentUse(@RequestBody PageCurriculumRecentUseReq req, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
req.setAccountId(Integer.valueOf(accountId)); |
|
||||||
req.setSchoolId(schoolId); |
|
||||||
return restoreUseService.recentUse(req); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
@ -1,157 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.api.OccupationlabClient; |
|
||||||
import com.huoran.api.UserClient; |
|
||||||
import com.huoran.common.entity.ProjectManage; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.CurriculumLearningProgress; |
|
||||||
import com.huoran.nakadai.entity.vo.ChapterVO; |
|
||||||
import com.huoran.nakadai.service.CurriculumChapterService; |
|
||||||
import com.huoran.nakadai.service.CurriculumLearningProgressService; |
|
||||||
import com.huoran.nakadai.service.ICurriculumConfigureService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import java.math.BigDecimal; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* @描述:课程学习进度控制类 |
|
||||||
* @作者: Rong |
|
||||||
* @日期: 2023-04-25 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/curriculum/learning/progressprogress") |
|
||||||
@Api(value = "R-课程学习进度", tags = "R-课程学习进度") |
|
||||||
public class CurriculumLearningProgressController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private CurriculumChapterService curriculumChapterService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public CurriculumLearningProgressService service; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private UserClient userClient; |
|
||||||
@Autowired |
|
||||||
public ICurriculumConfigureService configureService; |
|
||||||
|
|
||||||
|
|
||||||
@Autowired |
|
||||||
public OccupationlabClient occupationlabClient; |
|
||||||
|
|
||||||
@ApiOperation(value = "根据课程id查询课程下的项目(含当前用户学习进度)", response = ChapterVO.class) |
|
||||||
@PostMapping("/courseLearningProgress") |
|
||||||
public R courseLearningProgress(@ApiParam(name = "courseId", value = "课程ID", required = true) @RequestParam String courseId, |
|
||||||
@ApiParam(name = "systemId", value = "系统ID", required = true) @RequestParam String systemId, |
|
||||||
@ApiParam(name = "mallId", value = "商品id", required = true) @RequestParam Integer mallId |
|
||||||
, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
// List<ChapterVO> chapterList = curriculumChapterService.getChapterTree(courseId);
|
|
||||||
|
|
||||||
|
|
||||||
//查询课程下绑定的全部项目 (根据课程id获取实训项目列表) String systemId, Integer accountId, Integer permissions, Integer cId, Integer mallId,Integer schoolId
|
|
||||||
List<ProjectManage> courseList = configureService.getProjectBySystemIdRemoteCall(systemId, Integer.valueOf(accountId), 0, Integer.valueOf(courseId), mallId, schoolId); |
|
||||||
//统计本课程下全部项目数量
|
|
||||||
double statisticalSummary = 0; |
|
||||||
if (courseList != null) { |
|
||||||
statisticalSummary = courseList.size(); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
//统计已经记录的本课程下的项目数量
|
|
||||||
double learningQuantity = 0; |
|
||||||
|
|
||||||
//查询本人学习当前课程下已经学习的项目学习记录
|
|
||||||
List<CurriculumLearningProgress> curriculumLearningProgresses = service.curriculumLearningProgresses(Integer.valueOf(accountId), courseId); |
|
||||||
for (ProjectManage infoRes : courseList) { |
|
||||||
if (curriculumLearningProgresses.size() > 0) { |
|
||||||
for (CurriculumLearningProgress programProgress : curriculumLearningProgresses) { |
|
||||||
if (infoRes.getProjectId().equals(programProgress.getProjectId())) { |
|
||||||
//是否学习(0未学习 1已学习)
|
|
||||||
infoRes.setWhetherToStudyOrNot(1); |
|
||||||
infoRes.setLearningProgressId(programProgress.getId()); |
|
||||||
learningQuantity++; |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
double schedule = 0.0; |
|
||||||
if (learningQuantity != 0.0 && statisticalSummary != 0.0) { |
|
||||||
schedule = (learningQuantity / statisticalSummary) * 100; |
|
||||||
} |
|
||||||
|
|
||||||
BigDecimal bg = new BigDecimal(schedule); |
|
||||||
double f1 = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
||||||
return R.ok(courseList).put("schedule", f1 + "%").put("plan", (int) learningQuantity + "/" + (int) statisticalSummary); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/findById") |
|
||||||
@ApiOperation(value = "查询详情", response = CurriculumLearningProgress.class) |
|
||||||
public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { |
|
||||||
CurriculumLearningProgress curriculumLearningProgress = service.getById(id); |
|
||||||
return R.ok().put("data", curriculumLearningProgress); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/save") |
|
||||||
@ApiOperation(value = "新增", response = CurriculumLearningProgress.class) |
|
||||||
public R save(@RequestBody @ApiParam(name = "课程学习进度对象", value = "传入json格式", required = true) CurriculumLearningProgress curriculumLearningProgress, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
curriculumLearningProgress.setSchoolId(schoolId); |
|
||||||
curriculumLearningProgress.setAccountId(Integer.valueOf(accountId)); |
|
||||||
|
|
||||||
QueryWrapper<CurriculumLearningProgress> qwrap = new QueryWrapper<>(); |
|
||||||
qwrap.eq("cid", curriculumLearningProgress.getCid()); |
|
||||||
/*qwrap.eq("chapter_id", curriculumLearningProgress.getChapterId()); |
|
||||||
qwrap.eq("subsection_id", curriculumLearningProgress.getSubsectionId());*/ |
|
||||||
qwrap.eq("project_id", curriculumLearningProgress.getProjectId()); |
|
||||||
qwrap.eq("account_id", accountId); |
|
||||||
qwrap.eq("school_id", schoolId); |
|
||||||
|
|
||||||
List<CurriculumLearningProgress> list = service.list(qwrap); |
|
||||||
if (list.size() > 0) { |
|
||||||
return R.error("当前项目已被勾选!请刷新重试"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
boolean addState = service.save(curriculumLearningProgress); |
|
||||||
return addState ? R.ok() : R.error("新增失败"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/update") |
|
||||||
@ApiOperation(value = "修改", response = CurriculumLearningProgress.class) |
|
||||||
public R update(@RequestBody @ApiParam(name = "课程学习进度对象", value = "传入json格式", required = true) CurriculumLearningProgress curriculumLearningProgress, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
curriculumLearningProgress.setSchoolId(schoolId); |
|
||||||
curriculumLearningProgress.setAccountId(Integer.valueOf(accountId)); |
|
||||||
boolean updateState = service.updateById(curriculumLearningProgress); |
|
||||||
return updateState ? R.ok() : R.error("编辑失败"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/delete") |
|
||||||
@ApiOperation(value = "删除", response = CurriculumLearningProgress.class) |
|
||||||
public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { |
|
||||||
boolean delState = service.removeById(id); |
|
||||||
return delState ? R.ok() : R.error("删除失败"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,94 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil; |
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.CurriculumNotes; |
|
||||||
import com.huoran.nakadai.service.CurriculumNotesService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 课程笔记表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2023-05-04 |
|
||||||
*/ |
|
||||||
@Api(value = "课程笔记管理", tags = "课程笔记管理") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/curriculumNotes") |
|
||||||
public class CurriculumNotesController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private CurriculumNotesService curriculumNotesService; |
|
||||||
|
|
||||||
@ApiOperation(value = "添加笔记") |
|
||||||
@PostMapping("/addNote") |
|
||||||
public R addNote( |
|
||||||
@ApiParam(name = "notes", value = "笔记内容", required = true) |
|
||||||
@RequestBody CurriculumNotes notes, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
//名称判重
|
|
||||||
QueryWrapper<CurriculumNotes> queryWrapper = new QueryWrapper<>(); |
|
||||||
queryWrapper.eq("note_name",notes.getNoteName()); |
|
||||||
queryWrapper.eq("account_id",accountId); |
|
||||||
queryWrapper.eq("cid",notes.getCid()); |
|
||||||
CurriculumNotes one = curriculumNotesService.getOne(queryWrapper); |
|
||||||
if (ObjectUtil.isNotNull(one)){ |
|
||||||
return R.error("笔记名称已存在!"); |
|
||||||
} |
|
||||||
//新增笔记
|
|
||||||
notes.setAccountId(Integer.valueOf(accountId)); |
|
||||||
boolean save = curriculumNotesService.save(notes); |
|
||||||
return save ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "更新笔记") |
|
||||||
@PostMapping("/updateNote") |
|
||||||
public R updateNote( |
|
||||||
@ApiParam(name = "notes", value = "笔记内容", required = true) |
|
||||||
@RequestBody CurriculumNotes notes) { |
|
||||||
boolean update = curriculumNotesService.updateById(notes); |
|
||||||
return update ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "课程笔记列表") |
|
||||||
@GetMapping("/curriculumNoteList") |
|
||||||
public R curriculumNoteList( |
|
||||||
@ApiParam(name = "search", value = "查询条件",required = false) |
|
||||||
@RequestParam(required = false) String search, |
|
||||||
@ApiParam(name = "cid", value = "课程id") |
|
||||||
@RequestParam Integer cid, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
QueryWrapper<CurriculumNotes> queryWrapper = new QueryWrapper<>(); |
|
||||||
queryWrapper.eq("account_id",accountId); |
|
||||||
queryWrapper.eq("cid",cid); |
|
||||||
queryWrapper.orderByDesc("create_time"); |
|
||||||
if (search!=null){ |
|
||||||
queryWrapper.like("note_name",search); |
|
||||||
} |
|
||||||
List<CurriculumNotes> curriculumNotes = curriculumNotesService.list(queryWrapper); |
|
||||||
return R.ok().put("curriculumNotes",curriculumNotes); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "删除课程笔记") |
|
||||||
@PostMapping("/deleteNotes") |
|
||||||
public R deleteNotes( |
|
||||||
@ApiParam(name = "noteId", value = "课程笔记id", required = true) |
|
||||||
@RequestParam Integer noteId) { |
|
||||||
boolean remove = curriculumNotesService.removeById(noteId); |
|
||||||
return remove ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,81 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import com.aliyuncs.exceptions.ClientException; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.nakadai.entity.CurriculumSubsection; |
|
||||||
import com.huoran.nakadai.service.CurriculumSubsectionService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import java.util.Date; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 企业课程小节表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author lr |
|
||||||
* @since 2021-09-26 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@Api(description = "课程小节管理", tags = "课程小节管理") |
|
||||||
@RequestMapping("/nakadai/curriculum/subsection") |
|
||||||
public class CurriculumSubsectionController { |
|
||||||
@Autowired |
|
||||||
private CurriculumSubsectionService curriculumSubsectionService; |
|
||||||
|
|
||||||
@ApiOperation(value = "添加小节") |
|
||||||
@PostMapping("/addSubsection") |
|
||||||
public R addSubsection( |
|
||||||
@ApiParam(name = "courseSubsection", value = "小节对象", required = true) |
|
||||||
@RequestBody CurriculumSubsection curriculumSubsection) { |
|
||||||
//判重
|
|
||||||
boolean isRepeat = curriculumSubsectionService.repeat(curriculumSubsection); |
|
||||||
if (isRepeat) { |
|
||||||
return R.error("小节已存在"); |
|
||||||
} |
|
||||||
boolean save = curriculumSubsectionService.saveSubsection(curriculumSubsection); |
|
||||||
return save ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "修改小节") |
|
||||||
@PutMapping("/editSubsection") |
|
||||||
public R editSubsection( |
|
||||||
@ApiParam(name = "courseSubsection", value = "小节对象", required = true) |
|
||||||
@RequestBody CurriculumSubsection courseSubsection) { |
|
||||||
boolean update = curriculumSubsectionService.updateById(courseSubsection); |
|
||||||
return update ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "根据id删除小节") |
|
||||||
@DeleteMapping("/deleteSubsection/{subsectionId}") |
|
||||||
public R deleteSubsection( |
|
||||||
@ApiParam(name = "subsectionId", value = "小节ID", required = true) |
|
||||||
@PathVariable String subsectionId) throws ClientException { |
|
||||||
boolean remove = curriculumSubsectionService.removeSubsection(subsectionId); |
|
||||||
return remove ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "根据小节id获取预览文件地址") |
|
||||||
@GetMapping("/getSubsection/{subsectionId}") |
|
||||||
public R getSubsection( |
|
||||||
@ApiParam(name = "subsectionId", value = "小节ID", required = true) |
|
||||||
@PathVariable String subsectionId) { |
|
||||||
String officeUrl = "https://view.officeapps.live.com/op/view.aspx?src="; |
|
||||||
// String xDocUrl = "http://view.xdocin.com/xdoc?_xdoc=";
|
|
||||||
CurriculumSubsection courseSubsection = curriculumSubsectionService.getById(subsectionId); |
|
||||||
if (courseSubsection != null) { |
|
||||||
String fileUrl = courseSubsection.getFileUrl(); |
|
||||||
String previewUrl = officeUrl + fileUrl; |
|
||||||
return R.ok().put("previewUrl", previewUrl); |
|
||||||
} else { |
|
||||||
return R.error(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,358 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import cn.afterturn.easypoi.excel.ExcelExportUtil; |
|
||||||
import cn.afterturn.easypoi.excel.entity.ExportParams; |
|
||||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; |
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.api.NakadaiClient; |
|
||||||
import com.huoran.api.UserClient; |
|
||||||
import com.huoran.common.constant.DelConstant; |
|
||||||
import com.huoran.common.exception.ExceptionEnum; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.PageUtils; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.*; |
|
||||||
import com.huoran.nakadai.entity.req.CustomerListReq; |
|
||||||
import com.huoran.nakadai.entity.req.CustomerReq; |
|
||||||
import com.huoran.nakadai.entity.req.GetTheSystemUnderTheProductReq; |
|
||||||
import com.huoran.nakadai.entity.req.ListOfClientCommercialManagersReq; |
|
||||||
import com.huoran.nakadai.entity.res.BusinessManagerOrderResp; |
|
||||||
import com.huoran.nakadai.entity.res.CustomerDetailRes; |
|
||||||
import com.huoran.nakadai.entity.res.CustomerListRes; |
|
||||||
import com.huoran.nakadai.entity.res.ListOfClientCommercialManagersResp; |
|
||||||
import com.huoran.nakadai.mapper.CustomerMapper; |
|
||||||
import com.huoran.nakadai.mapper.HrStaffMapper; |
|
||||||
import com.huoran.nakadai.service.ICustomerService; |
|
||||||
import com.huoran.nakadai.service.IOrderService; |
|
||||||
import com.huoran.nakadai.utils.ExcelStyleUtil; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.apache.ibatis.annotations.Param; |
|
||||||
import org.apache.poi.ss.usermodel.Workbook; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import javax.servlet.http.HttpServletResponse; |
|
||||||
import javax.validation.Valid; |
|
||||||
import javax.validation.constraints.NotNull; |
|
||||||
import java.net.URLEncoder; |
|
||||||
import java.util.List; |
|
||||||
import java.util.UUID; |
|
||||||
import java.util.concurrent.ExecutionException; |
|
||||||
import java.util.concurrent.ThreadPoolExecutor; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 客户表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author huoran |
|
||||||
* @since 2021-06-28 |
|
||||||
*/ |
|
||||||
@Api(value = "客户管理", tags = "客户管理") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/customer") |
|
||||||
public class CustomerController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private ICustomerService iCustomerService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private CustomerMapper mapper; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private HrStaffMapper staffMapper; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private IOrderService orderService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private UserClient userClient; |
|
||||||
|
|
||||||
|
|
||||||
@Autowired |
|
||||||
private NakadaiClient nakadaiClient; |
|
||||||
|
|
||||||
/** |
|
||||||
* 客户登录次数补充 |
|
||||||
*/ |
|
||||||
@ApiOperation(value = "客户登录次数补充", notes = "客户登录次数补充") |
|
||||||
@PostMapping("/supplementaryCustomerLogins") |
|
||||||
public R supplementaryCustomerLogins() { |
|
||||||
List<Customer> list = iCustomerService.list(new QueryWrapper<Customer>()); |
|
||||||
for (Customer customer : list) { |
|
||||||
UserAccount userAccount = mapper.selectCustomerAccount(customer.getCustomerId()); |
|
||||||
|
|
||||||
if (userAccount != null) { |
|
||||||
//添加客户默认用户信息
|
|
||||||
com.huoran.nakadai.entity.UserInfo userInfo = new UserInfo(); |
|
||||||
// userInfo.setUserName();用户姓名默认为空
|
|
||||||
userInfo.setUniqueIdentification(UUID.randomUUID().toString()); |
|
||||||
staffMapper.addUserInfo(userInfo); |
|
||||||
|
|
||||||
userAccount.setUserId(userInfo.getUserId()); |
|
||||||
|
|
||||||
mapper.updateAccountCustomer(userAccount); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
return R.ok(); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 添加客户 |
|
||||||
* |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
@ApiOperation(value = "添加客户", notes = "添加客户") |
|
||||||
@PostMapping("/addCustomer") |
|
||||||
public R addCustomer(@RequestBody @Valid CustomerReq customerReq) { |
|
||||||
int result = 0; |
|
||||||
try { |
|
||||||
result = iCustomerService.addCustomer(customerReq); |
|
||||||
} catch (ExecutionException | InterruptedException e) { |
|
||||||
e.printStackTrace(); |
|
||||||
} |
|
||||||
return result > 0 ? R.ok().put("customerId", customerReq.getCustomerId()).put("schoolId", customerReq.getSchoolId()) : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 查询客户管理列表 |
|
||||||
* |
|
||||||
* @param customerListReq |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
@ApiOperation(value = "查询客户管理列表", notes = "查询客户管理列表") |
|
||||||
@PostMapping("/queryCustomer") |
|
||||||
public R queryCustomer(@RequestBody CustomerListReq customerListReq) { |
|
||||||
PageUtils data = iCustomerService.queryPage(customerListReq.getPage(), customerListReq.getSize(), customerListReq); |
|
||||||
return R.ok(data); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "批量导出客户(不用给分页,其余参数与列表一样)") |
|
||||||
@PostMapping(value = "/exportClient", produces = "application/json;multipart/form-data;charset=utf-8") |
|
||||||
public void exportProductPracticeResults( |
|
||||||
@RequestBody CustomerListReq customerListReq, |
|
||||||
HttpServletResponse response) throws Exception { |
|
||||||
/*iCustomerService.exportClient(req, response);*/ |
|
||||||
|
|
||||||
PageUtils data = iCustomerService.queryPage(1, 10000, customerListReq); |
|
||||||
// 告诉浏览器用什么软件可以打开此文件
|
|
||||||
response.setHeader("content-Type", "application/vnd.ms-excel"); |
|
||||||
|
|
||||||
// 下载文件的默认名称
|
|
||||||
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("客户列表", "UTF-8") + ".xls"); |
|
||||||
//编码
|
|
||||||
response.setCharacterEncoding("UTF-8"); |
|
||||||
|
|
||||||
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), CustomerListRes.class, data.getList()); |
|
||||||
ExportParams exportParams = new ExportParams(null, "客户列表", ExcelType.XSSF); |
|
||||||
exportParams.setStyle(ExcelStyleUtil.class); |
|
||||||
workbook.write(response.getOutputStream()); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 密码重置,重置密码为1122aa |
|
||||||
*/ |
|
||||||
@ApiOperation(value = "密码重置", notes = "密码重置") |
|
||||||
@GetMapping("/resetPwd") |
|
||||||
public R resetPwd(@RequestParam("customerId") Integer customerId) { |
|
||||||
int result = iCustomerService.resetPwd(customerId); |
|
||||||
return result > 0 ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 删除客户 |
|
||||||
*/ |
|
||||||
@ApiOperation(value = "删除客户", notes = "删除客户") |
|
||||||
@PostMapping("/delCustomer") |
|
||||||
public R delCustomer(@RequestBody Integer customerId) { |
|
||||||
int result = iCustomerService.delCustomer(customerId); |
|
||||||
return result > 0 ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 批量删除客户信息 |
|
||||||
* |
|
||||||
* @param ids |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
@PostMapping("/delCustomers") |
|
||||||
@ApiOperation(value = "批量删除客户信息") |
|
||||||
public R delCustomers(@RequestBody List<Integer> ids) { |
|
||||||
int result = iCustomerService.delCustomers(ids); |
|
||||||
return result > 0 ? R.ok("删除成功!") : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 查看客户详情 |
|
||||||
*/ |
|
||||||
@ApiOperation(value = "查看客户详情", notes = "查看客户详情", response = CustomerDetailRes.class) |
|
||||||
@GetMapping("/queryCustomerDetails") |
|
||||||
public R queryCustomerDetails(@RequestParam("customerId") Integer customerId) { |
|
||||||
CustomerDetailRes result = iCustomerService.queryCustomerDetails(customerId); |
|
||||||
return R.ok().put("result", result); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 修改课程权限启用禁用 |
|
||||||
* @param coursePermissionsId |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
// @ApiOperation(value = "修改课程权限启用禁用",notes = "修改课程权限启用禁用")
|
|
||||||
// @GetMapping("/updateCourseEnabled")
|
|
||||||
// public R updateCourseEnabled(@RequestParam("coursePermissionsId") Integer coursePermissionsId,@RequestParam("isEnabled") Integer isEnabled) {
|
|
||||||
// int result = iCustomerService.updateCourseEnabled(coursePermissionsId,isEnabled);
|
|
||||||
// return result>0 ? R.ok() : R.error();
|
|
||||||
// }
|
|
||||||
|
|
||||||
/** |
|
||||||
* 修改数据平台权限启用禁用 |
|
||||||
* @param dataPermissionsId |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
// @ApiOperation(value = "修改数据平台权限启用禁用",notes = "修改数据平台权限启用禁用")
|
|
||||||
// @GetMapping("/updateDataEnabled")
|
|
||||||
// public R updateDataEnabled(@RequestParam("dataPermissionsId") Integer dataPermissionsId,@RequestParam("isEnabled") Integer isEnabled) {
|
|
||||||
// int result = iCustomerService.updateDataEnabled(dataPermissionsId,isEnabled);
|
|
||||||
// return result>0 ? R.ok() : R.error();
|
|
||||||
// }
|
|
||||||
|
|
||||||
/** |
|
||||||
* 修改数据平台权限/课程权限启用禁用 |
|
||||||
* |
|
||||||
* @param id 主键id |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
@ApiOperation(value = "修改数据平台权限/课程权限启用禁用", notes = "修改数据平台权限/课程权限启用禁用") |
|
||||||
@GetMapping("/updateEnabled") |
|
||||||
public R updateEnabled(@RequestParam("id") Integer id, @RequestParam("isEnable") @ApiParam(value = "是否开启(0不开启,1开启,发货后,默认开启)") Integer isEnable) { |
|
||||||
int result = iCustomerService.updateEnabled(id, isEnable); |
|
||||||
return result > 0 ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 修改客户 |
|
||||||
* |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
@ApiOperation(value = "修改客户", notes = "修改客户") |
|
||||||
@PostMapping("/updateCustomer") |
|
||||||
public R updateCustomer(@RequestBody @Valid CustomerReq customerReq) { |
|
||||||
int result = iCustomerService.updateCustomer(customerReq); |
|
||||||
return result > 0 ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 修改客户角色Id |
|
||||||
* |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
@ApiOperation(value = "修改客户角色Id", notes = "修改客户角色Id") |
|
||||||
@PostMapping("/updateCustomerByRoleId") |
|
||||||
public R updateCustomerByRoleId(@RequestParam("customerId") @ApiParam(value = "客户id") Integer customerId, |
|
||||||
@RequestParam("roleId") @ApiParam(value = "角色id") String roleId |
|
||||||
) { |
|
||||||
int result = iCustomerService.updateCustomerByRoleId(customerId, roleId); |
|
||||||
return result > 0 ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 客户判重 |
|
||||||
* |
|
||||||
* @param schoolId |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
@ApiOperation(value = "查看客户是否存在", notes = "查看客户是否存在") |
|
||||||
@GetMapping("/queryCustomerIsExists") |
|
||||||
public R queryCustomerIsExists(@RequestParam Integer schoolId) { |
|
||||||
int result = iCustomerService.queryCustomerIsExists(schoolId); |
|
||||||
return result > 0 ? R.error().put("code", ExceptionEnum.EXIST_CUSTOMER.getCode()).put("message", ExceptionEnum.EXIST_CUSTOMER.getMsg()) : R.ok(); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 根据学校id获取客户id |
|
||||||
* |
|
||||||
* @param schoolId |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
@ApiOperation(value = "根据学校id获取客户id", notes = "根据学校id获取客户id") |
|
||||||
@GetMapping("/getCustomerBySchoolId") |
|
||||||
public Integer getCustomerBySchoolId(@RequestParam Integer schoolId) { |
|
||||||
QueryWrapper<Customer> queryWrapper = new QueryWrapper<>(); |
|
||||||
queryWrapper.eq("school_id", schoolId); |
|
||||||
queryWrapper.eq("is_del", DelConstant.NOT_DEL); |
|
||||||
Customer one = iCustomerService.getOne(queryWrapper); |
|
||||||
if (one==null){ |
|
||||||
return 0; |
|
||||||
} |
|
||||||
return one.getCustomerId(); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/checkEmailOrPhone") |
|
||||||
@ApiOperation(value = "新增客户前:校验手机号或者邮箱", response = Customer.class) |
|
||||||
public R checkEmailAndPhone(@ApiParam(name = "phone", value = "手机号(一次校验只传一个参数)") @RequestParam(required = false) String phone, |
|
||||||
@ApiParam(name = "email", value = "邮 箱(一次校验只传一个参数)") @RequestParam(required = false) String email |
|
||||||
, @ApiParam(name = "customerId", value = "编辑传:被编辑客户id") @RequestParam(value = "customerId", required = false) Integer customerId) { |
|
||||||
|
|
||||||
Customer customer = new Customer(); |
|
||||||
|
|
||||||
customer.setPhone(phone); |
|
||||||
customer.setEmail(email); |
|
||||||
if (customerId != null) { |
|
||||||
customer.setCustomerId(customerId); |
|
||||||
} |
|
||||||
|
|
||||||
List<Customer> customerList = iCustomerService.checkEmailOrPhone(customer); |
|
||||||
String msg = ""; |
|
||||||
if (customerList.size() > 0) { |
|
||||||
if (phone != null && !phone.equals("")) { |
|
||||||
msg = "该手机号已存在!"; |
|
||||||
} else if (email != null && !email.equals("")) { |
|
||||||
msg = "该Email已存在!"; |
|
||||||
} |
|
||||||
|
|
||||||
return R.error(msg); |
|
||||||
} |
|
||||||
return R.ok(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "根据客户id获取客户已订阅的产品", notes = "根据客户id获取客户已订阅的产品",response = OrderOther.class) |
|
||||||
@GetMapping("/getProductsSubscribedByCustomers") |
|
||||||
public R getProductsSubscribedByCustomers(@RequestParam Integer customeId) { |
|
||||||
return orderService.getProductsSubscribedByCustomers(customeId); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "根据客户id获取客户绑定的商务经理列表", notes = "根据客户id获取客户绑定的商务经理列表",response = ListOfClientCommercialManagersResp.class) |
|
||||||
@PostMapping("/getAListOfClientBusinessManagers") |
|
||||||
public R getAListOfClientBusinessManagers(@RequestBody ListOfClientCommercialManagersReq req) { |
|
||||||
return orderService.getAListOfClientBusinessManagers(req); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "获取业务经理订单", notes = "获取业务经理订单",response = BusinessManagerOrderResp.class) |
|
||||||
@PostMapping("/getBusinessManagerOrder") |
|
||||||
public R getBusinessManagerOrder(@RequestBody ListOfClientCommercialManagersReq req) { |
|
||||||
return orderService.getBusinessManagerOrder(req); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "获取客户购买的产品包含的系统", notes = "获取客户购买的产品包含的系统",response = ServiceConfiguration.class) |
|
||||||
@PostMapping("/getSystemByCustomers") |
|
||||||
public R getSystemByCustomers(@RequestBody GetTheSystemUnderTheProductReq req,HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
Integer customeId = nakadaiClient.getCustomerBySchoolId(schoolId); |
|
||||||
|
|
||||||
req.setCustomerId(customeId); |
|
||||||
return orderService.getSystemByCustomers(req); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} |
|
@ -1,233 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
||||||
import com.huoran.api.UserClient; |
|
||||||
import com.huoran.common.constant.DelConstant; |
|
||||||
import com.huoran.common.constant.PlatformConstant; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.CustomsPass; |
|
||||||
import com.huoran.nakadai.entity.req.PageCustomsPass; |
|
||||||
import com.huoran.nakadai.service.CustomsPassService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.util.ObjectUtils; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import java.util.Date; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* @描述:沙盘-关卡表控制类 |
|
||||||
* @作者: Rong |
|
||||||
* @日期: 2023-10-26 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/customsPass") |
|
||||||
@Api(value = "沙盘-关卡表:CustomsPassController", tags = "沙盘-关卡表") |
|
||||||
public class CustomsPassController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public CustomsPassService service; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private UserClient userClient; |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/checkPointListByStu") |
|
||||||
@ApiOperation(value = "学生端:关卡列表(用于学生端,需结合收藏表回显收藏id)", response = CustomsPass.class) |
|
||||||
public R checkPointListByStu(@ApiParam(name = "projectId", value = "项目id", required = true) @RequestParam Integer projectId, |
|
||||||
@ApiParam(name = "displayCollection", value = "显示收藏(为1表示仅展示已收藏)") @RequestParam(required = false) Integer displayCollection, |
|
||||||
HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
return service.checkPointList(schoolId, Integer.valueOf(accountId), projectId, displayCollection); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/checkpointList") |
|
||||||
@ApiOperation(value = "关卡列表", response = CustomsPass.class) |
|
||||||
public R checkpointList(@RequestBody PageCustomsPass customsPass) { |
|
||||||
QueryWrapper<CustomsPass> queryWrapper = new QueryWrapper<>(); |
|
||||||
queryWrapper.eq("is_del", DelConstant.NOT_DEL); |
|
||||||
|
|
||||||
|
|
||||||
if (customsPass.getPlatformId().equals(PlatformConstant.POST_STATION)) { |
|
||||||
//职站(前台只展示启用的关卡)
|
|
||||||
queryWrapper.eq("is_enable", DelConstant.IS_ENABLE); |
|
||||||
} else { |
|
||||||
//中台
|
|
||||||
if (!ObjectUtils.isEmpty(customsPass.getCustomsPassName())) { |
|
||||||
queryWrapper.like("customs_pass_name", customsPass.getCustomsPassName()); |
|
||||||
} |
|
||||||
|
|
||||||
if (!ObjectUtils.isEmpty(customsPass.getIsEnable())) { |
|
||||||
queryWrapper.eq("is_enable", customsPass.getIsEnable()); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
queryWrapper.orderByAsc("serial_number"); |
|
||||||
|
|
||||||
List<CustomsPass> customsPassList = service.list(queryWrapper); |
|
||||||
for (CustomsPass object : customsPassList) { |
|
||||||
String creator = userClient.getUserName(object.getAccountId()); |
|
||||||
object.setCreator(creator); |
|
||||||
} |
|
||||||
return R.ok().put("data", customsPassList); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/save") |
|
||||||
@ApiOperation(value = "新增关卡", response = CustomsPass.class) |
|
||||||
public R save(@RequestBody @ApiParam(name = "沙盘-关卡表对象", value = "传入json格式", required = true) List<CustomsPass> customsPassList, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer sequenceNumber = service.maximumSequenceNumber(); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
|
|
||||||
for (CustomsPass customsPass : customsPassList) { |
|
||||||
customsPass.setAccountId(Integer.valueOf(accountId)); |
|
||||||
customsPass.setSchoolId(Integer.valueOf(schoolId)); |
|
||||||
customsPass.setSerialNumber(++sequenceNumber); |
|
||||||
customsPass.setCreateTime(new Date()); |
|
||||||
customsPass.setUpdateTime(new Date()); |
|
||||||
service.save(customsPass); |
|
||||||
} |
|
||||||
|
|
||||||
return R.ok(); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/update") |
|
||||||
@ApiOperation(value = "修改", response = CustomsPass.class) |
|
||||||
public R update(@RequestBody @ApiParam(name = "沙盘-关卡表对象", value = "传入json格式", required = true) List<CustomsPass> customsPassList, HttpServletRequest request) { |
|
||||||
for (CustomsPass customsPass : customsPassList) { |
|
||||||
UpdateWrapper<CustomsPass> updateWrapper = new UpdateWrapper<>(); |
|
||||||
if (!ObjectUtils.isEmpty(customsPass.getSerialNumber())) { |
|
||||||
updateWrapper.set("serial_number", customsPass.getSerialNumber()); |
|
||||||
} |
|
||||||
|
|
||||||
if (!ObjectUtils.isEmpty(customsPass.getCustomsPassName())) { |
|
||||||
updateWrapper.set("customs_pass_name", customsPass.getCustomsPassName()); |
|
||||||
} |
|
||||||
|
|
||||||
if (!ObjectUtils.isEmpty(customsPass.getIsEnable())) { |
|
||||||
updateWrapper.set("is_enable", customsPass.getIsEnable()); |
|
||||||
} |
|
||||||
|
|
||||||
if (!ObjectUtils.isEmpty(customsPass.getIsDel())) { |
|
||||||
updateWrapper.set("is_del", customsPass.getIsDel()); |
|
||||||
} |
|
||||||
updateWrapper.set("update_time", new Date()); |
|
||||||
|
|
||||||
updateWrapper.eq("checkpoint_id", customsPass.getCheckpointId()); |
|
||||||
|
|
||||||
service.update(new CustomsPass(), updateWrapper); |
|
||||||
} |
|
||||||
|
|
||||||
return R.ok(); |
|
||||||
} |
|
||||||
|
|
||||||
/* @PostMapping("/update") |
|
||||||
@ApiOperation(value = "修改",response= CustomsPass.class) |
|
||||||
public R update(@RequestBody @ApiParam(name="沙盘-关卡表对象",value="传入json格式",required=true) CustomsPass customsPass, HttpServletRequest request){ |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
customsPass.setAccountId(Integer.valueOf(accountId)); |
|
||||||
boolean updateState = service.updateById(customsPass); |
|
||||||
return updateState? R.ok():R.error("编辑失败"); |
|
||||||
}*/ |
|
||||||
|
|
||||||
/* @PostMapping("/sort") |
|
||||||
@ApiOperation(value = "排序", response = CustomsPass.class) |
|
||||||
public R sort(@RequestBody @ApiParam(name = "沙盘-关卡表对象", value = "传入json格式", required = true) List<CustomsPassSortReq> sortReqs, HttpServletRequest request) { |
|
||||||
|
|
||||||
for (CustomsPassSortReq req : sortReqs) { |
|
||||||
UpdateWrapper<CustomsPass> updateWrapper = new UpdateWrapper<>(); |
|
||||||
updateWrapper.set("serial_number", req.getSerialNumber()); |
|
||||||
updateWrapper.eq("checkpoint_id", req.getCheckpointId()); |
|
||||||
service.update(new CustomsPass(), updateWrapper); |
|
||||||
} |
|
||||||
|
|
||||||
return R.ok(); |
|
||||||
} |
|
||||||
*/ |
|
||||||
|
|
||||||
/*@ApiOperation(value = "更新开启状态") |
|
||||||
@PostMapping("/updateIsOpen") |
|
||||||
public R updateIsOpen(@ApiParam(name = "checkpointId", value = "关卡id", required = true) @RequestParam Integer checkpointId, @ApiParam(name = "isEnable", value = "是否禁用(默认0:禁用,1:启用)", required = true) @RequestParam Integer isEnable, @RequestHeader String token) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(token); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
service.updateIsOpen(checkpointId, isEnable); |
|
||||||
return R.ok(); |
|
||||||
}*/ |
|
||||||
|
|
||||||
|
|
||||||
/* @ApiOperation(value = "编辑关卡名") |
|
||||||
@PostMapping("/updateByName") |
|
||||||
public R updateByName(@ApiParam(name = "checkpointId", value = "关卡id", required = true) @RequestParam Integer checkpointId, @ApiParam(name = "customsPassName", value = "关卡名", required = true) @RequestParam String customsPassName, @RequestHeader String token) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(token); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
UpdateWrapper<CustomsPass> updateWrapper = new UpdateWrapper<>(); |
|
||||||
updateWrapper.set("customs_pass_name", customsPassName); |
|
||||||
updateWrapper.eq("checkpoint_id", checkpointId); |
|
||||||
boolean ret = service.update(new CustomsPass(), updateWrapper); |
|
||||||
return ret ? R.ok() : R.error(); |
|
||||||
}*/ |
|
||||||
|
|
||||||
|
|
||||||
/*@ApiOperation(value = "排序") |
|
||||||
@PostMapping("/sort") |
|
||||||
public R sort(@ApiParam(name = "checkpointId", value = "关卡id", required = true) @RequestParam Integer checkpointId, @ApiParam(name = "type", value = "1.上移 2下移 3置顶 4置底", required = true) @RequestParam Integer type, @RequestHeader String token) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(token); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
CustomsPass customsPass = service.getById(checkpointId); |
|
||||||
|
|
||||||
|
|
||||||
//上移
|
|
||||||
if (type.equals(2)) { |
|
||||||
if (customsPass.getSerialNumber() == 1) { |
|
||||||
return R.error("已经在最上面啦,不能移动啦~"); |
|
||||||
} |
|
||||||
|
|
||||||
//查询下一条记录Id和sort
|
|
||||||
Integer nextId = service.selectNextId(customsPass); |
|
||||||
CustomsPass nextNotice = service.getById(nextId); |
|
||||||
//更新下一条记录的sort为当前值
|
|
||||||
customsPass.setCheckpointId(nextId); |
|
||||||
service.updateSortById(customsPass); |
|
||||||
//更新当前记录的sort为下一条
|
|
||||||
nextNotice.setCheckpointId(checkpointId); |
|
||||||
service.updateSortById(nextNotice); |
|
||||||
} |
|
||||||
// 3、下移
|
|
||||||
if (type.equals(1)) { |
|
||||||
//查询上一条记录Id和sort
|
|
||||||
Integer previousId = service.selectPreviousId(customsPass); |
|
||||||
CustomsPass previousNotice = service.getById(previousId); |
|
||||||
//更新上一条记录的sort为当前值
|
|
||||||
customsPass.setCheckpointId(previousId); |
|
||||||
service.updateSortById(customsPass); |
|
||||||
//更新当前记录的sort为上一条
|
|
||||||
previousNotice.setCheckpointId(checkpointId); |
|
||||||
service.updateSortById(previousNotice); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
return R.ok(); |
|
||||||
}*/ |
|
||||||
|
|
||||||
|
|
||||||
/* @PostMapping("/batchDeletion") |
|
||||||
@ApiOperation(value = "批量删除", response = CustomsPass.class) |
|
||||||
public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestBody List<Integer> ids) { |
|
||||||
boolean delState = service.removeByIds(ids); |
|
||||||
return delState ? R.ok() : R.error("删除失败"); |
|
||||||
}*/ |
|
||||||
} |
|
||||||
|
|
@ -1,45 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.Curriculum; |
|
||||||
import com.huoran.nakadai.entity.DataProduct; |
|
||||||
import com.huoran.nakadai.entity.Discipline; |
|
||||||
import com.huoran.nakadai.entity.req.AddCurriculumReq; |
|
||||||
import com.huoran.nakadai.entity.req.MiniProgramProductsReq; |
|
||||||
import com.huoran.nakadai.entity.res.AppletsDataProductResp; |
|
||||||
import com.huoran.nakadai.service.ICustomerService; |
|
||||||
import com.huoran.nakadai.service.IDataProductService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import javax.validation.Valid; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 数据平台产品表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author huoran |
|
||||||
* @since 2021-06-28 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/dataProduct") |
|
||||||
@Api(value = "产品", tags = "产品") |
|
||||||
public class DataProductController { |
|
||||||
|
|
||||||
|
|
||||||
@Autowired |
|
||||||
private IDataProductService dataProductService; |
|
||||||
|
|
||||||
@PostMapping("/AppletsDataProductList") |
|
||||||
@ApiOperation(value = "小程序数据产品列表", response = AppletsDataProductResp.class) |
|
||||||
public R AppletsDataProductList(@RequestBody MiniProgramProductsReq req) { |
|
||||||
return dataProductService.AppletsDataProductList(req); |
|
||||||
} |
|
||||||
} |
|
@ -1,75 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.nakadai.entity.Discipline; |
|
||||||
import com.huoran.nakadai.entity.Professional; |
|
||||||
import com.huoran.nakadai.entity.ProfessionalClass; |
|
||||||
import com.huoran.nakadai.service.IDisciplineService; |
|
||||||
import com.huoran.nakadai.service.IProfessionalClassService; |
|
||||||
import com.huoran.nakadai.service.IProfessionalService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.GetMapping; |
|
||||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||||
import org.springframework.web.bind.annotation.RequestParam; |
|
||||||
import org.springframework.web.bind.annotation.RestController; |
|
||||||
|
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* @Description: java方法作用描述 |
|
||||||
* @auther: Rong |
|
||||||
* @date: 2021/9/17 15:44 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/subject") |
|
||||||
@Api(value = "API - 课程管理三级联查", tags = "课程管理三级联查") |
|
||||||
public class DisciplineController { |
|
||||||
@Autowired |
|
||||||
public IDisciplineService service; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public IProfessionalClassService classService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public IProfessionalService professionalService; |
|
||||||
|
|
||||||
@GetMapping("/subjectCategoryCited") |
|
||||||
@ApiOperation(value = "教师端展示引用的学科类别(三级数据)", response = Discipline.class) |
|
||||||
public R subjectCategoryCited() { |
|
||||||
List<Discipline> list = service.subjectCategoryCited(); |
|
||||||
return R.ok().put("list", list); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/courseDiscipline") |
|
||||||
@ApiOperation(value = "课程学科类别", response = Discipline.class) |
|
||||||
public R courseDiscipline() { |
|
||||||
List<Discipline> list = service.disciplineLevel(); |
|
||||||
return R.ok().put("list", list); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/courseProfessionalClass") |
|
||||||
@ApiOperation(value = "课程专业类", response = ProfessionalClass.class) |
|
||||||
public R disciplineList( |
|
||||||
@ApiParam(value = "disciplineId", required = true) |
|
||||||
@RequestParam("disciplineId") Integer disciplineId) { |
|
||||||
List<ProfessionalClass> list = classService.professionalClassLevel(disciplineId); |
|
||||||
return R.ok().put("list", list); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/courseProfessional") |
|
||||||
@ApiOperation(value = "课程专业", response = Professional.class) |
|
||||||
public R courseProfessional( |
|
||||||
@ApiParam(value = "professionalClassId", required = true) |
|
||||||
@RequestParam("professionalClassId") Integer professionalClassId) { |
|
||||||
List<Professional> list = professionalService.professionalLevel(professionalClassId); |
|
||||||
return R.ok().put("list", list); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
@ -1,21 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||||
|
|
||||||
import org.springframework.stereotype.Controller; |
|
||||||
import org.springframework.web.bind.annotation.RestController; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 学科层次 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author huoran |
|
||||||
* @since 2021-07-09 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/disciplineLevel") |
|
||||||
public class DisciplineLevelController { |
|
||||||
|
|
||||||
} |
|
@ -1,21 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RestController; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 课程章节 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author lr |
|
||||||
* @since 2021-09-26 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/edu-curriculum-chapter") |
|
||||||
public class EduCurriculumChapterController { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,20 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RestController; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 合同信息表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author huoran |
|
||||||
* @since 2021-06-28 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/contractInformation") |
|
||||||
public class HrContractInformationController { |
|
||||||
|
|
||||||
} |
|
@ -1,20 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RestController; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 课程权限表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author huoran |
|
||||||
* @since 2021-06-28 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/coursePermissions") |
|
||||||
public class HrCoursePermissionsController { |
|
||||||
|
|
||||||
} |
|
@ -1,20 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RestController; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 数据平台权限表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author huoran |
|
||||||
* @since 2021-06-28 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/dataPermissions") |
|
||||||
public class HrDataPermissionsController { |
|
||||||
|
|
||||||
} |
|
@ -1,276 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil; |
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.HrLog; |
|
||||||
import com.huoran.nakadai.entity.LogContent; |
|
||||||
import com.huoran.nakadai.entity.vo.LogManagementListVo; |
|
||||||
import com.huoran.nakadai.entity.vo.OrderVo; |
|
||||||
import com.huoran.nakadai.service.HrLogService; |
|
||||||
import com.huoran.nakadai.service.LogContentService; |
|
||||||
import com.huoran.nakadai.utils.CollectionUtil; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.data.redis.core.RedisTemplate; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import javax.validation.Valid; |
|
||||||
import javax.validation.constraints.NotNull; |
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.Collection; |
|
||||||
import java.util.Date; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2022-03-04 |
|
||||||
*/ |
|
||||||
@Api(tags = "日志管理") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/log") |
|
||||||
public class HrLogController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private HrLogService logService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private LogContentService logContentService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private RedisTemplate<String, String> redisTemplate; |
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "名称查重") |
|
||||||
@GetMapping("/checkRepeat") |
|
||||||
public R logManagementList( |
|
||||||
@ApiParam(name = "versionName", value = "名称") @RequestParam String versionName, |
|
||||||
@ApiParam(name = "platformId", value = "平台id") @RequestParam String platformId) { |
|
||||||
//名称判重
|
|
||||||
QueryWrapper<HrLog> logQueryWrapper = new QueryWrapper<>(); |
|
||||||
logQueryWrapper.eq("version_name",versionName). |
|
||||||
eq("platform_id",platformId); |
|
||||||
HrLog hrLog = logService.getOne(logQueryWrapper); |
|
||||||
if (ObjectUtil.isNotNull(hrLog)){ |
|
||||||
return R.error("版本名称已存在!"); |
|
||||||
} |
|
||||||
return R.ok(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "日志通知") |
|
||||||
@GetMapping("/logNotification") |
|
||||||
public R logNotification( |
|
||||||
@ApiParam(name = "platformId", value = "平台id") |
|
||||||
String platformId,HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
String notification = redisTemplate.opsForValue().get(accountId+platformId); |
|
||||||
//读取完该用户删除通知标识
|
|
||||||
redisTemplate.delete(accountId+platformId); |
|
||||||
return R.ok().put("notification",notification); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "日志撤回") |
|
||||||
@GetMapping("/logWithdrawal") |
|
||||||
public R logWithdrawal( |
|
||||||
@ApiParam(name = "platformId", value = "平台id") |
|
||||||
Integer platformId, |
|
||||||
@ApiParam(name = "logId", value = "日志id") |
|
||||||
Integer logId) { |
|
||||||
HrLog log = new HrLog(); |
|
||||||
log.setLogId(logId); |
|
||||||
log.setOpen(1); |
|
||||||
log.setWithdraw(1); |
|
||||||
log.setWithdrawNum(1); |
|
||||||
//禁用日志
|
|
||||||
logService.updateById(log); |
|
||||||
|
|
||||||
//获取平台所有存在用户,清空该平台所有通知对象
|
|
||||||
List<Integer> accountIds = logService.queryAllAccount(platformId); |
|
||||||
accountIds.forEach(accountId -> { |
|
||||||
if (redisTemplate.hasKey(accountId.toString() + platformId)){ |
|
||||||
//存在删除该用户通知标识
|
|
||||||
redisTemplate.delete(accountId.toString()+platformId); |
|
||||||
} |
|
||||||
}); |
|
||||||
return R.ok(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "添加日志") |
|
||||||
@PostMapping("/add") |
|
||||||
public R add( |
|
||||||
@ApiParam(name = "log", value = "日志数据", required = true) |
|
||||||
@RequestBody @Valid HrLog log) { |
|
||||||
//发布状态判断
|
|
||||||
QueryWrapper<HrLog> queryWrapper = new QueryWrapper<>(); |
|
||||||
queryWrapper.eq("draft",1).eq("platform_id",log.getPlatformId()); |
|
||||||
HrLog one = logService.getOne(queryWrapper); |
|
||||||
if (ObjectUtil.isNotNull(one)){ |
|
||||||
return R.error("还有未发布的更新日志,请发布后进行新增!"); |
|
||||||
} |
|
||||||
//名称判重
|
|
||||||
QueryWrapper<HrLog> logQueryWrapper = new QueryWrapper<>(); |
|
||||||
logQueryWrapper.eq("version_name",log.getVersionName()). |
|
||||||
eq("platform_id",log.getPlatformId()); |
|
||||||
HrLog hrLog = logService.getOne(logQueryWrapper); |
|
||||||
if (ObjectUtil.isNotNull(hrLog)){ |
|
||||||
return R.error("版本名称已存在!"); |
|
||||||
} |
|
||||||
if (log.getDraft()==0){ |
|
||||||
log.setDraftTime(new Date()); |
|
||||||
log.setVersion(1); |
|
||||||
} |
|
||||||
boolean save = logService.save(log); |
|
||||||
//发布状态,通知该平台所有存在用户
|
|
||||||
if (log.getDraft()==0){ |
|
||||||
List<Integer> accountIds = logService.queryAllAccount(log.getPlatformId()); |
|
||||||
accountIds.forEach(accountId -> { |
|
||||||
redisTemplate.opsForValue().set(accountId.toString()+log.getPlatformId(),"true"); |
|
||||||
}); |
|
||||||
} |
|
||||||
if (save){ |
|
||||||
//新增内容
|
|
||||||
List<LogContent> logContents = log.getLogContents(); |
|
||||||
logContents.forEach(logContent -> { |
|
||||||
logContent.setLogId(log.getLogId()); |
|
||||||
logContentService.save(logContent); |
|
||||||
}); |
|
||||||
} |
|
||||||
return save ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "日志管理列表",response = LogManagementListVo.class) |
|
||||||
@GetMapping("/logManagementList") |
|
||||||
public R logManagementList( |
|
||||||
@ApiParam(name = "search", value = "查询条件") |
|
||||||
@RequestParam String search) { |
|
||||||
List<LogManagementListVo> logManagementListVo = logService.managementList(search); |
|
||||||
return R.ok().put("logManagementListVo",logManagementListVo); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "平台日志列表",response = HrLog.class) |
|
||||||
@GetMapping("/platformLogList") |
|
||||||
public R platformLogList( |
|
||||||
@ApiParam(name = "versionName", value = "版本查询", required = true) |
|
||||||
@RequestParam String versionName, |
|
||||||
@ApiParam(name = "port", value = "分端查询,前台查看传值1,只查询开启日志") |
|
||||||
Integer port, |
|
||||||
@ApiParam(name = "platformId", value = "平台id") Integer platformId) { |
|
||||||
QueryWrapper<HrLog> queryWrapper = new QueryWrapper<>(); |
|
||||||
queryWrapper.like("version_name",versionName). |
|
||||||
eq("platform_id",platformId). |
|
||||||
orderByDesc("create_time"); |
|
||||||
//前台查看传值1,只查询开启日志
|
|
||||||
if (port!=null && port==1){ |
|
||||||
queryWrapper.eq("open",0); |
|
||||||
} |
|
||||||
List<HrLog> logList = logService.list(queryWrapper); |
|
||||||
|
|
||||||
logList.forEach(log -> { |
|
||||||
QueryWrapper<LogContent> logContentQueryWrapper = new QueryWrapper<>(); |
|
||||||
logContentQueryWrapper.eq("log_id",log.getLogId()); |
|
||||||
List<LogContent> list = logContentService.list(logContentQueryWrapper); |
|
||||||
log.setLogContents(list); |
|
||||||
}); |
|
||||||
return R.ok().put("logList",logList); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "日志详情",response = OrderVo.class) |
|
||||||
@GetMapping("/get") |
|
||||||
public R get( |
|
||||||
@ApiParam(name = "logId", value = "日志id", required = true) |
|
||||||
@RequestParam @Valid @NotNull Integer logId) { |
|
||||||
HrLog log = logService.getById(logId); |
|
||||||
|
|
||||||
QueryWrapper<LogContent> queryWrapper = new QueryWrapper<>(); |
|
||||||
queryWrapper.eq("log_id",logId); |
|
||||||
List<LogContent> list = logContentService.list(queryWrapper); |
|
||||||
log.setLogContents(list); |
|
||||||
return R.ok().put("log",log); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "删除日志") |
|
||||||
@PostMapping("/delete") |
|
||||||
public R delete( |
|
||||||
@ApiParam(name = "logId", value = "日志id", required = true) |
|
||||||
@RequestParam Integer logId) { |
|
||||||
|
|
||||||
QueryWrapper<LogContent> queryWrapper = new QueryWrapper<>(); |
|
||||||
queryWrapper.eq("log_id",logId); |
|
||||||
logContentService.remove(queryWrapper); |
|
||||||
|
|
||||||
boolean remove = logService.removeById(logId); |
|
||||||
|
|
||||||
return remove ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "更新日志") |
|
||||||
@PostMapping("/update") |
|
||||||
public R update( |
|
||||||
@ApiParam(name = "log", value = "日志数据", required = true) |
|
||||||
@RequestBody HrLog log) { |
|
||||||
|
|
||||||
if (log.getLogContents()!=null){ |
|
||||||
ArrayList<Integer> before = new ArrayList<>(); |
|
||||||
ArrayList<Integer> after = new ArrayList<>(); |
|
||||||
//获取该平台最新数据
|
|
||||||
HrLog one = logService.getOne(new QueryWrapper<HrLog>(). |
|
||||||
eq("platform_id", log.getPlatformId()). |
|
||||||
orderByDesc("log_id").last("limit 1")); |
|
||||||
|
|
||||||
//更新之前查询日志数据
|
|
||||||
List<LogContent> contentList = logContentService. |
|
||||||
list(new QueryWrapper<LogContent>().eq("log_id", log.getLogId())); |
|
||||||
for (LogContent logContent : contentList) { |
|
||||||
before.add(logContent.getId()); |
|
||||||
} |
|
||||||
|
|
||||||
//更新内容
|
|
||||||
List<LogContent> logContents = log.getLogContents(); |
|
||||||
logContents.forEach(logContent -> { |
|
||||||
if (logContent.getId()!=null){ |
|
||||||
logContentService.updateById(logContent); |
|
||||||
after.add(logContent.getId()); |
|
||||||
}else { |
|
||||||
logContent.setLogId(log.getLogId()); |
|
||||||
logContentService.save(logContent); |
|
||||||
} |
|
||||||
}); |
|
||||||
//长度变化,表示有删减
|
|
||||||
if (before.size()!=after.size()){ |
|
||||||
Collection differentNoDuplicate = CollectionUtil.getDifferentNoDuplicate(before, after); |
|
||||||
logContentService.removeByIds(differentNoDuplicate); |
|
||||||
} |
|
||||||
|
|
||||||
HrLog byId = logService.getById(log.getLogId()); |
|
||||||
if (log.getDraft()==0 && byId.getVersion()<1){ |
|
||||||
log.setDraftTime(new Date()); |
|
||||||
log.setVersion(1); |
|
||||||
} |
|
||||||
|
|
||||||
//更新为发布状态且之前状态为撤回且之前版本更新不通知,通知该平台所有存在用户
|
|
||||||
if (log.getDraft()==0 & log.getLogId().equals(one.getLogId()) & one.getWithdraw()==1){ |
|
||||||
//重新发布允许撤回该日志
|
|
||||||
log.setWithdrawNum(0); |
|
||||||
List<Integer> accountIds = logService.queryAllAccount(log.getPlatformId()); |
|
||||||
accountIds.forEach(accountId -> { |
|
||||||
redisTemplate.opsForValue().set(accountId.toString()+log.getPlatformId(),"true"); |
|
||||||
}); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
boolean update = logService.updateById(log); |
|
||||||
return update ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,113 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
||||||
import com.huoran.api.UserClient; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.HrMallMarketingPromotion; |
|
||||||
import com.huoran.nakadai.entity.PartnerArticleManagement; |
|
||||||
import com.huoran.nakadai.entity.req.MarketingPromotionPageReq; |
|
||||||
import com.huoran.nakadai.service.HrMallMarketingPromotionService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* @描述:控制类 |
|
||||||
* @作者: Rong |
|
||||||
* @日期: 2023-04-25 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/mall/marketing/promotion") |
|
||||||
@Api(value = ":HrMallMarketingPromotionController", tags = "R-营销推广管理") |
|
||||||
|
|
||||||
public class HrMallMarketingPromotionController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public HrMallMarketingPromotionService service; |
|
||||||
@Autowired |
|
||||||
private UserClient userClient; |
|
||||||
|
|
||||||
@PostMapping("/pagingQueryList") |
|
||||||
@ApiOperation(value = "分页查询", response = HrMallMarketingPromotion.class) |
|
||||||
public R pagingQueryList(@RequestBody MarketingPromotionPageReq req) { |
|
||||||
Page<HrMallMarketingPromotion> page = new Page<HrMallMarketingPromotion>(req.getPageNum(), req.getPageSize()); |
|
||||||
|
|
||||||
QueryWrapper<HrMallMarketingPromotion> queryWrapper = new QueryWrapper<>(); |
|
||||||
if (req.getTitle() != null && !req.getTitle().equals("")) { |
|
||||||
queryWrapper.like("title", req.getTitle()); |
|
||||||
} |
|
||||||
|
|
||||||
if (req.getIsOpen() != null && !req.getIsOpen().equals("")) { |
|
||||||
queryWrapper.eq("is_open", req.getIsOpen()); |
|
||||||
} |
|
||||||
queryWrapper.orderByDesc("create_time"); |
|
||||||
IPage<HrMallMarketingPromotion> pagingQueryList = service.page(page, queryWrapper); |
|
||||||
return R.ok().put("page", pagingQueryList); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/findById") |
|
||||||
@ApiOperation(value = "查询详情", response = HrMallMarketingPromotion.class) |
|
||||||
public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { |
|
||||||
HrMallMarketingPromotion hrMallMarketingPromotion = service.getById(id); |
|
||||||
return R.ok().put("data", hrMallMarketingPromotion); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/save") |
|
||||||
@ApiOperation(value = "新增", response = HrMallMarketingPromotion.class) |
|
||||||
public R save(@RequestBody @ApiParam(name = "对象", value = "传入json格式", required = true) HrMallMarketingPromotion hrMallMarketingPromotion, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
hrMallMarketingPromotion.setAccountId(Integer.valueOf(accountId)); |
|
||||||
boolean addState = service.save(hrMallMarketingPromotion); |
|
||||||
return addState ? R.ok() : R.error("新增失败"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/update") |
|
||||||
@ApiOperation(value = "修改", response = HrMallMarketingPromotion.class) |
|
||||||
public R update(@RequestBody @ApiParam(name = "对象", value = "传入json格式", required = true) HrMallMarketingPromotion hrMallMarketingPromotion, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
hrMallMarketingPromotion.setAccountId(Integer.valueOf(accountId)); |
|
||||||
boolean updateState = service.updateById(hrMallMarketingPromotion); |
|
||||||
return updateState ? R.ok() : R.error("编辑失败"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/delete") |
|
||||||
@ApiOperation(value = "删除", response = HrMallMarketingPromotion.class) |
|
||||||
public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { |
|
||||||
boolean delState = service.removeById(id); |
|
||||||
return delState ? R.ok() : R.error("删除失败"); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/batchDeletion") |
|
||||||
@ApiOperation(value = "批量删除", response = HrMallMarketingPromotion.class) |
|
||||||
public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestParam List<Integer> ids) { |
|
||||||
boolean delState = service.removeByIds(ids); |
|
||||||
return delState ? R.ok() : R.error("删除失败"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/bannerEnableOrDisable") |
|
||||||
@ApiOperation(value = "banner启用禁用", response = PartnerArticleManagement.class) |
|
||||||
public R bannerEnableOrDisable(@ApiParam(name = "id", value = "banner id", required = true) @RequestParam Integer id, @ApiParam(name = "isDisable", value = "是否禁用(0默认,0启用 1禁用)", required = true) @RequestParam Integer isDisable) { |
|
||||||
UpdateWrapper<HrMallMarketingPromotion> updateWrapper = new UpdateWrapper<HrMallMarketingPromotion>(); |
|
||||||
updateWrapper.set("is_open", isDisable); |
|
||||||
updateWrapper.eq("id", id); |
|
||||||
boolean ret = service.update(new HrMallMarketingPromotion(), updateWrapper); |
|
||||||
return ret ? R.ok() : R.error("禁用/启用失败"); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,92 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.nakadai.entity.HrStaffAccountArchitecture; |
|
||||||
import com.huoran.nakadai.entity.req.ArchitectureAddReq; |
|
||||||
import com.huoran.nakadai.service.HrStaffAccountArchitectureService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.BeanUtils; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.validation.Valid; |
|
||||||
import java.util.*; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 中台账号组织架构 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2022-03-22 |
|
||||||
*/ |
|
||||||
@Api(tags = "中台账号组织架构") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/staffAccountArchitecture") |
|
||||||
public class HrStaffAccountArchitectureController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public HrStaffAccountArchitectureService architectureService; |
|
||||||
|
|
||||||
/** |
|
||||||
* 新增中台组织架构 |
|
||||||
*/ |
|
||||||
@PostMapping("/save") |
|
||||||
@ApiOperation(value = "新增中台组织架构") |
|
||||||
public R save(@RequestBody @Valid ArchitectureAddReq architectureAddReq) { |
|
||||||
|
|
||||||
if (architectureAddReq.getLevel() > 6) { |
|
||||||
return R.error("暂不支持" + architectureAddReq.getLevel() + "层级"); |
|
||||||
} |
|
||||||
HrStaffAccountArchitecture architecture = new HrStaffAccountArchitecture(); |
|
||||||
BeanUtils.copyProperties(architectureAddReq, architecture); |
|
||||||
|
|
||||||
boolean ok = architectureService.checkRepeat(architecture); |
|
||||||
if (ok) { |
|
||||||
return R.error("同级下已存在相同的名称:" + architectureAddReq.getOrganizationName()); |
|
||||||
} |
|
||||||
boolean save = architectureService.save(architecture); |
|
||||||
return save ? R.ok().put("id", architecture.getId()) : R.error(); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 编辑中台组织架构 |
|
||||||
*/ |
|
||||||
@PostMapping("/update") |
|
||||||
@ApiOperation(value = "编辑中台组织架构") |
|
||||||
public R update(@RequestBody @Valid HrStaffAccountArchitecture architecture) { |
|
||||||
boolean ok = architectureService.checkRepeat(architecture); |
|
||||||
if (ok) { |
|
||||||
return R.error("同级下已存在相同的名称:" + architecture.getOrganizationName()); |
|
||||||
} else { |
|
||||||
boolean update = architectureService.updateById(architecture); |
|
||||||
return update ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 删除组织架构 |
|
||||||
*/ |
|
||||||
@PostMapping("/delete") |
|
||||||
@ApiOperation(value = "删除中台组织架构") |
|
||||||
public R delete(@ApiParam(name = "id", value = "架构id", required = true) @RequestParam Integer id) { |
|
||||||
//级联删除子部门
|
|
||||||
boolean remove = architectureService.removeOrganization(id); |
|
||||||
return remove ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 中台组织架构树形列表 |
|
||||||
*/ |
|
||||||
@PostMapping("/treeList") |
|
||||||
@ApiOperation(value = "中台组织架构树形列表", response = HrStaffAccountArchitecture.class) |
|
||||||
public R treeList() { |
|
||||||
List<HrStaffAccountArchitecture> list = architectureService.treeList(); |
|
||||||
return R.ok().put("treeList", list); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,106 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import com.huoran.common.response.R; |
|
||||||
|
|
||||||
import com.huoran.nakadai.entity.req.StaffAddReq; |
|
||||||
import com.huoran.nakadai.entity.req.StaffListReq; |
|
||||||
import com.huoran.nakadai.entity.req.StaffUpdateReq; |
|
||||||
import com.huoran.nakadai.entity.res.StaffResp; |
|
||||||
import com.huoran.nakadai.service.HrStaffService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
import org.springframework.web.multipart.MultipartFile; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import javax.servlet.http.HttpServletResponse; |
|
||||||
import javax.validation.Valid; |
|
||||||
|
|
||||||
import java.io.IOException; |
|
||||||
import java.util.List; |
|
||||||
import java.util.Map; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 中台后台员工账号表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2022-03-22 |
|
||||||
*/ |
|
||||||
@Api(tags = "中台后台员工账号") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/backstageStaff") |
|
||||||
public class HrStaffController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public HrStaffService staffService; |
|
||||||
|
|
||||||
/** |
|
||||||
* 新增员工 |
|
||||||
*/ |
|
||||||
@PostMapping("/saveStaff") |
|
||||||
@ApiOperation(value = "新增员工") |
|
||||||
public R saveStaff(@RequestBody @Valid StaffAddReq staffReq) throws Exception { |
|
||||||
return staffService.saveStaff(staffReq); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 员工列表 |
|
||||||
*/ |
|
||||||
@PostMapping("/staffList") |
|
||||||
@ApiOperation(value = "员工列表", response = StaffResp.class) |
|
||||||
public R staffList(@RequestBody @Valid StaffListReq req) { |
|
||||||
return staffService.pageStaffList(req); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 员工详情 |
|
||||||
*/ |
|
||||||
@GetMapping("/staffDetail") |
|
||||||
@ApiOperation(value = "员工详情", response = StaffResp.class) |
|
||||||
public R staffDetail(@ApiParam(name = "accountId", value = "员工账号id") @RequestParam Integer accountId) { |
|
||||||
return staffService.staffDetail(accountId); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 编辑员工 |
|
||||||
*/ |
|
||||||
@PostMapping("/modifyStaff") |
|
||||||
@ApiOperation(value = "编辑员工") |
|
||||||
public R modifyStaff(@RequestBody @Valid StaffUpdateReq updateReq) { |
|
||||||
return staffService.modifyStaff(updateReq); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 删除员工 |
|
||||||
*/ |
|
||||||
@PostMapping("/delStaff") |
|
||||||
@ApiOperation(value = "删除员工") |
|
||||||
public R delStaff(@ApiParam(name = "accountIds", value = "要删除的账号id") @RequestParam List<Integer> accountIds) { |
|
||||||
return staffService.delStaff(accountIds); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 批量导入员工 |
|
||||||
*/ |
|
||||||
@PostMapping("/importStaff") |
|
||||||
@ApiOperation("批量导入员工") |
|
||||||
public R importStaff(@RequestParam(name = "file") MultipartFile file, HttpServletRequest request) throws IOException { |
|
||||||
Map<String, String> map = staffService.importStaff(file); |
|
||||||
return R.ok().put("data", map); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 批量导入员工失败数据导出 |
|
||||||
*/ |
|
||||||
@ApiOperation(value = "批量导入员工失败数据导出") |
|
||||||
@GetMapping("/exportFailure") |
|
||||||
public void exportFailureRecord(HttpServletResponse response, @ApiParam(name = "exportCode", value = "importQuestion接口返回的exportCode", required = true) @RequestParam String exportCode) throws Exception { |
|
||||||
staffService.exportFailureRecord(response, exportCode); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
@ -1,23 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RestController; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2022-03-23 |
|
||||||
*/ |
|
||||||
@Api(tags = "员工部门") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/staffDepartment") |
|
||||||
public class HrStaffDepartmentController { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,21 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RestController; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2022-03-08 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/log-content") |
|
||||||
public class LogContentController { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,21 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RestController; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 商品附件表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2023-05-06 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/mall-annex") |
|
||||||
public class MallAnnexController { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,20 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||||
import org.springframework.web.bind.annotation.RestController; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 商品分类关联表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2023-04-25 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/mallClassification") |
|
||||||
public class MallClassificationController { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,215 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil; |
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.api.UserClient; |
|
||||||
import com.huoran.common.exception.CustomException; |
|
||||||
import com.huoran.common.exception.ExceptionEnum; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.*; |
|
||||||
import com.huoran.nakadai.entity.req.GoodsListReq; |
|
||||||
import com.huoran.nakadai.entity.res.GoodsRes; |
|
||||||
import com.huoran.nakadai.entity.vo.GoodsVo; |
|
||||||
import com.huoran.nakadai.mapper.CurriculumMapper; |
|
||||||
import com.huoran.nakadai.mapper.DataProductMapper; |
|
||||||
import com.huoran.nakadai.service.MallClassificationService; |
|
||||||
import com.huoran.nakadai.service.MallService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.transaction.annotation.Transactional; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import javax.validation.Valid; |
|
||||||
import javax.validation.constraints.NotNull; |
|
||||||
import java.util.Date; |
|
||||||
import java.util.List; |
|
||||||
import java.util.concurrent.ExecutionException; |
|
||||||
import java.util.stream.Collectors; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 商城管理表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2023-04-25 |
|
||||||
*/ |
|
||||||
@Api(value = "M-商城商品管理", tags = "M-商城商品管理") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/mall") |
|
||||||
public class MallController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private MallService mallService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private MallClassificationService mallClassificationService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private CurriculumMapper curriculumMapper; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private DataProductMapper dataProductMapper; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private UserClient userClient; |
|
||||||
|
|
||||||
@ApiOperation(value = "添加商品") |
|
||||||
@PostMapping("/addGoods") |
|
||||||
public R addGoods( |
|
||||||
@ApiParam(name = "goodsVo", value = "商品数据", required = true) |
|
||||||
@RequestBody @Valid GoodsVo goodsVo, HttpServletRequest request) throws ExecutionException, InterruptedException { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
goodsVo.getMall().setAccountId(accountId); |
|
||||||
//保存上架时间
|
|
||||||
if (goodsVo.getMall().getState()==0){ |
|
||||||
goodsVo.getMall().setShelfTime(new Date()); |
|
||||||
} |
|
||||||
return mallService.addGoods(goodsVo); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "商品列表", response = GoodsRes.class) |
|
||||||
@PostMapping("/listOfGoods") |
|
||||||
public R listOfGoods( |
|
||||||
@ApiParam(name = "orderListReq", value = "查询条件", required = true) |
|
||||||
@RequestBody GoodsListReq goodsListReq,HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
goodsListReq.setSchoolId(schoolId); |
|
||||||
return mallService.listOfGoods(goodsListReq); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "职站商城", response = GoodsRes.class) |
|
||||||
@PostMapping("/stationShoppingMall") |
|
||||||
public R stationShoppingMall( |
|
||||||
@ApiParam(name = "orderListReq", value = "查询条件", required = true) |
|
||||||
@RequestBody GoodsListReq goodsListReq) { |
|
||||||
return mallService.stationShoppingMall(goodsListReq); |
|
||||||
} |
|
||||||
|
|
||||||
@GetMapping("/schoolGoods") |
|
||||||
@ApiOperation(value = "获取学校购买订单后的商品id") |
|
||||||
public List<Integer> schoolGoods(HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
return mallService.schoolGoods(schoolId); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "商品详情") |
|
||||||
@GetMapping("/detailsOfGoods") |
|
||||||
public R detailsOfGoods( |
|
||||||
@ApiParam(name = "mallId", value = "商品id", required = true) |
|
||||||
@RequestParam @Valid @NotNull Integer mallId,@RequestHeader(required = false) String token) { |
|
||||||
GoodsVo goodsDetails = mallService.detailsOfGoods(mallId,token); |
|
||||||
return R.ok().put("orderDetails", goodsDetails); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "商品上下架") |
|
||||||
@PostMapping("/goodsOffTheShelf") |
|
||||||
@Transactional |
|
||||||
// @CacheEvict(value = "n_listOfGoods", allEntries = true)
|
|
||||||
public R goodsOffTheShelf( |
|
||||||
@ApiParam(name = "mallId", value = "商品id", required = true) |
|
||||||
@RequestParam Integer mallId, |
|
||||||
@ApiParam(name = "isShelves", value = "上下架(1下架 0上架 默认0)", required = true) |
|
||||||
@RequestParam Integer isShelves, |
|
||||||
HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Mall mall = mallService.getById(mallId); |
|
||||||
|
|
||||||
//关联了课程产品并上架
|
|
||||||
if (mall.getIsAssociatedProduct()==0 && isShelves==0){ |
|
||||||
|
|
||||||
List<MallClassification> classifications = mallClassificationService.list(new QueryWrapper<MallClassification>().eq("mall_id", mallId)); |
|
||||||
List<Integer> classificationIds = classifications.stream().map(MallClassification::getClassificationId).collect(Collectors.toList()); |
|
||||||
|
|
||||||
if (classificationIds.contains(1)||classificationIds.contains(2)){ |
|
||||||
//查询课程
|
|
||||||
Curriculum curriculum = curriculumMapper.selectById(mall.getAssociatedProduct()); |
|
||||||
if (ObjectUtil.isNull(curriculum)){ |
|
||||||
throw new CustomException(ExceptionEnum.COURSE_PRODUCTS_HAVE_BEEN_REMOVED); |
|
||||||
}else { |
|
||||||
if (curriculum.getIsShelves()==0){ |
|
||||||
throw new CustomException(ExceptionEnum.COURSE_PRODUCTS_HAVE_BEEN_REMOVED_FROM_SALE); |
|
||||||
} |
|
||||||
} |
|
||||||
//关联了数据平台
|
|
||||||
}else if (classificationIds.contains(5)){ |
|
||||||
DataProduct dataProduct = dataProductMapper.selectById(mall.getAssociatedProduct()); |
|
||||||
if (ObjectUtil.isNull(dataProduct)){ |
|
||||||
throw new CustomException(ExceptionEnum.DATA_PRODUCTS_HAVE_BEEN_REMOVED); |
|
||||||
}else { |
|
||||||
if (dataProduct.getStatus()==0){ |
|
||||||
throw new CustomException(ExceptionEnum.DATA_PRODUCTS_HAVE_BEEN_REMOVED_FROM_SALE); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
if (isShelves==0){ |
|
||||||
mall.setShelfTime(new Date()); |
|
||||||
} |
|
||||||
|
|
||||||
boolean ret = mallService.updateById(mall.setIsShelves(isShelves).setAccountId(accountId).setState(isShelves)); |
|
||||||
return ret ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "商品精选") |
|
||||||
@PostMapping("/goodsSelection") |
|
||||||
// @CacheEvict(value = "n_listOfGoods", allEntries = true)
|
|
||||||
public R goodsSelection( |
|
||||||
@ApiParam(name = "mallId", value = "商品id", required = true) |
|
||||||
@RequestParam Integer mallId, |
|
||||||
@ApiParam(name = "selected", value = "0不精选,1为精选 默认0", required = true) |
|
||||||
@RequestParam Integer selected, |
|
||||||
HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Mall mall = mallService.getById(mallId); |
|
||||||
boolean ret = mallService.updateById(mall.setSelected(selected).setAccountId(accountId)); |
|
||||||
return ret ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "删除商品") |
|
||||||
@PostMapping("/deletionOfGoods") |
|
||||||
public R deletionOfGoods( |
|
||||||
@ApiParam(name = "mallId", value = "商品id", required = true) |
|
||||||
@RequestBody Integer mallId) { |
|
||||||
boolean delete = mallService.deletionOfGoods(mallId); |
|
||||||
return delete ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "更新商品") |
|
||||||
@PostMapping("/renewalOfGoods") |
|
||||||
public R renewalOfGoods( |
|
||||||
@ApiParam(name = "goodsVo", value = "商品数据", required = true) |
|
||||||
@RequestBody @Valid GoodsVo goodsVo,HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
goodsVo.getMall().setAccountId(accountId); |
|
||||||
boolean update = mallService.renewalOfGoods(goodsVo); |
|
||||||
return update ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "解决方案分类-商品") |
|
||||||
@GetMapping("/goodsSchemeClassification") |
|
||||||
public R goodsSchemeClassification() { |
|
||||||
List<PartnerArticleClassification> list = mallService.goodsSchemeClassification(); |
|
||||||
return R.ok().put("data", list); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "或然官网-商品列表",response = GoodsRes.class) |
|
||||||
@PostMapping("/websiteProductList") |
|
||||||
public R websiteProductList( |
|
||||||
@ApiParam(name = "orderListReq", value = "查询条件", required = true) |
|
||||||
@RequestBody GoodsListReq goodsListReq) { |
|
||||||
return mallService.websiteProductList(goodsListReq); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,61 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.api.UserClient; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.MallCourseLearningRecord; |
|
||||||
import com.huoran.nakadai.service.MallCourseLearningRecordService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.PostMapping; |
|
||||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||||
import org.springframework.web.bind.annotation.RequestParam; |
|
||||||
import org.springframework.web.bind.annotation.RestController; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 商品课程学习记录 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2023-04-26 |
|
||||||
*/ |
|
||||||
@Api(value = "M-商品课程学习记录", tags = "M-商品课程学习记录") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/mallCourseLearningRecord") |
|
||||||
public class MallCourseLearningRecordController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private MallCourseLearningRecordService recordService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private UserClient userClient; |
|
||||||
|
|
||||||
@ApiOperation(value = "添加学习记录(进入实验调用)") |
|
||||||
@PostMapping("/addLearningRecord") |
|
||||||
public R addLearningRecord( |
|
||||||
@ApiParam(name = "mallId", value = "商品id", required = true) |
|
||||||
@RequestParam Integer mallId, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
//查询记录,进入过实验,下次进入不再记录数据
|
|
||||||
MallCourseLearningRecord one = recordService.getOne(new QueryWrapper<MallCourseLearningRecord>(). |
|
||||||
eq("mall_id", mallId).eq("account_id", accountId)); |
|
||||||
if (one==null){ |
|
||||||
MallCourseLearningRecord record = new MallCourseLearningRecord(); |
|
||||||
record.setMallId(mallId); |
|
||||||
record.setAccountId(Integer.valueOf(accountId)); |
|
||||||
record.setSchoolId(schoolId); |
|
||||||
recordService.save(record); |
|
||||||
} |
|
||||||
return R.ok(); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,41 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.nakadai.service.MallDisciplineService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.PostMapping; |
|
||||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||||
import org.springframework.web.bind.annotation.RequestParam; |
|
||||||
import org.springframework.web.bind.annotation.RestController; |
|
||||||
import org.springframework.web.multipart.MultipartFile; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 商品学科类别关联表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2023-04-25 |
|
||||||
*/ |
|
||||||
@Api(value = "M-商城商品学科类别管理", tags = "M-商城商品学科类别管理") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/mallDiscipline") |
|
||||||
public class MallDisciplineController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private MallDisciplineService mallDisciplineService; |
|
||||||
|
|
||||||
/** |
|
||||||
* 批量导入学科类别 |
|
||||||
*/ |
|
||||||
@PostMapping("/importSubjectCategoriesInBatches") |
|
||||||
@ApiOperation("批量导入学科类别") |
|
||||||
public R importSubjectCategoriesInBatches(@RequestParam(name = "file") MultipartFile file) { |
|
||||||
return mallDisciplineService.importSubjectCategoriesInBatches(file); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,21 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RestController; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 非关联产品链接 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2023-05-15 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/mall-non-associated-links") |
|
||||||
public class MallNonAssociatedLinksController { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,76 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil; |
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.nakadai.entity.MallPrice; |
|
||||||
import com.huoran.nakadai.service.MallPriceService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.PostMapping; |
|
||||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||||
import org.springframework.web.bind.annotation.RequestParam; |
|
||||||
import org.springframework.web.bind.annotation.RestController; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 商品价格表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2023-04-25 |
|
||||||
*/ |
|
||||||
@Api(value = "M-商城商品价格管理", tags = "M-商城商品价格管理") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/mallPrice") |
|
||||||
public class MallPriceController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private MallPriceService mallPriceService; |
|
||||||
|
|
||||||
@ApiOperation(value = "查询商品所在省份城市结算价",response = MallPrice.class) |
|
||||||
@PostMapping("/queryCitySettlementPrice") |
|
||||||
public R queryCitySettlementPrice( |
|
||||||
@ApiParam(name = "provinceId", value = "省份id", required = true) |
|
||||||
@RequestParam Integer provinceId, |
|
||||||
@ApiParam(name = "cityId", value = "城市id", required = true) |
|
||||||
@RequestParam Integer cityId, |
|
||||||
@ApiParam(name = "mallId", value = "商品id", required = true) |
|
||||||
@RequestParam Integer mallId) { |
|
||||||
QueryWrapper<MallPrice> cityPriceQueryWrapper = new QueryWrapper<>(); |
|
||||||
cityPriceQueryWrapper.eq("settlement_price_type",1) |
|
||||||
.eq("mall_id",mallId) |
|
||||||
.eq("city_id",cityId); |
|
||||||
//查询城市价格,没有查询省份
|
|
||||||
MallPrice one = mallPriceService.getOne(cityPriceQueryWrapper); |
|
||||||
if (ObjectUtil.isNotNull(one)){ |
|
||||||
return R.ok().put("mallPrice",one); |
|
||||||
} |
|
||||||
//查询省份价格,没有查询平台价
|
|
||||||
QueryWrapper<MallPrice> provinceQueryWrapper = new QueryWrapper<>(); |
|
||||||
provinceQueryWrapper.eq("settlement_price_type",1) |
|
||||||
.eq("mall_id",mallId) |
|
||||||
.eq("area",provinceId); |
|
||||||
MallPrice two = mallPriceService.getOne(provinceQueryWrapper); |
|
||||||
if (ObjectUtil.isNotNull(two)){ |
|
||||||
return R.ok().put("mallPrice",two); |
|
||||||
} |
|
||||||
//查询平台价
|
|
||||||
QueryWrapper<MallPrice> platformQueryWrapper = new QueryWrapper<>(); |
|
||||||
platformQueryWrapper.eq("settlement_price_type",1) |
|
||||||
.eq("mall_id",mallId) |
|
||||||
.eq("area",0); |
|
||||||
MallPrice three = mallPriceService.getOne(platformQueryWrapper); |
|
||||||
if (ObjectUtil.isNotNull(three)){ |
|
||||||
return R.ok().put("mallPrice",three); |
|
||||||
}else { |
|
||||||
return R.error("该商品还未设置平台结算价,联系管理员设置价格再下订单!"); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,21 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RestController; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 商品供应商关联表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2023-04-25 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/mallSupplier") |
|
||||||
public class MallSupplierController { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,21 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RestController; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 商品分类标签关联表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2023-04-25 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/mallTags") |
|
||||||
public class MallTagsController { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,21 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RestController; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 商品类型关联表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2023-04-25 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/mallType") |
|
||||||
public class MallTypeController { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,96 +1,104 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
package com.huoran.nakadai.controller; |
package com.huoran.nakadai.controller; |
||||||
|
|
||||||
import com.huoran.common.response.R; |
import cn.hutool.core.util.StrUtil; |
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.huoran.common.response.ServerResponseEntity; |
||||||
|
import com.huoran.nakadai.entity.model.Message; |
||||||
import com.huoran.nakadai.service.MessageService; |
import com.huoran.nakadai.service.MessageService; |
||||||
import io.swagger.annotations.Api; |
import com.huoran.nakadai.utils.PageParam; |
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.apache.commons.lang3.StringUtils; |
|
||||||
import org.springframework.amqp.core.AmqpAdmin; |
|
||||||
import org.springframework.amqp.core.DirectExchange; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
import org.springframework.beans.factory.annotation.Autowired; |
||||||
import org.springframework.web.bind.annotation.*; |
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
import java.util.Arrays; |
||||||
|
|
||||||
|
|
||||||
@Api(value = "或然中台消息管理", tags = "或然中台消息管理") |
|
||||||
@RestController |
@RestController |
||||||
@RequestMapping("/message") |
@RequestMapping("/admin/message") |
||||||
public class MessageController { |
public class MessageController { |
||||||
|
|
||||||
@Autowired |
|
||||||
private AmqpAdmin amqpAdmin; |
|
||||||
|
|
||||||
@Autowired |
@Autowired |
||||||
private MessageService messageService; |
private MessageService messageService; |
||||||
|
|
||||||
// @Autowired
|
|
||||||
// private WebsocketService webSocketService;
|
|
||||||
|
|
||||||
// @ApiOperation(value = "所有在线用户接收消息通知",response = SendMsgVO.class)
|
|
||||||
// @PostMapping("/refreshPageNotification")
|
|
||||||
// public void refreshPageNotification(
|
|
||||||
// @ApiParam(name = "username", value = "发送者名称", required = false)
|
|
||||||
// @RequestParam(required = false) String username,
|
|
||||||
// @ApiParam(name = "to", value = "发给谁(默认发送给所有在线用户)", required = false)
|
|
||||||
// @RequestParam(required = false) String to,
|
|
||||||
// @ApiParam(name = "content", value = "消息通知", required = false)
|
|
||||||
// @RequestParam(required = false) String content) {
|
|
||||||
// WebsocketMsgDTO websocketMsgDTO = new WebsocketMsgDTO();
|
|
||||||
// websocketMsgDTO.setForm("系统消息");
|
|
||||||
// if (StringUtils.isEmpty(username)){
|
|
||||||
// websocketMsgDTO.setUsername("系统通知机器人");
|
|
||||||
// }else {
|
|
||||||
// websocketMsgDTO.setUsername(username);
|
|
||||||
// }
|
|
||||||
// if (StringUtils.isEmpty(to)){
|
|
||||||
// websocketMsgDTO.setTo("all");
|
|
||||||
// }else {
|
|
||||||
// websocketMsgDTO.setTo(to);
|
|
||||||
// }
|
|
||||||
// if (StringUtils.isEmpty(content)){
|
|
||||||
// websocketMsgDTO.setContent("refresh");
|
|
||||||
// }else {
|
|
||||||
// websocketMsgDTO.setContent(content);
|
|
||||||
// }
|
|
||||||
// websocketMsgDTO.setExtras(null);
|
|
||||||
// webSocketService.send(websocketMsgDTO);
|
|
||||||
// }
|
|
||||||
|
|
||||||
/** |
/** |
||||||
* 发送指定的用户队列 |
* 分页获取 |
||||||
*/ |
*/ |
||||||
@ApiOperation(value = "发送消息给指定的用户") |
@GetMapping("/page") |
||||||
@GetMapping("/sendMessageToUser") |
public ServerResponseEntity<IPage<Message>> page(Message message, PageParam<Message> page) { |
||||||
public void sendMessageToUser(String message, String accountId) { |
IPage<Message> messages = messageService.page(page, new LambdaQueryWrapper<Message>() |
||||||
messageService.sendMessageToUser(message,accountId); |
.like(StrUtil.isNotBlank(message.getUserName()), Message::getUserName, message.getUserName()) |
||||||
|
.eq(message.getStatus() != null, Message::getStatus, message.getStatus())); |
||||||
|
return ServerResponseEntity.success(messages); |
||||||
} |
} |
||||||
|
|
||||||
|
/** |
||||||
@ApiOperation(value = "接收消息") |
* 获取信息 |
||||||
@GetMapping("/receiveMessages") |
*/ |
||||||
public R receiveMessages(HttpServletRequest request,Long deliveryTag) { |
@GetMapping("/info/{id}") |
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
public ServerResponseEntity<Message> info(@PathVariable("id") Long id) { |
||||||
return messageService.messagesListener(accountId,deliveryTag); |
Message message = messageService.getById(id); |
||||||
|
return ServerResponseEntity.success(message); |
||||||
} |
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 保存 |
||||||
|
*/ |
||||||
|
@PostMapping |
||||||
|
public ServerResponseEntity<Void> save(@RequestBody Message message) { |
||||||
|
messageService.save(message); |
||||||
|
return ServerResponseEntity.success(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
@ApiOperation(value = "创建交换机") |
* 修改 |
||||||
@GetMapping("/creatExchange") |
*/ |
||||||
public void creatExchange( |
@PutMapping |
||||||
@ApiParam(name = "exchangeName", value = "交换机名称", required = true) |
public ServerResponseEntity<Void> update(@RequestBody Message message) { |
||||||
@RequestParam String exchangeName) { |
messageService.updateById(message); |
||||||
DirectExchange directExchange = new DirectExchange(exchangeName,true,false); |
return ServerResponseEntity.success(); |
||||||
amqpAdmin.declareExchange(directExchange); |
|
||||||
} |
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 公开留言 |
||||||
|
*/ |
||||||
|
@PutMapping("/release/{id}") |
||||||
|
public ServerResponseEntity<Void> release(@PathVariable("id") Long id) { |
||||||
|
Message message = new Message(); |
||||||
|
message.setId(id); |
||||||
|
message.setStatus(1); |
||||||
|
messageService.updateById(message); |
||||||
|
return ServerResponseEntity.success(); |
||||||
|
} |
||||||
|
|
||||||
@ApiOperation(value = "创建队列") |
/** |
||||||
@GetMapping("/createQueue") |
* 取消公开留言 |
||||||
public void createQueue(String accountId) { |
*/ |
||||||
messageService.createQueue(accountId); |
@PutMapping("/cancel/{id}") |
||||||
|
public ServerResponseEntity<Void> cancel(@PathVariable("id") Long id) { |
||||||
|
Message message = new Message(); |
||||||
|
message.setId(id); |
||||||
|
message.setStatus(1); |
||||||
|
messageService.updateById(message); |
||||||
|
return ServerResponseEntity.success(); |
||||||
} |
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除 |
||||||
|
*/ |
||||||
|
@DeleteMapping("/{ids}") |
||||||
|
public ServerResponseEntity<Void> delete(@PathVariable Long[] ids) { |
||||||
|
messageService.removeByIds(Arrays.asList(ids)); |
||||||
|
return ServerResponseEntity.success(); |
||||||
|
} |
||||||
} |
} |
||||||
|
@ -1,72 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import com.huoran.api.UserClient; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.ModelDemoHidden; |
|
||||||
import com.huoran.nakadai.service.ModelDemoHiddenService; |
|
||||||
import com.huoran.nakadai.service.ModelReferenceDemoService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
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; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 此表是在教师端系统管理,可对于系统内置模型统一管理 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2023-06-03 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/model/demo/hidden") |
|
||||||
|
|
||||||
@Api(value = "API - 中台:教师端可对于系统内置模型统一管理", tags = "中台:教师端可对于系统内置模型统一管理") |
|
||||||
public class ModelDemoHiddenController { |
|
||||||
@Autowired |
|
||||||
private UserClient userClient; |
|
||||||
@Autowired |
|
||||||
public ModelDemoHiddenService service; |
|
||||||
|
|
||||||
@PostMapping("/batchShutdown") |
|
||||||
@ApiOperation(value = "批量关闭(用于教师端读取系统内置模型—关闭模型) 集合传的是模型id") |
|
||||||
public R delete(@RequestBody List<Integer> ids, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
for (Integer modelId : ids) { |
|
||||||
ModelDemoHidden details = service.viewDetails(modelId, schoolId); |
|
||||||
if (details==null){ |
|
||||||
ModelDemoHidden hidden = new ModelDemoHidden(); |
|
||||||
hidden.setModelId(modelId); |
|
||||||
hidden.setIsClose(1); |
|
||||||
hidden.setSchoolId(schoolId); |
|
||||||
service.save(hidden); |
|
||||||
} |
|
||||||
} |
|
||||||
return R.ok(); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/batchOpen") |
|
||||||
@ApiOperation(value = "批量打开(用于教师端读取系统内置模型—打开模型) 集合传的是模型id") |
|
||||||
public R batchOpen(@RequestBody List<Integer> ids, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
for (Integer modelId : ids) { |
|
||||||
ModelDemoHidden hidden = service.viewDetails(modelId, schoolId); |
|
||||||
service.removeById(hidden.getId()); |
|
||||||
} |
|
||||||
return R.ok(); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,122 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.api.UserClient; |
|
||||||
import com.huoran.common.constant.DelConstant; |
|
||||||
import com.huoran.common.constant.ModellConstant; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.ModelReferenceCategory; |
|
||||||
import com.huoran.nakadai.entity.ModelSysCategory; |
|
||||||
import com.huoran.nakadai.service.ModelReferenceCategoryService; |
|
||||||
import com.huoran.nakadai.service.ModelSysCategoryService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.validation.annotation.Validated; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 引用模型-分类表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2022-03-04 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/model/reference") |
|
||||||
@Api(value = "API - 中台:ModelReferenceCategoryController", tags = "中台:模型分类") |
|
||||||
public class ModelReferenceCategoryController { |
|
||||||
@Autowired |
|
||||||
private UserClient userClient; |
|
||||||
@Autowired |
|
||||||
public ModelReferenceCategoryService service; |
|
||||||
|
|
||||||
@PostMapping("/saveReferenceCategory") |
|
||||||
@ApiOperation(value = "新增模型分类") |
|
||||||
public R saveReferenceCategory(@RequestBody @Validated ModelReferenceCategory modelSysCategory, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
modelSysCategory.setAccountId(Integer.valueOf(accountId)); |
|
||||||
if (modelSysCategory.getFounder() == ModellConstant.SOURCE_INSTITUTION) { |
|
||||||
//创建来源为院校时候赋值学校id
|
|
||||||
modelSysCategory.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); |
|
||||||
} else { |
|
||||||
|
|
||||||
} |
|
||||||
boolean checkRepeat = service.checkRepeat(modelSysCategory, 0); |
|
||||||
if (checkRepeat) { |
|
||||||
return R.error("该层级下已有重复的分类名称了!"); |
|
||||||
} |
|
||||||
boolean ret = service.save(modelSysCategory); |
|
||||||
return ret ? R.ok().put("referenceCategoryId", modelSysCategory.getId()) : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/modelClassList") |
|
||||||
@ApiOperation(value = "模型分类列表(中台、职站教师端通用)") |
|
||||||
public R modelClassList(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId |
|
||||||
, @RequestParam("founder") @ApiParam(value = "创建人来源(0、系统 1、院校)") Integer founder, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = null; |
|
||||||
if (founder == ModellConstant.SOURCE_INSTITUTION) { |
|
||||||
//创建来源为院校时候赋值学校id
|
|
||||||
schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
} |
|
||||||
|
|
||||||
List<ModelReferenceCategory> list = service.modelClassList(systemId, founder, schoolId); |
|
||||||
return R.ok().put("data", list); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/builtInClassificationByNakadai") |
|
||||||
@ApiOperation(value = "职站源模型—(读取的是中台引用模型分类表的数据)") |
|
||||||
public R builtInClassificationByOccupationlab(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
List<ModelReferenceCategory> list = service.builtInClassificationByNakadai(systemId); |
|
||||||
return R.ok().put("data", list); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/deleteModelClass") |
|
||||||
@ApiOperation(value = "删除模型分类") |
|
||||||
public R deleteModelClass(@RequestParam("categoryId") @ApiParam(value = "分类id") Integer categoryId) { |
|
||||||
return service.deleteModelClass(categoryId); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/updateModelClass") |
|
||||||
@ApiOperation(value = "编辑模型分类") |
|
||||||
public R updateModelClass(@RequestBody ModelReferenceCategory modelSysCategory, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
modelSysCategory.setAccountId(Integer.valueOf(accountId)); |
|
||||||
boolean checkRepeat = service.checkRepeat(modelSysCategory, 1); |
|
||||||
if (checkRepeat) { |
|
||||||
return R.error("该层级下已有重复的分类名称了!"); |
|
||||||
} |
|
||||||
boolean ret = service.updateById(modelSysCategory); |
|
||||||
return ret ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/checkIsShowBySystemId") |
|
||||||
@ApiOperation(value = "根据系统id查询模型是否展示", response = ModelReferenceCategory.class) |
|
||||||
public R checkIsShowBySystemId(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId) { |
|
||||||
return service.checkIsShowBySystemId(systemId); |
|
||||||
} |
|
||||||
|
|
||||||
/*@PostMapping("/modifyIsShowState") |
|
||||||
@ApiOperation(value = "更改内置模型按钮前台展示") |
|
||||||
public R modifyIsShowState(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, |
|
||||||
@RequestParam("isShow") @ApiParam(value = "是否展示->默认0为展示 1为不展示") Integer isShow) { |
|
||||||
return service.modifyIsShowState(systemId, isShow); |
|
||||||
}*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,271 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.api.UserClient; |
|
||||||
import com.huoran.common.constant.ModellConstant; |
|
||||||
import com.huoran.common.constant.PlatformConstant; |
|
||||||
import com.huoran.common.entity.PythonCodeResp; |
|
||||||
import com.huoran.common.exception.CustomException; |
|
||||||
import com.huoran.common.exception.ExceptionEnum; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.ModelReferenceDemo; |
|
||||||
import com.huoran.nakadai.entity.ModelSysCategory; |
|
||||||
import com.huoran.nakadai.entity.ModelSysDemo; |
|
||||||
import com.huoran.nakadai.entity.req.PageImportModelReq; |
|
||||||
import com.huoran.nakadai.entity.req.PageModelReq; |
|
||||||
import com.huoran.nakadai.entity.req.PythonCodeRunReq; |
|
||||||
import com.huoran.nakadai.entity.res.ModeCategoryResp; |
|
||||||
import com.huoran.nakadai.service.ModelReferenceDemoService; |
|
||||||
import com.huoran.nakadai.service.ModelSysCategoryService; |
|
||||||
import com.huoran.nakadai.service.ModelSysDemoService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.validation.annotation.Validated; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import java.io.IOException; |
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 引用模型代码记录表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2022-03-04 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/model/reference/demo") |
|
||||||
@Api(value = "API - 中台:ModelReferenceDemoController", tags = "中台:模型代码记录") |
|
||||||
public class ModelReferenceDemoController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private UserClient userClient; |
|
||||||
@Autowired |
|
||||||
public ModelReferenceDemoService service; |
|
||||||
|
|
||||||
|
|
||||||
@Autowired |
|
||||||
public ModelSysCategoryService sysCategoryService; |
|
||||||
@Autowired |
|
||||||
public ModelSysDemoService sysDemoService; |
|
||||||
|
|
||||||
@PostMapping("/saveReferenceDemo") |
|
||||||
@ApiOperation(value = "导入模型") |
|
||||||
public R saveReferenceDemo(@RequestBody @Validated List<ModelReferenceDemo> listReference, HttpServletRequest request) { |
|
||||||
|
|
||||||
if (listReference.size() <= 0) { |
|
||||||
//当前选择的分类下的没有满足条件的模型!
|
|
||||||
throw new CustomException(ExceptionEnum.CLASSIFICATION_HAS_NO_MODEL_DATA); |
|
||||||
} |
|
||||||
|
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
String roleName = userClient.getUserAllRole(accountId, PlatformConstant.NAKADAI);//获取当前用户的角色
|
|
||||||
Integer count = 0; |
|
||||||
for (ModelReferenceDemo referenceDemo : listReference) { |
|
||||||
referenceDemo.setModifyAccountId(Integer.valueOf(accountId)); |
|
||||||
if (roleName != null) { |
|
||||||
referenceDemo.setSchoolId(0); |
|
||||||
referenceDemo.setFounder(0); |
|
||||||
} else { |
|
||||||
referenceDemo.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); |
|
||||||
referenceDemo.setFounder(1); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
referenceDemo.setAccountId(Integer.valueOf(accountId)); |
|
||||||
boolean ret = service.save(referenceDemo); |
|
||||||
if (ret) { |
|
||||||
count++; |
|
||||||
} |
|
||||||
} |
|
||||||
return count == listReference.size() ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/save") |
|
||||||
@ApiOperation(value = "新增源模型分类") |
|
||||||
public R save(@RequestBody @Validated ModelReferenceDemo modelSysCategory, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
modelSysCategory.setAccountId(Integer.valueOf(accountId)); |
|
||||||
modelSysCategory.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); |
|
||||||
modelSysCategory.setModifyAccountId(Integer.valueOf(accountId)); |
|
||||||
if (modelSysCategory.getFounder() == ModellConstant.SOURCE_INSTITUTION) { |
|
||||||
//创建来源为院校时候赋值学校id
|
|
||||||
modelSysCategory.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); |
|
||||||
} |
|
||||||
|
|
||||||
boolean ret = service.save(modelSysCategory); |
|
||||||
return ret ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/findById") |
|
||||||
@ApiOperation(value = "根据主键查询", response = ModelReferenceDemo.class) |
|
||||||
public R findById(@RequestParam("id") @ApiParam(value = "序号") Integer id) { |
|
||||||
ModelReferenceDemo referenceDemo = service.getById(id); |
|
||||||
ModelSysDemo modelSysDemo = sysDemoService.getById(referenceDemo.getCopyId()); |
|
||||||
referenceDemo.setModelName(modelSysDemo.getModelName()); |
|
||||||
referenceDemo.setModelDemo(modelSysDemo.getModelDemo()); |
|
||||||
return R.ok().put("data", referenceDemo); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/referenceDemoList") |
|
||||||
@ApiOperation(value = "模型列表", response = ModelReferenceDemo.class) |
|
||||||
public R listByEntity(@RequestBody @Validated PageModelReq req, HttpServletRequest request) { |
|
||||||
return service.referenceDemoList(req); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/sortReadingModelByTeacherSideSystem") |
|
||||||
@ApiOperation(value = "教师端——依据分类读取系统模型", response = ModelReferenceDemo.class) |
|
||||||
public R sortReadingModelByTeacherSideSystem(@RequestBody @Validated PageModelReq req, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
req.setSchoolId(schoolId); |
|
||||||
return service.sortReadingModelByTeacherSideSystem(req); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/referenceDemoListByNakadai") |
|
||||||
@ApiOperation(value = "职站——系统内置模型列表(读取自中台的引用且启用的模型)", response = ModelReferenceDemo.class) |
|
||||||
public R referenceDemoListByOccupationlab(@RequestBody PageModelReq req, HttpServletRequest request) { |
|
||||||
return service.referenceDemoListByNakadai(req); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/deleteReferenceDemo") |
|
||||||
@ApiOperation(value = "批量移除") |
|
||||||
public R delete(@RequestBody List<Integer> ids) { |
|
||||||
boolean ret = service.removeByIds(ids); |
|
||||||
return ret ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/delModelInfoBySystemId") |
|
||||||
@ApiOperation(value = "同步模型前删除原有数据") |
|
||||||
public R delModelInfoBySystemId(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, |
|
||||||
@RequestParam("founder") @ApiParam(value = "创建人来源(0、系统 1、院校)") Integer founder, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
if (founder == ModellConstant.SOURCE_SYSTEM) { |
|
||||||
schoolId = null; |
|
||||||
} |
|
||||||
return service.delModelInfoBySystemId(systemId, founder, schoolId); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/getAllModelList") |
|
||||||
@ApiOperation(value = "查询全部模型列表", response = ModelReferenceDemo.class) |
|
||||||
public R getAllModelList(@RequestBody @Validated PageImportModelReq req, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
String roleName = userClient.getUserAllRole(accountId, PlatformConstant.NAKADAI);//获取当前用户的角色
|
|
||||||
if (req.getFounder() == ModellConstant.SOURCE_SYSTEM) { |
|
||||||
req.setIsAdmin(1); |
|
||||||
} else { |
|
||||||
if (roleName != null) { |
|
||||||
req.setIsAdmin(1); |
|
||||||
} else { |
|
||||||
req.setIsAdmin(0); |
|
||||||
if (req.getIsAdmin() == 0) { |
|
||||||
req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
return service.getAllModelList(req); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/teacherModelList") |
|
||||||
@ApiOperation(value = "教师端模型列表", response = ModelReferenceDemo.class) |
|
||||||
public R teacherModelList(@RequestBody @Validated PageImportModelReq req, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); |
|
||||||
return service.teacherModelList(req); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("systemModelByTeacher") |
|
||||||
@ApiOperation(value = "教师端——读取系统模型(该系统模型为中台的模型列表)", response = ModelReferenceDemo.class) |
|
||||||
public R systemModelByTeacher(@RequestBody @Validated PageImportModelReq req, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); |
|
||||||
return service.systemModelByTeacher(req); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/synchronizationMdel") |
|
||||||
@ApiOperation(value = "中台同步模型至引用模型(模型列表)") |
|
||||||
public R synchronizationMdel(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
return service.synchronizationMdel(systemId, Integer.valueOf(accountId)); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/synchronizationMdelByOccupationlab") |
|
||||||
@ApiOperation(value = "职站同步模型至引用模型(模型列表)") |
|
||||||
public R synchronizationMdelByOccupationlab(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
return service.synchronizationMdelByOccupationlab(systemId, schoolId, Integer.valueOf(accountId)); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
/*@PostMapping("/mergeModel") |
|
||||||
@ApiOperation(value = "合并模型") |
|
||||||
public R mergeModel(@RequestBody @Validated List<ModeCategoryResp> modeCategoryRespList, HttpServletRequest request) { |
|
||||||
|
|
||||||
if (modeCategoryRespList.size() <= 0) { |
|
||||||
//当前选择的分类下的没有满足条件的模型!
|
|
||||||
throw new CustomException(ExceptionEnum.CLASSIFICATION_HAS_NO_MODEL_DATA); |
|
||||||
} |
|
||||||
|
|
||||||
return R.ok(); |
|
||||||
} |
|
||||||
*/ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*@ApiOperation("根据分类id查询该分类下的所有子分类id") |
|
||||||
@PostMapping("/selectCategoryChildById") |
|
||||||
public String selectCategoryChildById(Integer id) { |
|
||||||
|
|
||||||
//1 创建list集合,用于封装所有删除菜单id值
|
|
||||||
List<Integer> idList = new ArrayList<>(); |
|
||||||
//2 向idList集合设置删除菜单id
|
|
||||||
this.selectCategoryChildById(id + "", idList);//找到当前菜单的子菜单 把结果id封装到idlist里面去
|
|
||||||
//把当前id封装到list里面
|
|
||||||
idList.add(id);//现在把当前id封装进去 之前都是子菜单的id
|
|
||||||
String str = ""; |
|
||||||
for (Integer idstr : idList) { |
|
||||||
str += idstr + ","; |
|
||||||
} |
|
||||||
return str.substring(0, str.length()-1); |
|
||||||
} |
|
||||||
|
|
||||||
//2 根据当前菜单id,查询菜单里面子菜单id,封装到list集合
|
|
||||||
public void selectCategoryChildById(String id, List<Integer> idList) { |
|
||||||
//查询菜单里面子菜单id
|
|
||||||
QueryWrapper<ModelSysCategory> wrapper = new QueryWrapper<ModelSysCategory>(); |
|
||||||
wrapper.eq("founder", 1); |
|
||||||
wrapper.eq("school_id", id); |
|
||||||
wrapper.eq("is_del", 0); |
|
||||||
|
|
||||||
wrapper.select("id");//我们只想查询id 所以只需要查询指定列的值
|
|
||||||
List<ModelSysCategory> childIdList = sysCategoryService.list(wrapper);//当前菜单的所有子菜单
|
|
||||||
//把childIdList里面菜单id值获取出来,封装idList里面,做递归查询
|
|
||||||
childIdList.stream().forEach(item -> {//遍历集合得到每一个对象item
|
|
||||||
//封装idList里面
|
|
||||||
idList.add(item.getId()); |
|
||||||
//递归查询
|
|
||||||
this.selectCategoryChildById(item.getId() + "", idList); |
|
||||||
}); |
|
||||||
}*/ |
|
||||||
|
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,153 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.api.UserClient; |
|
||||||
import com.huoran.common.constant.DelConstant; |
|
||||||
import com.huoran.common.constant.ModellConstant; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.Customer; |
|
||||||
import com.huoran.nakadai.entity.ModelReferenceCategory; |
|
||||||
import com.huoran.nakadai.entity.ModelSysCategory; |
|
||||||
import com.huoran.nakadai.entity.ModelSysDemo; |
|
||||||
import com.huoran.nakadai.entity.req.ModelSysDemoReq; |
|
||||||
import com.huoran.nakadai.service.ICustomerService; |
|
||||||
import com.huoran.nakadai.service.ModelSysCategoryService; |
|
||||||
import io.swagger.annotations.*; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.http.HttpStatus; |
|
||||||
import org.springframework.http.ResponseEntity; |
|
||||||
import org.springframework.validation.annotation.Validated; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* @描述:源模型-分类表控制类 |
|
||||||
* @作者: Rong |
|
||||||
* @日期: 2022-03-03 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/model/category") |
|
||||||
@Api(value = "API - 中台:ModelSysCategoryController", tags = "中台:源模型分类") |
|
||||||
public class ModelSysCategoryController { |
|
||||||
@Autowired |
|
||||||
private UserClient userClient; |
|
||||||
@Autowired |
|
||||||
public ModelSysCategoryService service; |
|
||||||
@Autowired |
|
||||||
public ICustomerService customerService; |
|
||||||
@PostMapping("/save") |
|
||||||
@ApiOperation(value = "新增源模型分类") |
|
||||||
public R save(@RequestBody @Validated ModelSysCategory modelSysCategory, HttpServletRequest request) { |
|
||||||
boolean checkRepeat = service.checkRepeat(modelSysCategory, 0); |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
modelSysCategory.setAccountId(Integer.valueOf(accountId)); |
|
||||||
modelSysCategory.setSchoolId(0); |
|
||||||
if (modelSysCategory.getFounder() == ModellConstant.SOURCE_INSTITUTION) { |
|
||||||
//创建来源为院校时候赋值学校id
|
|
||||||
modelSysCategory.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); |
|
||||||
} |
|
||||||
|
|
||||||
if (checkRepeat) { |
|
||||||
return R.error("该层级下已有重复的分类名称了!"); |
|
||||||
} |
|
||||||
boolean ret = service.save(modelSysCategory); |
|
||||||
return ret ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/sourceModelClassification") |
|
||||||
@ApiOperation(value = "源模型分类列表") |
|
||||||
public R sourceModelClassification(@RequestParam("founder") @ApiParam(value = "创建人来源(0、系统 1、院校)") Integer founder, HttpServletRequest request) { |
|
||||||
|
|
||||||
ModelSysDemoReq req = new ModelSysDemoReq(); |
|
||||||
req.setFounder(founder); |
|
||||||
if (founder == ModellConstant.SOURCE_INSTITUTION) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
//创建来源为院校时候赋值学校id
|
|
||||||
req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); |
|
||||||
} |
|
||||||
List<ModelSysCategory> sourceModelClassification = service.sourceModelClassification(req); |
|
||||||
return R.ok().put("data", sourceModelClassification); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/primaryClassification") |
|
||||||
@ApiOperation(value = "一级分类") |
|
||||||
public R primaryClassification() { |
|
||||||
List<ModelSysCategory> primaryClassification = service.primaryClassification(); |
|
||||||
return R.ok().put("data", primaryClassification); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/classificationByPid") |
|
||||||
@ApiOperation(value = "根据父id查询分类下的分类") |
|
||||||
public R classificationByPid(@RequestParam("parentId") @ApiParam(value = "分类父id") Integer parentId) { |
|
||||||
List<ModelSysCategory> primaryClassification = service.classificationByPid(parentId); |
|
||||||
return R.ok().put("data", primaryClassification); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/deleteSourceModelCategory") |
|
||||||
@ApiOperation(value = "删除源模型分类") |
|
||||||
public R deleteSourceModelCategory(@RequestParam("categoryId") @ApiParam(value = "分类id") Integer categoryId) { |
|
||||||
return service.deleteSourceModelCategory(categoryId); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/updateSourceModelCategory") |
|
||||||
@ApiOperation(value = "编辑源模型分类") |
|
||||||
public R update(@RequestBody ModelSysCategory modelSysCategory, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
modelSysCategory.setAccountId(Integer.valueOf(accountId)); |
|
||||||
boolean checkRepeat = service.checkRepeat(modelSysCategory, 1); |
|
||||||
|
|
||||||
if (checkRepeat) { |
|
||||||
return R.error("该层级下已有重复的分类名称了!"); |
|
||||||
} |
|
||||||
boolean ret = service.updateById(modelSysCategory); |
|
||||||
return ret ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/builtInModelClassification") |
|
||||||
@ApiOperation(value = "学校模型内置分类(用于新增订单后给学校内置数据)") |
|
||||||
public R builtInModelClassification(@RequestParam("schoolId") @ApiParam(value = "学校id") Integer schoolId) { |
|
||||||
ModelSysCategory modelSysCategory = new ModelSysCategory(); |
|
||||||
modelSysCategory.setCategoryName("全部"); |
|
||||||
modelSysCategory.setParentId(0); |
|
||||||
modelSysCategory.setLevel(0); |
|
||||||
modelSysCategory.setFounder(ModellConstant.SOURCE_INSTITUTION); |
|
||||||
modelSysCategory.setIsOpen(0); |
|
||||||
modelSysCategory.setSchoolId(schoolId); |
|
||||||
modelSysCategory.setAccountId(1); |
|
||||||
boolean ret = service.save(modelSysCategory); |
|
||||||
return ret ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/batchBuiltInModelClassification") |
|
||||||
@ApiOperation(value = "学校模型内置分类(用于新增订单后给学校内置数据)") |
|
||||||
public R batchBuiltInModelClassification() { |
|
||||||
|
|
||||||
QueryWrapper<Customer> queryWrapper = new QueryWrapper<>(); |
|
||||||
queryWrapper.eq("is_del",0); |
|
||||||
queryWrapper.last(" GROUP BY school_id"); |
|
||||||
List<Customer> list = customerService.list(queryWrapper); |
|
||||||
for (Customer customer: list ) { |
|
||||||
ModelSysCategory modelSysCategory = new ModelSysCategory(); |
|
||||||
modelSysCategory.setCategoryName("全部"); |
|
||||||
modelSysCategory.setParentId(0); |
|
||||||
modelSysCategory.setLevel(0); |
|
||||||
modelSysCategory.setFounder(ModellConstant.SOURCE_INSTITUTION); |
|
||||||
modelSysCategory.setIsOpen(0); |
|
||||||
modelSysCategory.setSchoolId(customer.getSchoolId()); |
|
||||||
modelSysCategory.setAccountId(1); |
|
||||||
boolean ret = service.save(modelSysCategory); |
|
||||||
} |
|
||||||
return R.ok() ; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,405 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||||
import com.huoran.api.UserClient; |
|
||||||
import com.huoran.common.aop.annotation.NoRepeatSubmit; |
|
||||||
import com.huoran.common.constant.ModellConstant; |
|
||||||
import com.huoran.common.constant.PlatformConstant; |
|
||||||
import com.huoran.common.entity.PythonCodeResp; |
|
||||||
import com.huoran.common.exception.CustomException; |
|
||||||
import com.huoran.common.exception.ExceptionEnum; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.DataProduct; |
|
||||||
import com.huoran.nakadai.entity.ModelReferenceDemo; |
|
||||||
import com.huoran.nakadai.entity.ModelSysDemo; |
|
||||||
import com.huoran.nakadai.entity.req.CopyTheModelToTheNakadaiReq; |
|
||||||
import com.huoran.nakadai.entity.req.DisableEnableModelReq; |
|
||||||
import com.huoran.nakadai.entity.req.PageModelReq; |
|
||||||
import com.huoran.nakadai.entity.req.PythonCodeRunReq; |
|
||||||
import com.huoran.nakadai.service.ModelSysDemoService; |
|
||||||
import io.swagger.annotations.*; |
|
||||||
import org.apache.commons.lang.StringUtils; |
|
||||||
import org.apache.ibatis.annotations.Param; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate; |
|
||||||
import org.springframework.validation.annotation.Validated; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import com.huoran.common.response.R; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import javax.validation.Valid; |
|
||||||
import java.io.IOException; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* @描述:源模型代码记录表控制类 |
|
||||||
* @作者: Rong |
|
||||||
* @日期: 2022-03-04 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/model/demo") |
|
||||||
@Api(value = "API - 中台:ModelSysDemoController", tags = "中台:源模型代码记录") |
|
||||||
public class ModelSysDemoController { |
|
||||||
@Autowired |
|
||||||
private UserClient userClient; |
|
||||||
@Autowired |
|
||||||
public ModelSysDemoService service; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private StringRedisTemplate redisTemplate; |
|
||||||
|
|
||||||
@PostMapping("/saveSysModelDemo") |
|
||||||
@ApiOperation(value = "新增源模型") |
|
||||||
public R save(@RequestBody @Validated ModelSysDemo modelSysDemo, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
modelSysDemo.setAccountId(Integer.valueOf(accountId)); |
|
||||||
modelSysDemo.setModifyAccountId(Integer.valueOf(accountId)); |
|
||||||
if (modelSysDemo.getFounder() == ModellConstant.SOURCE_INSTITUTION) { |
|
||||||
//创建来源为院校时候赋值学校id
|
|
||||||
modelSysDemo.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); |
|
||||||
} |
|
||||||
|
|
||||||
boolean ret = service.save(modelSysDemo); |
|
||||||
return ret ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/updateSysModelDemo") |
|
||||||
@ApiOperation(value = "修改") |
|
||||||
public R update(@RequestBody ModelSysDemo modelSysDemo, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
|
|
||||||
|
|
||||||
ModelSysDemo sysDemo = service.getById(modelSysDemo.getId()); |
|
||||||
//(0、系统 1、院校)
|
|
||||||
if (modelSysDemo.getIsAdmin() == null) { |
|
||||||
modelSysDemo.setModifyAccountId(Integer.valueOf(accountId)); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
boolean ret = service.updateById(modelSysDemo); |
|
||||||
return ret ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/deleteSysModelDemo") |
|
||||||
@ApiOperation(value = "批量删除") |
|
||||||
public R delete(@RequestBody List<Integer> ids) { |
|
||||||
boolean ret = service.removeByIds(ids); |
|
||||||
return ret ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
/* @PostMapping("/bulkDisable") |
|
||||||
@ApiOperation(value = "批量禁用启用") |
|
||||||
public R bulkDisable(@RequestParam(value = "isOpen") @ApiParam(value = "启用状态(0开启 1禁用 默认0)") Integer isOpen, @RequestBody List<Integer> ids, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer count = 0; |
|
||||||
for (Integer id : ids) { |
|
||||||
ModelSysDemo modelSysDemo = new ModelSysDemo(); |
|
||||||
modelSysDemo.setModifyAccountId(Integer.valueOf(accountId)); |
|
||||||
modelSysDemo.setIsOpen(isOpen); |
|
||||||
modelSysDemo.setId(id); |
|
||||||
boolean ret = service.updateById(modelSysDemo); |
|
||||||
if (ret) { |
|
||||||
count++; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
return count == ids.size() ? R.ok() : R.error(); |
|
||||||
}*/ |
|
||||||
|
|
||||||
@PostMapping("/findById") |
|
||||||
@ApiOperation(value = "根据主键查询", response = ModelSysDemo.class) |
|
||||||
public R findById(@RequestParam("id") @ApiParam(value = "序号") Integer id) { |
|
||||||
ModelSysDemo modelSysDemo = service.getById(id); |
|
||||||
return R.ok().put("data", modelSysDemo); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/sysModelDemoList") |
|
||||||
@ApiOperation(value = "源模型列表(依据分类id查的模型列表)", response = ModelSysDemo.class) |
|
||||||
public R listByEntity(@RequestBody @Validated PageModelReq req, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
String roleName = userClient.getUserAllRole(accountId, PlatformConstant.NAKADAI);//获取当前用户的角色
|
|
||||||
if (roleName != null) { |
|
||||||
req.setIsAdmin(1); |
|
||||||
} else { |
|
||||||
req.setIsAdmin(0); |
|
||||||
req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); |
|
||||||
} |
|
||||||
return service.sysModelDemoList(req); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/runPythonCode") |
|
||||||
@ApiOperation(value = "运行python代码", response = PythonCodeResp.class) |
|
||||||
public R runPythonCode(@RequestBody @Validated PythonCodeRunReq req) throws IOException { |
|
||||||
return service.runCode(req.getCode()); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/getAllModelListBySys") |
|
||||||
@ApiOperation(value = "源模型-查询全部模型列表", response = ModelSysDemo.class) |
|
||||||
public R getAllModelListBySys(@RequestBody PageModelReq req, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
if (req.getFounder() == ModellConstant.SOURCE_INSTITUTION) { |
|
||||||
//创建来源为院校时候赋值学校id
|
|
||||||
req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); |
|
||||||
} |
|
||||||
return service.getAllModelListBySys(req); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* 中台端读取院校模型 未删除、未禁用的模型。 |
|
||||||
* |
|
||||||
* @param req |
|
||||||
* @param request |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
@PostMapping("/InstitutionSourceModel") |
|
||||||
@ApiOperation(value = "中台端——院校源模型/教师端——源模型", response = ModelSysDemo.class) |
|
||||||
public R InstitutionSourceModel(@RequestBody PageModelReq req, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
String roleName = userClient.getUserAllRole(accountId, PlatformConstant.NAKADAI);//获取当前用户的角色
|
|
||||||
if (roleName != null) { |
|
||||||
req.setIsAdmin(1); |
|
||||||
} else { |
|
||||||
req.setIsAdmin(0); |
|
||||||
req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); |
|
||||||
} |
|
||||||
return service.InstitutionSourceModel(req); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@NoRepeatSubmit |
|
||||||
@ApiOperation(value = "模型禁启用", response = ModelSysDemo.class) |
|
||||||
@PostMapping("/disabledEvents") |
|
||||||
public R disabledEvents(@RequestBody List<DisableEnableModelReq> list, HttpServletRequest request) { |
|
||||||
boolean ret = false; |
|
||||||
for (DisableEnableModelReq req : list) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
//modelSysDemo:查看当前模型禁启用状态
|
|
||||||
ModelSysDemo modelSysDemo = service.getById(req.getModelId()); |
|
||||||
ModelSysDemo sysDemo = new ModelSysDemo(); |
|
||||||
sysDemo.setId(req.getModelId()); |
|
||||||
//禁用平台来源(0中台,1职站教师端 2.职站学生端)
|
|
||||||
switch (req.getType()) { |
|
||||||
case 0: |
|
||||||
sysDemo.setZtOpen(req.getIsOpen()); |
|
||||||
// sysDemo.setIsOpen(req.getIsOpen());
|
|
||||||
break; |
|
||||||
case 1: |
|
||||||
// 客户创建的模型,禁用时职站首页以及学生登录后的模型模块看不到对应的模型,创建的老师在模型管理还是可以看到该模型,可以编辑,但是无法启用。
|
|
||||||
// 即中台禁用的模型,即使是该院校老师创建的,老师端也不能自己启用,需要中台启用。
|
|
||||||
//1.判断当前院校禁启用状态为要启用时候再判断当前赛事中台禁启用的状态
|
|
||||||
if (req.getIsOpen() == 0) { |
|
||||||
if (modelSysDemo.getZtOpen() == 1) { |
|
||||||
return R.error("当前模型已被平台禁用,请联系平台管理员!"); |
|
||||||
} |
|
||||||
} |
|
||||||
sysDemo.setIsOpen(req.getIsOpen()); |
|
||||||
break; |
|
||||||
|
|
||||||
} |
|
||||||
ret = service.updateById(sysDemo); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
//保存的key名
|
|
||||||
String key = "modelDisabled"; |
|
||||||
//以时间戳方式保存到缓存中
|
|
||||||
redisTemplate.opsForValue().set(key, System.currentTimeMillis() + ""); |
|
||||||
return R.ok(); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* 禁用/启用的时候,把时间戳写入那个key,前端第一次调用的时候,把时间戳写入本地缓存 |
|
||||||
* 然后前端通过定时器获取这个redis缓存的接口 |
|
||||||
* 只要获取到的值跟本地缓存的不一致就刷新列表 |
|
||||||
* |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
@PostMapping("/getRedisCache") |
|
||||||
@ApiOperation(value = "获取Redis缓存(返回的时间戳只要获取到的值跟本地缓存的不一致就刷新列表)") |
|
||||||
public R getRedisCache() { |
|
||||||
//保存的key名
|
|
||||||
String key = "modelDisabled"; |
|
||||||
//查看缓存是否有数据
|
|
||||||
String returnValue = redisTemplate.opsForValue().get(key); |
|
||||||
|
|
||||||
//使用缓存返回数据
|
|
||||||
if (returnValue != null) { |
|
||||||
return R.ok().put("data", returnValue); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
return R.ok(); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/copyTheModelToTheNakadai") |
|
||||||
@ApiOperation(value = "中台端复制院校模型", response = ModelSysDemo.class) |
|
||||||
public R copyTheModelToTheNakadai(@RequestBody CopyTheModelToTheNakadaiReq req, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
req.setAccountId(Integer.valueOf(accountId)); |
|
||||||
return service.copyTheModelToTheNakadai(req); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/controlPasteCode") |
|
||||||
@ApiOperation(value = "控制是否学生端可以粘贴代码") |
|
||||||
public R controlPasteCode(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, |
|
||||||
@RequestParam("isShow") @ApiParam(value = "是否展示->默认true为展示 false为不展示") String isShow, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
//保存的key名
|
|
||||||
String key = "controlPasteCode:systemId:" + systemId + "schoolId:" + schoolId; |
|
||||||
redisTemplate.opsForValue().set(key, isShow); |
|
||||||
return R.ok(); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/whetherCanPaste") |
|
||||||
@ApiOperation(value = "查询是否能粘贴") |
|
||||||
public R whetherCanPaste(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
//保存的key名
|
|
||||||
String key = "controlPasteCode:systemId:" + systemId + "schoolId:" + schoolId; |
|
||||||
//查看缓存是否有数据
|
|
||||||
String returnValue = redisTemplate.opsForValue().get(key); |
|
||||||
|
|
||||||
//使用缓存返回数据
|
|
||||||
if (returnValue != null) { |
|
||||||
return R.ok().put("data", returnValue); |
|
||||||
} |
|
||||||
redisTemplate.opsForValue().set(key, "true"); |
|
||||||
return R.ok().put("data", "true"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/builtInModelButtonDisplayByNakadai") |
|
||||||
@ApiOperation(value = "中台控制教师端内置模型按钮展示(用于中台禁用按钮后控制教师端的模型按钮)") |
|
||||||
public R builtInModelButtonDisplayByNakadai(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, |
|
||||||
@RequestParam("isShow") @ApiParam(value = "是否展示->默认true为展示 false为不展示") String isShow) { |
|
||||||
//保存的key名
|
|
||||||
String key = "builtInModelButtonDisplay:systemId:" + systemId; |
|
||||||
redisTemplate.opsForValue().set(key, isShow); |
|
||||||
|
|
||||||
//查看缓存是否有数据
|
|
||||||
String returnValue = redisTemplate.opsForValue().get(key); |
|
||||||
//没有则内置数据
|
|
||||||
if (returnValue == null) { |
|
||||||
redisTemplate.opsForValue().set(key, "true"); |
|
||||||
} |
|
||||||
|
|
||||||
return R.ok(); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/builtInModelState") |
|
||||||
@ApiOperation(value = "中台显示内置模型状态") |
|
||||||
public R builtInModelState(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId) { |
|
||||||
//保存的key名
|
|
||||||
String key = "builtInModelButtonDisplay:systemId:" + systemId; |
|
||||||
//查看缓存是否有数据
|
|
||||||
String returnValue = redisTemplate.opsForValue().get(key); |
|
||||||
//没有则内置数据
|
|
||||||
if (returnValue == null) { |
|
||||||
redisTemplate.opsForValue().set(key, "true"); |
|
||||||
} |
|
||||||
|
|
||||||
return R.ok(returnValue); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/builtInModelStateByTeacher") |
|
||||||
@ApiOperation(value = "职站教师端显示内置模型状态(基于中台禁用、启用后教师端的模型列表以及源模型列表展示依据该接口展示)") |
|
||||||
public R builtInModelStateByTeacher(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, HttpServletRequest request) { |
|
||||||
//保存的key名
|
|
||||||
String key = "builtInModelButtonDisplay:systemId:" + systemId; |
|
||||||
//查看缓存是否有数据
|
|
||||||
String returnValue = redisTemplate.opsForValue().get(key); |
|
||||||
//没有则内置数据
|
|
||||||
if (returnValue == null) { |
|
||||||
redisTemplate.opsForValue().set(key, "true"); |
|
||||||
} |
|
||||||
|
|
||||||
return R.ok(returnValue); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/displayListOrNotByTeacher") |
|
||||||
@ApiOperation(value = "职站教师端是否展示模型列表以及源模型管理(true表示展示 false不展示)") |
|
||||||
public R displayListOrNotByTeacher(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
//保存的key名
|
|
||||||
String key = "builtInModelButtonDisplayByTeacher:systemId:" + systemId + "schoolId:" + schoolId; |
|
||||||
//查看缓存是否有数据
|
|
||||||
String returnValue = redisTemplate.opsForValue().get(key); |
|
||||||
if (returnValue == null) { |
|
||||||
//没有则内置数据
|
|
||||||
redisTemplate.opsForValue().set(key, "true"); |
|
||||||
return R.ok().put("teacherButtonStatus", "true"); |
|
||||||
} |
|
||||||
//使用缓存返回数据
|
|
||||||
return R.ok().put("teacherButtonStatus", returnValue); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/builtInModelButtonDisplayByTeacher") |
|
||||||
@ApiOperation(value = "教师端控制学生端内置模型按钮展示") |
|
||||||
public R builtInModelButtonDisplayByTeacher(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, |
|
||||||
@RequestParam("isShow") @ApiParam(value = "是否展示->默认true为展示 false为不展示") String isShow, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
//保存的key名
|
|
||||||
String key = "builtInModelButtonDisplayByTeacher:systemId:" + systemId + "schoolId:" + schoolId; |
|
||||||
redisTemplate.opsForValue().set(key, isShow); |
|
||||||
//查看缓存是否有数据
|
|
||||||
String returnValue = redisTemplate.opsForValue().get(key); |
|
||||||
//没有则内置数据
|
|
||||||
if (returnValue == null) { |
|
||||||
redisTemplate.opsForValue().set(key, "true"); |
|
||||||
} |
|
||||||
return R.ok(returnValue); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/displayListOrNotByStudent") |
|
||||||
@ApiOperation(value = "学生端是否展示模型列表以及源模型管理(true表示展示 false不展示)") |
|
||||||
public R displayListOrNotByStudent(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
|
|
||||||
|
|
||||||
//中台控制的key
|
|
||||||
String middleConsoleControlKey = "builtInModelButtonDisplay:systemId:" + systemId; |
|
||||||
//查看中台缓存是否有数据
|
|
||||||
String returnValueByNakadai = redisTemplate.opsForValue().get(middleConsoleControlKey); |
|
||||||
//没有则内置数据
|
|
||||||
if (returnValueByNakadai == null) { |
|
||||||
redisTemplate.opsForValue().set(middleConsoleControlKey, "true"); |
|
||||||
returnValueByNakadai = redisTemplate.opsForValue().get(middleConsoleControlKey); |
|
||||||
} |
|
||||||
|
|
||||||
String key = "builtInModelButtonDisplayByTeacher:systemId:" + systemId + "schoolId:" + schoolId; |
|
||||||
String returnValue = redisTemplate.opsForValue().get(key); |
|
||||||
//没有则内置数据
|
|
||||||
if (returnValue == null) { |
|
||||||
redisTemplate.opsForValue().set(key, "true"); |
|
||||||
returnValue = redisTemplate.opsForValue().get(key); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
//中台和职站一并开启才能启用
|
|
||||||
if (returnValueByNakadai.equals("true") && returnValue.equals("true")) { |
|
||||||
return R.ok().put("studentSideShowsTheStatus", "true"); |
|
||||||
} |
|
||||||
return R.ok().put("studentSideShowsTheStatus", "false"); |
|
||||||
|
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,114 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.nakadai.controller; |
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.huoran.common.response.ServerResponseEntity; |
||||||
|
import com.huoran.nakadai.entity.model.Notice; |
||||||
|
import com.huoran.nakadai.service.NoticeService; |
||||||
|
import com.huoran.nakadai.utils.PageParam; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.validation.Valid; |
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* 公告管理 |
||||||
|
* |
||||||
|
* @author hzm |
||||||
|
* @date |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@AllArgsConstructor |
||||||
|
@RequestMapping("/shop/notice") |
||||||
|
public class NoticeController { |
||||||
|
|
||||||
|
private final NoticeService noticeService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询 |
||||||
|
* |
||||||
|
* @param page 分页对象 |
||||||
|
* @param notice 公告管理 |
||||||
|
* @return 分页数据 |
||||||
|
*/ |
||||||
|
@GetMapping("/page") |
||||||
|
public ServerResponseEntity<IPage<Notice>> getNoticePage(PageParam<Notice> page, Notice notice) { |
||||||
|
IPage<Notice> noticePage = noticeService.page(page, new LambdaQueryWrapper<Notice>() |
||||||
|
.eq(notice.getStatus() != null, Notice::getStatus, notice.getStatus()) |
||||||
|
.eq(notice.getIsTop()!=null,Notice::getIsTop,notice.getIsTop()) |
||||||
|
.like(notice.getTitle() != null, Notice::getTitle, notice.getTitle()).orderByDesc(Notice::getUpdateTime)); |
||||||
|
return ServerResponseEntity.success(noticePage); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id查询公告管理 |
||||||
|
* |
||||||
|
* @param id id |
||||||
|
* @return 单个数据 |
||||||
|
*/ |
||||||
|
@GetMapping("/info/{id}") |
||||||
|
public ServerResponseEntity<Notice> getById(@PathVariable("id") Long id) { |
||||||
|
return ServerResponseEntity.success(noticeService.getById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增公告管理 |
||||||
|
* |
||||||
|
* @param notice 公告管理 |
||||||
|
* @return 是否新增成功 |
||||||
|
*/ |
||||||
|
@PostMapping |
||||||
|
public ServerResponseEntity<Boolean> save(@RequestBody @Valid Notice notice) { |
||||||
|
if (notice.getStatus() == 1) { |
||||||
|
notice.setPublishTime(new Date()); |
||||||
|
} |
||||||
|
notice.setUpdateTime(new Date()); |
||||||
|
noticeService.removeNoticeList(); |
||||||
|
return ServerResponseEntity.success(noticeService.save(notice)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改公告管理 |
||||||
|
* |
||||||
|
* @param notice 公告管理 |
||||||
|
* @return 是否修改成功 |
||||||
|
*/ |
||||||
|
@PutMapping |
||||||
|
public ServerResponseEntity<Boolean> updateById(@RequestBody @Valid Notice notice) { |
||||||
|
Notice oldNotice = noticeService.getById(notice.getId()); |
||||||
|
if (oldNotice.getStatus() == 0 && notice.getStatus() == 1) { |
||||||
|
notice.setPublishTime(new Date()); |
||||||
|
} |
||||||
|
notice.setUpdateTime(new Date()); |
||||||
|
noticeService.removeNoticeList(); |
||||||
|
noticeService.removeNoticeById(notice.getId()); |
||||||
|
return ServerResponseEntity.success(noticeService.updateById(notice)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id删除公告管理 |
||||||
|
* |
||||||
|
* @param id id |
||||||
|
* @return 是否删除成功 |
||||||
|
*/ |
||||||
|
@DeleteMapping("/{id}") |
||||||
|
public ServerResponseEntity<Boolean> removeById(@PathVariable Long id) { |
||||||
|
noticeService.removeNoticeList(); |
||||||
|
noticeService.removeNoticeById(id); |
||||||
|
return ServerResponseEntity.success(noticeService.removeById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -1,100 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.huoran.common.entity.FilesResult; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.service.OSSFileService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
import org.springframework.web.multipart.MultipartFile; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import java.io.IOException; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* @Author chen |
|
||||||
* @DATE 2021/7/13 10:09 |
|
||||||
* @Version 1.0 |
|
||||||
*/ |
|
||||||
@Api(tags = "阿里云文件/视频管理") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/oss") |
|
||||||
public class OSSFileController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private OSSFileService ossFileService; |
|
||||||
|
|
||||||
@ApiOperation(value = "文件上传") |
|
||||||
@PostMapping("/fileUpload") |
|
||||||
public R fileUpload( |
|
||||||
@ApiParam(name = "file", value = "文件", required = true) |
|
||||||
@RequestParam("file") MultipartFile file, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
if (file == null) { |
|
||||||
return R.error("请选择文件"); |
|
||||||
} |
|
||||||
try { |
|
||||||
//获取上传路径
|
|
||||||
FilesResult filesResult = ossFileService.upload(file); |
|
||||||
return R.ok().put("filesResult", filesResult); |
|
||||||
} catch (IOException e) { |
|
||||||
e.printStackTrace(); |
|
||||||
return R.error(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 批量删除文件 |
|
||||||
* |
|
||||||
* @param keys 多个文件完整名称集合 |
|
||||||
*/ |
|
||||||
@ApiOperation(value = "删除OSS文件") |
|
||||||
@DeleteMapping("/fileDeletion") |
|
||||||
public R fileDeletion( |
|
||||||
@ApiParam(name = "keys", value = "文件完整名称集合", required = true) |
|
||||||
@RequestParam("keys") List<String> keys, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
if (keys != null && keys.size() != 0) { |
|
||||||
List<String> deletedObjects = ossFileService.fileDeletion(keys); |
|
||||||
return R.ok().put("deletedObjects", deletedObjects); |
|
||||||
} else { |
|
||||||
return R.error(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "获取播放凭证") |
|
||||||
@GetMapping("getPlayAuth/{videoId}") |
|
||||||
public R getVideoPlayAuth( |
|
||||||
@ApiParam(name = "videoId", value = "视频Id", required = true) |
|
||||||
@PathVariable("videoId") String videoId) { |
|
||||||
|
|
||||||
try { |
|
||||||
String playAuth = ossFileService.getPlayAuth(videoId); |
|
||||||
return R.ok().put("playAuth", playAuth); |
|
||||||
} catch (com.aliyuncs.exceptions.ClientException e) { |
|
||||||
e.printStackTrace(); |
|
||||||
return R.error(e.getMessage()); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "删除视频文件") |
|
||||||
@DeleteMapping("/removeVideo/{videoId}") |
|
||||||
public R removeVideo( |
|
||||||
@ApiParam(name = "videoId", value = "视频Id", required = true) |
|
||||||
@PathVariable String videoId){ |
|
||||||
try { |
|
||||||
ossFileService.removeVideo(videoId); |
|
||||||
return R.ok("删除视频成功"); |
|
||||||
} catch (com.aliyuncs.exceptions.ClientException e) { |
|
||||||
e.printStackTrace(); |
|
||||||
return R.error(e.getMessage()); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,140 +1,286 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
package com.huoran.nakadai.controller; |
package com.huoran.nakadai.controller; |
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
import cn.hutool.core.date.DatePattern; |
||||||
|
import cn.hutool.core.date.DateUtil; |
||||||
|
import cn.hutool.core.io.IORuntimeException; |
||||||
|
import cn.hutool.core.io.IoUtil; |
||||||
|
import cn.hutool.poi.excel.ExcelUtil; |
||||||
|
import cn.hutool.poi.excel.ExcelWriter; |
||||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
import com.huoran.common.response.R; |
import com.google.common.base.Objects; |
||||||
import com.huoran.nakadai.entity.Mall; |
import com.huoran.common.exception.YamiShopBindException; |
||||||
import com.huoran.nakadai.entity.Order; |
import com.huoran.common.response.ServerResponseEntity; |
||||||
import com.huoran.nakadai.entity.OrderOther; |
import com.huoran.common.utils.TokenUtils; |
||||||
import com.huoran.nakadai.entity.PartnerTeam; |
import com.huoran.nakadai.entity.enums.OrderStatus; |
||||||
import com.huoran.nakadai.entity.req.DeleteIds; |
import com.huoran.nakadai.entity.model.Order; |
||||||
import com.huoran.nakadai.entity.req.OrderListReq; |
import com.huoran.nakadai.entity.model.OrderItem; |
||||||
import com.huoran.nakadai.entity.res.ExportSubscribedRecordsResp; |
import com.huoran.nakadai.entity.model.UserAddrOrder; |
||||||
import com.huoran.nakadai.entity.vo.OrderVo; |
|
||||||
import com.huoran.nakadai.service.IOrderService; |
import com.huoran.nakadai.entity.param.DeliveryOrderParam; |
||||||
import com.huoran.nakadai.service.MallService; |
import com.huoran.nakadai.entity.param.OrderParam; |
||||||
import com.huoran.nakadai.service.OrderOtherService; |
import com.huoran.nakadai.service.OrderItemService; |
||||||
import com.huoran.nakadai.service.PartnerTeamService; |
import com.huoran.nakadai.service.OrderService; |
||||||
import io.swagger.annotations.Api; |
import com.huoran.nakadai.service.ProductService; |
||||||
import io.swagger.annotations.ApiOperation; |
import com.huoran.nakadai.service.SkuService; |
||||||
import io.swagger.annotations.ApiParam; |
import com.huoran.nakadai.utils.PageParam; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.apache.poi.ss.usermodel.Sheet; |
||||||
import org.springframework.beans.factory.annotation.Autowired; |
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||||
import org.springframework.web.bind.annotation.*; |
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.servlet.ServletOutputStream; |
||||||
import javax.servlet.http.HttpServletRequest; |
import javax.servlet.http.HttpServletRequest; |
||||||
import javax.servlet.http.HttpServletResponse; |
import javax.servlet.http.HttpServletResponse; |
||||||
import javax.validation.Valid; |
import java.io.IOException; |
||||||
import javax.validation.constraints.NotNull; |
import java.util.Arrays; |
||||||
import java.math.BigDecimal; |
import java.util.Date; |
||||||
import java.util.HashMap; |
|
||||||
import java.util.List; |
import java.util.List; |
||||||
import java.util.concurrent.ExecutionException; |
|
||||||
|
|
||||||
/** |
/** |
||||||
* <p> |
* @author lgh on 2018/09/15. |
||||||
* 订单表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author huoran |
|
||||||
* @since 2021-06-28 |
|
||||||
*/ |
*/ |
||||||
@Api(tags = "订单管理") |
@Slf4j |
||||||
@RestController |
@RestController |
||||||
@RequestMapping("/nakadai/order") |
@RequestMapping("/order/order") |
||||||
public class OrderController { |
public class OrderController { |
||||||
|
|
||||||
@Autowired |
@Autowired |
||||||
private IOrderService orderService; |
private OrderService orderService; |
||||||
|
|
||||||
@Autowired |
@Autowired |
||||||
private OrderOtherService orderOtherService; |
private OrderItemService orderItemService; |
||||||
|
|
||||||
|
// @Autowired
|
||||||
|
// private UserAddrOrderService userAddrOrderService;
|
||||||
|
|
||||||
@Autowired |
@Autowired |
||||||
private MallService mallService; |
private ProductService productService; |
||||||
|
|
||||||
@Autowired |
@Autowired |
||||||
private PartnerTeamService partnerTeamService; |
private SkuService skuService; |
||||||
|
|
||||||
@ApiOperation(value = "添加订单") |
/** |
||||||
@PostMapping("/add") |
* 分页获取 |
||||||
public R add( |
*/ |
||||||
@ApiParam(name = "orderVo", value = "订单数据", required = true) |
@GetMapping("/page") |
||||||
@RequestBody @Valid OrderVo orderVo) throws ExecutionException, InterruptedException { |
public ServerResponseEntity<IPage<Order>> page(OrderParam orderParam, PageParam<Order> page, HttpServletRequest request) { |
||||||
return orderService.addOrder(orderVo); |
Long shopId = TokenUtils.getShopIdByJwtToken(request); |
||||||
} |
orderParam.setShopId(shopId); |
||||||
|
IPage<Order> orderPage = orderService.pageOrdersDetailByOrderParam(page, orderParam); |
||||||
|
return ServerResponseEntity.success(orderPage); |
||||||
|
|
||||||
@ApiOperation(value = "订单列表", response = IPage.class) |
|
||||||
@PostMapping("/list") |
|
||||||
public R list(@ApiParam(name = "orderListReq", value = "查询条件", required = true) @RequestBody OrderListReq orderListReq) { |
|
||||||
HashMap<String, Object> orderPage = orderService.orderList(orderListReq); |
|
||||||
return R.ok().put("orderPage", orderPage); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "订单详情", response = OrderVo.class) |
|
||||||
@GetMapping("/get") |
|
||||||
public R get(@ApiParam(name = "orderId", value = "订单id", required = true) @RequestParam @Valid @NotNull Integer orderId) { |
|
||||||
OrderVo orderDetails = orderService.queryOrderDetails(orderId); |
|
||||||
PartnerTeam rateInformation = null; |
|
||||||
if (orderDetails.getOrder().getBusinessManagerId() != null && orderDetails.getOrder().getTeamId() != null) { |
|
||||||
//查询费率
|
|
||||||
QueryWrapper<PartnerTeam> queryWrapper = new QueryWrapper<>(); |
|
||||||
queryWrapper.eq("classification_id", orderDetails.getOrder().getTeamId()); |
|
||||||
rateInformation = partnerTeamService.getOne(queryWrapper); |
|
||||||
} |
} |
||||||
|
|
||||||
BigDecimal annualMarketingFee = null; |
/** |
||||||
if (rateInformation!=null && rateInformation.getAnnualMarketingFee() != null) { |
* 获取信息 |
||||||
annualMarketingFee = rateInformation.getAnnualMarketingFee().divide(new BigDecimal(100)); |
*/ |
||||||
|
@GetMapping("/orderInfo/{orderNumber}") |
||||||
|
public ServerResponseEntity<Order> info(@PathVariable("orderNumber") String orderNumber,HttpServletRequest request) { |
||||||
|
Long shopId = TokenUtils.getShopIdByJwtToken(request); |
||||||
|
Order order = orderService.getOrderByOrderNumber(orderNumber); |
||||||
|
if (!Objects.equal(shopId, order.getShopId())) { |
||||||
|
throw new YamiShopBindException("您没有权限获取该订单信息"); |
||||||
} |
} |
||||||
|
List<OrderItem> orderItems = orderItemService.getOrderItemsByOrderNumber(orderNumber); |
||||||
return R.ok().put("orderDetails", orderDetails).put("annualMarketingFee",annualMarketingFee ); |
order.setOrderItems(orderItems); |
||||||
|
// UserAddrOrder userAddrOrder = userAddrOrderService.getById(order.getAddrOrderId());
|
||||||
|
// order.setUserAddrOrder(userAddrOrder);
|
||||||
|
return ServerResponseEntity.success(order); |
||||||
} |
} |
||||||
|
|
||||||
@ApiOperation(value = "批量删除订单") |
/** |
||||||
@PostMapping("/delete") |
* 发货 |
||||||
public R delete(@ApiParam(name = "orderIds", value = "订单ids", required = true) @RequestBody DeleteIds orderIds) { |
*/ |
||||||
boolean delete = orderService.deleteOrders(orderIds.getIds()); |
@PutMapping("/delivery") |
||||||
return delete ? R.ok() : R.error(); |
public ServerResponseEntity<Void> delivery(@RequestBody DeliveryOrderParam deliveryOrderParam,HttpServletRequest request) { |
||||||
|
Long shopId = TokenUtils.getShopIdByJwtToken(request); |
||||||
|
Order order = orderService.getOrderByOrderNumber(deliveryOrderParam.getOrderNumber()); |
||||||
|
if (!Objects.equal(shopId, order.getShopId())) { |
||||||
|
throw new YamiShopBindException("您没有权限修改该订单信息"); |
||||||
} |
} |
||||||
|
|
||||||
@ApiOperation(value = "更新订单") |
Order orderParam = new Order(); |
||||||
@PostMapping("/update") |
orderParam.setOrderId(order.getOrderId()); |
||||||
public R update(@ApiParam(name = "orderVo", value = "订单数据", required = true) @RequestBody @Valid OrderVo orderVo) { |
orderParam.setDvyId(deliveryOrderParam.getDvyId()); |
||||||
boolean update = orderService.updateOrder(orderVo); |
orderParam.setDvyFlowId(deliveryOrderParam.getDvyFlowId()); |
||||||
return update ? R.ok() : R.error(); |
orderParam.setDvyTime(new Date()); |
||||||
|
orderParam.setStatus(OrderStatus.CONSIGNMENT.value()); |
||||||
|
orderParam.setUserId(order.getUserId()); |
||||||
|
|
||||||
|
orderService.delivery(orderParam); |
||||||
|
|
||||||
|
List<OrderItem> orderItems = orderItemService.getOrderItemsByOrderNumber(deliveryOrderParam.getOrderNumber()); |
||||||
|
for (OrderItem orderItem : orderItems) { |
||||||
|
productService.removeProductCacheByProdId(orderItem.getProdId()); |
||||||
|
skuService.removeSkuCacheBySkuId(orderItem.getSkuId(),orderItem.getProdId()); |
||||||
|
} |
||||||
|
return ServerResponseEntity.success(); |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 查询客户订单 |
* 打印待发货的订单表 |
||||||
* |
* |
||||||
* @param customerId 客户id |
* @param order |
||||||
|
* @param consignmentName 发件人姓名 |
||||||
|
* @param consignmentMobile 发货人手机号 |
||||||
|
* @param consignmentAddr 发货地址 |
||||||
*/ |
*/ |
||||||
@GetMapping("/getCustomerOrder") |
@GetMapping("/waitingConsignmentExcel") |
||||||
public R getCustomerOrder(Integer customerId) { |
public void waitingConsignmentExcel(Order order, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime, |
||||||
List<Order> orderList = orderService.list(new QueryWrapper<Order>().eq("customer_id", customerId)); |
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime, String consignmentName, String consignmentMobile, |
||||||
return R.ok().put("orderList", orderList); |
String consignmentAddr, HttpServletResponse response,HttpServletRequest request) { |
||||||
|
Long shopId = TokenUtils.getShopIdByJwtToken(request); |
||||||
|
order.setShopId(shopId); |
||||||
|
order.setStatus(OrderStatus.PADYED.value()); |
||||||
|
List<Order> orders = orderService.listOrdersDetailByOrder(order, startTime, endTime); |
||||||
|
|
||||||
|
//通过工具类创建writer
|
||||||
|
ExcelWriter writer = ExcelUtil.getBigWriter(); |
||||||
|
Sheet sheet = writer.getSheet(); |
||||||
|
sheet.setColumnWidth(0, 20 * 256); |
||||||
|
sheet.setColumnWidth(1, 20 * 256); |
||||||
|
sheet.setColumnWidth(2, 20 * 256); |
||||||
|
sheet.setColumnWidth(3, 60 * 256); |
||||||
|
sheet.setColumnWidth(4, 60 * 256); |
||||||
|
sheet.setColumnWidth(7, 60 * 256); |
||||||
|
sheet.setColumnWidth(8, 60 * 256); |
||||||
|
sheet.setColumnWidth(9, 60 * 256); |
||||||
|
// 待发货
|
||||||
|
String[] hearder = {"订单编号", "收件人", "手机", "收货地址", "商品名称", "数量", "发件人姓名", "发件人手机号", "发货地址", "备注"}; |
||||||
|
writer.merge(hearder.length - 1, "发货信息整理"); |
||||||
|
writer.writeRow(Arrays.asList(hearder)); |
||||||
|
|
||||||
|
int row = 1; |
||||||
|
for (Order dbOrder : orders) { |
||||||
|
UserAddrOrder addr = dbOrder.getUserAddrOrder(); |
||||||
|
String addrInfo = addr.getProvince() + addr.getCity() + addr.getArea() + addr.getAddr(); |
||||||
|
List<OrderItem> orderItems = dbOrder.getOrderItems(); |
||||||
|
row++; |
||||||
|
for (OrderItem orderItem : orderItems) { |
||||||
|
// 第0列开始
|
||||||
|
int col = 0; |
||||||
|
writer.writeCellValue(col++, row, dbOrder.getOrderNumber()); |
||||||
|
writer.writeCellValue(col++, row, addr.getReceiver()); |
||||||
|
writer.writeCellValue(col++, row, addr.getMobile()); |
||||||
|
writer.writeCellValue(col++, row, addrInfo); |
||||||
|
writer.writeCellValue(col++, row, orderItem.getProdName()); |
||||||
|
writer.writeCellValue(col++, row, orderItem.getProdCount()); |
||||||
|
writer.writeCellValue(col++, row, consignmentName); |
||||||
|
writer.writeCellValue(col++, row, consignmentMobile); |
||||||
|
writer.writeCellValue(col++, row, consignmentAddr); |
||||||
|
writer.writeCellValue(col++, row, dbOrder.getRemarks()); |
||||||
|
} |
||||||
|
} |
||||||
|
writeExcel(response, writer); |
||||||
} |
} |
||||||
|
|
||||||
@ApiOperation(value = "中台-导出Excel已订阅记录") |
/** |
||||||
@PostMapping(value = "/exportSubscribedRecords", produces = "application/json;multipart/form-data;charset=utf-8") |
* 已销售订单 |
||||||
public void exportSubscribedRecords(@RequestBody List<ExportSubscribedRecordsResp> listOfExportSub, HttpServletResponse response, HttpServletRequest request) throws Exception { |
* |
||||||
orderService.exportSubscribedRecords(listOfExportSub, response); |
* @param order |
||||||
|
*/ |
||||||
|
@GetMapping("/soldExcel") |
||||||
|
public void soldExcel(Order order, @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime, |
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime, HttpServletResponse response,HttpServletRequest request) { |
||||||
|
Long shopId = TokenUtils.getShopIdByJwtToken(request); |
||||||
|
order.setShopId(shopId); |
||||||
|
order.setIsPayed(1); |
||||||
|
List<Order> orders = orderService.listOrdersDetailByOrder(order, startTime, endTime); |
||||||
|
|
||||||
|
//通过工具类创建writer
|
||||||
|
ExcelWriter writer = ExcelUtil.getBigWriter(); |
||||||
|
// 待发货
|
||||||
|
String[] hearder = {"订单编号", "下单时间", "收件人", "手机", "收货地址", "商品名称", "数量", "订单应付", "订单运费", "订单实付"}; |
||||||
|
Sheet sheet = writer.getSheet(); |
||||||
|
sheet.setColumnWidth(0, 20 * 256); |
||||||
|
sheet.setColumnWidth(1, 20 * 256); |
||||||
|
sheet.setColumnWidth(3, 20 * 256); |
||||||
|
sheet.setColumnWidth(4, 60 * 256); |
||||||
|
sheet.setColumnWidth(5, 60 * 256); |
||||||
|
|
||||||
|
writer.merge(hearder.length - 1, "销售信息整理"); |
||||||
|
writer.writeRow(Arrays.asList(hearder)); |
||||||
|
|
||||||
|
int row = 1; |
||||||
|
for (Order dbOrder : orders) { |
||||||
|
UserAddrOrder addr = dbOrder.getUserAddrOrder(); |
||||||
|
String addrInfo = addr.getProvince() + addr.getCity() + addr.getArea() + addr.getAddr(); |
||||||
|
List<OrderItem> orderItems = dbOrder.getOrderItems(); |
||||||
|
int firstRow = row + 1; |
||||||
|
int lastRow = row + orderItems.size(); |
||||||
|
int col = -1; |
||||||
|
// 订单编号
|
||||||
|
mergeIfNeed(writer, firstRow, lastRow, ++col, col, dbOrder.getOrderNumber()); |
||||||
|
// 下单时间
|
||||||
|
mergeIfNeed(writer, firstRow, lastRow, ++col, col, dbOrder.getCreateTime()); |
||||||
|
// 收件人
|
||||||
|
mergeIfNeed(writer, firstRow, lastRow, ++col, col, addr.getReceiver()); |
||||||
|
// "手机"
|
||||||
|
mergeIfNeed(writer, firstRow, lastRow, ++col, col, addr.getMobile()); |
||||||
|
// "收货地址"
|
||||||
|
mergeIfNeed(writer, firstRow, lastRow, ++col, col, addrInfo); |
||||||
|
int prodNameCol = ++col; |
||||||
|
int prodCountCol = ++col; |
||||||
|
for (OrderItem orderItem : orderItems) { |
||||||
|
row++; |
||||||
|
// 商品名称
|
||||||
|
writer.writeCellValue(prodNameCol, row, orderItem.getProdName()); |
||||||
|
// 数量
|
||||||
|
writer.writeCellValue(prodCountCol, row, orderItem.getProdCount()); |
||||||
} |
} |
||||||
|
// 订单应付
|
||||||
|
mergeIfNeed(writer, firstRow, lastRow, ++col, col, dbOrder.getTotal()); |
||||||
|
// 订单运费
|
||||||
|
mergeIfNeed(writer, firstRow, lastRow, ++col, col, dbOrder.getFreightAmount()); |
||||||
|
// 订单实付
|
||||||
|
mergeIfNeed(writer, firstRow, lastRow, ++col, col, dbOrder.getActualTotal()); |
||||||
|
|
||||||
@ApiOperation(value = "历史订单补充产品数据") |
|
||||||
@PostMapping(value = "/supplementaryMallId") |
|
||||||
public void supplementaryMallId() { |
|
||||||
List<OrderOther> list = orderOtherService.list(new QueryWrapper<OrderOther>().eq("is_del",1)); |
|
||||||
for (OrderOther orderOther : list) { |
|
||||||
if (orderOther.getMallId()==null){ |
|
||||||
//根据订单名称查询对应的商品id
|
|
||||||
Mall mall = mallService.getOne(new QueryWrapper<Mall>().eq("associated_product_name", orderOther.getProductName())); |
|
||||||
if (mall!=null){ |
|
||||||
orderOther.setMallId(mall.getMallId()); |
|
||||||
orderOtherService.updateById(orderOther); |
|
||||||
} |
} |
||||||
|
writeExcel(response, writer); |
||||||
} |
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 如果需要合并的话,就合并 |
||||||
|
*/ |
||||||
|
private void mergeIfNeed(ExcelWriter writer, int firstRow, int lastRow, int firstColumn, int lastColumn, Object content) { |
||||||
|
if (content instanceof Date) { |
||||||
|
content = DateUtil.format((Date) content, DatePattern.NORM_DATETIME_PATTERN); |
||||||
} |
} |
||||||
|
if (lastRow - firstRow > 0 || lastColumn - firstColumn > 0) { |
||||||
|
writer.merge(firstRow, lastRow, firstColumn, lastColumn, content, false); |
||||||
|
} else { |
||||||
|
writer.writeCellValue(firstColumn, firstRow, content); |
||||||
} |
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
private void writeExcel(HttpServletResponse response, ExcelWriter writer) { |
||||||
|
//response为HttpServletResponse对象
|
||||||
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
||||||
|
//test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码
|
||||||
|
response.setHeader("Content-Disposition", "attachment;filename=1.xls"); |
||||||
|
|
||||||
|
ServletOutputStream servletOutputStream = null; |
||||||
|
try { |
||||||
|
servletOutputStream = response.getOutputStream(); |
||||||
|
writer.flush(servletOutputStream); |
||||||
|
servletOutputStream.flush(); |
||||||
|
} catch (IORuntimeException | IOException e) { |
||||||
|
log.error("写出Excel错误:", e); |
||||||
|
} finally { |
||||||
|
IoUtil.close(writer); |
||||||
|
} |
||||||
|
} |
||||||
} |
} |
||||||
|
@ -1,141 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.common.entity.to.JudgmentPointDataTo; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.OrderOther; |
|
||||||
import com.huoran.nakadai.entity.req.BulkShipOrdersReq; |
|
||||||
import com.huoran.nakadai.entity.req.QueryTimeReq; |
|
||||||
import com.huoran.nakadai.entity.vo.OrderRenewVo; |
|
||||||
import com.huoran.nakadai.service.OrderOtherService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.scheduling.annotation.Scheduled; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import javax.validation.Valid; |
|
||||||
import javax.validation.constraints.NotNull; |
|
||||||
import javax.validation.constraints.Size; |
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 订单其他信息(包含课程权限、数据平台权限、合同信息等) 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author cheney |
|
||||||
* @since 2021-07-01 |
|
||||||
*/ |
|
||||||
@Api(tags = "订单内容管理") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/orderOther") |
|
||||||
public class OrderOtherController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private OrderOtherService orderOtherService; |
|
||||||
|
|
||||||
@ApiOperation(value = "订单发货") |
|
||||||
@PostMapping("/ship") |
|
||||||
public R ship(@RequestBody OrderOther orderOther) { |
|
||||||
boolean update = orderOtherService.ship(orderOther); |
|
||||||
return update ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "批量发货") |
|
||||||
@PostMapping("/bulkShipping") |
|
||||||
public R bulkShipping(@RequestBody BulkShipOrdersReq bulkShipOrdersReq) { |
|
||||||
boolean update = orderOtherService.bulkShipping(bulkShipOrdersReq); |
|
||||||
return update ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "是否启用订单") |
|
||||||
@PostMapping("/enable") |
|
||||||
public R enable( |
|
||||||
@ApiParam(name = "id", value = "货品id", required = true) |
|
||||||
@RequestParam @Valid @NotNull(message = "货品id不能为空") Integer id, |
|
||||||
@ApiParam(name = "flag", value = "标识", required = true) |
|
||||||
@RequestParam @Valid @Size(max = 1) Integer flag) { |
|
||||||
boolean update = orderOtherService.enable(id, flag); |
|
||||||
return update ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "续费查询之前产品信息") |
|
||||||
@PostMapping("/renew") |
|
||||||
public R renew(@RequestBody @Valid OrderRenewVo orderRenewVo) { |
|
||||||
ArrayList<OrderOther> orderOthers = orderOtherService.renew(orderRenewVo); |
|
||||||
return R.ok().put("orderOthers", orderOthers); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 查询订单其他信息 |
|
||||||
*/ |
|
||||||
@GetMapping("/getOrderOther") |
|
||||||
public R getOrderOther(Integer orderId, Integer authority) { |
|
||||||
List<OrderOther> orderOtherList = orderOtherService. |
|
||||||
list(new QueryWrapper<OrderOther>().eq("order_id", orderId).eq("authority", authority)); |
|
||||||
return R.ok().put("orderOtherList", orderOtherList); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 查询客户订单信息 |
|
||||||
*/ |
|
||||||
@ApiOperation(value = "查询客户订单信息") |
|
||||||
@PostMapping("/getCustomerOrderOther") |
|
||||||
public JudgmentPointDataTo getCustomerOrderOther(@RequestParam Integer schoolId, @RequestParam Integer systemId, @RequestParam String name) { |
|
||||||
return orderOtherService.getCustomerOrderOther(schoolId, systemId, name); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 查询订单内容时间 |
|
||||||
*/ |
|
||||||
@ApiOperation(value = "查询订单内容时间") |
|
||||||
@PostMapping("/getOrderOtherTime") |
|
||||||
public R getOrderOtherTime(@RequestBody QueryTimeReq queryTimeReq) { |
|
||||||
String newTime = orderOtherService.getOrderOtherTime(queryTimeReq); |
|
||||||
return R.ok().put("endTime", newTime); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 定时任务处理剩余期限(每日凌晨一点执行一遍) |
|
||||||
*/ |
|
||||||
@Scheduled(cron = "0 0 1 * * ?") |
|
||||||
// @ApiOperation(value = "定时任务处理剩余期限")
|
|
||||||
// @PostMapping("/remainingPeriod")
|
|
||||||
public void remainingPeriod() { |
|
||||||
orderOtherService.remainingPeriod(); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 定时任务处理客户到期时间(每日凌晨两点执行一遍) |
|
||||||
*/ |
|
||||||
@Scheduled(cron = "0 0 2 * * ?") |
|
||||||
// @PostMapping("/remainingPeriod")
|
|
||||||
public void customerExpiration() { |
|
||||||
orderOtherService.customerExpiration(); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/orderBulkDisableEnable") |
|
||||||
@ApiOperation(value = "订单批量禁用启用") |
|
||||||
public R orderBulkDisableEnable(@RequestParam(value = "isOpen") @ApiParam(value = "是否开启(0不开启,1开启,发货后,默认开启)") Integer isOpen, @RequestBody List<Integer> ids, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer count = 0; |
|
||||||
for (Integer id : ids) { |
|
||||||
OrderOther orderOther = new OrderOther(); |
|
||||||
orderOther.setIsEnable(isOpen); |
|
||||||
orderOther.setId(id); |
|
||||||
boolean ret = orderOtherService.updateById(orderOther); |
|
||||||
if (ret) { |
|
||||||
count++; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
return count == ids.size() ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
@ -1,217 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.common.exception.CustomException; |
|
||||||
import com.huoran.common.exception.ExceptionEnum; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.nakadai.entity.PartnerAccount; |
|
||||||
import com.huoran.nakadai.entity.PartnerClassification; |
|
||||||
import com.huoran.nakadai.entity.PartnerTeam; |
|
||||||
import com.huoran.nakadai.entity.req.*; |
|
||||||
import com.huoran.nakadai.entity.res.PartnerAccountResp; |
|
||||||
import com.huoran.nakadai.entity.vo.TeamMemberVo; |
|
||||||
import com.huoran.nakadai.service.PartnerAccountService; |
|
||||||
import com.huoran.nakadai.service.PartnerClassificationService; |
|
||||||
import com.huoran.nakadai.service.PartnerTeamService; |
|
||||||
import com.huoran.nakadai.utils.GenerateCodeUtil; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.apache.commons.lang3.StringUtils; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.data.redis.core.RedisTemplate; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse; |
|
||||||
import javax.validation.Valid; |
|
||||||
import java.util.concurrent.TimeUnit; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 合伙人账号表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2022-05-18 |
|
||||||
*/ |
|
||||||
@Api(tags = "合伙人账号管理") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/partnerAccount") |
|
||||||
public class PartnerAccountController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public PartnerAccountService partnerAccountService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public PartnerTeamService partnerTeamService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public PartnerClassificationService partnerClassificationService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private RedisTemplate<String, String> redisTemplate; |
|
||||||
|
|
||||||
/** |
|
||||||
* 生成专属邀请码 |
|
||||||
*/ |
|
||||||
@PostMapping("/generateInvitationCode") |
|
||||||
@ApiOperation(value = "生成专属邀请码") |
|
||||||
public R generateInvitationCode(@RequestParam("accountId") String accountId) { |
|
||||||
//存在直接返回邀请码
|
|
||||||
String code = redisTemplate.opsForValue().get(accountId+"invitationCode"); |
|
||||||
if (StringUtils.isEmpty(code)){ |
|
||||||
code = GenerateCodeUtil.generateCode(); |
|
||||||
redisTemplate.opsForValue().set(accountId+"invitationCode",code,7, TimeUnit.DAYS); |
|
||||||
} |
|
||||||
//过期时间
|
|
||||||
Long expireTime = redisTemplate.opsForValue().getOperations().getExpire(accountId+"invitationCode"); |
|
||||||
return R.ok().put("invitationCode",code).put("expireTime",expireTime); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "邀请二维码生成") |
|
||||||
@GetMapping(value = "/generationQrCode",produces = "image/png") |
|
||||||
public void generationQrCode( |
|
||||||
@ApiParam(name = "url", value = "链接", required = true) |
|
||||||
@RequestParam String url, HttpServletResponse response){ |
|
||||||
partnerAccountService.generationQrCode(url,response); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 新增合伙人账号 |
|
||||||
*/ |
|
||||||
@PostMapping("/savePartnerAccount") |
|
||||||
@ApiOperation(value = "新增合伙人账号") |
|
||||||
public R savePartnerAccount(@RequestBody @Valid PartnerAccountAddReq partnerAccountAddReq) { |
|
||||||
return partnerAccountService.savePartnerAccount(partnerAccountAddReq); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 合伙人账号列表 |
|
||||||
*/ |
|
||||||
@PostMapping("/partnerAccountList") |
|
||||||
@ApiOperation(value = "合伙人账号列表(查询分类下所有团队及成员)", response = PartnerAccountResp.class) |
|
||||||
public R partnerAccountList(@RequestBody @Valid PartnerAccountListReq req) { |
|
||||||
return partnerAccountService.pagePartnerAccountList(req); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/partnerAccountMergeList") |
|
||||||
@ApiOperation(value = "合伙人账号列表--合并数据查询(以账号为维度查询合并-中台调用)", response = PartnerAccountResp.class) |
|
||||||
public R partnerAccountMergeList(@RequestBody @Valid PartnerAccountListReq req) { |
|
||||||
return partnerAccountService.partnerAccountMergeList(req); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/teamPartnerList") |
|
||||||
@ApiOperation(value = "团队合伙人列表(以团队维度查询-小程序调用)", response = PartnerAccountResp.class) |
|
||||||
public R teamPartnerList(@RequestBody @Valid PartnerAccountListReq req) { |
|
||||||
return partnerAccountService.teamPartnerList(req); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/queryTeamMembers") |
|
||||||
@ApiOperation(value = "查询团队成员", response = PartnerAccountResp.class) |
|
||||||
public R queryTeamMembers(@RequestBody TeamMemberVo teamMemberVo) { |
|
||||||
return partnerAccountService.queryTeamMembers(teamMemberVo); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 合伙人账号详情 |
|
||||||
*/ |
|
||||||
@GetMapping("/partnerAccountDetail") |
|
||||||
// @ApiOperation(value = "合伙人账号详情", response = PartnerAccountResp.class)
|
|
||||||
public R partnerAccountDetail(@ApiParam(name = "accountId", value = "合伙人账号账号id") |
|
||||||
@RequestParam Integer accountId) { |
|
||||||
return partnerAccountService.partnerAccountDetail(accountId); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 编辑合伙人账号 |
|
||||||
*/ |
|
||||||
@PostMapping("/modifyPartnerAccount") |
|
||||||
// @ApiOperation(value = "编辑合伙人账号")
|
|
||||||
public R modifyPartnerAccount(@RequestBody @Valid PartnerAccountUpdateReq updateReq) { |
|
||||||
return partnerAccountService.modifyPartnerAccount(updateReq); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 生成转让邀请码 |
|
||||||
*/ |
|
||||||
@PostMapping("/generateTransferCode") |
|
||||||
@ApiOperation(value = "生成转让邀请码") |
|
||||||
public R generateTransferCode(@RequestParam("accountId") String accountId) { |
|
||||||
//存在直接返回邀请码
|
|
||||||
String code = redisTemplate.opsForValue().get(accountId+"transferCode"); |
|
||||||
if (StringUtils.isEmpty(code)){ |
|
||||||
code = GenerateCodeUtil.generateCode(); |
|
||||||
redisTemplate.opsForValue().set(accountId+"transferCode",code,1, TimeUnit.DAYS); |
|
||||||
} |
|
||||||
//过期时间
|
|
||||||
Long expireTime = redisTemplate.opsForValue().getOperations().getExpire(accountId+"transferCode"); |
|
||||||
return R.ok().put("transferCode",code).put("expireTime",expireTime); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/transferAdmin") |
|
||||||
@ApiOperation(value = "新增转让超管") |
|
||||||
public R transferAdmin(@RequestBody @Valid TransferAdminReq transferAdminReq) { |
|
||||||
return partnerAccountService.transferAdmin(transferAdminReq); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/transferTeam") |
|
||||||
@ApiOperation(value = "团队内转让超管") |
|
||||||
public R transferTeam(@RequestBody @Valid TransferTeamReq transferTeamReq) { |
|
||||||
return partnerAccountService.transferTeam(transferTeamReq); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 删除团队 |
|
||||||
*/ |
|
||||||
@PostMapping("/delPartnerAccount") |
|
||||||
@ApiOperation(value = "删除合伙人") |
|
||||||
public R delPartnerAccount( |
|
||||||
@ApiParam(name = "accountId", value = "账号id") |
|
||||||
@RequestParam Integer accountId) { |
|
||||||
return partnerAccountService.delPartnerAccount(accountId); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 移除团队 |
|
||||||
*/ |
|
||||||
@GetMapping("/partnerRemoval") |
|
||||||
@ApiOperation(value = "移除团队") |
|
||||||
public R partnerRemoval( |
|
||||||
@ApiParam(name = "teamId", value = "团队id") |
|
||||||
@RequestParam String teamId, |
|
||||||
@ApiParam(name = "partnerId", value = "合伙人id") |
|
||||||
@RequestParam String partnerId) { |
|
||||||
PartnerClassification partnerClassification = partnerClassificationService.getById(teamId); |
|
||||||
if (partnerClassification.getIsTeam() == 1) { |
|
||||||
throw new CustomException(ExceptionEnum.PARTNER_REMOVAL); |
|
||||||
} |
|
||||||
PartnerAccount partnerAccount = partnerAccountService.getById(partnerId); |
|
||||||
//删除团队成员
|
|
||||||
partnerClassificationService.removeById(Integer.parseInt(teamId)); |
|
||||||
//同步删除该团队相关角色信息
|
|
||||||
partnerClassificationService.removeRole(teamId,partnerAccount.getAccountId()); |
|
||||||
return partnerTeamService.remove(new QueryWrapper<PartnerTeam>(). |
|
||||||
eq("partner_id", partnerId). |
|
||||||
eq("classification_id", teamId)) ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/mailFileSend") |
|
||||||
@ApiOperation(value = "邮箱文案发送") |
|
||||||
public R mailFileSend(@RequestBody FileSendReq fileSendReq) { |
|
||||||
return partnerAccountService.mailFileSend(fileSendReq); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "查询合伙人账号信息") |
|
||||||
@PostMapping("/queryPartnerAccount") |
|
||||||
public R queryPartnerAccount(@RequestParam String phone) { |
|
||||||
return partnerAccountService.queryPartnerAccount(phone); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "合伙人账号申请注册") |
|
||||||
@PostMapping("/partnerAccountApplication") |
|
||||||
public R partnerAccountApplication(@RequestBody @Valid PartnerRegisterReq registerReq) { |
|
||||||
return partnerAccountService.partnerAccountApplication(registerReq); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
@ -1,99 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.PartnerArticleClassification; |
|
||||||
import com.huoran.nakadai.service.PartnerArticleClassificationService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* @描述:合伙人——文章管理——文章所属分类控制类 |
|
||||||
* @作者: Rong |
|
||||||
* @日期: 2023-03-16 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/partner/article/classification") |
|
||||||
@Api(value = "合伙人——文章管理——文章所属分类:PartnerArticleClassificationController", tags = "R-合伙人——文章所属分类") |
|
||||||
public class PartnerArticleClassificationController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public PartnerArticleClassificationService service; |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/queryClassificationByType") |
|
||||||
@ApiOperation(value = "依据类型查询分类", response = PartnerArticleClassification.class) |
|
||||||
public R allTheQuery(@ApiParam(name = "typeId", value = "类型(1.学习2.资讯3.方案)", required = true) @RequestParam Integer typeId) { |
|
||||||
List<PartnerArticleClassification> list = service.list(new QueryWrapper<PartnerArticleClassification>() |
|
||||||
.eq("type_id", typeId)); |
|
||||||
return R.ok().put("data",list); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/findById") |
|
||||||
@ApiOperation(value = "查询详情", response = PartnerArticleClassification.class) |
|
||||||
public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { |
|
||||||
PartnerArticleClassification partnerArticleClassification = service.getById(id); |
|
||||||
return R.ok().put("data", partnerArticleClassification); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/checkForHeavy") |
|
||||||
@ApiOperation(value = "分类校验判重", response = PartnerArticleClassification.class) |
|
||||||
public R checkForHeavy(@ApiParam(name = "typeId", value = "类型(1.学习2.资讯", required = true) @RequestParam Integer typeId, |
|
||||||
@ApiParam(name = "classificationName", value = "分类名称", required = true) @RequestParam String classificationName, |
|
||||||
@ApiParam(name = "classificationId", value = "分类id(新增不传,编辑传)", required = false) @RequestParam Integer classificationId) { |
|
||||||
|
|
||||||
QueryWrapper<PartnerArticleClassification> queryWrapper = new QueryWrapper<PartnerArticleClassification>().eq("type_id", typeId). |
|
||||||
eq("classification_name", classificationName); |
|
||||||
|
|
||||||
//id不得空表示编辑校验
|
|
||||||
if (classificationId != null) { |
|
||||||
queryWrapper.last(" and id != " + classificationId); |
|
||||||
} |
|
||||||
PartnerArticleClassification sysContentClassification = service.getOne(queryWrapper); |
|
||||||
if (sysContentClassification != null) { |
|
||||||
return R.error("当前分类名称已存在!"); |
|
||||||
} |
|
||||||
return R.ok(); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/save") |
|
||||||
@ApiOperation(value = "新增", response = PartnerArticleClassification.class) |
|
||||||
public R save(@RequestBody @ApiParam(name = "合伙人——文章管理——文章所属分类对象", value = "传入json格式", required = true) PartnerArticleClassification partnerArticleClassification, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
partnerArticleClassification.setFounderId(Integer.parseInt(accountId)); |
|
||||||
partnerArticleClassification.setEditorId(Integer.parseInt(accountId)); |
|
||||||
boolean addState = service.save(partnerArticleClassification); |
|
||||||
return addState ? R.ok() : R.error("新增失败"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/update") |
|
||||||
@ApiOperation(value = "修改", response = PartnerArticleClassification.class) |
|
||||||
public R update(@RequestBody @ApiParam(name = "合伙人——文章管理——文章所属分类对象", value = "传入json格式", required = true) PartnerArticleClassification partnerArticleClassification, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
partnerArticleClassification.setEditorId(Integer.parseInt(accountId)); |
|
||||||
boolean updateState = service.updateById(partnerArticleClassification); |
|
||||||
return updateState ? R.ok() : R.error("编辑失败"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/batchDeletion") |
|
||||||
@ApiOperation(value = "批量删除", response = PartnerArticleClassification.class) |
|
||||||
public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestParam List<Integer> ids) { |
|
||||||
boolean delState = service.removeByIds(ids); |
|
||||||
return delState ? R.ok() : R.error("删除失败"); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
@ -1,80 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.PartnerArticleFile; |
|
||||||
import com.huoran.nakadai.service.PartnerArticleFileService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* @描述:合伙人——文章管理——文章附件管理表控制类 |
|
||||||
* @作者: Rong |
|
||||||
* @日期: 2023-03-16 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/partner/article/file") |
|
||||||
@Api(value = "合伙人——文章管理——文章附件管理表:PartnerArticleFileController", tags = "R-合伙人——文章附件管理表") |
|
||||||
public class PartnerArticleFileController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public PartnerArticleFileService service; |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/theAttachmentUnderTheQueryColumn") |
|
||||||
@ApiOperation(value = "查询文章id下的附件", response = PartnerArticleFile.class) |
|
||||||
public R theAttachmentUnderTheQueryColumn(@ApiParam(name = "contentId", value = "文章id", required = true) @RequestParam Integer contentId) { |
|
||||||
QueryWrapper<PartnerArticleFile> queryWrapper = new QueryWrapper<>(); |
|
||||||
queryWrapper.eq("content_id",contentId); |
|
||||||
List<PartnerArticleFile> sysContentFile = service.list(queryWrapper); |
|
||||||
return R.ok().put("data",sysContentFile); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/findById") |
|
||||||
@ApiOperation(value = "查询详情", response = PartnerArticleFile.class) |
|
||||||
public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { |
|
||||||
PartnerArticleFile partnerArticleFile = service.getById(id); |
|
||||||
return R.ok().put("data", partnerArticleFile); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/save") |
|
||||||
@ApiOperation(value = "新增", response = PartnerArticleFile.class) |
|
||||||
public R save(@RequestBody @ApiParam(name = "合伙人——文章管理——文章附件管理表对象", value = "传入json格式", required = true) PartnerArticleFile partnerArticleFile, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
partnerArticleFile.setFounderId(Integer.parseInt(accountId)); |
|
||||||
partnerArticleFile.setEditorId(Integer.parseInt(accountId)); |
|
||||||
boolean addState = service.save(partnerArticleFile); |
|
||||||
return addState ? R.ok() : R.error("新增失败"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/update") |
|
||||||
@ApiOperation(value = "修改", response = PartnerArticleFile.class) |
|
||||||
public R update(@RequestBody @ApiParam(name = "合伙人——文章管理——文章附件管理表对象", value = "传入json格式", required = true) PartnerArticleFile partnerArticleFile, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
partnerArticleFile.setEditorId(Integer.parseInt(accountId)); |
|
||||||
boolean updateState = service.updateById(partnerArticleFile); |
|
||||||
return updateState ? R.ok() : R.error("编辑失败"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/batchDeletion") |
|
||||||
@ApiOperation(value = "批量删除", response = PartnerArticleFile.class) |
|
||||||
public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestParam List<Integer> ids) { |
|
||||||
boolean delState = service.removeByIds(ids); |
|
||||||
return delState ? R.ok() : R.error("删除失败"); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
@ -1,95 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.PartnerArticleLabel; |
|
||||||
import com.huoran.nakadai.service.PartnerArticleLabelService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* @描述:合伙人——文章管理——文章主题标签控制类 |
|
||||||
* @作者: Rong |
|
||||||
* @日期: 2023-03-16 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/partner/article/label") |
|
||||||
@Api(value = "合伙人——文章管理——文章主题标签:PartnerArticleLabelController", tags = "R-合伙人——文章主题标签") |
|
||||||
public class PartnerArticleLabelController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public PartnerArticleLabelService service; |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/queryAllArticleSubjectTags") |
|
||||||
@ApiOperation(value = "查询全部文章主题标签(文章主题标签不区分)", response = PartnerArticleLabel.class) |
|
||||||
public R queryAllArticleSubjectTags() { |
|
||||||
List<PartnerArticleLabel> list = service.list(null); |
|
||||||
return R.ok().put("data", list); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/findById") |
|
||||||
@ApiOperation(value = "查询详情", response = PartnerArticleLabel.class) |
|
||||||
public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { |
|
||||||
PartnerArticleLabel partnerArticleLabel = service.getById(id); |
|
||||||
return R.ok().put("data", partnerArticleLabel); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/save") |
|
||||||
@ApiOperation(value = "新增", response = PartnerArticleLabel.class) |
|
||||||
public R save(@RequestBody @ApiParam(name = "合伙人——文章管理——文章主题标签对象", value = "传入json格式", required = true) PartnerArticleLabel partnerArticleLabel, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
partnerArticleLabel.setFounderId(Integer.parseInt(accountId)); |
|
||||||
partnerArticleLabel.setEditorId(Integer.parseInt(accountId)); |
|
||||||
boolean addState = service.save(partnerArticleLabel); |
|
||||||
return addState ? R.ok() : R.error("新增失败"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/checkForHeavy") |
|
||||||
@ApiOperation(value = "标签校验判重", response = PartnerArticleLabel.class) |
|
||||||
public R checkForHeavy( @ApiParam(name = "labelName", value = "标签名称", required = true) @RequestParam String labelName, @ApiParam(name = "labelId", value = "标签id(新增不传,编辑传)", required = false) @RequestParam Integer labelId) { |
|
||||||
|
|
||||||
QueryWrapper<PartnerArticleLabel> queryWrapper = new QueryWrapper<PartnerArticleLabel>().eq("label_name", labelName); |
|
||||||
|
|
||||||
//id不得空表示编辑校验
|
|
||||||
if (labelId != null) { |
|
||||||
queryWrapper.last(" and id != " + labelId); |
|
||||||
} |
|
||||||
PartnerArticleLabel contentLabel = service.getOne(queryWrapper); |
|
||||||
if (contentLabel != null) { |
|
||||||
return R.error("当前标签名称已存在!"); |
|
||||||
} |
|
||||||
return R.ok(); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/update") |
|
||||||
@ApiOperation(value = "修改", response = PartnerArticleLabel.class) |
|
||||||
public R update(@RequestBody @ApiParam(name = "合伙人——文章管理——文章主题标签对象", value = "传入json格式", required = true) PartnerArticleLabel partnerArticleLabel, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
partnerArticleLabel.setEditorId(Integer.parseInt(accountId)); |
|
||||||
boolean updateState = service.updateById(partnerArticleLabel); |
|
||||||
return updateState ? R.ok() : R.error("编辑失败"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/batchDeletion") |
|
||||||
@ApiOperation(value = "批量删除", response = PartnerArticleLabel.class) |
|
||||||
public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestParam List<Integer> ids) { |
|
||||||
boolean delState = service.removeByIds(ids); |
|
||||||
return delState ? R.ok() : R.error("删除失败"); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
@ -1,216 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
||||||
import com.huoran.api.UserClient; |
|
||||||
import com.huoran.common.constant.DelConstant; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.PartnerArticleFile; |
|
||||||
import com.huoran.nakadai.entity.PartnerArticleManagement; |
|
||||||
import com.huoran.nakadai.entity.PartnerArticleManagementCollect; |
|
||||||
import com.huoran.nakadai.entity.req.PagePartnerArticleManagementReq; |
|
||||||
import com.huoran.nakadai.entity.res.PartnerArticleManagementResp; |
|
||||||
import com.huoran.nakadai.entity.vo.ContentHeavyTitleReqVO; |
|
||||||
import com.huoran.nakadai.service.*; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import javax.validation.Valid; |
|
||||||
import java.util.Date; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* @描述:合伙人——文章管理控制类 |
|
||||||
* @作者: Rong |
|
||||||
* @日期: 2023-03-16 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/partner/article/management") |
|
||||||
@Api(value = "合伙人——文章管理:PartnerArticleManagementController", tags = "R-合伙人——文章管理") |
|
||||||
public class PartnerArticleManagementController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public PartnerArticleManagementService service; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public PartnerArticleManagementCollectService articleManagementCollectService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public PartnerArticleClassificationService classificationService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public PartnerArticleFileService fileService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public PartnerArticleLabelService labelService; |
|
||||||
@Autowired |
|
||||||
private UserClient userClient; |
|
||||||
|
|
||||||
@PostMapping("/partnerOperatingList") |
|
||||||
@ApiOperation(value = "合伙人运营列表", response = PartnerArticleManagementResp.class) |
|
||||||
public R partnerOperatingList(@RequestBody PagePartnerArticleManagementReq partnerArticleManagement, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
partnerArticleManagement.setAccountId(Integer.valueOf(accountId)); |
|
||||||
return service.partnerOperatingList(partnerArticleManagement); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/findById") |
|
||||||
@ApiOperation(value = "查询详情", response = PartnerArticleManagement.class) |
|
||||||
public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { |
|
||||||
PartnerArticleManagement partnerArticleManagement = service.getById(id); |
|
||||||
List<PartnerArticleFile> fileList = fileService.getFileByContentId(id); |
|
||||||
partnerArticleManagement.setFileList(fileList); |
|
||||||
partnerArticleManagement.setClassificationNameList(classificationService.categoryIdsQueriesCategoryInformation(partnerArticleManagement.getClassificationId() + "")); |
|
||||||
partnerArticleManagement.setLabelNameList((labelService.idsQueriesLabelInformation(partnerArticleManagement.getLableId() + ""))); |
|
||||||
return R.ok().put("data", partnerArticleManagement); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/save") |
|
||||||
@ApiOperation(value = "新增", response = PartnerArticleManagement.class) |
|
||||||
public R save(@RequestBody @ApiParam(name = "合伙人文章管理对象", value = "传入json格式", required = true) PartnerArticleManagement articleManagement, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
articleManagement.setFounderId(Integer.parseInt(accountId)); |
|
||||||
articleManagement.setEditorId(Integer.parseInt(accountId)); |
|
||||||
/* |
|
||||||
QueryWrapper<PartnerArticleManagement> queryWrap = new QueryWrapper<>(); |
|
||||||
queryWrap.eq("type_id", articleManagement.getTypeId()); |
|
||||||
Integer count = service.count(queryWrap); |
|
||||||
if (count == 0) { |
|
||||||
count = 1; |
|
||||||
}*/ |
|
||||||
// articleManagement.setSequence(count + 1);
|
|
||||||
boolean addState = service.save(articleManagement); |
|
||||||
//附件新增数据处理
|
|
||||||
if (articleManagement.getFileList().size() > 0) { |
|
||||||
for (PartnerArticleFile partnerArticleFile : articleManagement.getFileList()) { |
|
||||||
partnerArticleFile.setContentId(articleManagement.getId()); |
|
||||||
partnerArticleFile.setFounderId(Integer.parseInt(accountId)); |
|
||||||
partnerArticleFile.setEditorId(Integer.parseInt(accountId)); |
|
||||||
fileService.save(partnerArticleFile); |
|
||||||
} |
|
||||||
} |
|
||||||
return addState ? R.ok() : R.error("新增失败"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/update") |
|
||||||
@ApiOperation(value = "修改", response = PartnerArticleManagement.class) |
|
||||||
public R update(@RequestBody @ApiParam(name = "合伙人——文章管理对象", value = "传入json格式", required = true) PartnerArticleManagement partnerArticleManagement, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
// partnerArticleManagement.setFounderId(Integer.parseInt(accountId));
|
|
||||||
partnerArticleManagement.setEditorId(Integer.parseInt(accountId)); |
|
||||||
ContentHeavyTitleReqVO content = new ContentHeavyTitleReqVO(); |
|
||||||
content.setTitle(partnerArticleManagement.getTitle()); |
|
||||||
content.setTypeId(partnerArticleManagement.getTypeId()); |
|
||||||
content.setId(partnerArticleManagement.getId()); |
|
||||||
boolean verify = service.checkIfTheTitleIsRepeat(content); |
|
||||||
if (verify == false) { |
|
||||||
return R.error("该标题已重复"); |
|
||||||
} |
|
||||||
|
|
||||||
UpdateWrapper<PartnerArticleFile> updateWrapper = new UpdateWrapper<>(); |
|
||||||
updateWrapper.set("is_del", DelConstant.IS_DEL); |
|
||||||
updateWrapper.eq("content_id", partnerArticleManagement.getId()); |
|
||||||
fileService.update(new PartnerArticleFile(), updateWrapper); |
|
||||||
|
|
||||||
|
|
||||||
//附件新增数据处理
|
|
||||||
if (partnerArticleManagement.getFileList().size() > 0) { |
|
||||||
for (PartnerArticleFile partnerArticleFile : partnerArticleManagement.getFileList()) { |
|
||||||
partnerArticleFile.setContentId(partnerArticleManagement.getId()); |
|
||||||
partnerArticleFile.setFounderId(Integer.parseInt(accountId)); |
|
||||||
partnerArticleFile.setEditorId(Integer.parseInt(accountId)); |
|
||||||
fileService.save(partnerArticleFile); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
boolean updateState = service.updateById(partnerArticleManagement); |
|
||||||
return updateState ? R.ok() : R.error("编辑失败"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/batchDeletion") |
|
||||||
@ApiOperation(value = "批量删除", response = PartnerArticleManagement.class) |
|
||||||
public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestParam List<Integer> ids) { |
|
||||||
|
|
||||||
boolean delState = service.removeByIds(ids); |
|
||||||
return delState ? R.ok() : R.error("删除失败"); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/articleEnableOrDisable") |
|
||||||
@ApiOperation(value = "文章启用禁用", response = PartnerArticleManagement.class) |
|
||||||
public R articleEnableOrDisable(@ApiParam(name = "id", value = "文章id", required = true) @RequestParam Integer id, @ApiParam(name = "isDisable", value = "是否禁用(0默认,0启用 1禁用)", required = true) @RequestParam Integer isDisable) { |
|
||||||
UpdateWrapper<PartnerArticleManagement> updateWrapper = new UpdateWrapper<PartnerArticleManagement>(); |
|
||||||
updateWrapper.set("is_disable", isDisable); |
|
||||||
updateWrapper.eq("id", id); |
|
||||||
boolean ret = service.update(new PartnerArticleManagement(), updateWrapper); |
|
||||||
return ret ? R.ok() : R.error("禁用/启用失败"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/checkIfTheTitleIsRepeat") |
|
||||||
@ApiOperation(value = "标题判重——只对已发布的判重(新增,编辑,点击发布时候都要调用判断))", response = PartnerArticleManagement.class) |
|
||||||
public R checkIfTheTitleIsRepeat(@RequestBody @Valid ContentHeavyTitleReqVO content) { |
|
||||||
return service.checkIfTheTitleIsRepeat(content) ? R.ok() : R.error("该标题已重复!"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/articleTopOperation") |
|
||||||
@ApiOperation(value = "文章置顶/取消置顶", response = PartnerArticleManagement.class) |
|
||||||
public R articleTopOperation(@ApiParam(name = "isTop", value = "是否置顶(默认为0 不置顶 1为置顶)", required = true) @RequestParam Integer isTop, @ApiParam(name = "articleId", value = "文章Id", required = true) @RequestParam Integer articleId) { |
|
||||||
//是否置顶(默认为0 不置顶 1为置顶)
|
|
||||||
UpdateWrapper<PartnerArticleManagement> updateWrap = new UpdateWrapper<>(); |
|
||||||
updateWrap.set("is_top", isTop); |
|
||||||
if (isTop == 1) { |
|
||||||
updateWrap.set("top_time", new Date());//置顶时间(置顶一次更新一次)
|
|
||||||
} else { |
|
||||||
updateWrap.set("top_time", null); |
|
||||||
} |
|
||||||
updateWrap.eq("id", articleId); |
|
||||||
boolean ret = service.update(new PartnerArticleManagement(), updateWrap); |
|
||||||
return ret ? R.ok() : R.error("操作失败"); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/collectCourse") |
|
||||||
@ApiOperation(value = "收藏课程", response = PartnerArticleManagement.class) |
|
||||||
public R collectCourse(@ApiParam(name = "contentId", value = "文章id", required = true) @RequestParam Integer contentId, @ApiParam(name = "state", value = "操作状态(state = 1收藏,0取消收藏)", required = true) @RequestParam Integer state, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
QueryWrapper<PartnerArticleManagementCollect> queryWrapper = new QueryWrapper<PartnerArticleManagementCollect>(); |
|
||||||
queryWrapper.eq("content_id", contentId); |
|
||||||
queryWrapper.eq("account_id", accountId); |
|
||||||
|
|
||||||
PartnerArticleManagementCollect detail = articleManagementCollectService.getOne(queryWrapper); |
|
||||||
switch (state) { |
|
||||||
case 0://取消收藏
|
|
||||||
if (detail != null) { |
|
||||||
articleManagementCollectService.removeById(detail.getId()); |
|
||||||
} |
|
||||||
break; |
|
||||||
|
|
||||||
case 1://收藏
|
|
||||||
if (detail != null) { |
|
||||||
return R.ok("已经收藏过了!"); |
|
||||||
} |
|
||||||
PartnerArticleManagementCollect courseCollect = new PartnerArticleManagementCollect(); |
|
||||||
courseCollect.setContentId(contentId); |
|
||||||
courseCollect.setCollectionTime(new Date()); |
|
||||||
courseCollect.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); |
|
||||||
courseCollect.setAccountId(Integer.valueOf(accountId)); |
|
||||||
articleManagementCollectService.save(courseCollect); |
|
||||||
break; |
|
||||||
} |
|
||||||
return R.ok(); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,119 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.nakadai.entity.PartnerClassification; |
|
||||||
import com.huoran.nakadai.entity.req.PartnerClassificationAddReq; |
|
||||||
import com.huoran.nakadai.service.PartnerClassificationService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.BeanUtils; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.validation.Valid; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 合伙人分类表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2022-05-18 |
|
||||||
*/ |
|
||||||
@Api(tags = "合伙人分类管理") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/partnerClassification") |
|
||||||
public class PartnerClassificationController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public PartnerClassificationService partnerClassificationService; |
|
||||||
|
|
||||||
/** |
|
||||||
* 新增合伙人分类 |
|
||||||
*/ |
|
||||||
@PostMapping("/save") |
|
||||||
@ApiOperation(value = "新增合伙人分类") |
|
||||||
public R save(@RequestBody @Valid PartnerClassificationAddReq PartnerClassificationAddReq) { |
|
||||||
|
|
||||||
//暂时无限制
|
|
||||||
/* if (PartnerClassificationAddReq.getLevel() > 6) { |
|
||||||
return R.error("暂不支持" + PartnerClassificationAddReq.getLevel() + "层级"); |
|
||||||
}*/ |
|
||||||
|
|
||||||
PartnerClassification partnerClassification = new PartnerClassification(); |
|
||||||
BeanUtils.copyProperties(PartnerClassificationAddReq, partnerClassification); |
|
||||||
|
|
||||||
boolean ok = partnerClassificationService.checkRepeat(partnerClassification); |
|
||||||
if (ok) { |
|
||||||
return R.error("同级下已存在相同的名称:" + PartnerClassificationAddReq.getPartnerClassificationName()); |
|
||||||
} |
|
||||||
boolean save = partnerClassificationService.save(partnerClassification); |
|
||||||
return save ? R.ok().put("id", partnerClassification.getId()) : R.error(); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 编辑合伙人分类 |
|
||||||
*/ |
|
||||||
@PostMapping("/update") |
|
||||||
@ApiOperation(value = "编辑合伙人分类") |
|
||||||
public R update(@RequestBody @Valid PartnerClassification partnerClassification) { |
|
||||||
boolean ok = false; |
|
||||||
PartnerClassification byId = partnerClassificationService.getById(partnerClassification.getId()); |
|
||||||
//名字未修改,不用进行判重
|
|
||||||
if (!byId.getPartnerClassificationName().equals(partnerClassification.getPartnerClassificationName())){ |
|
||||||
//全部分类进行判重
|
|
||||||
ok = partnerClassificationService.checkRepeatAll(partnerClassification); |
|
||||||
} |
|
||||||
if (ok) { |
|
||||||
return R.error("已存在相同的名称:" + partnerClassification.getPartnerClassificationName()); |
|
||||||
} else { |
|
||||||
boolean update = partnerClassificationService.updateById(partnerClassification); |
|
||||||
if (partnerClassification.getIsTeam()==1){ |
|
||||||
//更新团员所属团队名称
|
|
||||||
List<PartnerClassification> partnerClassifications = partnerClassificationService.list(new QueryWrapper<PartnerClassification>(). |
|
||||||
eq("parent_id", partnerClassification.getId())); |
|
||||||
partnerClassifications.forEach(partnerClassification1 -> { |
|
||||||
partnerClassification1.setPartnerClassificationName(partnerClassification.getPartnerClassificationName()); |
|
||||||
partnerClassificationService.updateById(partnerClassification1); |
|
||||||
}); |
|
||||||
} |
|
||||||
return update ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 删除合伙人分类 |
|
||||||
*/ |
|
||||||
@PostMapping("/delete") |
|
||||||
@ApiOperation(value = "删除合伙人分类") |
|
||||||
public R delete(@ApiParam(name = "id", value = "分类id", required = true) @RequestParam Integer id) { |
|
||||||
//级联删除子分类
|
|
||||||
boolean remove = partnerClassificationService.removeClassification(id); |
|
||||||
return remove ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 合伙人分类树形列表 |
|
||||||
*/ |
|
||||||
@PostMapping("/treeList") |
|
||||||
@ApiOperation(value = "合伙人分类树形列表", response = PartnerClassification.class) |
|
||||||
public R treeList(@ApiParam(name = "applet", value = "小程序标识", required = false) |
|
||||||
@RequestParam(required = false) Integer applet) { |
|
||||||
List<PartnerClassification> list = partnerClassificationService.treeList(applet); |
|
||||||
return R.ok().put("treeList", list); |
|
||||||
} |
|
||||||
|
|
||||||
@GetMapping("/getAllTeam") |
|
||||||
@ApiOperation(value = "查询所有团队") |
|
||||||
public R getAllTeam() { |
|
||||||
List<PartnerClassification> team = partnerClassificationService.list(new QueryWrapper<PartnerClassification>(). |
|
||||||
eq("is_team", 1)); |
|
||||||
return R.ok().put("team",team) ; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
@ -1,138 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.PartnerSchemeManagement; |
|
||||||
import com.huoran.nakadai.entity.PartnerSchemeManagementProductConfig; |
|
||||||
import com.huoran.nakadai.entity.req.PagePartnerArticleManagementReq; |
|
||||||
import com.huoran.nakadai.service.PartnerSchemeManagementProductConfigService; |
|
||||||
import com.huoran.nakadai.service.PartnerSchemeManagementService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* @描述:合伙人——方案管理控制类 |
|
||||||
* @作者: Rong |
|
||||||
* @日期: 2023-03-20 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/partner/schemeManagement") |
|
||||||
@Api(value = "合伙人——方案管理", tags = "R-合伙人——方案管理") |
|
||||||
public class PartnerSchemeManagementController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public PartnerSchemeManagementService service; |
|
||||||
@Autowired |
|
||||||
public PartnerSchemeManagementProductConfigService productConfigService; |
|
||||||
|
|
||||||
@PostMapping("/schemeList") |
|
||||||
@ApiOperation(value = "方案列表分页查询", response = PartnerSchemeManagement.class) |
|
||||||
public R schemeList(@RequestBody PagePartnerArticleManagementReq partnerSchemeManagement) { |
|
||||||
return service.schemeList(partnerSchemeManagement); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/findById") |
|
||||||
@ApiOperation(value = "查询详情", response = PartnerSchemeManagement.class) |
|
||||||
public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { |
|
||||||
PartnerSchemeManagement partnerSchemeManagement = service.getById(id); |
|
||||||
//isRelease:是否发布(0:草稿 1:已发布)
|
|
||||||
Integer isRelease = partnerSchemeManagement.getIsRelease(); |
|
||||||
List<PartnerSchemeManagementProductConfig> list = productConfigService.obtainProductsAccordingToTheScheme(id, isRelease); |
|
||||||
if (list.size() > 0) { |
|
||||||
partnerSchemeManagement.setProductList(list); |
|
||||||
|
|
||||||
} |
|
||||||
return R.ok().put("data", partnerSchemeManagement); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/save") |
|
||||||
@ApiOperation(value = "新增", response = PartnerSchemeManagement.class) |
|
||||||
public R save(@RequestBody @ApiParam(name = "合伙人——方案管理对象", value = "传入json格式", required = true) PartnerSchemeManagement partnerSchemeManagement, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
partnerSchemeManagement.setFounderId(Integer.parseInt(accountId)); |
|
||||||
partnerSchemeManagement.setEditorId(Integer.parseInt(accountId)); |
|
||||||
boolean addState = service.save(partnerSchemeManagement); |
|
||||||
if (partnerSchemeManagement.getProductList().size() > 0) { |
|
||||||
//新增到产品配置表
|
|
||||||
for (PartnerSchemeManagementProductConfig productConfig : partnerSchemeManagement.getProductList()) { |
|
||||||
productConfig.setSchemeId(partnerSchemeManagement.getId()); |
|
||||||
productConfigService.save(productConfig); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
return addState ? R.ok() : R.error("新增失败"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/update") |
|
||||||
@ApiOperation(value = "修改", response = PartnerSchemeManagement.class) |
|
||||||
public R update(@RequestBody @ApiParam(name = "合伙人——方案管理对象", value = "传入json格式", required = true) PartnerSchemeManagement partnerSchemeManagement, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
partnerSchemeManagement.setEditorId(Integer.parseInt(accountId)); |
|
||||||
|
|
||||||
LambdaQueryWrapper<PartnerSchemeManagementProductConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
||||||
lambdaQueryWrapper.eq(PartnerSchemeManagementProductConfig::getSchemeId, partnerSchemeManagement.getId()); |
|
||||||
productConfigService.remove(lambdaQueryWrapper); |
|
||||||
|
|
||||||
if (partnerSchemeManagement.getProductList().size() > 0) { |
|
||||||
//新增到产品配置表
|
|
||||||
for (PartnerSchemeManagementProductConfig productConfig : partnerSchemeManagement.getProductList()) { |
|
||||||
productConfigService.save(productConfig); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
boolean updateState = service.updateById(partnerSchemeManagement); |
|
||||||
return updateState ? R.ok() : R.error("编辑失败"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/delete") |
|
||||||
@ApiOperation(value = "删除", response = PartnerSchemeManagement.class) |
|
||||||
public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { |
|
||||||
boolean delState = service.removeById(id); |
|
||||||
return delState ? R.ok() : R.error("删除失败"); |
|
||||||
} |
|
||||||
|
|
||||||
@PostMapping("/batchDeletion") |
|
||||||
@ApiOperation(value = "批量删除", response = PartnerSchemeManagement.class) |
|
||||||
public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestParam List<Integer> ids) { |
|
||||||
boolean delState = service.removeByIds(ids); |
|
||||||
return delState ? R.ok() : R.error("删除失败"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/enableOrDisable") |
|
||||||
@ApiOperation(value = "启用禁用", response = PartnerSchemeManagement.class) |
|
||||||
public R enableOrDisable(@ApiParam(name = "id", value = "id", required = true) @RequestParam Integer id, |
|
||||||
@ApiParam(name = "isDisable", value = "是否禁用(0默认,0启用 1禁用)", required = true) @RequestParam Integer isDisable) { |
|
||||||
UpdateWrapper<PartnerSchemeManagement> updateWrapper = new UpdateWrapper<PartnerSchemeManagement>(); |
|
||||||
updateWrapper.set("is_disable", isDisable); |
|
||||||
updateWrapper.eq("id", id); |
|
||||||
boolean ret = service.update(new PartnerSchemeManagement(), updateWrapper); |
|
||||||
return ret ? R.ok() : R.error("禁用/启用失败"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
/*@PostMapping("/modifiedArticleSort") |
|
||||||
@ApiOperation(value = "修改文章排序", response = PartnerSchemeManagement.class) |
|
||||||
public R modifiedSort(@RequestBody List<ArticleModifiedSortReq> reqList) { |
|
||||||
return service.modifiedSort(reqList); |
|
||||||
}*/ |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,61 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import com.huoran.nakadai.entity.PartnerSchemeManagementProductConfig; |
|
||||||
import com.huoran.nakadai.service.PartnerSchemeManagementProductConfigService; |
|
||||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||||
import com.huoran.api.UserClient; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import io.swagger.annotations.*; |
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.apache.commons.lang.StringUtils; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
import org.springframework.web.bind.annotation.PostMapping; |
|
||||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||||
import org.springframework.web.bind.annotation.RestController; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import org.springframework.web.bind.annotation.RequestParam; |
|
||||||
import io.swagger.annotations.ApiImplicitParam; |
|
||||||
import io.swagger.annotations.ApiImplicitParams; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
|
|
||||||
import java.util.List; |
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RestController; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 合伙人——方案管理——产品配置表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2023-06-28 |
|
||||||
*/ |
|
||||||
|
|
||||||
/** |
|
||||||
* @描述:合伙人——方案管理——产品配置表控制类 |
|
||||||
* @作者: Rong |
|
||||||
* @日期: 2023-06-28 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/partnerSchemeManagementProductConfig") |
|
||||||
@Api(value = "合伙人——方案管理——产品配置表:PartnerSchemeManagementProductConfigController", tags = "R-合伙人——方案管理——产品配置表") |
|
||||||
public class PartnerSchemeManagementProductConfigController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public PartnerSchemeManagementProductConfigService service; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private UserClient userClient; |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/batchDeletion") |
|
||||||
@ApiOperation(value = "批量删除", response = PartnerSchemeManagementProductConfig.class) |
|
||||||
public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestBody List<Integer> ids) { |
|
||||||
boolean delState = service.removeByIds(ids); |
|
||||||
return delState ? R.ok() : R.error("删除失败"); |
|
||||||
} |
|
||||||
} |
|
@ -1,199 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
||||||
import com.huoran.api.UserClient; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.PartnerAccount; |
|
||||||
import com.huoran.nakadai.entity.PartnerClassification; |
|
||||||
import com.huoran.nakadai.entity.PartnerTeam; |
|
||||||
import com.huoran.nakadai.entity.req.EditProvinceCityReq; |
|
||||||
import com.huoran.nakadai.entity.req.PartnerTeamRateReq; |
|
||||||
import com.huoran.nakadai.entity.vo.CheckVo; |
|
||||||
import com.huoran.nakadai.service.PartnerAccountService; |
|
||||||
import com.huoran.nakadai.service.PartnerClassificationService; |
|
||||||
import com.huoran.nakadai.service.PartnerTeamService; |
|
||||||
import com.huoran.nakadai.service.impl.PartnerAccountServiceImpl; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.apache.commons.lang3.StringUtils; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import javax.validation.Valid; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 合伙人团队表(合伙人账号与分类中间表) 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2022-05-18 |
|
||||||
*/ |
|
||||||
@Api(tags = "团队管理") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/partner-team") |
|
||||||
public class PartnerTeamController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public PartnerTeamService partnerTeamService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public PartnerAccountService accountService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public PartnerAccountServiceImpl accountServiceImpl; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public PartnerClassificationService classificationService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private UserClient userClient; |
|
||||||
|
|
||||||
/*@ApiOperation(value = "团队成员列表") |
|
||||||
@GetMapping(value = "/teamList") |
|
||||||
public R teamList( |
|
||||||
@ApiParam(name = "id", value = "团队id", required = true) |
|
||||||
@RequestParam String id, |
|
||||||
@ApiParam(name = "current", value = "当前页码", required = true) |
|
||||||
@RequestParam int current, |
|
||||||
@ApiParam(name = "pageSize", value = "每页记录数", required = true) |
|
||||||
@RequestParam int pageSize, |
|
||||||
@ApiParam(name = "name", value = "成员名称", required = false) |
|
||||||
@RequestParam(value = "name") String name){ |
|
||||||
List<PartnerAccountResp> teamList = partnerTeamService.selectTeamList(id,current,pageSize,name); |
|
||||||
return R.ok().put("teamList",teamList); |
|
||||||
}*/ |
|
||||||
|
|
||||||
@ApiOperation(value = "我的") |
|
||||||
@GetMapping(value = "/my") |
|
||||||
public R my( |
|
||||||
@ApiParam(name = "partnerId", value = "商务经理id", required = false) |
|
||||||
@RequestParam(required = false) String partnerId, |
|
||||||
@ApiParam(name = "teamId", value = "团队id", required = false) |
|
||||||
@RequestParam(required = false) String teamId, HttpServletRequest request){ |
|
||||||
int platformId = 3; |
|
||||||
if (StringUtils.isNotEmpty(partnerId)||StringUtils.isNotEmpty(teamId)){ |
|
||||||
platformId = 4; |
|
||||||
} |
|
||||||
String id = TokenUtils.getIdByJwtToken(request); |
|
||||||
String phone = partnerTeamService.getPhone(id,platformId); |
|
||||||
|
|
||||||
return partnerTeamService.queryUserInfoByPhone(phone,partnerId,teamId); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "查询手机号用户") |
|
||||||
@GetMapping(value = "/queryUserInfoByPhone") |
|
||||||
public R queryUserInfoByPhone( |
|
||||||
@ApiParam(name = "phone", value = "手机号", required = true) |
|
||||||
@RequestParam String phone ){ |
|
||||||
return partnerTeamService.queryPhone(phone); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "更新邮箱") |
|
||||||
@PostMapping("/updateMyEmail") |
|
||||||
public R updateMyEmail(@RequestBody CheckVo checkVo, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
checkVo.setAccountId(accountId); |
|
||||||
return partnerTeamService.updateMyEmail(checkVo); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "邮箱验证码发送") |
|
||||||
@PostMapping("/mailCodeSend") |
|
||||||
public R mailCodeSend(@RequestBody CheckVo checkVo, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
checkVo.setAccountId(accountId); |
|
||||||
boolean send = partnerTeamService.mailCodeSend(checkVo); |
|
||||||
return send ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "编辑合伙人信息") |
|
||||||
@PostMapping("/editProvinceCity") |
|
||||||
public R editProvinceCity(@RequestBody @Valid EditProvinceCityReq provinceCityReq) { |
|
||||||
if (provinceCityReq.getUserName()!=null){ |
|
||||||
boolean res = partnerTeamService.checkName(provinceCityReq); |
|
||||||
if (res){ |
|
||||||
return R.error("合伙人姓名已存在!"); |
|
||||||
} |
|
||||||
//修改用户姓名
|
|
||||||
partnerTeamService.editUsername(provinceCityReq); |
|
||||||
} |
|
||||||
//更新角色
|
|
||||||
if (provinceCityReq.getRoleList() != null) { |
|
||||||
//团队成员不能赋予超管角色
|
|
||||||
if (provinceCityReq.getIsTeam()!=null && provinceCityReq.getIsTeam()!=1){ |
|
||||||
for (Integer integer : provinceCityReq.getRoleList()) { |
|
||||||
//测试|正式
|
|
||||||
if (integer==172||integer==123){ |
|
||||||
return R.error("团体成员无法设置超管角色!"); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
// 负责人角色从未认证改为超管后,成员未认证修改
|
|
||||||
if (provinceCityReq.getRoleName()!=null && provinceCityReq.getRoleName().contains("未认证")){ |
|
||||||
QueryWrapper<PartnerClassification> queryWrapper = new QueryWrapper<>(); |
|
||||||
queryWrapper.eq("parent_id",provinceCityReq.getClassificationId()); |
|
||||||
queryWrapper.eq("is_team",0); |
|
||||||
List<PartnerClassification> list = classificationService.list(queryWrapper); |
|
||||||
for (PartnerClassification partnerClassification : list) { |
|
||||||
QueryWrapper<PartnerTeam> teamQueryWrapper = new QueryWrapper<>(); |
|
||||||
teamQueryWrapper.eq("classification_id",partnerClassification.getId()); |
|
||||||
PartnerTeam one = partnerTeamService.getOne(teamQueryWrapper); |
|
||||||
PartnerAccount partnerAccount = accountService.getById(one.getPartnerId()); |
|
||||||
|
|
||||||
//删除该账号在所在团队的角色
|
|
||||||
partnerTeamService.delRoleByAccountIdAndTeamId(partnerAccount.getAccountId(),partnerClassification.getId()); |
|
||||||
//账号赋予团队成员角色
|
|
||||||
accountServiceImpl.assignTeamMemberRoles(partnerAccount.getAccountId(),0,partnerClassification.getId()); |
|
||||||
} |
|
||||||
} |
|
||||||
//删除该账号在所在团队的角色
|
|
||||||
partnerTeamService.delRoleByAccountIdAndTeamId(provinceCityReq.getAccountId(),provinceCityReq.getClassificationId()); |
|
||||||
//账号赋予所在团队角色
|
|
||||||
userClient.rolePermissionService(provinceCityReq.getAccountId(), provinceCityReq.getRoleList(),provinceCityReq.getClassificationId()); |
|
||||||
} |
|
||||||
if (provinceCityReq.getProvinceId()!=null||provinceCityReq.getCityId()!=null){ |
|
||||||
//更新省份城市
|
|
||||||
UpdateWrapper<PartnerTeam> updateWrapper = new UpdateWrapper<>(); |
|
||||||
updateWrapper.set("province_id",provinceCityReq.getProvinceId()); |
|
||||||
updateWrapper.set("city_id",provinceCityReq.getCityId()); |
|
||||||
updateWrapper.eq("classification_id",provinceCityReq.getClassificationId()); |
|
||||||
updateWrapper.eq("partner_id",provinceCityReq.getPartnerId()); |
|
||||||
partnerTeamService.update(new PartnerTeam(), updateWrapper); |
|
||||||
} |
|
||||||
return R.ok(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "编辑合伙人团队费率") |
|
||||||
@PostMapping("/editPartnerTeamRates") |
|
||||||
public R editPartnerTeamRates(@RequestBody @Valid PartnerTeamRateReq teamRateReq) { |
|
||||||
//更新费率
|
|
||||||
UpdateWrapper<PartnerTeam> updateWrapper = new UpdateWrapper<>(); |
|
||||||
/* if (teamRateReq.getAnnualTeamFee()!=null){ |
|
||||||
}*/ |
|
||||||
updateWrapper.set("annual_team_fee",teamRateReq.getAnnualTeamFee()); |
|
||||||
updateWrapper.set("annual_marketing_fee",teamRateReq.getAnnualMarketingFee()); |
|
||||||
// if (teamRateReq.getAnnualMarketingFee()!=null){
|
|
||||||
// }
|
|
||||||
updateWrapper.eq("classification_id",teamRateReq.getTeamId()); |
|
||||||
updateWrapper.eq("partner_id",teamRateReq.getPartnerId()); |
|
||||||
boolean update = partnerTeamService.update(new PartnerTeam(), updateWrapper); |
|
||||||
return update ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "查询合伙人团队费率") |
|
||||||
@PostMapping("/getPartnerTeamRates") |
|
||||||
public R getPartnerTeamRates(@RequestBody @Valid PartnerTeamRateReq teamRateReq) { |
|
||||||
QueryWrapper<PartnerTeam> queryWrapper = new QueryWrapper<>(); |
|
||||||
queryWrapper.eq("classification_id",teamRateReq.getTeamId()); |
|
||||||
PartnerTeam one = partnerTeamService.getOne(queryWrapper); |
|
||||||
return R.ok().put("teamRates",one); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -0,0 +1,97 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.nakadai.controller; |
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.huoran.common.exception.YamiShopBindException; |
||||||
|
import com.huoran.common.response.ResponseEnum; |
||||||
|
import com.huoran.common.response.ServerResponseEntity; |
||||||
|
import com.huoran.common.utils.TokenUtils; |
||||||
|
import com.huoran.nakadai.entity.model.PickAddr; |
||||||
|
|
||||||
|
import com.huoran.nakadai.service.PickAddrService; |
||||||
|
import com.huoran.nakadai.utils.PageParam; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import javax.validation.Valid; |
||||||
|
import java.util.Arrays; |
||||||
|
import java.util.Objects; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* @author lgh on 2018/10/17. |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequestMapping("/shop/pickAddr") |
||||||
|
public class PickAddrController { |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private PickAddrService pickAddrService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页获取 |
||||||
|
*/ |
||||||
|
@GetMapping("/page") |
||||||
|
public ServerResponseEntity<IPage<PickAddr>> page(PickAddr pickAddr, PageParam<PickAddr> page){ |
||||||
|
IPage<PickAddr> pickAddrs = pickAddrService.page(page,new LambdaQueryWrapper<PickAddr>() |
||||||
|
.like(StrUtil.isNotBlank(pickAddr.getAddrName()),PickAddr::getAddrName,pickAddr.getAddrName()) |
||||||
|
.orderByDesc(PickAddr::getAddrId)); |
||||||
|
return ServerResponseEntity.success(pickAddrs); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取信息 |
||||||
|
*/ |
||||||
|
@GetMapping("/info/{id}") |
||||||
|
public ServerResponseEntity<PickAddr> info(@PathVariable("id") Long id){ |
||||||
|
PickAddr pickAddr = pickAddrService.getById(id); |
||||||
|
return ServerResponseEntity.success(pickAddr); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 保存 |
||||||
|
*/ |
||||||
|
@PostMapping |
||||||
|
public ServerResponseEntity<Void> save(@Valid @RequestBody PickAddr pickAddr,HttpServletRequest request){ |
||||||
|
pickAddr.setShopId(TokenUtils.getShopIdByJwtToken(request)); |
||||||
|
pickAddrService.save(pickAddr); |
||||||
|
return ServerResponseEntity.success(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改 |
||||||
|
*/ |
||||||
|
@PutMapping |
||||||
|
public ServerResponseEntity<Void> update(@Valid @RequestBody PickAddr pickAddr, HttpServletRequest request){ |
||||||
|
PickAddr dbPickAddr = pickAddrService.getById(pickAddr.getAddrId()); |
||||||
|
|
||||||
|
if (!Objects.equals(dbPickAddr.getShopId(), TokenUtils.getShopIdByJwtToken(request))) { |
||||||
|
throw new YamiShopBindException(ResponseEnum.UNAUTHORIZED); |
||||||
|
} |
||||||
|
pickAddrService.updateById(pickAddr); |
||||||
|
return ServerResponseEntity.success(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除 |
||||||
|
*/ |
||||||
|
@DeleteMapping |
||||||
|
public ServerResponseEntity<Void> delete(@RequestBody Long[] ids){ |
||||||
|
pickAddrService.removeByIds(Arrays.asList(ids)); |
||||||
|
return ServerResponseEntity.success(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,90 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.nakadai.controller; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.huoran.common.response.ServerResponseEntity; |
||||||
|
import com.huoran.nakadai.entity.model.ProdComm; |
||||||
|
import com.huoran.nakadai.service.ProdCommService; |
||||||
|
import com.huoran.nakadai.utils.PageParam; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.validation.Valid; |
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* 商品评论 |
||||||
|
* |
||||||
|
* @author xwc |
||||||
|
* @date 2019-04-19 10:43:57 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@AllArgsConstructor |
||||||
|
@RequestMapping("/prod/prodComm" ) |
||||||
|
public class ProdCommController { |
||||||
|
|
||||||
|
private final ProdCommService prodCommService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询 |
||||||
|
* @param page 分页对象 |
||||||
|
* @param prodComm 商品评论 |
||||||
|
* @return 分页数据 |
||||||
|
*/ |
||||||
|
@GetMapping("/page" ) |
||||||
|
public ServerResponseEntity<IPage<ProdComm>> getProdCommPage(PageParam page, ProdComm prodComm) { |
||||||
|
return ServerResponseEntity.success(prodCommService.getProdCommPage(page,prodComm)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id查询商品评论 |
||||||
|
* @param prodCommId id |
||||||
|
* @return 单个数据 |
||||||
|
*/ |
||||||
|
@GetMapping("/info/{prodCommId}" ) |
||||||
|
public ServerResponseEntity<ProdComm> getById(@PathVariable("prodCommId" ) Long prodCommId) { |
||||||
|
return ServerResponseEntity.success(prodCommService.getById(prodCommId)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增商品评论 |
||||||
|
* @param prodComm 商品评论 |
||||||
|
* @return 是否新增成功 |
||||||
|
*/ |
||||||
|
@PostMapping |
||||||
|
public ServerResponseEntity<Boolean> save(@RequestBody @Valid ProdComm prodComm) { |
||||||
|
return ServerResponseEntity.success(prodCommService.save(prodComm)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改商品评论 |
||||||
|
* @param prodComm 商品评论 |
||||||
|
* @return 是否修改成功 |
||||||
|
*/ |
||||||
|
@PutMapping |
||||||
|
public ServerResponseEntity<Boolean> updateById(@RequestBody @Valid ProdComm prodComm) { |
||||||
|
prodComm.setReplyTime(new Date()); |
||||||
|
return ServerResponseEntity.success(prodCommService.updateById(prodComm)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id删除商品评论 |
||||||
|
* @param prodCommId id |
||||||
|
* @return 是否删除成功 |
||||||
|
*/ |
||||||
|
@DeleteMapping("/{prodCommId}" ) |
||||||
|
public ServerResponseEntity<Boolean> removeById(@PathVariable Long prodCommId) { |
||||||
|
return ServerResponseEntity.success(prodCommService.removeById(prodCommId)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,132 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.nakadai.controller; |
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.huoran.common.exception.YamiShopBindException; |
||||||
|
import com.huoran.common.response.ServerResponseEntity; |
||||||
|
import com.huoran.common.utils.TokenUtils; |
||||||
|
import com.huoran.nakadai.entity.model.ProdTag; |
||||||
|
import com.huoran.nakadai.service.ProdTagService; |
||||||
|
import com.huoran.nakadai.utils.PageParam; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import javax.validation.Valid; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* 商品分组 |
||||||
|
* |
||||||
|
* @author hzm |
||||||
|
* @date 2019-04-18 09:08:36 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequestMapping("/prod/prodTag") |
||||||
|
public class ProdTagController { |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private ProdTagService prodTagService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询 |
||||||
|
* |
||||||
|
* @param page 分页对象 |
||||||
|
* @param prodTag 商品分组标签 |
||||||
|
* @return 分页数据 |
||||||
|
*/ |
||||||
|
@GetMapping("/page") |
||||||
|
public ServerResponseEntity<IPage<ProdTag>> getProdTagPage(PageParam<ProdTag> page, ProdTag prodTag) { |
||||||
|
IPage<ProdTag> tagPage = prodTagService.page( |
||||||
|
page, new LambdaQueryWrapper<ProdTag>() |
||||||
|
.eq(prodTag.getStatus() != null, ProdTag::getStatus, prodTag.getStatus()) |
||||||
|
.like(prodTag.getTitle() != null, ProdTag::getTitle, prodTag.getTitle()) |
||||||
|
.orderByDesc(ProdTag::getSeq, ProdTag::getCreateTime)); |
||||||
|
return ServerResponseEntity.success(tagPage); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id查询商品分组标签 |
||||||
|
* |
||||||
|
* @param id id |
||||||
|
* @return 单个数据 |
||||||
|
*/ |
||||||
|
@GetMapping("/info/{id}") |
||||||
|
public ServerResponseEntity<ProdTag> getById(@PathVariable("id") Long id) { |
||||||
|
return ServerResponseEntity.success(prodTagService.getById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增商品分组标签 |
||||||
|
* |
||||||
|
* @param prodTag 商品分组标签 |
||||||
|
* @return 是否新增成功 |
||||||
|
*/ |
||||||
|
@PostMapping |
||||||
|
public ServerResponseEntity<Boolean> save(@RequestBody @Valid ProdTag prodTag, HttpServletRequest request) { |
||||||
|
// 查看是否相同的标签
|
||||||
|
List<ProdTag> list = prodTagService.list(new LambdaQueryWrapper<ProdTag>().like(ProdTag::getTitle, prodTag.getTitle())); |
||||||
|
if (CollectionUtil.isNotEmpty(list)) { |
||||||
|
throw new YamiShopBindException("标签名称已存在,不能添加相同的标签"); |
||||||
|
} |
||||||
|
prodTag.setIsDefault(0); |
||||||
|
prodTag.setProdCount(0L); |
||||||
|
prodTag.setCreateTime(new Date()); |
||||||
|
prodTag.setUpdateTime(new Date()); |
||||||
|
prodTag.setShopId(TokenUtils.getShopIdByJwtToken(request)); |
||||||
|
prodTagService.removeProdTag(); |
||||||
|
return ServerResponseEntity.success(prodTagService.save(prodTag)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改商品分组标签 |
||||||
|
* |
||||||
|
* @param prodTag 商品分组标签 |
||||||
|
* @return 是否修改成功 |
||||||
|
*/ |
||||||
|
@PutMapping |
||||||
|
public ServerResponseEntity<Boolean> updateById(@RequestBody @Valid ProdTag prodTag) { |
||||||
|
prodTag.setUpdateTime(new Date()); |
||||||
|
prodTagService.removeProdTag(); |
||||||
|
return ServerResponseEntity.success(prodTagService.updateById(prodTag)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id删除商品分组标签 |
||||||
|
* |
||||||
|
* @param id id |
||||||
|
* @return 是否删除成功 |
||||||
|
*/ |
||||||
|
@DeleteMapping("/{id}") |
||||||
|
public ServerResponseEntity<Boolean> removeById(@PathVariable Long id) { |
||||||
|
ProdTag prodTag = prodTagService.getById(id); |
||||||
|
if (prodTag.getIsDefault() != 0) { |
||||||
|
throw new YamiShopBindException("默认标签不能删除"); |
||||||
|
} |
||||||
|
prodTagService.removeProdTag(); |
||||||
|
return ServerResponseEntity.success(prodTagService.removeById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/listTagList") |
||||||
|
public ServerResponseEntity<List<ProdTag>> listTagList() { |
||||||
|
return ServerResponseEntity.success(prodTagService.listProdTag()); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,90 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.nakadai.controller; |
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.huoran.common.response.ServerResponseEntity; |
||||||
|
import com.huoran.nakadai.entity.model.ProdTagReference; |
||||||
|
import com.huoran.nakadai.service.ProdTagReferenceService; |
||||||
|
import com.huoran.nakadai.utils.PageParam; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.validation.Valid; |
||||||
|
|
||||||
|
/** |
||||||
|
* 分组标签引用 |
||||||
|
* |
||||||
|
* @author hzm |
||||||
|
* @date 2019-04-18 16:28:01 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@AllArgsConstructor |
||||||
|
@RequestMapping("/generator/prodTagReference" ) |
||||||
|
public class ProdTagReferenceController { |
||||||
|
|
||||||
|
private final ProdTagReferenceService prodTagReferenceService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询 |
||||||
|
* @param page 分页对象 |
||||||
|
* @param prodTagReference 分组标签引用 |
||||||
|
* @return 分页数据 |
||||||
|
*/ |
||||||
|
@GetMapping("/page" ) |
||||||
|
public ServerResponseEntity<IPage<ProdTagReference>> getProdTagReferencePage(PageParam page, ProdTagReference prodTagReference) { |
||||||
|
return ServerResponseEntity.success(prodTagReferenceService.page(page, new LambdaQueryWrapper<ProdTagReference>())); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id查询分组标签引用 |
||||||
|
* @param referenceId id |
||||||
|
* @return 单个数据 |
||||||
|
*/ |
||||||
|
@GetMapping("/info/{referenceId}" ) |
||||||
|
public ServerResponseEntity<ProdTagReference> getById(@PathVariable("referenceId" ) Long referenceId) { |
||||||
|
return ServerResponseEntity.success(prodTagReferenceService.getById(referenceId)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增分组标签引用 |
||||||
|
* @param prodTagReference 分组标签引用 |
||||||
|
* @return 是否新增成功 |
||||||
|
*/ |
||||||
|
@PostMapping |
||||||
|
public ServerResponseEntity<Boolean> save(@RequestBody @Valid ProdTagReference prodTagReference) { |
||||||
|
return ServerResponseEntity.success(prodTagReferenceService.save(prodTagReference)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改分组标签引用 |
||||||
|
* @param prodTagReference 分组标签引用 |
||||||
|
* @return 是否修改成功 |
||||||
|
*/ |
||||||
|
@PutMapping |
||||||
|
public ServerResponseEntity<Boolean> updateById(@RequestBody @Valid ProdTagReference prodTagReference) { |
||||||
|
return ServerResponseEntity.success(prodTagReferenceService.updateById(prodTagReference)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过id删除分组标签引用 |
||||||
|
* @param referenceId id |
||||||
|
* @return 是否删除成功 |
||||||
|
*/ |
||||||
|
@DeleteMapping("/{referenceId}" ) |
||||||
|
public ServerResponseEntity<Boolean> removeById(@PathVariable Long referenceId) { |
||||||
|
return ServerResponseEntity.success(prodTagReferenceService.removeById(referenceId)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -1,76 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil; |
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.nakadai.entity.ProductClassification; |
|
||||||
import com.huoran.nakadai.service.ProductClassificationService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 产品分类表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2023-04-25 |
|
||||||
*/ |
|
||||||
@Api(value = "M-商品产品分类管理", tags = "M-商品产品分类管理") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/productClassification") |
|
||||||
public class ProductClassificationController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private ProductClassificationService classificationService; |
|
||||||
|
|
||||||
@ApiOperation(value = "添加产品分类") |
|
||||||
@PostMapping("/addProductCategory") |
|
||||||
public R addProductCategory( |
|
||||||
@ApiParam(name = "classificationName", value = "分类名称", required = true) |
|
||||||
@RequestParam String classificationName) { |
|
||||||
//名称判重
|
|
||||||
QueryWrapper<ProductClassification> queryWrapper = new QueryWrapper<>(); |
|
||||||
queryWrapper.eq("classification_name",classificationName); |
|
||||||
ProductClassification one = classificationService.getOne(queryWrapper); |
|
||||||
if (ObjectUtil.isNotNull(one)){ |
|
||||||
return R.error("产品分类已存在!"); |
|
||||||
} |
|
||||||
//新增产品分类
|
|
||||||
ProductClassification classification = new ProductClassification(); |
|
||||||
classification.setClassificationName(classificationName); |
|
||||||
boolean save = classificationService.save(classification); |
|
||||||
return save ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "产品分类列表") |
|
||||||
@GetMapping("/productCategoryList") |
|
||||||
public R productCategoryList( |
|
||||||
@ApiParam(name = "search", value = "查询条件",required = false) |
|
||||||
@RequestParam(required = false) String search) { |
|
||||||
QueryWrapper<ProductClassification> queryWrapper = new QueryWrapper<>(); |
|
||||||
if (search!=null){ |
|
||||||
queryWrapper.like("classification_name",search); |
|
||||||
} |
|
||||||
List<ProductClassification> classificationList = classificationService.list(queryWrapper); |
|
||||||
return R.ok().put("classificationList",classificationList); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "删除产品分类") |
|
||||||
@PostMapping("/deleteProductCategory") |
|
||||||
public R deleteProductCategory( |
|
||||||
@ApiParam(name = "categoryId", value = "分类id", required = true) |
|
||||||
@RequestParam Integer categoryId) { |
|
||||||
boolean remove = classificationService.removeById(categoryId); |
|
||||||
return remove ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -0,0 +1,229 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.nakadai.controller; |
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil; |
||||||
|
import cn.hutool.core.collection.CollectionUtil; |
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.huoran.common.exception.YamiShopBindException; |
||||||
|
import com.huoran.common.response.ServerResponseEntity; |
||||||
|
import com.huoran.common.utils.TokenUtils; |
||||||
|
import com.huoran.nakadai.entity.model.Product; |
||||||
|
import com.huoran.nakadai.entity.model.Sku; |
||||||
|
import com.huoran.nakadai.entity.param.ProductParam; |
||||||
|
import com.huoran.nakadai.service.BasketService; |
||||||
|
import com.huoran.nakadai.service.ProdTagReferenceService; |
||||||
|
import com.huoran.nakadai.service.ProductService; |
||||||
|
import com.huoran.nakadai.service.SkuService; |
||||||
|
import com.huoran.nakadai.utils.Json; |
||||||
|
import com.huoran.nakadai.utils.PageParam; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import javax.validation.Valid; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Objects; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 商品列表、商品发布controller |
||||||
|
* |
||||||
|
* @author lgh |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequestMapping("/prod/prod") |
||||||
|
public class ProductController { |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private ProductService productService; |
||||||
|
|
||||||
|
|
||||||
|
@Autowired |
||||||
|
private SkuService skuService; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private ProdTagReferenceService prodTagReferenceService; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private BasketService basketService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页获取商品信息 |
||||||
|
*/ |
||||||
|
@GetMapping("/page") |
||||||
|
public ServerResponseEntity<IPage<Product>> page(ProductParam product, PageParam<Product> page,HttpServletRequest request) { |
||||||
|
IPage<Product> products = productService.page(page, |
||||||
|
new LambdaQueryWrapper<Product>() |
||||||
|
.like(StrUtil.isNotBlank(product.getProdName()), Product::getProdName, product.getProdName()) |
||||||
|
.eq(Product::getShopId, TokenUtils.getShopIdByJwtToken(request)) |
||||||
|
.eq(product.getStatus() != null, Product::getStatus, product.getStatus()) |
||||||
|
.orderByDesc(Product::getPutawayTime)); |
||||||
|
return ServerResponseEntity.success(products); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取信息 |
||||||
|
*/ |
||||||
|
@GetMapping("/info/{prodId}") |
||||||
|
public ServerResponseEntity<Product> info(@PathVariable("prodId") Long prodId, HttpServletRequest request) { |
||||||
|
Product prod = productService.getProductByProdId(prodId); |
||||||
|
if (!Objects.equals(prod.getShopId(), TokenUtils.getShopIdByJwtToken(request))) { |
||||||
|
throw new YamiShopBindException("没有权限获取该商品规格信息"); |
||||||
|
} |
||||||
|
List<Sku> skuList = skuService.listByProdId(prodId); |
||||||
|
prod.setSkuList(skuList); |
||||||
|
|
||||||
|
//获取分组标签
|
||||||
|
List<Long> listTagId = prodTagReferenceService.listTagIdByProdId(prodId); |
||||||
|
prod.setTagList(listTagId); |
||||||
|
return ServerResponseEntity.success(prod); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 保存 |
||||||
|
*/ |
||||||
|
@PostMapping |
||||||
|
public ServerResponseEntity<String> save(@Valid @RequestBody ProductParam productParam,HttpServletRequest request) { |
||||||
|
checkParam(productParam); |
||||||
|
|
||||||
|
Product product = BeanUtil.copyProperties(productParam, Product.class); |
||||||
|
product.setDeliveryMode(Json.toJsonString(productParam.getDeliveryModeVo())); |
||||||
|
product.setShopId(TokenUtils.getShopIdByJwtToken(request)); |
||||||
|
product.setUpdateTime(new Date()); |
||||||
|
if (product.getStatus() == 1) { |
||||||
|
product.setPutawayTime(new Date()); |
||||||
|
} |
||||||
|
product.setCreateTime(new Date()); |
||||||
|
productService.saveProduct(product); |
||||||
|
return ServerResponseEntity.success(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改 |
||||||
|
*/ |
||||||
|
@PutMapping |
||||||
|
public ServerResponseEntity<String> update(@Valid @RequestBody ProductParam productParam,HttpServletRequest request) { |
||||||
|
checkParam(productParam); |
||||||
|
Product dbProduct = productService.getProductByProdId(productParam.getProdId()); |
||||||
|
if (!Objects.equals(dbProduct.getShopId(), TokenUtils.getShopIdByJwtToken(request))) { |
||||||
|
return ServerResponseEntity.showFailMsg("无法修改非本店铺商品信息"); |
||||||
|
} |
||||||
|
|
||||||
|
List<Sku> dbSkus = skuService.listByProdId(dbProduct.getProdId()); |
||||||
|
|
||||||
|
|
||||||
|
Product product = BeanUtil.copyProperties(productParam, Product.class); |
||||||
|
product.setDeliveryMode(Json.toJsonString(productParam.getDeliveryModeVo())); |
||||||
|
product.setUpdateTime(new Date()); |
||||||
|
|
||||||
|
if (dbProduct.getStatus() == 0 || productParam.getStatus() == 1) { |
||||||
|
product.setPutawayTime(new Date()); |
||||||
|
} |
||||||
|
dbProduct.setSkuList(dbSkus); |
||||||
|
productService.updateProduct(product, dbProduct); |
||||||
|
|
||||||
|
|
||||||
|
List<String> userIds = basketService.listUserIdByProdId(product.getProdId()); |
||||||
|
|
||||||
|
for (String userId : userIds) { |
||||||
|
basketService.removeShopCartItemsCacheByUserId(userId); |
||||||
|
} |
||||||
|
for (Sku sku : dbSkus) { |
||||||
|
skuService.removeSkuCacheBySkuId(sku.getSkuId(), sku.getProdId()); |
||||||
|
} |
||||||
|
return ServerResponseEntity.success(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除 |
||||||
|
*/ |
||||||
|
public ServerResponseEntity<Void> delete(Long prodId,HttpServletRequest request) { |
||||||
|
Product dbProduct = productService.getProductByProdId(prodId); |
||||||
|
if (!Objects.equals(dbProduct.getShopId(), TokenUtils.getShopIdByJwtToken(request))) { |
||||||
|
throw new YamiShopBindException("无法获取非本店铺商品信息"); |
||||||
|
} |
||||||
|
List<Sku> dbSkus = skuService.listByProdId(dbProduct.getProdId()); |
||||||
|
// 删除商品
|
||||||
|
productService.removeProductByProdId(prodId); |
||||||
|
|
||||||
|
for (Sku sku : dbSkus) { |
||||||
|
skuService.removeSkuCacheBySkuId(sku.getSkuId(), sku.getProdId()); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
List<String> userIds = basketService.listUserIdByProdId(prodId); |
||||||
|
|
||||||
|
for (String userId : userIds) { |
||||||
|
basketService.removeShopCartItemsCacheByUserId(userId); |
||||||
|
} |
||||||
|
|
||||||
|
return ServerResponseEntity.success(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 批量删除 |
||||||
|
*/ |
||||||
|
@DeleteMapping |
||||||
|
public ServerResponseEntity<Void> batchDelete(@RequestBody Long[] prodIds,HttpServletRequest request) { |
||||||
|
for (Long prodId : prodIds) { |
||||||
|
delete(prodId,request); |
||||||
|
} |
||||||
|
return ServerResponseEntity.success(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新商品状态 |
||||||
|
*/ |
||||||
|
@PutMapping("/prodStatus") |
||||||
|
public ServerResponseEntity<Void> shopStatus(@RequestParam Long prodId, @RequestParam Integer prodStatus) { |
||||||
|
Product product = new Product(); |
||||||
|
product.setProdId(prodId); |
||||||
|
product.setStatus(prodStatus); |
||||||
|
if (prodStatus == 1) { |
||||||
|
product.setPutawayTime(new Date()); |
||||||
|
} |
||||||
|
productService.updateById(product); |
||||||
|
productService.removeProductCacheByProdId(prodId); |
||||||
|
List<String> userIds = basketService.listUserIdByProdId(prodId); |
||||||
|
|
||||||
|
for (String userId : userIds) { |
||||||
|
basketService.removeShopCartItemsCacheByUserId(userId); |
||||||
|
} |
||||||
|
return ServerResponseEntity.success(); |
||||||
|
} |
||||||
|
|
||||||
|
private void checkParam(ProductParam productParam) { |
||||||
|
if (CollectionUtil.isEmpty(productParam.getTagList())) { |
||||||
|
throw new YamiShopBindException("请选择产品分组"); |
||||||
|
} |
||||||
|
|
||||||
|
Product.DeliveryModeVO deliveryMode = productParam.getDeliveryModeVo(); |
||||||
|
boolean hasDeliverMode = deliveryMode != null |
||||||
|
&& (deliveryMode.getHasShopDelivery() || deliveryMode.getHasUserPickUp()); |
||||||
|
if (!hasDeliverMode) { |
||||||
|
throw new YamiShopBindException("请选择配送方式"); |
||||||
|
} |
||||||
|
List<Sku> skuList = productParam.getSkuList(); |
||||||
|
boolean isAllUnUse = true; |
||||||
|
for (Sku sku : skuList) { |
||||||
|
if (sku.getStatus() == 1) { |
||||||
|
isAllUnUse = false; |
||||||
|
} |
||||||
|
} |
||||||
|
if (isAllUnUse) { |
||||||
|
throw new YamiShopBindException("至少要启用一种商品规格"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -1,55 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.huoran.api.UserClient; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import io.swagger.annotations.*; |
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.apache.commons.lang.StringUtils; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
import org.springframework.web.bind.annotation.PostMapping; |
|
||||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||||
import org.springframework.web.bind.annotation.RestController; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import org.springframework.web.bind.annotation.RequestParam; |
|
||||||
import io.swagger.annotations.ApiImplicitParam; |
|
||||||
import io.swagger.annotations.ApiImplicitParams; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import com.huoran.nakadai.service.ProductThemeService; |
|
||||||
import com.huoran.nakadai.entity.ProductTheme; |
|
||||||
import org.apache.commons.io.FileUtils; |
|
||||||
import org.apache.commons.io.IOUtils; |
|
||||||
|
|
||||||
import java.io.File; |
|
||||||
import java.io.FileOutputStream; |
|
||||||
import java.io.IOException; |
|
||||||
import java.io.InputStream; |
|
||||||
import java.net.HttpURLConnection; |
|
||||||
import java.net.MalformedURLException; |
|
||||||
import java.net.URL; |
|
||||||
import java.util.List; |
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
|
|
||||||
/** |
|
||||||
* @描述:控制类 |
|
||||||
* @作者: Rong |
|
||||||
* @日期: 2023-08-22 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/productTheme") |
|
||||||
@Api(value = "产品主题:ProductThemeController", tags = "R-产品主题") |
|
||||||
public class ProductThemeController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public ProductThemeService service; |
|
||||||
|
|
||||||
@PostMapping("/allSubjects") |
|
||||||
@ApiOperation(value = "全部主题", response = ProductTheme.class) |
|
||||||
public R allSubjects() { |
|
||||||
List<ProductTheme> list = service.list(null); |
|
||||||
return R.ok().put("data", list); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,91 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil; |
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.nakadai.entity.ProductType; |
|
||||||
import com.huoran.nakadai.service.ProductTypeService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 产品类型表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2023-04-25 |
|
||||||
*/ |
|
||||||
@Api(value = "M-商品产品类型管理", tags = "M-商品产品类型管理") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/productType") |
|
||||||
public class ProductTypeController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private ProductTypeService typeService; |
|
||||||
|
|
||||||
@ApiOperation(value = "添加产品类型") |
|
||||||
@PostMapping("/addProductType") |
|
||||||
public R addProductType( |
|
||||||
@ApiParam(name = "typeName", value = "类型名称", required = true) |
|
||||||
@RequestParam String typeName) { |
|
||||||
//名称判重
|
|
||||||
QueryWrapper<ProductType> queryWrapper = new QueryWrapper<>(); |
|
||||||
queryWrapper.eq("type_name",typeName); |
|
||||||
ProductType one = typeService.getOne(queryWrapper); |
|
||||||
if (ObjectUtil.isNotNull(one)){ |
|
||||||
return R.error("产品类型已存在!"); |
|
||||||
} |
|
||||||
//新增产品分类
|
|
||||||
ProductType type = new ProductType(); |
|
||||||
type.setTypeName(typeName); |
|
||||||
boolean save = typeService.save(type); |
|
||||||
return save ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "更新产品类型") |
|
||||||
@PostMapping("/updateProductType") |
|
||||||
public R updateProductType( |
|
||||||
@ApiParam(name = "type", value = "类型", required = true) |
|
||||||
@RequestBody ProductType type) { |
|
||||||
//名称判重
|
|
||||||
QueryWrapper<ProductType> queryWrapper = new QueryWrapper<>(); |
|
||||||
queryWrapper.eq("type_name",type.getTypeName()).notInSql("type_id",type.getTypeId().toString()); |
|
||||||
ProductType one = typeService.getOne(queryWrapper); |
|
||||||
if (ObjectUtil.isNotNull(one)){ |
|
||||||
return R.error("产品类型已存在!"); |
|
||||||
} |
|
||||||
boolean save = typeService.updateById(type); |
|
||||||
return save ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "产品类型列表") |
|
||||||
@GetMapping("/productTypeList") |
|
||||||
public R productTypeList( |
|
||||||
@ApiParam(name = "search", value = "查询条件",required = false) |
|
||||||
@RequestParam(required = false) String search) { |
|
||||||
QueryWrapper<ProductType> queryWrapper = new QueryWrapper<>(); |
|
||||||
if (search!=null){ |
|
||||||
queryWrapper.like("type_name",search); |
|
||||||
} |
|
||||||
List<ProductType> typeList = typeService.list(queryWrapper); |
|
||||||
return R.ok().put("typeList",typeList); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "删除产品类型") |
|
||||||
@PostMapping("/deleteProductType") |
|
||||||
public R deleteProductType( |
|
||||||
@ApiParam(name = "typeId", value = "类型id", required = true) |
|
||||||
@RequestParam Integer typeId) { |
|
||||||
boolean remove = typeService.removeById(typeId); |
|
||||||
return remove ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,42 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.nakadai.entity.ProfessionalClass; |
|
||||||
import com.huoran.nakadai.entity.res.CustomerDetailRes; |
|
||||||
import com.huoran.nakadai.service.IProfessionalClassService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author huoran |
|
||||||
* @since 2021-07-09 |
|
||||||
*/ |
|
||||||
@Api(value = "专业类管理", tags = "专业类管理") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/professionalClass") |
|
||||||
public class ProfessionalClassController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private IProfessionalClassService iProfessionalClassService; |
|
||||||
|
|
||||||
/** |
|
||||||
* 查询专业类 |
|
||||||
* @param disciplineIds |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
@ApiOperation(value = "查询专业类",notes = "查询专业类",response = ProfessionalClass.class) |
|
||||||
@PostMapping("/queryProfessionalClass") |
|
||||||
public R queryProfessionalClass(@RequestBody List<Integer> disciplineIds) { |
|
||||||
List<ProfessionalClass> result = iProfessionalClassService.queryProfessionalClass(disciplineIds); |
|
||||||
return R.ok().put("result",result); |
|
||||||
} |
|
||||||
} |
|
@ -1,39 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.nakadai.entity.Professional; |
|
||||||
import com.huoran.nakadai.entity.ProfessionalClass; |
|
||||||
import com.huoran.nakadai.service.IProfessionalService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import org.springframework.stereotype.Controller; |
|
||||||
|
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 专业 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author huoran |
|
||||||
* @since 2021-07-09 |
|
||||||
*/ |
|
||||||
@Api(value = "专业管理", tags = "专业管理") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/professional") |
|
||||||
public class ProfessionalController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private IProfessionalService iProfessionalService; |
|
||||||
|
|
||||||
@ApiOperation(value = "查询专业",notes = "查询专业",response = Professional.class) |
|
||||||
@GetMapping("/queryProfessional") |
|
||||||
public R queryProfessional(@RequestParam Integer professionalClassId) { |
|
||||||
List<Professional> result = iProfessionalService.queryProfessional(professionalClassId); |
|
||||||
return R.ok().put("result",result); |
|
||||||
} |
|
||||||
} |
|
@ -1,65 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.huoran.api.UserClient; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.ProgramShoppingCart; |
|
||||||
import com.huoran.nakadai.entity.req.ProgramShoppingCartReq; |
|
||||||
import com.huoran.nakadai.service.ProgramShoppingCartService; |
|
||||||
import io.swagger.annotations.*; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
import org.springframework.web.bind.annotation.PostMapping; |
|
||||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||||
import org.springframework.web.bind.annotation.RestController; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import org.springframework.web.bind.annotation.RequestParam; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
|
|
||||||
import java.util.List; |
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
|
|
||||||
/** |
|
||||||
* @描述:小程序—购物车控制类 |
|
||||||
* @作者: Rong |
|
||||||
* @日期: 2023-06-09 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/mini/program/shopping/cart") |
|
||||||
@Api(value = "小程序—购物车:ProgramShoppingCartController", tags = "R-小程序—购物车") |
|
||||||
public class ProgramShoppingCartController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public ProgramShoppingCartService service; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private UserClient userClient; |
|
||||||
|
|
||||||
@PostMapping("/shoppingCartList") |
|
||||||
@ApiOperation(value = "购物车列表", response = ProgramShoppingCart.class) |
|
||||||
public R shoppingCartList(@RequestBody ProgramShoppingCartReq req, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
req.setAccountId(Integer.valueOf(accountId)); |
|
||||||
return service.shoppingCartList(req); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/addToShoppingCart") |
|
||||||
@ApiOperation(value = "加入购物车", response = ProgramShoppingCart.class) |
|
||||||
public R save(@RequestBody @ApiParam(name = "小程序—购物车对象", value = "传入json格式", required = true) ProgramShoppingCart ProgramShoppingCart, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
ProgramShoppingCart.setAccountId(Integer.valueOf(accountId)); |
|
||||||
boolean addState = service.save(ProgramShoppingCart); |
|
||||||
return addState ? R.ok() : R.error("新增失败"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/batchDeletion") |
|
||||||
@ApiOperation(value = "批量删除购物车产品", response = ProgramShoppingCart.class) |
|
||||||
public R batchDeletion(@ApiParam(name = "id", value = "主键", required = true) @RequestBody List<Integer> ids) { |
|
||||||
boolean delState = service.removeByIds(ids); |
|
||||||
return delState ? R.ok() : R.error("删除失败"); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
@ -0,0 +1,153 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.nakadai.controller; |
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil; |
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.huoran.common.response.ServerResponseEntity; |
||||||
|
import com.huoran.common.utils.TokenUtils; |
||||||
|
import com.huoran.nakadai.entity.model.ShopDetail; |
||||||
|
import com.huoran.nakadai.entity.param.ShopDetailParam; |
||||||
|
import com.huoran.nakadai.service.ShopDetailService; |
||||||
|
import com.huoran.nakadai.utils.PageParam; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import javax.validation.Valid; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.List; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* @author lgh on 2018/08/29. |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequestMapping("/shop/shopDetail") |
||||||
|
public class ShopDetailController { |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private ShopDetailService shopDetailService; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 修改分销开关 |
||||||
|
*/ |
||||||
|
@PutMapping("/isDistribution") |
||||||
|
public ServerResponseEntity<Void> updateIsDistribution(@RequestParam Integer isDistribution, HttpServletRequest request){ |
||||||
|
ShopDetail shopDetail=new ShopDetail(); |
||||||
|
Long shopId = TokenUtils.getShopIdByJwtToken(request); |
||||||
|
shopDetail.setShopId(shopId); |
||||||
|
shopDetail.setIsDistribution(isDistribution); |
||||||
|
shopDetailService.updateById(shopDetail); |
||||||
|
// 更新完成后删除缓存
|
||||||
|
shopDetailService.removeShopDetailCacheByShopId(shopDetail.getShopId()); |
||||||
|
return ServerResponseEntity.success(); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 获取信息 |
||||||
|
*/ |
||||||
|
@GetMapping("/info") |
||||||
|
public ServerResponseEntity<ShopDetail> info(HttpServletRequest request){ |
||||||
|
ShopDetail shopDetail = shopDetailService.getShopDetailByShopId(TokenUtils.getShopIdByJwtToken(request)); |
||||||
|
return ServerResponseEntity.success(shopDetail); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 分页获取 |
||||||
|
*/ |
||||||
|
@GetMapping("/page") |
||||||
|
public ServerResponseEntity<IPage<ShopDetail>> page(ShopDetail shopDetail, PageParam<ShopDetail> page){ |
||||||
|
IPage<ShopDetail> shopDetails = shopDetailService.page(page, |
||||||
|
new LambdaQueryWrapper<ShopDetail>() |
||||||
|
.like(StrUtil.isNotBlank(shopDetail.getShopName()),ShopDetail::getShopName,shopDetail.getShopName()) |
||||||
|
.orderByDesc(ShopDetail::getShopId)); |
||||||
|
return ServerResponseEntity.success(shopDetails); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取信息 |
||||||
|
*/ |
||||||
|
@GetMapping("/info/{shopId}") |
||||||
|
public ServerResponseEntity<ShopDetail> info(@PathVariable("shopId") Long shopId){ |
||||||
|
ShopDetail shopDetail = shopDetailService.getShopDetailByShopId(shopId); |
||||||
|
// 店铺图片
|
||||||
|
return ServerResponseEntity.success(shopDetail); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 保存 |
||||||
|
*/ |
||||||
|
@PostMapping |
||||||
|
public ServerResponseEntity<Void> save(@Valid ShopDetailParam shopDetailParam){ |
||||||
|
ShopDetail shopDetail = BeanUtil.copyProperties(shopDetailParam, ShopDetail.class); |
||||||
|
shopDetail.setCreateTime(new Date()); |
||||||
|
shopDetail.setShopStatus(1); |
||||||
|
shopDetailService.save(shopDetail); |
||||||
|
return ServerResponseEntity.success(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改 |
||||||
|
*/ |
||||||
|
@PutMapping |
||||||
|
public ServerResponseEntity<Void> update(@Valid ShopDetailParam shopDetailParam){ |
||||||
|
ShopDetail daShopDetail = shopDetailService.getShopDetailByShopId(shopDetailParam.getShopId()); |
||||||
|
ShopDetail shopDetail = BeanUtil.copyProperties(shopDetailParam, ShopDetail.class); |
||||||
|
shopDetail.setUpdateTime(new Date()); |
||||||
|
shopDetailService.updateShopDetail(shopDetail,daShopDetail); |
||||||
|
return ServerResponseEntity.success(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除 |
||||||
|
*/ |
||||||
|
@DeleteMapping("/{id}") |
||||||
|
public ServerResponseEntity<Void> delete(@PathVariable Long id){ |
||||||
|
shopDetailService.deleteShopDetailByShopId(id); |
||||||
|
return ServerResponseEntity.success(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新店铺状态 |
||||||
|
*/ |
||||||
|
@PutMapping("/shopStatus") |
||||||
|
public ServerResponseEntity<Void> shopStatus(@RequestParam Long shopId,@RequestParam Integer shopStatus){ |
||||||
|
ShopDetail shopDetail = new ShopDetail(); |
||||||
|
shopDetail.setShopId(shopId); |
||||||
|
shopDetail.setShopStatus(shopStatus); |
||||||
|
shopDetailService.updateById(shopDetail); |
||||||
|
// 更新完成后删除缓存
|
||||||
|
shopDetailService.removeShopDetailCacheByShopId(shopDetail.getShopId()); |
||||||
|
return ServerResponseEntity.success(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 获取所有的店铺名称 |
||||||
|
*/ |
||||||
|
// @GetMapping("/listShopName")
|
||||||
|
// public ServerResponseEntity<List<ShopDetail>> listShopName(){
|
||||||
|
// List<ShopDetail> list = shopDetailService.list().stream().map((dbShopDetail) ->{
|
||||||
|
// ShopDetail shopDetail = new ShopDetail();
|
||||||
|
// shopDetail.setShopId(dbShopDetail.getShopId());
|
||||||
|
// shopDetail.setShopName(dbShopDetail.getShopName());
|
||||||
|
// return shopDetail;
|
||||||
|
// }).collect(Collectors.toList());
|
||||||
|
// return ServerResponseEntity.success(list);
|
||||||
|
// }
|
||||||
|
} |
@ -0,0 +1,122 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.nakadai.controller; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.huoran.common.exception.YamiShopBindException; |
||||||
|
import com.huoran.common.response.ServerResponseEntity; |
||||||
|
import com.huoran.common.utils.TokenUtils; |
||||||
|
import com.huoran.nakadai.entity.enums.ProdPropRule; |
||||||
|
import com.huoran.nakadai.entity.model.ProdProp; |
||||||
|
import com.huoran.nakadai.entity.model.ProdPropValue; |
||||||
|
|
||||||
|
import com.huoran.nakadai.service.ProdPropService; |
||||||
|
import com.huoran.nakadai.service.ProdPropValueService; |
||||||
|
import com.huoran.nakadai.utils.PageParam; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import javax.validation.Valid; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Objects; |
||||||
|
|
||||||
|
/** |
||||||
|
* 规格管理 |
||||||
|
* |
||||||
|
* @author lgh |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequestMapping("/prod/spec") |
||||||
|
public class SpecController { |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private ProdPropService prodPropService; |
||||||
|
@Autowired |
||||||
|
private ProdPropValueService prodPropValueService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页获取 |
||||||
|
*/ |
||||||
|
@GetMapping("/page") |
||||||
|
public ServerResponseEntity<IPage<ProdProp>> page(ProdProp prodProp, PageParam<ProdProp> page,HttpServletRequest request) { |
||||||
|
prodProp.setRule(ProdPropRule.SPEC.value()); |
||||||
|
prodProp.setShopId(TokenUtils.getShopIdByJwtToken(request)); |
||||||
|
IPage<ProdProp> list = prodPropService.pagePropAndValue(prodProp, page); |
||||||
|
return ServerResponseEntity.success(list); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 获取所有的规格 |
||||||
|
*/ |
||||||
|
@GetMapping("/list") |
||||||
|
public ServerResponseEntity<List<ProdProp>> list(HttpServletRequest request) { |
||||||
|
List<ProdProp> list = prodPropService.list(new LambdaQueryWrapper<ProdProp>().eq(ProdProp::getRule, ProdPropRule.SPEC.value()).eq(ProdProp::getShopId, TokenUtils.getShopIdByJwtToken(request))); |
||||||
|
return ServerResponseEntity.success(list); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据规格id获取规格值 |
||||||
|
*/ |
||||||
|
@GetMapping("/listSpecValue/{specId}") |
||||||
|
public ServerResponseEntity<List<ProdPropValue>> listSpecValue(@PathVariable("specId") Long specId) { |
||||||
|
List<ProdPropValue> list = prodPropValueService.list(new LambdaQueryWrapper<ProdPropValue>().eq(ProdPropValue::getPropId, specId)); |
||||||
|
return ServerResponseEntity.success(list); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 保存 |
||||||
|
*/ |
||||||
|
@PostMapping |
||||||
|
public ServerResponseEntity<Void> save(@Valid @RequestBody ProdProp prodProp,HttpServletRequest request) { |
||||||
|
prodProp.setRule(ProdPropRule.SPEC.value()); |
||||||
|
prodProp.setShopId(TokenUtils.getShopIdByJwtToken(request)); |
||||||
|
prodPropService.saveProdPropAndValues(prodProp); |
||||||
|
return ServerResponseEntity.success(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改 |
||||||
|
*/ |
||||||
|
@PutMapping |
||||||
|
public ServerResponseEntity<Void> update(@Valid @RequestBody ProdProp prodProp, HttpServletRequest request) { |
||||||
|
ProdProp dbProdProp = prodPropService.getById(prodProp.getPropId()); |
||||||
|
if (!Objects.equals(dbProdProp.getShopId(), TokenUtils.getShopIdByJwtToken(request))) { |
||||||
|
throw new YamiShopBindException("没有权限获取该商品规格信息"); |
||||||
|
} |
||||||
|
prodProp.setRule(ProdPropRule.SPEC.value()); |
||||||
|
prodProp.setShopId(TokenUtils.getShopIdByJwtToken(request)); |
||||||
|
prodPropService.updateProdPropAndValues(prodProp); |
||||||
|
return ServerResponseEntity.success(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除 |
||||||
|
*/ |
||||||
|
@DeleteMapping("/{id}") |
||||||
|
public ServerResponseEntity<Void> delete(@PathVariable Long id,HttpServletRequest request) { |
||||||
|
prodPropService.deleteProdPropAndValues(id, ProdPropRule.SPEC.value(), TokenUtils.getShopIdByJwtToken(request)); |
||||||
|
return ServerResponseEntity.success(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据获取规格值最大的自增id |
||||||
|
*/ |
||||||
|
@GetMapping("/listSpecMaxValueId") |
||||||
|
public ServerResponseEntity<Long> listSpecMaxValueId() { |
||||||
|
ProdPropValue propValue = prodPropValueService.getOne(new LambdaQueryWrapper<ProdPropValue>() |
||||||
|
.orderByDesc(ProdPropValue::getValueId).last("limit 1")); |
||||||
|
return ServerResponseEntity.success(Objects.isNull(propValue) ? 0L : propValue.getValueId()); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -1,91 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.huoran.api.UserClient; |
|
||||||
import com.huoran.common.constant.DelConstant; |
|
||||||
import com.huoran.common.constant.ModellConstant; |
|
||||||
import com.huoran.common.constant.PlatformConstant; |
|
||||||
import com.huoran.common.exception.CustomException; |
|
||||||
import com.huoran.common.exception.ExceptionEnum; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.ModelReferenceCategory; |
|
||||||
import com.huoran.nakadai.entity.ModelReferenceDemo; |
|
||||||
import com.huoran.nakadai.entity.ModelSysDemo; |
|
||||||
import com.huoran.nakadai.entity.req.PageImportModelReq; |
|
||||||
import com.huoran.nakadai.entity.req.PageModelReq; |
|
||||||
import com.huoran.nakadai.service.ModelReferenceCategoryService; |
|
||||||
import com.huoran.nakadai.service.ModelReferenceDemoService; |
|
||||||
import com.huoran.nakadai.service.ModelSysDemoService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.validation.annotation.Validated; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 引用模型代码记录表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2022-03-04 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/model/student/") |
|
||||||
@Api(value = "API - 学生端:ModelReferenceDemoController", tags = "中台:学生端模型相关") |
|
||||||
public class StudentModelCorrelationController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private UserClient userClient; |
|
||||||
@Autowired |
|
||||||
public ModelReferenceDemoService service; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public ModelSysDemoService sysDemoService; |
|
||||||
|
|
||||||
|
|
||||||
@Autowired |
|
||||||
public ModelReferenceCategoryService referenceCategoryService; |
|
||||||
|
|
||||||
@PostMapping("/studentModelList") |
|
||||||
@ApiOperation(value = "学生端:读取教师端模型列表") |
|
||||||
public R studentModelList(@RequestBody @Validated PageImportModelReq req, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); |
|
||||||
return service.studentModelList(req); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/studentModelListBySystem") |
|
||||||
@ApiOperation(value = "学生端:读取教师端系统模型") |
|
||||||
public R studentModelListBySystem(@RequestBody @Validated PageImportModelReq req, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
req.setSchoolId(userClient.getSchoolIdByAccountId(accountId)); |
|
||||||
req.setIsOpen(DelConstant.IS_OPEN); |
|
||||||
return service.systemModelByTeacher(req); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/modelClassListByStudent") |
|
||||||
@ApiOperation(value = "学生端模型分类") |
|
||||||
public R modelClassListByStudent(@RequestParam("systemId") @ApiParam(value = "系统id") Integer systemId, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
//schoolClassification学校共享出来的分类
|
|
||||||
List<ModelReferenceCategory> schoolClassification = referenceCategoryService.modelClassList(systemId, ModellConstant.SOURCE_INSTITUTION, schoolId); |
|
||||||
|
|
||||||
//系统内置分类
|
|
||||||
List<ModelReferenceCategory> systemBuiltInClassification = referenceCategoryService.builtInClassificationByNakadai(systemId); |
|
||||||
|
|
||||||
return R.ok().put("systemBuiltInClassification", systemBuiltInClassification).put("schoolClassification", schoolClassification); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,77 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.huoran.api.UserClient; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.SupplierClassificationConfig; |
|
||||||
import com.huoran.nakadai.service.SupplierClassificationConfigService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* @描述:供应商分类配置表控制类 |
|
||||||
* @作者: Rong |
|
||||||
* @日期: 2023-12-27 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/supplierClassificationConfig") |
|
||||||
@Api(value = "供应商分类配置表:SupplierClassificationConfigController", tags = "供应商分类配置表") |
|
||||||
public class SupplierClassificationConfigController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public SupplierClassificationConfigService service; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private UserClient userClient; |
|
||||||
|
|
||||||
/*@PostMapping("/listByEntity") |
|
||||||
@ApiOperation(value = "分页查询", response = SupplierClassificationConfig.class) |
|
||||||
public R listByEntity(@RequestBody SupplierClassificationConfig supplierClassificationConfig) { |
|
||||||
|
|
||||||
return null; |
|
||||||
} |
|
||||||
*/ |
|
||||||
|
|
||||||
@PostMapping("/findById") |
|
||||||
@ApiOperation(value = "查询详情", response = SupplierClassificationConfig.class) |
|
||||||
public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { |
|
||||||
SupplierClassificationConfig supplierClassificationConfig = service.getById(id); |
|
||||||
return R.ok().put("data", supplierClassificationConfig); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/save") |
|
||||||
@ApiOperation(value = "新增分类", response = SupplierClassificationConfig.class) |
|
||||||
public R save(@RequestBody @ApiParam(name = "供应商分类配置表对象", value = "传入json格式", required = true) SupplierClassificationConfig supplierClassificationConfig, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
supplierClassificationConfig.setAccountId(Integer.valueOf(accountId)); |
|
||||||
boolean addState = service.save(supplierClassificationConfig); |
|
||||||
return addState ? R.ok() : R.error("新增失败"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/update") |
|
||||||
@ApiOperation(value = "修改", response = SupplierClassificationConfig.class) |
|
||||||
public R update(@RequestBody @ApiParam(name = "供应商分类配置表对象", value = "传入json格式", required = true) SupplierClassificationConfig supplierClassificationConfig, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
supplierClassificationConfig.setAccountId(Integer.valueOf(accountId)); |
|
||||||
boolean updateState = service.updateById(supplierClassificationConfig); |
|
||||||
return updateState ? R.ok() : R.error("编辑失败"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/batchDeletion") |
|
||||||
@ApiOperation(value = "批量删除", response = SupplierClassificationConfig.class) |
|
||||||
public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestBody List<Integer> ids) { |
|
||||||
boolean delState = service.removeByIds(ids); |
|
||||||
return delState ? R.ok() : R.error("删除失败"); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
@ -1,106 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.api.UserClient; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.SupplierClassification; |
|
||||||
import com.huoran.nakadai.entity.req.SupplierClassificationReq; |
|
||||||
import com.huoran.nakadai.service.SupplierClassificationService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.util.ObjectUtils; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import java.util.*; |
|
||||||
|
|
||||||
/** |
|
||||||
* @描述:供应商分类信息控制类 |
|
||||||
* @作者: Rong |
|
||||||
* @日期: 2023-12-27 |
|
||||||
*/ |
|
||||||
@RestController |
|
||||||
@RequestMapping("/supplierClassification") |
|
||||||
@Api(value = "供应商分类信息:SupplierClassificationController", tags = "供应商分类信息") |
|
||||||
public class SupplierClassificationController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
public SupplierClassificationService service; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private UserClient userClient; |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/treeStructureList") |
|
||||||
@ApiOperation(value = "树结构列表", response = SupplierClassification.class) |
|
||||||
public R treeStructureList(@RequestBody SupplierClassificationReq supplierClassification) { |
|
||||||
/*QueryWrapper<SupplierClassification> queryWrapper = new QueryWrapper<>(); |
|
||||||
queryWrapper.eq("parent_id", supplierClassification.getParentId());*/ |
|
||||||
List<SupplierClassification> list = service.list(null); |
|
||||||
|
|
||||||
|
|
||||||
return R.ok().put("list", buildTree(list)); |
|
||||||
} |
|
||||||
|
|
||||||
public List<SupplierClassification> buildTree(List<SupplierClassification> list) { |
|
||||||
List<SupplierClassification> treeList = new ArrayList<SupplierClassification>(); |
|
||||||
List<SupplierClassification> children; |
|
||||||
|
|
||||||
for (SupplierClassification address : list) { |
|
||||||
if (address.getParentId() == 0) { |
|
||||||
treeList.add(address); |
|
||||||
} |
|
||||||
children = new ArrayList<SupplierClassification>(); |
|
||||||
for (SupplierClassification node : list) { |
|
||||||
if (node.getParentId() == address.getId()) { |
|
||||||
children.add(node); |
|
||||||
} |
|
||||||
} |
|
||||||
address.setChildren(children); |
|
||||||
} |
|
||||||
|
|
||||||
return treeList; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/findById") |
|
||||||
@ApiOperation(value = "查询详情", response = SupplierClassification.class) |
|
||||||
public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { |
|
||||||
SupplierClassification supplierClassification = service.getById(id); |
|
||||||
return R.ok().put("data", supplierClassification); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/save") |
|
||||||
@ApiOperation(value = "新增", response = SupplierClassification.class) |
|
||||||
public R save(@RequestBody @ApiParam(name = "供应商分类信息对象", value = "传入json格式", required = true) SupplierClassification supplierClassification, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
supplierClassification.setAccountId(Integer.valueOf(accountId)); |
|
||||||
boolean addState = service.save(supplierClassification); |
|
||||||
return addState ? R.ok() : R.error("新增失败"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/update") |
|
||||||
@ApiOperation(value = "修改", response = SupplierClassification.class) |
|
||||||
public R update(@RequestBody @ApiParam(name = "供应商分类信息对象", value = "传入json格式", required = true) SupplierClassification supplierClassification, HttpServletRequest request) { |
|
||||||
String accountId = TokenUtils.getIdByJwtToken(request); |
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(accountId); |
|
||||||
supplierClassification.setAccountId(Integer.valueOf(accountId)); |
|
||||||
boolean updateState = service.updateById(supplierClassification); |
|
||||||
return updateState ? R.ok() : R.error("编辑失败"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/batchDeletion") |
|
||||||
@ApiOperation(value = "批量删除", response = SupplierClassification.class) |
|
||||||
public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestBody List<Integer> ids) { |
|
||||||
boolean delState = service.removeByIds(ids); |
|
||||||
return delState ? R.ok() : R.error("删除失败"); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
@ -1,75 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil; |
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.nakadai.entity.Supplier; |
|
||||||
import com.huoran.nakadai.service.SupplierService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 供应商表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2023-04-25 |
|
||||||
*/ |
|
||||||
@Api(value = "M-商品供应商管理", tags = "M-商品供应商管理") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/supplier") |
|
||||||
public class SupplierController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private SupplierService supplierService; |
|
||||||
|
|
||||||
@ApiOperation(value = "添加供应商") |
|
||||||
@PostMapping("/addSupplier") |
|
||||||
public R addSupplier( |
|
||||||
@ApiParam(name = "supplierName", value = "供应商名称", required = true) |
|
||||||
@RequestParam String supplierName) { |
|
||||||
//名称判重
|
|
||||||
QueryWrapper<Supplier> queryWrapper = new QueryWrapper<>(); |
|
||||||
queryWrapper.eq("supplier_name",supplierName); |
|
||||||
Supplier one = supplierService.getOne(queryWrapper); |
|
||||||
if (ObjectUtil.isNotNull(one)){ |
|
||||||
return R.error("供应商已存在!"); |
|
||||||
} |
|
||||||
//新增产品分类
|
|
||||||
Supplier supplier = new Supplier(); |
|
||||||
supplier.setSupplierName(supplierName); |
|
||||||
boolean save = supplierService.save(supplier); |
|
||||||
return save ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "供应商列表") |
|
||||||
@GetMapping("/supplierList") |
|
||||||
public R supplierList( |
|
||||||
@ApiParam(name = "search", value = "查询条件",required = false) |
|
||||||
@RequestParam(required = false) String search) { |
|
||||||
QueryWrapper<Supplier> queryWrapper = new QueryWrapper<>(); |
|
||||||
if (search!=null){ |
|
||||||
queryWrapper.like("supplier_name",search); |
|
||||||
} |
|
||||||
List<Supplier> supplierList = supplierService.list(queryWrapper); |
|
||||||
return R.ok().put("supplierList",supplierList); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "删除供应商") |
|
||||||
@PostMapping("/deleteSupplier") |
|
||||||
public R deleteSupplier( |
|
||||||
@ApiParam(name = "supplierId", value = "供应商id", required = true) |
|
||||||
@RequestParam Integer supplierId) { |
|
||||||
boolean remove = supplierService.removeById(supplierId); |
|
||||||
return remove ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,103 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil; |
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.nakadai.entity.Tags; |
|
||||||
import com.huoran.nakadai.entity.req.TagsReq; |
|
||||||
import com.huoran.nakadai.service.TagsService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 分类标签表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2023-04-25 |
|
||||||
*/ |
|
||||||
@Api(value = "M-商品分类标签管理", tags = "M-商品分类标签管理") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/tags") |
|
||||||
public class TagsController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private TagsService tagsService; |
|
||||||
|
|
||||||
@ApiOperation(value = "添加分类标签") |
|
||||||
@PostMapping("/addTags") |
|
||||||
public R addTags( |
|
||||||
@ApiParam(name = "tagsName", value = "分类标签名称", required = true) |
|
||||||
@RequestParam String tagsName) { |
|
||||||
//名称判重
|
|
||||||
QueryWrapper<Tags> queryWrapper = new QueryWrapper<>(); |
|
||||||
queryWrapper.eq("tags_name",tagsName); |
|
||||||
Tags one = tagsService.getOne(queryWrapper); |
|
||||||
if (ObjectUtil.isNotNull(one)){ |
|
||||||
return R.error("分类标签已存在!"); |
|
||||||
} |
|
||||||
//新增产品分类
|
|
||||||
Tags tags = new Tags(); |
|
||||||
tags.setTagsName(tagsName); |
|
||||||
tags.setSort(tagsService.count(null)); |
|
||||||
boolean save = tagsService.save(tags); |
|
||||||
return save ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "更新分类标签") |
|
||||||
@PostMapping("/updateTags") |
|
||||||
public R updateTags( |
|
||||||
@ApiParam(name = "tags", value = "分类标签", required = true) |
|
||||||
@RequestBody Tags tags) { |
|
||||||
//名称判重
|
|
||||||
QueryWrapper<Tags> queryWrapper = new QueryWrapper<>(); |
|
||||||
queryWrapper.eq("tags_name",tags.getTagsName()).notInSql("tags_id", tags.getTagsId().toString()); |
|
||||||
Tags one = tagsService.getOne(queryWrapper); |
|
||||||
if (ObjectUtil.isNotNull(one)){ |
|
||||||
return R.error("分类标签已存在!"); |
|
||||||
} |
|
||||||
boolean save = tagsService.updateById(tags); |
|
||||||
return save ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "更新标签排序") |
|
||||||
@PostMapping("/updateTagsSort") |
|
||||||
public R updateTagsSort( |
|
||||||
@ApiParam(name = "tagsReq", value = "标签集合", required = true) |
|
||||||
@RequestBody TagsReq tagsReq) { |
|
||||||
boolean updateBatchById = tagsService.updateBatchById(tagsReq.getTagsList()); |
|
||||||
return updateBatchById ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "分类标签列表") |
|
||||||
@GetMapping("/tagsList") |
|
||||||
public R tagsList( |
|
||||||
@ApiParam(name = "search", value = "查询条件",required = false) |
|
||||||
@RequestParam(required = false) String search) { |
|
||||||
QueryWrapper<Tags> queryWrapper = new QueryWrapper<>(); |
|
||||||
if (search!=null){ |
|
||||||
queryWrapper.like("tags_name",search); |
|
||||||
} |
|
||||||
queryWrapper.orderByAsc("sort"); |
|
||||||
List<Tags> tagsList = tagsService.list(queryWrapper); |
|
||||||
return R.ok().put("tagsList",tagsList); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiOperation(value = "删除分类标签") |
|
||||||
@PostMapping("/deleteTags") |
|
||||||
public R deleteTags( |
|
||||||
@ApiParam(name = "tagsId", value = "标签id", required = true) |
|
||||||
@RequestParam Integer tagsId) { |
|
||||||
boolean remove = tagsService.removeById(tagsId); |
|
||||||
return remove ? R.ok() : R.error(); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
@ -1,114 +0,0 @@ |
|||||||
package com.huoran.nakadai.controller; |
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
||||||
import com.huoran.api.UserClient; |
|
||||||
import com.huoran.common.response.R; |
|
||||||
import com.huoran.common.utils.TokenUtils; |
|
||||||
import com.huoran.nakadai.entity.Customer; |
|
||||||
import com.huoran.nakadai.entity.Order; |
|
||||||
import com.huoran.nakadai.entity.OrderOther; |
|
||||||
import com.huoran.nakadai.entity.ValueModuleManagement; |
|
||||||
import com.huoran.nakadai.service.ICustomerService; |
|
||||||
import com.huoran.nakadai.service.IOrderService; |
|
||||||
import com.huoran.nakadai.service.OrderOtherService; |
|
||||||
import com.huoran.nakadai.service.ValueModuleManagementService; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest; |
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.Date; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* 增值模块管理表 前端控制器 |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author chen |
|
||||||
* @since 2023-01-30 |
|
||||||
*/ |
|
||||||
@Api(tags = "增值模块管理") |
|
||||||
@RestController |
|
||||||
@RequestMapping("/nakadai/valueModuleManagement") |
|
||||||
public class ValueModuleManagementController { |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private ValueModuleManagementService valueModuleManagementService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private IOrderService orderService; |
|
||||||
|
|
||||||
|
|
||||||
@Autowired |
|
||||||
private UserClient userClient; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private ICustomerService customerService; |
|
||||||
|
|
||||||
@Autowired |
|
||||||
private OrderOtherService orderOtherService; |
|
||||||
|
|
||||||
@ApiOperation(value = "增值模块列表") |
|
||||||
@PostMapping("/getValueModule") |
|
||||||
public R getAllService(@RequestParam Integer platformId){ |
|
||||||
QueryWrapper<ValueModuleManagement> wrapper = new QueryWrapper<>(); |
|
||||||
wrapper.eq("platform_id",platformId); |
|
||||||
List<ValueModuleManagement> list = valueModuleManagementService.list(wrapper); |
|
||||||
List<Integer> valueList = valueModuleManagementService.selectProductModule(); |
|
||||||
for (ValueModuleManagement valueModuleManagement : list) { |
|
||||||
if (valueList.contains(valueModuleManagement.getId())){ |
|
||||||
valueModuleManagement.setAssociatedProductIdentification(true); |
|
||||||
} |
|
||||||
} |
|
||||||
return R.ok().put("valueList",list); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "查询客户增值模块") |
|
||||||
@GetMapping("/getCustomerOrder") |
|
||||||
public R getCustomerOrder(HttpServletRequest request) { |
|
||||||
Integer customerId; |
|
||||||
String id = TokenUtils.getIdByJwtToken(request); |
|
||||||
//查询学校id
|
|
||||||
Integer schoolId = userClient.getSchoolIdByAccountId(id); |
|
||||||
//根据学校查询客户id
|
|
||||||
QueryWrapper<Customer> wrapper = new QueryWrapper<>(); |
|
||||||
wrapper.eq("school_id",schoolId); |
|
||||||
Customer one = customerService.getOne(wrapper); |
|
||||||
if (one!=null){ |
|
||||||
customerId = one.getCustomerId(); |
|
||||||
}else { |
|
||||||
return R.ok().put("show", false); |
|
||||||
} |
|
||||||
|
|
||||||
List<Order> orderList = orderService.list(new QueryWrapper<Order>().eq("customer_id", customerId)); |
|
||||||
if (orderList!=null && orderList.size()<1){ |
|
||||||
return R.ok().put("show", false); |
|
||||||
} |
|
||||||
ArrayList<Integer> orderIdList = new ArrayList<>(); |
|
||||||
orderList.forEach(order -> { |
|
||||||
orderIdList.add(order.getOrderId()); |
|
||||||
}); |
|
||||||
|
|
||||||
QueryWrapper<OrderOther> orderOtherQueryWrapper = new QueryWrapper<>(); |
|
||||||
orderOtherQueryWrapper.eq("is_enable",1); |
|
||||||
orderOtherQueryWrapper.eq("authority",2); |
|
||||||
orderOtherQueryWrapper.eq("ship",1); |
|
||||||
orderOtherQueryWrapper.in("order_id",orderIdList); |
|
||||||
List<OrderOther> list = orderOtherService.list(orderOtherQueryWrapper); |
|
||||||
if (list!=null && list.size()>0){ |
|
||||||
for (OrderOther orderOther : list) { |
|
||||||
//结束时间大于当前时间,当前模块还在使用期间
|
|
||||||
if (orderOther.getEndTime().getTime() > new Date().getTime()){ |
|
||||||
return R.ok().put("show",true); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
return R.ok().put("show", false); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
@ -0,0 +1,69 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.nakadai.entity.app.dto; |
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore; |
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author lanhai |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class BasketItemDto implements Serializable { |
||||||
|
|
||||||
|
@ApiModelProperty(value = "购物车ID" , required = true) |
||||||
|
private Long basketId; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "店铺ID" , required = true) |
||||||
|
private Long shopId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 商品名称 |
||||||
|
*/ |
||||||
|
@JsonIgnore |
||||||
|
private String shopName; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "产品ID" , required = true) |
||||||
|
private Long prodId; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "skuID" , required = true) |
||||||
|
private Long skuId; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "产品个数" , required = true) |
||||||
|
private Integer prodCount; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "产品名称" , required = true) |
||||||
|
private String prodName; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "产品主图" , required = true) |
||||||
|
private String pic; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "产品现价" , required = true) |
||||||
|
private Double price; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "产品原价" , required = true) |
||||||
|
private Double oriPrice; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "产品简介" , required = true) |
||||||
|
private String brief; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "产品sku信息" , required = true) |
||||||
|
private String skuName; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "参与满减活动列表" ) |
||||||
|
private List<DiscountDto> discounts; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,36 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.nakadai.entity.app.dto; |
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author lanhai |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class CategoryDto { |
||||||
|
|
||||||
|
@ApiModelProperty(value = "分类id" ,required=true) |
||||||
|
private Long categoryId; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "分类父id" ,required=true) |
||||||
|
private Long parentId; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "分类名称" ,required=true) |
||||||
|
private String categoryName; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "分类图片" ,required=true) |
||||||
|
private String pic; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,26 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.nakadai.entity.app.dto; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
/** |
||||||
|
* 购物车中选中的满减活动项信息 |
||||||
|
* @author lanhai |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class ChooseDiscountItemDto implements Serializable { |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,23 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.nakadai.entity.app.dto; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author lanhai |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class CouponOrderDto implements Serializable { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,37 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.nakadai.entity.app.dto; |
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author lanhai |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class DeliveryDto { |
||||||
|
|
||||||
|
@ApiModelProperty(value = "物流公司名称" ,required=true) |
||||||
|
private String companyName; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "物流公司官网" ,required=true) |
||||||
|
private String companyHomeUrl; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "物流订单号" ,required=true) |
||||||
|
private String dvyFlowId; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "查询出的物流信息" ,required=true) |
||||||
|
private List<DeliveryInfoDto> data; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,34 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.nakadai.entity.app.dto; |
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author lanhai |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class DeliveryInfoDto { |
||||||
|
|
||||||
|
@ApiModelProperty(value = "详细信息" ,required=true) |
||||||
|
private String context; |
||||||
|
|
||||||
|
private String ftime; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "快递所在区域" ,required=true) |
||||||
|
private String location; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "物流更新时间" ,required=true) |
||||||
|
private String time; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,24 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.nakadai.entity.app.dto; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author lanhai |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class DiscountDto implements Serializable { |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,58 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.nakadai.entity.app.dto; |
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author lanhai |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class IndexImgDto { |
||||||
|
|
||||||
|
/** |
||||||
|
* 图片 |
||||||
|
*/ |
||||||
|
@ApiModelProperty(value = "图片Url" , required = true) |
||||||
|
private String imgUrl; |
||||||
|
|
||||||
|
/** |
||||||
|
* 顺序 |
||||||
|
*/ |
||||||
|
@ApiModelProperty(value = "图片顺序" , required = true) |
||||||
|
private Integer seq; |
||||||
|
|
||||||
|
/** |
||||||
|
* 上传时间 |
||||||
|
*/ |
||||||
|
@ApiModelProperty(value = "上传时间" , required = true) |
||||||
|
private Date uploadTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 类型 |
||||||
|
*/ |
||||||
|
@ApiModelProperty(value = "类型" , required = true) |
||||||
|
private int type; |
||||||
|
|
||||||
|
/** |
||||||
|
* 关联id |
||||||
|
*/ |
||||||
|
@ApiModelProperty(value = "关联id" , required = true) |
||||||
|
private Long relation; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,37 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.nakadai.entity.app.dto; |
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author lanhai |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class MyOrderDto { |
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单项" ,required=true) |
||||||
|
private List<MyOrderItemDto> orderItemDtos; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单号" ,required=true) |
||||||
|
private String orderNumber; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "总价" ,required=true) |
||||||
|
private Double actualTotal; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单状态" ,required=true) |
||||||
|
private Integer status; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,39 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.nakadai.entity.app.dto; |
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author lanhai |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class MyOrderItemDto { |
||||||
|
|
||||||
|
@ApiModelProperty(value = "商品图片" , required = true) |
||||||
|
private String pic; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "商品名称" , required = true) |
||||||
|
private String prodName; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "商品数量" , required = true) |
||||||
|
private Integer prodCount; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "商品价格" , required = true) |
||||||
|
private Double price; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "skuName" , required = true) |
||||||
|
private String skuName; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,39 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.nakadai.entity.app.dto; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author lanhai |
||||||
|
*/ |
||||||
|
//@Schema(description = "公告对象")
|
||||||
|
@Data |
||||||
|
public class NoticeDto { |
||||||
|
|
||||||
|
// @Schema(description = "公告id" )
|
||||||
|
private Long id; |
||||||
|
|
||||||
|
// @Schema(description = "店铺id" )
|
||||||
|
private Long shopId; |
||||||
|
|
||||||
|
// @Schema(description = "标题" )
|
||||||
|
private String title; |
||||||
|
|
||||||
|
// @Schema(description = "公告内容" )
|
||||||
|
private String content; |
||||||
|
|
||||||
|
// @Schema(description = "公告发布时间" )
|
||||||
|
private Date publishTime; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,44 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.nakadai.entity.app.dto; |
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author lanhai |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class OrderCountData { |
||||||
|
|
||||||
|
@ApiModelProperty(value = "所有订单数量" ) |
||||||
|
private Integer allCount; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "待付款" ) |
||||||
|
private Integer unPay; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "待发货" ) |
||||||
|
private Integer payed; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "待收货" ) |
||||||
|
private Integer consignment; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "待评价" ) |
||||||
|
private Integer confirm; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "成功" ) |
||||||
|
private Integer success; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "失败" ) |
||||||
|
private Integer close; |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.nakadai.entity.app.dto; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author LGH |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper = false) |
||||||
|
public class OrderItemDto extends ProductItemDto implements Serializable { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,30 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved. |
||||||
|
* |
||||||
|
* https://www.mall4j.com/
|
||||||
|
* |
||||||
|
* 未经允许,不可做商业用途! |
||||||
|
* |
||||||
|
* 版权所有,侵权必究! |
||||||
|
*/ |
||||||
|
|
||||||
|
package com.huoran.nakadai.entity.app.dto; |
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author lanhai |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class OrderNumbersDto { |
||||||
|
|
||||||
|
@ApiModelProperty(value = "多个订单号拼接的字符串" ,required=true) |
||||||
|
private String orderNumbers; |
||||||
|
|
||||||
|
public OrderNumbersDto(String orderNumbers) { |
||||||
|
this.orderNumbers = orderNumbers; |
||||||
|
} |
||||||
|
public OrderNumbersDto(){} |
||||||
|
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue