提交 c6f8e218 编写于 作者: zhouweidong's avatar zhouweidong

代码格式化

上级 0659452a
...@@ -55,13 +55,13 @@ import java.util.List; ...@@ -55,13 +55,13 @@ import java.util.List;
com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure.class com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure.class
</#if> </#if>
}) })
public class ${app.getPKGCodeName()}Application extends WebMvcConfigurerAdapter{ public class ${app.getPKGCodeName()}Application extends WebMvcConfigurerAdapter {
@Autowired @Autowired
SearchContextHandlerMethodArgumentResolver resolver; SearchContextHandlerMethodArgumentResolver resolver;
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(${app.getPKGCodeName()}Application.class,args); SpringApplication.run(${app.getPKGCodeName()}Application.class, args);
} }
@Override @Override
......
...@@ -115,10 +115,10 @@ public class ${app.getPKGCodeName()}SecurityConfig extends WebSecurityConfigurer ...@@ -115,10 +115,10 @@ public class ${app.getPKGCodeName()}SecurityConfig extends WebSecurityConfigurer
"/**/svg/**", "/**/svg/**",
"/" "/"
).permitAll() ).permitAll()
//放行登录请求 // 放行登录请求
.antMatchers( HttpMethod.POST,"/"+loginPath).permitAll() .antMatchers( HttpMethod.POST, "/"+loginPath).permitAll()
//放行注销请求 // 放行注销请求
.antMatchers( HttpMethod.GET,"/"+logoutPath).permitAll() .antMatchers( HttpMethod.GET, "/"+logoutPath).permitAll()
// 文件操作 // 文件操作
.antMatchers("/"+downloadpath+"/**").permitAll() .antMatchers("/"+downloadpath+"/**").permitAll()
.antMatchers("/"+uploadpath).permitAll() .antMatchers("/"+uploadpath).permitAll()
......
...@@ -50,8 +50,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -50,8 +50,8 @@ import org.springframework.beans.factory.annotation.Autowired;
</#if> </#if>
}) })
@ComponentScan(basePackages = {"${pub.getPKGCodeName()}"} @ComponentScan(basePackages = {"${pub.getPKGCodeName()}"}
// ,excludeFilters={ // ,excludeFilters = {
// @ComponentScan.Filter(type= org.springframework.context.annotation.FilterType.REGEX,pattern="${pub.getPKGCodeName()}.xxx.rest.xxx"), // @ComponentScan.Filter(type= org.springframework.context.annotation.FilterType.REGEX, pattern="${pub.getPKGCodeName()}.xxx.rest.xxx"),
// } // }
) )
@Import({ @Import({
...@@ -59,13 +59,13 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -59,13 +59,13 @@ import org.springframework.beans.factory.annotation.Autowired;
}) })
@EnableAsync @EnableAsync
@EnableScheduling @EnableScheduling
public class DevBootApplication extends WebMvcConfigurerAdapter{ public class DevBootApplication extends WebMvcConfigurerAdapter {
@Autowired @Autowired
SearchContextHandlerMethodArgumentResolver resolver; SearchContextHandlerMethodArgumentResolver resolver;
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(DevBootApplication.class,args); SpringApplication.run(DevBootApplication.class, args);
} }
@Override @Override
......
...@@ -113,9 +113,9 @@ public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -113,9 +113,9 @@ public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter {
"/v2/**" "/v2/**"
).permitAll() ).permitAll()
//放行登录请求 //放行登录请求
.antMatchers( HttpMethod.POST,"/"+loginPath).permitAll() .antMatchers( HttpMethod.POST, "/"+loginPath).permitAll()
//放行注销请求 //放行注销请求
.antMatchers( HttpMethod.GET,"/"+logoutPath).permitAll() .antMatchers( HttpMethod.GET, "/"+logoutPath).permitAll()
// 文件操作 // 文件操作
.antMatchers("/"+downloadpath+"/**").permitAll() .antMatchers("/"+downloadpath+"/**").permitAll()
.antMatchers("/"+uploadpath).permitAll() .antMatchers("/"+uploadpath).permitAll()
......
...@@ -12,11 +12,11 @@ public interface ${de.codeName}${item.codeName} { ...@@ -12,11 +12,11 @@ public interface ${de.codeName}${item.codeName} {
<#assign keyFieldName=srfcaseformat(de.getKeyPSDEField().getCodeName(),'l_u2lC')> <#assign keyFieldName=srfcaseformat(de.getKeyPSDEField().getCodeName(),'l_u2lC')>
<#if item.getPSDEDataImportItems?? && item.getPSDEDataImportItems()??> <#if item.getPSDEDataImportItems?? && item.getPSDEDataImportItems()??>
@Mappings({ @Mappings({
@Mapping(target = "${keyFieldName}",source = "${keyFieldName}"), @Mapping(target = "${keyFieldName}", source = "${keyFieldName}"),
<#list item.getPSDEDataImportItems() as importItem> <#list item.getPSDEDataImportItems() as importItem>
<#if importItem.getPSDEField()?? && importItem.getPSDEField().isKeyDEField()==false> <#if importItem.getPSDEField()?? && importItem.getPSDEField().isKeyDEField()==false>
<#assign deFieldName = srfcaseformat(importItem.getPSDEField().getCodeName(),'l_u2lC')> <#assign deFieldName = srfcaseformat(importItem.getPSDEField().getCodeName(),'l_u2lC')>
@Mapping(target = "${deFieldName}",source = "${deFieldName}"), @Mapping(target = "${deFieldName}", source = "${deFieldName}"),
</#if> </#if>
</#list> </#list>
}) })
......
...@@ -5,19 +5,13 @@ TARGET=PSDELOGIC ...@@ -5,19 +5,13 @@ TARGET=PSDELOGIC
<#assign startWF=false> <#assign startWF=false>
package ${pub.getPKGCodeName()}.core.${item.getPSDataEntity().getPSSystemModule().getCodeName()?lower_case}.service.logic.impl; package ${pub.getPKGCodeName()}.core.${item.getPSDataEntity().getPSSystemModule().getCodeName()?lower_case}.service.logic.impl;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.HashMap; import java.util.HashMap;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.kie.api.runtime.KieSession; import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.KieContainer; import org.kie.api.runtime.KieContainer;
import ${pub.getPKGCodeName()}.core.${item.getPSDataEntity().getPSSystemModule().getCodeName()?lower_case}.service.logic.I${de.codeName}${item.codeName}Logic; import ${pub.getPKGCodeName()}.core.${item.getPSDataEntity().getPSSystemModule().getCodeName()?lower_case}.service.logic.I${de.codeName}${item.codeName}Logic;
import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.domain.${de.getCodeName()}; import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.domain.${de.getCodeName()};
...@@ -68,9 +62,9 @@ public class ${de.codeName}${item.codeName}LogicImpl implements I${de.codeName}$ ...@@ -68,9 +62,9 @@ public class ${de.codeName}${item.codeName}LogicImpl implements I${de.codeName}$
@Override @Override
public void execute(${de.codeName} et) { public void execute(${de.codeName} et) {
KieSession kieSession = null; KieSession kieSession = null;
try{ try {
kieSession = kieContainer.newKieSession(); kieSession = kieContainer.newKieSession();
<#comment>插入逻辑参数</#comment> <#comment>插入逻辑参数</#comment>
<#if item.getPSDELogicParams?? && item.getPSDELogicParams()??> <#if item.getPSDELogicParams?? && item.getPSDELogicParams()??>
<#assign logicName=(de.codeName+item.codeName)?lower_case> <#assign logicName=(de.codeName+item.codeName)?lower_case>
...@@ -81,12 +75,12 @@ public class ${de.codeName}${item.codeName}LogicImpl implements I${de.codeName}$ ...@@ -81,12 +75,12 @@ public class ${de.codeName}${item.codeName}LogicImpl implements I${de.codeName}$
<#assign paramObjValue="et"> <#assign paramObjValue="et">
<#elseif logicParam.getParamPSDataEntity?? && logicParam.getParamPSDataEntity()??> <#elseif logicParam.getParamPSDataEntity?? && logicParam.getParamPSDataEntity()??>
<#assign ParamPSDataEntity=logicParam.getParamPSDataEntity()> <#assign ParamPSDataEntity=logicParam.getParamPSDataEntity()>
${pub.getPKGCodeName()}.core.${ParamPSDataEntity.getPSSystemModule().codeName?lower_case}.domain.${ParamPSDataEntity.codeName} ${(logicName+logicParam.codeName)?lower_case} = new ${pub.getPKGCodeName()}.core.${ParamPSDataEntity.getPSSystemModule().codeName?lower_case}.domain.${ParamPSDataEntity.codeName}(); ${pub.getPKGCodeName()}.core.${ParamPSDataEntity.getPSSystemModule().codeName?lower_case}.domain.${ParamPSDataEntity.codeName} ${(logicName+logicParam.codeName)?lower_case} = new ${pub.getPKGCodeName()}.core.${ParamPSDataEntity.getPSSystemModule().codeName?lower_case}.domain.${ParamPSDataEntity.codeName}();
<#else> <#else>
Map ${(logicName+logicParam.codeName)?lower_case} = new HashMap(); Map ${(logicName+logicParam.codeName)?lower_case} = new HashMap();
</#if> </#if>
kieSession.insert(${paramObjValue}); <#comment>将逻辑参数存储到fact</#comment> kieSession.insert(${paramObjValue}); <#comment>将逻辑参数存储到fact</#comment>
kieSession.setGlobal("${paramObj}", ${paramObjValue});<#comment>将逻辑参数存储到global</#comment> kieSession.setGlobal("${paramObj}", ${paramObjValue});<#comment>将逻辑参数存储到global</#comment>
</#list> </#list>
</#if> </#if>
<#comment>插入处理逻辑中所用到的service对象</#comment> <#comment>插入处理逻辑中所用到的service对象</#comment>
...@@ -94,29 +88,28 @@ public class ${de.codeName}${item.codeName}LogicImpl implements I${de.codeName}$ ...@@ -94,29 +88,28 @@ public class ${de.codeName}${item.codeName}LogicImpl implements I${de.codeName}$
<#list item.getPSDELogicNodes() as deLogicNode> <#list item.getPSDELogicNodes() as deLogicNode>
<#if deLogicNode.getDstPSDataEntity?? && deLogicNode.getDstPSDataEntity()??> <#if deLogicNode.getDstPSDataEntity?? && deLogicNode.getDstPSDataEntity()??>
<#if !P.exists(item.codeName,"kieSessionGlobalService",deLogicNode.getDstPSDataEntity().getCodeName()?lower_case)> <#if !P.exists(item.codeName,"kieSessionGlobalService",deLogicNode.getDstPSDataEntity().getCodeName()?lower_case)>
kieSession.setGlobal("${deLogicNode.getDstPSDataEntity().getCodeName()?lower_case}service", ${deLogicNode.getDstPSDataEntity().getCodeName()?lower_case}service);<#comment>将逻辑中引用到的service存储到global</#comment> kieSession.setGlobal("${deLogicNode.getDstPSDataEntity().getCodeName()?lower_case}service", ${deLogicNode.getDstPSDataEntity().getCodeName()?lower_case}service);<#comment>将逻辑中引用到的service存储到global</#comment>
</#if> </#if>
</#if> </#if>
</#list> </#list>
</#if> </#if>
<#comment>插入当前实体的defaultService对象,供自定义查询使用</#comment> <#comment>插入当前实体的defaultService对象,供自定义查询使用</#comment>
kieSession.setGlobal("iBzSys${de.codeName?lower_case?cap_first}DefaultService", iBzSysDefaultService);<#comment>将逻辑中引用到的service存储到global</#comment> kieSession.setGlobal("iBzSys${de.codeName?lower_case?cap_first}DefaultService", iBzSysDefaultService);<#comment>将逻辑中引用到的service存储到global</#comment>
kieSession.setGlobal("curuser", ${pub.getPKGCodeName()}.util.security.AuthenticationUser.getAuthenticationUser()); kieSession.setGlobal("curuser", ${pub.getPKGCodeName()}.util.security.AuthenticationUser.getAuthenticationUser());
<#comment>插入wfclient</#comment> <#comment>插入wfclient</#comment>
<#if startWF> <#if startWF>
kieSession.setGlobal("wfClient", wfClient); kieSession.setGlobal("wfClient", wfClient);
</#if> </#if>
kieSession.startProcess("${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.service.logic.${de.codeName?lower_case}${item.getCodeName()?lower_case}");<#comment>执行所要执行的流程</#comment> kieSession.startProcess("${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.service.logic.${de.codeName?lower_case}${item.getCodeName()?lower_case}");<#comment>执行所要执行的流程</#comment>
}catch(Exception e) { } catch (Exception e) {
throw new RuntimeException("执行[${item.getName()}]处理逻辑发生异常"+e); throw new RuntimeException("执行[${item.getName()}]处理逻辑发生异常" + e);
<#--throw new BadRequestAlertException(""+e,"","");--> <#--throw new BadRequestAlertException(""+e,"","");-->
}finally { } finally {
if(kieSession!=null) { if(kieSession != null) {
kieSession.destroy(); kieSession.destroy();
} }
} }
} }
} }
</#if> </#if>
\ No newline at end of file
...@@ -27,7 +27,7 @@ import org.springframework.context.annotation.Import; ...@@ -27,7 +27,7 @@ import org.springframework.context.annotation.Import;
@ConditionalOnClass(${item.codeName}RestConfiguration.class) @ConditionalOnClass(${item.codeName}RestConfiguration.class)
@ConditionalOnWebApplication @ConditionalOnWebApplication
@EnableConfigurationProperties(${item.codeName}ServiceProperties.class) @EnableConfigurationProperties(${item.codeName}ServiceProperties.class)
public class ${item.codeName}AutoConfiguration implements ApplicationContextAware{ public class ${item.codeName}AutoConfiguration implements ApplicationContextAware {
protected ApplicationContext applicationContext; protected ApplicationContext applicationContext;
......
...@@ -118,9 +118,9 @@ public class ${item.codeName}SecurityConfig extends WebSecurityConfigurerAdapter ...@@ -118,9 +118,9 @@ public class ${item.codeName}SecurityConfig extends WebSecurityConfigurerAdapter
"/v2/**" "/v2/**"
).permitAll() ).permitAll()
//放行登录请求 //放行登录请求
.antMatchers( HttpMethod.POST,"/"+loginPath).permitAll() .antMatchers( HttpMethod.POST, "/"+loginPath).permitAll()
//放行注销请求 //放行注销请求
.antMatchers( HttpMethod.GET,"/"+logoutPath).permitAll() .antMatchers( HttpMethod.GET, "/"+logoutPath).permitAll()
// 文件操作 // 文件操作
.antMatchers("/"+downloadpath+"/**").permitAll() .antMatchers("/"+downloadpath+"/**").permitAll()
.antMatchers("/"+uploadpath).permitAll() .antMatchers("/"+uploadpath).permitAll()
......
...@@ -23,12 +23,12 @@ public interface AuthenticationUserService extends UserDetailsService { ...@@ -23,12 +23,12 @@ public interface AuthenticationUserService extends UserDetailsService {
</#if> </#if>
@Override @Override
@Cacheable( value="${cachename}",key = "'getByUsername:'+#p0") @Cacheable( value="${cachename}", key = "'getByUsername:'+#p0")
AuthenticationUser loadUserByUsername(String username); AuthenticationUser loadUserByUsername(String username);
@Cacheable( value="${cachename}",key = "'getByUsername:'+#p0") @Cacheable( value="${cachename}", key = "'getByUsername:'+#p0")
AuthenticationUser loadUserByLogin(String username,String password); AuthenticationUser loadUserByLogin(String username,String password);
@CacheEvict( value="${cachename}",key = "'getByUsername:'+#p0") @CacheEvict( value="${cachename}", key = "'getByUsername:'+#p0")
void resetByUsername(String username); void resetByUsername(String username);
} }
...@@ -34,39 +34,39 @@ public class IBZConfigService extends ServiceImpl<IBZConfigMapper, IBZConfig> im ...@@ -34,39 +34,39 @@ public class IBZConfigService extends ServiceImpl<IBZConfigMapper, IBZConfig> im
@Value("${r'${'}ibiz.admin.userid:0100}") @Value("${r'${'}ibiz.admin.userid:0100}")
private String adminuserid; private String adminuserid;
@Cacheable( value="${cachename}",key = "'cfgid:'+#p0+'||'+#p1+'||'+#p2") @Cacheable(value="${cachename}",key = "'cfgid:'+#p0+'||'+#p1+'||'+#p2")
public JSONObject getConfig(String cfgType,String targetType,String userId) public JSONObject getConfig(String cfgType,String targetType,String userId)
{ {
if(StringUtils.isEmpty(userId)||StringUtils.isEmpty(cfgType)||StringUtils.isEmpty(targetType)){ if(StringUtils.isEmpty(userId) || StringUtils.isEmpty(cfgType) || StringUtils.isEmpty(targetType)) {
throw new BadRequestAlertException("获取配置失败,参数缺失","IBZConfig",cfgType); throw new BadRequestAlertException("获取配置失败,参数缺失","IBZConfig",cfgType);
} }
IBZConfig config=this.getOne(Wrappers.query(IBZConfig.builder().systemId(systemId).cfgType(cfgType).targetType(targetType).userId(userId).build()),false); IBZConfig config = this.getOne(Wrappers.query(IBZConfig.builder().systemId(systemId).cfgType(cfgType).targetType(targetType).userId(userId).build()), false);
if(config==null) { if(config == null) {
config=this.getOne(Wrappers.query(IBZConfig.builder().systemId(systemId).cfgType(cfgType).targetType(targetType).userId(adminuserid).build()),false); config = this.getOne(Wrappers.query(IBZConfig.builder().systemId(systemId).cfgType(cfgType).targetType(targetType).userId(adminuserid).build()), false);
if(config==null) { if(config == null) {
return new JSONObject(); return new JSONObject();
} }
} }
return JSON.parseObject(config.getCfg()); return JSON.parseObject(config.getCfg());
} }
@CacheEvict( value="${cachename}",key = "'cfgid:'+#p0+'||'+#p1+'||'+#p2") @CacheEvict(value="${cachename}", key = "'cfgid:'+#p0+'||'+#p1+'||'+#p2")
public boolean saveConfig(String cfgType,String targetType,String userId,JSONObject config) public boolean saveConfig(String cfgType, String targetType, String userId, JSONObject config)
{ {
if(StringUtils.isEmpty(userId)||StringUtils.isEmpty(cfgType)||StringUtils.isEmpty(targetType)){ if(StringUtils.isEmpty(userId) || StringUtils.isEmpty(cfgType) || StringUtils.isEmpty(targetType)) {
throw new BadRequestAlertException("保存配置失败,参数缺失","IBZConfig",cfgType); throw new BadRequestAlertException("保存配置失败,参数缺失","IBZConfig",cfgType);
} }
String cfg="{}"; String cfg = "{}";
if(config!=null){ if(config != null) {
cfg=JSONObject.toJSONString(config); cfg = JSONObject.toJSONString(config);
} }
return this.saveOrUpdate(IBZConfig.builder().systemId(systemId).cfgType(cfgType).targetType(targetType).userId(userId).cfg(cfg).updateDate(DataObject.getNow()).build()); return this.saveOrUpdate(IBZConfig.builder().systemId(systemId).cfgType(cfgType).targetType(targetType).userId(userId).cfg(cfg).updateDate(DataObject.getNow()).build());
} }
@CacheEvict( value="${cachename}",key = "'cfgid:'+#p0+'||'+#p1+'||'+#p2") @CacheEvict(value = "${cachename}", key = "'cfgid:'+#p0+'||'+#p1+'||'+#p2")
public void resetConfig(String cfgType,String targetType,String userId) public void resetConfig(String cfgType, String targetType, String userId)
{ {
if(StringUtils.isEmpty(userId)||StringUtils.isEmpty(cfgType)||StringUtils.isEmpty(targetType)){ if(StringUtils.isEmpty(userId) || StringUtils.isEmpty(cfgType) || StringUtils.isEmpty(targetType)) {
throw new BadRequestAlertException("重置配置失败,参数缺失","IBZConfig",cfgType); throw new BadRequestAlertException("重置配置失败,参数缺失","IBZConfig",cfgType);
} }
this.remove(Wrappers.query(IBZConfig.builder().systemId(systemId).cfgType(cfgType).targetType(targetType).userId(userId).build())); this.remove(Wrappers.query(IBZConfig.builder().systemId(systemId).cfgType(cfgType).targetType(targetType).userId(userId).build()));
......
...@@ -14,9 +14,9 @@ import java.util.Map; ...@@ -14,9 +14,9 @@ import java.util.Map;
*/ */
public interface IBZDataAuditService { public interface IBZDataAuditService {
@Async("asyncExecutor") @Async("asyncExecutor")
void createAudit(HttpServletRequest request,EntityBase entity,Object idValue,Map<String, Audit> auditFields); void createAudit(HttpServletRequest request, EntityBase entity, Object idValue, Map<String, Audit> auditFields);
@Async("asyncExecutor") @Async("asyncExecutor")
void updateAudit(HttpServletRequest request, EntityBase beforeEntity, Object serviceObj, Object idValue, Map<String, Audit> auditFields); void updateAudit(HttpServletRequest request, EntityBase beforeEntity, Object serviceObj, Object idValue, Map<String, Audit> auditFields);
@Async("asyncExecutor") @Async("asyncExecutor")
void removeAudit(HttpServletRequest request,EntityBase entity,Object idValue,Map<String, Audit> auditFields); void removeAudit(HttpServletRequest request, EntityBase entity, Object idValue, Map<String, Audit> auditFields);
} }
\ No newline at end of file
...@@ -29,8 +29,8 @@ public class IBZUAAUserService implements AuthenticationUserService{ ...@@ -29,8 +29,8 @@ public class IBZUAAUserService implements AuthenticationUserService{
@Override @Override
public AuthenticationUser loadUserByUsername(String username) { public AuthenticationUser loadUserByUsername(String username) {
AuthenticationUser user=uaaFeignClient.loginByUsername(username); AuthenticationUser user = uaaFeignClient.loginByUsername(username);
if(user==null){ if(user == null) {
throw new BadRequestAlertException("登录失败","IBZUAAUser",username); throw new BadRequestAlertException("登录失败","IBZUAAUser",username);
} }
return user; return user;
...@@ -38,9 +38,9 @@ public class IBZUAAUserService implements AuthenticationUserService{ ...@@ -38,9 +38,9 @@ public class IBZUAAUserService implements AuthenticationUserService{
@Override @Override
public AuthenticationUser loadUserByLogin(String username, String password) { public AuthenticationUser loadUserByLogin(String username, String password) {
String[] data=username.split("[|]"); String[] data = username.split("[|]");
String loginname=username; String loginname = username;
String domains=""; String domains = "";
if(data.length==2) { if(data.length==2) {
loginname=data[0].trim(); loginname=data[0].trim();
...@@ -50,9 +50,9 @@ public class IBZUAAUserService implements AuthenticationUserService{ ...@@ -50,9 +50,9 @@ public class IBZUAAUserService implements AuthenticationUserService{
logininfo.setDomain(domains); logininfo.setDomain(domains);
logininfo.setLoginname(loginname); logininfo.setLoginname(loginname);
logininfo.setPassword(password); logininfo.setPassword(password);
AuthenticationUser user=uaaFeignClient.login(logininfo); AuthenticationUser user = uaaFeignClient.login(logininfo);
if(user==null){ if(user == null){
throw new BadRequestAlertException("登录失败","IBZUAAUser",username); throw new BadRequestAlertException("登录失败","IBZUAAUser", username);
} }
return user; return user;
} }
......
...@@ -31,22 +31,23 @@ public class IBZUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> impl ...@@ -31,22 +31,23 @@ public class IBZUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> impl
@Override @Override
public AuthenticationUser loadUserByUsername(String username) { public AuthenticationUser loadUserByUsername(String username) {
if(StringUtils.isEmpty(username)) if(StringUtils.isEmpty(username)) {
throw new UsernameNotFoundException("用户名为空"); throw new UsernameNotFoundException("用户名为空");
QueryWrapper<IBZUSER> conds=new QueryWrapper<IBZUSER>();
String[] data=username.split("[|]");
String loginname="";
String domains="";
if(data.length>0){
loginname=data[0].trim();
} }
if(data.length>1){ QueryWrapper<IBZUSER> conds = new QueryWrapper<IBZUSER>();
domains=data[1].trim(); String[] data = username.split("[|]");
String loginname = "";
String domains = "";
if(data.length>0) {
loginname = data[0].trim();
} }
if(!StringUtils.isEmpty(loginname)){ if(data.length>1) {
domains = data[1].trim();
}
if(!StringUtils.isEmpty(loginname)) {
conds.eq("loginname",loginname); conds.eq("loginname",loginname);
} }
if(!StringUtils.isEmpty(domains)){ if(!StringUtils.isEmpty(domains)) {
conds.eq("domains",domains); conds.eq("domains",domains);
} }
IBZUSER user = this.getOne(conds); IBZUSER user = this.getOne(conds);
...@@ -62,13 +63,13 @@ public class IBZUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> impl ...@@ -62,13 +63,13 @@ public class IBZUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> impl
@Override @Override
public AuthenticationUser loadUserByLogin(String username, String password){ public AuthenticationUser loadUserByLogin(String username, String password){
AuthenticationUser authuserdetail = loadUserByUsername(username); AuthenticationUser authuserdetail = loadUserByUsername(username);
if(pwencrymode==1){ if(pwencrymode == 1){
password = DigestUtils.md5DigestAsHex(password.getBytes()); password = DigestUtils.md5DigestAsHex(password.getBytes());
} }
else if(pwencrymode==2){ else if(pwencrymode == 2){
password = DigestUtils.md5DigestAsHex(String.format("%1$s||%2$s", username, password).getBytes()); password = DigestUtils.md5DigestAsHex(String.format("%1$s||%2$s", username, password).getBytes());
} }
if(!authuserdetail.getPassword().equals( password )){ if(!authuserdetail.getPassword().equals(password)) {
throw new BadRequestAlertException("用户名密码错误","IBZUSER",username); throw new BadRequestAlertException("用户名密码错误","IBZUSER",username);
} }
return authuserdetail; return authuserdetail;
...@@ -82,7 +83,7 @@ public class IBZUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> impl ...@@ -82,7 +83,7 @@ public class IBZUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> impl
public AuthenticationUser createUserDetails(IBZUSER user) { public AuthenticationUser createUserDetails(IBZUSER user) {
AuthenticationUser userdatail = new AuthenticationUser(); AuthenticationUser userdatail = new AuthenticationUser();
CachedBeanCopier.copy(user,userdatail); CachedBeanCopier.copy(user,userdatail);
if(userdatail.getSuperuser()==1){ if(userdatail.getSuperuser() == 1){
userdatail.setAuthorities(AuthorityUtils.createAuthorityList("ROLE_SUPERADMIN")); userdatail.setAuthorities(AuthorityUtils.createAuthorityList("ROLE_SUPERADMIN"));
} }
return userdatail; return userdatail;
......
...@@ -52,19 +52,19 @@ public class RemoteService { ...@@ -52,19 +52,19 @@ public class RemoteService {
*/ */
public interface RemoteFeignClient { public interface RemoteFeignClient {
@RequestMapping(method = RequestMethod.POST, value = "/{path}") @RequestMapping(method = RequestMethod.POST, value = "/{path}")
JSONObject post( @PathVariable("path") String path, @RequestHeader("Authorization") String token,@RequestBody Map param); JSONObject post( @PathVariable("path") String path, @RequestHeader("Authorization") String token, @RequestBody Map param);
@RequestMapping(method = RequestMethod.GET, value = "/{path}") @RequestMapping(method = RequestMethod.GET, value = "/{path}")
JSONObject request( @PathVariable("path") String path, @RequestHeader("Authorization") String token,Map param); JSONObject request( @PathVariable("path") String path, @RequestHeader("Authorization") String token, Map param);
@RequestMapping(method = RequestMethod.GET, value = "/{path}") @RequestMapping(method = RequestMethod.GET, value = "/{path}")
JSONObject get( @PathVariable("path") String path, @RequestHeader("Authorization") String token); JSONObject get( @PathVariable("path") String path, @RequestHeader("Authorization") String token);
@RequestMapping(method = RequestMethod.PUT, value = "/{path}") @RequestMapping(method = RequestMethod.PUT, value = "/{path}")
JSONObject put( @PathVariable("path") String path, @RequestHeader("Authorization") String token,@RequestBody Map param); JSONObject put( @PathVariable("path") String path, @RequestHeader("Authorization") String token,@RequestBody Map param);
@RequestMapping(method = RequestMethod.DELETE, value = "/{path}") @RequestMapping(method = RequestMethod.DELETE, value = "/{path}")
JSONObject delete( @PathVariable("path") String path, @RequestHeader("Authorization") String token); JSONObject delete(@PathVariable("path") String path, @RequestHeader("Authorization") String token);
} }
/** /**
...@@ -118,6 +118,4 @@ public class RemoteService { ...@@ -118,6 +118,4 @@ public class RemoteService {
final HttpMessageConverters httpMessageConverters = new HttpMessageConverters(jsonConverter); final HttpMessageConverters httpMessageConverters = new HttpMessageConverters(jsonConverter);
return () -> httpMessageConverters; return () -> httpMessageConverters;
} }
} }
\ No newline at end of file
...@@ -71,7 +71,7 @@ public class SimpleAuditService extends ServiceImpl<IBZDataAuditMapper, IBZDataA ...@@ -71,7 +71,7 @@ public class SimpleAuditService extends ServiceImpl<IBZDataAuditMapper, IBZDataA
public void createAudit(HttpServletRequest request, EntityBase entity, Object idValue, Map<String, Audit> auditFields) { public void createAudit(HttpServletRequest request, EntityBase entity, Object idValue, Map<String, Audit> auditFields) {
IBZDataAudit dataAudit = new IBZDataAudit(); IBZDataAudit dataAudit = new IBZDataAudit();
dataAudit.setOppersonid(AuthenticationUser.getAuthenticationUser().getUserid()); dataAudit.setOppersonid(AuthenticationUser.getAuthenticationUser().getUserid());
dataAudit.setOppersonname(String.format("%s[%s]",AuthenticationUser.getAuthenticationUser().getPersonname(),AuthenticationUser.getAuthenticationUser().getOrgname())); dataAudit.setOppersonname(String.format("%s[%s]", AuthenticationUser.getAuthenticationUser().getPersonname(), AuthenticationUser.getAuthenticationUser().getOrgname()));
dataAudit.setAudittype("CREATE"); dataAudit.setAudittype("CREATE");
dataAudit.setAuditobject(entity.getClass().getSimpleName()); dataAudit.setAuditobject(entity.getClass().getSimpleName());
dataAudit.setAuditobjectdata(idValue); dataAudit.setAuditobjectdata(idValue);
......
...@@ -30,7 +30,7 @@ public class SimpleFileService implements FileService { ...@@ -30,7 +30,7 @@ public class SimpleFileService implements FileService {
// 获取文件名 // 获取文件名
String fileName = multipartFile.getOriginalFilename(); String fileName = multipartFile.getOriginalFilename();
// 获取文件后缀 // 获取文件后缀
String extname ="."+getExtensionName(fileName); String extname = "."+getExtensionName(fileName);
try { try {
String fileid = DigestUtils.md5DigestAsHex(multipartFile.getInputStream()); String fileid = DigestUtils.md5DigestAsHex(multipartFile.getInputStream());
String fileFullPath = this.fileRoot+"ibizutil"+File.separator+fileid+File.separator+fileName; String fileFullPath = this.fileRoot+"ibizutil"+File.separator+fileid+File.separator+fileName;
......
...@@ -34,14 +34,14 @@ public class SearchContextHandlerMethodArgumentResolver implements HandlerMethod ...@@ -34,14 +34,14 @@ public class SearchContextHandlerMethodArgumentResolver implements HandlerMethod
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception { NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
Map<String, String[]> params = webRequest.getParameterMap(); Map<String, String[]> params = webRequest.getParameterMap();
LinkedHashMap<String,Object> set=new LinkedHashMap<>(); LinkedHashMap<String,Object> set = new LinkedHashMap<>();
for (String key : params.keySet()) { for (String key : params.keySet()) {
set.put(key,params.get(key)[0]); set.put(key,params.get(key)[0]);
} }
if((!set.containsKey("size")) ){ if((!set.containsKey("size")) ){
set.put("size",pageLimit); set.put("size", pageLimit);
} }
String json=objectMapper.writeValueAsString(set); String json = objectMapper.writeValueAsString(set);
return objectMapper.readValue(json,parameter.getParameterType()); return objectMapper.readValue(json, parameter.getParameterType());
} }
} }
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册