Przeglądaj źródła

商品/二手商品

zhijiezhao 3 lat temu
rodzic
commit
5cc932221b

+ 9 - 0
src/main/java/com/caimei/modules/product/dao/CmSecondHandDetailDao.java

@@ -6,6 +6,7 @@ import com.caimei.modules.product.entity.CmSecondHandDetail;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * 二手商品DAO接口
@@ -22,4 +23,12 @@ public interface CmSecondHandDetailDao extends CrudDao<CmSecondHandDetail> {
     void updatSecondHnadproductSold(Integer productID);
 
     void updatSecondHnadBySold(Integer productID);
+
+    void deleteFileType(Integer productId);
+
+    void insertFileType(@Param("productId")Integer productId,@Param("secondId")String secondId, @Param("fileType")String fileType);
+
+    CmSecondHandDetail findValue(Integer productID);
+
+    List<Integer> findFlieTypes(Integer productID);
 }

+ 37 - 9
src/main/java/com/caimei/modules/product/entity/CmSecondHandDetail.java

@@ -31,7 +31,8 @@ public class CmSecondHandDetail extends DataEntity<CmSecondHandDetail> {
     private String provinceCityDistrict;        // 省市区(地址前部分)
     private String address;        // 详细联系地址
     private String productQuality;        // 商品成色
-    private String payStatus;        // 付款状态1:待支付、2已付款
+//    private String payStatus;        // 付款状态1:待支付、2已付款
+    private String publishIdentity;     //发布身份1.个人身份,2公司身份
     private Double payAmount;        // 支付金额
     private String payFormData;        // 线上支付回调返回数据存档
     private String payType;        // 付款方式 0后台付款、1:支付宝、2微信 、12PC-B2B网银、13PC-微信支付、14PC-支付宝、15小程序-微信支付
@@ -45,10 +46,13 @@ public class CmSecondHandDetail extends DataEntity<CmSecondHandDetail> {
     private String productDetails;//商品详情
     private String publisher;//后台二手商品发布人员名称
     private String authenticationImage;//身份验证照片
+    private String authenticationBackImage;//身份证背面照片
+    private String licenseImage;//营业执照照片
     private String fileName;//出让承诺函文件名称
     private String ossName;//对应oss存储名
     private String commitmentImage;//出让承诺函图片
     private String url; //文件预览url
+    private List<Integer> fileTypes;
     private String splitCode;//商品分账号
 
     private String validFlag;//商品状态,见表c_productstatus或枚举ProductStatus,0逻辑删除 1待审核 2已上架 3已下架 8审核未通过 9已冻结
@@ -110,6 +114,38 @@ public class CmSecondHandDetail extends DataEntity<CmSecondHandDetail> {
         super(id);
     }
 
+    public List<Integer> getFileTypes() {
+        return fileTypes;
+    }
+
+    public void setFileTypes(List<Integer> fileTypes) {
+        this.fileTypes = fileTypes;
+    }
+
+    public String getLicenseImage() {
+        return licenseImage;
+    }
+
+    public void setLicenseImage(String licenseImage) {
+        this.licenseImage = licenseImage;
+    }
+
+    public String getPublishIdentity() {
+        return publishIdentity;
+    }
+
+    public String getAuthenticationBackImage() {
+        return authenticationBackImage;
+    }
+
+    public void setAuthenticationBackImage(String authenticationBackImage) {
+        this.authenticationBackImage = authenticationBackImage;
+    }
+
+    public void setPublishIdentity(String publishIdentity) {
+        this.publishIdentity = publishIdentity;
+    }
+
     private List<String> imageList;
 
     public Integer getProductID() {
@@ -248,14 +284,6 @@ public class CmSecondHandDetail extends DataEntity<CmSecondHandDetail> {
         this.productQuality = productQuality;
     }
 
-    public String getPayStatus() {
-        return payStatus;
-    }
-
-    public void setPayStatus(String payStatus) {
-        this.payStatus = payStatus;
-    }
-
     public Double getPayAmount() {
         return payAmount;
     }

+ 9 - 0
src/main/java/com/caimei/modules/product/entity/Product.java

@@ -128,6 +128,7 @@ public class Product extends DataEntity<Product> {
     private BigDecimal trainingFee; //培训费用(售价未包含)
     private Integer svipFlag;	//超级会员商品标识:1是,2不是
     private Integer publishIdentity; //发布者身份 1,个人,2.公司
+    private String companyName; //公司名称
 
     //以下参数是搜索回显参数
     private String searchName;
@@ -213,6 +214,14 @@ public class Product extends DataEntity<Product> {
      */
     private Integer searchType;
 
+    public String getCompanyName() {
+        return companyName;
+    }
+
+    public void setCompanyName(String companyName) {
+        this.companyName = companyName;
+    }
+
     public String getSplitCode() {
         return splitCode;
     }

+ 29 - 0
src/main/java/com/caimei/modules/product/service/CmSecondHandDetailService.java

@@ -5,6 +5,7 @@ import java.util.List;
 
 import com.caimei.modules.product.dao.ProductDao;
 import com.caimei.modules.product.entity.Product;
+import com.thinkgem.jeesite.common.utils.StringUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -77,4 +78,32 @@ private ProductDao productDao;
 	public void updatSecondHnadproductSold(Integer productID) {
 		cmSecondHandDetailDao.updatSecondHnadproductSold(productID);
 	}
+
+	@Transactional(readOnly = false)
+	public void saveFileType(Integer productId, String secondId, List<String> fileTypes) {
+		cmSecondHandDetailDao.deleteFileType(productId);
+		for (String fileType : fileTypes) {
+			cmSecondHandDetailDao.insertFileType(productId,secondId,fileType);
+		}
+	}
+
+	public void setValue(CmSecondHandDetail cmSecondHandDetail) {
+		Integer productID = cmSecondHandDetail.getProductID();
+		CmSecondHandDetail value = cmSecondHandDetailDao.findValue(productID);
+		if(null!=value){
+			if(StringUtils.isNoneBlank(value.getAuthenticationBackImage())){
+				cmSecondHandDetail.setAuthenticationBackImage(value.getAuthenticationBackImage());
+			}
+			if(null!=value.getPublishIdentity()){
+				cmSecondHandDetail.setPublishIdentity(value.getPublishIdentity());
+			}
+			if(StringUtils.isNotBlank(value.getLicenseImage())){
+				cmSecondHandDetail.setLicenseImage(value.getLicenseImage());
+			}
+			List<Integer> flieTypes = cmSecondHandDetailDao.findFlieTypes(productID);
+			if(null!=flieTypes&&flieTypes.size()>0){
+				cmSecondHandDetail.setFileTypes(flieTypes);
+			}
+		}
+	}
 }

+ 17 - 14
src/main/java/com/caimei/modules/product/web/CmSecondHandDetailController.java

@@ -37,10 +37,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 /**
  * 二手商品Controller
@@ -188,17 +185,19 @@ public class CmSecondHandDetailController extends BaseController {
             cmSecondHandDetail.setUrl(ossUrl);
         }
 
-
+        cmSecondHandDetailService.setValue(cmSecondHandDetail);
         model.addAttribute("cmSecondHandDetail", cmSecondHandDetail);
         return "modules/product/cmSecondHandDetailForm";
     }
 
     @RequiresPermissions("product:cmSecondHandDetail:edit")
     @RequestMapping(value = "save")
-    public String save(CmSecondHandDetail cmSecondHandDetail, Model model, RedirectAttributes redirectAttributes) {
+    public String save(CmSecondHandDetail cmSecondHandDetail, HttpServletRequest request, Model model, RedirectAttributes redirectAttributes) {
         if (!beanValidator(model, cmSecondHandDetail)) {
             return form(cmSecondHandDetail, model);
         }
+        String[] ids = request.getParameterValues("ids");
+        List<String> fileTypes = Arrays.asList(ids);
         String validFlag = cmSecondHandDetail.getValidFlag();
         Date date = new Date();
         String dateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
@@ -240,6 +239,7 @@ public class CmSecondHandDetailController extends BaseController {
                 product.setValidFlag("1");
             }
             product.setAddTime(dateStr);
+
         }
         product.setSplitCode(cmSecondHandDetail.getSplitCode());
         product.setLadderPriceFlag("0");
@@ -275,15 +275,8 @@ public class CmSecondHandDetailController extends BaseController {
             product.setMainImage(imageUrl);
         }
         cmSecondHandDetailService.saveProduct(product);
-
-        String payStatus = cmSecondHandDetail.getPayStatus();
         String payType = cmSecondHandDetail.getPayType();
-        if (StringUtils.equals("2", payStatus) && StringUtils.isEmpty(payType)) {
-            //后台是已付款且之前从未付款当做是后台直接付款
-            cmSecondHandDetail.setPayType("0");
-        }
         cmSecondHandDetail.setProductID(product.getProductID());
-
         // 地址优化
         Integer townId = cmSecondHandDetail.getTownId();
         String provinceCityDistrict = "";
@@ -328,9 +321,19 @@ public class CmSecondHandDetailController extends BaseController {
             String imageUrl = getImageUrl(commitmentImage);
             cmSecondHandDetail.setCommitmentImage(imageUrl);
         }
-
+        String authenticationBackImage = cmSecondHandDetail.getAuthenticationBackImage();
+        if(StringUtils.isNotEmpty(authenticationBackImage)){
+            String imageUrl = getImageUrl(authenticationBackImage);
+            cmSecondHandDetail.setAuthenticationBackImage(imageUrl);
+        }
+        String licenseImage = cmSecondHandDetail.getLicenseImage();
+        if(StringUtils.isNotEmpty(licenseImage)){
+            String imageUrl = getImageUrl(licenseImage);
+            cmSecondHandDetail.setLicenseImage(imageUrl);
+        }
         // 保存二手详细信息
         cmSecondHandDetailService.save(cmSecondHandDetail);
+        cmSecondHandDetailService.saveFileType(product.getProductID(), cmSecondHandDetail.getId(), fileTypes);
         if (null != product.getProductID()) {
             //删除之前图片再添加
             productNewService.deleteImageByProductId(product.getProductID());

+ 30 - 3
src/main/resources/mappings/modules/product/CmSecondHandDetailMapper.xml

@@ -102,10 +102,25 @@
 			</otherwise>
 		</choose>
 	</select>
-
+	<select id="findValue"  resultType="com.caimei.modules.product.entity.CmSecondHandDetail">
+		select
+			publishIdentity,
+			authenticationBackImage,
+			licenseImage
+		from caimei.cm_second_hand_detail
+		where productID = #{productID}
+	</select>
+	<select id="findFlieTypes" resultType="java.lang.Integer">
+		select fileType
+		from cm_second_file_type
+		where productId = #{productID}
+	</select>
 	<insert id="insert" parameterType="CmSecondHandDetail"  keyProperty="id" useGeneratedKeys="true">
 		INSERT INTO cm_second_hand_detail(
-			productID,
+			publishIdentity,
+			authenticationBackImage,
+			licenseImage,
+		    productID,
 			sold,
 			secondHandType,
 			instrumentType,
@@ -142,6 +157,9 @@
 			ossName,
 			commitmentImage
 		) VALUES (
+			#{publishIdentity},
+		    #{authenticationBackImage},
+			#{licenseImage},
 			#{productID},
 			#{sold},
 			#{secondHandType},
@@ -180,7 +198,11 @@
 			#{commitmentImage}
 		)
 	</insert>
-
+	<insert id="insertFileType">
+		insert into cm_second_file_type
+			(secondid, productid, filetype)
+		values(#{secondId},#{productId},#{fileType})
+	</insert>
 	<update id="update">
 		UPDATE cm_second_hand_detail SET
 			productID = #{productID},
@@ -247,6 +269,11 @@
 		WHERE productID = #{productID}
 	</delete>
 
+	<delete id="deleteFileType">
+		delete from cm_second_file_type
+		where productId = #{productId}
+	</delete>
+
 	<update id="updatSecondHnadBySold">
 		UPDATE cm_second_hand_detail SET sold =  0 WHERE productID = #{productID}
 	</update>

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

@@ -99,7 +99,9 @@
         cshd.source AS "source",
         cshd.dockingPeopleName AS "dockingPeopleName",
         cb.name as "brandName",
-        if(csp.id is not null,1,0) as "svipFlag"
+        if(csp.id is not null,1,0) as "svipFlag",
+        cshd.companyName as "companyName",
+        cshd.publishIdentity as "publishIdentity"
     </sql>
 
     <sql id="productJoins">
@@ -213,6 +215,9 @@
             <if test="source != null and source != ''">
                 AND cshd.source=#{source}
             </if>
+            <if test="publishIdentity != null and publishIdentity !=''">
+                AND cshd.publishIdentity = #{publishIdentity}
+            </if>
             <if test="sqlMap !=null and sqlMap !=''">
                 ${sqlMap.dsf}
             </if>

+ 5 - 4
src/main/webapp/WEB-INF/views/modules/product-new/secondHand.jsp

@@ -119,6 +119,7 @@
         <th>市场价</th>
         <th>交易价</th>
         <th>采购价</th>
+        <th>线上分帐号</th>
         <th>分类</th>
         <th>商品状态</th>
         <th>交易状态</th>
@@ -173,7 +174,7 @@
                     ${product.contactName}
                 </c:if>
                 <c:if test="${product.publishIdentity eq 2}">
-
+                    ${product.companyName}
                 </c:if>
             </td>
             <td>${product.dockingPeopleName}</td>
@@ -210,6 +211,9 @@
                     ${product.originalPrice}
                 </c:if>
             </td>
+            <td>
+                    ${product.splitCode}
+            </td>
             <td>
                 ${product.secondHandType eq 1?'二手仪器':product.secondHandType eq 2?'临期产品':'其他'}
                 <c:if test="${product.secondHandType eq 1}">
@@ -221,9 +225,6 @@
             </td>
             <td>
                 ${product.sold eq '1'?'已售':'未售'}
-            </td>
-            <td>
-
             </td>
             <td>
                 <c:if test="${empty product.submitDate}">

Plik diff jest za duży
+ 1140 - 960
src/main/webapp/WEB-INF/views/modules/product/cmSecondHandDetailForm.jsp


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików