Authored by caoyan

商品上下架操作记录

package com.yoho.product.dal;
import com.yoho.product.model.ProductOperateRecord;
public interface ProductOperateRecordMapper {
int insert(ProductOperateRecord productOperateRecord);
}
\ No newline at end of file
... ...
package com.yoho.product.model;
import lombok.Data;
@Data
public class ProductOperateRecord {
private Integer id;
private Integer productId;
private Integer type;
private Integer operateTime;
private Integer uid;
private String userName;
}
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.product.dal.ProductOperateRecordMapper">
<resultMap id="BaseResultMap" type="com.yoho.product.model.ProductOperateRecord">
<result column="id" property="id" jdbcType="INTEGER" />
<result column="product_id" property="productId" jdbcType="INTEGER" />
<result column="type" property="type" jdbcType="INTEGER" />
<result column="operate_time" property="operateTime" jdbcType="INTEGER" />
<result column="uid" property="uid" jdbcType="INTEGER" />
<result column="user_name" property="userName" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List">
id, product_id, type, operate_time, uid, user_name
</sql>
<insert id="insert" parameterType="com.yoho.product.model.ProductOperateRecord">
insert into product_operate_record(product_id, type, operate_time, uid, user_name)
values (#{productId}, #{type}, #{operateTime}, #{uid}, #{userName})
</insert>
</mapper>
\ No newline at end of file
... ...
... ... @@ -3,15 +3,18 @@ package com.yoho.ufo.service.impl;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yoho.order.dal.SellerOrderMapper;
import com.yoho.product.model.ProductNameAndImgReq;
import com.yoho.ufo.dal.model.*;
import com.yohobuy.ufo.model.order.bo.SellerBo;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
... ... @@ -26,8 +29,14 @@ import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yoho.core.dal.datasource.annotation.Database;
import com.yoho.core.rest.client.ServiceCaller;
import com.yoho.order.dal.SellerOrderMapper;
import com.yoho.product.dal.ProductOperateRecordMapper;
import com.yoho.product.model.ProductNameAndImgReq;
import com.yoho.product.model.ProductOperateRecord;
import com.yoho.ufo.dal.BrandMapper;
import com.yoho.ufo.dal.GoodsImagesMapper;
import com.yoho.ufo.dal.GoodsMapper;
... ... @@ -42,6 +51,16 @@ import com.yoho.ufo.dal.StoragePriceMapper;
import com.yoho.ufo.dal.UfoBrandSeriesMapper;
import com.yoho.ufo.dal.UfoProductColorMapper;
import com.yoho.ufo.dal.UfoSizeMapper;
import com.yoho.ufo.dal.model.Goods;
import com.yoho.ufo.dal.model.GoodsImages;
import com.yoho.ufo.dal.model.Product;
import com.yoho.ufo.dal.model.ProductAttrImportItem;
import com.yoho.ufo.dal.model.ProductImportTran;
import com.yoho.ufo.dal.model.ProductImportTranItem;
import com.yoho.ufo.dal.model.ProductLimitSale;
import com.yoho.ufo.dal.model.ProductSales;
import com.yoho.ufo.dal.model.Storage;
import com.yoho.ufo.dal.model.StoragePrice;
import com.yoho.ufo.exception.CommonException;
import com.yoho.ufo.exception.PlatformException;
import com.yoho.ufo.model.brand.Brand;
... ... @@ -56,6 +75,7 @@ import com.yoho.ufo.util.ImagesConstant;
import com.yoho.ufo.util.ImagesHelper;
import com.yohobuy.ufo.model.common.ApiResponse;
import com.yohobuy.ufo.model.common.PageResponseBO;
import com.yohobuy.ufo.model.order.bo.SellerBo;
import com.yohobuy.ufo.model.order.req.BatchImportPrdReq;
import com.yohobuy.ufo.model.order.req.SellerReq;
import com.yohobuy.ufo.model.order.vo.AddressInfo;
... ... @@ -117,6 +137,9 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw
@Autowired
private SellerOrderMapper sellerOrderMapper;
@Autowired
private ProductOperateRecordMapper productOperateRecordMapper;
private static final Integer NOT_SYN_CALENDER = 0;
... ... @@ -813,6 +836,15 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw
}
int n = productMapper.updateStatusByPrimaryKey(bo.getId(), bo.getStatus());
if (n == 1) {
if(bo.getStatus().intValue() == 1 || bo.getStatus().intValue() == 2) {//上架或下架,记录操作日志
ProductOperateRecord record = new ProductOperateRecord();
record.setProductId(bo.getId());
record.setOperateTime(DateUtil.getCurrentTimeSeconds());
record.setType(bo.getStatus());
record.setUid(new UserHelper().getUserId());
record.setUserName(new UserHelper().getUserName());
productOperateRecordMapper.insert(record);
}
return new ApiResponse<>(200, "操作成功");
}
return new ApiResponse<>(400, "操作失败!");
... ...
... ... @@ -16,6 +16,7 @@ datasources:
- com.yoho.product.dal.SecondhandFlawMapper
- com.yoho.ufo.dal.SizePoolMapper
- com.yoho.ufo.dal.SizePoolDetailMapper
- com.yoho.product.model.ProductOperateRecord
ufo_order:
servers:
... ...
... ... @@ -17,6 +17,7 @@ datasources:
- com.yoho.product.dal.StorageDepositMapper
- com.yoho.ufo.dal.SizePoolMapper
- com.yoho.ufo.dal.SizePoolDetailMapper
- com.yoho.product.model.ProductOperateRecord
ufo_order:
servers:
... ...