注释信息完善
This commit is contained in:
@@ -6,6 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 应用启动入口
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@MapperScan({"com.macro.mall.mapper","com.macro.mall.dao"})
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.util.Collection;
|
||||
|
||||
/**
|
||||
* SpringSecurity需要的用户详情
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public class AdminUserDetails implements UserDetails {
|
||||
private UmsAdmin umsAdmin;
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.macro.mall.bo;
|
||||
|
||||
/**
|
||||
* Controller层的日志封装类
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public class WebLog {
|
||||
/**
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.springframework.validation.BindingResult;
|
||||
|
||||
/**
|
||||
* HibernateValidator错误结果处理切面
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.io.IOException;
|
||||
|
||||
/**
|
||||
* JWT登录授权过滤器
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(JwtAuthenticationTokenFilter.class);
|
||||
|
||||
@@ -13,6 +13,7 @@ import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 用于Rest请求是返回自定义错误信息
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@Component
|
||||
public class RestfulAccessDeniedHandler implements AccessDeniedHandler{
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.util.*;
|
||||
|
||||
/**
|
||||
* 统一日志处理切面
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.springframework.security.web.authentication.UsernamePasswordAuthentic
|
||||
|
||||
/**
|
||||
* SpringSecurity的配置
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
|
||||
@@ -12,6 +12,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
/**
|
||||
* Swagger2API文档的配置
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 品牌功能Controller
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@Controller
|
||||
@Api(tags = "PmsBrandController",description = "商品品牌管理")
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品属性分类Controller
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@Controller
|
||||
@Api(tags = "PmsProductAttributeCategoryController",description = "商品属性分类管理")
|
||||
|
||||
@@ -19,6 +19,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品属性管理Controller
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@Controller
|
||||
@Api(tags = "PmsProductAttributeController", description = "商品属性管理")
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品分类模块Controller
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@Controller
|
||||
@Api(tags = "PmsProductCategoryController",description = "商品分类管理")
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
/**
|
||||
* 商品管理Controller
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@Controller
|
||||
@Api(tags = "PmsProductController", description = "商品管理")
|
||||
|
||||
@@ -20,6 +20,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 后台用户管理
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@Controller
|
||||
@Api(tags = "UmsAdminController", description = "后台用户管理")
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员等级管理Controller
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@Controller
|
||||
@Api(tags = "UmsMemberLevelController",description = "会员等级管理")
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 自定义会员价格Dao
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public interface PmsMemberPriceDao {
|
||||
int insertList(@Param("list") List<PmsMemberPrice> memberPriceList);
|
||||
|
||||
@@ -6,7 +6,8 @@ import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品自定义满减
|
||||
* 自定义商品满减Dao
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public interface PmsProductFullReductionDao {
|
||||
int insertList(@Param("list") List<PmsProductFullReduction> productFullReductionList);
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 自定义会员阶梯价格Dao
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public interface PmsProductLadderDao {
|
||||
int insertList(@Param("list") List<PmsProductLadder> productLadderList);
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.macro.mall.dao;
|
||||
|
||||
import com.macro.mall.model.PmsSkuStock;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 自定义商品sku库存Dao
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public interface PmsSkuStockDao {
|
||||
int insertList(@Param("list")List<PmsSkuStock> skuStockList);
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* 通用返回对象
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public class CommonResult {
|
||||
//操作成功
|
||||
|
||||
@@ -10,6 +10,7 @@ import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 品牌传递参数
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public class PmsBrandParam {
|
||||
@ApiModelProperty(value = "品牌名称",required = true)
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* 商品属性参数
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public class PmsProductAttributeParam {
|
||||
@ApiModelProperty("属性分类ID")
|
||||
|
||||
@@ -8,6 +8,7 @@ import javax.validation.constraints.Min;
|
||||
|
||||
/**
|
||||
* 添加更新产品分类的参数
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public class PmsProductCategoryParam {
|
||||
@ApiModelProperty("父分类的编号")
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 创建和修改商品时使用的参数
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public class PmsProductParam {
|
||||
@ApiModelProperty("商品信息")
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* 用户登录参数
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public class UmsAdminLoginParam {
|
||||
@ApiModelProperty(value = "用户名", required = true)
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* 用户登录参数
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public class UmsAdminParam {
|
||||
@ApiModelProperty(value = "用户名", required = true)
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品品牌Service
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public interface PmsBrandService {
|
||||
List<PmsBrand> listAllBrand();
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品属性分类Service
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public interface PmsProductAttributeCategoryService {
|
||||
int create(String name);
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品属性Service
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public interface PmsProductAttributeService {
|
||||
/**
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品分类Service
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public interface PmsProductCategoryService {
|
||||
int create(PmsProductCategoryParam pmsProductCategoryParam);
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.macro.mall.dto.PmsProductParam;
|
||||
|
||||
/**
|
||||
* 商品管理Service
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public interface PmsProductService {
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.macro.mall.model.UmsAdmin;
|
||||
|
||||
/**
|
||||
* 后台管理员Service
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public interface UmsAdminService {
|
||||
/**
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员等级管理Service
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public interface UmsMemberLevelService {
|
||||
/**
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品品牌Service实现类
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@Service
|
||||
public class PmsBrandServiceImpl implements PmsBrandService {
|
||||
|
||||
@@ -12,6 +12,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* PmsProductAttributeCategoryService实现类
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@Service
|
||||
public class PmsProductAttributeCategoryServiceImpl implements PmsProductAttributeCategoryService {
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品属性Service实现类
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@Service
|
||||
public class PmsProductAttributeServiceImpl implements PmsProductAttributeService {
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* PmsProductCategoryService实现类
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@Service
|
||||
public class PmsProductCategoryServiceImpl implements PmsProductCategoryService {
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.List;
|
||||
* 商品管理Service实现类
|
||||
*/
|
||||
@Service
|
||||
public class PmsProductServiceImpl implements PmsProductService{
|
||||
public class PmsProductServiceImpl implements PmsProductService {
|
||||
@Autowired
|
||||
private PmsProductMapper productMapper;
|
||||
@Autowired
|
||||
@@ -29,6 +29,7 @@ public class PmsProductServiceImpl implements PmsProductService{
|
||||
private PmsProductLadderDao productLadderDao;
|
||||
@Autowired
|
||||
private PmsProductFullReductionDao productFullReductionDao;
|
||||
|
||||
@Override
|
||||
public int create(PmsProductParam productParam) {
|
||||
int count;
|
||||
@@ -38,43 +39,39 @@ public class PmsProductServiceImpl implements PmsProductService{
|
||||
productMapper.insertSelective(product);
|
||||
//根据促销类型设置价格:、阶梯价格、满减价格
|
||||
Long productId = product.getId();
|
||||
if(product.getPromotionType()==2){
|
||||
//会员价格
|
||||
List<PmsMemberPrice> memberPriceList = productParam.getPmsMemberPriceList();
|
||||
if(!CollectionUtils.isEmpty(memberPriceList)){
|
||||
for(PmsMemberPrice pmsMemberPrice: memberPriceList){
|
||||
pmsMemberPrice.setId(null);
|
||||
pmsMemberPrice.setProductId(productId);
|
||||
}
|
||||
memberPriceDao.insertList(memberPriceList);
|
||||
//会员价格
|
||||
List<PmsMemberPrice> memberPriceList = productParam.getPmsMemberPriceList();
|
||||
if (!CollectionUtils.isEmpty(memberPriceList)) {
|
||||
for (PmsMemberPrice pmsMemberPrice : memberPriceList) {
|
||||
pmsMemberPrice.setId(null);
|
||||
pmsMemberPrice.setProductId(productId);
|
||||
}
|
||||
}else if(product.getPromotionType()==3){
|
||||
//阶梯价格
|
||||
List<PmsProductLadder> productLadderList = productParam.getProductLadderList();
|
||||
if(!CollectionUtils.isEmpty(productLadderList)){
|
||||
for(PmsProductLadder productLadder:productLadderList){
|
||||
productLadder.setId(null);
|
||||
productLadder.setProductId(productId);
|
||||
}
|
||||
productLadderDao.insertList(productLadderList);
|
||||
memberPriceDao.insertList(memberPriceList);
|
||||
}
|
||||
//阶梯价格
|
||||
List<PmsProductLadder> productLadderList = productParam.getProductLadderList();
|
||||
if (!CollectionUtils.isEmpty(productLadderList)) {
|
||||
for (PmsProductLadder productLadder : productLadderList) {
|
||||
productLadder.setId(null);
|
||||
productLadder.setProductId(productId);
|
||||
}
|
||||
}else if(product.getPromotionType()==4){
|
||||
//满减价格
|
||||
List<PmsProductFullReduction> productFullReductionList = productParam.getPmsProductFullReductionList();
|
||||
if(!CollectionUtils.isEmpty(productFullReductionList)){
|
||||
for (PmsProductFullReduction productFullReduction: productFullReductionList) {
|
||||
productFullReduction.setId(null);
|
||||
productFullReduction.setProductId(productId);
|
||||
}
|
||||
productFullReductionDao.insertList(productFullReductionList);
|
||||
productLadderDao.insertList(productLadderList);
|
||||
}
|
||||
//满减价格
|
||||
List<PmsProductFullReduction> productFullReductionList = productParam.getPmsProductFullReductionList();
|
||||
if (!CollectionUtils.isEmpty(productFullReductionList)) {
|
||||
for (PmsProductFullReduction productFullReduction : productFullReductionList) {
|
||||
productFullReduction.setId(null);
|
||||
productFullReduction.setProductId(productId);
|
||||
}
|
||||
productFullReductionDao.insertList(productFullReductionList);
|
||||
}
|
||||
//添加sku库存信息
|
||||
//添加商品参数
|
||||
//添加自定义商品规格
|
||||
//关联专题
|
||||
//关联优选
|
||||
count=1;
|
||||
count = 1;
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* UmsAdminService实现类
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@Service
|
||||
public class UmsAdminServiceImpl implements UmsAdminService{
|
||||
|
||||
@@ -11,6 +11,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员等级管理Service实现类
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@Service
|
||||
public class UmsMemberLevelServiceImpl implements UmsMemberLevelService{
|
||||
|
||||
@@ -7,7 +7,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 淘淘商城自定义响应结构
|
||||
* Jackson json序列化和反序列化工具类
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public class JsonUtil {
|
||||
|
||||
@@ -16,10 +17,6 @@ public class JsonUtil {
|
||||
|
||||
/**
|
||||
* 将对象转换成json字符串。
|
||||
* <p>Title: pojoToJson</p>
|
||||
* <p>Description: </p>
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public static String objectToJson(Object data) {
|
||||
try {
|
||||
@@ -36,7 +33,6 @@ public class JsonUtil {
|
||||
*
|
||||
* @param jsonData json数据
|
||||
* @param beanType 对象中的object类型
|
||||
* @return
|
||||
*/
|
||||
public static <T> T jsonToPojo(String jsonData, Class<T> beanType) {
|
||||
try {
|
||||
@@ -50,11 +46,6 @@ public class JsonUtil {
|
||||
|
||||
/**
|
||||
* 将json数据转换成pojo对象list
|
||||
* <p>Title: jsonToList</p>
|
||||
* <p>Description: </p>
|
||||
* @param jsonData
|
||||
* @param beanType
|
||||
* @return
|
||||
*/
|
||||
public static <T>List<T> jsonToList(String jsonData, Class<T> beanType) {
|
||||
JavaType javaType = MAPPER.getTypeFactory().constructParametricType(List.class, beanType);
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.util.Map;
|
||||
* {"sub":"wang","created":1489079981393,"exp":1489684781}
|
||||
* signature的生成算法:
|
||||
* HMACSHA256(base64UrlEncode(header) + "." +base64UrlEncode(payload),secret)
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@Component
|
||||
public class JwtTokenUtil {
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* request工具类
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public class RequestUtil {
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 用户验证状态是否在指定范围内的注解
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
||||
@@ -5,6 +5,7 @@ import javax.validation.ConstraintValidatorContext;
|
||||
|
||||
/**
|
||||
* 状态标记校验器
|
||||
* Created by macro on 2018/4/26.
|
||||
*/
|
||||
public class FlagValidatorClass implements ConstraintValidator<FlagValidator,Integer> {
|
||||
private String[] values;
|
||||
|
||||
Reference in New Issue
Block a user