parent
410472fa96
commit
6155267158
@ -1,31 +0,0 @@
|
|||||||
package com.example.demo.Dao;
|
|
||||||
|
|
||||||
import com.example.demo.bean.Audit;
|
|
||||||
import org.apache.ibatis.annotations.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface auditMapper {
|
|
||||||
@Select("select * from audit where checkNum = #{checkNum}")
|
|
||||||
public Audit selectAudioByCheckNum(long checkNum);
|
|
||||||
|
|
||||||
@Select("select * from audit")
|
|
||||||
public List<Audit> select();
|
|
||||||
|
|
||||||
@Insert("insert into audit(checkNum, userNum, productNum, " +
|
|
||||||
"bankAccount, checkState, contractNum, " +
|
|
||||||
"isSignContract, year, amount, applyTime)" +
|
|
||||||
" values (#{checkNum},#{userNum},#{productNum},#{bankAccount},#{checkState}," +
|
|
||||||
"#{contractNum},#{isSignContract},#{year},#{amount},#{applyTime})")
|
|
||||||
public void addAudit(Audit audits);
|
|
||||||
|
|
||||||
@Update("update audit set checkNum=#{checkNum},userNum=#{userNum}" +
|
|
||||||
",productNum=#{productNum},checkState=#{checkState},contractNum=#{contractNum}," +
|
|
||||||
"isSignContract=#{isSignContract},year=#{year},amount=#{amount}," +
|
|
||||||
"applyTime=#{applyTime}where checkNum=#{checkNum}")
|
|
||||||
public void updateAudit(Audit audits);
|
|
||||||
|
|
||||||
@Delete("delete from audit where checkNum=#{checkNum}")
|
|
||||||
public void deleteAudit(long checkNum);
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
package com.example.demo.Dao;
|
|
||||||
|
|
||||||
import com.example.demo.bean.Bank;
|
|
||||||
import org.apache.ibatis.annotations.Insert;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
import org.apache.ibatis.annotations.Update;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface bankMapper {
|
|
||||||
|
|
||||||
@Select("select * from bank where bankNum = #{bankNum}")
|
|
||||||
public Bank selectBankByBankNum(int bankNum);
|
|
||||||
|
|
||||||
@Select("select * from bank where bankName = #{bankName}")
|
|
||||||
public Bank selectBankByBankName(String bankName);
|
|
||||||
|
|
||||||
@Select("select * from bank")
|
|
||||||
public List<Bank> select();
|
|
||||||
|
|
||||||
@Insert("insert into bank(bankNum, bankName, contact, " +
|
|
||||||
" values (#{bankNum},#{bankName},#{contact},)")
|
|
||||||
public void addBank(Bank banks);
|
|
||||||
|
|
||||||
@Update("update bank set bankNum=#{bankNum},bankName=#{bankName}" +
|
|
||||||
",contact=#{contact} where bankNum=#{bankNum}")
|
|
||||||
public void updateBank(Bank banks);
|
|
||||||
|
|
||||||
// @Delete("delete from bank where bankNum=#{bankNum}")
|
|
||||||
// public void deleteBank(String bankNum);
|
|
||||||
//
|
|
||||||
// @Delete("delete from bank where bankName=#{bankName}")
|
|
||||||
// public void deleteBanks(String bankName);
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
package com.example.demo.Dao;
|
|
||||||
|
|
||||||
import com.example.demo.bean.Manager;
|
|
||||||
import org.apache.ibatis.annotations.Insert;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
import org.apache.ibatis.annotations.Update;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface managerMapper {
|
|
||||||
@Select("select * from manager where managerNum = #{managerName}")
|
|
||||||
public Manager selectManagerByManagerName(String managerName);
|
|
||||||
|
|
||||||
@Insert("insert into manager(managerNum, managerName, managerPwd, " +
|
|
||||||
"managerRight, telephoneNum) values (#{managerNum},#{managerName}," +
|
|
||||||
"#{managerPwd},#{managerRight},#{telephoneNum})")
|
|
||||||
public void addManager(Manager managers);
|
|
||||||
|
|
||||||
@Update("update manager set managerNum=#{managerNum},managerName=#{managerName}" +
|
|
||||||
",managerPwd=#{managerPwd},managerRight=#{managerRight},telephoneNum=#{telephoneNum},")
|
|
||||||
public void updateManager(Manager managers);
|
|
||||||
|
|
||||||
// @Delete("delete from manager where managerNum=#{managerNum}")
|
|
||||||
// public void deleteManager(String managerNum);
|
|
||||||
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package com.example.demo.Dao;
|
|
||||||
|
|
||||||
import com.example.demo.bean.Repayment;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
import org.apache.ibatis.annotations.Update;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface paymentMapper {
|
|
||||||
@Select("select * from repayment where checkNum =#{checkNum}")
|
|
||||||
public Repayment selectPepaymentBycheckNum(long checkNum);
|
|
||||||
|
|
||||||
@Update("update repayment set repAmount = {#repAmount} ,repSum = {#repSum} where checkNum = #{checkNum}")
|
|
||||||
public void updateRepayment(Repayment repayment);
|
|
||||||
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
package com.example.demo.Dao;
|
|
||||||
|
|
||||||
|
|
||||||
import com.example.demo.bean.ProductHistroy;
|
|
||||||
import org.apache.ibatis.annotations.Insert;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface productHistroyMapper {
|
|
||||||
@Select("select * from producthistroy where productNum = #{productNum}")
|
|
||||||
public ProductHistroy selectAudioByCheckNum(long productNum);
|
|
||||||
|
|
||||||
@Select("select * from producthistroy")
|
|
||||||
public List<ProductHistroy> 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);
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
package com.example.demo.Dao;
|
|
||||||
|
|
||||||
import com.example.demo.bean.Product;
|
|
||||||
import org.apache.ibatis.annotations.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface productMapper {
|
|
||||||
@Select("select * from product where productNum = #{productNum}")
|
|
||||||
public Product selectProductByProductNum(long productNum);
|
|
||||||
|
|
||||||
@Select("select * from product where productName = #{productName}")
|
|
||||||
public Product selectProductByProductName(long productName);
|
|
||||||
|
|
||||||
@Select("select * from product")
|
|
||||||
public List<Product> select();
|
|
||||||
|
|
||||||
@Insert("insert into product(productNum, productName, category, intrate, " +
|
|
||||||
"bankNum, productDescription, pictureAddress)" +
|
|
||||||
" values (#{productNum},#{productName},#{category},#{intrate},#{bankNum}," +
|
|
||||||
"#{productDescription},#{pictureAddress})")
|
|
||||||
public void addProduct(Product products);
|
|
||||||
|
|
||||||
@Update("update product set productNum=#{productNum},productName=#{productName}" +
|
|
||||||
",category=#{category},intrate=#{intrate},bankNum=#{bankNum}," +
|
|
||||||
"productDescription=#{productDescription},pictureAddress=#{pictureAddress}")
|
|
||||||
public void updateProduct(Product products);
|
|
||||||
|
|
||||||
|
|
||||||
@Delete("delete from product where productNum=#{productNum}")
|
|
||||||
public void deleteProduct(int productNum);
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
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(long transactionNum);
|
|
||||||
|
|
||||||
@Select("select * from transaction")
|
|
||||||
public List<Transaction> select();
|
|
||||||
|
|
||||||
@Insert("insert into transaction(transactionNum, payer, payee," +
|
|
||||||
" transactionTime, transactionAmount, note,checkNum)" +
|
|
||||||
" values (#{transactionNum},#{payer},#{payee},#{transactionTime},#{transactionAmount}," +
|
|
||||||
"#{note},#{checkNum})")
|
|
||||||
public void addTransaction(Transaction transactions);
|
|
||||||
|
|
||||||
@Update("update audit set transactionNum=#{transactionNum},payer=#{payer}" +
|
|
||||||
",payee=#{payee},transactionTime=#{transactionTime},transactionAmount=#{transactionAmount}," +
|
|
||||||
"note=#{note}")
|
|
||||||
public void updateTransaction(Transaction transactions);
|
|
||||||
|
|
||||||
@Delete("delete from audit where transactionNum=#{transactionNum}")
|
|
||||||
public void deleteTransaction(long transactionNum);
|
|
||||||
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
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(long checkNum);
|
|
||||||
|
|
||||||
@Select("select * from usagedate")
|
|
||||||
public List<UsageDate> 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(long checkNum);
|
|
||||||
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
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<UserBankIdentify> 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);
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
package com.example.demo.Dao;
|
|
||||||
|
|
||||||
import com.example.demo.bean.User;
|
|
||||||
import org.apache.ibatis.annotations.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface userMapper {
|
|
||||||
@Select("select * from user where userNum = #{userNum}")
|
|
||||||
public User selectUserByuserNum(long userNum);
|
|
||||||
|
|
||||||
@Select("select * from user")
|
|
||||||
public List<User> select();
|
|
||||||
|
|
||||||
@Insert("insert into user(userNum, userName, userPwd, userRight," +
|
|
||||||
" tureName, idNum, telephoneNum, address, isIdentify, registerTime)" +
|
|
||||||
" values (#{userNum},#{userName},#{userPwd},#{userRight},#{tureName}," +
|
|
||||||
"#{idNum},#{telephoneNum},#{address},#{isIdentify},#{registerTime})")
|
|
||||||
public void addUser(User users);
|
|
||||||
|
|
||||||
@Update("update user set userNum=#{userNum},userName=#{userName}" +
|
|
||||||
",userPwd=#{userPwd},userRight=#{userRight},tureName=#{tureName}," +
|
|
||||||
"idNum=#{idNum},telephoneNum=#{telephoneNum},address=#{address}," +
|
|
||||||
"isIdentify=#{isIdentify},registerTime=#{registerTime}where userNum=#{userNum}")
|
|
||||||
public void updateUser(User users);
|
|
||||||
|
|
||||||
@Delete("delete from user where userNum=#{userNum}")
|
|
||||||
public void deleteUser(long userNum);
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
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 Audit {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private long checkNum;
|
|
||||||
private long userNum;
|
|
||||||
private double amount;
|
|
||||||
private String applyTime;
|
|
||||||
private String bankAccount;
|
|
||||||
private long checkState;
|
|
||||||
private long contractNum;
|
|
||||||
private short isSignContract;
|
|
||||||
private long productNum;
|
|
||||||
private int year;
|
|
||||||
private int equation;
|
|
||||||
|
|
||||||
|
|
||||||
public Audit(){};
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
package com.example.demo.bean;
|
|
||||||
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Entity
|
|
||||||
public class Bank {
|
|
||||||
@Id
|
|
||||||
private int bankNum;
|
|
||||||
private String bankName;
|
|
||||||
private String contact;//联系方式
|
|
||||||
|
|
||||||
|
|
||||||
public Bank(){};
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
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 long managerNum;
|
|
||||||
private String managerName;
|
|
||||||
private String managerPwd;
|
|
||||||
private String managerRight;
|
|
||||||
private String telephoneNum;
|
|
||||||
|
|
||||||
|
|
||||||
public Manager(){};
|
|
||||||
|
|
||||||
public long getManagerNum() {
|
|
||||||
return managerNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setManagerNum(int managerNum) {
|
|
||||||
this.managerNum = managerNum;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,83 +0,0 @@
|
|||||||
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 long productNum;
|
|
||||||
private String productName;
|
|
||||||
private String category;
|
|
||||||
private float intrate;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPictureAddress(String pictureAddress) {
|
|
||||||
this.pictureAddress = pictureAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProductDescription() {
|
|
||||||
return productDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProductDescription(String productDescription) {
|
|
||||||
this.productDescription = productDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getBankNum() {
|
|
||||||
return bankNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBankNum(int bankNum) {
|
|
||||||
this.bankNum = bankNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getIntrate() {
|
|
||||||
return intrate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIntrate(float intrate) {
|
|
||||||
this.intrate = intrate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getProductNum() {
|
|
||||||
return productNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProductName(String productName) {
|
|
||||||
this.productName = productName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProductNum(long productNum) {
|
|
||||||
this.productNum = productNum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,111 +0,0 @@
|
|||||||
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 long productNum;
|
|
||||||
private int bankNum;
|
|
||||||
private long 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 long getManagerNum() {
|
|
||||||
return managerNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setManagerNum(long managerNum) {
|
|
||||||
this.managerNum = managerNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getProductNum() {
|
|
||||||
return productNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProductNum(long 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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
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 Repayment {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private long checkNum;
|
|
||||||
private double repAmount;
|
|
||||||
private double repSum;
|
|
||||||
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
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 long transactionNum;
|
|
||||||
private long payer;
|
|
||||||
private long payee;
|
|
||||||
private float transactionTime;
|
|
||||||
private float transactionAmount;
|
|
||||||
private String note;
|
|
||||||
private long checkNum;
|
|
||||||
|
|
||||||
public Transaction(){};
|
|
||||||
public Transaction(long checkNum,long payer,long payee,double transationAmount){
|
|
||||||
this.checkNum=checkNum;
|
|
||||||
this.payer = payer;
|
|
||||||
this.payee = payee;
|
|
||||||
this.transactionAmount=transactionNum;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
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 UsageDate {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private long checkNum;
|
|
||||||
private long productNum;
|
|
||||||
private long userNum;
|
|
||||||
private String bankAccount;
|
|
||||||
private int bankNum;
|
|
||||||
private int year;
|
|
||||||
private float amount;
|
|
||||||
private String startTime;
|
|
||||||
|
|
||||||
public UsageDate(){};
|
|
||||||
private int equation;
|
|
||||||
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
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 long userNum;
|
|
||||||
private String userName;
|
|
||||||
private String userPwd;
|
|
||||||
private String userRight;
|
|
||||||
private String trueName;
|
|
||||||
private String idNum;
|
|
||||||
private String telephoneNum;
|
|
||||||
private String address;
|
|
||||||
private String isIdentify;
|
|
||||||
private String registerTime;
|
|
||||||
|
|
||||||
|
|
||||||
public User(){};
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
package com.example.demo.bean;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.GenerationType;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Entity
|
|
||||||
public class UserBankIdentify {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private String userName;
|
|
||||||
private String bankAccount;
|
|
||||||
private short bankAccountIdentify;
|
|
||||||
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
package com.example.demo.circulator.controller;
|
|
||||||
|
|
||||||
import com.example.demo.circulator.service.PayCirService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
public class PayCirController {
|
|
||||||
//@Autowired
|
|
||||||
PayCirService payCirService;
|
|
||||||
|
|
||||||
@PostMapping("/pay")
|
|
||||||
public String payAmountCir(long checkNum,double pay){
|
|
||||||
int result = payCirService.payAmountCirculator(checkNum,pay);
|
|
||||||
if(result==1){
|
|
||||||
return "/还款成功";
|
|
||||||
}else if(result==-2){
|
|
||||||
return"/未贷款该业务";
|
|
||||||
}else
|
|
||||||
|
|
||||||
return "还款失败";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.example.demo.circulator.service;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
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;}
|
|
||||||
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
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.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class EPAIR_CirService extends CirService{
|
|
||||||
@Autowired
|
|
||||||
private usageDateMapper usageDateMapper;
|
|
||||||
@Autowired
|
|
||||||
private productMapper productMapper;
|
|
||||||
|
|
||||||
@Transactional //数据库与事物的一致性
|
|
||||||
public double NextCirculator(long checkNum){
|
|
||||||
try{
|
|
||||||
UsageDate usageDate = usageDateMapper.selectUsageDateByCheckNum(checkNum);
|
|
||||||
if(usageDate==null)return -2;
|
|
||||||
int year = usageDate.getYear();
|
|
||||||
double amount = usageDate.getAmount();
|
|
||||||
long productNum = usageDate.getProductNum();
|
|
||||||
|
|
||||||
Product product = productMapper.selectProductByProductNum(productNum);
|
|
||||||
if(product==null)return -3;
|
|
||||||
float intrate = product.getIntrate();
|
|
||||||
double rep_amount = 0;
|
|
||||||
|
|
||||||
//double not_rep_amount = amount - rep_amount;
|
|
||||||
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;
|
|
||||||
}catch(Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}finally {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double SumCirculator(long productNum,double amount,int year){
|
|
||||||
try{
|
|
||||||
Product product = productMapper.selectProductByProductNum(productNum);
|
|
||||||
if(product==null)return -3;
|
|
||||||
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;
|
|
||||||
}catch(Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}finally {
|
|
||||||
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,69 +0,0 @@
|
|||||||
package com.example.demo.circulator.service;
|
|
||||||
|
|
||||||
import com.example.demo.Dao.paymentMapper;
|
|
||||||
import com.example.demo.Dao.productMapper;
|
|
||||||
import com.example.demo.Dao.usageDateMapper;
|
|
||||||
import com.example.demo.bean.Product;
|
|
||||||
import com.example.demo.bean.Repayment;
|
|
||||||
import com.example.demo.bean.UsageDate;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class EPR_CirService extends CirService{
|
|
||||||
@Autowired
|
|
||||||
private usageDateMapper usageDateMapper;
|
|
||||||
@Autowired
|
|
||||||
private paymentMapper paymentMapper;
|
|
||||||
@Autowired
|
|
||||||
private productMapper productMapper;
|
|
||||||
|
|
||||||
@Transactional //数据库与事物的一致性
|
|
||||||
public double NextCirculator(long checkNum){
|
|
||||||
try{
|
|
||||||
UsageDate usageDate = usageDateMapper.selectUsageDateByCheckNum(checkNum);
|
|
||||||
Repayment repayment = paymentMapper.selectPepaymentBycheckNum(checkNum);
|
|
||||||
if(usageDate!=null){return -2;}
|
|
||||||
int year = usageDate.getYear();
|
|
||||||
double amount = usageDate.getAmount();
|
|
||||||
long productNum = usageDate.getProductNum();
|
|
||||||
|
|
||||||
Product product = productMapper.selectProductByProductNum(productNum);
|
|
||||||
if(product==null)return -3;
|
|
||||||
float intrate = product.getIntrate();
|
|
||||||
double rep_amount = 0;
|
|
||||||
if(repayment!=null)
|
|
||||||
repayment.getRepAmount();
|
|
||||||
intrate /= 12;
|
|
||||||
int month = year*12;
|
|
||||||
double next_principal_and_interest = amount/month + (amount - rep_amount) * intrate;
|
|
||||||
return next_principal_and_interest;
|
|
||||||
}catch(Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}finally {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double SumCirculator(long productNum,double amount,int year){
|
|
||||||
try{
|
|
||||||
Product product = productMapper.selectProductByProductNum(productNum);
|
|
||||||
if(product==null)return -3;
|
|
||||||
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;
|
|
||||||
}catch(Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}finally {
|
|
||||||
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
package com.example.demo.circulator.service;
|
|
||||||
|
|
||||||
import com.example.demo.Dao.paymentMapper;
|
|
||||||
import com.example.demo.Dao.transMapper;
|
|
||||||
import com.example.demo.Dao.usageDateMapper;
|
|
||||||
import com.example.demo.bean.Repayment;
|
|
||||||
import com.example.demo.bean.Transaction;
|
|
||||||
import com.example.demo.bean.UsageDate;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class PayCirService {
|
|
||||||
@Autowired
|
|
||||||
private usageDateMapper usageDateMapper;
|
|
||||||
@Autowired
|
|
||||||
private paymentMapper paymentMapper;
|
|
||||||
@Autowired
|
|
||||||
private transMapper transMapper;
|
|
||||||
|
|
||||||
public int payAmountCirculator(long checkNum,double pay){
|
|
||||||
try{
|
|
||||||
Repayment repayment = paymentMapper.selectPepaymentBycheckNum(checkNum);
|
|
||||||
UsageDate usageDate= usageDateMapper.selectUsageDateByCheckNum(checkNum);
|
|
||||||
if(usageDate!=null)return -2;
|
|
||||||
double rep_amount = 0;
|
|
||||||
if(repayment!=null)
|
|
||||||
repayment.getRepAmount();
|
|
||||||
long userNum = usageDate.getUserNum();
|
|
||||||
int bankNum = usageDate.getBankNum();
|
|
||||||
double amount = usageDate.getAmount();
|
|
||||||
int year = usageDate.getYear();
|
|
||||||
|
|
||||||
Transaction transaction = new Transaction(checkNum,userNum,bankNum,pay);
|
|
||||||
transMapper.addTransaction(transaction);
|
|
||||||
|
|
||||||
rep_amount = pay - amount/(year*12);
|
|
||||||
repayment.setRepAmount(rep_amount);
|
|
||||||
repayment.setRepSum(pay);
|
|
||||||
paymentMapper.updateRepayment(repayment);
|
|
||||||
return 1;
|
|
||||||
}catch(Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}finally {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
package com.example.demo.productService.controller;
|
|
||||||
|
|
||||||
import com.example.demo.bean.Product;
|
|
||||||
import com.example.demo.productService.tools.addPro;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
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;
|
|
||||||
|
|
||||||
@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 "页面出错";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
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 "页面出错";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,46 +0,0 @@
|
|||||||
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 "页面出错";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
package com.example.demo.productService.tools;
|
|
||||||
|
|
||||||
import com.example.demo.Dao.productHistroyMapper;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
package com.example.demo.productService.tools;
|
|
||||||
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
package com.example.demo.Dao;
|
|
||||||
|
|
||||||
import com.example.demo.bean.Audit;
|
|
||||||
import org.apache.ibatis.annotations.Delete;
|
|
||||||
import org.apache.ibatis.annotations.Insert;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
import org.apache.ibatis.annotations.Update;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface auditMapper {
|
|
||||||
@Select("select * from audit where checkNum = #{checkNum}")
|
|
||||||
public Audit selectAudioByCheckNum(long checkNum);
|
|
||||||
|
|
||||||
@Select("select * from audit")
|
|
||||||
public List<Audit> select();
|
|
||||||
|
|
||||||
@Insert("insert into audit(checkNum, userNum, productNum, " +
|
|
||||||
"bankAccount, checkState, contractNum, " +
|
|
||||||
"isSignContract, year, amount, applyTime)" +
|
|
||||||
" values (#{checkNum},#{userNum},#{productNum},#{bankAccount},#{checkState}," +
|
|
||||||
"#{contractNum},#{isSignContract},#{year},#{amount},#{applyTime})")
|
|
||||||
public void addAudit(Audit audits);
|
|
||||||
|
|
||||||
@Update("update audit set checkNum=#{checkNum},userNum=#{userNum}" +
|
|
||||||
",productNum=#{productNum},checkState=#{checkState},contractNum=#{contractNum}," +
|
|
||||||
"isSignContract=#{isSignContract},year=#{year},amount=#{amount}," +
|
|
||||||
"applyTime=#{applyTime}where checkNum=#{checkNum}")
|
|
||||||
public void updateAudit(Audit audits);
|
|
||||||
|
|
||||||
@Delete("delete from audit where checkNum=#{checkNum}")
|
|
||||||
public void deleteAudit(long checkNum);
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
package com.example.demo.Dao;
|
|
||||||
|
|
||||||
import com.example.demo.bean.Bank;
|
|
||||||
import org.apache.ibatis.annotations.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface bankMapper {
|
|
||||||
|
|
||||||
@Select("select * from bank where bankNum = #{bankNum}")
|
|
||||||
public Bank selectBankByBankNum(int bankNum);
|
|
||||||
|
|
||||||
@Select("select * from bank where bankName = #{bankName}")
|
|
||||||
public Bank selectBankByBankName(String bankName);
|
|
||||||
|
|
||||||
@Select("select * from bank")
|
|
||||||
public List<Bank> select();
|
|
||||||
|
|
||||||
@Insert("insert into bank(bankNum, bankName, contact, " +
|
|
||||||
" values (#{bankNum},#{bankName},#{contact},)")
|
|
||||||
public void addBank(Bank banks);
|
|
||||||
|
|
||||||
@Update("update bank set bankNum=#{bankNum},bankName=#{bankName}" +
|
|
||||||
",contact=#{contact} where bankNum=#{bankNum}")
|
|
||||||
public void updateBank(Bank banks);
|
|
||||||
|
|
||||||
// @Delete("delete from bank where bankNum=#{bankNum}")
|
|
||||||
// public void deleteBank(String bankNum);
|
|
||||||
//
|
|
||||||
// @Delete("delete from bank where bankName=#{bankName}")
|
|
||||||
// public void deleteBanks(String bankName);
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
package com.example.demo.Dao;
|
|
||||||
|
|
||||||
import com.example.demo.bean.Manager;
|
|
||||||
import org.apache.ibatis.annotations.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface managerMapper {
|
|
||||||
@Select("select * from manager where managerNum = #{managerName}")
|
|
||||||
public Manager selectManagerByManagerName(String managerName);
|
|
||||||
|
|
||||||
@Insert("insert into manager(managerNum, managerName, managerPwd, " +
|
|
||||||
"managerRight, telephoneNum) values (#{managerNum},#{managerName}," +
|
|
||||||
"#{managerPwd},#{managerRight},#{telephoneNum})")
|
|
||||||
public void addManager(Manager managers);
|
|
||||||
|
|
||||||
@Update("update manager set managerNum=#{managerNum},managerName=#{managerName}" +
|
|
||||||
",managerPwd=#{managerPwd},managerRight=#{managerRight},telephoneNum=#{telephoneNum},")
|
|
||||||
public void updateManager(Manager managers);
|
|
||||||
|
|
||||||
// @Delete("delete from manager where managerNum=#{managerNum}")
|
|
||||||
// public void deleteManager(String managerNum);
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.example.demo.Dao;
|
|
||||||
|
|
||||||
import com.example.demo.bean.Repayment;
|
|
||||||
import com.example.demo.bean.Transaction;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
import org.apache.ibatis.annotations.Update;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface paymentMapper {
|
|
||||||
@Select("select * from repayment where checkNum =#{checkNum}")
|
|
||||||
public Repayment selectPepaymentBycheckNum(long checkNum);
|
|
||||||
|
|
||||||
@Update("update repayment set repAmount = {#repAmount} ,repSum = #{repSum} where checkNum = #{checkNum}")
|
|
||||||
public void updateRepayment(Repayment repayment);
|
|
||||||
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
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(long productNum);
|
|
||||||
|
|
||||||
@Select("select * from producthistroy")
|
|
||||||
public List<ProductHistroy> 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);
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
package com.example.demo.Dao;
|
|
||||||
|
|
||||||
import com.example.demo.bean.Product;
|
|
||||||
import org.apache.ibatis.annotations.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface productMapper {
|
|
||||||
@Select("select * from product where productNum = #{productNum}")
|
|
||||||
public Product selectProductByProductNum(long productNum);
|
|
||||||
|
|
||||||
@Select("select * from product where productName = #{productName}")
|
|
||||||
public Product selectProductByProductName(long productName);
|
|
||||||
|
|
||||||
@Select("select * from product")
|
|
||||||
public List<Product> select();
|
|
||||||
|
|
||||||
@Insert("insert into product(productNum, productName, category, intrate, " +
|
|
||||||
"bankNum, productDescription, pictureAddress)" +
|
|
||||||
" values (#{productNum},#{productName},#{category},#{intrate},#{bankNum}," +
|
|
||||||
"#{productDescription},#{pictureAddress})")
|
|
||||||
public void addProduct(Product products);
|
|
||||||
|
|
||||||
@Update("update product set productNum=#{productNum},productName=#{productName}" +
|
|
||||||
",category=#{category},intrate=#{intrate},bankNum=#{bankNum}," +
|
|
||||||
"productDescription=#{productDescription},pictureAddress=#{pictureAddress}")
|
|
||||||
public void updateProduct(Product products);
|
|
||||||
|
|
||||||
|
|
||||||
@Delete("delete from product where productNum=#{productNum}")
|
|
||||||
public void deleteProduct(int productNum);
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
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(long transactionNum);
|
|
||||||
|
|
||||||
@Select("select * from transaction")
|
|
||||||
public List<Transaction> select();
|
|
||||||
|
|
||||||
@Insert("insert into transaction(transactionNum, payer, payee," +
|
|
||||||
" transactionTime, transactionAmount, note,checkNum)" +
|
|
||||||
" values (#{transactionNum},#{payer},#{payee},#{transactionTime},#{transactionAmount}," +
|
|
||||||
"#{note},#{checkNum})")
|
|
||||||
public void addTransaction(Transaction transactions);
|
|
||||||
|
|
||||||
@Update("update audit set transactionNum=#{transactionNum},payer=#{payer}" +
|
|
||||||
",payee=#{payee},transactionTime=#{transactionTime},transactionAmount=#{transactionAmount}," +
|
|
||||||
"note=#{note}")
|
|
||||||
public void updateTransaction(Transaction transactions);
|
|
||||||
|
|
||||||
@Delete("delete from audit where transactionNum=#{transactionNum}")
|
|
||||||
public void deleteTransaction(long transactionNum);
|
|
||||||
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
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(long checkNum);
|
|
||||||
|
|
||||||
@Select("select * from usagedate")
|
|
||||||
public List<UsageDate> 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(long checkNum);
|
|
||||||
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
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<UserBankIdentify> 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);
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
package com.example.demo.Dao;
|
|
||||||
|
|
||||||
import com.example.demo.bean.User;
|
|
||||||
import org.apache.ibatis.annotations.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface userMapper {
|
|
||||||
@Select("select * from user where userNum = #{userNum}")
|
|
||||||
public User selectUserByuserNum(long userNum);
|
|
||||||
|
|
||||||
@Select("select * from user")
|
|
||||||
public List<User> select();
|
|
||||||
|
|
||||||
@Insert("insert into user(userNum, userName, userPwd, userRight," +
|
|
||||||
" tureName, idNum, telephoneNum, address, isIdentify, registerTime)" +
|
|
||||||
" values (#{userNum},#{userName},#{userPwd},#{userRight},#{tureName}," +
|
|
||||||
"#{idNum},#{telephoneNum},#{address},#{isIdentify},#{registerTime})")
|
|
||||||
public void addUser(User users);
|
|
||||||
|
|
||||||
@Update("update user set userNum=#{userNum},userName=#{userName}" +
|
|
||||||
",userPwd=#{userPwd},userRight=#{userRight},tureName=#{tureName}," +
|
|
||||||
"idNum=#{idNum},telephoneNum=#{telephoneNum},address=#{address}," +
|
|
||||||
"isIdentify=#{isIdentify},registerTime=#{registerTime}where userNum=#{userNum}")
|
|
||||||
public void updateUser(User users);
|
|
||||||
|
|
||||||
@Delete("delete from user where userNum=#{userNum}")
|
|
||||||
public void deleteUser(long userNum);
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.example.demo;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest
|
|
||||||
public class DemoApplicationTests {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void contextLoads() {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
|||||||
package com.example.demo.bean;
|
|
||||||
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Entity
|
|
||||||
public class Audit {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private long checkNum;
|
|
||||||
private long userNum;
|
|
||||||
private double amount;
|
|
||||||
private String applyTime;
|
|
||||||
private String bankAccount;
|
|
||||||
private long checkState;
|
|
||||||
private long contractNum;
|
|
||||||
private short isSignContract;
|
|
||||||
private long productNum;
|
|
||||||
private int year;
|
|
||||||
private int equation;
|
|
||||||
|
|
||||||
|
|
||||||
public Audit(){};
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
package com.example.demo.bean;
|
|
||||||
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Entity
|
|
||||||
public class Bank {
|
|
||||||
private int bankNum;
|
|
||||||
private String bankName;
|
|
||||||
private String contact;//联系方式
|
|
||||||
|
|
||||||
|
|
||||||
public Bank(){};
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
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 long managerNum;
|
|
||||||
private String managerName;
|
|
||||||
private String managerPwd;
|
|
||||||
private String managerRight;
|
|
||||||
private String telephoneNum;
|
|
||||||
|
|
||||||
|
|
||||||
public Manager(){};
|
|
||||||
|
|
||||||
public long getManagerNum() {
|
|
||||||
return managerNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setManagerNum(int managerNum) {
|
|
||||||
this.managerNum = managerNum;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,83 +0,0 @@
|
|||||||
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 long productNum;
|
|
||||||
private String productName;
|
|
||||||
private String category;
|
|
||||||
private float intrate;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPictureAddress(String pictureAddress) {
|
|
||||||
this.pictureAddress = pictureAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProductDescription() {
|
|
||||||
return productDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProductDescription(String productDescription) {
|
|
||||||
this.productDescription = productDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getBankNum() {
|
|
||||||
return bankNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBankNum(int bankNum) {
|
|
||||||
this.bankNum = bankNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getIntrate() {
|
|
||||||
return intrate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIntrate(float intrate) {
|
|
||||||
this.intrate = intrate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getProductNum() {
|
|
||||||
return productNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProductName(String productName) {
|
|
||||||
this.productName = productName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProductNum(long productNum) {
|
|
||||||
this.productNum = productNum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,111 +0,0 @@
|
|||||||
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 long productNum;
|
|
||||||
private int bankNum;
|
|
||||||
private long 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 long getManagerNum() {
|
|
||||||
return managerNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setManagerNum(long managerNum) {
|
|
||||||
this.managerNum = managerNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getProductNum() {
|
|
||||||
return productNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProductNum(long 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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package com.example.demo.bean;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Entity
|
|
||||||
public class Repayment {
|
|
||||||
private long checkNum;
|
|
||||||
private double repAmount;
|
|
||||||
private double repSum;
|
|
||||||
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
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 long transactionNum;
|
|
||||||
private long payer;
|
|
||||||
private long payee;
|
|
||||||
private float transactionTime;
|
|
||||||
private float transactionAmount;
|
|
||||||
private String note;
|
|
||||||
private long checkNum;
|
|
||||||
|
|
||||||
public Transaction(){};
|
|
||||||
public Transaction(long checkNum,long payer,long payee,double transationAmount){
|
|
||||||
this.checkNum=checkNum;
|
|
||||||
this.payer = payer;
|
|
||||||
this.payee = payee;
|
|
||||||
this.transactionAmount=transactionNum;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
package com.example.demo.bean;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Entity
|
|
||||||
public class UsageDate {
|
|
||||||
private long checkNum;
|
|
||||||
private long productNum;
|
|
||||||
private long userNum;
|
|
||||||
private String bankAccount;
|
|
||||||
private int bankNum;
|
|
||||||
private int year;
|
|
||||||
private float amount;
|
|
||||||
private String startTime;
|
|
||||||
|
|
||||||
public UsageDate(){};
|
|
||||||
private int equation;
|
|
||||||
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
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 long userNum;
|
|
||||||
private String userName;
|
|
||||||
private String userPwd;
|
|
||||||
private String userRight;
|
|
||||||
private String trueName;
|
|
||||||
private String idNum;
|
|
||||||
private String telephoneNum;
|
|
||||||
private String address;
|
|
||||||
private String isIdentify;
|
|
||||||
private String registerTime;
|
|
||||||
|
|
||||||
|
|
||||||
public User(){};
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
package com.example.demo.bean;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Entity
|
|
||||||
public class UserBankIdentify {
|
|
||||||
private String userName;
|
|
||||||
private String bankAccount;
|
|
||||||
private short bankAccountIdentify;
|
|
||||||
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
package com.example.demo.circulator.controller;
|
|
||||||
|
|
||||||
import com.example.demo.circulator.service.PayCirService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
public class PayCirController {
|
|
||||||
@Autowired
|
|
||||||
PayCirService payCirService;
|
|
||||||
|
|
||||||
@PostMapping("/pay")
|
|
||||||
public String payAmountCir(long checkNum,double pay){
|
|
||||||
int result = payCirService.payAmountCirculator(checkNum,pay);
|
|
||||||
if(result==1){
|
|
||||||
return "/还款成功";
|
|
||||||
}else{
|
|
||||||
return"/还款失败";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.example.demo.circulator.service;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
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;}
|
|
||||||
|
|
||||||
}
|
|
@ -1,59 +0,0 @@
|
|||||||
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.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class EPAIR_CirService extends CirService {
|
|
||||||
@Autowired
|
|
||||||
private usageDateMapper usageDateMapper;
|
|
||||||
@Autowired
|
|
||||||
private productMapper productMapper;
|
|
||||||
|
|
||||||
@Transactional //数据库与事物的一致性
|
|
||||||
public double NextCirculator(long checkNum){
|
|
||||||
try{
|
|
||||||
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;
|
|
||||||
|
|
||||||
//double not_rep_amount = amount - rep_amount;
|
|
||||||
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;
|
|
||||||
}catch(Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}finally {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double SumCirculator(long productNum,double amount,int year){
|
|
||||||
try{
|
|
||||||
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;
|
|
||||||
}catch(Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}finally {
|
|
||||||
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,64 +0,0 @@
|
|||||||
package com.example.demo.circulator.service;
|
|
||||||
|
|
||||||
import com.example.demo.Dao.paymentMapper;
|
|
||||||
import com.example.demo.Dao.productMapper;
|
|
||||||
import com.example.demo.Dao.usageDateMapper;
|
|
||||||
import com.example.demo.bean.Product;
|
|
||||||
import com.example.demo.bean.Repayment;
|
|
||||||
import com.example.demo.bean.UsageDate;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class EPR_CirService extends CirService {
|
|
||||||
@Autowired
|
|
||||||
private usageDateMapper usageDateMapper;
|
|
||||||
@Autowired
|
|
||||||
private paymentMapper paymentMapper;
|
|
||||||
@Autowired
|
|
||||||
private productMapper productMapper;
|
|
||||||
|
|
||||||
@Transactional //数据库与事物的一致性
|
|
||||||
public double NextCirculator(long checkNum){
|
|
||||||
try{
|
|
||||||
UsageDate usageDate = usageDateMapper.selectUsageDateByCheckNum(checkNum);
|
|
||||||
Repayment repayment = paymentMapper.selectPepaymentBycheckNum(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 = repayment.getRepAmount();
|
|
||||||
intrate /= 12;
|
|
||||||
int month = year*12;
|
|
||||||
double next_principal_and_interest = amount/month + (amount - rep_amount) * intrate;
|
|
||||||
return next_principal_and_interest;
|
|
||||||
}catch(Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}finally {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double SumCirculator(long productNum,double amount,int year){
|
|
||||||
try{
|
|
||||||
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;
|
|
||||||
}catch(Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}finally {
|
|
||||||
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
package com.example.demo.circulator.service;
|
|
||||||
|
|
||||||
import com.example.demo.Dao.paymentMapper;
|
|
||||||
import com.example.demo.Dao.transMapper;
|
|
||||||
import com.example.demo.Dao.usageDateMapper;
|
|
||||||
import com.example.demo.bean.Repayment;
|
|
||||||
import com.example.demo.bean.Transaction;
|
|
||||||
import com.example.demo.bean.UsageDate;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class PayCirService {
|
|
||||||
@Autowired
|
|
||||||
private usageDateMapper usageDateMapper;
|
|
||||||
@Autowired
|
|
||||||
private paymentMapper paymentMapper;
|
|
||||||
@Autowired
|
|
||||||
private transMapper transMapper;
|
|
||||||
|
|
||||||
public int payAmountCirculator(long checkNum,double pay){
|
|
||||||
try{
|
|
||||||
Repayment repayment = paymentMapper.selectPepaymentBycheckNum(checkNum);
|
|
||||||
UsageDate usageDate= usageDateMapper.selectUsageDateByCheckNum(checkNum);
|
|
||||||
double rep_amount = repayment.getRepAmount();
|
|
||||||
long userNum = usageDate.getUserNum();
|
|
||||||
int bankNum = usageDate.getBankNum();
|
|
||||||
double amount = usageDate.getAmount();
|
|
||||||
int year = usageDate.getYear();
|
|
||||||
|
|
||||||
Transaction transaction = new Transaction(checkNum,userNum,bankNum,pay);
|
|
||||||
transMapper.addTransaction(transaction);
|
|
||||||
|
|
||||||
rep_amount = pay - amount/(year*12);
|
|
||||||
repayment.setRepAmount(rep_amount);
|
|
||||||
repayment.setRepSum(pay);
|
|
||||||
paymentMapper.updateRepayment(repayment);
|
|
||||||
return 1;
|
|
||||||
}catch(Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}finally {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,46 +0,0 @@
|
|||||||
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 "页面出错";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
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 "页面出错";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,46 +0,0 @@
|
|||||||
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 "页面出错";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in new issue