商户注册查询完善
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/ShopDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/ShopDao.java
index 2eb003e..fccf800 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/ShopDao.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/dao/ShopDao.java
@@ -2,10 +2,22 @@
import com.supwisdom.dlpay.framework.domain.TShop;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Lock;
+import org.springframework.data.jpa.repository.Query;
+
+import javax.persistence.LockModeType;
/**
* Created by shuwei on 2019/4/15.
*/
public interface ShopDao extends JpaRepository<TShop, Integer> {
TShop getByThirdUniqueIdenty(String thirdUniqueIdenty);
+
+ @Lock(LockModeType.PESSIMISTIC_WRITE)
+ @Query("select a from TShop a where a.thirdUniqueIdenty=?1")
+ TShop getByThirdUniqueIdentyForUpdate(String thirdUniqueIdenty);
+
+ TShop getTShopByShopid(Integer shopid);
+
+ TShop getTShopByShopaccno(String shopaccno);
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TShop.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TShop.java
index 9263fa1..664e1ad 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TShop.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/domain/TShop.java
@@ -4,9 +4,9 @@
import javax.persistence.*;
@Entity
-@Table(name = "TB_SHOP")
+@Table(name = "TB_SHOP",
+ indexes = {@Index(name = "shop_shopaccno_idx", columnList = "shopaccno")})
public class TShop {
-
@Id
@SequenceGenerator(name = "shopid", sequenceName = "SEQ_SHOP", allocationSize = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "shopid")
@@ -61,9 +61,31 @@
/**
* 第三方唯一ID
* */
- @Column(name="THIRD_UNIQUE_IDENTY", length = 40)
+ @Column(name="THIRD_UNIQUE_IDENTY", length = 200)
private String thirdUniqueIdenty;
+ public TShop() {
+ }
+
+ public TShop(Integer fshopid, String shopname, Integer shoptype, String status, String shopaccno, String contactman, String idtype, String idno, String tel, String mobile, String email, String addr, String zipcode, String opendate, String closedate, String thirdUniqueIdenty) {
+ this.fshopid = fshopid;
+ this.shopname = shopname;
+ this.shoptype = shoptype;
+ this.status = status;
+ this.shopaccno = shopaccno;
+ this.contactman = contactman;
+ this.idtype = idtype;
+ this.idno = idno;
+ this.tel = tel;
+ this.mobile = mobile;
+ this.email = email;
+ this.addr = addr;
+ this.zipcode = zipcode;
+ this.opendate = opendate;
+ this.closedate = closedate;
+ this.thirdUniqueIdenty = thirdUniqueIdenty;
+ }
+
public String getThirdUniqueIdenty() {
return thirdUniqueIdenty;
}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/util/TradeErrorCode.java b/src/main/java/com/supwisdom/dlpay/framework/util/TradeErrorCode.java
index 13062ef..6411cac 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/util/TradeErrorCode.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/util/TradeErrorCode.java
@@ -105,4 +105,6 @@
public static final int BUSINESS_DEAL_ERROR = 30000; //业务处理错误
+ public static final int BUSINESS_SHOP_EXISTS = 30001; //商户已经存在
+
}
diff --git a/src/main/java/com/supwisdom/dlpay/util/ConstantUtil.java b/src/main/java/com/supwisdom/dlpay/util/ConstantUtil.java
index 7342e18..13af83c 100644
--- a/src/main/java/com/supwisdom/dlpay/util/ConstantUtil.java
+++ b/src/main/java/com/supwisdom/dlpay/util/ConstantUtil.java
@@ -19,4 +19,6 @@
public static final String IDTYPE_OTHER = "9"; //其他
public static final String[] IDTYPE_DICTS = {"1", "2", "3", "4", "5", "9"}; //联动
+ public static final int SHOPTYPE_GROUP = 0; //商户组
+ public static final int SHOPTYPE_LEAF = 1; //末级商户,独立核算商户
}