zhijiezhao 3 роки тому
батько
коміт
82000afcd6

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

@@ -35,5 +35,5 @@ public interface CmSecondHandDetailDao extends CrudDao<CmSecondHandDetail> {
 
     Integer findShopId(String cardNumber);
 
-    void insertShop(Shop shopVo);
+    Integer insertShop(Shop shopVo);
 }

+ 90 - 86
src/main/java/com/caimei/modules/product/service/CmSecondHandDetailService.java

@@ -19,6 +19,7 @@ import javax.annotation.Resource;
 
 /**
  * 二手商品Service
+ *
  * @author admin
  * @version 2020-07-15
  */
@@ -26,94 +27,97 @@ import javax.annotation.Resource;
 @Transactional(readOnly = true)
 public class CmSecondHandDetailService extends CrudService<CmSecondHandDetailDao, CmSecondHandDetail> {
 
-@Resource
-private CmSecondHandDetailDao cmSecondHandDetailDao;
-@Resource
-private ProductDao productDao;
-
-	public CmSecondHandDetail get(String id) {
-		return super.get(id);
-	}
-
-	public List<CmSecondHandDetail> findList(CmSecondHandDetail cmSecondHandDetail) {
-		return super.findList(cmSecondHandDetail);
-	}
-
-	public Page<CmSecondHandDetail> findPage(Page<CmSecondHandDetail> page, CmSecondHandDetail cmSecondHandDetail) {
-		return super.findPage(page, cmSecondHandDetail);
-	}
-
-	@Transactional(readOnly = false)
-	public void save(CmSecondHandDetail cmSecondHandDetail) {
-		super.save(cmSecondHandDetail);
-	}
-
-	@Transactional(readOnly = false)
-	public void delete(CmSecondHandDetail cmSecondHandDetail) {
-		super.delete(cmSecondHandDetail);
-	}
-
-	@Transactional(readOnly = false)
-	public void updateRevieweInfo(Date reviewedDate, Date onLineDate,Integer productID){
-		cmSecondHandDetailDao.updateRevieweInfo(reviewedDate,onLineDate,productID);
-	}
-
-	@Transactional(readOnly = false)
-	public void updateOnLineDate(Date date,Integer productID) {
-		cmSecondHandDetailDao.updateOnLineDate(date,productID);
-	}
-
-	@Transactional(readOnly = false)
-	public void saveProduct(Product product) {
-		Integer productID = product.getProductID();
-		if(null != productID){
-			// 更新
-			productDao.updateByPrimaryKeySelective(product);
-		}else{
-		    // 插入
-		    productDao.insertProduct(product);
-		}
-	}
-
-	@Transactional(readOnly = false)
-	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);
-			}
-		}
-	}
+    @Resource
+    private CmSecondHandDetailDao cmSecondHandDetailDao;
+    @Resource
+    private ProductDao productDao;
+
+    public CmSecondHandDetail get(String id) {
+        return super.get(id);
+    }
+
+    public List<CmSecondHandDetail> findList(CmSecondHandDetail cmSecondHandDetail) {
+        return super.findList(cmSecondHandDetail);
+    }
+
+    public Page<CmSecondHandDetail> findPage(Page<CmSecondHandDetail> page, CmSecondHandDetail cmSecondHandDetail) {
+        return super.findPage(page, cmSecondHandDetail);
+    }
+
+    @Transactional(readOnly = false)
+    public void save(CmSecondHandDetail cmSecondHandDetail) {
+        super.save(cmSecondHandDetail);
+    }
+
+    @Transactional(readOnly = false)
+    public void delete(CmSecondHandDetail cmSecondHandDetail) {
+        super.delete(cmSecondHandDetail);
+    }
+
+    @Transactional(readOnly = false)
+    public void updateRevieweInfo(Date reviewedDate, Date onLineDate, Integer productID) {
+        cmSecondHandDetailDao.updateRevieweInfo(reviewedDate, onLineDate, productID);
+    }
+
+    @Transactional(readOnly = false)
+    public void updateOnLineDate(Date date, Integer productID) {
+        cmSecondHandDetailDao.updateOnLineDate(date, productID);
+    }
+
+    @Transactional(readOnly = false)
+    public void saveProduct(Product product) {
+        Integer productID = product.getProductID();
+        if (null != productID) {
+            // 更新
+            productDao.updateByPrimaryKeySelective(product);
+        } else {
+            // 插入
+            productDao.insertProduct(product);
+        }
+    }
+
+    @Transactional(readOnly = false)
+    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);
+            }
+            if (null != value.getCardNumber()) {
+                cmSecondHandDetail.setCardNumber(value.getCardNumber());
+            }
+        }
+    }
 
     public Integer findSecondShop(String cardNumber) {
-		return cmSecondHandDetailDao.findShopId(cardNumber);
+        return cmSecondHandDetailDao.findShopId(cardNumber);
     }
 
-	@Transactional(readOnly = false)
-	public void insertShop(Shop shopVo) {
-		cmSecondHandDetailDao.insertShop(shopVo);
-	}
+    @Transactional(readOnly = false)
+    public void insertShop(Shop shopVo) {
+        cmSecondHandDetailDao.insertShop(shopVo);
+    }
 }

+ 7 - 1
src/main/java/com/caimei/modules/product/web/CmSecondHandDetailController.java

@@ -197,9 +197,15 @@ public class CmSecondHandDetailController extends BaseController {
         if (!beanValidator(model, cmSecondHandDetail)) {
             return form(cmSecondHandDetail, model);
         }
+        String cardNumber = cmSecondHandDetail.getCardNumber();
+        if(StringUtils.isBlank(cardNumber)){
+            addMessage(redirectAttributes,"请填写收款卡号");
+            model.addAttribute("cmSecondHandDetail",cmSecondHandDetail);
+            return "redirect:" + Global.getAdminPath() + "/product/new/list?searchProductCategory=2";
+        }
         //根据银行卡判断是否注册过特殊二手供应商,有则挂在之前的供应商名下,否则注册新供应商
         Integer shopId = cmSecondHandDetailService.findSecondShop(cmSecondHandDetail.getCardNumber());
-        if (null == shopId || shopId <= 0) {
+        if (null == shopId) {
             //保存为特殊二手供应商
             Shop shopVo = new Shop();
             //1个人,2公司

+ 9 - 1
src/main/java/com/caimei/modules/user/service/NewCmShopService.java

@@ -52,7 +52,15 @@ public class NewCmShopService extends CrudService<NewCmShopDao, NewCmShop> {
         shopPage.getList().forEach(shop -> {
             List<SplitCode> splitCode = newCmShopDao.findSplitCode(shop.getShopID());
             if (null != splitCode && splitCode.size() > 0) {
-                shop.setSplitCode(splitCode.get(0).getSplitCode());
+                StringBuilder code= new StringBuilder();
+                for (int i = 0; i < splitCode.size(); i++) {
+                    if(i<splitCode.size()-1){
+                        code.append(splitCode.get(i).getSplitCode()).append(",");
+                    }else {
+                        code.append(splitCode.get(i).getSplitCode());
+                    }
+                }
+                shop.setSplitCode(code.toString());
             }
         });
         return shopPage;

+ 9 - 6
src/main/resources/mappings/modules/product/CmSecondHandDetailMapper.xml

@@ -103,11 +103,14 @@
 	</select>
 	<select id="findValue"  resultType="com.caimei.modules.product.entity.CmSecondHandDetail">
 		select
-			publishIdentity,
-			authenticationBackImage,
-			licenseImage
-		from caimei.cm_second_hand_detail
-		where productID = #{productID}
+			cshd.publishIdentity,
+			cshd.authenticationBackImage,
+			cshd.licenseImage,
+		    s.cardNumber
+		from cm_second_hand_detail cshd
+		left join product p on cshd.productId = p.productId
+		left join shop s on s.shopID = p.shopID
+		where p.productID = #{productID}
 	</select>
 	<select id="findFlieTypes" resultType="java.lang.Integer">
 		select fileType
@@ -205,7 +208,7 @@
 			(secondid, productid, filetype)
 		values(#{secondId},#{productId},#{fileType})
 	</insert>
-	<insert id="insertShop" keyColumn="shopID" keyProperty="shopId" useGeneratedKeys="true">
+	<insert id="insertShop" keyColumn="shopID" keyProperty="shopID" useGeneratedKeys="true">
 		insert into shop (name,linkMan,contractMobile,cardNumber,addTime,status,shopType)
 		values (#{name},#{linkMan},#{contractMobile},#{cardNumber},now(),90,3)
 	</insert>

+ 6 - 0
src/main/webapp/WEB-INF/views/modules/product/cmSecondHandDetailForm.jsp

@@ -554,6 +554,12 @@
             <form:input path="contactMobile" htmlEscape="false" maxlength="11" class="input-xlarge required"/>
         </div>
     </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>收款卡号:<font color="red">(用于接收最终结算金额)</font></label>
+        <div class="controls">
+            <form:input path="cardNumber" htmlEscape="false" type="number" maxlength="20" class="input-xlarge required"/>
+        </div>
+    </div>
     <div class="control-group">
         <label class="control-label"><font color="red">*</font>是否显示联系人和联系方式:</label>
         <div class="controls" style="margin-top: 5px">

+ 4 - 4
src/main/webapp/WEB-INF/views/modules/user/cmNewProductShopEdit.jsp

@@ -29,7 +29,7 @@
 <body>
 <ul class="nav nav-tabs">
     <li><a href="${ctx}/user/newCmShop/special/new">新品供应商</a></li>
-    <li class="active"><a href="${ctx}/user/newCmShop/special/new/edit?id=${newCmShop.shopID}">${not empty newCmShop.shopID?'编辑':'添加'}特殊供应商</a></li>
+    <li class="active"><a href="${ctx}/user/newCmShop/special/new/edit?id=${newCmShop.shopID}&shopType=${newCmshop.shopType}">${not empty newCmShop.shopID?'编辑':'添加'}特殊供应商</a></li>
 </ul>
 <br/>
 <form:form id="inputForm" modelAttribute="newCmShop" action="${ctx}/user/newCmShop/special/new/save" method="post"
@@ -44,7 +44,7 @@
                 ${newCmShop.name}
             </c:if>
             <c:if test="${newCmShop.shopType eq 2}">
-                <form:input path="name" htmlEscape="false" maxlength="25" class="input-xlarge required"/>
+                <form:input path="name" htmlEscape="false" maxlength="30" class="input-xlarge required"/>
             </c:if>
         </div>
     </div>
@@ -55,7 +55,7 @@
                 ${newCmShop.linkMan}
             </c:if>
             <c:if test="${newCmShop.shopType eq 2}">
-            <form:input path="linkMan" htmlEscape="false" maxlength="15" class="input-xlarge required"/>
+            <form:input path="linkMan" htmlEscape="false" maxlength="6" class="input-xlarge required"/>
             </c:if>
         </div>
     </div>
@@ -66,7 +66,7 @@
                 ${newCmShop.contractMobile}
             </c:if>
             <c:if test="${newCmShop.shopType eq 2}">
-            <form:input path="contractMobile" htmlEscape="false" type="number" maxlength="15" class="input-xlarge required"/>
+            <form:input path="contractMobile" htmlEscape="false" type="number" maxlength="11" class="input-xlarge required"/>
             </c:if>
         </div>
     </div>

+ 8 - 8
src/main/webapp/WEB-INF/views/modules/user/cmNewProductShopList.jsp

@@ -224,10 +224,16 @@
         <div class="flex-wrap">
             <div class="item">
                 <label>供应商ID:</label>
-                <form:input path="shopID" htmlEscape="false" maxlength="10" class="input-medium"/>
-                <label>公司名称:</label>
+                <form:input path="shopID" htmlEscape="false" maxlength="10" type="number" class="input-medium"/>
+                <label>供应商名称:</label>
                 <form:input path="name" htmlEscape="false" maxlength="50" class="input-medium"/>
             </div>
+            <div class="item">
+                <label>联系人:</label>
+                <form:input path="linkMan" htmlEscape="false" maxlength="100" class="input-medium"/>
+                <label>手机号:</label>
+                <form:input path="contractMobile" htmlEscape="false" maxlength="100" class="input-medium"/>
+            </div>
             <div class="item">
                 <label> 状态:</label>
                 <form:select path="status" class="input-medium">
@@ -235,12 +241,6 @@
                     <form:option value="90" label="已上线"/>
                     <form:option value="91" label="已下线"/>
                 </form:select>
-                <label>手机号:</label>
-                <form:input path="contractMobile" htmlEscape="false" maxlength="100" class="input-medium"/>
-            </div>
-            <div class="item">
-                <label>联系人:</label>
-                <form:input path="linkMan" htmlEscape="false" maxlength="100" class="input-medium"/>
             </div>
             <div class="item">
                 &nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>