Aslee 3 лет назад
Родитель
Сommit
9b525d28f4

+ 9 - 0
src/main/java/com/caimei/modules/hehe/entity/CmHeheProduct.java

@@ -27,6 +27,7 @@ public class CmHeheProduct extends DataEntity<CmHeheProduct> {
     private String costType;        // 成本价类型:1固定成本 2比例成本
     private BigDecimal costPrice;        // 成本价
     private BigDecimal costProportional;        // 比例成本百分比
+    private Integer oldProductId;   //旧商品id
     private Date addTime;        // 添加时间
     private String name;         //商品名称
     private String mainImage;       //商品图片
@@ -184,4 +185,12 @@ public class CmHeheProduct extends DataEntity<CmHeheProduct> {
     public void setFloorIds(String floorIds) {
         this.floorIds = floorIds;
     }
+
+    public Integer getOldProductId() {
+        return oldProductId;
+    }
+
+    public void setOldProductId(Integer oldProductId) {
+        this.oldProductId = oldProductId;
+    }
 }

+ 2 - 0
src/main/java/com/caimei/modules/product/dao/ProductNewDao.java

@@ -65,4 +65,6 @@ public interface ProductNewDao extends CrudDao<Product> {
     Integer getShopIdByName(String shopName);
 
     List<SplitCode> findSecondSplitCode(String id);
+
+    void addProductData(@Param("productId") Integer productId,@Param("costPrice") String costPrice,@Param("costProportional") String costProportional,@Param("taxPoint") String taxPoint,@Param("supplierTaxPoint") String supplierTaxPoint);
 }

+ 14 - 0
src/main/java/com/caimei/modules/product/service/ProductNewService.java

@@ -369,4 +369,18 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
         });
 
     }
+
+    public void addProductData() {
+        List<CmHeheProduct> heheProductList = cmHeheProductDao.findList(new CmHeheProduct());
+        heheProductList.forEach(heheProduct->{
+            Product cmProduct = productNewDao.get(heheProduct.getOldProductId().toString());
+            if (null != cmProduct) {
+                String costPrice = cmProduct.getCostPrice();
+                String costProportional = cmProduct.getCostProportional();
+                String taxPoint = cmProduct.getTaxPoint();
+                String supplierTaxPoint = cmProduct.getSupplierTaxPoint();
+                productNewDao.addProductData(heheProduct.getProductId(), costPrice, costProportional, taxPoint, supplierTaxPoint);
+            }
+        });
+    }
 }

+ 11 - 0
src/main/java/com/caimei/modules/product/web/ProductNewController.java

@@ -1095,6 +1095,17 @@ public class ProductNewController extends BaseController {
         return "success";
     }
 
+    /**
+     * 补充数据
+     * @return
+     */
+    @RequestMapping("/hehe/data/add")
+    @ResponseBody
+    public String addProductData(){
+        productNewService.addProductData();
+        return "success";
+    }
+
     /**
      * 恢复呵呵商品原来对应的采美商品id
      */

+ 1 - 0
src/main/resources/mappings/modules/hehe/CmHeheProductMapper.xml

@@ -11,6 +11,7 @@
 		a.invoiceType AS "invoiceType",
 		a.clubTaxPoint AS "clubTaxPoint",
 		a.shopTaxPoint AS "shopTaxPoint",
+		a.oldProductId,
 		p.costCheckFlag AS "costType",
 		p.costPrice AS "costPrice",
 		p.costProportional AS "costProportional",

+ 8 - 0
src/main/resources/mappings/modules/product/ProductNewMapper.xml

@@ -732,6 +732,14 @@
             #{addTime}
           )
     </insert>
+    <insert id="addProductData">
+        update product
+        set costPrice        = #{costPrice},
+            costProportional = #{costProportional},
+            taxPoint         = #{taxPoint},
+            supplierTaxPoint = #{supplierTaxPoint}
+        where productID = #{productId}
+    </insert>
 
     <select id="findAllStatusRemarks" resultType="com.caimei.modules.product.entity.ProductStatusRecord">
         SELECT