作者 钟来

模块整理

正在显示 100 个修改的文件 包含 766 行增加1089 行删除

要显示太多修改。

为保证性能只显示 100 of 100+ 个文件。

package com.ruoyi.system.domain.afms;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
@ApiModel(description = "基础信息管理-动保信息管理")
public class AfmsBasicAquatic {
@ApiModelProperty(value = "ID")
private Integer id;
@ApiModelProperty(value = "动保名称")
private String name;
@ApiModelProperty(value = "类别")
private String category;
@ApiModelProperty(value = "品牌")
private String brand;
@ApiModelProperty(value = "计量单位ID")
private Integer measurementUnitId;
@ApiModelProperty(value = "规格单位")
private String specificationUnit;
@ApiModelProperty(value = "供应商ID")
private Integer supplierId;
@ApiModelProperty(value = "供应商")
private String supplier;
@ApiModelProperty(value = "创建时间")
private Date createTime;
// 省略getter和setter方法
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getBrand() {
return brand;
}
public void setBrand(String brand) {
this.brand = brand;
}
public Integer getMeasurementUnitId() {
return measurementUnitId;
}
public void setMeasurementUnitId(Integer measurementUnitId) {
this.measurementUnitId = measurementUnitId;
}
public String getSpecificationUnit() {
return specificationUnit;
}
public void setSpecificationUnit(String specificationUnit) {
this.specificationUnit = specificationUnit;
}
public Integer getSupplierId() {
return supplierId;
}
public void setSupplierId(Integer supplierId) {
this.supplierId = supplierId;
}
public String getSupplier() {
return supplier;
}
public void setSupplier(String supplier) {
this.supplier = supplier;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
package com.ruoyi.system.domain.afms;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
@ApiModel(description = "基础信息管理-品牌信息管理")
public class AfmsBasicBrand {
@ApiModelProperty(value = "ID")
private Integer id;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "描述")
private String description;
@ApiModelProperty(value = "创建时间")
private Date createTime;
// 省略getter和setter方法
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
package com.ruoyi.system.domain.afms;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
@ApiModel(description = "基础信息管理-品类信息管理")
public class AfmsBasicCategory {
@ApiModelProperty(value = "ID")
private Integer id;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "描述")
private String description;
@ApiModelProperty(value = "创建时间")
private Date createTime;
// 省略getter和setter方法
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
package com.ruoyi.system.domain.afms;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
@ApiModel(description = "基础信息管理-客户信息管理")
public class AfmsBasicCustomer {
@ApiModelProperty(value = "ID")
private Integer id;
@ApiModelProperty(value = "客户名称")
private String name;
@ApiModelProperty(value = "客户类型ID")
private Integer customerTypeId;
@ApiModelProperty(value = "联系人")
private String contactPerson;
@ApiModelProperty(value = "联系电话")
private String contactPhone;
@ApiModelProperty(value = "联系地址")
private String contactAddress;
@ApiModelProperty(value = "纳税人识别号")
private String taxpayerIdentificationNumber;
@ApiModelProperty(value = "开户行")
private String bank;
@ApiModelProperty(value = "用户名")
private String accountName;
@ApiModelProperty(value = "账号")
private String accountNumber;
@ApiModelProperty(value = "营业执照")
private String businessLicense;
@ApiModelProperty(value = "创建时间")
private Date createTime;
// 省略getter和setter方法
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getCustomerTypeId() {
return customerTypeId;
}
public void setCustomerTypeId(Integer customerTypeId) {
this.customerTypeId = customerTypeId;
}
public String getContactPerson() {
return contactPerson;
}
public void setContactPerson(String contactPerson) {
this.contactPerson = contactPerson;
}
public String getContactPhone() {
return contactPhone;
}
public void setContactPhone(String contactPhone) {
this.contactPhone = contactPhone;
}
public String getContactAddress() {
return contactAddress;
}
public void setContactAddress(String contactAddress) {
this.contactAddress = contactAddress;
}
public String getTaxpayerIdentificationNumber() {
return taxpayerIdentificationNumber;
}
public void setTaxpayerIdentificationNumber(String taxpayerIdentificationNumber) {
this.taxpayerIdentificationNumber = taxpayerIdentificationNumber;
}
public String getBank() {
return bank;
}
public void setBank(String bank) {
this.bank = bank;
}
public String getAccountName() {
return accountName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
public String getAccountNumber() {
return accountNumber;
}
public void setAccountNumber(String accountNumber) {
this.accountNumber = accountNumber;
}
public String getBusinessLicense() {
return businessLicense;
}
public void setBusinessLicense(String businessLicense) {
this.businessLicense = businessLicense;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
package com.ruoyi.system.domain.afms;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
@ApiModel(description = "基础信息管理-客户类型信息管理")
public class AfmsBasicCustomerType {
@ApiModelProperty(value = "ID")
private Integer id;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "描述")
private String description;
@ApiModelProperty(value = "创建时间")
private Date createTime;
// 省略getter和setter方法
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
package com.ruoyi.system.domain.afms;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
@ApiModel(description = "基础信息管理-饲料信息管理")
public class AfmsBasicFeed {
@ApiModelProperty(value = "ID")
private Integer id;
@ApiModelProperty(value = "饲料名称")
private String name;
@ApiModelProperty(value = "品牌ID")
private Integer brandId;
@ApiModelProperty(value = "品类ID")
private Integer categoryId;
@ApiModelProperty(value = "规格单位(kg/包)")
private String specificationUnit;
@ApiModelProperty(value = "供应商ID")
private Integer supplierId;
@ApiModelProperty(value = "供应商")
private String supplier;
@ApiModelProperty(value = "创建时间")
private Date createTime;
// 省略getter和setter方法
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getBrandId() {
return brandId;
}
public void setBrandId(Integer brandId) {
this.brandId = brandId;
}
public Integer getCategoryId() {
return categoryId;
}
public void setCategoryId(Integer categoryId) {
this.categoryId = categoryId;
}
public String getSpecificationUnit() {
return specificationUnit;
}
public void setSpecificationUnit(String specificationUnit) {
this.specificationUnit = specificationUnit;
}
public Integer getSupplierId() {
return supplierId;
}
public void setSupplierId(Integer supplierId) {
this.supplierId = supplierId;
}
public String getSupplier() {
return supplier;
}
public void setSupplier(String supplier) {
this.supplier = supplier;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
package com.ruoyi.system.domain.afms;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
@ApiModel(description = "基础信息管理-苗种信息管理")
public class AfmsBasicFry {
@ApiModelProperty(value = "ID")
private Integer id;
@ApiModelProperty(value = "苗种名称")
private String name;
@ApiModelProperty(value = "养殖品种ID")
private Integer speciesId;
@ApiModelProperty(value = "类别")
private String category;
@ApiModelProperty(value = "数量单位")
private String quantityUnit;
@ApiModelProperty(value = "规格单位")
private String specificationUnit;
@ApiModelProperty(value = "供应商ID")
private Integer supplierId;
@ApiModelProperty(value = "供应商")
private String supplier;
@ApiModelProperty(value = "创建时间")
private Date createTime;
// 省略getter和setter方法
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getSpeciesId() {
return speciesId;
}
public void setSpeciesId(Integer speciesId) {
this.speciesId = speciesId;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getQuantityUnit() {
return quantityUnit;
}
public void setQuantityUnit(String quantityUnit) {
this.quantityUnit = quantityUnit;
}
public String getSpecificationUnit() {
return specificationUnit;
}
public void setSpecificationUnit(String specificationUnit) {
this.specificationUnit = specificationUnit;
}
public Integer getSupplierId() {
return supplierId;
}
public void setSupplierId(Integer supplierId) {
this.supplierId = supplierId;
}
public String getSupplier() {
return supplier;
}
public void setSupplier(String supplier) {
this.supplier = supplier;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
package com.ruoyi.system.domain.afms;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
@ApiModel(description = "基础信息管理-计量单位信息管理")
public class AfmsBasicMeasurementUnit {
@ApiModelProperty(value = "ID")
private Integer id;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "描述")
private String description;
@ApiModelProperty(value = "创建时间")
private Date createTime;
// 省略getter和setter方法
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
package com.ruoyi.system.domain.afms;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
@ApiModel(description = "基础信息管理-塘口信息管理")
public class AfmsBasicPond {
@ApiModelProperty(value = "ID")
private Integer id;
@ApiModelProperty(value = "用户ID")
private Integer userId;
@ApiModelProperty(value = "塘口名称")
private String name;
@ApiModelProperty(value = "负责人")
private String personInCharge;
@ApiModelProperty(value = "养殖品种ID集合(以英文逗号分割)")
private String speciesIds;
@ApiModelProperty(value = "创建时间")
private Date createTime;
// 省略getter和setter方法
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPersonInCharge() {
return personInCharge;
}
public void setPersonInCharge(String personInCharge) {
this.personInCharge = personInCharge;
}
public String getSpeciesIds() {
return speciesIds;
}
public void setSpeciesIds(String speciesIds) {
this.speciesIds = speciesIds;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
package com.ruoyi.system.domain.afms;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
@ApiModel(description = "基础信息管理-养殖品种管理")
public class AfmsBasicSpecies {
@ApiModelProperty(value = "ID")
private Integer id;
@ApiModelProperty(value = "品种名称")
private String name;
@ApiModelProperty(value = "水体类型")
private String waterType;
@ApiModelProperty(value = "重量单位")
private String weightUnit;
@ApiModelProperty(value = "数量单位")
private String quantityUnit;
@ApiModelProperty(value = "规格单位")
private String specificationUnit;
@ApiModelProperty(value = "创建时间")
private Date createTime;
// 省略getter和setter方法
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getWaterType() {
return waterType;
}
public void setWaterType(String waterType) {
this.waterType = waterType;
}
public String getWeightUnit() {
return weightUnit;
}
public void setWeightUnit(String weightUnit) {
this.weightUnit = weightUnit;
}
public String getQuantityUnit() {
return quantityUnit;
}
public void setQuantityUnit(String quantityUnit) {
this.quantityUnit = quantityUnit;
}
public String getSpecificationUnit() {
return specificationUnit;
}
public void setSpecificationUnit(String specificationUnit) {
this.specificationUnit = specificationUnit;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
package com.ruoyi.system.domain.afms;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
@ApiModel(description = "基础信息管理-供应商信息管理")
public class AfmsBasicSupplier {
@ApiModelProperty(value = "ID")
private Integer id;
@ApiModelProperty(value = "供应商名称")
private String name;
@ApiModelProperty(value = "供应商类型ID")
private Integer supplierTypeId;
@ApiModelProperty(value = "联系人")
private String contactPerson;
@ApiModelProperty(value = "联系电话")
private String contactPhone;
@ApiModelProperty(value = "联系地址")
private String contactAddress;
@ApiModelProperty(value = "纳税人识别号")
private String taxpayerIdentificationNumber;
@ApiModelProperty(value = "开户行")
private String bank;
@ApiModelProperty(value = "用户名")
private String accountName;
@ApiModelProperty(value = "账号")
private String accountNumber;
@ApiModelProperty(value = "营业执照")
private String businessLicense;
@ApiModelProperty(value = "创建时间")
private Date createTime;
// 省略getter和setter方法
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getSupplierTypeId() {
return supplierTypeId;
}
public void setSupplierTypeId(Integer supplierTypeId) {
this.supplierTypeId = supplierTypeId;
}
public String getContactPerson() {
return contactPerson;
}
public void setContactPerson(String contactPerson) {
this.contactPerson = contactPerson;
}
public String getContactPhone() {
return contactPhone;
}
public void setContactPhone(String contactPhone) {
this.contactPhone = contactPhone;
}
public String getContactAddress() {
return contactAddress;
}
public void setContactAddress(String contactAddress) {
this.contactAddress = contactAddress;
}
public String getTaxpayerIdentificationNumber() {
return taxpayerIdentificationNumber;
}
public void setTaxpayerIdentificationNumber(String taxpayerIdentificationNumber) {
this.taxpayerIdentificationNumber = taxpayerIdentificationNumber;
}
public String getBank() {
return bank;
}
public void setBank(String bank) {
this.bank = bank;
}
public String getAccountName() {
return accountName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
public String getAccountNumber() {
return accountNumber;
}
public void setAccountNumber(String accountNumber) {
this.accountNumber = accountNumber;
}
public String getBusinessLicense() {
return businessLicense;
}
public void setBusinessLicense(String businessLicense) {
this.businessLicense = businessLicense;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
package com.ruoyi.system.domain.afms;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
@ApiModel(description = "基础信息管理-供应商类型信息管理")
public class AfmsBasicSupplierType {
@ApiModelProperty(value = "ID")
private Integer id;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "描述")
private String description;
@ApiModelProperty(value = "创建时间")
private Date createTime;
// 省略getter和setter方法
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
... ... @@ -18,18 +18,21 @@
</properties>
<modules>
<module>lh-common-datasource</module>
<module>lh-common-firewall</module>
<module>lh-common-log</module>
<module>lh-common-swagger</module>
<module>lh-domain</module>
<module>ruoyi-common</module>
<module>ruoyi-system</module>
<module>lh-public-dao</module>
<module>lh-quartz</module>
<module>ruoyi-auth</module>
<module>ruoyi-common</module>
<module>ruoyi-common-core</module>
<module>ruoyi-common-redis</module>
<module>ruoyi-common-security</module>
<module>ruoyi-auth</module>
<module>lh-common-datasource</module>
<module>lh-common-log</module>
<module>lh-quartz</module>
<module>ruoyi-framework</module>
<module>ruoyi-generator</module>
<module>ruoyi-system</module>
</modules>
<packaging>pom</packaging>
... ...
... ... @@ -32,10 +32,5 @@
<groupId>com.zhonglai.luhui</groupId>
<artifactId>lh-jar-sys-service</artifactId>
</dependency>
<!-- spring security 安全认证 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
... ...
... ... @@ -3,11 +3,14 @@ package com.zhonglai.luhui.security.config;
import com.zhonglai.luhui.security.filter.JwtAuthenticationTokenFilter;
import com.zhonglai.luhui.security.handle.AuthenticationEntryPointImpl;
import com.zhonglai.luhui.security.handle.LogoutSuccessHandlerImpl;
import com.zhonglai.luhui.security.service.CustomAuthenticationProvider;
import com.zhonglai.luhui.security.service.CustomUserDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
... ... @@ -31,7 +34,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
* 自定义用户认证逻辑
*/
@Autowired
private UserDetailsService userDetailsService;
private CustomUserDetailsService userDetailsService;
/**
* 认证失败处理类
... ... @@ -129,6 +132,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 添加CORS filter
httpSecurity.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class);
httpSecurity.addFilterBefore(corsFilter, LogoutFilter.class);
}
/**
... ... @@ -140,12 +144,26 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
return new BCryptPasswordEncoder();
}
/**
* 身份认证接口
*/
// /**
// * 身份认证接口
// */
// @Override
// protected void configure(AuthenticationManagerBuilder auth) throws Exception
// {
// auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder());
// }
@Bean(name="customAuthenticationProvider")
public AuthenticationProvider customAuthenticationProvider() {
CustomAuthenticationProvider customAuthenticationProvider= new CustomAuthenticationProvider();
customAuthenticationProvider.setUserDetailsService(userDetailsService);
customAuthenticationProvider.setHideUserNotFoundExceptions(false);
customAuthenticationProvider.setPasswordEncoder(bCryptPasswordEncoder());
return customAuthenticationProvider;
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception
{
auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder());
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(customAuthenticationProvider());
}
}
... ...
package com.zhonglai.luhui.security.controller;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api(tags = "登陆")
@RestController
@RequestMapping("/login")
public class LoginController {
}
... ...
package com.zhonglai.luhui.security.service;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.InternalAuthenticationServiceException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsPasswordService;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.factory.PasswordEncoderFactories;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.util.Assert;
import java.util.Map;
public class CustomAuthenticationProvider extends AbstractUserDetailsAuthenticationProvider {
/**
* The plaintext password used to perform PasswordEncoder#matches(CharSequence,
* String)} on when the user is not found to avoid SEC-2056.
*/
private static final String USER_NOT_FOUND_PASSWORD = "userNotFoundPassword";
private PasswordEncoder passwordEncoder;
/**
* The password used to perform {@link PasswordEncoder#matches(CharSequence, String)}
* on when the user is not found to avoid SEC-2056. This is necessary, because some
* {@link PasswordEncoder} implementations will short circuit if the password is not
* in a valid format.
*/
private volatile String userNotFoundEncodedPassword;
private CustomUserDetailsService userDetailsService;
private UserDetailsPasswordService userDetailsPasswordService;
public CustomAuthenticationProvider() {
setPasswordEncoder(PasswordEncoderFactories.createDelegatingPasswordEncoder());
}
@Override
@SuppressWarnings("deprecation")
protected void additionalAuthenticationChecks(UserDetails userDetails,
UsernamePasswordAuthenticationToken authentication) throws AuthenticationException {
if (authentication.getCredentials() == null) {
this.logger.debug("Failed to authenticate since no credentials provided");
throw new BadCredentialsException(this.messages
.getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials"));
}
String presentedPassword = authentication.getCredentials().toString();
if (!this.passwordEncoder.matches(presentedPassword, userDetails.getPassword())) {
this.logger.debug("Failed to authenticate since password does not match stored value");
throw new BadCredentialsException(this.messages
.getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials"));
}
}
@Override
protected void doAfterPropertiesSet() {
Assert.notNull(this.userDetailsService, "A UserDetailsService must be set");
}
@Override
protected final UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication)
throws AuthenticationException {
this.prepareTimingAttackProtection();
Map<String,String> map = (Map<String, String>) authentication.getDetails(); // 自定义添加
try {
String userType = map.get("userType"); // 自定义添加
UserDetails loadedUser = this.getUserDetailsService().loadUserByUsername(username, userType); // 自定义添加userType参数
if (loadedUser == null) {
throw new InternalAuthenticationServiceException("UserDetailsService returned null, which is an interface contract violation");
} else {
return loadedUser;
}
} catch (UsernameNotFoundException var4) {
this.mitigateAgainstTimingAttack(authentication);
throw var4;
} catch (InternalAuthenticationServiceException var5) {
throw var5;
} catch (Exception var6) {
throw new InternalAuthenticationServiceException(var6.getMessage(), var6);
}
}
@Override
protected Authentication createSuccessAuthentication(Object principal, Authentication authentication,
UserDetails user) {
boolean upgradeEncoding = this.userDetailsPasswordService != null
&& this.passwordEncoder.upgradeEncoding(user.getPassword());
if (upgradeEncoding) {
String presentedPassword = authentication.getCredentials().toString();
String newPassword = this.passwordEncoder.encode(presentedPassword);
user = this.userDetailsPasswordService.updatePassword(user, newPassword);
}
return super.createSuccessAuthentication(principal, authentication, user);
}
private void prepareTimingAttackProtection() {
if (this.userNotFoundEncodedPassword == null) {
this.userNotFoundEncodedPassword = this.passwordEncoder.encode(USER_NOT_FOUND_PASSWORD);
}
}
private void mitigateAgainstTimingAttack(UsernamePasswordAuthenticationToken authentication) {
if (authentication.getCredentials() != null) {
String presentedPassword = authentication.getCredentials().toString();
this.passwordEncoder.matches(presentedPassword, this.userNotFoundEncodedPassword);
}
}
/**
* Sets the PasswordEncoder instance to be used to encode and validate passwords. If
* not set, the password will be compared using
* {@link PasswordEncoderFactories#createDelegatingPasswordEncoder()}
* @param passwordEncoder must be an instance of one of the {@code PasswordEncoder}
* types.
*/
public void setPasswordEncoder(PasswordEncoder passwordEncoder) {
Assert.notNull(passwordEncoder, "passwordEncoder cannot be null");
this.passwordEncoder = passwordEncoder;
this.userNotFoundEncodedPassword = null;
}
protected PasswordEncoder getPasswordEncoder() {
return this.passwordEncoder;
}
public void setUserDetailsService(CustomUserDetailsService userDetailsService) {
this.userDetailsService = userDetailsService;
}
protected CustomUserDetailsService getUserDetailsService() {
return this.userDetailsService;
}
public void setUserDetailsPasswordService(UserDetailsPasswordService userDetailsPasswordService) {
this.userDetailsPasswordService = userDetailsPasswordService;
}
}
... ...
package com.zhonglai.luhui.security.service;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
public interface CustomUserDetailsService extends UserDetailsService {
UserDetails loadUserByUsername(String username, String usertype) throws UsernameNotFoundException;
}
... ...
package com.zhonglai.luhui.security.service;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
@Service
public class UserDetailsServiceImpl implements CustomUserDetailsService {
@Override
public UserDetails loadUserByUsername(String username, String usertype) throws UsernameNotFoundException {
return null;
}
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
return null;
}
}
... ...
... ... @@ -35,12 +35,6 @@
<artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency>
<!-- 自定义验证注解 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<!--常用工具类 -->
<dependency>
<groupId>org.apache.commons</groupId>
... ... @@ -145,7 +139,6 @@
</dependency>
<!-- 自定义验证注解 -->
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-validation -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
... ...
... ... @@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>Luhui</artifactId>
<artifactId>lh-common</artifactId>
<groupId>com.zhonglai.luhui</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
... ...
package com.ruoyi.framework.web.domain.server;
import com.ruoyi.common.utils.Arith;
/**
* CPU相关信息
*
* @author ruoyi
*/
public class Cpu
{
/**
* 核心数
*/
private int cpuNum;
/**
* CPU总的使用率
*/
private double total;
/**
* CPU系统使用率
*/
private double sys;
/**
* CPU用户使用率
*/
private double used;
/**
* CPU当前等待率
*/
private double wait;
/**
* CPU当前空闲率
*/
private double free;
public int getCpuNum()
{
return cpuNum;
}
public void setCpuNum(int cpuNum)
{
this.cpuNum = cpuNum;
}
public double getTotal()
{
return Arith.round(Arith.mul(total, 100), 2);
}
public void setTotal(double total)
{
this.total = total;
}
public double getSys()
{
return Arith.round(Arith.mul(sys / total, 100), 2);
}
public void setSys(double sys)
{
this.sys = sys;
}
public double getUsed()
{
return Arith.round(Arith.mul(used / total, 100), 2);
}
public void setUsed(double used)
{
this.used = used;
}
public double getWait()
{
return Arith.round(Arith.mul(wait / total, 100), 2);
}
public void setWait(double wait)
{
this.wait = wait;
}
public double getFree()
{
return Arith.round(Arith.mul(free / total, 100), 2);
}
public void setFree(double free)
{
this.free = free;
}
}
... ...
package com.ruoyi.framework.web.domain.server;
import com.ruoyi.common.utils.Arith;
import com.ruoyi.common.utils.DateUtils;
import java.lang.management.ManagementFactory;
/**
* JVM相关信息
*
* @author ruoyi
*/
public class Jvm
{
/**
* 当前JVM占用的内存总数(M)
*/
private double total;
/**
* JVM最大可用内存总数(M)
*/
private double max;
/**
* JVM空闲内存(M)
*/
private double free;
/**
* JDK版本
*/
private String version;
/**
* JDK路径
*/
private String home;
public double getTotal()
{
return Arith.div(total, (1024 * 1024), 2);
}
public void setTotal(double total)
{
this.total = total;
}
public double getMax()
{
return Arith.div(max, (1024 * 1024), 2);
}
public void setMax(double max)
{
this.max = max;
}
public double getFree()
{
return Arith.div(free, (1024 * 1024), 2);
}
public void setFree(double free)
{
this.free = free;
}
public double getUsed()
{
return Arith.div(total - free, (1024 * 1024), 2);
}
public double getUsage()
{
return Arith.mul(Arith.div(total - free, total, 4), 100);
}
/**
* 获取JDK名称
*/
public String getName()
{
return ManagementFactory.getRuntimeMXBean().getVmName();
}
public String getVersion()
{
return version;
}
public void setVersion(String version)
{
this.version = version;
}
public String getHome()
{
return home;
}
public void setHome(String home)
{
this.home = home;
}
/**
* JDK启动时间
*/
public String getStartTime()
{
return DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.getServerStartDate());
}
/**
* JDK运行时间
*/
public String getRunTime()
{
return DateUtils.getDatePoor(DateUtils.getNowDate(), DateUtils.getServerStartDate());
}
/**
* 运行参数
*/
public String getInputArgs()
{
return ManagementFactory.getRuntimeMXBean().getInputArguments().toString();
}
}
... ...
package com.ruoyi.framework.web.domain.server;
import com.ruoyi.common.utils.Arith;
/**
* 內存相关信息
*
* @author ruoyi
*/
public class Mem
{
/**
* 内存总量
*/
private double total;
/**
* 已用内存
*/
private double used;
/**
* 剩余内存
*/
private double free;
public double getTotal()
{
return Arith.div(total, (1024 * 1024 * 1024), 2);
}
public void setTotal(long total)
{
this.total = total;
}
public double getUsed()
{
return Arith.div(used, (1024 * 1024 * 1024), 2);
}
public void setUsed(long used)
{
this.used = used;
}
public double getFree()
{
return Arith.div(free, (1024 * 1024 * 1024), 2);
}
public void setFree(long free)
{
this.free = free;
}
public double getUsage()
{
return Arith.mul(Arith.div(used, total, 4), 100);
}
}
... ...
package com.ruoyi.framework.web.domain.server;
/**
* 系统相关信息
*
* @author ruoyi
*/
public class Sys
{
/**
* 服务器名称
*/
private String computerName;
/**
* 服务器Ip
*/
private String computerIp;
/**
* 项目路径
*/
private String userDir;
/**
* 操作系统
*/
private String osName;
/**
* 系统架构
*/
private String osArch;
public String getComputerName()
{
return computerName;
}
public void setComputerName(String computerName)
{
this.computerName = computerName;
}
public String getComputerIp()
{
return computerIp;
}
public void setComputerIp(String computerIp)
{
this.computerIp = computerIp;
}
public String getUserDir()
{
return userDir;
}
public void setUserDir(String userDir)
{
this.userDir = userDir;
}
public String getOsName()
{
return osName;
}
public void setOsName(String osName)
{
this.osName = osName;
}
public String getOsArch()
{
return osArch;
}
public void setOsArch(String osArch)
{
this.osArch = osArch;
}
}
... ...
package com.ruoyi.framework.web.domain.server;
/**
* 系统文件相关信息
*
* @author ruoyi
*/
public class SysFile
{
/**
* 盘符路径
*/
private String dirName;
/**
* 盘符类型
*/
private String sysTypeName;
/**
* 文件类型
*/
private String typeName;
/**
* 总大小
*/
private String total;
/**
* 剩余大小
*/
private String free;
/**
* 已经使用量
*/
private String used;
/**
* 资源的使用率
*/
private double usage;
public String getDirName()
{
return dirName;
}
public void setDirName(String dirName)
{
this.dirName = dirName;
}
public String getSysTypeName()
{
return sysTypeName;
}
public void setSysTypeName(String sysTypeName)
{
this.sysTypeName = sysTypeName;
}
public String getTypeName()
{
return typeName;
}
public void setTypeName(String typeName)
{
this.typeName = typeName;
}
public String getTotal()
{
return total;
}
public void setTotal(String total)
{
this.total = total;
}
public String getFree()
{
return free;
}
public void setFree(String free)
{
this.free = free;
}
public String getUsed()
{
return used;
}
public void setUsed(String used)
{
this.used = used;
}
public double getUsage()
{
return usage;
}
public void setUsage(double usage)
{
this.usage = usage;
}
}
... ...
... ... @@ -219,8 +219,8 @@ public class GenController extends BaseController
@ApiOperation("从数据库结构生成代码")
@ApiImplicitParam(value = "表名集合",name = "tableNames")
@GetMapping("/generatorCodeFromDb")
public void generatorCodeFromDb(HttpServletResponse response,String databaseName, String tableNames,String packageName) throws IOException {
byte[] data = genTableService.generatorCodeFromDb(databaseName,tableNames,packageName);
public void generatorCodeFromDb(HttpServletResponse response,String databaseName, String tableNames,String packageName,String dataSource) throws IOException {
byte[] data = genTableService.generatorCodeFromDb(databaseName,tableNames,packageName,dataSource);
genCode(response, data);
}
... ...
... ... @@ -5,6 +5,7 @@ import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import com.ruoyi.common.annotation.PublicSQLConfig;
import com.zhonglai.luhui.datasource.enums.DataSourceType;
import org.apache.commons.lang3.ArrayUtils;
import com.ruoyi.common.constant.GenConstants;
import com.ruoyi.common.tool.BaseEntity;
... ... @@ -98,6 +99,8 @@ public class GenTable extends BaseEntity
/** 上级菜单名称字段 */
private String parentMenuName;
private String dataSource;
public Long getTableId()
{
return tableId;
... ... @@ -372,4 +375,12 @@ public class GenTable extends BaseEntity
}
return StringUtils.equalsAnyIgnoreCase(javaField, GenConstants.BASE_ENTITY);
}
public String getDataSource() {
return dataSource;
}
public void setDataSource(String dataSource) {
this.dataSource = dataSource;
}
}
\ No newline at end of file
... ...
... ... @@ -262,7 +262,7 @@ public class GenTableServiceImpl implements IGenTableService
*/
@DataSource(value = DataSourceType.SLAVE)
@Override
public byte[] generatorCodeFromDb(String databaseName,String tableNames,String packageName)
public byte[] generatorCodeFromDb(String databaseName,String tableNames,String packageName,String dataSource)
{
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
ZipOutputStream zip = new ZipOutputStream(outputStream);
... ... @@ -270,7 +270,7 @@ public class GenTableServiceImpl implements IGenTableService
for (String tableName:tableNames.split(","))
{
// 查询表信息
GenTable table = generatorFromTablename(databaseName,tableName,packageName);
GenTable table = generatorFromTablename(databaseName,tableName,packageName,dataSource);
generatorCode(table, zip);
}
IOUtils.closeQuietly(zip);
... ... @@ -314,7 +314,7 @@ public class GenTableServiceImpl implements IGenTableService
}
}
public GenTable generatorFromTablename(String databaseName,String tableName,String packageName)
public GenTable generatorFromTablename(String databaseName,String tableName,String packageName,String dataSource)
{
List<Map<String,Object>> list = mapMapper.getObjectListBySQL("SELECT COLUMN_NAME,ORDINAL_POSITION,COLUMN_DEFAULT,IS_NULLABLE,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH,CHARACTER_OCTET_LENGTH,NUMERIC_PRECISION,NUMERIC_SCALE,DATETIME_PRECISION,CHARACTER_SET_NAME,COLLATION_NAME,COLUMN_TYPE,COLUMN_KEY,EXTRA,COLUMN_COMMENT FROM information_schema.columns WHERE table_schema = '"+databaseName+"' AND table_name = '"+tableName+"'");
Map<String,Object> map = mapMapper.getObjectListBySQL("SELECT TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name='"+tableName+"' AND table_schema='"+databaseName+"'").get(0);
... ... @@ -332,7 +332,7 @@ public class GenTableServiceImpl implements IGenTableService
genTable.setFunctionAuthor("钟来");
genTable.setGenType("1");
genTable.setGenPath("/");
genTable.setDataSource("DataSourceType."+dataSource);
List<GenTableColumn> columns = new ArrayList<>();
for(Map<String,Object> table:list)
{
... ...
... ... @@ -124,5 +124,5 @@ public interface IGenTableService
*
* @param tableName 表名称
*/
public byte[] generatorCodeFromDb(String databaseName,String tableName,String packageName);
public byte[] generatorCodeFromDb(String databaseName,String tableName,String packageName,String dataSource);
}
... ...
... ... @@ -276,7 +276,7 @@ public class GenUtils
case "mediumint":return "Integer";
case "bit":return "Boolean";
case "bigint":return "java.math.BigInteger";
case "float":return "Fload";
case "float":return "Float";
case "double":return "Double";
case "decimal":return "java.math.BigDecimal";
case "boolean":return "Boolean";
... ... @@ -294,6 +294,7 @@ public class GenUtils
case "int":return "Integer";
case "longblob":return "String";
case "mediumtext":return "String";
case "enum":return "Enum";
default:
System.out.println("-----------------》转化失败:未发现的类型"+sqlType);
break;
... ...
... ... @@ -60,6 +60,7 @@ public class VelocityUtils
velocityContext.put("columns", genTable.getColumns());
velocityContext.put("table", genTable);
velocityContext.put("dicts", getDicts(genTable));
velocityContext.put("dataSource", genTable.getDataSource());
setMenuVelocityContext(velocityContext, genTable);
if (GenConstants.TPL_TREE.equals(tplCategory))
{
... ...
... ... @@ -5,7 +5,7 @@ import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
##import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
... ... @@ -45,7 +45,7 @@ public class ${ClassName}Controller extends BaseController
* 查询${functionName}列表
*/
@ApiOperation("查询${functionName}列表")
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')")
## @PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')")
@GetMapping("/list")
#if($table.crud || $table.sub)
public TableDataInfo list(${ClassName} ${className})
... ... @@ -66,7 +66,7 @@ public class ${ClassName}Controller extends BaseController
* 导出${functionName}列表
*/
@ApiOperation("导出${functionName}列表")
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
## @PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')")
@Log(title = "${functionName}", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ${ClassName} ${className})
... ... @@ -80,7 +80,7 @@ public class ${ClassName}Controller extends BaseController
* 获取${functionName}详细信息
*/
@ApiOperation("获取${functionName}详细信息")
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')")
## @PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')")
@GetMapping(value = "/{${pkColumn.javaField}}")
public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField})
{
... ... @@ -91,7 +91,7 @@ public class ${ClassName}Controller extends BaseController
* 新增${functionName}
*/
@ApiOperation("新增${functionName}")
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:add')")
## @PreAuthorize("@ss.hasPermi('${permissionPrefix}:add')")
@Log(title = "${functionName}", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ${ClassName} ${className})
... ... @@ -103,7 +103,7 @@ public class ${ClassName}Controller extends BaseController
* 修改${functionName}
*/
@ApiOperation("修改${functionName}")
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:edit')")
## @PreAuthorize("@ss.hasPermi('${permissionPrefix}:edit')")
@Log(title = "${functionName}", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ${ClassName} ${className})
... ... @@ -115,7 +115,7 @@ public class ${ClassName}Controller extends BaseController
* 删除${functionName}
*/
@ApiOperation("删除${functionName}")
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')")
## @PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')")
@Log(title = "${functionName}", businessType = BusinessType.DELETE)
@DeleteMapping("/{${pkColumn.javaField}s}")
public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s)
... ...
... ... @@ -7,6 +7,11 @@ import com.ruoyi.common.utils.DateUtils;
#break
#end
#end
#if($dataSource)
import com.zhonglai.luhui.datasource.enums.DataSource;
import com.zhonglai.luhui.datasource.enums.DataSourceType;
#end
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
#if($table.sub)
... ... @@ -37,6 +42,9 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
* @param ${pkColumn.javaField} ${functionName}主键
* @return ${functionName}
*/
#if($dataSource)
@DataSource(${dataSource})
#end
@Override
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField})
{
... ... @@ -49,6 +57,9 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
* @param ${className} ${functionName}
* @return ${functionName}
*/
#if($dataSource)
@DataSource(${dataSource})
#end
@Override
public List<${ClassName}> select${ClassName}List(${ClassName} ${className})
{
... ... @@ -61,6 +72,9 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
* @param ${className} ${functionName}
* @return 结果
*/
#if($dataSource)
@DataSource(${dataSource})
#end
#if($table.sub)
@Transactional
#end
... ... @@ -87,6 +101,9 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
* @param ${className} ${functionName}
* @return 结果
*/
#if($dataSource)
@DataSource(${dataSource})
#end
#if($table.sub)
@Transactional
#end
... ... @@ -111,6 +128,9 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
* @param ${pkColumn.javaField}s 需要删除的${functionName}主键
* @return 结果
*/
#if($dataSource)
@DataSource(${dataSource})
#end
#if($table.sub)
@Transactional
#end
... ... @@ -129,6 +149,9 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
* @param ${pkColumn.javaField} ${functionName}主键
* @return 结果
*/
#if($dataSource)
@DataSource(${dataSource})
#end
#if($table.sub)
@Transactional
#end
... ... @@ -147,6 +170,9 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
*
* @param ${className} ${functionName}对象
*/
#if($dataSource)
@DataSource(${dataSource})
#end
public void insert${subClassName}(${ClassName} ${className})
{
List<${subClassName}> ${subclassName}List = ${className}.get${subClassName}List();
... ...
... ... @@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>Luhui</artifactId>
<artifactId>lh-modules</artifactId>
<groupId>com.zhonglai.luhui</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
... ...