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

关于发货提醒的重复验证方法,新增唯一标识验证,存储重复的不做处理

hejq 8 лет назад
Родитель
Сommit
19b53e6baa

+ 2 - 0
src/main/java/com/uas/platform/b2b/controller/SaleNoticeController.java

@@ -359,6 +359,7 @@ public class SaleNoticeController {
 		SaleSend send = FlexJsonUtils.fromJson(json, SaleSend.class);
 		boolean flag = tokenService.enabled(token);
 		if (flag) {
+			send.setUuid(token);
 			send = purchaseNoticeService.send(noticeId, send);
 			tokenService.delete(token);
 		}
@@ -384,6 +385,7 @@ public class SaleNoticeController {
 		SaleSend send = FlexJsonUtils.fromJson(json, SaleSend.class);
 		boolean flag = tokenService.enabled(token);
 		if (flag) {
+			send.setUuid(token);
 			send = purchaseNoticeService.send(send);
 			tokenService.delete(token);
 		}

+ 40 - 0
src/main/java/com/uas/platform/b2b/model/SaleSend.java

@@ -146,6 +146,12 @@ public class SaleSend implements Serializable {
 	@Column(name = "ss_verifystatus")
 	private Short verifystatus;
 
+	/**
+	 * 每次产生送货单时记录一个唯一标识,防止重复
+	 */
+	@Column(name = "ss_uuid")
+	private String uuid;
+
 	public SaleSend() {
 	}
 
@@ -303,6 +309,40 @@ public class SaleSend implements Serializable {
 		this.custUser = custUser;
 	}
 
+	public String getUuid() {
+		return uuid;
+	}
+
+	public void setUuid(String uuid) {
+		this.uuid = uuid;
+	}
+
+	@Override
+	public String toString() {
+		return "SaleSend{" +
+				"id=" + id +
+				", code='" + code + '\'' +
+				", enUU=" + enUU +
+				", vendor=" + vendor +
+				", date=" + date +
+				", payments='" + payments + '\'' +
+				", currency='" + currency + '\'' +
+				", rate=" + rate +
+				", custUU=" + custUU +
+				", customer=" + customer +
+				", custUserUU=" + custUserUU +
+				", custUser=" + custUser +
+				", remark='" + remark + '\'' +
+				", recorder='" + recorder + '\'' +
+				", sendItems=" + sendItems +
+				", sendStatus=" + sendStatus +
+				", backStatus=" + backStatus +
+				", print=" + print +
+				", verifystatus=" + verifystatus +
+				", uuid='" + uuid + '\'' +
+				'}';
+	}
+
 	/**
 	 * 送货单详细
 	 * 

+ 6 - 14
src/main/java/com/uas/platform/b2b/service/impl/PurchaseNoticeServiceImpl.java

@@ -409,13 +409,9 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
 	@Override
 	public SaleSend send(Long noticeId, SaleSend send) {
 		PurchaseNotice notice = purchaseNoticeDao.findOne(noticeId);
-		if (notice != null) {
-//			//限制同一个供应商给同一个客户发货单号不可以重复,(避免一次发货产生多张单)
-//			List<SaleSend> sends =
-//					saleSendDao.findByEnUUAndCustUUAndCode(SystemSession.getUser().getEnterprise().getUu(),notice.getEnUU(), send.getCode());
-//			if (sends.size() > 0) {
-//				throw new IllegalOperatorException("发货单号重复,无法发货!提示:多个物料一起发货请选择批量发货。");
-//			}
+		List<SaleSend> sends = saleSendDao.findByUuid(send.getUuid());
+		//限制同一个供应商给同一个客户发货单号不可以重复,(避免一次发货产生多张单)
+		if (notice != null && CollectionUtils.isEmpty(sends)) {
 			if (notice.getEnd() != null && notice.getEnd() == Constant.YES) {
 				throw new IllegalOperatorException("客户已经取消了本次送货提醒,请刷新重试!");
 			}
@@ -474,13 +470,9 @@ public class PurchaseNoticeServiceImpl implements PurchaseNoticeService {
 
 	@Override
 	public SaleSend send(SaleSend saleSend) {
-		if (saleSend != null) {
-//			 //限制同一个供应商给同一个客户发货单号不可以重复,(避免一次发货产生多张单)
-//			 List<SaleSend> sends =
-//			 	saleSendDao.findByEnUUAndCustUUAndCode(SystemSession.getUser().getEnterprise().getUu(),saleSend.getCustUU(), saleSend.getCode());
-//			 if (sends.size() > 0) {
-//				 throw new IllegalOperatorException("发货单号重复,无法发货!提示:多个物料一起发货请选择批量发货。");
-//			 }
+		//限制同一个供应商给同一个客户发货单号不可以重复,(避免一次发货产生多张单),存在时不做处理
+		List<SaleSend> sendList = saleSendDao.findByUuid(saleSend.getUuid());
+		if (saleSend != null && CollectionUtils.isEmpty(sendList)) {
 			saleSend.setBackStatus((short) Status.NOT_UPLOAD.value());
 			saleSend.setSendStatus((short) Status.NOT_UPLOAD.value());
 			saleSend.setEnUU(SystemSession.getUser().getEnterprise().getUu());