商户注册查询完善
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;  //末级商户,独立核算商户
 }
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/bean/api_request_param.kt b/src/main/kotlin/com/supwisdom/dlpay/api/bean/api_request_param.kt
index 79d56ea..e3ab38e 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/api/bean/api_request_param.kt
+++ b/src/main/kotlin/com/supwisdom/dlpay/api/bean/api_request_param.kt
@@ -23,6 +23,7 @@
     }
 }
 
+// ============================ USER ============================ //
 class OpenUserParam : APIRequestParam() {
     var syscode: String = "" //必传
     var uid: String = ""    //必传
@@ -98,4 +99,53 @@
         param_map.plus(mapOf("syscode" to syscode, "userid" to userid, "uid" to uid, "name" to name, "sex" to sex, "idtype" to idtype, "idno" to idno, "mobile" to mobile, "tel" to tel, "email" to email, "address" to address, "zipcode" to zipcode, "sign" to sign))
         return true
     }
+}
+
+
+// ============================ SHOP ============================ //
+class OpenShopParam : APIRequestParam() {
+    var syscode: String = "" //必传
+    var shopUniqueId: String = "" //必传
+    var shoptype: Int = 1
+    var fshopid: Int? = null
+    var shopname: String = "" //必传
+    var contactman: String? = null
+    var idtype: String? = null
+    var idno: String? = null
+    var mobile: String? = null
+    var email: String? = null
+    var address: String? = null
+    var zipcode: String? = null
+    var sign: String = "" //必传
+
+    fun checkParam(): Boolean {
+        if (StringUtil.isEmpty(syscode)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "子系统注册代码不能为空")
+        if (StringUtil.isEmpty(shopUniqueId)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "商户唯一号不能为空")
+        if (ConstantUtil.SHOPTYPE_GROUP != shoptype && ConstantUtil.SHOPTYPE_LEAF != shoptype) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "请指定商户类型")
+        if (StringUtil.isEmpty(shopname)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "商户名称不能为空")
+        if (!StringUtil.isEmpty(idtype) && !ConstantUtil.IDTYPE_DICTS.contains(idtype)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "证件类型非法")
+        if (!StringUtil.isEmpty(idno) && !StringUtil.isCharAndNum(idno)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "证件号不能为空,且仅支持数字和字母")
+        if (!StringUtil.isEmpty(idno) && StringUtil.isEmpty(idtype)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "证件号不能为空时,请指定证件类型")
+        if (!StringUtil.isEmpty(mobile) && !StringUtil.isMobile(mobile)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "手机号格式错误")
+        if (!StringUtil.isEmpty(email) && !StringUtil.isEmail(email)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "邮箱格式错误")
+
+        param_map.plus(mapOf("syscode" to syscode, "shopUniqueId" to shopUniqueId, "shoptype" to shoptype, "fshopid" to fshopid, "shopname" to shopname, "contactman" to contactman, "idtype" to idtype, "idno" to idno, "mobile" to mobile, "email" to email, "address" to address, "zipcode" to zipcode, "sign" to sign))
+        return true
+    }
+}
+
+class QueryShopParam : APIRequestParam() {
+    var syscode: String = "" //必传
+    var shopid: Int? = null  //注册时返回的shopid
+    var shopaccno: String? = null  //注册时返回的shopaccno
+    var shopUniqueId: String? = null //注册传的商户唯一号
+    var sign: String = "" //必传
+
+    fun checkParam(): Boolean {
+        if (StringUtil.isEmpty(syscode)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "子系统注册代码不能为空")
+        if (StringUtil.isEmpty(shopUniqueId) && null == shopid && StringUtil.isEmpty(shopaccno)) throw RequestParamCheckException(TradeErrorCode.REQUEST_PARAM_ERROR, "商户唯一标志不能为空")
+
+        param_map.plus(mapOf("syscode" to syscode, "shopUniqueId" to shopUniqueId, "shopid" to shopid, "shopaccno" to shopaccno, "sign" to sign))
+        return true
+    }
 }
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/controller/shop_api_controller.kt b/src/main/kotlin/com/supwisdom/dlpay/api/controller/shop_api_controller.kt
new file mode 100644
index 0000000..a8f4bfc
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/api/controller/shop_api_controller.kt
@@ -0,0 +1,81 @@
+package com.supwisdom.dlpay.api.controller
+
+import com.supwisdom.dlpay.api.bean.OpenShopParam
+import com.supwisdom.dlpay.api.bean.QueryShopParam
+import com.supwisdom.dlpay.framework.ResponseBodyBuilder
+import com.supwisdom.dlpay.api.service.ShopService
+import com.supwisdom.dlpay.exception.RequestParamCheckException
+import com.supwisdom.dlpay.exception.TransactionException
+import com.supwisdom.dlpay.framework.service.SystemUtilService
+import com.supwisdom.dlpay.framework.util.TradeErrorCode
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.http.ResponseEntity
+import org.springframework.web.bind.annotation.*
+import java.net.URLDecoder
+
+@RestController
+@RequestMapping("/api/shop")
+class ShopAPIController {
+    @Autowired
+    private lateinit var shopService: ShopService
+    @Autowired
+    private lateinit var systemUtilService: SystemUtilService
+
+    @PostMapping("/open")
+    fun openAccount(@RequestBody request: OpenShopParam): ResponseEntity<Any> {
+        return try {
+            if (request.checkParam() && request.checkSign(systemUtilService.getSubsystemSignKey(request.syscode))) {
+                ResponseEntity.ok(ResponseBodyBuilder.create()
+                        .fail(TradeErrorCode.REQUEST_SIGN_ERROR, "参数签名错误"))
+            }
+            shopService.findByThirdUniqueId(request.shopUniqueId)?.let {
+                ResponseEntity.ok(ResponseBodyBuilder.create()
+                        .fail(TradeErrorCode.BUSINESS_SHOP_EXISTS, "该商户唯一号[${request.shopUniqueId}]已经存在"))
+            }
+
+            request.shopname = request.shopname?.let { URLDecoder.decode(request.shopname, Charsets.UTF_8.toString()) } //解码
+            request.contactman = request.contactman?.let { URLDecoder.decode(request.contactman, Charsets.UTF_8.toString()) } //解码
+            request.address = request.address?.let { URLDecoder.decode(request.address, Charsets.UTF_8.toString()) } //解码
+            shopService.registerShop(request)?.let {
+                ResponseEntity.ok(ResponseBodyBuilder.create()
+                        .data("shopid", it.shopid)
+                        .data("shopaccno",it.shopaccno?:"")
+                        .success("注册成功"))
+            }
+
+            ResponseEntity.ok(ResponseBodyBuilder.create()
+                    .fail(TradeErrorCode.BUSINESS_DEAL_ERROR, "商户注册失败"))
+        } catch (ex: RequestParamCheckException) {
+            ResponseEntity.ok(ResponseBodyBuilder.create()
+                    .requestException(ex, "请求参数错误"))
+        } catch (et: TransactionException) {
+            ResponseEntity.ok(ResponseBodyBuilder.create()
+                    .transException(et, "业务处理错误"))
+        }
+    }
+
+    @GetMapping("/query")
+    fun queryShop(@RequestBody request: QueryShopParam): ResponseEntity<Any> {
+        return try {
+            if (request.checkParam() && request.checkSign(systemUtilService.getSubsystemSignKey(request.syscode))) {
+                ResponseEntity.ok(ResponseBodyBuilder.create()
+                        .fail(TradeErrorCode.REQUEST_SIGN_ERROR, "参数签名错误"))
+            }
+
+            shopService.findByShopBySearch(request.shopid,request.shopaccno,request.shopUniqueId)?.let {
+                ResponseEntity.ok(ResponseBodyBuilder.create()
+                        .data("shopid", it)
+                        .success())
+            }
+
+            ResponseEntity.ok(ResponseBodyBuilder.create()
+                    .fail(TradeErrorCode.SHOP_NOT_EXISTS, "商户不存在"))
+        } catch (ex: RequestParamCheckException) {
+            ResponseEntity.ok(ResponseBodyBuilder.create()
+                    .requestException(ex, "请求参数错误"))
+        } catch (et: TransactionException) {
+            ResponseEntity.ok(ResponseBodyBuilder.create()
+                    .transException(et, "业务处理错误"))
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/shop_service_impl.kt b/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/shop_service_impl.kt
new file mode 100644
index 0000000..07c6c40
--- /dev/null
+++ b/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/shop_service_impl.kt
@@ -0,0 +1,94 @@
+package com.supwisdom.dlpay.api.service.impl
+
+import com.supwisdom.dlpay.api.bean.OpenShopParam
+import com.supwisdom.dlpay.framework.dao.ShopDao
+import com.supwisdom.dlpay.framework.dao.ShopaccDao
+import com.supwisdom.dlpay.framework.domain.TShop
+import com.supwisdom.dlpay.framework.domain.TShopacc
+import com.supwisdom.dlpay.framework.service.SystemUtilService
+import com.supwisdom.dlpay.framework.util.Subject
+import com.supwisdom.dlpay.api.service.ShopService
+import com.supwisdom.dlpay.exception.TransactionProcessException
+import com.supwisdom.dlpay.framework.util.StringUtil
+import com.supwisdom.dlpay.framework.util.TradeDict
+import com.supwisdom.dlpay.framework.util.TradeErrorCode
+import com.supwisdom.dlpay.util.ConstantUtil
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.stereotype.Service
+
+/**
+ * Created by shuwei on 2019/4/15.
+ */
+@Service
+class ShopServiceImpl : ShopService {
+    @Autowired
+    private lateinit var shopDao: ShopDao
+    @Autowired
+    private lateinit var shopaccDao: ShopaccDao
+    @Autowired
+    private lateinit var systemUtilService: SystemUtilService
+
+    override fun findByThirdUniqueId(uniqueId: String): TShop? {
+       return shopDao.getByThirdUniqueIdenty(uniqueId)
+    }
+
+    override fun registerShop(param: OpenShopParam): TShop {
+        val systemdatetime = systemUtilService.sysdatetime
+        var shop = shopDao.getByThirdUniqueIdentyForUpdate(param.shopUniqueId)
+        if (null != shop) {
+            throw TransactionProcessException(TradeErrorCode.BUSINESS_SHOP_EXISTS, "该商户唯一号[${param.shopUniqueId}]已经存在")
+        }
+        if (null != param.fshopid) {
+            shopDao.getTShopByShopid(param.fshopid).let {
+                if (null == it) {
+                    throw TransactionProcessException(TradeErrorCode.SHOP_NOT_EXISTS, "上级商户不存在已经存在")
+                }
+            }
+        }
+        shop = shopDao.save(TShop().apply {
+            fshopid = param.fshopid
+            shopname = param.shopname
+            shoptype = param.shoptype
+            status = TradeDict.STATUS_NORMAL
+            contactman = param.contactman
+            idtype = param.idtype
+            idno = param.idno
+            mobile = param.mobile
+            email = param.email
+            addr = param.address
+            zipcode = param.zipcode
+            opendate = systemdatetime.hostdate
+            thirdUniqueIdenty = param.shopUniqueId
+        })
+        if (ConstantUtil.SHOPTYPE_GROUP != shop.shoptype) {
+            //非商户组要创建账号
+            val shopaccno = String.format("2%09d", shop.shopid)
+            shopaccDao.save(TShopacc().apply {
+                this.shopaccno = shopaccno
+                this.shopid = shop.shopid
+                this.shopname = shop.shopname
+                this.subjno = Subject.SUBJNO_MACHANT_INCOME
+                this.status = TradeDict.STATUS_NORMAL
+                this.opendate = shop.opendate
+            })
+            shop.shopaccno = shopaccno
+            shopDao.save(shop) //更新账号
+        }
+        return shop
+    }
+
+    override fun findByShopId(shopid: Int): TShop {
+        return shopDao.getTShopByShopid(shopid)
+                ?: throw TransactionProcessException(TradeErrorCode.SHOP_NOT_EXISTS, "商户[ID=$shopid]不存在")
+    }
+
+    override fun findByShopBySearch(shopid: Int?, shopaccno: String?, shopUniqueId: String?): TShop? {
+        return if (null != shopid) {
+            shopDao.getTShopByShopid(shopid)
+        } else if (!StringUtil.isEmpty(shopaccno)) {
+            shopDao.getTShopByShopaccno(shopaccno)
+        } else {
+            shopDao.getByThirdUniqueIdenty(shopUniqueId)
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/shop/service/shop_service.kt b/src/main/kotlin/com/supwisdom/dlpay/api/service/shop_service.kt
similarity index 61%
rename from src/main/kotlin/com/supwisdom/dlpay/shop/service/shop_service.kt
rename to src/main/kotlin/com/supwisdom/dlpay/api/service/shop_service.kt
index a42b86b..697bc11 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/shop/service/shop_service.kt
+++ b/src/main/kotlin/com/supwisdom/dlpay/api/service/shop_service.kt
@@ -1,5 +1,6 @@
-package com.supwisdom.dlpay.shop.service
+package com.supwisdom.dlpay.api.service
 
+import com.supwisdom.dlpay.api.bean.OpenShopParam
 import com.supwisdom.dlpay.framework.domain.TShop
 import org.springframework.transaction.annotation.Propagation
 import org.springframework.transaction.annotation.Transactional
@@ -9,11 +10,14 @@
  */
 interface ShopService {
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = arrayOf(Exception::class))
-    fun save(shop: TShop): TShop
+    fun registerShop(param: OpenShopParam): TShop
 
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = arrayOf(Exception::class), readOnly = true)
     fun findByThirdUniqueId(uniqueId: String): TShop?
 
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = arrayOf(Exception::class), readOnly = true)
-    fun findByShopId(shopid: Int): TShop?
+    fun findByShopId(shopid: Int): TShop
+
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = arrayOf(Exception::class), readOnly = true)
+    fun findByShopBySearch(shopid: Int?, shopaccno: String?, shopUniqueId: String?): TShop?
 }
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/shop/bean/shop_param.kt b/src/main/kotlin/com/supwisdom/dlpay/shop/bean/shop_param.kt
deleted file mode 100644
index 749dd3a..0000000
--- a/src/main/kotlin/com/supwisdom/dlpay/shop/bean/shop_param.kt
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.supwisdom.dlpay.shop.bean
-
-/**
- * 请求参数
- */
-class ShopParam {
-    var shopid: Int? = 0
-    var addr: String? = ""
-    var shopname: String = ""
-    var mobile: String = ""
-    var contactman: String = ""
-    var uniqueId: String? = ""
-}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/shop/controller/shop_controller.kt b/src/main/kotlin/com/supwisdom/dlpay/shop/controller/shop_controller.kt
deleted file mode 100644
index 7103b4d..0000000
--- a/src/main/kotlin/com/supwisdom/dlpay/shop/controller/shop_controller.kt
+++ /dev/null
@@ -1,66 +0,0 @@
-package com.supwisdom.dlpay.shop.controller
-
-import com.supwisdom.dlpay.framework.ResponseBodyBuilder
-import com.supwisdom.dlpay.framework.domain.TShop
-import com.supwisdom.dlpay.framework.service.SystemUtilService
-import com.supwisdom.dlpay.framework.util.TradeDict
-import com.supwisdom.dlpay.shop.bean.ShopParam
-import com.supwisdom.dlpay.shop.service.ShopService
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.http.ResponseEntity
-import org.springframework.web.bind.annotation.*
-
-/**
- * 接口签名值等
- */
-@RestController
-@RequestMapping("/api/shop")
-class ShopController {
-    @Autowired
-    private lateinit var shopService: ShopService
-
-    @PostMapping("/open")
-    fun openAccount(@RequestBody request: ShopParam): ResponseEntity<Any> {
-        if (request.uniqueId != null && request.uniqueId != "") {
-            var shop = shopService.findByThirdUniqueId(request.uniqueId!!)
-            if (shop != null) {
-                return ResponseEntity.ok(ResponseBodyBuilder.create()
-                        .fail(1, "[uniqueId]该值已存在"))
-            }
-        }
-        val shop = TShop()
-        shop.addr = request.addr
-        shop.contactman = request.contactman
-        shop.mobile = request.mobile
-        shop.shopname = request.shopname
-        shop.status = TradeDict.STATUS_NORMAL
-        shop.thirdUniqueIdenty = request.uniqueId
-        shopService.save(shop)
-        return ResponseEntity.ok(ResponseBodyBuilder.create()
-                .data("shopid", shop.shopid)
-                .success())
-    }
-
-    @GetMapping("/get")
-    fun queryShop(@RequestBody request: ShopParam): ResponseEntity<Any> {
-        if (request.uniqueId != null && request.uniqueId != "") {
-            var shop = shopService.findByThirdUniqueId(request.uniqueId!!)
-            if (shop != null) {
-                return ResponseEntity.ok(ResponseBodyBuilder.create()
-                        .data("shop", shop)
-                        .success())
-            }
-        } else if (request.shopid != null && request.shopid != 0) {
-            var shop = shopService.findByShopId(request.shopid!!)
-            if (shop != null) {
-                return ResponseEntity.ok(ResponseBodyBuilder.create()
-                        .data("shop", shop)
-                        .success())
-            }
-        }
-        return ResponseEntity.ok(ResponseBodyBuilder.create()
-                .fail(1, "数据不存在"))
-    }
-
-
-}
\ No newline at end of file
diff --git a/src/main/kotlin/com/supwisdom/dlpay/shop/service/impl/shop_service_impl.kt b/src/main/kotlin/com/supwisdom/dlpay/shop/service/impl/shop_service_impl.kt
deleted file mode 100644
index 411182d..0000000
--- a/src/main/kotlin/com/supwisdom/dlpay/shop/service/impl/shop_service_impl.kt
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.supwisdom.dlpay.shop.service.impl
-
-import com.supwisdom.dlpay.framework.dao.ShopDao
-import com.supwisdom.dlpay.framework.dao.ShopaccDao
-import com.supwisdom.dlpay.framework.domain.TShop
-import com.supwisdom.dlpay.framework.domain.TShopacc
-import com.supwisdom.dlpay.framework.service.SystemUtilService
-import com.supwisdom.dlpay.framework.util.Subject
-import com.supwisdom.dlpay.shop.service.ShopService
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.stereotype.Service
-
-/**
- * Created by shuwei on 2019/4/15.
- */
-@Service
-class ShopServiceImpl : ShopService {
-    @Autowired
-    private lateinit var shopDao: ShopDao
-    @Autowired
-    private lateinit var shopaccDao: ShopaccDao
-    @Autowired
-    private lateinit var systemUtilService: SystemUtilService
-
-    override fun findByThirdUniqueId(uniqueId: String): TShop? {
-       return shopDao.getByThirdUniqueIdenty(uniqueId)
-    }
-
-    override fun save(shop: TShop): TShop {
-        var systemdatetime = systemUtilService.sysdatetime
-        shop.opendate = systemdatetime.hostdate
-        shopDao.save(shop)
-        var shopacc = shopaccDao.findByShopid(shop.shopid)
-        if (shopacc == null) {
-            shopacc = TShopacc()
-            shopacc.shopid = shop.shopid
-            shopacc.shopname = shop.shopname
-            shopacc.status = shop.status
-            shopacc.subjno = Subject.SUBJNO_MACHANT_INCOME
-            shopacc.opendate = systemdatetime.hostdate
-            shopacc.shopaccno = String.format("2%09d",shop.shopid)
-            shopaccDao.save(shopacc)
-        }
-        return shop
-    }
-
-    override fun findByShopId(shopid: Int): TShop? {
-        return shopDao.getOne(shopid)
-    }
-}
\ No newline at end of file