parent
d7f5bedbb0
commit
e74085bccb
|
|
@ -7,7 +7,7 @@ ruoyi:
|
||||||
# 版权年份
|
# 版权年份
|
||||||
copyrightYear: 2019
|
copyrightYear: 2019
|
||||||
# 实例演示开关
|
# 实例演示开关
|
||||||
demoEnabled: true
|
demoEnabled: false
|
||||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||||
profile: D:/ruoyi/uploadPath
|
profile: D:/ruoyi/uploadPath
|
||||||
# 获取ip地址开关
|
# 获取ip地址开关
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.ruoyi.business.ajax;
|
||||||
|
|
||||||
|
import com.ruoyi.business.service.IBizMemberService;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前端用户登录
|
||||||
|
* @author bei.wu
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/ajax")
|
||||||
|
public class AjaxLoginController extends BaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IBizMemberService bizMemberService;
|
||||||
|
|
||||||
|
@PostMapping("/login")
|
||||||
|
public AjaxResult login(@Param("loginName") String loginName, @Param("password") String password) {
|
||||||
|
return super.success();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -46,7 +47,7 @@ public class AjaxOrderController extends AuthController {
|
||||||
{
|
{
|
||||||
Long userID = getUserID();
|
Long userID = getUserID();
|
||||||
BizOrder order = bizOrderService.selectBizOrderById(orderID);
|
BizOrder order = bizOrderService.selectBizOrderById(orderID);
|
||||||
if (order == null || userID != order.getMemberId()) {
|
if (order == null || !userID.equals(order.getMemberId())) {
|
||||||
return AjaxResult.error();
|
return AjaxResult.error();
|
||||||
}
|
}
|
||||||
return AjaxResult.success(order);
|
return AjaxResult.success(order);
|
||||||
|
|
@ -71,7 +72,7 @@ public class AjaxOrderController extends AuthController {
|
||||||
resultMap.put("productName", product.getProductName());
|
resultMap.put("productName", product.getProductName());
|
||||||
resultMap.put("productNum", productNum);
|
resultMap.put("productNum", productNum);
|
||||||
resultMap.put("productPrice", product.getAmount());
|
resultMap.put("productPrice", product.getAmount());
|
||||||
resultMap.put("orderPrice", product.getAmount() * productNum);
|
resultMap.put("orderPrice", product.getAmount().multiply(new BigDecimal(productNum)));
|
||||||
return AjaxResult.success(resultMap);
|
return AjaxResult.success(resultMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,11 @@ import com.alibaba.excel.ExcelReader;
|
||||||
import com.ruoyi.business.domain.BizAccount;
|
import com.ruoyi.business.domain.BizAccount;
|
||||||
import com.ruoyi.business.mapper.BizAccountMapper;
|
import com.ruoyi.business.mapper.BizAccountMapper;
|
||||||
import com.ruoyi.business.mapper.BizMemberMapper;
|
import com.ruoyi.business.mapper.BizMemberMapper;
|
||||||
|
import com.ruoyi.business.mapper.BizProductMapper;
|
||||||
|
import com.ruoyi.business.mapper.BizProductTypeMapper;
|
||||||
import com.ruoyi.business.service.IBizMemberService;
|
import com.ruoyi.business.service.IBizMemberService;
|
||||||
|
import com.ruoyi.business.sync.GoodsData;
|
||||||
|
import com.ruoyi.business.sync.GoodsDataListener;
|
||||||
import com.ruoyi.business.sync.UserData;
|
import com.ruoyi.business.sync.UserData;
|
||||||
import com.ruoyi.business.sync.UserDataListener;
|
import com.ruoyi.business.sync.UserDataListener;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
|
@ -27,6 +31,10 @@ public class SyncDataController extends BaseController {
|
||||||
private BizMemberMapper memberMapper;
|
private BizMemberMapper memberMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private BizAccountMapper accountMapper;
|
private BizAccountMapper accountMapper;
|
||||||
|
@Resource
|
||||||
|
private BizProductMapper productMapper;
|
||||||
|
@Resource
|
||||||
|
private BizProductTypeMapper productTypeMapper;
|
||||||
|
|
||||||
@PostMapping("/user")
|
@PostMapping("/user")
|
||||||
public AjaxResult user(@RequestParam("file") MultipartFile file) {
|
public AjaxResult user(@RequestParam("file") MultipartFile file) {
|
||||||
|
|
@ -43,6 +51,21 @@ public class SyncDataController extends BaseController {
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/goods")
|
||||||
|
public AjaxResult goods(@RequestParam("file") MultipartFile file) {
|
||||||
|
ExcelReader reader = null;
|
||||||
|
try {
|
||||||
|
reader = EasyExcel.read(file.getInputStream(), GoodsData.class, new GoodsDataListener(productMapper, productTypeMapper)).build();
|
||||||
|
reader.readAll();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
assert reader != null;
|
||||||
|
reader.finish();
|
||||||
|
}
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/initUserTree")
|
@PostMapping("/initUserTree")
|
||||||
public AjaxResult initUserTree() {
|
public AjaxResult initUserTree() {
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.ruoyi.business.domain;
|
package com.ruoyi.business.domain;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
|
@ -18,7 +19,7 @@ public class BizProduct extends BaseEntity
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 产品ID */
|
/** 产品ID */
|
||||||
private Long productId;
|
private Long id;
|
||||||
|
|
||||||
/** 产品编码 */
|
/** 产品编码 */
|
||||||
@Excel(name = "产品编码")
|
@Excel(name = "产品编码")
|
||||||
|
|
@ -38,15 +39,15 @@ public class BizProduct extends BaseEntity
|
||||||
|
|
||||||
/** 产品单价 */
|
/** 产品单价 */
|
||||||
@Excel(name = "产品单价")
|
@Excel(name = "产品单价")
|
||||||
private Long amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
/** 产品返现金额 */
|
/** 产品返现金额 */
|
||||||
@Excel(name = "产品返现金额")
|
@Excel(name = "产品返现金额")
|
||||||
private Long cashbackAmount;
|
private BigDecimal cashbackAmount;
|
||||||
|
|
||||||
/** 排序 */
|
/** 排序 */
|
||||||
@Excel(name = "排序")
|
@Excel(name = "排序")
|
||||||
private Long sort;
|
private Integer sort;
|
||||||
|
|
||||||
/** 是否上架 */
|
/** 是否上架 */
|
||||||
@Excel(name = "是否上架")
|
@Excel(name = "是否上架")
|
||||||
|
|
@ -64,15 +65,14 @@ public class BizProduct extends BaseEntity
|
||||||
private List<String> detailImages;
|
private List<String> detailImages;
|
||||||
private List<String> loopImages;
|
private List<String> loopImages;
|
||||||
|
|
||||||
public void setProductId(Long productId)
|
public Long getId() {
|
||||||
{
|
return id;
|
||||||
this.productId = productId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getProductId()
|
public void setId(Long id) {
|
||||||
{
|
this.id = id;
|
||||||
return productId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProductCode(String productCode)
|
public void setProductCode(String productCode)
|
||||||
{
|
{
|
||||||
this.productCode = productCode;
|
this.productCode = productCode;
|
||||||
|
|
@ -109,29 +109,29 @@ public class BizProduct extends BaseEntity
|
||||||
{
|
{
|
||||||
return productClass;
|
return productClass;
|
||||||
}
|
}
|
||||||
public void setAmount(Long amount)
|
public void setAmount(BigDecimal amount)
|
||||||
{
|
{
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getAmount()
|
public BigDecimal getAmount()
|
||||||
{
|
{
|
||||||
return amount;
|
return amount;
|
||||||
}
|
}
|
||||||
public void setSort(Long sort)
|
public void setSort(Integer sort)
|
||||||
{
|
{
|
||||||
this.sort = sort;
|
this.sort = sort;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getCashbackAmount() {
|
public BigDecimal getCashbackAmount() {
|
||||||
return cashbackAmount;
|
return cashbackAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCashbackAmount(Long cashbackAmount) {
|
public void setCashbackAmount(BigDecimal cashbackAmount) {
|
||||||
this.cashbackAmount = cashbackAmount;
|
this.cashbackAmount = cashbackAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getSort()
|
public Integer getSort()
|
||||||
{
|
{
|
||||||
return sort;
|
return sort;
|
||||||
}
|
}
|
||||||
|
|
@ -190,7 +190,7 @@ public class BizProduct extends BaseEntity
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
.append("productId", getProductId())
|
.append("id", getId())
|
||||||
.append("productCode", getProductCode())
|
.append("productCode", getProductCode())
|
||||||
.append("productName", getProductName())
|
.append("productName", getProductName())
|
||||||
.append("productTypeId", getProductTypeId())
|
.append("productTypeId", getProductTypeId())
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ public class BizProductImage extends BaseEntity
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 产品图片ID */
|
/** 产品图片ID */
|
||||||
private Long productImageId;
|
private Long id;
|
||||||
|
|
||||||
/** 产品ID */
|
/** 产品ID */
|
||||||
private Long productId;
|
private Long productId;
|
||||||
|
|
@ -28,15 +28,14 @@ public class BizProductImage extends BaseEntity
|
||||||
private String imageUrl;
|
private String imageUrl;
|
||||||
|
|
||||||
|
|
||||||
public void setProductImageId(Long productImageId)
|
public Long getId() {
|
||||||
{
|
return id;
|
||||||
this.productImageId = productImageId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getProductImageId()
|
public void setId(Long id) {
|
||||||
{
|
this.id = id;
|
||||||
return productImageId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProductId(Long productId)
|
public void setProductId(Long productId)
|
||||||
{
|
{
|
||||||
this.productId = productId;
|
this.productId = productId;
|
||||||
|
|
@ -67,7 +66,7 @@ public class BizProductImage extends BaseEntity
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
.append("productImageId", getProductImageId())
|
.append("id", getId())
|
||||||
.append("productId", getProductId())
|
.append("productId", getProductId())
|
||||||
.append("imageUrl", getImageUrl())
|
.append("imageUrl", getImageUrl())
|
||||||
.toString();
|
.toString();
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ public class BizProductType extends BaseEntity
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 产品分类ID */
|
/** 产品分类ID */
|
||||||
private Long productTypeId;
|
private Long id;
|
||||||
|
|
||||||
/** 产品分类编码 */
|
/** 产品分类编码 */
|
||||||
@Excel(name = "产品分类编码")
|
@Excel(name = "产品分类编码")
|
||||||
|
|
@ -37,15 +37,14 @@ public class BizProductType extends BaseEntity
|
||||||
@Excel(name = "是否禁用:0-否,1-是")
|
@Excel(name = "是否禁用:0-否,1-是")
|
||||||
private Integer isEnable;
|
private Integer isEnable;
|
||||||
|
|
||||||
public void setProductTypeId(Long productTypeId)
|
public Long getId() {
|
||||||
{
|
return id;
|
||||||
this.productTypeId = productTypeId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getProductTypeId()
|
public void setId(Long id) {
|
||||||
{
|
this.id = id;
|
||||||
return productTypeId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProductTypeCode(String productTypeCode)
|
public void setProductTypeCode(String productTypeCode)
|
||||||
{
|
{
|
||||||
this.productTypeCode = productTypeCode;
|
this.productTypeCode = productTypeCode;
|
||||||
|
|
@ -95,7 +94,7 @@ public class BizProductType extends BaseEntity
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
.append("productTypeId", getProductTypeId())
|
.append("id", getId())
|
||||||
.append("productTypeCode", getProductTypeCode())
|
.append("productTypeCode", getProductTypeCode())
|
||||||
.append("productTypeName", getProductTypeName())
|
.append("productTypeName", getProductTypeName())
|
||||||
.append("imageUrl", getImageUrl())
|
.append("imageUrl", getImageUrl())
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,14 @@ public interface BizProductTypeMapper
|
||||||
*/
|
*/
|
||||||
public BizProductType selectBizProductTypeById(Long productTypeId);
|
public BizProductType selectBizProductTypeById(Long productTypeId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询产品分类
|
||||||
|
*
|
||||||
|
* @param productTypeCode 产品分类Code
|
||||||
|
* @return 产品分类
|
||||||
|
*/
|
||||||
|
public BizProductType selectBizProductTypeByCode(String productTypeCode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询产品分类列表
|
* 查询产品分类列表
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,24 @@
|
||||||
package com.ruoyi.business.service.impl;
|
package com.ruoyi.business.service.impl;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.ruoyi.business.domain.*;
|
import com.ruoyi.business.domain.*;
|
||||||
import com.ruoyi.business.mapper.BizMemberAddressMapper;
|
import com.ruoyi.business.mapper.BizMemberAddressMapper;
|
||||||
import com.ruoyi.business.mapper.BizMemberMapper;
|
import com.ruoyi.business.mapper.BizMemberMapper;
|
||||||
|
import com.ruoyi.business.mapper.BizOrderMapper;
|
||||||
import com.ruoyi.business.mapper.BizProductMapper;
|
import com.ruoyi.business.mapper.BizProductMapper;
|
||||||
|
import com.ruoyi.business.service.IBizOrderService;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.text.Convert;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.framework.util.ShiroUtils;
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.business.mapper.BizOrderMapper;
|
|
||||||
import com.ruoyi.business.service.IBizOrderService;
|
|
||||||
import com.ruoyi.common.core.text.Convert;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单Service业务层处理
|
* 订单Service业务层处理
|
||||||
*
|
*
|
||||||
|
|
@ -28,19 +28,19 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
@Service
|
@Service
|
||||||
public class BizOrderServiceImpl implements IBizOrderService
|
public class BizOrderServiceImpl implements IBizOrderService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Resource
|
||||||
private BizOrderMapper bizOrderMapper;
|
private BizOrderMapper bizOrderMapper;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private BizProductMapper bizProductMapper;
|
private BizProductMapper bizProductMapper;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private BizMemberMapper bizMemberMapper;
|
private BizMemberMapper bizMemberMapper;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private BizMemberAddressMapper bizMemberAddressMapper;
|
private BizMemberAddressMapper bizMemberAddressMapper;
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private BizAccountServiceImpl bizAccountService;
|
private BizAccountServiceImpl bizAccountService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -162,15 +162,15 @@ public class BizOrderServiceImpl implements IBizOrderService
|
||||||
return AjaxResult.error("该商品不存在");
|
return AjaxResult.error("该商品不存在");
|
||||||
}
|
}
|
||||||
//订单总价
|
//订单总价
|
||||||
Long amount = product.getAmount();
|
BigDecimal amount = product.getAmount();
|
||||||
Long orderTotal = amount * productNum;
|
BigDecimal orderTotal = amount.multiply(new BigDecimal(productNum));
|
||||||
//判断余额
|
//判断余额
|
||||||
BizMember member = bizMemberMapper.selectBizMemberById(memberID);
|
BizMember member = bizMemberMapper.selectBizMemberById(memberID);
|
||||||
Long douBalance = member.getDouBalance();
|
Long douBalance = member.getDouBalance();
|
||||||
if (douBalance < orderTotal) {
|
if (douBalance < orderTotal.longValue()) {
|
||||||
return AjaxResult.error("福豆余额不足");
|
return AjaxResult.error("福豆余额不足");
|
||||||
}
|
}
|
||||||
Long cashbackAmount = product.getCashbackAmount() * productNum;
|
BigDecimal cashbackAmount = product.getCashbackAmount().multiply(new BigDecimal(productNum));
|
||||||
//TODO cashbackAmount 专项划拨金额等级判断
|
//TODO cashbackAmount 专项划拨金额等级判断
|
||||||
|
|
||||||
//判断地址
|
//判断地址
|
||||||
|
|
@ -185,7 +185,7 @@ public class BizOrderServiceImpl implements IBizOrderService
|
||||||
order.setMemberId(memberID);
|
order.setMemberId(memberID);
|
||||||
order.setMobile(address.getMobile());
|
order.setMobile(address.getMobile());
|
||||||
order.setMemberName(member.getMemberName());
|
order.setMemberName(member.getMemberName());
|
||||||
order.setOrderAmount(new BigDecimal(orderTotal));
|
order.setOrderAmount(orderTotal);
|
||||||
order.setOrderStatus(BizOrder.STATUS_PAYED); //已支付
|
order.setOrderStatus(BizOrder.STATUS_PAYED); //已支付
|
||||||
order.setRemark(remark);
|
order.setRemark(remark);
|
||||||
order.setAddressDetail(address.getAddress());
|
order.setAddressDetail(address.getAddress());
|
||||||
|
|
@ -198,16 +198,18 @@ public class BizOrderServiceImpl implements IBizOrderService
|
||||||
orderDetail.setProductId(productID);
|
orderDetail.setProductId(productID);
|
||||||
orderDetail.setProductCode(product.getProductName());
|
orderDetail.setProductCode(product.getProductName());
|
||||||
orderDetail.setProductCount(productNum);
|
orderDetail.setProductCount(productNum);
|
||||||
orderDetail.setProductAmount(new BigDecimal(amount));
|
orderDetail.setProductAmount(amount);
|
||||||
bizOrderMapper.insertBizOrderDetail(orderDetail);
|
bizOrderMapper.insertBizOrderDetail(orderDetail);
|
||||||
//减去福豆余额账户
|
//减去福豆余额账户
|
||||||
boolean result = bizAccountService.accountChange(memberID, BizAccount.DOU_BALANCE, BizAccountDetail.DOU_DETAIL_TYPE_ORDER, -orderTotal, String.valueOf(order.getId()), BizAccountDetail.DOU_DESC_ORDER);
|
// TODO 类型不对,同步完数据后在修改
|
||||||
|
boolean result = bizAccountService.accountChange(memberID, BizAccount.DOU_BALANCE, BizAccountDetail.DOU_DETAIL_TYPE_ORDER, -orderTotal.longValue(), String.valueOf(order.getId()), BizAccountDetail.DOU_DESC_ORDER);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return AjaxResult.error("扣款失败,请联系管理员");
|
return AjaxResult.error("扣款失败,请联系管理员");
|
||||||
}
|
}
|
||||||
//增加专项账户
|
//增加专项账户
|
||||||
if(cashbackAmount > 0) {
|
if(cashbackAmount.longValue() > 0) {
|
||||||
result = bizAccountService.accountChange(memberID, BizAccount.DOU_SPECIAL, BizAccountDetail.DOU_DETAIL_TYPE_CHARGE, cashbackAmount, String.valueOf(order.getId()), BizAccountDetail.DOU_DESC_SPECIAL1);
|
// TODO 类型不对,同步完数据后在修改
|
||||||
|
result = bizAccountService.accountChange(memberID, BizAccount.DOU_SPECIAL, BizAccountDetail.DOU_DETAIL_TYPE_CHARGE, cashbackAmount.longValue(), String.valueOf(order.getId()), BizAccountDetail.DOU_DESC_SPECIAL1);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return AjaxResult.error("扣款失败,请联系管理员");
|
return AjaxResult.error("扣款失败,请联系管理员");
|
||||||
}
|
}
|
||||||
|
|
@ -227,7 +229,7 @@ public class BizOrderServiceImpl implements IBizOrderService
|
||||||
{
|
{
|
||||||
BizOrder order = selectBizOrderById(orderID);
|
BizOrder order = selectBizOrderById(orderID);
|
||||||
//验证
|
//验证
|
||||||
if (order == null || order.getMemberId() != userID || order.getOrderStatus() != BizOrder.STATUS_DELIVERY) {
|
if (order == null || !order.getMemberId().equals(userID) || order.getOrderStatus() != BizOrder.STATUS_DELIVERY) {
|
||||||
return AjaxResult.error("订单操作失败");
|
return AjaxResult.error("订单操作失败");
|
||||||
}
|
}
|
||||||
order.setOrderStatus(BizOrder.STATUS_COMPLETED);
|
order.setOrderStatus(BizOrder.STATUS_COMPLETED);
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ public class BizProductServiceImpl implements IBizProductService
|
||||||
public int updateBizProduct(BizProduct bizProduct)
|
public int updateBizProduct(BizProduct bizProduct)
|
||||||
{
|
{
|
||||||
bizProduct.setUpdateTime(DateUtils.getNowDate());
|
bizProduct.setUpdateTime(DateUtils.getNowDate());
|
||||||
bizProductMapper.deleteBizProductImageByProductId(bizProduct.getProductId());
|
bizProductMapper.deleteBizProductImageByProductId(bizProduct.getId());
|
||||||
insertBizProductImage(bizProduct);
|
insertBizProductImage(bizProduct);
|
||||||
return bizProductMapper.updateBizProduct(bizProduct);
|
return bizProductMapper.updateBizProduct(bizProduct);
|
||||||
}
|
}
|
||||||
|
|
@ -167,7 +167,7 @@ public class BizProductServiceImpl implements IBizProductService
|
||||||
List<String> detailImages = bizProduct.getDetailImages();
|
List<String> detailImages = bizProduct.getDetailImages();
|
||||||
List<String> loopImages = bizProduct.getLoopImages();
|
List<String> loopImages = bizProduct.getLoopImages();
|
||||||
String mainImage = bizProduct.getMainImage();
|
String mainImage = bizProduct.getMainImage();
|
||||||
Long productId = bizProduct.getProductId();
|
Long productId = bizProduct.getId();
|
||||||
List<BizProductImage> list = new ArrayList<BizProductImage>();
|
List<BizProductImage> list = new ArrayList<BizProductImage>();
|
||||||
//插入三类产品图片
|
//插入三类产品图片
|
||||||
if (StringUtils.isNotEmpty(mainImage)) {
|
if (StringUtils.isNotEmpty(mainImage)) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,203 @@
|
||||||
|
package com.ruoyi.business.sync;
|
||||||
|
|
||||||
|
public class GoodsData {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private String goodsId;
|
||||||
|
private String goodsName;
|
||||||
|
private String isProduct;
|
||||||
|
private String goodsType;
|
||||||
|
private String goodsLevel;
|
||||||
|
private String unitPrice;
|
||||||
|
private String goodsDescribe;
|
||||||
|
private String goodsMainImg;
|
||||||
|
private String goodsDetailsImg;
|
||||||
|
private String itemPoints;
|
||||||
|
private String directPoints;
|
||||||
|
private String indirectPoints;
|
||||||
|
private String stockCount;
|
||||||
|
private String goodsFreight;
|
||||||
|
private String enable;
|
||||||
|
private String addtime;
|
||||||
|
private String exterd1;
|
||||||
|
private String exterd2;
|
||||||
|
private String exterd3;
|
||||||
|
private String goodsLevelName;
|
||||||
|
private String goodsLevelText;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGoodsId() {
|
||||||
|
return goodsId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGoodsId(String goodsId) {
|
||||||
|
this.goodsId = goodsId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGoodsName() {
|
||||||
|
return goodsName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGoodsName(String goodsName) {
|
||||||
|
this.goodsName = goodsName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIsProduct() {
|
||||||
|
return isProduct;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsProduct(String isProduct) {
|
||||||
|
this.isProduct = isProduct;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGoodsType() {
|
||||||
|
return goodsType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGoodsType(String goodsType) {
|
||||||
|
this.goodsType = goodsType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGoodsLevel() {
|
||||||
|
return goodsLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGoodsLevel(String goodsLevel) {
|
||||||
|
this.goodsLevel = goodsLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUnitPrice() {
|
||||||
|
return unitPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUnitPrice(String unitPrice) {
|
||||||
|
this.unitPrice = unitPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGoodsDescribe() {
|
||||||
|
return goodsDescribe;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGoodsDescribe(String goodsDescribe) {
|
||||||
|
this.goodsDescribe = goodsDescribe;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGoodsMainImg() {
|
||||||
|
return goodsMainImg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGoodsMainImg(String goodsMainImg) {
|
||||||
|
this.goodsMainImg = goodsMainImg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGoodsDetailsImg() {
|
||||||
|
return goodsDetailsImg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGoodsDetailsImg(String goodsDetailsImg) {
|
||||||
|
this.goodsDetailsImg = goodsDetailsImg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getItemPoints() {
|
||||||
|
return itemPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setItemPoints(String itemPoints) {
|
||||||
|
this.itemPoints = itemPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDirectPoints() {
|
||||||
|
return directPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDirectPoints(String directPoints) {
|
||||||
|
this.directPoints = directPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIndirectPoints() {
|
||||||
|
return indirectPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndirectPoints(String indirectPoints) {
|
||||||
|
this.indirectPoints = indirectPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStockCount() {
|
||||||
|
return stockCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStockCount(String stockCount) {
|
||||||
|
this.stockCount = stockCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGoodsFreight() {
|
||||||
|
return goodsFreight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGoodsFreight(String goodsFreight) {
|
||||||
|
this.goodsFreight = goodsFreight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEnable() {
|
||||||
|
return enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnable(String enable) {
|
||||||
|
this.enable = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAddtime() {
|
||||||
|
return addtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddtime(String addtime) {
|
||||||
|
this.addtime = addtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExterd1() {
|
||||||
|
return exterd1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExterd1(String exterd1) {
|
||||||
|
this.exterd1 = exterd1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExterd2() {
|
||||||
|
return exterd2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExterd2(String exterd2) {
|
||||||
|
this.exterd2 = exterd2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExterd3() {
|
||||||
|
return exterd3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExterd3(String exterd3) {
|
||||||
|
this.exterd3 = exterd3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGoodsLevelName() {
|
||||||
|
return goodsLevelName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGoodsLevelName(String goodsLevelName) {
|
||||||
|
this.goodsLevelName = goodsLevelName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGoodsLevelText() {
|
||||||
|
return goodsLevelText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGoodsLevelText(String goodsLevelText) {
|
||||||
|
this.goodsLevelText = goodsLevelText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
package com.ruoyi.business.sync;
|
||||||
|
|
||||||
|
import com.alibaba.excel.context.AnalysisContext;
|
||||||
|
import com.alibaba.excel.event.AnalysisEventListener;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.ruoyi.business.domain.BizProduct;
|
||||||
|
import com.ruoyi.business.domain.BizProductImage;
|
||||||
|
import com.ruoyi.business.domain.BizProductType;
|
||||||
|
import com.ruoyi.business.mapper.BizProductMapper;
|
||||||
|
import com.ruoyi.business.mapper.BizProductTypeMapper;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class GoodsDataListener extends AnalysisEventListener<GoodsData> {
|
||||||
|
|
||||||
|
private BizProductMapper productMapper;
|
||||||
|
|
||||||
|
private BizProductTypeMapper productTypeMapper;
|
||||||
|
|
||||||
|
public GoodsDataListener(BizProductMapper productMapper, BizProductTypeMapper productTypeMapper) {
|
||||||
|
this.productMapper = productMapper;
|
||||||
|
this.productTypeMapper = productTypeMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invoke(GoodsData goodsData, AnalysisContext analysisContext) {
|
||||||
|
BizProduct product = new BizProduct();
|
||||||
|
product.setId(Long.valueOf(goodsData.getId()));
|
||||||
|
product.setAmount(new BigDecimal(goodsData.getUnitPrice()));
|
||||||
|
product.setProductName(goodsData.getGoodsName());
|
||||||
|
product.setProductCode(goodsData.getGoodsId());
|
||||||
|
product.setRemark(goodsData.getGoodsDescribe());
|
||||||
|
product.setSort(1);
|
||||||
|
product.setOnlineStatus("Y".equals(goodsData.getEnable()) ? 1 : 0);
|
||||||
|
product.setOnlineTime(DateUtils.parseDate(goodsData.getAddtime()));
|
||||||
|
product.setCreateBy("admin");
|
||||||
|
product.setCreateTime(DateUtils.parseDate(goodsData.getAddtime()));
|
||||||
|
product.setProductClass("Y".equals(goodsData.getIsProduct()) ? 1 : 0);
|
||||||
|
|
||||||
|
BizProductType productType = productTypeMapper.selectBizProductTypeByCode(goodsData.getGoodsType());
|
||||||
|
if (!Objects.isNull(productType)) {
|
||||||
|
product.setProductTypeId(productType.getId());
|
||||||
|
productMapper.insertBizProduct(product);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<BizProductImage> images = Lists.newArrayList();
|
||||||
|
if (StringUtils.isNotEmpty(goodsData.getExterd1())) {
|
||||||
|
BizProductImage mainImage = new BizProductImage();
|
||||||
|
mainImage.setProductId(product.getId());
|
||||||
|
mainImage.setImageUrl(goodsData.getExterd1());
|
||||||
|
mainImage.setImageType(0);
|
||||||
|
images.add(mainImage);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotEmpty(goodsData.getExterd2())) {
|
||||||
|
String[] detailImages = goodsData.getExterd2().split(",");
|
||||||
|
for (String image : detailImages) {
|
||||||
|
BizProductImage detailImage = new BizProductImage();
|
||||||
|
detailImage.setProductId(product.getId());
|
||||||
|
detailImage.setImageUrl(image);
|
||||||
|
detailImage.setImageType(1);
|
||||||
|
images.add(detailImage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotEmpty(goodsData.getExterd3())) {
|
||||||
|
String[] runImages = goodsData.getExterd3().split(",");
|
||||||
|
for (String image : runImages) {
|
||||||
|
BizProductImage runImage = new BizProductImage();
|
||||||
|
runImage.setProductId(product.getId());
|
||||||
|
runImage.setImageUrl(image);
|
||||||
|
runImage.setImageType(2);
|
||||||
|
images.add(runImage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!CollectionUtils.isEmpty(images)) {
|
||||||
|
productMapper.batchBizProductImage(images);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,7 +5,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<mapper namespace="com.ruoyi.business.mapper.BizProductMapper">
|
<mapper namespace="com.ruoyi.business.mapper.BizProductMapper">
|
||||||
|
|
||||||
<resultMap type="BizProduct" id="BizProductResult">
|
<resultMap type="BizProduct" id="BizProductResult">
|
||||||
<result property="productId" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="productCode" column="product_code" />
|
<result property="productCode" column="product_code" />
|
||||||
<result property="productName" column="product_name" />
|
<result property="productName" column="product_name" />
|
||||||
<result property="productTypeId" column="product_type_id" />
|
<result property="productTypeId" column="product_type_id" />
|
||||||
|
|
@ -24,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap type="BizProductImage" id="BizProductImageResult">
|
<resultMap type="BizProductImage" id="BizProductImageResult">
|
||||||
<result property="productImageId" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="productId" column="product_id" />
|
<result property="productId" column="product_id" />
|
||||||
<result property="imageType" column="image_type" />
|
<result property="imageType" column="image_type" />
|
||||||
<result property="imageUrl" column="image_url" />
|
<result property="imageUrl" column="image_url" />
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<mapper namespace="com.ruoyi.business.mapper.BizProductTypeMapper">
|
<mapper namespace="com.ruoyi.business.mapper.BizProductTypeMapper">
|
||||||
|
|
||||||
<resultMap type="BizProductType" id="BizProductTypeResult">
|
<resultMap type="BizProductType" id="BizProductTypeResult">
|
||||||
<result property="productTypeId" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="productTypeCode" column="product_type_code" />
|
<result property="productTypeCode" column="product_type_code" />
|
||||||
<result property="productTypeName" column="product_type_name" />
|
<result property="productTypeName" column="product_type_name" />
|
||||||
<result property="imageUrl" column="image_url" />
|
<result property="imageUrl" column="image_url" />
|
||||||
|
|
@ -35,6 +35,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where id = #{productTypeId}
|
where id = #{productTypeId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectBizProductTypeByCode" parameterType="String" resultMap="BizProductTypeResult">
|
||||||
|
<include refid="selectBizProductTypeVo"/>
|
||||||
|
where product_type_code = #{productTypeCode} limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertBizProductType" parameterType="BizProductType" useGeneratedKeys="true" keyProperty="productTypeId">
|
<insert id="insertBizProductType" parameterType="BizProductType" useGeneratedKeys="true" keyProperty="productTypeId">
|
||||||
insert into biz_product_type
|
insert into biz_product_type
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
</head>
|
</head>
|
||||||
<body class="white-bg">
|
<body class="white-bg">
|
||||||
<form class="form-horizontal m" id="form-product-edit" >
|
<form class="form-horizontal m" id="form-product-edit" >
|
||||||
<input name="productId" th:field="*{bizProduct.productId}" type="hidden">
|
<input name="id" th:field="*{bizProduct.id}" type="hidden">
|
||||||
<input id="hiddenDetail" th:value="*{bizProduct.detailImages}" type="hidden">
|
<input id="hiddenDetail" th:value="*{bizProduct.detailImages}" type="hidden">
|
||||||
<input id="hiddenLoop" th:value="*{bizProduct.loopImages}" type="hidden">
|
<input id="hiddenLoop" th:value="*{bizProduct.loopImages}" type="hidden">
|
||||||
<div class="tabs-container">
|
<div class="tabs-container">
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
<label class="col-sm-3 control-label is-required">产品分类:</label>
|
<label class="col-sm-3 control-label is-required">产品分类:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<select th:field="*{bizProduct.productTypeId}" name="productTypeId" class="form-control m-b" required>
|
<select th:field="*{bizProduct.productTypeId}" name="productTypeId" class="form-control m-b" required>
|
||||||
<option th:each="ptype:${productTypeList}" th:value="*{ptype.productTypeId}" th:text="*{ptype.productTypeName}"></option>
|
<option th:each="ptype:${productTypeList}" th:value="*{ptype.id}" th:text="*{ptype.productTypeName}"></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,9 @@
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label>产品分类:</label>
|
<label>产品分类:</label>
|
||||||
<select name="productTypeId">
|
<select name="id">
|
||||||
<option value="">所有</option>
|
<option value="">所有</option>
|
||||||
<option class="typeOption" th:each="ptype:${productTypeList}" th:value="*{ptype.productTypeId}" th:text="*{ptype.productTypeName}"></option>
|
<option class="typeOption" th:each="ptype:${productTypeList}" th:value="*{ptype.id}" th:text="*{ptype.productTypeName}"></option>
|
||||||
</select>
|
</select>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
|
@ -92,7 +92,7 @@
|
||||||
checkbox: true
|
checkbox: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'productId',
|
field: 'id',
|
||||||
title: '产品ID',
|
title: '产品ID',
|
||||||
visible: false
|
visible: false
|
||||||
},
|
},
|
||||||
|
|
@ -147,9 +147,9 @@
|
||||||
align: 'center',
|
align: 'center',
|
||||||
formatter: function(value, row, index) {
|
formatter: function(value, row, index) {
|
||||||
var actions = [];
|
var actions = [];
|
||||||
actions.push('<a class="btn btn-' + (value ? 'warning' : 'primary') + ' btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="productStatusEdit(\'' + row.productId + '\', ' + value + ')"><i class="fa fa-' + (value ? 'level-down' : 'level-up') + '"></i>' + (value ? '下架' : '上架') + '</a> ');
|
actions.push('<a class="btn btn-' + (value ? 'warning' : 'primary') + ' btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="productStatusEdit(\'' + row.id + '\', ' + value + ')"><i class="fa fa-' + (value ? 'level-down' : 'level-up') + '"></i>' + (value ? '下架' : '上架') + '</a> ');
|
||||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.productId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.productId + '\')"><i class="fa fa-remove"></i>删除</a>');
|
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||||
return actions.join('');
|
return actions.join('');
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.ruoyi.common.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前端接口鉴权
|
||||||
|
* @author bei.wu
|
||||||
|
*/
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface AjaxLogin
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.ruoyi.framework.config;
|
package com.ruoyi.framework.config;
|
||||||
|
|
||||||
|
import com.ruoyi.framework.interceptor.AjaxAuthenticationInterceptor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
@ -27,6 +28,8 @@ public class ResourcesConfig implements WebMvcConfigurer
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RepeatSubmitInterceptor repeatSubmitInterceptor;
|
private RepeatSubmitInterceptor repeatSubmitInterceptor;
|
||||||
|
@Autowired
|
||||||
|
private AjaxAuthenticationInterceptor ajaxAuthenticationInterceptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 默认首页的设置,当输入域名是可以自动跳转到默认指定的网页
|
* 默认首页的设置,当输入域名是可以自动跳转到默认指定的网页
|
||||||
|
|
@ -55,5 +58,6 @@ public class ResourcesConfig implements WebMvcConfigurer
|
||||||
public void addInterceptors(InterceptorRegistry registry)
|
public void addInterceptors(InterceptorRegistry registry)
|
||||||
{
|
{
|
||||||
registry.addInterceptor(repeatSubmitInterceptor).addPathPatterns("/**");
|
registry.addInterceptor(repeatSubmitInterceptor).addPathPatterns("/**");
|
||||||
|
registry.addInterceptor(ajaxAuthenticationInterceptor).addPathPatterns("/ajax/**");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.ruoyi.framework.interceptor;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* /ajax/**
|
||||||
|
* 所有接口身份认证拦截器
|
||||||
|
* @author bei.wu
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class AjaxAuthenticationInterceptor extends HandlerInterceptorAdapter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||||
|
return super.preHandle(request, response, handler);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue