Merge remote-tracking branch 'origin/zcc'
This commit is contained in:
@@ -86,11 +86,33 @@ public class BookLabelAndMarketController {
|
||||
|
||||
@RequestMapping(path = "/saveOrUpdateLabel")
|
||||
public R saveOrUpdateLabel(@RequestBody ShopProductBookLabel label) {
|
||||
if (label.getIsLast()==1){
|
||||
labelService.saveOrUpdate(label);
|
||||
return R.ok().put("result",label);
|
||||
if (label.getId()==null){
|
||||
if(label.getPid()==0){
|
||||
labelService.save(label);
|
||||
return R.ok().put("result",label);
|
||||
}else {
|
||||
ShopProductBookLabel l = labelService.getById(label.getPid());
|
||||
if (l.getIsLast()==1){
|
||||
return R.error("请将父标签设置为非最后一集");
|
||||
}else {
|
||||
labelService.save(label);
|
||||
return R.ok().put("result",label);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
return R.error("父标签非最后一集");
|
||||
if (label.getIsLast() == 1){
|
||||
List llast = labelService.list(new LambdaQueryWrapper<ShopProductBookLabel>()
|
||||
.eq(ShopProductBookLabel::getPid,label.getId()));
|
||||
if (llast.size()>0){
|
||||
return R.error("请先删除子集,再设置为最后一集");
|
||||
}else {
|
||||
labelService.saveOrUpdate(label);
|
||||
return R.ok().put("result",label);
|
||||
}
|
||||
}else {
|
||||
labelService.saveOrUpdate(label);
|
||||
return R.ok().put("result",label);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +130,13 @@ public class BookLabelAndMarketController {
|
||||
return R.ok();
|
||||
}
|
||||
}else {
|
||||
return R.error("请先删除子集,设置成最后一集");
|
||||
List<ShopProductBookLabel> labelList = labelService.list(new LambdaQueryWrapper<ShopProductBookLabel>().eq(ShopProductBookLabel::getPid,id));
|
||||
if (labelList.size() > 0) {
|
||||
return R.error("请先删除子集,设置成最后一集");
|
||||
}else {
|
||||
labelService.removeById(id);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,11 +147,33 @@ public class BookLabelAndMarketController {
|
||||
|
||||
@RequestMapping(path = "/saveOrUpdateMarket")
|
||||
public R saveOrUpdateMarket(@RequestBody ShopProductBookMarket market) {
|
||||
if (market.getIsLast()==1){
|
||||
marketService.saveOrUpdate(market);
|
||||
return R.ok().put("result",market);
|
||||
if (market.getId()==null){
|
||||
if(market.getPid()==0){
|
||||
marketService.save(market);
|
||||
return R.ok().put("result",market);
|
||||
}else {
|
||||
ShopProductBookMarket m = marketService.getById(market.getPid());
|
||||
if (m.getIsLast()==1){
|
||||
return R.error("请将父标签设置为非最后一集");
|
||||
}else {
|
||||
marketService.save(market);
|
||||
return R.ok().put("result",market);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
return R.error("父标签非最后一集");
|
||||
if (market.getIsLast() == 1){
|
||||
List mList = marketService.list(new LambdaQueryWrapper<ShopProductBookMarket>()
|
||||
.eq(ShopProductBookMarket::getPid,market.getId()));
|
||||
if (mList.size()>0){
|
||||
return R.error("请先删除子集,再设置为最后一集");
|
||||
}else {
|
||||
marketService.saveOrUpdate(market);
|
||||
return R.ok().put("result",market);
|
||||
}
|
||||
}else {
|
||||
marketService.saveOrUpdate(market);
|
||||
return R.ok().put("result",market);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +191,13 @@ public class BookLabelAndMarketController {
|
||||
return R.ok();
|
||||
}
|
||||
}else {
|
||||
return R.error("请先删除子集,设置成最后一集");
|
||||
List<ShopProductBookMarket> marketList = marketService.list(new LambdaQueryWrapper<ShopProductBookMarket>().eq(ShopProductBookMarket::getPid,id));
|
||||
if (marketList.size() > 0) {
|
||||
return R.error("请先删除子集,设置成最后一集");
|
||||
}else {
|
||||
marketService.removeById(id);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,6 +210,9 @@ public class BookLabelAndMarketController {
|
||||
if (params.containsKey("goodsType")&&!"".equals(params.get("goodsType").toString())){
|
||||
wrapper.eq(ShopProduct::getGoodsType,params.get("goodsType").toString());
|
||||
}
|
||||
if (params.containsKey("productName")&&!"".equals(params.get("productName").toString())){
|
||||
wrapper.like(ShopProduct::getProductName,params.get("productName").toString());
|
||||
}
|
||||
if (params.containsKey("bookLabelId")&&!"".equals(params.get("bookLabelId").toString())){
|
||||
String sql = "select product_id from shop_product_to_book_label where del_flag = 0 and book_label_id = "+params.get("bookLabelId");
|
||||
wrapper.notInSql(ShopProduct::getProductId,sql);
|
||||
@@ -267,19 +326,29 @@ public class BookLabelAndMarketController {
|
||||
|
||||
@RequestMapping(path = "/delToLable")
|
||||
public R delToLable(String lableId,String productId) {
|
||||
LambdaQueryWrapper<ShopProductToBookLabel> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(ShopProductToBookLabel::getBookLabelId,lableId);
|
||||
wrapper.eq(ShopProductToBookLabel::getProductId,productId);
|
||||
toLabelService.remove(wrapper);
|
||||
if(StringUtils.isNotEmpty(productId)){
|
||||
String[] productIds = productId.split(",");
|
||||
for(String id : productIds){
|
||||
LambdaQueryWrapper<ShopProductToBookLabel> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(ShopProductToBookLabel::getBookLabelId,lableId);
|
||||
wrapper.eq(ShopProductToBookLabel::getProductId,id);
|
||||
toLabelService.remove(wrapper);
|
||||
}
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/delToMarket")
|
||||
public R delToMarket(String marketId,String productId) {
|
||||
LambdaQueryWrapper<ShopProductToBookMarket> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(ShopProductToBookMarket::getBookMarketId,marketId);
|
||||
wrapper.eq(ShopProductToBookMarket::getProductId,productId);
|
||||
toMarketService.remove(wrapper);
|
||||
if(StringUtils.isNotEmpty(productId)){
|
||||
String[] productIds = productId.split(",");
|
||||
for(String id : productIds){
|
||||
LambdaQueryWrapper<ShopProductToBookMarket> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(ShopProductToBookMarket::getBookMarketId,marketId);
|
||||
wrapper.eq(ShopProductToBookMarket::getProductId,id);
|
||||
toMarketService.remove(wrapper);
|
||||
}
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@@ -722,9 +722,7 @@ public class BuyOrderController {
|
||||
@RequestMapping(value = "/delivery", method = RequestMethod.POST)
|
||||
public R delivery(@RequestParam("expressCompanyCode") String expressCompanyCode,
|
||||
@RequestBody List<Integer> buyOrderProductId) throws Exception {
|
||||
buyOrderService.delivery(expressCompanyCode, buyOrderProductId);
|
||||
return R.ok();
|
||||
|
||||
return buyOrderService.delivery(expressCompanyCode, buyOrderProductId);
|
||||
}
|
||||
|
||||
@RequestMapping("/mytest")
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.peanut.modules.book.service;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.BuyOrder;
|
||||
import com.peanut.modules.book.to.UserOrderDto;
|
||||
import com.peanut.modules.book.vo.UserOrderVo;
|
||||
@@ -49,7 +50,7 @@ public interface BuyOrderService extends IService<BuyOrder> {
|
||||
* @param expressCompanyCode 快递公司代码
|
||||
* @param buyOrderDetailId 订单详情 ID 列表
|
||||
*/
|
||||
void delivery(String expressCompanyCode, List<Integer> buyOrderDetailId);
|
||||
R delivery(String expressCompanyCode, List<Integer> buyOrderDetailId);
|
||||
|
||||
Page<BuyOrder> getUserOrderList(UserOrderDto userOrderDto);
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.common.utils.ExcludeEmptyQueryWrapper;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.Query;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.config.Constants;
|
||||
import com.peanut.modules.common.dao.BuyOrderDao;
|
||||
import com.peanut.modules.common.dao.BuyOrderProductDao;
|
||||
@@ -490,7 +491,7 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delivery(String expressCompanyCode, List<Integer> buyOrderProductId) {
|
||||
public R delivery(String expressCompanyCode, List<Integer> buyOrderProductId) {
|
||||
QueryWrapper<BuyOrderProduct> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("id", buyOrderProductId);
|
||||
List<BuyOrderProduct> buyOrderProductList = buyOrderProductService.list(queryWrapper);
|
||||
@@ -518,16 +519,9 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
||||
commodityList.add(commodity);
|
||||
ln++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 获取用户地址
|
||||
Integer orderId = buyOrderProductList.get(0).getOrderId();
|
||||
|
||||
BuyOrder buyOrder = getById(orderId);
|
||||
|
||||
// System.out.println(buyOrder);
|
||||
|
||||
QueryWrapper<County> countyQueryWrapper = new QueryWrapper<>();
|
||||
countyQueryWrapper.eq("county_name", buyOrder.getDistrict());
|
||||
List<County> counties = countyService.getBaseMapper().selectList(countyQueryWrapper);
|
||||
@@ -536,11 +530,8 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
||||
countyQueryWrapper.eq("city_id",one.getCityId());
|
||||
}
|
||||
County county = countyService.getOne(countyQueryWrapper);
|
||||
|
||||
|
||||
// 计算快递费用
|
||||
BigDecimal expressFee = expressFeeService.calculateExpressFee(expressCompanyCode, totalWeight, county.getRegionCode());
|
||||
|
||||
ExpressOrder expressOrder = new ExpressOrder();
|
||||
expressOrder.setExpressFee(expressFee);
|
||||
expressOrder.setCreateTime(new Date());
|
||||
@@ -557,34 +548,39 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
||||
expressOrder.setRemark(remark);
|
||||
// 生成快递面单
|
||||
ExpressOrderResponseVo response = expressOrderService.placeExpressOrder(expressOrder);
|
||||
String expressOrderSn = response.getOrder().getLogisticCode();
|
||||
if(response.isSuccess()){
|
||||
String expressOrderSn = response.getOrder().getLogisticCode();
|
||||
// String printTemplate = response.getPrintTemplate();
|
||||
String printTemplate = pushHtmlToOss(response.getPrintTemplate(),expressOrderSn+".html");
|
||||
String printTemplate = pushHtmlToOss(response.getPrintTemplate(),expressOrderSn+".html");
|
||||
|
||||
expressOrder.setExpressOrderSn(expressOrderSn);
|
||||
expressOrder.setPrintTemplate(printTemplate);
|
||||
expressOrderDao.insert(expressOrder);
|
||||
int expressOrderId = expressOrder.getId();
|
||||
for (BuyOrderProduct buyOrderProduct : buyOrderProductList) {
|
||||
buyOrderProduct.setExpressOrderId(expressOrderId);
|
||||
buyOrderProduct.setShipped(1);
|
||||
}
|
||||
buyOrderProductService.updateBatchById(buyOrderProductList);
|
||||
|
||||
//更改订单状态
|
||||
QueryWrapper<BuyOrder> buyOrderQueryWrapper = new QueryWrapper<>();
|
||||
buyOrderQueryWrapper.in("order_id", buyOrderIdList);
|
||||
List<BuyOrder> buyOrderList = list(buyOrderQueryWrapper);
|
||||
for (BuyOrder buyorder : buyOrderList) {
|
||||
QueryWrapper<BuyOrderProduct> buyOrderProductQueryWrapper = new QueryWrapper<>();
|
||||
buyOrderProductQueryWrapper.eq("order_id", buyorder.getOrderId());
|
||||
buyOrderProductQueryWrapper.eq("express_order_id", 0);
|
||||
int count = buyOrderProductService.count(buyOrderProductQueryWrapper);
|
||||
if (count == 0) {
|
||||
buyorder.setOrderStatus(Constants.ORDER_STATUS_SHIPPED);
|
||||
expressOrder.setExpressOrderSn(expressOrderSn);
|
||||
expressOrder.setPrintTemplate(printTemplate);
|
||||
expressOrderDao.insert(expressOrder);
|
||||
int expressOrderId = expressOrder.getId();
|
||||
for (BuyOrderProduct buyOrderProduct : buyOrderProductList) {
|
||||
buyOrderProduct.setExpressOrderId(expressOrderId);
|
||||
buyOrderProduct.setShipped(1);
|
||||
}
|
||||
buyOrderProductService.updateBatchById(buyOrderProductList);
|
||||
|
||||
//更改订单状态
|
||||
QueryWrapper<BuyOrder> buyOrderQueryWrapper = new QueryWrapper<>();
|
||||
buyOrderQueryWrapper.in("order_id", buyOrderIdList);
|
||||
List<BuyOrder> buyOrderList = list(buyOrderQueryWrapper);
|
||||
for (BuyOrder buyorder : buyOrderList) {
|
||||
QueryWrapper<BuyOrderProduct> buyOrderProductQueryWrapper = new QueryWrapper<>();
|
||||
buyOrderProductQueryWrapper.eq("order_id", buyorder.getOrderId());
|
||||
buyOrderProductQueryWrapper.eq("express_order_id", 0);
|
||||
int count = buyOrderProductService.count(buyOrderProductQueryWrapper);
|
||||
if (count == 0) {
|
||||
buyorder.setOrderStatus(Constants.ORDER_STATUS_SHIPPED);
|
||||
}
|
||||
}
|
||||
updateBatchById(buyOrderList);
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error(response.getReason());
|
||||
}
|
||||
updateBatchById(buyOrderList);
|
||||
}
|
||||
|
||||
public String mytest() throws IOException {
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.peanut.modules.common.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.Message;
|
||||
import com.peanut.modules.common.service.MessageService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 公共消息
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController("commonMessage")
|
||||
@RequestMapping("common/message")
|
||||
public class MessageController {
|
||||
|
||||
@Autowired
|
||||
private MessageService messageService;
|
||||
|
||||
@RequestMapping("/listByPage")
|
||||
public R listByPage(@RequestBody Map<String, Object> params) {
|
||||
LambdaQueryWrapper<Message> wrapper = new LambdaQueryWrapper();
|
||||
if (params.containsKey("title")&& StringUtils.isNotEmpty(params.get("title").toString())) {
|
||||
wrapper.like(Message::getTitle,params.get("title"));
|
||||
}
|
||||
if (params.containsKey("type")&& StringUtils.isNotEmpty(params.get("type").toString())) {
|
||||
wrapper.eq(Message::getType,params.get("type"));
|
||||
}
|
||||
if (params.containsKey("isBook")&& StringUtils.isNotEmpty(params.get("isBook").toString())) {
|
||||
wrapper.eq(Message::getIsBook,params.get("isBook"));
|
||||
}
|
||||
if (params.containsKey("isMedical")&& StringUtils.isNotEmpty(params.get("isMedical").toString())) {
|
||||
wrapper.eq(Message::getIsBook,params.get("isMedical"));
|
||||
}
|
||||
if (params.containsKey("isSociology")&& StringUtils.isNotEmpty(params.get("isSociology").toString())) {
|
||||
wrapper.eq(Message::getIsBook,params.get("isSociology"));
|
||||
}
|
||||
wrapper.orderByDesc(Message::getCreateTime);
|
||||
Page<Message> page = messageService.page(new Page<>(
|
||||
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())), wrapper);
|
||||
return R.ok().put("result", page);
|
||||
}
|
||||
|
||||
@RequestMapping("/getMessageById")
|
||||
public R getMessageById(String id) {
|
||||
return R.ok().put("result", messageService.getById(id));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.peanut.modules.common.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.ShopProduct;
|
||||
import com.peanut.modules.common.entity.ShopProductRecord;
|
||||
import com.peanut.modules.common.service.ShopProductRecordService;
|
||||
import com.peanut.modules.master.service.ShopProductService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 商品评价管理
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController("commonShopProductRecord")
|
||||
@RequestMapping("common/shopProductRecord")
|
||||
public class ShopProductRecordController {
|
||||
|
||||
@Autowired
|
||||
private ShopProductRecordService recordService;
|
||||
@Autowired
|
||||
private ShopProductService productService;
|
||||
|
||||
@RequestMapping("/listByPage")
|
||||
public R listByPage(@RequestBody Map<String, Object> params) {
|
||||
MPJLambdaWrapper<ShopProductRecord> wrapper = new MPJLambdaWrapper();
|
||||
if (params.containsKey("userId")&&StringUtils.isNotEmpty(params.get("userId").toString())) {
|
||||
wrapper.eq(ShopProductRecord::getUserId,params.get("userId"));
|
||||
}
|
||||
if (params.containsKey("productId")&&StringUtils.isNotEmpty(params.get("productId").toString())) {
|
||||
wrapper.eq(ShopProductRecord::getProductId,params.get("productId"));
|
||||
}
|
||||
if (params.containsKey("state")&&StringUtils.isNotEmpty(params.get("state").toString())) {
|
||||
wrapper.eq(ShopProductRecord::getState,params.get("state"));
|
||||
}
|
||||
wrapper.orderByAsc(ShopProductRecord::getCreateTime);
|
||||
Page<ShopProductRecord> records = recordService.page(new Page<>(
|
||||
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())), wrapper);
|
||||
List<ShopProductRecord> result = records.getRecords();
|
||||
if (result.size() > 0) {
|
||||
for (ShopProductRecord record:result){
|
||||
ShopProduct product = productService.getById(record.getProductId());
|
||||
record.setProduct(product);
|
||||
}
|
||||
}
|
||||
return R.ok().put("result", records);
|
||||
}
|
||||
|
||||
@RequestMapping("/saveRecord")
|
||||
public R saveRecord(@RequestBody ShopProductRecord record) {
|
||||
record.setRecordTime(new Date());
|
||||
record.setState(1);
|
||||
recordService.saveOrUpdate(record);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping("/reSaveRecord")
|
||||
public R reSaveRecord(@RequestBody ShopProductRecord record) {
|
||||
record.setReRecordTime(new Date());
|
||||
recordService.saveOrUpdate(record);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.common.dao;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.peanut.modules.common.entity.Message;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface MessageDao extends MPJBaseMapper<Message> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.common.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.peanut.modules.common.entity.ShopProductRecord;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ShopProductRecordDao extends BaseMapper<ShopProductRecord> {
|
||||
}
|
||||
59
src/main/java/com/peanut/modules/common/entity/Message.java
Normal file
59
src/main/java/com/peanut/modules/common/entity/Message.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package com.peanut.modules.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("message")
|
||||
public class Message {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 0本地信息1外链
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 本地信息内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 外链地址
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 是否在疯子读书显示0否1是
|
||||
*/
|
||||
private Integer isBook;
|
||||
|
||||
/**
|
||||
* 是否在医学视频显示
|
||||
*/
|
||||
private Integer isMedical;
|
||||
|
||||
/**
|
||||
* 是否在国学显示0否1是
|
||||
*/
|
||||
private Integer isSociology;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.peanut.modules.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 商品评价
|
||||
*/
|
||||
@Data
|
||||
@TableName("shop_product_record")
|
||||
public class ShopProductRecord implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@TableId
|
||||
private Integer id;
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
private Integer productId;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 评价内容
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String images;
|
||||
/**
|
||||
* 追评内容
|
||||
*/
|
||||
private String reContent;
|
||||
/**
|
||||
* 追评图片
|
||||
*/
|
||||
private String reImages;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 评价时间
|
||||
*/
|
||||
private Date recordTime;
|
||||
/**
|
||||
* 追评时间
|
||||
*/
|
||||
private Date reRecordTime;
|
||||
/**
|
||||
* 0未评价1已评
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private ShopProduct product;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.peanut.modules.common.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.Message;
|
||||
|
||||
public interface MessageService extends IService<Message> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.peanut.modules.common.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.ShopProductRecord;
|
||||
|
||||
public interface ShopProductRecordService extends IService<ShopProductRecord> {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.peanut.modules.common.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.MessageDao;
|
||||
import com.peanut.modules.common.entity.Message;
|
||||
import com.peanut.modules.common.service.MessageService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service("commonMessageService")
|
||||
public class MessageServiceImpl extends ServiceImpl<MessageDao, Message> implements MessageService {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.peanut.modules.common.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.ShopProductRecordDao;
|
||||
import com.peanut.modules.common.entity.ShopProductRecord;
|
||||
import com.peanut.modules.common.service.ShopProductRecordService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service("commonShopProductRecordService")
|
||||
public class ShopProductRecordServiceImpl extends ServiceImpl<ShopProductRecordDao, ShopProductRecord> implements ShopProductRecordService {
|
||||
}
|
||||
@@ -2,13 +2,11 @@ package com.peanut.modules.job.task;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.modules.common.entity.BuyOrder;
|
||||
import com.peanut.modules.common.entity.BuyOrderProduct;
|
||||
import com.peanut.modules.common.entity.ExpressOrder;
|
||||
import com.peanut.modules.common.entity.ExpressQueryResponse;
|
||||
import com.peanut.modules.common.entity.*;
|
||||
import com.peanut.modules.book.service.BuyOrderProductService;
|
||||
import com.peanut.modules.book.service.BuyOrderService;
|
||||
import com.peanut.modules.book.service.ExpressOrderService;
|
||||
import com.peanut.modules.common.service.ShopProductRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.util.List;
|
||||
@@ -23,6 +21,8 @@ public class ExpressTask implements ITask{
|
||||
private BuyOrderProductService productService;
|
||||
@Autowired
|
||||
private ExpressOrderService expressOrderService;
|
||||
@Autowired
|
||||
private ShopProductRecordService recordService;
|
||||
|
||||
@Override
|
||||
public void run(String params) {
|
||||
@@ -37,6 +37,7 @@ public class ExpressTask implements ITask{
|
||||
for (BuyOrder buyOrder : list) {
|
||||
MPJLambdaWrapper<BuyOrderProduct> w = new MPJLambdaWrapper();
|
||||
w.selectAll(ExpressOrder.class);
|
||||
w.selectAs(BuyOrderProduct::getProductId,"productId");
|
||||
w.eq(BuyOrderProduct::getOrderId,buyOrder.getOrderId());
|
||||
w.leftJoin(ExpressOrder.class,ExpressOrder::getId,BuyOrderProduct::getExpressOrderId);
|
||||
List<Map<String,Object>> plist = productService.listMaps(w);
|
||||
@@ -55,6 +56,12 @@ public class ExpressTask implements ITask{
|
||||
if (flag){
|
||||
buyOrder.setOrderStatus("3");
|
||||
buyOrderService.saveOrUpdate(buyOrder);
|
||||
for (Map<String,Object> m : plist){
|
||||
ShopProductRecord record = new ShopProductRecord();
|
||||
record.setProductId(Integer.parseInt(m.get("productId").toString()));
|
||||
record.setUserId(buyOrder.getUserId());
|
||||
recordService.save(record);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.peanut.modules.master.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.Message;
|
||||
import com.peanut.modules.master.service.MessageService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 公共消息
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController("masterMessage")
|
||||
@RequestMapping("master/message")
|
||||
public class MessageController {
|
||||
|
||||
@Autowired
|
||||
private MessageService messageService;
|
||||
|
||||
@RequestMapping("/listByPage")
|
||||
public R listByPage(@RequestBody Map<String, Object> params) {
|
||||
LambdaQueryWrapper<Message> wrapper = new LambdaQueryWrapper();
|
||||
if (params.containsKey("title")&& StringUtils.isNotEmpty(params.get("title").toString())) {
|
||||
wrapper.like(Message::getTitle,params.get("title"));
|
||||
}
|
||||
if (params.containsKey("type")&& StringUtils.isNotEmpty(params.get("type").toString())) {
|
||||
wrapper.eq(Message::getType,params.get("type"));
|
||||
}
|
||||
if (params.containsKey("isBook")&& StringUtils.isNotEmpty(params.get("isBook").toString())) {
|
||||
wrapper.eq(Message::getIsBook,params.get("isBook"));
|
||||
}
|
||||
if (params.containsKey("isMedical")&& StringUtils.isNotEmpty(params.get("isMedical").toString())) {
|
||||
wrapper.eq(Message::getIsBook,params.get("isMedical"));
|
||||
}
|
||||
if (params.containsKey("isSociology")&& StringUtils.isNotEmpty(params.get("isSociology").toString())) {
|
||||
wrapper.eq(Message::getIsBook,params.get("isSociology"));
|
||||
}
|
||||
wrapper.orderByDesc(Message::getCreateTime);
|
||||
Page<Message> page = messageService.page(new Page<>(
|
||||
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())), wrapper);
|
||||
return R.ok().put("result", page);
|
||||
}
|
||||
|
||||
@RequestMapping("/getMessageById")
|
||||
public R getMessageById(String id) {
|
||||
return R.ok().put("result", messageService.getById(id));
|
||||
}
|
||||
|
||||
@RequestMapping("/saveOrUpdateMessage")
|
||||
public R saveOrUpdateMessage(@RequestBody Message message) {
|
||||
messageService.saveOrUpdate(message);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping("/delMessage")
|
||||
public R delMessage(String id) {
|
||||
messageService.removeById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.peanut.modules.master.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.ShopProductRecord;
|
||||
import com.peanut.modules.master.service.ShopProductRecordService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 商品评价管理
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController("masterShopProductRecord")
|
||||
@RequestMapping("master/shopProductRecord")
|
||||
public class ShopProductRecordController {
|
||||
|
||||
@Autowired
|
||||
private ShopProductRecordService recordService;
|
||||
|
||||
@RequestMapping("/listByPage")
|
||||
public R listByPage(@RequestBody Map<String, Object> params) {
|
||||
MPJLambdaWrapper<ShopProductRecord> wrapper = new MPJLambdaWrapper();
|
||||
if (params.containsKey("productId")&&StringUtils.isNotEmpty(params.get("productId").toString())) {
|
||||
wrapper.eq(ShopProductRecord::getProductId,params.get("productId"));
|
||||
}
|
||||
if (params.containsKey("content")&&StringUtils.isNotEmpty(params.get("content").toString())) {
|
||||
wrapper.like(ShopProductRecord::getContent,params.get("content"));
|
||||
}
|
||||
if (params.containsKey("reContent")&&StringUtils.isNotEmpty(params.get("reContent").toString())) {
|
||||
wrapper.like(ShopProductRecord::getReContent,params.get("reContent"));
|
||||
}
|
||||
wrapper.orderByDesc(ShopProductRecord::getRecordTime);
|
||||
Page<ShopProductRecord> records = recordService.page(new Page<>(
|
||||
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())), wrapper);
|
||||
return R.ok().put("result", records);
|
||||
}
|
||||
|
||||
@RequestMapping("/delRecord")
|
||||
public R delRecord(String id) {
|
||||
recordService.removeById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.peanut.modules.master.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.Message;
|
||||
|
||||
public interface MessageService extends IService<Message> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.peanut.modules.master.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.ShopProductRecord;
|
||||
|
||||
public interface ShopProductRecordService extends IService<ShopProductRecord> {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.peanut.modules.master.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.MessageDao;
|
||||
import com.peanut.modules.common.entity.Message;
|
||||
import com.peanut.modules.master.service.MessageService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service("messageService")
|
||||
public class MessageServiceImpl extends ServiceImpl<MessageDao, Message> implements MessageService {
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.peanut.modules.master.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.ShopProductRecordDao;
|
||||
import com.peanut.modules.common.entity.ShopProductRecord;
|
||||
import com.peanut.modules.master.service.ShopProductRecordService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service("masterShopProductRecordService")
|
||||
public class ShopProductRecordServiceImpl extends ServiceImpl<ShopProductRecordDao, ShopProductRecord> implements ShopProductRecordService {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user