Browse Source

增加“删除客户申请”接口

zhou.xiaoning 4 years ago
parent
commit
3d76c92c2a
7 changed files with 4072 additions and 2448 deletions
  1. 6 6
      config/config.xml
  2. 39 0
      controllers/erms3/customer.go
  3. 519 238
      docs/docs.go
  4. 519 238
      docs/swagger.json
  5. 2974 1966
      docs/swagger.yaml
  6. 13 0
      models/account.go
  7. 2 0
      routers/router.go

+ 6 - 6
config/config.xml

@@ -13,11 +13,11 @@
     <DbAddress value="192.168.31.117"/>
     <DbName value="orcl"/>
     <DbPort value="1521"/>
-    <DbUser value="mtp2_test114"/>
+    <DbUser value="mtp2_test175"/>
     <DbPwd value="muchinfo"/>
   </DbSetting>
   <RedisSetting>
-    <Address value="192.168.31.114"/>
+    <Address value="192.168.31.175"/>
     <Port value="5007"/>
     <Timeout value="3"/>
     <ConnNum value="1"/>
@@ -25,11 +25,11 @@
     <Pwd value=""/>
   </RedisSetting>
   <MqSetting>
-    <Url value="amqp://guest:guest@192.168.31.114:5020/test"/>
+    <Url value="amqp://guest:guest@192.168.31.175:5020/test"/>
     <Exchange value="entry"/>
   </MqSetting>
   <MongoDBSetting>
-    <HostName value="192.168.31.114"/>
+    <HostName value="192.168.31.175"/>
     <Port value="5025"/>
     <DBName value="HistoryQuote"/>
     <Username value="quote_test01"/>
@@ -38,8 +38,8 @@
   <MySQLSetting>
     <Host value="192.168.30.140"/>
     <Port value="3306"/>
-    <DBName value="historyquote_test114"/>
-    <Username value="quote_test114"/>
+    <DBName value="historyquote_test175"/>
+    <Username value="quote_test175"/>
     <Password value="123456"/>
   </MySQLSetting>
 </Configuration>

+ 39 - 0
controllers/erms3/customer.go

@@ -94,6 +94,45 @@ func ModifyUserInfoApply(c *gin.Context) {
 	appG.Response(http.StatusOK, e.SUCCESS, "OK")
 }
 
+// DeleteUserInfoApplyReq 删除客户申请请求参数
+type DeleteUserInfoApplyReq struct {
+	UserID int `form:"userID" binding:"required"`
+}
+
+// DeleteUserInfoApply 删除客户申请
+// @Summary 删除客户申请
+// @description 只可删除 UserState = 1 (未提交)状态的申请信息
+// @Produce json
+// @Security ApiKeyAuth
+// @Param userID query int true "用户ID"
+// @Success 200 {object} app.Response
+// @Failure 500 {object} app.Response
+// @Router /Erms3/DeleteUserInfoApply [get]
+// @Tags 风险管理v3
+func DeleteUserInfoApply(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取请求参数
+	var req DeleteUserInfoApplyReq
+	err := appG.C.ShouldBindQuery(&req)
+	if err != nil {
+		logger.GetLogger().Errorf("DeleteUserInfoApply failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	if err := models.DeleteWSKHUserInfo(req.UserID); err != nil {
+		// 执行失败
+		logger.GetLogger().Errorf("DeleteUserInfoApply failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_OPERATION_FAILED, nil)
+		return
+	}
+
+	// 执行成功
+	logger.GetLogger().Debugln("DeleteUserInfoApply successed: %v", "OK")
+	appG.Response(http.StatusOK, e.SUCCESS, "OK")
+}
+
 // QueryUserInfoAppliesReq 客户申请信息查询请求参数
 type QueryUserInfoAppliesReq struct {
 	app.PageInfo

File diff suppressed because it is too large
+ 519 - 238
docs/docs.go


File diff suppressed because it is too large
+ 519 - 238
docs/swagger.json


File diff suppressed because it is too large
+ 2974 - 1966
docs/swagger.yaml


+ 13 - 0
models/account.go

@@ -975,6 +975,19 @@ func UpdateWSKHUserInfo(userinfo Wskhuserinfo) error {
 	return nil
 }
 
+// DeleteWSKHUserInfo 删除网上开户账户信息(客户资料申请)
+func DeleteWSKHUserInfo(userID int) error {
+	if userID == 0 {
+		return errors.New("userID为0")
+	}
+	sql := fmt.Sprintf("DELETE FROM WSKH_USERINFO WHERE USERSTATE = 1 AND USERID = %d", userID)
+	if _, err := db.GetEngine().Exec(sql); err != nil {
+		return err
+	}
+
+	return nil
+}
+
 // GetWSKHUserInfos 获取开户信息列表
 func GetWSKHUserInfos(userName string) ([]Wskhuserinfo, error) {
 	engine := db.GetEngine()

+ 2 - 0
routers/router.go

@@ -232,6 +232,8 @@ func InitRouter() *gin.Engine {
 		erms3R.POST("/AddUserInfoApply", erms3.AddUserInfoApply)
 		// 修改客户申请
 		erms3R.POST("/ModifyUserInfoApply", erms3.ModifyUserInfoApply)
+		// 删除客户申请
+		erms3R.GET("/DeleteUserInfoApply", erms3.DeleteUserInfoApply)
 		// 客户申请信息查询
 		erms3R.GET("/QueryUserInfoApplies", erms3.QueryUserInfoApplies)
 		// 待审核业务查询

Some files were not shown because too many files changed in this diff