From 2337e30251c31ccf176da2c8fd445bca75a6735a Mon Sep 17 00:00:00 2001 From: yuan <1551130722@qq.com> Date: Thu, 24 May 2018 18:44:35 +0800 Subject: [PATCH] fix~ --- src/db/modify.sql | 29 ++++++++++++++++++- .../application/beans/ClientPreApplyBean.java | 10 +++++++ .../impls/SimpleClientApplyServiceImpl.java | 13 +++++---- .../preapply/SysClientPreMapperMapper.java | 2 +- .../merchant_application.js | 3 ++ 5 files changed, 50 insertions(+), 7 deletions(-) diff --git a/src/db/modify.sql b/src/db/modify.sql index 12073aaad..b4e706834 100644 --- a/src/db/modify.sql +++ b/src/db/modify.sql @@ -505,4 +505,31 @@ CREATE TABLE `sys_mail_send` ( PRIMARY KEY (`id`,`mail_address`), KEY `mail_address` (`mail_address`), KEY `id` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 + +CREATE TABLE `sys_client_pre_apply` ( + `client_pre_apply_id` int(11) NOT NULL, + `username` varchar(50) DEFAULT NULL, + `password` varchar(20) DEFAULT '', + `contact_person` varchar(50) DEFAULT NULL, + `contact_phone` varchar(20) DEFAULT '', + `contact_email` varchar(255) DEFAULT NULL, + `company_name` varchar(100) DEFAULT NULL, + `abn` varchar(20) DEFAULT NULL, + `short_name` varchar(50) DEFAULT NULL, + `address` varchar(200) DEFAULT NULL, + `suburb` varchar(50) DEFAULT NULL, + `state` varchar(20) DEFAULT NULL, + `postcode` varchar(20) DEFAULT NULL, + `industry` varchar(50) DEFAULT NULL, + `bank_no` varchar(20) DEFAULT NULL, + `bank_name` varchar(50) DEFAULT NULL, + `bsb_no` varchar(6) DEFAULT NULL, + `clean_days` smallint(6) DEFAULT NULL, + `create_time` datetime DEFAULT NULL, + `update_time` datetime DEFAULT NULL, + `agree` tinyint(1) DEFAULT NULL, + `company_phone` varchar(20) DEFAULT NULL, + PRIMARY KEY (`client_pre_apply_id`), + UNIQUE KEY `username` (`username`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; \ No newline at end of file diff --git a/src/main/java/au/com/royalpay/payment/manage/application/beans/ClientPreApplyBean.java b/src/main/java/au/com/royalpay/payment/manage/application/beans/ClientPreApplyBean.java index abe3c616c..13661e32c 100644 --- a/src/main/java/au/com/royalpay/payment/manage/application/beans/ClientPreApplyBean.java +++ b/src/main/java/au/com/royalpay/payment/manage/application/beans/ClientPreApplyBean.java @@ -30,6 +30,8 @@ public class ClientPreApplyBean { private boolean agree; + private String codeKey; + public JSONObject insertObject() { JSONObject res = (JSONObject) JSON.toJSON(this); return res; @@ -185,4 +187,12 @@ public class ClientPreApplyBean { public void setCompany_phone(String company_phone) { this.company_phone = company_phone; } + + public String getCodeKey() { + return codeKey; + } + + public void setCodeKey(String codeKey) { + this.codeKey = codeKey; + } } diff --git a/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java index c2d51150f..c26fa7ebd 100644 --- a/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/application/core/impls/SimpleClientApplyServiceImpl.java @@ -219,12 +219,15 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService { @Transactional public void updateApplyInfo(ClientPreApplyBean companyBean, String username) { JSONObject apply = sysClientPreMapperMapper.findByUserName(username); - if (apply != null ){ - throw new BadRequestException("用户名已重复!"); - } JSONObject applyInfo = companyBean.insertObject(); - applyInfo.put("create_time",new Date()); - sysClientPreMapperMapper.save(applyInfo); + if (apply == null ){ + applyInfo.put("create_time",new Date()); + sysClientPreMapperMapper.save(applyInfo); + }else { + applyInfo.put("client_pre_apply_id",apply.getIntValue("client_pre_apply_id")); + applyInfo.put("update_time",new Date()); + sysClientPreMapperMapper.update(applyInfo); + } if(applyInfo.getBoolean("agree")){ applyerToClient(username); } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/preapply/SysClientPreMapperMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/preapply/SysClientPreMapperMapper.java index 8a268e2cd..bdd1b88d6 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/preapply/SysClientPreMapperMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/preapply/SysClientPreMapperMapper.java @@ -10,7 +10,7 @@ import java.math.BigDecimal; import java.util.Date; import java.util.List; -@AutoMapper(tablename = "sys_client_pre_apply", pkName = "client_pre_apply_id") +@AutoMapper(tablename = "sys_client_pre_apply", pkName = "client_pre_apply_id",pkAutoIncrement = true) public interface SysClientPreMapperMapper { @AutoSql(type = SqlType.UPDATE) void update(JSONObject data); diff --git a/src/main/ui/static/merchantapplication/merchant_application.js b/src/main/ui/static/merchantapplication/merchant_application.js index f3a6d76bd..70195f836 100644 --- a/src/main/ui/static/merchantapplication/merchant_application.js +++ b/src/main/ui/static/merchantapplication/merchant_application.js @@ -216,6 +216,9 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl', }); return; } + if(index == 1){ + $scope.partner.codeKey = Math.random().toString(16).substring(2); + } $http.post('/register/info/update/' + $scope.partner.username, $scope.partner).then(function (resp) { if (index == 3) { $scope.getRateConfig();