Просмотр исходного кода

邀请记录,如果企业注册,显示物料上传数量

hejq 8 лет назад
Родитель
Сommit
7c5236f104

+ 1 - 2
src/main/java/com/uas/platform/b2b/controller/InvitationRecordController.java

@@ -2,7 +2,6 @@ package com.uas.platform.b2b.controller;
 
 import com.alibaba.fastjson.JSONObject;
 import com.uas.platform.b2b.core.util.ContextUtils;
-import com.uas.platform.b2b.model.Enterprise;
 import com.uas.platform.b2b.model.EnterpriseBaseInfo;
 import com.uas.platform.b2b.model.InvitationRecord;
 import com.uas.platform.b2b.search.SearchService;
@@ -79,7 +78,7 @@ public class InvitationRecordController {
 	@RequestMapping(value = "/records", method = RequestMethod.GET)
 	private SPage<InvitationRecord> getRecords(PageParams params, String keyword) {
 		com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, null);
-		pageParams.getFilters().put("in_enuu", SystemSession.getUser().getEnterprise().getUu());
+//		pageParams.getFilters().put("in_enuu", SystemSession.getUser().getEnterprise().getUu());
 		pageParams.getFilters().put("in_useruu", SystemSession.getUser().getUserUU());
 		List<Sort> sortList = new ArrayList<>();
 		sortList.add(new Sort("in_date", false, Type.LONG, new Long(1)));

+ 10 - 23
src/main/java/com/uas/platform/b2b/dao/ProductDao.java

@@ -1,13 +1,13 @@
 package com.uas.platform.b2b.dao;
 
 import com.uas.platform.b2b.model.Product;
-import org.springframework.data.jpa.repository.*;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.QueryHints;
 import org.springframework.data.jpa.repository.query.Procedure;
-import org.springframework.data.repository.query.Param;
 import org.springframework.stereotype.Repository;
 
 import javax.persistence.QueryHint;
-import javax.transaction.Transactional;
 import java.util.List;
 
 @Repository
@@ -242,15 +242,6 @@ public interface ProductDao extends JpaSpecificationExecutor<Product>, JpaReposi
 	@Procedure(procedureName = "PRODUCT$BUSINESSSTATUS")
 	public Integer findProductBusinessStatusById(Long id);
 
-//	/**
-//	 * 获得每种单据状态的数量
-//	 *
-//	 * @param ids 单据id
-//	 * @return
-//	 */
-//	@Query("select count(p), p.status from Product p where p.id in :ids group by p.status")
-//	public List<Object[]> getUnreadCountEveryStatus(@Param("ids") List<Long> ids);
-
 	/**
 	 * 通过型号和品牌查询物料是否存在
 	 * 
@@ -261,15 +252,11 @@ public interface ProductDao extends JpaSpecificationExecutor<Product>, JpaReposi
 	 */
 	List<Product> findByEnUUAndPcmpcodeAndPbrand(Long enuu, String pcmpcoe, String brand);
 
-//	/**  // 此方法已弃用
-//	 * 通过企业uu和物料编号禁用物料
-//	 *
-//	 * @param enUU 物料所属企业UU
-//	 * @param code 物料号
-//	 * @param b2bDisabled 是否禁用  1为禁用  其他为未禁用
-//	 */
-//	@Transactional
-//	@Modifying
-//	@Query("update Product p set p.productStatus.b2bDisabled = :b2bDisabled where p.enUU = :enUU and p.code = :code")
-//	int updateB2bEnabled(@Param("enUU") Long enUU, @Param("code") String code, @Param("b2bDisabled") Short b2bDisabled);
+	/**
+	 * 通过企业UU号查询物料上传数量
+	 *
+	 * @param enUU 企业UU
+	 * @return
+	 */
+	Long countByEnUU(Long enUU);
 }

+ 15 - 11
src/main/java/com/uas/platform/b2b/model/InvitationRecord.java

@@ -1,19 +1,9 @@
 package com.uas.platform.b2b.model;
 
+import javax.persistence.*;
 import java.io.Serializable;
 import java.util.Date;
 
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-
 /**
  * 邀请合作伙伴注册
  * 
@@ -134,6 +124,12 @@ public class InvitationRecord implements Serializable {
 	@Column(name = "in_erpdate")
 	private Date erpdate;
 
+	/**
+	 * 物料上传数量
+	 */
+	@Transient
+	private Long productNum;
+
 	public Long getId() {
 		return id;
 	}
@@ -269,4 +265,12 @@ public class InvitationRecord implements Serializable {
 	public void setErpdate(Date erpdate) {
 		this.erpdate = erpdate;
 	}
+
+	public Long getProductNum() {
+		return productNum;
+	}
+
+	public void setProductNum(Long productNum) {
+		this.productNum = productNum;
+	}
 }

+ 13 - 12
src/main/java/com/uas/platform/b2b/service/impl/InvitationRecordServiceImpl.java

@@ -1,23 +1,13 @@
 package com.uas.platform.b2b.service.impl;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.uas.platform.b2b.model.EnterpriseBaseInfo;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.ui.ModelMap;
-import org.springframework.util.CollectionUtils;
-
 import com.uas.account.util.AccountUtils;
 import com.uas.message.mail.service.MailService;
 import com.uas.platform.b2b.dao.EnterpriseDao;
 import com.uas.platform.b2b.dao.InvitationRecordDao;
+import com.uas.platform.b2b.dao.ProductDao;
 import com.uas.platform.b2b.dao.UserDao;
 import com.uas.platform.b2b.model.Enterprise;
+import com.uas.platform.b2b.model.EnterpriseBaseInfo;
 import com.uas.platform.b2b.model.InvitationRecord;
 import com.uas.platform.b2b.model.User;
 import com.uas.platform.b2b.search.SearchService;
@@ -30,6 +20,12 @@ import com.uas.platform.core.util.HttpUtil;
 import com.uas.platform.core.util.serializer.FlexJsonUtils;
 import com.uas.search.b2b.model.PageParams;
 import com.uas.search.b2b.model.SPage;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.ui.ModelMap;
+import org.springframework.util.CollectionUtils;
+
+import java.util.*;
 
 @Service
 public class InvitationRecordServiceImpl implements InvitationRecordService {
@@ -52,6 +48,9 @@ public class InvitationRecordServiceImpl implements InvitationRecordService {
 	@Autowired
 	private UserDao userDao;
 
+	@Autowired
+    private ProductDao productDao;
+
 	/**
 	 * 短信接口
 	 */
@@ -141,6 +140,7 @@ public class InvitationRecordServiceImpl implements InvitationRecordService {
 			record.setEnuu(enuu);
 			record.setUseruu(useruu);
 			record.setDate(new Date());
+			record.setActive(Constant.NO);
 			record = invitationRecordDao.save(record);
 			if (record.getVenduseremail() != null) {
 				mailService.send(messageConf.getTplInvitationForB2B(), record.getVenduseremail(), model);
@@ -208,6 +208,7 @@ public class InvitationRecordServiceImpl implements InvitationRecordService {
                         record.setActive(Constant.YES);
                         record.setSamecount(enters.size());
                         record.setVenduu(enters.get(0).getUu());
+                        record.setProductNum(productDao.countByEnUU(enters.get(0).getUu()));
                     } else {
                         record.setActive(Constant.NO);
                         record.setSamecount(enters.size());

+ 3 - 0
src/main/webapp/resources/tpl/index/baseInfo/invitation.html

@@ -171,6 +171,9 @@
 							<div ng-if="record.active == 1 && record.venduu != null"  class="col-md-2"><span class="text-muted">企业UU:</span><span ng-bind="::record.venduu"></span></div>
 							<div class="text-icon" ng-if="record.active == 1">已注册</div>
 							<div class="text-icon" ng-if="record.active == 0" style="border: #327ebe 1px solid; color: #327ebe;">未注册</div>
+							<div ng-if="record.active == 1">
+								物料: <span ng-bind="record.productNum"></span>
+							</div>
 						</td>
 						<td width="120" class="text-center all-btn">
 							<a ng-click="reInvite(record.id)" class="btn" ng-if="record.active == 0" style="padding: 0; background: #327ebe; color: #fff;">再次邀请</a>