Authored by caoyan

商品上下架操作记录

  1 +package com.yoho.product.dal;
  2 +
  3 +
  4 +import com.yoho.product.model.ProductOperateRecord;
  5 +
  6 +public interface ProductOperateRecordMapper {
  7 + int insert(ProductOperateRecord productOperateRecord);
  8 +
  9 +}
  1 +package com.yoho.product.model;
  2 +
  3 +import lombok.Data;
  4 +
  5 +@Data
  6 +public class ProductOperateRecord {
  7 + private Integer id;
  8 +
  9 + private Integer productId;
  10 +
  11 + private Integer type;
  12 +
  13 + private Integer operateTime;
  14 +
  15 + private Integer uid;
  16 +
  17 + private String userName;
  18 +
  19 +}
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3 +<mapper namespace="com.yoho.product.dal.ProductOperateRecordMapper">
  4 + <resultMap id="BaseResultMap" type="com.yoho.product.model.ProductOperateRecord">
  5 + <result column="id" property="id" jdbcType="INTEGER" />
  6 + <result column="product_id" property="productId" jdbcType="INTEGER" />
  7 + <result column="type" property="type" jdbcType="INTEGER" />
  8 + <result column="operate_time" property="operateTime" jdbcType="INTEGER" />
  9 + <result column="uid" property="uid" jdbcType="INTEGER" />
  10 + <result column="user_name" property="userName" jdbcType="VARCHAR" />
  11 + </resultMap>
  12 +
  13 + <sql id="Base_Column_List">
  14 + id, product_id, type, operate_time, uid, user_name
  15 + </sql>
  16 +
  17 + <insert id="insert" parameterType="com.yoho.product.model.ProductOperateRecord">
  18 + insert into product_operate_record(product_id, type, operate_time, uid, user_name)
  19 + values (#{productId}, #{type}, #{operateTime}, #{uid}, #{userName})
  20 + </insert>
  21 +
  22 +</mapper>
@@ -3,15 +3,18 @@ package com.yoho.ufo.service.impl; @@ -3,15 +3,18 @@ package com.yoho.ufo.service.impl;
3 import java.math.BigDecimal; 3 import java.math.BigDecimal;
4 import java.text.ParseException; 4 import java.text.ParseException;
5 import java.text.SimpleDateFormat; 5 import java.text.SimpleDateFormat;
6 -import java.util.*; 6 +import java.util.ArrayList;
  7 +import java.util.Arrays;
  8 +import java.util.Calendar;
  9 +import java.util.Collections;
  10 +import java.util.HashMap;
  11 +import java.util.HashSet;
  12 +import java.util.List;
  13 +import java.util.Map;
  14 +import java.util.Objects;
  15 +import java.util.Set;
7 import java.util.stream.Collectors; 16 import java.util.stream.Collectors;
8 17
9 -import com.alibaba.fastjson.JSON;  
10 -import com.alibaba.fastjson.JSONObject;  
11 -import com.yoho.order.dal.SellerOrderMapper;  
12 -import com.yoho.product.model.ProductNameAndImgReq;  
13 -import com.yoho.ufo.dal.model.*;  
14 -import com.yohobuy.ufo.model.order.bo.SellerBo;  
15 import org.apache.commons.collections.CollectionUtils; 18 import org.apache.commons.collections.CollectionUtils;
16 import org.apache.commons.collections.map.HashedMap; 19 import org.apache.commons.collections.map.HashedMap;
17 import org.apache.commons.lang3.StringUtils; 20 import org.apache.commons.lang3.StringUtils;
@@ -26,8 +29,14 @@ import org.springframework.context.ApplicationContextAware; @@ -26,8 +29,14 @@ import org.springframework.context.ApplicationContextAware;
26 import org.springframework.stereotype.Service; 29 import org.springframework.stereotype.Service;
27 import org.springframework.web.multipart.MultipartFile; 30 import org.springframework.web.multipart.MultipartFile;
28 31
  32 +import com.alibaba.fastjson.JSON;
  33 +import com.alibaba.fastjson.JSONObject;
29 import com.yoho.core.dal.datasource.annotation.Database; 34 import com.yoho.core.dal.datasource.annotation.Database;
30 import com.yoho.core.rest.client.ServiceCaller; 35 import com.yoho.core.rest.client.ServiceCaller;
  36 +import com.yoho.order.dal.SellerOrderMapper;
  37 +import com.yoho.product.dal.ProductOperateRecordMapper;
  38 +import com.yoho.product.model.ProductNameAndImgReq;
  39 +import com.yoho.product.model.ProductOperateRecord;
31 import com.yoho.ufo.dal.BrandMapper; 40 import com.yoho.ufo.dal.BrandMapper;
32 import com.yoho.ufo.dal.GoodsImagesMapper; 41 import com.yoho.ufo.dal.GoodsImagesMapper;
33 import com.yoho.ufo.dal.GoodsMapper; 42 import com.yoho.ufo.dal.GoodsMapper;
@@ -42,6 +51,16 @@ import com.yoho.ufo.dal.StoragePriceMapper; @@ -42,6 +51,16 @@ import com.yoho.ufo.dal.StoragePriceMapper;
42 import com.yoho.ufo.dal.UfoBrandSeriesMapper; 51 import com.yoho.ufo.dal.UfoBrandSeriesMapper;
43 import com.yoho.ufo.dal.UfoProductColorMapper; 52 import com.yoho.ufo.dal.UfoProductColorMapper;
44 import com.yoho.ufo.dal.UfoSizeMapper; 53 import com.yoho.ufo.dal.UfoSizeMapper;
  54 +import com.yoho.ufo.dal.model.Goods;
  55 +import com.yoho.ufo.dal.model.GoodsImages;
  56 +import com.yoho.ufo.dal.model.Product;
  57 +import com.yoho.ufo.dal.model.ProductAttrImportItem;
  58 +import com.yoho.ufo.dal.model.ProductImportTran;
  59 +import com.yoho.ufo.dal.model.ProductImportTranItem;
  60 +import com.yoho.ufo.dal.model.ProductLimitSale;
  61 +import com.yoho.ufo.dal.model.ProductSales;
  62 +import com.yoho.ufo.dal.model.Storage;
  63 +import com.yoho.ufo.dal.model.StoragePrice;
45 import com.yoho.ufo.exception.CommonException; 64 import com.yoho.ufo.exception.CommonException;
46 import com.yoho.ufo.exception.PlatformException; 65 import com.yoho.ufo.exception.PlatformException;
47 import com.yoho.ufo.model.brand.Brand; 66 import com.yoho.ufo.model.brand.Brand;
@@ -56,6 +75,7 @@ import com.yoho.ufo.util.ImagesConstant; @@ -56,6 +75,7 @@ import com.yoho.ufo.util.ImagesConstant;
56 import com.yoho.ufo.util.ImagesHelper; 75 import com.yoho.ufo.util.ImagesHelper;
57 import com.yohobuy.ufo.model.common.ApiResponse; 76 import com.yohobuy.ufo.model.common.ApiResponse;
58 import com.yohobuy.ufo.model.common.PageResponseBO; 77 import com.yohobuy.ufo.model.common.PageResponseBO;
  78 +import com.yohobuy.ufo.model.order.bo.SellerBo;
59 import com.yohobuy.ufo.model.order.req.BatchImportPrdReq; 79 import com.yohobuy.ufo.model.order.req.BatchImportPrdReq;
60 import com.yohobuy.ufo.model.order.req.SellerReq; 80 import com.yohobuy.ufo.model.order.req.SellerReq;
61 import com.yohobuy.ufo.model.order.vo.AddressInfo; 81 import com.yohobuy.ufo.model.order.vo.AddressInfo;
@@ -118,6 +138,9 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw @@ -118,6 +138,9 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw
118 @Autowired 138 @Autowired
119 private SellerOrderMapper sellerOrderMapper; 139 private SellerOrderMapper sellerOrderMapper;
120 140
  141 + @Autowired
  142 + private ProductOperateRecordMapper productOperateRecordMapper;
  143 +
121 private static final Integer NOT_SYN_CALENDER = 0; 144 private static final Integer NOT_SYN_CALENDER = 0;
122 145
123 @Override 146 @Override
@@ -813,6 +836,15 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw @@ -813,6 +836,15 @@ public class ProductServiceImpl implements IProductService, ApplicationContextAw
813 } 836 }
814 int n = productMapper.updateStatusByPrimaryKey(bo.getId(), bo.getStatus()); 837 int n = productMapper.updateStatusByPrimaryKey(bo.getId(), bo.getStatus());
815 if (n == 1) { 838 if (n == 1) {
  839 + if(bo.getStatus().intValue() == 1 || bo.getStatus().intValue() == 2) {//上架或下架,记录操作日志
  840 + ProductOperateRecord record = new ProductOperateRecord();
  841 + record.setProductId(bo.getId());
  842 + record.setOperateTime(DateUtil.getCurrentTimeSeconds());
  843 + record.setType(bo.getStatus());
  844 + record.setUid(new UserHelper().getUserId());
  845 + record.setUserName(new UserHelper().getUserName());
  846 + productOperateRecordMapper.insert(record);
  847 + }
816 return new ApiResponse<>(200, "操作成功"); 848 return new ApiResponse<>(200, "操作成功");
817 } 849 }
818 return new ApiResponse<>(400, "操作失败!"); 850 return new ApiResponse<>(400, "操作失败!");
@@ -16,6 +16,7 @@ datasources: @@ -16,6 +16,7 @@ datasources:
16 - com.yoho.product.dal.SecondhandFlawMapper 16 - com.yoho.product.dal.SecondhandFlawMapper
17 - com.yoho.ufo.dal.SizePoolMapper 17 - com.yoho.ufo.dal.SizePoolMapper
18 - com.yoho.ufo.dal.SizePoolDetailMapper 18 - com.yoho.ufo.dal.SizePoolDetailMapper
  19 + - com.yoho.product.model.ProductOperateRecord
19 20
20 ufo_order: 21 ufo_order:
21 servers: 22 servers:
@@ -17,6 +17,7 @@ datasources: @@ -17,6 +17,7 @@ datasources:
17 - com.yoho.product.dal.StorageDepositMapper 17 - com.yoho.product.dal.StorageDepositMapper
18 - com.yoho.ufo.dal.SizePoolMapper 18 - com.yoho.ufo.dal.SizePoolMapper
19 - com.yoho.ufo.dal.SizePoolDetailMapper 19 - com.yoho.ufo.dal.SizePoolDetailMapper
  20 + - com.yoho.product.model.ProductOperateRecord
20 21
21 ufo_order: 22 ufo_order:
22 servers: 23 servers: