diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Front-end/Login/Login.html b/Front-end/Login/Login.html new file mode 100644 index 0000000..9ba9ad7 --- /dev/null +++ b/Front-end/Login/Login.html @@ -0,0 +1,443 @@ + + + + + + + + + 账号登录 + + + + + +
+
+

登录失败

+
+
+
+
+ + + +
+ +
+

+

+

+ + +
+ 忘记密码 +
+
+ +
+ + + + + + + + + + + + + + + + + + +

CLOUD

+
+
+
+ + + + diff --git a/Front-end/Login/NEOTERICc.ttf b/Front-end/Login/NEOTERICc.ttf new file mode 100644 index 0000000..9ec1177 Binary files /dev/null and b/Front-end/Login/NEOTERICc.ttf differ diff --git a/Front-end/Login/main.css b/Front-end/Login/main.css new file mode 100644 index 0000000..81f985b --- /dev/null +++ b/Front-end/Login/main.css @@ -0,0 +1,274 @@ +*{ + margin: 0; + padding: 0; +} + +html, +body { + height: 100%; +} + +@font-face { + font-family: 'neo'; + src: url("NEOTERICc-1.ttf")/*tpa=http://www.17sucai.com/preview/384665/2018-12-28/login/css/font/NEOTERICc.ttf*/; +} +input:focus{ + outline: none; +} +.form input{ + width: 300px; + height: 30px; + font-size: 18px; + background: none; + border: none; + border-bottom: 1px solid #fff; + color: #fff; + margin-bottom: 20px; +} +.form input::placeholder{ + color: rgba(255,255,255,0.8); + font-size: 18px; + font-family: "neo"; +} +.confirm{ + height: 0; + overflow: hidden; + transition: .25s; +} +.btn{ + width:140px; + height: 40px; + border: 1px solid #fff; + background: none; + font-size:20px; + color: #fff; + cursor: pointer; + margin-top: 25px; + font-family: "neo"; + transition: .25s; +} +.btn:hover{ + background: rgba(255,255,255,.25); +} +#login_wrap{ + width: 980px; + min-height: 500px; + border-radius: 10px; + font-family: "neo"; + overflow: hidden; + box-shadow: 0px 0px 120px rgba(0, 0, 0, 0.25); + position: fixed; + top: 50%; + right: 50%; + margin-top: -250px; + margin-right: -490px; +} +#login{ + width: 50%; + height: 100%; + min-height: 500px; + background: linear-gradient(45deg, #9a444e, #e06267); + position: relative; + float: right; +} +#login #status{ + width: 90px; + height: 35px; + margin: 40px auto; + color: #fff; + font-size: 30px; + font-weight: 600; + position: relative; + overflow: hidden; +} +#login #status i{ + font-style: normal; + position: absolute; + transition: .5s +} +#login span{ + text-align: center; + position: absolute; + left: 50%; + margin-left: -150px; + top: 52%; + margin-top: -140px; +} +#login span a{ + text-decoration: none; + color: #fff; + display: block; + margin-top: 80px; + font-size: 18px; +} +#bg{ + background: linear-gradient(45deg, #211136, #bf5853); + height: 100%; +} +/*绘图*/ +#login_img{ + width: 50%; + min-height: 500px; + background: linear-gradient(45deg, #221334, #6c3049); + float: left; + position: relative; +} +#login_img span{ + position: absolute; + display: block; +} +#login_img .circle{ + width: 200px; + height: 200px; + border-radius: 50%; + background: linear-gradient(45deg, #df5555, #ef907a); + top: 70px; + left: 50%; + margin-left: -100px; + overflow: hidden; +} +#login_img .circle span{ + width: 150px; + height: 40px; + border-radius: 50px; + position: absolute; +} +#login_img .circle span:nth-child(1){ + top: 30px; + left: -38px; + background: #c55c59; +} +#login_img .circle span:nth-child(2){ + bottom: 20px; + right: -35px; + background: #934555; +} +#login_img .star span{ + background: radial-gradient(#fff 10%,#fff 20%,rgba(72, 34, 64, 0)); + border-radius: 50%; + box-shadow: 0 0 7px #fff; +} +#login_img .star span:nth-child(1){ + width: 15px; + height: 15px; + top: 50px; + left: 30px; +} +#login_img .star span:nth-child(2){ + width: 10px; + height: 10px; + left: 360px; + top: 80px; +} +#login_img .star span:nth-child(3){ + width: 5px; + height: 5px; + top: 400px; + left: 80px; +} +#login_img .star span:nth-child(4){ + width: 8px; + height: 8px; + top: 240px; + left: 60px; +} +#login_img .star span:nth-child(5){ + width: 4px; + height: 4px; + top: 20px; + left: 200px; +} +#login_img .star span:nth-child(6){ + width: 4px; + height: 4px; + top: 460px; + left: 410px; +} +#login_img .star span:nth-child(7){ + width: 6px; + height: 6px; + top: 250px; + left: 350px; +} +#login_img .fly_star span{ + width: 90px; + height: 3px; + background: -webkit-linear-gradient(left, rgba(255, 255, 255, 0.67), rgba(255,255,255,0)); + background: -o-linear-gradient(left, rgba(255, 255, 255, 0.67), rgba(255,255,255,0)); + background: linear-gradient(to right, rgba(255, 255, 255, 0.67), rgba(255,255,255,0)); + transform: rotate(-45deg); +} +#login_img .fly_star span:nth-child(1){ + top:60px; + left: 80px; +} +#login_img .fly_star span:nth-child(2){ + top: 210px; + left: 332px; + opacity: 0.6; +} +#login_img p{ + text-align: center; + color: #af4b55; + font-weight: 600; + margin-top: 365px; + font-size: 25px; +} +#login_img p i{ + font-style: normal; + margin-right: 45px; +} +#login_img p i:nth-last-child(1){ + margin-right: 0; +} +/*提示*/ +#hint{ + width: 100%; + line-height: 70px; + background: linear-gradient(-90deg, #9b494d, #bf5853); + text-align: center; + font-size: 25px; + color: #fff; + box-shadow: 0 0 20px #733544; + display: none; + opacity: 0; + transition: .5s; + position: absolute; + top: 0; + z-index: 999; +} +/* 响应式 */ +@media screen and (max-width:1000px ) { + #login_img{ + display: none; + } + #login_wrap{ + width: 490px; + margin-right: -245px; + } + #login{ + width: 100%; + + } +} +@media screen and (max-width:560px ) { + #login_wrap{ + width: 330px; + margin-right: -165px; + } + #login span{ + margin-left: -125px; + } + .form input{ + width: 250px; + } + .btn{ + width: 113px; + } +} +@media screen and (max-width:345px ) { + #login_wrap { + width: 290px; + margin-right: -145px; + } +} \ No newline at end of file diff --git a/Front-end/PhoneLogin/NEOTERICc.ttf b/Front-end/PhoneLogin/NEOTERICc.ttf new file mode 100644 index 0000000..9ec1177 Binary files /dev/null and b/Front-end/PhoneLogin/NEOTERICc.ttf differ diff --git a/Front-end/PhoneLogin/PhoneLogin.html b/Front-end/PhoneLogin/PhoneLogin.html new file mode 100644 index 0000000..9ffbfd0 --- /dev/null +++ b/Front-end/PhoneLogin/PhoneLogin.html @@ -0,0 +1,442 @@ + + + + + + + + + 手机登录 + + + + + +
+
+

登录失败

+
+
+
+
+ + + +
+ +
+

+

+

+ + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + +

CLOUD

+
+
+
+ + + + diff --git a/Front-end/PhoneLogin/main.css b/Front-end/PhoneLogin/main.css new file mode 100644 index 0000000..81f985b --- /dev/null +++ b/Front-end/PhoneLogin/main.css @@ -0,0 +1,274 @@ +*{ + margin: 0; + padding: 0; +} + +html, +body { + height: 100%; +} + +@font-face { + font-family: 'neo'; + src: url("NEOTERICc-1.ttf")/*tpa=http://www.17sucai.com/preview/384665/2018-12-28/login/css/font/NEOTERICc.ttf*/; +} +input:focus{ + outline: none; +} +.form input{ + width: 300px; + height: 30px; + font-size: 18px; + background: none; + border: none; + border-bottom: 1px solid #fff; + color: #fff; + margin-bottom: 20px; +} +.form input::placeholder{ + color: rgba(255,255,255,0.8); + font-size: 18px; + font-family: "neo"; +} +.confirm{ + height: 0; + overflow: hidden; + transition: .25s; +} +.btn{ + width:140px; + height: 40px; + border: 1px solid #fff; + background: none; + font-size:20px; + color: #fff; + cursor: pointer; + margin-top: 25px; + font-family: "neo"; + transition: .25s; +} +.btn:hover{ + background: rgba(255,255,255,.25); +} +#login_wrap{ + width: 980px; + min-height: 500px; + border-radius: 10px; + font-family: "neo"; + overflow: hidden; + box-shadow: 0px 0px 120px rgba(0, 0, 0, 0.25); + position: fixed; + top: 50%; + right: 50%; + margin-top: -250px; + margin-right: -490px; +} +#login{ + width: 50%; + height: 100%; + min-height: 500px; + background: linear-gradient(45deg, #9a444e, #e06267); + position: relative; + float: right; +} +#login #status{ + width: 90px; + height: 35px; + margin: 40px auto; + color: #fff; + font-size: 30px; + font-weight: 600; + position: relative; + overflow: hidden; +} +#login #status i{ + font-style: normal; + position: absolute; + transition: .5s +} +#login span{ + text-align: center; + position: absolute; + left: 50%; + margin-left: -150px; + top: 52%; + margin-top: -140px; +} +#login span a{ + text-decoration: none; + color: #fff; + display: block; + margin-top: 80px; + font-size: 18px; +} +#bg{ + background: linear-gradient(45deg, #211136, #bf5853); + height: 100%; +} +/*绘图*/ +#login_img{ + width: 50%; + min-height: 500px; + background: linear-gradient(45deg, #221334, #6c3049); + float: left; + position: relative; +} +#login_img span{ + position: absolute; + display: block; +} +#login_img .circle{ + width: 200px; + height: 200px; + border-radius: 50%; + background: linear-gradient(45deg, #df5555, #ef907a); + top: 70px; + left: 50%; + margin-left: -100px; + overflow: hidden; +} +#login_img .circle span{ + width: 150px; + height: 40px; + border-radius: 50px; + position: absolute; +} +#login_img .circle span:nth-child(1){ + top: 30px; + left: -38px; + background: #c55c59; +} +#login_img .circle span:nth-child(2){ + bottom: 20px; + right: -35px; + background: #934555; +} +#login_img .star span{ + background: radial-gradient(#fff 10%,#fff 20%,rgba(72, 34, 64, 0)); + border-radius: 50%; + box-shadow: 0 0 7px #fff; +} +#login_img .star span:nth-child(1){ + width: 15px; + height: 15px; + top: 50px; + left: 30px; +} +#login_img .star span:nth-child(2){ + width: 10px; + height: 10px; + left: 360px; + top: 80px; +} +#login_img .star span:nth-child(3){ + width: 5px; + height: 5px; + top: 400px; + left: 80px; +} +#login_img .star span:nth-child(4){ + width: 8px; + height: 8px; + top: 240px; + left: 60px; +} +#login_img .star span:nth-child(5){ + width: 4px; + height: 4px; + top: 20px; + left: 200px; +} +#login_img .star span:nth-child(6){ + width: 4px; + height: 4px; + top: 460px; + left: 410px; +} +#login_img .star span:nth-child(7){ + width: 6px; + height: 6px; + top: 250px; + left: 350px; +} +#login_img .fly_star span{ + width: 90px; + height: 3px; + background: -webkit-linear-gradient(left, rgba(255, 255, 255, 0.67), rgba(255,255,255,0)); + background: -o-linear-gradient(left, rgba(255, 255, 255, 0.67), rgba(255,255,255,0)); + background: linear-gradient(to right, rgba(255, 255, 255, 0.67), rgba(255,255,255,0)); + transform: rotate(-45deg); +} +#login_img .fly_star span:nth-child(1){ + top:60px; + left: 80px; +} +#login_img .fly_star span:nth-child(2){ + top: 210px; + left: 332px; + opacity: 0.6; +} +#login_img p{ + text-align: center; + color: #af4b55; + font-weight: 600; + margin-top: 365px; + font-size: 25px; +} +#login_img p i{ + font-style: normal; + margin-right: 45px; +} +#login_img p i:nth-last-child(1){ + margin-right: 0; +} +/*提示*/ +#hint{ + width: 100%; + line-height: 70px; + background: linear-gradient(-90deg, #9b494d, #bf5853); + text-align: center; + font-size: 25px; + color: #fff; + box-shadow: 0 0 20px #733544; + display: none; + opacity: 0; + transition: .5s; + position: absolute; + top: 0; + z-index: 999; +} +/* 响应式 */ +@media screen and (max-width:1000px ) { + #login_img{ + display: none; + } + #login_wrap{ + width: 490px; + margin-right: -245px; + } + #login{ + width: 100%; + + } +} +@media screen and (max-width:560px ) { + #login_wrap{ + width: 330px; + margin-right: -165px; + } + #login span{ + margin-left: -125px; + } + .form input{ + width: 250px; + } + .btn{ + width: 113px; + } +} +@media screen and (max-width:345px ) { + #login_wrap { + width: 290px; + margin-right: -145px; + } +} \ No newline at end of file diff --git a/demo/src/test/java/com/example/demo/Dao/auditMapper.java b/demo/src/test/java/com/example/demo/Dao/auditMapper.java index 9af18e7..354e466 100644 --- a/demo/src/test/java/com/example/demo/Dao/auditMapper.java +++ b/demo/src/test/java/com/example/demo/Dao/auditMapper.java @@ -12,7 +12,7 @@ import java.util.List; @Mapper public interface auditMapper { @Select("select * from audit where checkNum = #{checkNum}") - public Audit selectAudioByCheckNum(String checkNum); + public Audit selectAudioByCheckNum(int checkNum); @Select("select * from audit") public List select(); @@ -31,5 +31,5 @@ public interface auditMapper { public void updateAudit(Audit audits); @Delete("delete from audit where checkNum=#{checkNum}") - public void deleteAudit(String checkNum); + public void deleteAudit(int checkNum); } diff --git a/demo/src/test/java/com/example/demo/Dao/bankMapper.java b/demo/src/test/java/com/example/demo/Dao/bankMapper.java index 91469e7..2c89c79 100644 --- a/demo/src/test/java/com/example/demo/Dao/bankMapper.java +++ b/demo/src/test/java/com/example/demo/Dao/bankMapper.java @@ -9,7 +9,7 @@ import java.util.List; public interface bankMapper { @Select("select * from bank where bankNum = #{bankNum}") - public Bank selectBankByBankNum(String bankNum); + public Bank selectBankByBankNum(int bankNum); @Select("select * from bank where bankName = #{bankName}") public Bank selectBankByBankName(String bankName); diff --git a/demo/src/test/java/com/example/demo/Dao/productHistroyMapper.java b/demo/src/test/java/com/example/demo/Dao/productHistroyMapper.java new file mode 100644 index 0000000..0f2661f --- /dev/null +++ b/demo/src/test/java/com/example/demo/Dao/productHistroyMapper.java @@ -0,0 +1,31 @@ +package com.example.demo.Dao; + + +import com.example.demo.bean.ProductHistroy; +import org.apache.ibatis.annotations.*; + +import java.util.List; + +@Mapper +public interface productHistroyMapper { + @Select("select * from producthistroy where productNum = #{productNum}") + public ProductHistroy selectAudioByCheckNum(int productNum); + + @Select("select * from producthistroy") + public List select(); + + @Insert("insert into productHistroy(productNum, productName, category, " + + "intrate, bankNum, productDescription, uploadTime, deleteTime, alterTime)" + + " values (#{productNum},#{productName},#{category},#{intrate},#{bankNum}," + + "#{productDescription},#{uploadTime},#{deleteTime},#{alterTime})") + public void addProductHistroy(ProductHistroy productHistroys); + +// @Update("update producthistroy set productNum=#{productNum},productName=#{productName}" + +// ",category=#{category},intrate=#{intrate},bankNum=#{bankNum}," + +// "productDescription=#{productDescription},uploadTime=#{uploadTime},deleteTime=#{deleteTime}," + +// "alterTime=#{alterTime}where productNum=#{productNum}") +// public void updateProductHistroy(ProductHistroy productHistroys); + +// @Delete("delete from producthistroy where productNum=#{productNum}") +// public void deleteProductHistroy(int productNum); +} diff --git a/demo/src/test/java/com/example/demo/Dao/productMapper.java b/demo/src/test/java/com/example/demo/Dao/productMapper.java index 6a5faa8..638b330 100644 --- a/demo/src/test/java/com/example/demo/Dao/productMapper.java +++ b/demo/src/test/java/com/example/demo/Dao/productMapper.java @@ -8,13 +8,10 @@ import java.util.List; @Mapper public interface productMapper { @Select("select * from product where productNum = #{productNum}") - public Product selectProductByProductNum(String productNum); - - @Select("select intrate from product where productNum = #{productNum}") - public Product selectProductIntrateByProductNum(String productNum); + public Product selectProductByProductNum(long productNum); @Select("select * from product where productName = #{productName}") - public Product selectProductByProductName(String productName); + public Product selectProductByProductName(long productName); @Select("select * from product") public List select(); @@ -28,8 +25,8 @@ public interface productMapper { @Update("update product set productNum=#{productNum},productName=#{productName}" + ",category=#{category},intrate=#{intrate},bankNum=#{bankNum}," + "productDescription=#{productDescription},pictureAddress=#{pictureAddress}") - public void updateAudio(Product products); + public void updateProduct(Product products); @Delete("delete from product where productNum=#{productNum}") - public void deleteAudio(String productNum); + public void deleteProduct(int productNum); } diff --git a/demo/src/test/java/com/example/demo/Dao/transMapper.java b/demo/src/test/java/com/example/demo/Dao/transMapper.java new file mode 100644 index 0000000..4aaf7a5 --- /dev/null +++ b/demo/src/test/java/com/example/demo/Dao/transMapper.java @@ -0,0 +1,29 @@ +package com.example.demo.Dao; + +import com.example.demo.bean.Transaction; +import org.apache.ibatis.annotations.*; + +import java.util.List; + +@Mapper +public interface transMapper { + @Select("select * from transaction where transactionNum = #{transactionNum}") + public Transaction selectAudioByCheckNum(int transactionNum); + + @Select("select * from transaction") + public List select(); + + @Insert("insert into transaction(transactionNum, payer, payee," + + " transactionTime, transactionAmount, note)" + + " values (#{transactionNum},#{payer},#{payee},#{transactionTime},#{transactionAmount}," + + "#{note})") + public void addTransaction(Transaction transactions); + + @Update("update audio set transactionNum=#{transactionNum},payer=#{payer}" + + ",payee=#{payee},transactionTime=#{transactionTime},transactionAmount=#{transactionAmount}," + + "note=#{note}") + public void updateTransaction(Transaction transactions); + + @Delete("delete from audio where transactionNum=#{transactionNum}") + public void deleteTransaction(int transactionNum); +} diff --git a/demo/src/test/java/com/example/demo/Dao/transationMapping.java b/demo/src/test/java/com/example/demo/Dao/transationMapping.java deleted file mode 100644 index 67128f7..0000000 --- a/demo/src/test/java/com/example/demo/Dao/transationMapping.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.example.demo.Dao; - -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface transationMapping { - -} \ No newline at end of file diff --git a/demo/src/test/java/com/example/demo/Dao/usageDateMapper.java b/demo/src/test/java/com/example/demo/Dao/usageDateMapper.java new file mode 100644 index 0000000..b4edeb8 --- /dev/null +++ b/demo/src/test/java/com/example/demo/Dao/usageDateMapper.java @@ -0,0 +1,30 @@ +package com.example.demo.Dao; + +import com.example.demo.bean.UsageDate; +import org.apache.ibatis.annotations.*; + +import java.util.List; + + +@Mapper +public interface usageDateMapper { + @Select("select * from usagedate where transactionNum = #{transactionNum}") + public UsageDate selectUsageDateByCheckNum(int checkNum); + + @Select("select * from usagedate") + public List select(); + + @Insert("insert into usagedate(checkNum, productNum, userNum," + + " bankAccount, bankNum, year, amount, startTime)" + + " values (#{checkNum},#{productNum},#{userNum},#{bankAccount},#{bankNum}," + + "#{year},#{amount},#{startTime})") + public void addUsageDate(UsageDate usageDate); + + @Update("update usagedate set checkNum=#{checkNum},productNum=#{productNum}" + + ",userNum=#{userNum},bankAccount=#{bankAccount},bankNum=#{bankNum}," + + "year=#{year},amount=#{amount},startTime=#{startTime}") + public void updateUsageDate(UsageDate usageDate); + + @Delete("delete from usagedate where checkNum=#{checkNum}") + public void deleteUsageDate(int checkNum); +} diff --git a/demo/src/test/java/com/example/demo/Dao/usageDateMapping.java b/demo/src/test/java/com/example/demo/Dao/usageDateMapping.java deleted file mode 100644 index 7867168..0000000 --- a/demo/src/test/java/com/example/demo/Dao/usageDateMapping.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.example.demo.Dao; - -import org.apache.ibatis.annotations.Mapper; -@Mapper -public interface usageDateMapping { - -} diff --git a/demo/src/test/java/com/example/demo/Dao/userBankIdentify.java b/demo/src/test/java/com/example/demo/Dao/userBankIdentify.java new file mode 100644 index 0000000..fabaf77 --- /dev/null +++ b/demo/src/test/java/com/example/demo/Dao/userBankIdentify.java @@ -0,0 +1,26 @@ +package com.example.demo.Dao; + +import com.example.demo.bean.UserBankIdentify; +import org.apache.ibatis.annotations.*; + +import java.util.List; + +@Mapper +public interface userBankIdentify { + @Select("select * from userbankidentify where userName = #{userName}") + public UserBankIdentify selectUsageDateByCheckNum(String userName); + + @Select("select * from userBankIdentify") + public List select(); + + @Insert("insert into usagedate(userName, bankAccount, bankAccountIdentify)" + + " values (#{userName},#{bankAccount},#{bankAccountIdentify})") + public void addUserBankIdentify(UserBankIdentify userBankIdentifys); + + @Update("update usagedate set userName=#{userName},bankAccount=#{bankAccount}" + + ",bankAccountIdentify=#{bankAccountIdentify}") + public void updateUserBankIdentify(UserBankIdentify userBankIdentifys); + + @Delete("delete from usagedate where userName=#{userName}") + public void deleteUserBankIdentify(String userName); +} diff --git a/demo/src/test/java/com/example/demo/Dao/userMapper.java b/demo/src/test/java/com/example/demo/Dao/userMapper.java index f16e7a3..0399e77 100644 --- a/demo/src/test/java/com/example/demo/Dao/userMapper.java +++ b/demo/src/test/java/com/example/demo/Dao/userMapper.java @@ -8,7 +8,7 @@ import java.util.List; @Mapper public interface userMapper { @Select("select * from user where userNum = #{userNum}") - public User selectUserByuserNum(String userNum); + public User selectUserByuserNum(int userNum); @Select("select * from user") public List select(); @@ -26,5 +26,5 @@ public interface userMapper { public void updateUser(User users); @Delete("delete from user where userNum=#{userNum}") - public void deleteUser(String userNum); + public void deleteUser(int userNum); } diff --git a/demo/src/test/java/com/example/demo/bean/Audit.java b/demo/src/test/java/com/example/demo/bean/Audit.java index a9035e7..a6d1085 100644 --- a/demo/src/test/java/com/example/demo/bean/Audit.java +++ b/demo/src/test/java/com/example/demo/bean/Audit.java @@ -1,103 +1,28 @@ package com.example.demo.bean; -import javax.persistence.*; +import lombok.Getter; +import lombok.Setter; +import javax.persistence.*; +@Getter +@Setter @Entity public class Audit { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - private String checkNum; - private String userNum; - private float amount; + private int checkNum; + private int userNum; + private double amount; private String applyTime; private String bankAccount; private int checkState; - private String contractNum; + private int contractNum; private short isSignContract; - private String productNum; + private int productNum; private int year; + private int equation; public Audit(){}; - - public int getYear() { - return year; - } - - public void setYear(int year) { - this.year = year; - } - - public String getProductNum() { - return productNum; - } - - public void setProductNum(String productNum) { - this.productNum = productNum; - } - - public short getIsSignContract() { - return isSignContract; - } - - public void setIsSignContract(short isSignContract) { - this.isSignContract = isSignContract; - } - - public String getContractNum() { - return contractNum; - } - - public void setContractNum(String contractNum) { - this.contractNum = contractNum; - } - - public int getCheckState() { - return checkState; - } - - public void setCheckState(int checkState) { - this.checkState = checkState; - } - - public String getCheckNum() { - return checkNum; - } - - public void setCheckNum(String checkNum) { - this.checkNum = checkNum; - } - - public float getAmount() { - return amount; - } - - public void setAmount(float amount) { - this.amount = amount; - } - - public String getBankAccount() { - return bankAccount; - } - - public void setBankAccount(String bankAccount) { - this.bankAccount = bankAccount; - } - - public String getApplyTime() { - return applyTime; - } - - public void setApplyTime(String applyTime) { - this.applyTime = applyTime; - } - - public String getUserNum() { - return userNum; - } - - public void setUserNum(String userNum) { - this.userNum = userNum; - } } diff --git a/demo/src/test/java/com/example/demo/bean/Bank.java b/demo/src/test/java/com/example/demo/bean/Bank.java index 51b1b10..5db2090 100644 --- a/demo/src/test/java/com/example/demo/bean/Bank.java +++ b/demo/src/test/java/com/example/demo/bean/Bank.java @@ -1,37 +1,18 @@ package com.example.demo.bean; +import lombok.Getter; +import lombok.Setter; + import javax.persistence.*; +@Getter +@Setter @Entity public class Bank { - private String bankNum; + private int bankNum; private String bankName; private String contact;//联系方式 public Bank(){}; - - public String getBankNum() { - return bankNum; - } - - public void setBankNum(String bankNum) { - this.bankNum = bankNum; - } - - public String getContact() { - return contact; - } - - public void setContact(String contact) { - this.contact = contact; - } - - public String getBankName() { - return bankName; - } - - public void setBankName(String bankName) { - this.bankName = bankName; - } } diff --git a/demo/src/test/java/com/example/demo/bean/Manager.java b/demo/src/test/java/com/example/demo/bean/Manager.java index 2d84b3b..83f7476 100644 --- a/demo/src/test/java/com/example/demo/bean/Manager.java +++ b/demo/src/test/java/com/example/demo/bean/Manager.java @@ -1,15 +1,20 @@ package com.example.demo.bean; +import lombok.Getter; +import lombok.Setter; + import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; +@Getter +@Setter @Entity public class Manager { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - private String managerNum; + private int managerNum; private String managerName; private String managerPwd; private String managerRight; @@ -17,43 +22,11 @@ public class Manager { public Manager(){}; - public String getTelephoneNum() { - return telephoneNum; - } - - public void setTelephoneNum(String telephoneNum) { - this.telephoneNum = telephoneNum; - } - - public String getManagerRight() { - return managerRight; - } - - public void setManagerRight(String managerRight) { - this.managerRight = managerRight; - } - - public String getManagerPwd() { - return managerPwd; - } - - public void setManagerPwd(String managerPwd) { - this.managerPwd = managerPwd; - } - - public String getManagerName() { - return managerName; - } - - public void setManagerName(String managerName) { - this.managerName = managerName; - } - - public String getManagerNum() { + public int getManagerNum() { return managerNum; } - public void setManagerNum(String managerNum) { + public void setManagerNum(int managerNum) { this.managerNum = managerNum; } } diff --git a/demo/src/test/java/com/example/demo/bean/Product.java b/demo/src/test/java/com/example/demo/bean/Product.java index 4f74c16..754ac93 100644 --- a/demo/src/test/java/com/example/demo/bean/Product.java +++ b/demo/src/test/java/com/example/demo/bean/Product.java @@ -1,24 +1,41 @@ package com.example.demo.bean; +import lombok.Getter; +import lombok.Setter; + import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; +@Getter +@Setter @Entity public class Product { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - private String productNum; + private int productNum; private String productName; private String category; private float intrate; - private String bankNum; + private int bankNum; private String productDescription; private String pictureAddress; public Product(){}; + public String getProductName() { + return productName; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + public String getPictureAddress() { return pictureAddress; } @@ -35,11 +52,11 @@ public class Product { this.productDescription = productDescription; } - public String getBankNum() { + public int getBankNum() { return bankNum; } - public void setBankNum(String bankNum) { + public void setBankNum(int bankNum) { this.bankNum = bankNum; } @@ -51,27 +68,15 @@ public class Product { this.intrate = intrate; } - public String getCategory() { - return category; - } - - public void setCategory(String category) { - this.category = category; - } - - public String getProductName() { - return productName; + public int getProductNum() { + return productNum; } public void setProductName(String productName) { this.productName = productName; } - public String getProductNum() { - return productNum; - } - - public void setProductNum(String productNum) { + public void setProductNum(int productNum) { this.productNum = productNum; } } diff --git a/demo/src/test/java/com/example/demo/bean/ProductHistroy.java b/demo/src/test/java/com/example/demo/bean/ProductHistroy.java new file mode 100644 index 0000000..95c1f24 --- /dev/null +++ b/demo/src/test/java/com/example/demo/bean/ProductHistroy.java @@ -0,0 +1,110 @@ +package com.example.demo.bean; + + +import lombok.Getter; +import lombok.Setter; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +@Entity +@Getter +@Setter +public class ProductHistroy { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int productNum; + private int bankNum; + private int managerNum; + private String productName; + private String category; + private float intrate; + private String productDescription; + private String upLoadTime; + private String deleteTime; + private String alterTime; + + public ProductHistroy(){}; + + public int getManagerNum() { + return managerNum; + } + + public void setManagerNum(int managerNum) { + this.managerNum = managerNum; + } + + public int getProductNum() { + return productNum; + } + + public void setProductNum(int productNum) { + this.productNum = productNum; + } + + public String getAlterTime() { + return alterTime; + } + + public void setAlterTime(String alterTime) { + this.alterTime = alterTime; + } + + public String getDeleteTime() { + return deleteTime; + } + + public void setDeleteTime(String deleteTime) { + this.deleteTime = deleteTime; + } + + public String getUpLoadTime() { + return upLoadTime; + } + + public void setUpLoadTime(String upLoadTime) { + this.upLoadTime = upLoadTime; + } + + public String getProductDescription() { + return productDescription; + } + + public void setProductDescription(String productDescription) { + this.productDescription = productDescription; + } + + public float getIntrate() { + return intrate; + } + + public void setIntrate(float intrate) { + this.intrate = intrate; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public int getBankNum() { + return bankNum; + } + + public void setBankNum(int bankNum) { + this.bankNum = bankNum; + } +} diff --git a/demo/src/test/java/com/example/demo/bean/Transaction.java b/demo/src/test/java/com/example/demo/bean/Transaction.java index c3bb192..c6291cf 100644 --- a/demo/src/test/java/com/example/demo/bean/Transaction.java +++ b/demo/src/test/java/com/example/demo/bean/Transaction.java @@ -1,15 +1,20 @@ package com.example.demo.bean; +import lombok.Getter; +import lombok.Setter; + import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; +@Getter +@Setter @Entity public class Transaction { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - private String transaction; + private int transactionNum; private String payer; private String payee; private float transactionTime; @@ -17,52 +22,4 @@ public class Transaction { private String note; public Transaction(){}; - - public String getNote() { - return note; - } - - public void setNote(String note) { - this.note = note; - } - - public float getTransactionAmount() { - return transactionAmount; - } - - public void setTransactionAmount(float transactionAmount) { - this.transactionAmount = transactionAmount; - } - - public float getTransactionTime() { - return transactionTime; - } - - public void setTransactionTime(float transactionTime) { - this.transactionTime = transactionTime; - } - - public String getPayee() { - return payee; - } - - public void setPayee(String payee) { - this.payee = payee; - } - - public String getPayer() { - return payer; - } - - public void setPayer(String payer) { - this.payer = payer; - } - - public String getTransaction() { - return transaction; - } - - public void setTransaction(String transaction) { - this.transaction = transaction; - } } diff --git a/demo/src/test/java/com/example/demo/bean/UsageDate.java b/demo/src/test/java/com/example/demo/bean/UsageDate.java index 0b6d9a3..76d44c2 100644 --- a/demo/src/test/java/com/example/demo/bean/UsageDate.java +++ b/demo/src/test/java/com/example/demo/bean/UsageDate.java @@ -7,12 +7,15 @@ import javax.persistence.Entity; @Getter @Entity public class UsageDate { - private String checkNum; - private String productNum; - private String userNum; + private long checkNum; + private long productNum; + private long userNum; private String bankAccount; - private String bankNum; + private int bankNum; private int year; private float amount; private String startTime; + + public UsageDate(){}; + private int equation; } diff --git a/demo/src/test/java/com/example/demo/bean/User.java b/demo/src/test/java/com/example/demo/bean/User.java index 6cabcb9..964c3a6 100644 --- a/demo/src/test/java/com/example/demo/bean/User.java +++ b/demo/src/test/java/com/example/demo/bean/User.java @@ -1,15 +1,20 @@ package com.example.demo.bean; +import lombok.Getter; +import lombok.Setter; + import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; +@Getter +@Setter @Entity public class User { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - private String userNum; + private int userNum; private String userName; private String userPwd; private String userRight; @@ -21,84 +26,4 @@ public class User { private String registerTime; public User(){}; - - public String getRegisterTime() { - return registerTime; - } - - public void setRegisterTime(String registerTime) { - this.registerTime = registerTime; - } - - public int getIsIdentify() { - return isIdentify; - } - - public void setIsIdentify(int isIdentify) { - this.isIdentify = isIdentify; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getTelephoneNum() { - return telephoneNum; - } - - public void setTelephoneNum(String telephoneNum) { - this.telephoneNum = telephoneNum; - } - - public String getIdNum() { - return idNum; - } - - public void setIdNum(String idNum) { - this.idNum = idNum; - } - - public String getTrueName() { - return trueName; - } - - public void setTrueName(String trueName) { - this.trueName = trueName; - } - - public String getUserRight() { - return userRight; - } - - public void setUserRight(String userRight) { - this.userRight = userRight; - } - - public String getUserPwd() { - return userPwd; - } - - public void setUserPwd(String userPwd) { - this.userPwd = userPwd; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getUserNum() { - return userNum; - } - - public void setUserNum(String userNum) { - this.userNum = userNum; - } } diff --git a/demo/src/test/java/com/example/demo/bean/UserBankIdentify.java b/demo/src/test/java/com/example/demo/bean/UserBankIdentify.java index 84ef770..f4bff53 100644 --- a/demo/src/test/java/com/example/demo/bean/UserBankIdentify.java +++ b/demo/src/test/java/com/example/demo/bean/UserBankIdentify.java @@ -7,7 +7,7 @@ import javax.persistence.Entity; @Getter @Entity public class UserBankIdentify { - private String userNum; + private String userName; private String bankAccount; private short bankAccountIdentify; } diff --git a/demo/src/test/java/com/example/demo/circulator/service/CirService.java b/demo/src/test/java/com/example/demo/circulator/service/CirService.java new file mode 100644 index 0000000..c3be9ef --- /dev/null +++ b/demo/src/test/java/com/example/demo/circulator/service/CirService.java @@ -0,0 +1,16 @@ +package com.example.demo.circulator.service; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.PostConstruct; + +public abstract class CirService { + @PostConstruct + public void init(){} + + @Transactional //数据库与事物的一致性 + public double NextCirculator(long checkNum){return 0;} + public double SumCirculator(long productNum,double amount,int year){return 0;} + +} diff --git a/demo/src/test/java/com/example/demo/circulator/service/CirculatorService.java b/demo/src/test/java/com/example/demo/circulator/service/CirculatorService.java deleted file mode 100644 index 03eabe9..0000000 --- a/demo/src/test/java/com/example/demo/circulator/service/CirculatorService.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.example.demo.circulator.service; - -import com.example.demo.Dao.auditMapper; -import com.example.demo.Dao.productMapper; -import com.example.demo.bean.Product; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.PostConstruct; - -public class CirculatorService { - @Autowired - private productMapper productMapper; - private auditMapper auditMapper; - - @PostConstruct - public void init(){} - - @Transactional //数据库与事物的一致性 - public double countSumCirculator(String userNum,String productNum,float amount,int year){ - Product product = productMapper.selectProductIntrateByProductNum(productNum); - float intrate = product.getIntrate(); - return intrate; - } -} diff --git a/demo/src/test/java/com/example/demo/circulator/service/EPAIR_CirService.java b/demo/src/test/java/com/example/demo/circulator/service/EPAIR_CirService.java new file mode 100644 index 0000000..e93758b --- /dev/null +++ b/demo/src/test/java/com/example/demo/circulator/service/EPAIR_CirService.java @@ -0,0 +1,40 @@ +package com.example.demo.circulator.service; + +import com.example.demo.Dao.productMapper; +import com.example.demo.Dao.usageDateMapper; +import com.example.demo.bean.Product; +import com.example.demo.bean.UsageDate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.PostConstruct; + +public class EPAIR_CirService extends CirService{ + @Autowired + private usageDateMapper usageDateMapper; + private productMapper productMapper; + + @Transactional //数据库与事物的一致性 + public double NextCirculator(long checkNum){ + UsageDate usageDate = usageDateMapper.selectUsageDateByCheckNum(checkNum); + int year = usageDate.getYear(); + double amount = usageDate.getAmount(); + long productNum = usageDate.getProductNum(); + + Product product = productMapper.selectProductByProductNum(productNum); + float intrate = product.getIntrate(); + intrate /= 12; + int month = year*12; + double rep = Math.pow((1+intrate),month)/(Math.pow((1+intrate),month)-1); + double next_principal_and_interest = rep * intrate * amount; + return next_principal_and_interest; + } + + public double SumCirculator(long productNum,double amount,int year){ + Product product = productMapper.selectProductByProductNum(productNum); + float intrate = product.getIntrate(); + double rep = Math.pow((1+intrate),year)/(Math.pow((1+intrate),year)-1); + double principal_and_interest = rep * intrate * amount * year; + return principal_and_interest; + } +} diff --git a/demo/src/test/java/com/example/demo/circulator/service/EPR_CirService.java b/demo/src/test/java/com/example/demo/circulator/service/EPR_CirService.java new file mode 100644 index 0000000..e47223e --- /dev/null +++ b/demo/src/test/java/com/example/demo/circulator/service/EPR_CirService.java @@ -0,0 +1,43 @@ +package com.example.demo.circulator.service; + +import com.example.demo.Dao.productMapper; +import com.example.demo.Dao.usageDateMapper; +import com.example.demo.bean.Product; +import com.example.demo.bean.UsageDate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.PostConstruct; + +public class EPR_CirService extends CirService{ + @Autowired + private usageDateMapper usageDateMapper; + private productMapper productMapper; + + @Transactional //数据库与事物的一致性 + public double NextCirculator(long checkNum){ + UsageDate usageDate = usageDateMapper.selectUsageDateByCheckNum(checkNum); + int year = usageDate.getYear(); + double amount = usageDate.getAmount(); + long productNum = usageDate.getProductNum(); + + Product product = productMapper.selectProductByProductNum(productNum); + float intrate = product.getIntrate(); + double rep_amount = 0; + intrate /= 12; + int month = year*12; + double next_principal_and_interest = amount/month + (amount - rep_amount) * intrate; + return next_principal_and_interest; + } + + public double SumCirculator(long productNum,double amount,int year){ + Product product = productMapper.selectProductByProductNum(productNum); + float intrate = product.getIntrate(); + intrate /= 12; + int month = year * 12; + double first_principal_and_interest = amount/month + amount*intrate; + double last_principal_and_interest = amount/month + amount*(1-(month-1)/month)*intrate; + double principal_and_interest = (first_principal_and_interest + last_principal_and_interest)*month/2; + return principal_and_interest; + } +} diff --git a/demo/src/test/java/com/example/demo/circulator/service/controller/NextCirController.java b/demo/src/test/java/com/example/demo/circulator/service/controller/NextCirController.java new file mode 100644 index 0000000..7b1e666 --- /dev/null +++ b/demo/src/test/java/com/example/demo/circulator/service/controller/NextCirController.java @@ -0,0 +1,36 @@ +package com.example.demo.circulator.service.controller; + +import com.example.demo.circulator.service.CirService; +import com.example.demo.circulator.service.EPAIR_CirService; +import com.example.demo.circulator.service.EPR_CirService; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@Controller +public class NextCirController { + //@Autowired + private CirService cirService; + + @GetMapping("/cir/next") + public String nextCirculator(HttpServletRequest request,HttpServletResponse response){ + long checkNum = (Long)request.getAttribute("checkNum"); + int equation = (Integer)request.getAttribute("equation"); + switch (equation){ + case 1: + cirService = new EPAIR_CirService(); + break; + case 2: + cirService = new EPR_CirService(); + break; + default: + System.out.println("not exit!!"); + break; + } + double next_principal_and_intrate = cirService.NextCirculator(checkNum); + request.setAttribute("next",next_principal_and_intrate); + return "/next"; + } +} diff --git a/demo/src/test/java/com/example/demo/circulator/service/controller/SumCirController.java b/demo/src/test/java/com/example/demo/circulator/service/controller/SumCirController.java new file mode 100644 index 0000000..9b445ce --- /dev/null +++ b/demo/src/test/java/com/example/demo/circulator/service/controller/SumCirController.java @@ -0,0 +1,39 @@ +package com.example.demo.circulator.service.controller; + +import com.example.demo.circulator.service.CirService; +import com.example.demo.circulator.service.EPAIR_CirService; +import com.example.demo.circulator.service.EPR_CirService; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@Controller +public class SumCirController { + //@Autowired + private CirService cirService; + + @GetMapping("/cir/sum") + public String SumCirculator(HttpServletRequest request, HttpServletResponse response){ + long productNum = Long.parseLong(request.getParameter("productNum")); + double amount = Double.parseDouble(request.getParameter("amount")); + int year = Integer.parseInt(request.getParameter("year")); + int equation = Integer.parseInt(request.getParameter("equation")); + + switch (equation){ + case 1: + cirService = new EPAIR_CirService(); + break; + case 2: + cirService = new EPR_CirService(); + break; + default: + System.out.println("not exit!!"); + break; + } + double sum_principal_and_intrate = cirService.SumCirculator(productNum,amount,year); + request.setAttribute("sum",sum_principal_and_intrate); + return "/circulator"; + } +} diff --git a/demo/src/test/java/com/example/demo/circulator/service/controller/SumCirculatorController.java b/demo/src/test/java/com/example/demo/circulator/service/controller/SumCirculatorController.java deleted file mode 100644 index 13d4485..0000000 --- a/demo/src/test/java/com/example/demo/circulator/service/controller/SumCirculatorController.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.example.demo.circulator.service.controller; - -public class SumCirculatorController { -} diff --git a/demo/src/test/java/com/example/demo/productService/controller/addController.java b/demo/src/test/java/com/example/demo/productService/controller/addController.java new file mode 100644 index 0000000..5536160 --- /dev/null +++ b/demo/src/test/java/com/example/demo/productService/controller/addController.java @@ -0,0 +1,46 @@ +package com.example.demo.productService.controller; + +import com.example.demo.bean.Product; +import com.example.demo.productService.tools.addPro; +import org.springframework.web.bind.annotation.RequestMapping; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.PrintWriter; +import org.springframework.stereotype.Controller; + +@Controller +public class addController extends HttpServlet { + Product product; + addPro addPro; + @RequestMapping("/addproduct") + public String doPost(HttpServletResponse response,HttpServletRequest request){ + PrintWriter writer=null; + try{ + product.setProductNum(Integer.parseInt(request.getParameter("productNum"))); + product.setProductName(request.getParameter("productName")); + product.setBankNum(Integer.parseInt(request.getParameter("bankNum"))); + product.setCategory(request.getParameter("productName")); + product.setIntrate(Integer.parseInt(request.getParameter("intrate"))); + product.setProductDescription(request.getParameter("description")); + product.setPictureAddress(request.getParameter("address")); + int result= addPro.add(product); + response.setContentType("text/hmtl;charset=utf-8"); + writer=response.getWriter(); + if(result==1){ + writer.write("增加成功"); + return "/";//返回增加删除修改的总页面 + } + writer.write("增加失败"); + return "/";//返回增加的页面 + }catch(Exception e){ + e.printStackTrace(); + }finally { + if(writer!=null){ + writer.close(); + } + } + return "页面出错"; + } + +} diff --git a/demo/src/test/java/com/example/demo/productService/controller/deleteController.java b/demo/src/test/java/com/example/demo/productService/controller/deleteController.java new file mode 100644 index 0000000..cdd6510 --- /dev/null +++ b/demo/src/test/java/com/example/demo/productService/controller/deleteController.java @@ -0,0 +1,40 @@ +package com.example.demo.productService.controller; + + +import com.example.demo.bean.Product; +import com.example.demo.productService.tools.deletePro; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.PrintWriter; + +@Controller +public class deleteController { + Product product; + deletePro deletes; + @RequestMapping("/deleteproduct") + public String doPost(HttpServletResponse response, HttpServletRequest request){ + PrintWriter writer=null; + try{ + int productNum=Integer.parseInt(request.getParameter("productNum")); + int result= deletes.delete(productNum); + response.setContentType("text/hmtl;charset=utf-8"); + writer=response.getWriter(); + if(result==1){ + writer.write("删除成功"); + return "/";//返回增加删除修改的总页面 + } + writer.write("删除失败"); + return "/";//返回删除的页面 + }catch(Exception e){ + e.printStackTrace(); + }finally { + if(writer!=null){ + writer.close(); + } + } + return "页面出错"; + } +} diff --git a/demo/src/test/java/com/example/demo/productService/controller/updateController.java b/demo/src/test/java/com/example/demo/productService/controller/updateController.java new file mode 100644 index 0000000..56ca6f8 --- /dev/null +++ b/demo/src/test/java/com/example/demo/productService/controller/updateController.java @@ -0,0 +1,46 @@ +package com.example.demo.productService.controller; + +import com.example.demo.bean.Product; +import com.example.demo.productService.tools.updatePro; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.PrintWriter; + +@Controller +public class updateController { + Product product; + updatePro updatePro; + @RequestMapping("/updateproduct") + public String doPost(HttpServletResponse response, HttpServletRequest request){ + PrintWriter writer=null; + try{ + product.setProductNum(Integer.parseInt(request.getParameter("productNum"))); + product.setProductName(request.getParameter("productName")); + product.setBankNum(Integer.parseInt(request.getParameter("bankNum"))); + product.setCategory(request.getParameter("productName")); + product.setIntrate(Integer.parseInt(request.getParameter("intrate"))); + product.setProductDescription(request.getParameter("description")); + product.setPictureAddress(request.getParameter("address")); + int result= updatePro.update(product); + response.setContentType("text/hmtl;charset=utf-8"); + writer=response.getWriter(); + if(result==1){ + writer.write("修改成功"); + return "/";//返回增加删除修改的总页面 + } + writer.write("修改失败"); + return "/";//返回修改的页面 + }catch(Exception e){ + e.printStackTrace(); + }finally { + if(writer!=null){ + writer.close(); + } + } + return "页面出错"; + } + +} diff --git a/demo/src/test/java/com/example/demo/productService/tools/addPro.java b/demo/src/test/java/com/example/demo/productService/tools/addPro.java new file mode 100644 index 0000000..3d60f75 --- /dev/null +++ b/demo/src/test/java/com/example/demo/productService/tools/addPro.java @@ -0,0 +1,27 @@ +package com.example.demo.productService.tools; + +import com.example.demo.Dao.productHistroyMapper; +import com.example.demo.Dao.productMapper; +import com.example.demo.bean.Product; +import com.example.demo.bean.ProductHistroy; + +public class addPro { + private com.example.demo.productService.tools.nowTime nowTime; + private productMapper productMapper; + private productHistroyMapper proHisMapper; + private ProductHistroy productHistroy; + + public int add(Product product1){ + productMapper.addProduct(product1); + productHistroy.setProductNum(product1.getProductNum()); + productHistroy.setProductName(product1.getProductName()); + productHistroy.setBankNum(product1.getBankNum()); + productHistroy.setCategory(product1.getCategory()); + productHistroy.setIntrate(product1.getIntrate()); + //productHistroy.setManagerNum(); manager.setManagerNum();调用登陆里面的一个接口得到managerNum + productHistroy.setProductDescription(product1.getProductDescription()); + productHistroy.setUpLoadTime(nowTime.nowTime()); + proHisMapper.addProductHistroy(productHistroy); + return 1; + } +} diff --git a/demo/src/test/java/com/example/demo/productService/tools/deletePro.java b/demo/src/test/java/com/example/demo/productService/tools/deletePro.java new file mode 100644 index 0000000..886e14c --- /dev/null +++ b/demo/src/test/java/com/example/demo/productService/tools/deletePro.java @@ -0,0 +1,21 @@ +package com.example.demo.productService.tools; + +import com.example.demo.Dao.productHistroyMapper; +import com.example.demo.bean.Product; +import com.example.demo.bean.ProductHistroy; + +public class deletePro { + private com.example.demo.productService.tools.nowTime nowTime; + private com.example.demo.Dao.productMapper productMapper; + private productHistroyMapper proHisMapper; + private ProductHistroy productHistroy; + + public int delete(int productNum){ + productMapper.deleteProduct(productNum); + productHistroy.setProductNum(productNum); + //productHistroy.setManagerNum(); manager.setManagerNum();调用登陆里面的一个接口得到managerNum + productHistroy.setUpLoadTime(nowTime.nowTime()); + proHisMapper.addProductHistroy(productHistroy); + return 1; + } +} diff --git a/demo/src/test/java/com/example/demo/productService/tools/nowTime.java b/demo/src/test/java/com/example/demo/productService/tools/nowTime.java new file mode 100644 index 0000000..92065f9 --- /dev/null +++ b/demo/src/test/java/com/example/demo/productService/tools/nowTime.java @@ -0,0 +1,14 @@ +package com.example.demo.productService.tools; + + +import java.util.Date; +import java.text.SimpleDateFormat; + + +public class nowTime{ + public String nowTime(){ + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式 + String time=(String)df.format(new Date()); + return time; + } +} diff --git a/demo/src/test/java/com/example/demo/productService/tools/updatePro.java b/demo/src/test/java/com/example/demo/productService/tools/updatePro.java new file mode 100644 index 0000000..fe43ceb --- /dev/null +++ b/demo/src/test/java/com/example/demo/productService/tools/updatePro.java @@ -0,0 +1,27 @@ +package com.example.demo.productService.tools; + +import com.example.demo.Dao.productHistroyMapper; +import com.example.demo.Dao.productMapper; +import com.example.demo.bean.Product; +import com.example.demo.bean.ProductHistroy; + +public class updatePro { + private com.example.demo.productService.tools.nowTime nowTime; + private productMapper productMapper; + private productHistroyMapper proHisMapper; + private ProductHistroy productHistroy; + + public int update(Product product1){ + productMapper.updateProduct(product1); + productHistroy.setProductNum(product1.getProductNum()); + productHistroy.setProductName(product1.getProductName()); + productHistroy.setBankNum(product1.getBankNum()); + productHistroy.setCategory(product1.getCategory()); + productHistroy.setIntrate(product1.getIntrate()); + //productHistroy.setManagerNum(); manager.setManagerNum();调用登陆里面的一个接口得到managerNum + productHistroy.setProductDescription(product1.getProductDescription()); + productHistroy.setAlterTime(nowTime.nowTime()); + proHisMapper.addProductHistroy(productHistroy); + return 1; + } +}