Ver código fonte

bugfix-呵呵商品转移

Aslee 3 anos atrás
pai
commit
9efab09ac4

+ 2 - 0
src/main/java/com/caimei/modules/hehe/dao/CmHeheActivityProductDao.java

@@ -72,4 +72,6 @@ public interface CmHeheActivityProductDao extends CrudDao<CmHeheActivityProduct>
     void deleteUserActivity(Integer productId);
 
     List<Integer> findCollageProductId();
+
+    void updateProductId(@Param("newProductId") Integer newProductId, @Param("oldProductId") Integer oldProductId);
 }

+ 2 - 0
src/main/java/com/caimei/modules/hehe/dao/CmHeheCollageProductDao.java

@@ -22,4 +22,6 @@ public interface CmHeheCollageProductDao extends CrudDao<CmHeheCollageProduct> {
     List<Integer> findActivityProductIds();
 
     Integer getProductId(Integer heheProductId);
+
+    void updateProductId(@Param("newProductId") Integer newProductId, @Param("oldProductId") Integer oldProductId);
 }

+ 5 - 0
src/main/java/com/caimei/modules/hehe/dao/CmHeheCouponDao.java

@@ -7,6 +7,7 @@ import com.caimei.modules.user.entity.CmUser;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import com.caimei.modules.hehe.entity.CmHeheCoupon;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -45,4 +46,8 @@ public interface CmHeheCouponDao extends CrudDao<CmHeheCoupon> {
     List<CmHeheCoupon> receiveCouponList(CmHeheCoupon cmHeheCoupon);
 
     void deleteCoupon(String cmHeheCoupon);
+
+    void updateProductId(@Param("newProductId") Integer newProductId, @Param("oldProductId") Integer oldProductId);
+
+    List<Integer> findAllProductIds();
 }

+ 3 - 1
src/main/java/com/caimei/modules/hehe/dao/CmHeheProductDao.java

@@ -53,5 +53,7 @@ public interface CmHeheProductDao extends CrudDao<CmHeheProduct> {
 
     void addFloorProduct(@Param("productId") String productId, @Param("floorId") String floorId);
 
-    void updateProductId(@Param("heheProductId") Integer heheProductId, @Param("newProductId") Integer newProductId);
+    void updateProductId(@Param("oldProductId") Integer oldProductId, @Param("newProductId") Integer newProductId);
+
+    Integer getNewProductId(Integer oldProductId);
 }

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

@@ -3,7 +3,10 @@ package com.caimei.modules.product.service;
 
 import com.caimei.dfs.image.beens.ImageUploadInfo;
 import com.caimei.modules.common.utils.UploadUtils;
-import com.caimei.modules.hehe.dao.CmHeheProductDao;
+import com.caimei.modules.hehe.dao.*;
+import com.caimei.modules.hehe.entity.CmHeheActivityProduct;
+import com.caimei.modules.hehe.entity.CmHeheCollageProduct;
+import com.caimei.modules.hehe.entity.CmHeheFloorProduct;
 import com.caimei.modules.hehe.entity.CmHeheProduct;
 import com.caimei.modules.product.dao.CmPromotionDao;
 import com.caimei.modules.product.dao.ProductDao;
@@ -48,6 +51,14 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
     @Autowired
     private CmHeheProductDao cmHeheProductDao;
     @Autowired
+    private CmHeheActivityProductDao cmHeheActivityProductDao;
+    @Autowired
+    private CmHeheCollageProductDao cmHeheCollageProductDao;
+    @Autowired
+    private CmHeheCouponDao cmHeheCouponDao;
+    @Autowired
+    private CmHeheFloorProductDao cmHeheFloorProductDao;
+    @Autowired
     private ProductService productService;
 
     @Override
@@ -274,17 +285,18 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
     }
 
     public void moveHeheProducts() {
-        List<CmHeheProduct> heheProductList = cmHeheProductDao.findList(new CmHeheProduct());
-        heheProductList.forEach(heheProduct->{
-            Integer heheProductId = Integer.parseInt(heheProduct.getId());
-            // 采美商品id
-            Integer productId = heheProduct.getProductId();
-            // 查询商品
-            Product product = productNewDao.get(productId.toString());
-            Integer shopId = productNewDao.getShopIdByName("采美奥泰特殊供应商");
-            if (null != shopId) {
+        Integer shopId = productNewDao.getShopIdByName("采美奥泰");
+        if (null != shopId) {
+            List<CmHeheProduct> heheProductList = cmHeheProductDao.findList(new CmHeheProduct());
+            heheProductList.forEach(heheProduct->{
+                Integer heheProductId = Integer.parseInt(heheProduct.getId());
+                Integer oldProductId = heheProduct.getProductId();
+                // 采美商品id
+                Integer productId = heheProduct.getProductId();
+                // 查询商品
+                Product product = productNewDao.get(productId.toString());
                 product.setId(null);
-                product.setSplitCode("E1807085606");
+                product.setSplitCode("E1807059160");
                 product.setShopID(shopId);
                 // 置为冻结状态
                 product.setValidFlag("10");
@@ -314,9 +326,35 @@ public class ProductNewService extends CrudService<ProductNewDao, Product> {
                     productNewDao.insertParameters(productParam);
                 });
                 // 将呵呵商品关联到新商品上
-                cmHeheProductDao.updateProductId(heheProductId, newProductId);
-            }
-        });
+                cmHeheProductDao.updateProductId(oldProductId, newProductId);
+            });
+            // 更新活动商品
+            List<CmHeheActivityProduct> activityProductList = cmHeheActivityProductDao.findAllList(new CmHeheActivityProduct());
+            activityProductList.forEach(activityProduct->{
+                Integer oldProductId = activityProduct.getProductId();
+                Integer newProductId = cmHeheProductDao.getNewProductId(oldProductId);
+                if (null != newProductId) {
+                    cmHeheActivityProductDao.updateProductId(newProductId, oldProductId);
+                }
+            });
+            // 更新拼团商品
+            List<CmHeheCollageProduct> collageProductList = cmHeheCollageProductDao.findAllList(new CmHeheCollageProduct());
+            collageProductList.forEach(collageProduct->{
+                Integer oldProductId = collageProduct.getProductId();
+                Integer newProductId = cmHeheProductDao.getNewProductId(oldProductId);
+                if (null != newProductId) {
+                    cmHeheCollageProductDao.updateProductId(newProductId, oldProductId);
+                }
+            });
+            // 更新优惠券商品
+            List<Integer> productIds = cmHeheCouponDao.findAllProductIds();
+            productIds.forEach(oldProductId->{
+                Integer newProductId = cmHeheProductDao.getNewProductId(oldProductId);
+                if (null != newProductId) {
+                    cmHeheCouponDao.updateProductId(newProductId, oldProductId);
+                }
+            });
+        }
     }
 
     public void backHeheProducts() {

+ 4 - 1
src/main/resources/mappings/modules/hehe/CmHeheActivityProductMapper.xml

@@ -96,8 +96,11 @@
 	<update id="delete">
 		UPDATE cm_hehe_activity_product SET delFlag = 1 WHERE id = #{id}
 	</update>
+    <update id="updateProductId">
+		update cm_hehe_activity_product set productId = #{newProductId} where productId = #{oldProductId}
+	</update>
 
-	<select id="findActivityProductId" resultType="integer">
+    <select id="findActivityProductId" resultType="integer">
 		SELECT
 		  productId
 		FROM

+ 4 - 1
src/main/resources/mappings/modules/hehe/CmHeheCollageProductMapper.xml

@@ -127,8 +127,11 @@
 	<update id="updateStatus">
 		update cm_hehe_collage_product set status = #{status} where id = #{id}
 	</update>
+    <update id="updateProductId">
+		update cm_hehe_collage_product set productId = #{newProductId} where productId = #{oldProductId}
+	</update>
 
-	<delete id="delete">
+    <delete id="delete">
 		DELETE FROM cm_hehe_collage_product
 		WHERE id = #{id}
 	</delete>

+ 6 - 0
src/main/resources/mappings/modules/hehe/CmHeheCouponMapper.xml

@@ -228,6 +228,9 @@
 		</where>
 		order by chrc.receiveTime desc
 	</select>
+	<select id="findAllProductIds" resultType="java.lang.Integer">
+		select productId from cm_hehe_coupon_product;
+	</select>
 
 	<insert id="insert" parameterType="CmHeheCoupon"  keyProperty="id" useGeneratedKeys="true">
 		INSERT INTO cm_hehe_coupon(
@@ -323,5 +326,8 @@
 	<update id="deleteCoupon">
 		update cm_hehe_coupon set delFlag = 1 where id = #{id}
 	</update>
+	<update id="updateProductId">
+		update cm_hehe_coupon_product set productId = #{newProductId} where productId = #{oldProductId}
+	</update>
 
 </mapper>

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

@@ -146,7 +146,7 @@
 		where id = #{id}
 	</update>
 
-<!--    <update id="updateStatusByFloorId">-->
+    <!--    <update id="updateStatusByFloorId">-->
 <!--		update cm_hehe_floor_product set status = #{status} where id = #{floorId}-->
 <!--	</update>-->
 <!--	-->

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

@@ -213,13 +213,16 @@
 	<select id="findProductActivity" resultType="java.lang.Integer">
 		select activityId from cm_hehe_activity_product where productId = #{productId}
 	</select>
+	<select id="getNewProductId" resultType="java.lang.Integer">
+		select productId from cm_hehe_product where oldProductId = #{oldProductId}
+	</select>
 
 
 	<update id="deleteActivityProduct">
 		UPDATE cm_hehe_activity_product SET delFlag = 1 WHERE productId = #{productId}
 	</update>
 	<update id="updateProductId">
-		update cm_hehe_product set productId = #{newProductId} where id = #{heheProductId}
+		update cm_hehe_product set oldProductId = #{oldProductId}, productId = #{newProductId} where productId = #{oldProductId}
 	</update>
 
 </mapper>

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

@@ -757,7 +757,7 @@
         select splitCode from product where productID = #{productID}
     </select>
     <select id="getShopIdByName" resultType="java.lang.Integer">
-        select shopID from shop where name like concat('%',#{shopName},'%')
+        select shopID from shop where name like concat('%',#{shopName},'%') order by shopID desc limit 1
     </select>
     <select id="findSecondSplitCode" resultType="com.caimei.modules.user.entity.SplitCode">
         select css.shopId,css.commercialCode as splitCode,css.codeDetail as codeRemark

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/order/cmPayShopCheck.jsp

@@ -680,7 +680,7 @@
             totalComissionEle.each(function () {
                 totalComissionVal += Number($(this).text().replace(',', ''));
             })
-            resVal = (totalComissionVal + clubFreight - thirdPartyVal - freightVal - eachDiscount).toFixed(2);
+            resVal = (totalComissionVal - thirdPartyVal - eachDiscount).toFixed(2);
             comissionEle.text(resVal);
         })
 

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/order/cmPayShopDetail.jsp

@@ -468,7 +468,7 @@
                 totalComissionEle.each(function(){
                     totalComissionVal += Number($(this).text().replace(',',''));
 				})
-				resVal = (totalComissionVal + clubFreight - thirdPartyVal - freightVal - eachDiscount).toFixed(2);
+				resVal = (totalComissionVal - thirdPartyVal - eachDiscount).toFixed(2);
                 comissionEle.text(resVal);
 			})
 

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/order/cmPayShopEdit.jsp

@@ -449,7 +449,7 @@
             totalComissionEle.each(function () {
                 totalComissionVal += Number($(this).text().replace(',', ''));
             })
-            resVal = (totalComissionVal + clubFreight - thirdPartyVal - freightVal - eachDiscount).toFixed(2);
+            resVal = (totalComissionVal - thirdPartyVal - eachDiscount).toFixed(2);
             comissionEle.text(resVal);
         })
 

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/order/cmPayShopForm.jsp

@@ -951,7 +951,7 @@
                 totalComissionVal += Number($(this).text().replace(',', ''));
             })
             // 子订单佣金=单个商品总佣金+机构运费-付第三方-供应商运费-子订单分摊优惠
-            resVal = (totalComissionVal + clubFreight - thirdPartyVal - freightVal - eachDiscount).toFixed(2);
+            resVal = (totalComissionVal - thirdPartyVal - eachDiscount).toFixed(2);
             comissionEle.text(resVal);
         })
 

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/order/cmRefundShopDetail.jsp

@@ -475,7 +475,7 @@
             totalComissionEle.each(function(){
                 totalComissionVal += Number($(this).text().replace(',',''));
             })
-            resVal = (totalComissionVal + clubFreight - thirdPartyVal - freightVal - eachDiscount).toFixed(2);
+            resVal = (totalComissionVal - thirdPartyVal - eachDiscount).toFixed(2);
             comissionEle.text(resVal);
         })
     })()