master
parent
bce56c4e60
commit
9ba7c9880a
@ -1,11 +1,7 @@
|
|||||||
package com.example.demo.Dao;
|
package com.example.demo.Dao;
|
||||||
|
|
||||||
import com.example.demo.bean.Audit;
|
import com.example.demo.bean.Audit;
|
||||||
import org.apache.ibatis.annotations.Delete;
|
import org.apache.ibatis.annotations.*;
|
||||||
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;
|
import java.util.List;
|
||||||
|
|
@ -1,7 +1,10 @@
|
|||||||
package com.example.demo.Dao;
|
package com.example.demo.Dao;
|
||||||
|
|
||||||
import com.example.demo.bean.Bank;
|
import com.example.demo.bean.Bank;
|
||||||
import org.apache.ibatis.annotations.*;
|
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;
|
import java.util.List;
|
||||||
|
|
@ -1,9 +1,10 @@
|
|||||||
package com.example.demo.Dao;
|
package com.example.demo.Dao;
|
||||||
|
|
||||||
import com.example.demo.bean.Manager;
|
import com.example.demo.bean.Manager;
|
||||||
import org.apache.ibatis.annotations.*;
|
import org.apache.ibatis.annotations.Insert;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import java.util.List;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
import org.apache.ibatis.annotations.Update;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface managerMapper {
|
public interface managerMapper {
|
@ -1,7 +1,6 @@
|
|||||||
package com.example.demo.Dao;
|
package com.example.demo.Dao;
|
||||||
|
|
||||||
import com.example.demo.bean.Repayment;
|
import com.example.demo.bean.Repayment;
|
||||||
import com.example.demo.bean.Transaction;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
import org.apache.ibatis.annotations.Update;
|
import org.apache.ibatis.annotations.Update;
|
@ -0,0 +1,30 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
public double getRepAmount() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRepAmount(double repamount) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRepSum(double pay) {
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
public double getAmount() {
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getYear() {
|
||||||
|
return year;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getProductNum() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getUserNum() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBankNum() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
@ -1,12 +1,19 @@
|
|||||||
package com.example.demo.bean;
|
package com.example.demo.bean;
|
||||||
|
|
||||||
|
import lombok.Setter;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
@Setter
|
||||||
@Entity
|
@Entity
|
||||||
public class UserBankIdentify {
|
public class UserBankIdentify {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private String userName;
|
private String userName;
|
||||||
private String bankAccount;
|
private String bankAccount;
|
||||||
private short bankAccountIdentify;
|
private short bankAccountIdentify;
|
@ -1,6 +1,5 @@
|
|||||||
package com.example.demo.circulator.service;
|
package com.example.demo.circulator.service;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
@ -1,7 +1,6 @@
|
|||||||
package com.example.demo.productService.tools;
|
package com.example.demo.productService.tools;
|
||||||
|
|
||||||
import com.example.demo.Dao.productHistroyMapper;
|
import com.example.demo.Dao.productHistroyMapper;
|
||||||
import com.example.demo.bean.Product;
|
|
||||||
import com.example.demo.bean.ProductHistroy;
|
import com.example.demo.bean.ProductHistroy;
|
||||||
|
|
||||||
public class deletePro {
|
public class deletePro {
|
@ -1,8 +1,8 @@
|
|||||||
package com.example.demo.productService.tools;
|
package com.example.demo.productService.tools;
|
||||||
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
public class nowTime{
|
public class nowTime{
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.example.demo.searchService.controller;
|
||||||
|
|
||||||
|
import com.example.demo.bean.Product;
|
||||||
|
import com.example.demo.searchService.service.impl.ProductSearchServiceImpl;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public class SearchServiceController {
|
||||||
|
ProductSearchServiceImpl productSearchService = new ProductSearchServiceImpl();
|
||||||
|
//模糊查询
|
||||||
|
@GetMapping("/findByNameLike/{productName}")
|
||||||
|
public List<Product> findByNameLike(@PathVariable(value = "productName") String productName){
|
||||||
|
return productSearchService.findByNameLike(productName);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.example.demo.searchService.repository;
|
||||||
|
|
||||||
|
import com.example.demo.bean.Product;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ProductRepository extends JpaRepository<Product,Integer>, JpaSpecificationExecutor<Product> {
|
||||||
|
@Query("select p.productName from Product p where p.productName like CONCAT('%',:productName,'%')")
|
||||||
|
List<Product> findByNameLike(@Param("productName") String productName);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,171 @@
|
|||||||
|
package com.example.demo.searchService.service.impl;
|
||||||
|
|
||||||
|
import com.example.demo.bean.Product;
|
||||||
|
import com.example.demo.searchService.repository.ProductRepository;
|
||||||
|
import com.example.demo.searchService.service.ProductSearchService;
|
||||||
|
import org.springframework.data.domain.Example;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.data.domain.Sort;
|
||||||
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public class ProductSearchServiceImpl implements ProductSearchService {
|
||||||
|
ProductRepository productRepository = new ProductRepository() {
|
||||||
|
@Override
|
||||||
|
public List<Product> findByNameLike(String productName) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Product> findAll() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Product> findAll(Sort sort) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Product> findAllById(Iterable<Integer> iterable) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S extends Product> List<S> saveAll(Iterable<S> iterable) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void flush() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S extends Product> S saveAndFlush(S s) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteInBatch(Iterable<Product> iterable) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteAllInBatch() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Product getOne(Integer integer) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S extends Product> List<S> findAll(Example<S> example) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S extends Product> List<S> findAll(Example<S> example, Sort sort) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<Product> findOne(Specification<Product> specification) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Product> findAll(Specification<Product> specification) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<Product> findAll(Specification<Product> specification, Pageable pageable) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Product> findAll(Specification<Product> specification, Sort sort) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long count(Specification<Product> specification) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<Product> findAll(Pageable pageable) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S extends Product> S save(S s) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<Product> findById(Integer integer) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean existsById(Integer integer) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long count() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteById(Integer integer) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(Product product) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteAll(Iterable<? extends Product> iterable) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteAll() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S extends Product> Optional<S> findOne(Example<S> example) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S extends Product> Page<S> findAll(Example<S> example, Pageable pageable) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S extends Product> long count(Example<S> example) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <S extends Product> boolean exists(Example<S> example) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
public List<Product> findByNameLike(String productName){
|
||||||
|
List<Product> list = productRepository.findByNameLike(productName);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
@ -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,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,38 +0,0 @@
|
|||||||
package com.example.demo.searchService.controller;
|
|
||||||
|
|
||||||
|
|
||||||
import com.example.demo.bean.Product;
|
|
||||||
import com.example.demo.searchService.service.ProductSearchService;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
public class SearchServiceController {
|
|
||||||
private ProductSearchService productSearchService;
|
|
||||||
@RequestMapping("/search")
|
|
||||||
public List<Product> productSearch(HttpServletRequest request, HttpServletResponse response){
|
|
||||||
List<Product> list = new ArrayList<Product>();
|
|
||||||
String productName = request.getParameter("productName");
|
|
||||||
String category = request.getParameter("category");
|
|
||||||
float intrate = Integer.parseInt(request.getParameter("intrate"));
|
|
||||||
if(productName!=null){
|
|
||||||
list = productSearchService.findByNameLike(productName);
|
|
||||||
//按关键字搜索
|
|
||||||
}else if(category!=null){
|
|
||||||
list = productSearchService.findByCategory(category);
|
|
||||||
//按产品类别搜索
|
|
||||||
}else if(intrate!=0){
|
|
||||||
list = productSearchService.findByIntrate(intrate);
|
|
||||||
//按利率排序由低到高
|
|
||||||
}else{
|
|
||||||
list = productSearchService.findByCount();
|
|
||||||
//默认按产品热度由高到低排序
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
package com.example.demo.searchService.service.impl;
|
|
||||||
|
|
||||||
import com.example.demo.Dao.productMapper;
|
|
||||||
import com.example.demo.Dao.usageDateMapper;
|
|
||||||
import com.example.demo.bean.Product;
|
|
||||||
import com.example.demo.searchService.service.ProductSearchService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ProductSearchServiceImpl implements ProductSearchService {
|
|
||||||
@Autowired
|
|
||||||
productMapper productMapper;
|
|
||||||
usageDateMapper usageDateMapper;
|
|
||||||
Product product;
|
|
||||||
@Override
|
|
||||||
public List<Product> findByNameLike(String productName){
|
|
||||||
return productMapper.findByNameLike(productName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Product> findByCategory(String category){
|
|
||||||
return productMapper.findByCategory(category);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Product> findByIntrate(float intrate){
|
|
||||||
return productMapper.findByIntrate(intrate);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Product> findByCount(){
|
|
||||||
List<Product> productList = new ArrayList<Product>();
|
|
||||||
List<Integer> listusage = usageDateMapper.selectByCount();
|
|
||||||
int[] arr = listusage.stream().mapToInt(Integer::valueOf).toArray();
|
|
||||||
for(int i=0;i<arr.length;i++){
|
|
||||||
product = productMapper.selectProductByProductNum(arr[i]);
|
|
||||||
productList.add(product);
|
|
||||||
}
|
|
||||||
return productList;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in new issue