Commit d17fa4b4 authored by gary's avatar gary

1、后端权限由数据库中查询

2、任何角色变更时,都会将对应的用户权限缓存清除
3、role的curd都在缓存上进行
parent 7f32ff64
...@@ -49,7 +49,8 @@ public enum OperationModule { ...@@ -49,7 +49,8 @@ public enum OperationModule {
OrganizationReturnRate(37), OrganizationReturnRate(37),
OrganizationApprovedLevyInfo(38), OrganizationApprovedLevyInfo(38),
OrganizationTaxOfficer(39), OrganizationTaxOfficer(39),
OrganizationTaxRule(40); OrganizationTaxRule(40),
Equity(41);
private int value; private int value;
......
...@@ -16,6 +16,13 @@ public class LogMessage { ...@@ -16,6 +16,13 @@ public class LogMessage {
public static final String AddOrganization = "AddOrganization"; public static final String AddOrganization = "AddOrganization";
public static final String UpdateOrganization = "UpdateOrganization"; public static final String UpdateOrganization = "UpdateOrganization";
public static final String AddOrganizationEquity = "AddOrganizationEquity";
public static final String UpdateOrganizationEquity = "UpdateOrganizationEquity";
public static final String DeleteOrganizationEquity = "DeleteOrganizationEquity";
public static final String ChangeOrganizationEquity = "ChangeOrganizationEquity";
public static final String CancelChangeUpdateOrganizationEquity = "CancelChangeUpdateOrganizationEquity";
public static final String AddOrganizationInvoice = "AddOrganizationInvoice"; public static final String AddOrganizationInvoice = "AddOrganizationInvoice";
public static final String UpdateOrganizationInvoice = "UpdateOrganizationInvoice"; public static final String UpdateOrganizationInvoice = "UpdateOrganizationInvoice";
public static final String DeleteOrganizationInvoice = "DeleteOrganizationInvoice"; public static final String DeleteOrganizationInvoice = "DeleteOrganizationInvoice";
......
package pwc.taxtech.atms.data;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.Caching;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dao.RoleMapper;
import pwc.taxtech.atms.dto.role.RoleDto;
import pwc.taxtech.atms.entity.Role;
import java.util.ArrayList;
import java.util.List;
import pwc.taxtech.atms.entity.RoleExample;
import javax.annotation.Resource;
/**
* @Auther: Gary J Li
* @Date: 11/01/2019 14:53
* @Description:将Role存入ehcache,提高查询效率
*/
@Service
public class RoleData {
private static final Logger logger = LoggerFactory.getLogger(RoleData.class);
@Resource
private RoleMapper roleMapper;
/**
* 11/01/2019 16:15
* 根据serviceTypeId查询,存入ehcache
* [serviceTypeId]
* @author Gary J Li
* @return List<Role> roleList
*/
@Cacheable(value = "roleByServiceTypeIdCache", key = "#serviceTypeId")
public List<Role> selectByServiceTypeId(String serviceTypeId){
List<Role> roleList = new ArrayList<>();
try{
RoleExample roleExample = new RoleExample();
if(StringUtils.isNotBlank(serviceTypeId)){
roleExample.createCriteria().andServiceTypeIdEqualTo(serviceTypeId);
}
roleList = roleMapper.selectByExample(roleExample);
}catch (Exception e){
logger.error(String.format("Error selectByServiceTypeId: %s",e.getMessage()));
}
return roleList;
}
/**
* 11/01/2019 16:16
* 根据id查询,存入ehcache
* [id]
* @author Gary J Li
* @return Role role
*/
@Cacheable(value = "roleByIdCache", key = "#id")
public Role selectByPrimaryKey(String id){
Role role = new Role();
try{
role = roleMapper.selectByPrimaryKey(id);
}catch (Exception e){
logger.error(String.format("Error role selectByPrimaryKey: %s",e.getMessage()));
}
return role;
}
/**
* 11/01/2019 16:17
* 根据主键id删除,并把ehcache里的role都删掉
* [roleDto]
* @author Gary J Li
* @return int res
*/
@Caching(evict= {@CacheEvict(value = "roleByServiceTypeIdCache", key = "#role.getServiceTypeId()"),@CacheEvict(value = "roleByIdCache", key = "#role.getId()")} )
public int deleteByPrimaryKey(RoleDto roleDto){
int res = 0;
try{
res = roleMapper.deleteByPrimaryKey(roleDto.getId());
}catch (Exception e){
logger.error(String.format("Error role delete: %s",e.getMessage()));
}
return res;
}
/**
* 11/01/2019 16:20
* role写入,并在缓存里写入两个Hash(ServiceTypeId,Id)里
* [role]
* @author Gary J Li
* @return Role role
*/
@Caching(put= {@CachePut(value = "roleByServiceTypeIdCache", key = "#role.getServiceTypeId()"),@CachePut(value = "roleByIdCache", key = "#role.getId()")} )
public Role insert(Role role){
try{
roleMapper.insert(role);
}catch (Exception e){
logger.error(String.format("Error role insert: %s",e.getMessage()));
}
return role;
}
/**
* 11/01/2019 16:22
* role更新,并在缓存里更新两个Hash(ServiceTypeId,Id)里
* [role]
* @author Gary J Li
* @return Role role
*/
@Caching(put= {@CachePut(value = "roleByServiceTypeIdCache", key = "#role.getServiceTypeId()"),@CachePut(value = "roleByIdCache", key = "#role.getId()")} )
public Role updateByPrimaryKey(Role role){
try{
roleMapper.updateByPrimaryKey(role);
}catch (Exception e){
logger.error(String.format("Error role updateByPrimaryKey : %s",e.getMessage()));
}
return role;
}
}
package pwc.taxtech.atms.data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dao.RolePermissionMapper;
import pwc.taxtech.atms.entity.RolePermission;
import javax.annotation.Resource;
import java.util.List;
/**
* @Auther: Gary J Li
* @Date: 11/01/2019 14:53
* @Description:
*/
@Service
public class RolePermissionData {
private static final Logger logger = LoggerFactory.getLogger(RolePermissionData.class);
@Resource
private RolePermissionMapper rolePermissionMapper;
@Cacheable(value = "role", key = "#roleId+ '_' +#serviceTypeId")
public List<RolePermission> selectByRoleIdAndServiceTypeId(String roleId,String serviceTypeId){
return rolePermissionMapper.selectByRoleAndServiceTypeWithAssociation(roleId, serviceTypeId);
}
}
...@@ -5,8 +5,15 @@ import org.slf4j.LoggerFactory; ...@@ -5,8 +5,15 @@ import org.slf4j.LoggerFactory;
import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dao.PermissionMapper;
import pwc.taxtech.atms.dao.RolePermissionMapper;
import pwc.taxtech.atms.dao.UserRoleMapper;
import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.service.impl.RoleServiceImpl;
import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
...@@ -16,18 +23,55 @@ public class JwtAuthenticationService { ...@@ -16,18 +23,55 @@ public class JwtAuthenticationService {
protected final Logger logger = LoggerFactory.getLogger(this.getClass()); protected final Logger logger = LoggerFactory.getLogger(this.getClass());
@Resource
private UserRoleMapper userRoleMapper;
@Resource
private RolePermissionMapper rolePermissionMapper;
@Resource
private PermissionMapper permissionMapper;
/** /**
* 27/12/2018 11:05 * 27/12/2018 11:05
* 用户第一个需鉴权的操作时,从UPM获取用户操作权限存入EhCache,至下一次登陆前从EhCache获取权限进行操作鉴权。 *
* 用户第一个需鉴权的操作时,从UPM(目前从数据库中查询)获取用户操作权限存入EhCache,至下一次登陆前从EhCache获取权限进行操作鉴权。
* // todo upm return response
* [userName] * [userName]
* @author Gary J Li * @author Gary J Li
* @return List<String> * @return List<String>
*/ */
@Cacheable(value = "apiAuthCache", key = "'userName'") @Cacheable(value = "apiAuthCache", key = "#userid")
public List<String> getApiAuthList(String userName) { public List<String> getApiAuthList(String userid) {
List<String> apiAuthList = new ArrayList<>(); List<String> apiAuthList = new ArrayList<>();
apiAuthList.add("user:add"); // todo 1、修改角色的权限时,查询角色下的用户,刷新缓存
UserRoleExample userRoleExample = new UserRoleExample();
userRoleExample.createCriteria().andUserIdEqualTo(userid);
List<UserRole> userRoles = userRoleMapper.selectByExample(userRoleExample);
List<String> roleIds = new ArrayList<>();
userRoles.forEach( ur ->{
roleIds.add(ur.getRoleId());
});
RolePermissionExample rolePermissionExample = new RolePermissionExample();
rolePermissionExample.createCriteria().andRoleIdIn(roleIds);
List<RolePermission> rolePermissions = rolePermissionMapper.selectByExample(rolePermissionExample);
List<String> permissionIds = new ArrayList<>();
rolePermissions.forEach( rp ->{
permissionIds.add(rp.getPermissionId());
});
PermissionExample permissionExample= new PermissionExample();
permissionExample.createCriteria().andIdIn(permissionIds);
List<Permission> permissions = permissionMapper.selectByExample(permissionExample);
permissions.forEach(permission -> {
apiAuthList.addAll(Arrays.asList(permission.getOperationPermList().split("\\|")));
});
/*apiAuthList.add("user:add");
apiAuthList.add("cit:apply");
apiAuthList.add("user:edit"); apiAuthList.add("user:edit");
apiAuthList.add("userRole:add"); apiAuthList.add("userRole:add");
apiAuthList.add("userRole:edit"); apiAuthList.add("userRole:edit");
...@@ -36,9 +80,9 @@ public class JwtAuthenticationService { ...@@ -36,9 +80,9 @@ public class JwtAuthenticationService {
apiAuthList.add("roleCategory:add"); apiAuthList.add("roleCategory:add");
apiAuthList.add("roleCategory:edit"); apiAuthList.add("roleCategory:edit");
apiAuthList.add("vatApproval:commit"); apiAuthList.add("vatApproval:commit");
apiAuthList.add("vatApproval:check"); apiAuthList.add("vatApproval:check");*/
// todo upm return response
logger.debug("get Cache from upm :"+"apiAuthCache-"+"key :"+userName + " value :"+String.join(",",apiAuthList)); logger.debug("get Cache from upm :"+"apiAuthCache-"+"key :"+userid + " value :"+String.join(",",apiAuthList));
return apiAuthList; return apiAuthList;
} }
...@@ -49,9 +93,9 @@ public class JwtAuthenticationService { ...@@ -49,9 +93,9 @@ public class JwtAuthenticationService {
* @author Gary J Li * @author Gary J Li
* *
*/ */
@CacheEvict(value = "apiAuthCache", key = "'#userName'") @CacheEvict(value = "apiAuthCache", key = "#userid")
public void removeApiAuthList(String userName) { public void removeApiAuthList(String userid) {
logger.debug("remove Cache :"+"apiAuthCache"+"key :"+userName); logger.debug("remove Cache :"+"apiAuthCache"+"key :"+userid);
} }
} }
...@@ -61,7 +61,7 @@ public class JwtUtil implements InitializingBean { ...@@ -61,7 +61,7 @@ public class JwtUtil implements InitializingBean {
String username = String.valueOf(defaultClaims.get("username")); String username = String.valueOf(defaultClaims.get("username"));
String userid = String.valueOf(defaultClaims.get("userid")); String userid = String.valueOf(defaultClaims.get("userid"));
// 原版 UserDetails return new JwtUser(userid, username, databaseUsername, defaultClaims, getAuthorities()); // 原版 UserDetails return new JwtUser(userid, username, databaseUsername, defaultClaims, getAuthorities());
return new JwtUser(userid, username, databaseUsername, defaultClaims, getAuthorities(username)); return new JwtUser(userid, username, databaseUsername, defaultClaims, getAuthorities(userid));
} }
private List<SimpleGrantedAuthority> getAuthorities() { private List<SimpleGrantedAuthority> getAuthorities() {
...@@ -71,11 +71,11 @@ public class JwtUtil implements InitializingBean { ...@@ -71,11 +71,11 @@ public class JwtUtil implements InitializingBean {
return list; return list;
} }
private List<SimpleGrantedAuthority> getAuthorities(String userName) { private List<SimpleGrantedAuthority> getAuthorities(String userid) {
List<SimpleGrantedAuthority> list = new ArrayList<>(); List<SimpleGrantedAuthority> list = new ArrayList<>();
list.add(new SimpleGrantedAuthority("ROLE_USER")); list.add(new SimpleGrantedAuthority("ROLE_USER"));
list.add(new SimpleGrantedAuthority("ROLE_JWT_USER")); list.add(new SimpleGrantedAuthority("ROLE_JWT_USER"));
List<String> ecApiAuthList = jwtAuthenticationService.getApiAuthList(userName); List<String> ecApiAuthList = jwtAuthenticationService.getApiAuthList(userid);
for(String ecApiAuth : ecApiAuthList){ for(String ecApiAuth : ecApiAuthList){
list.add(new SimpleGrantedAuthority(ecApiAuth)); list.add(new SimpleGrantedAuthority(ecApiAuth));
} }
......
...@@ -419,8 +419,8 @@ public class DimensionServiceImpl extends AbstractService { ...@@ -419,8 +419,8 @@ public class DimensionServiceImpl extends AbstractService {
Dimension entity = new Dimension(); Dimension entity = new Dimension();
CommonUtils.copyProperties(model, entity); CommonUtils.copyProperties(model, entity);
entity.setId(CommonUtils.getUUID()); entity.setId(CommonUtils.getUUID());
Short orderIndex = dimensionMapper.selectByExample(null).stream().map(Dimension::getOrderIndex) Integer orderIndex = dimensionMapper.selectByExample(null).stream().map(Dimension::getOrderIndex)
.filter(Objects::nonNull).max(Comparator.naturalOrder()).orElse(Short.valueOf("0")); .filter(Objects::nonNull).max(Comparator.naturalOrder()).orElse(Integer.valueOf("0"));
entity.setOrderIndex(orderIndex); entity.setOrderIndex(orderIndex);
entity.setIsSystemDimension(false); entity.setIsSystemDimension(false);
......
...@@ -19,6 +19,7 @@ import pwc.taxtech.atms.entity.EquityInformationExample; ...@@ -19,6 +19,7 @@ import pwc.taxtech.atms.entity.EquityInformationExample;
import pwc.taxtech.atms.entity.OperationLogBasicData; import pwc.taxtech.atms.entity.OperationLogBasicData;
import pwc.taxtech.atms.exception.ApplicationException; import pwc.taxtech.atms.exception.ApplicationException;
import javax.annotation.Resource;
import java.util.*; import java.util.*;
import static pwc.taxtech.atms.common.CommonConstants.CommonFail; import static pwc.taxtech.atms.common.CommonConstants.CommonFail;
...@@ -30,9 +31,9 @@ public class EquityServiceImpl extends BaseService{ ...@@ -30,9 +31,9 @@ public class EquityServiceImpl extends BaseService{
@Autowired @Autowired
private OperationLogServiceImpl operationLogServiceImpl; private OperationLogServiceImpl operationLogServiceImpl;
@Autowired @Resource
private EquityInformationMapper equityInformationMapper; private EquityInformationMapper equityInformationMapper;
@Autowired @Resource
private EquityInformationHistoryMapper equityInformationHistoryMapper; private EquityInformationHistoryMapper equityInformationHistoryMapper;
public List<EquityInfoDto> getEquityListByOrgId(String orgId) { public List<EquityInfoDto> getEquityListByOrgId(String orgId) {
...@@ -67,10 +68,11 @@ public class EquityServiceImpl extends BaseService{ ...@@ -67,10 +68,11 @@ public class EquityServiceImpl extends BaseService{
BeanUtils.copyProperties(equityInfoDto,equityInformation); BeanUtils.copyProperties(equityInfoDto,equityInformation);
equityInformationMapper.insert(equityInformation); equityInformationMapper.insert(equityInformation);
} }
// todo 加日志 AddOrgEquityLog(OperationAction.New.value(),LogMessage.AddOrganizationEquity,equityInfoDtos.get(0).getOrganizationId(),OperationModule.Equity.value());
return new OperationResultDto(true); return new OperationResultDto(true);
}catch (Exception e){ }catch (Exception e){
return new OperationResultDto(false, CommonFail + e.getMessage()); logger.error(String.format("写入全部股东信息异常:%s", e.getMessage()));
return new OperationResultDto(false, CommonFail + SystemError);
} }
} }
...@@ -81,10 +83,11 @@ public class EquityServiceImpl extends BaseService{ ...@@ -81,10 +83,11 @@ public class EquityServiceImpl extends BaseService{
EquityInformationExample example = new EquityInformationExample(); EquityInformationExample example = new EquityInformationExample();
example.createCriteria().andIdEqualTo(equityInformation.getId()).andENumEqualTo(equityInformation.geteNum()); example.createCriteria().andIdEqualTo(equityInformation.getId()).andENumEqualTo(equityInformation.geteNum());
equityInformationMapper.updateByExampleSelective(equityInformation,example); equityInformationMapper.updateByExampleSelective(equityInformation,example);
// todo 加日志 AddOrgEquityLog(OperationAction.Update.value(),LogMessage.UpdateOrganizationEquity,equityInfoDto.getOrganizationId(),OperationModule.Equity.value());
return new OperationResultDto(true); return new OperationResultDto(true);
}catch (Exception e){ }catch (Exception e){
return new OperationResultDto(false, CommonFail + e.getMessage()); logger.error(String.format("更新股东信息异常:%s", e.getMessage()));
return new OperationResultDto(false, CommonFail + SystemError);
} }
} }
...@@ -99,9 +102,10 @@ public class EquityServiceImpl extends BaseService{ ...@@ -99,9 +102,10 @@ public class EquityServiceImpl extends BaseService{
if (delRes > 0) { if (delRes > 0) {
refreshEquityList(id); refreshEquityList(id);
} }
// todo 加日志 AddOrgEquityLog(OperationAction.Delete.value(),LogMessage.DeleteOrganizationEquity,String.valueOf(id),OperationModule.Equity.value());
return new OperationResultDto(true); return new OperationResultDto(true);
} catch (Exception e) { } catch (Exception e) {
logger.error(String.format("删除股东信息异常:%s", e.getMessage()));
return new OperationResultDto(false, CommonFail + e.getMessage()); return new OperationResultDto(false, CommonFail + e.getMessage());
} }
} }
...@@ -156,7 +160,6 @@ public class EquityServiceImpl extends BaseService{ ...@@ -156,7 +160,6 @@ public class EquityServiceImpl extends BaseService{
* @author Gary J Li * @author Gary J Li
* @return OperationResultDto<Object> * @return OperationResultDto<Object>
*/ */
@Transactional
public OperationResultDto<Object> change(String orgName, String comment, List<EquityInfoDto> equityInfoDtos) { public OperationResultDto<Object> change(String orgName, String comment, List<EquityInfoDto> equityInfoDtos) {
EquityInformationExample exampleForOldData = new EquityInformationExample(); EquityInformationExample exampleForOldData = new EquityInformationExample();
...@@ -224,6 +227,7 @@ public class EquityServiceImpl extends BaseService{ ...@@ -224,6 +227,7 @@ public class EquityServiceImpl extends BaseService{
opLog.setLogType(OperateLogType.OperationLogEquity.value()); opLog.setLogType(OperateLogType.OperationLogEquity.value());
opLog.setEquityLog(true); opLog.setEquityLog(true);
operationLogService.addOperationLog(opLog); operationLogService.addOperationLog(opLog);
AddOrgEquityLog(OperationAction.Update.value(),LogMessage.ChangeOrganizationEquity,orgName,OperationModule.Equity.value());
return new OperationResultDto(true, "变更成功!", oldId); return new OperationResultDto(true, "变更成功!", oldId);
} }
...@@ -257,50 +261,44 @@ public class EquityServiceImpl extends BaseService{ ...@@ -257,50 +261,44 @@ public class EquityServiceImpl extends BaseService{
* @author Gary J Li * @author Gary J Li
* @return OperationResultDto<Object> * @return OperationResultDto<Object>
*/ */
@Transactional
public OperationResultDto<Object> cancelChange(Long oldId, Long newId) { public OperationResultDto<Object> cancelChange(Long oldId, Long newId) {
try{ if (null != oldId) {
if (null != oldId) { // 1、根据oldId历史数据查出来equityInfomations equity_infomation_history
// 1、根据oldId历史数据查出来equityInfomations equity_infomation_history EquityInformationExample exampleForOldData = new EquityInformationExample();
EquityInformationExample exampleForOldData = new EquityInformationExample(); exampleForOldData.createCriteria().andIdEqualTo(oldId);
exampleForOldData.createCriteria().andIdEqualTo(oldId); List<EquityInformation> equityInformations = equityInformationHistoryMapper.selectByExample(exampleForOldData);
List<EquityInformation> equityInformations = equityInformationHistoryMapper.selectByExample(exampleForOldData); // 2、equityInfomations存入新表 equity_infomation
// 2、equityInfomations存入新表 equity_infomation int insRes = 0;
int insRes = 0; for (EquityInformation equityInformation : equityInformations) {
for(EquityInformation equityInformation : equityInformations) { insRes += equityInformationMapper.insert(equityInformation);
insRes += equityInformationMapper.insert(equityInformation);
}
if (insRes < 1) {
logger.warn(String.format("撤销变更-2 表equity_infomation 存入新表数据异常.id: [ %s ]", newId));
throw new ApplicationException("撤销变更-2 存入新表数据异常");
}
} }
// 3、根据newId删除 equity_infomation if (insRes < 1) {
EquityInformationExample exampleDeleteOld = new EquityInformationExample(); logger.warn(String.format("撤销变更-2 表equity_infomation 存入新表数据异常.id: [ %s ]", newId));
exampleDeleteOld.createCriteria().andIdEqualTo(newId); throw new ApplicationException("撤销变更-2 存入新表数据异常");
if (equityInformationMapper.deleteByExample(exampleDeleteOld) < 1) {
logger.warn(String.format("撤销变更-3 表equity_infomation 删除股权数据异常.id: [ %s ]", newId));
throw new ApplicationException("撤销变更-3 删除股权数据异常");
} }
if (null != oldId) { }
// 3、根据newId删除 equity_infomation
EquityInformationExample exampleDeleteOld = new EquityInformationExample();
exampleDeleteOld.createCriteria().andIdEqualTo(newId);
if (equityInformationMapper.deleteByExample(exampleDeleteOld) < 1) {
logger.warn(String.format("撤销变更-3 表equity_infomation 删除股权数据异常.id: [ %s ]", newId));
throw new ApplicationException("撤销变更-3 删除股权数据异常");
}
if (null != oldId) {
// 4、根据oldId删除历史数据 equity_infomation_history // 4、根据oldId删除历史数据 equity_infomation_history
EquityInformationExample exampleDeleteNew = new EquityInformationExample(); EquityInformationExample exampleDeleteNew = new EquityInformationExample();
exampleDeleteNew.createCriteria().andIdEqualTo(oldId); exampleDeleteNew.createCriteria().andIdEqualTo(oldId);
if (equityInformationHistoryMapper.deleteByExample(exampleDeleteNew) < 1) { if (equityInformationHistoryMapper.deleteByExample(exampleDeleteNew) < 1) {
logger.warn(String.format("撤销变更-3 表equity_infomation_history 删除股权数据异常.id: [ %s ]", oldId)); logger.warn(String.format("撤销变更-3 表equity_infomation_history 删除股权数据异常.id: [ %s ]", oldId));
throw new ApplicationException("撤销变更-4 删除历史数据异常"); throw new ApplicationException("撤销变更-4 删除历史数据异常");
}
} }
}
// 5、根据oldId删除操作日志 operation_log_equity // 5、根据oldId删除操作日志 operation_log_equity
if (operationLogServiceImpl.deleteById(newId) < 1) { if (operationLogServiceImpl.deleteById(newId) < 1) {
logger.warn(String.format("撤销变更-3 表operation_log_equity 删除操作日志异常.id: [ %s ]", oldId)); logger.warn(String.format("撤销变更-3 表operation_log_equity 删除操作日志异常.id: [ %s ]", oldId));
throw new ApplicationException("撤销变更-5 删除操作日志异常"); throw new ApplicationException("撤销变更-5 删除操作日志异常");
}
}catch (Exception e){
logger.error(String.format("%s",e.getMessage()));
} }
AddOrgEquityLog(OperationAction.Update.value(),LogMessage.CancelChangeUpdateOrganizationEquity,String.valueOf(newId),OperationModule.Equity.value());
return new OperationResultDto(true); return new OperationResultDto(true);
} }
...@@ -343,4 +341,25 @@ public class EquityServiceImpl extends BaseService{ ...@@ -343,4 +341,25 @@ public class EquityServiceImpl extends BaseService{
} }
return equityInfoDtos; return equityInfoDtos;
} }
/**
* 25/01/2019 14:39
* [增删改查,操作描述,操作对象,操作模块] 更新、删除需补充oldData、newData
* [actionValue, content, object, module]
* @author Gary J Li
* @return
*/
private void AddOrgEquityLog(int actionValue,String content,String object,Integer module) {
OperationLogDto opLog = new OperationLogDto();
opLog.setAction(actionValue);
opLog.setOperationContent(content);
opLog.setOperationObject(object);
opLog.setOriginalState("");
opLog.setUpdateState("");
opLog.setIp("");
opLog.setModule(module);
opLog.setComment("");
opLog.setLogType(OperateLogType.OperationLogOrganization.value());
operationLogService.addOperationLog(opLog);
}
} }
...@@ -296,7 +296,7 @@ public class OrganizationExtraServiceImpl extends BaseService{ ...@@ -296,7 +296,7 @@ public class OrganizationExtraServiceImpl extends BaseService{
/** /**
* 24/01/2019 10:41 * 24/01/2019 10:41
* [增删改查,操作描述,操作对象,操作模块] * [增删改查,操作描述,操作对象,操作模块] 更新、删除需补充oldData、newData
* [actionValue, content, object, module] * [actionValue, content, object, module]
* @author Gary J Li * @author Gary J Li
* @return * @return
......
...@@ -13,6 +13,7 @@ import pwc.taxtech.atms.common.OperationModule; ...@@ -13,6 +13,7 @@ import pwc.taxtech.atms.common.OperationModule;
import pwc.taxtech.atms.common.RoleSourceEnum; import pwc.taxtech.atms.common.RoleSourceEnum;
import pwc.taxtech.atms.common.ServiceTypeEnum; import pwc.taxtech.atms.common.ServiceTypeEnum;
import pwc.taxtech.atms.constant.DimensionConstant; import pwc.taxtech.atms.constant.DimensionConstant;
import pwc.taxtech.atms.data.RoleData;
import pwc.taxtech.atms.dpo.DimensionParamDto; import pwc.taxtech.atms.dpo.DimensionParamDto;
import pwc.taxtech.atms.dpo.DimensionValueOrgDto; import pwc.taxtech.atms.dpo.DimensionValueOrgDto;
import pwc.taxtech.atms.dpo.OrganizationDto; import pwc.taxtech.atms.dpo.OrganizationDto;
...@@ -38,6 +39,7 @@ import pwc.taxtech.atms.dto.role.UpdateRoleInfo; ...@@ -38,6 +39,7 @@ import pwc.taxtech.atms.dto.role.UpdateRoleInfo;
import pwc.taxtech.atms.dto.user.*; import pwc.taxtech.atms.dto.user.*;
import pwc.taxtech.atms.entity.*; import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.entity.UserRoleExample.Criteria; import pwc.taxtech.atms.entity.UserRoleExample.Criteria;
import pwc.taxtech.atms.security.JwtAuthenticationService;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
...@@ -64,12 +66,20 @@ public class RoleServiceImpl extends AbstractService { ...@@ -64,12 +66,20 @@ public class RoleServiceImpl extends AbstractService {
@Autowired @Autowired
private OrganizationServiceImpl organizationService; private OrganizationServiceImpl organizationService;
@Autowired
private JwtAuthenticationService jwtAuthenticationService;
@Autowired
private RoleData roleData;
public List<NavTreeDto> getRoleTreeList() { public List<NavTreeDto> getRoleTreeList() {
logger.debug("RoleServiceImpl getRoleTreeList"); logger.debug("RoleServiceImpl getRoleTreeList");
RoleCategoryExample roleCategoryExample = new RoleCategoryExample(); RoleCategoryExample roleCategoryExample = new RoleCategoryExample();
roleCategoryExample.createCriteria().andIsActiveEqualTo(CommonConstants.ACTIVE_STATUS); roleCategoryExample.createCriteria().andIsActiveEqualTo(CommonConstants.ACTIVE_STATUS);
List<RoleCategory> roleCategoryList = roleCategoryMapper.selectByExample(roleCategoryExample); List<RoleCategory> roleCategoryList = roleCategoryMapper.selectByExample(roleCategoryExample);
List<Role> allRoleList = roleMapper.selectByExample(new RoleExample()); // List<Role> allRoleList = roleMapper.selectByExample(new RoleExample());
List<Role> allRoleList = roleData.selectByServiceTypeId(null);
List<NavTreeDto> retList = new ArrayList<>(); List<NavTreeDto> retList = new ArrayList<>();
for (RoleCategory category : roleCategoryList) { for (RoleCategory category : roleCategoryList) {
NavTreeDto treeDto = new NavTreeDto(); NavTreeDto treeDto = new NavTreeDto();
...@@ -179,7 +189,8 @@ public class RoleServiceImpl extends AbstractService { ...@@ -179,7 +189,8 @@ public class RoleServiceImpl extends AbstractService {
private List<Role> findAll() { private List<Role> findAll() {
RoleExample roleExample = new RoleExample(); RoleExample roleExample = new RoleExample();
return roleMapper.selectByExample(roleExample); // return roleMapper.selectByExample(roleExample);
return roleData.selectByServiceTypeId(null);
} }
private List<UserRole> findAllUserRoles() { private List<UserRole> findAllUserRoles() {
...@@ -612,7 +623,8 @@ public class RoleServiceImpl extends AbstractService { ...@@ -612,7 +623,8 @@ public class RoleServiceImpl extends AbstractService {
.collect(Collectors.toList()); .collect(Collectors.toList());
for (Map<String, String> l : userRoleList) { for (Map<String, String> l : userRoleList) {
Role role = roleMapper.selectByPrimaryKey(l.get("roleId")); // Role role = roleMapper.selectByPrimaryKey(l.get("roleId"));
Role role = roleData.selectByPrimaryKey(l.get("roleId"));
UserRoleDto userRoleDto = new UserRoleDto(); UserRoleDto userRoleDto = new UserRoleDto();
userRoleDto.setRoleId(l.get("roleId")); userRoleDto.setRoleId(l.get("roleId"));
userRoleDto.setUserId(l.get("userId")); userRoleDto.setUserId(l.get("userId"));
...@@ -966,7 +978,8 @@ public class RoleServiceImpl extends AbstractService { ...@@ -966,7 +978,8 @@ public class RoleServiceImpl extends AbstractService {
*/ */
public void addUsersToRole(String roleId, String serviceTypeId, List<String> userIdList) { public void addUsersToRole(String roleId, String serviceTypeId, List<String> userIdList) {
Role role = roleMapper.selectByPrimaryKey(roleId); // Role role = roleMapper.selectByPrimaryKey(roleId);
Role role = roleData.selectByPrimaryKey(roleId);
if (role == null) { if (role == null) {
return; return;
} }
...@@ -985,6 +998,8 @@ public class RoleServiceImpl extends AbstractService { ...@@ -985,6 +998,8 @@ public class RoleServiceImpl extends AbstractService {
userRole.setServiceTypeId(serviceTypeId); userRole.setServiceTypeId(serviceTypeId);
userRoleMapper.insert(userRole); userRoleMapper.insert(userRole);
jwtAuthenticationService.removeApiAuthList(userId);
// operation log // operation log
UpdateLogParams updateLogParams = new UpdateLogParams(); UpdateLogParams updateLogParams = new UpdateLogParams();
updateLogParams.setOperationModule(OperationModule.Role.value()); updateLogParams.setOperationModule(OperationModule.Role.value());
...@@ -1017,7 +1032,8 @@ public class RoleServiceImpl extends AbstractService { ...@@ -1017,7 +1032,8 @@ public class RoleServiceImpl extends AbstractService {
for (String roleId : roleIdList) { for (String roleId : roleIdList) {
UpdateLogParams updateLogParams = new UpdateLogParams(); UpdateLogParams updateLogParams = new UpdateLogParams();
User user = userMapper.selectByPrimaryKey(userId); User user = userMapper.selectByPrimaryKey(userId);
Role role = roleMapper.selectByPrimaryKey(roleId); // Role role = roleMapper.selectByPrimaryKey(roleId);
Role role = roleData.selectByPrimaryKey(roleId);
updateLogParams.setOperationModule(OperationModule.Role.value()); updateLogParams.setOperationModule(OperationModule.Role.value());
updateLogParams.setOperationUser(authUserHelper.getCurrentAuditor().get()); updateLogParams.setOperationUser(authUserHelper.getCurrentAuditor().get());
updateLogParams.setOperationContent(user == null ? "" : user.getUserName()); updateLogParams.setOperationContent(user == null ? "" : user.getUserName());
...@@ -1029,6 +1045,7 @@ public class RoleServiceImpl extends AbstractService { ...@@ -1029,6 +1045,7 @@ public class RoleServiceImpl extends AbstractService {
} }
operationLogService.addOrDeleteDataAddLog(updateLogParamsList); operationLogService.addOrDeleteDataAddLog(updateLogParamsList);
jwtAuthenticationService.removeApiAuthList(userId);
} }
/* /*
...@@ -1036,11 +1053,12 @@ public class RoleServiceImpl extends AbstractService { ...@@ -1036,11 +1053,12 @@ public class RoleServiceImpl extends AbstractService {
* *
* @see pwc.taxtech.atms.service.RoleService#getRoleListByRoleType(int) * @see pwc.taxtech.atms.service.RoleService#getRoleListByRoleType(int)
*/ */
public List<RoleDto> getRoleListByRoleType(String roleTypeId) { public List<RoleDto> getRoleListByRoleType(String serviceTypeId) {
// roleTypeId修订为serviceTypeId
RoleExample example = new RoleExample(); RoleExample example = new RoleExample();
example.createCriteria().andServiceTypeIdEqualTo(roleTypeId); example.createCriteria().andServiceTypeIdEqualTo(serviceTypeId);
List<Role> roleList = roleMapper.selectByExample(example); // List<Role> roleList = roleMapper.selectByExample(example);
List<Role> roleList = roleData.selectByServiceTypeId(serviceTypeId);
List<RoleDto> roleDtoList = new ArrayList<>(); List<RoleDto> roleDtoList = new ArrayList<>();
roleList.stream().forEach(role -> { roleList.stream().forEach(role -> {
RoleDto roleDto = new RoleDto(); RoleDto roleDto = new RoleDto();
...@@ -1182,7 +1200,8 @@ public class RoleServiceImpl extends AbstractService { ...@@ -1182,7 +1200,8 @@ public class RoleServiceImpl extends AbstractService {
roleToAdd.setName(roleDisplayDto.getName().trim()); roleToAdd.setName(roleDisplayDto.getName().trim());
roleToAdd.setCreateTime(new Date()); roleToAdd.setCreateTime(new Date());
roleToAdd.setUpdateTime(new Date()); roleToAdd.setUpdateTime(new Date());
roleMapper.insert(roleToAdd); // roleMapper.insert(roleToAdd);
roleData.insert(roleToAdd);
// operation log for add role // operation log for add role
UpdateLogParams updateLogParams = new UpdateLogParams(); UpdateLogParams updateLogParams = new UpdateLogParams();
...@@ -1240,7 +1259,8 @@ public class RoleServiceImpl extends AbstractService { ...@@ -1240,7 +1259,8 @@ public class RoleServiceImpl extends AbstractService {
} }
// update role info // update role info
Role roleToUpdate = roleMapper.selectByPrimaryKey(roleId); // Role roleToUpdate = roleMapper.selectByPrimaryKey(roleId);
Role roleToUpdate = roleData.selectByPrimaryKey(roleId);
if (roleToUpdate == null) { if (roleToUpdate == null) {
return; return;
} }
...@@ -1248,7 +1268,8 @@ public class RoleServiceImpl extends AbstractService { ...@@ -1248,7 +1268,8 @@ public class RoleServiceImpl extends AbstractService {
CommonUtils.copyProperties(roleToUpdate, roleOriginal); CommonUtils.copyProperties(roleToUpdate, roleOriginal);
roleToUpdate.setName(updateRole.getRoleName().trim()); roleToUpdate.setName(updateRole.getRoleName().trim());
roleToUpdate.setDescription(updateRole.getRoleDescription()); roleToUpdate.setDescription(updateRole.getRoleDescription());
roleMapper.updateByPrimaryKey(roleToUpdate); // roleMapper.updateByPrimaryKey(roleToUpdate);
roleData.updateByPrimaryKey(roleToUpdate);
// operation log for role update // operation log for role update
UpdateLogParams updateRoleLogParams = new UpdateLogParams(); UpdateLogParams updateRoleLogParams = new UpdateLogParams();
...@@ -1324,6 +1345,14 @@ public class RoleServiceImpl extends AbstractService { ...@@ -1324,6 +1345,14 @@ public class RoleServiceImpl extends AbstractService {
permissionLogParams.setComment("Permission"); permissionLogParams.setComment("Permission");
operationLogService.addOrDeleteDataAddLog(permissionLogParams); operationLogService.addOrDeleteDataAddLog(permissionLogParams);
} }
// todo review ensure 查出角色下所有用户清除缓存
UserRoleExample userRoleExample = new UserRoleExample();
userRoleExample.createCriteria().andRoleIdEqualTo(roleId);
List<UserRole> userRoles = userRoleMapper.selectByExample(userRoleExample);
userRoles.forEach( userRole -> {
jwtAuthenticationService.removeApiAuthList(userRole.getUserId());
});
} }
/* /*
...@@ -1365,8 +1394,10 @@ public class RoleServiceImpl extends AbstractService { ...@@ -1365,8 +1394,10 @@ public class RoleServiceImpl extends AbstractService {
rolePermissionMapper.deleteByExample(rolePermissionExample); rolePermissionMapper.deleteByExample(rolePermissionExample);
// delete role // delete role
roleMapper.deleteByPrimaryKey(roleDto.getId()); // roleMapper.deleteByPrimaryKey(roleDto.getId());
roleData.deleteByPrimaryKey(roleDto);
// todo 未确认roleDto是否有serviceTypeId
// operation log // operation log
UpdateLogParams permissionLogParams = new UpdateLogParams(); UpdateLogParams permissionLogParams = new UpdateLogParams();
permissionLogParams.setOperationModule(OperationModule.Role.value()); permissionLogParams.setOperationModule(OperationModule.Role.value());
...@@ -1378,6 +1409,13 @@ public class RoleServiceImpl extends AbstractService { ...@@ -1378,6 +1409,13 @@ public class RoleServiceImpl extends AbstractService {
permissionLogParams.setComment("Role"); permissionLogParams.setComment("Role");
operationLogService.addOrDeleteDataAddLog(permissionLogParams); operationLogService.addOrDeleteDataAddLog(permissionLogParams);
// todo review ensure 查出角色下所有用户清除缓存
UserRoleExample userRoleExample = new UserRoleExample();
userRoleExample.createCriteria().andRoleIdEqualTo(roleDto.getId());
List<UserRole> userRoles = userRoleMapper.selectByExample(userRoleExample);
userRoles.forEach( userRole -> {
jwtAuthenticationService.removeApiAuthList(userRole.getUserId());
});
} }
/* /*
...@@ -1432,7 +1470,8 @@ public class RoleServiceImpl extends AbstractService { ...@@ -1432,7 +1470,8 @@ public class RoleServiceImpl extends AbstractService {
}); });
// 角色列表 // 角色列表
List<Role> roles = roleMapper.selectByExample(null); // List<Role> roles = roleMapper.selectByExample(null);
List<Role> roles = roleData.selectByServiceTypeId(null);
List<NameDto> roleList = new ArrayList<>(); List<NameDto> roleList = new ArrayList<>();
roles.stream().forEach(role -> { roles.stream().forEach(role -> {
NameDto nameDto = new NameDto(); NameDto nameDto = new NameDto();
...@@ -1741,7 +1780,8 @@ public class RoleServiceImpl extends AbstractService { ...@@ -1741,7 +1780,8 @@ public class RoleServiceImpl extends AbstractService {
RoleExample roleExample = new RoleExample(); RoleExample roleExample = new RoleExample();
roleExample.createCriteria().andServiceTypeIdEqualTo(serviceTypeId); roleExample.createCriteria().andServiceTypeIdEqualTo(serviceTypeId);
List<Role> roleList = roleMapper.selectByExample(roleExample); // List<Role> roleList = roleMapper.selectByExample(roleExample);
List<Role> roleList = roleData.selectByServiceTypeId(serviceTypeId);
for (Role role : roleList) { for (Role role : roleList) {
RolePermissionDto rolePermissionDto = new RolePermissionDto(); RolePermissionDto rolePermissionDto = new RolePermissionDto();
rolePermissionDto.setRoleId(role.getId()); rolePermissionDto.setRoleId(role.getId());
...@@ -1796,7 +1836,7 @@ public class RoleServiceImpl extends AbstractService { ...@@ -1796,7 +1836,7 @@ public class RoleServiceImpl extends AbstractService {
userRoleMapper.insert(userRole); userRoleMapper.insert(userRole);
} }
} }
jwtAuthenticationService.removeApiAuthList(userRoleUpdateDto.getUserId());
} }
/* /*
...@@ -1931,7 +1971,8 @@ public class RoleServiceImpl extends AbstractService { ...@@ -1931,7 +1971,8 @@ public class RoleServiceImpl extends AbstractService {
// 用户列表 // 用户列表
List<User> userList = userMapper.selectByExample(new UserExample()); List<User> userList = userMapper.selectByExample(new UserExample());
// 角色列表 // 角色列表
List<Role> roleList = roleMapper.selectByExample(new RoleExample()); // List<Role> roleList = roleMapper.selectByExample(new RoleExample());
List<Role> roleList = roleData.selectByServiceTypeId(null);
List<UserDimensionValueRoleDto> group = userDimensionValueRoleDtoList.stream() List<UserDimensionValueRoleDto> group = userDimensionValueRoleDtoList.stream()
.map(this::convertUserDimensionValueRoleDtoForDistinct).distinct().collect(Collectors.toList()); .map(this::convertUserDimensionValueRoleDtoForDistinct).distinct().collect(Collectors.toList());
for (UserDimensionValueRoleDto item : group) { for (UserDimensionValueRoleDto item : group) {
...@@ -2090,7 +2131,9 @@ public class RoleServiceImpl extends AbstractService { ...@@ -2090,7 +2131,9 @@ public class RoleServiceImpl extends AbstractService {
List<VMUser> userList = userMapper.selectByExample(userExample).stream() List<VMUser> userList = userMapper.selectByExample(userExample).stream()
.map(sa -> CommonUtils.copyProperties(sa, new VMUser())).collect(toList()); .map(sa -> CommonUtils.copyProperties(sa, new VMUser())).collect(toList());
// 角色列表 // 角色列表
List<NameDto> roleList = roleMapper.selectByExample(new RoleExample()).stream() /*List<NameDto> roleList = roleMapper.selectByExample(new RoleExample()).stream()
.map(sa -> CommonUtils.copyProperties(sa, new NameDto())).collect(toList());*/
List<NameDto> roleList = roleData.selectByServiceTypeId(null).stream()
.map(sa -> CommonUtils.copyProperties(sa, new NameDto())).collect(toList()); .map(sa -> CommonUtils.copyProperties(sa, new NameDto())).collect(toList());
// 获取原始角色列表 // 获取原始角色列表
List<UserRoleSimpleDto> userRoleList = getOriginalUserRoleList(roleList); List<UserRoleSimpleDto> userRoleList = getOriginalUserRoleList(roleList);
......
...@@ -12,6 +12,7 @@ import pwc.taxtech.atms.common.*; ...@@ -12,6 +12,7 @@ import pwc.taxtech.atms.common.*;
import pwc.taxtech.atms.common.message.UserMessage; import pwc.taxtech.atms.common.message.UserMessage;
import pwc.taxtech.atms.dao.UserHistoricalPasswordMapper; import pwc.taxtech.atms.dao.UserHistoricalPasswordMapper;
import pwc.taxtech.atms.dao.UserMapper; import pwc.taxtech.atms.dao.UserMapper;
import pwc.taxtech.atms.data.RoleData;
import pwc.taxtech.atms.dto.ForgetPasswordDto; import pwc.taxtech.atms.dto.ForgetPasswordDto;
import pwc.taxtech.atms.dto.LoginOutputDto; import pwc.taxtech.atms.dto.LoginOutputDto;
import pwc.taxtech.atms.dto.MailMto; import pwc.taxtech.atms.dto.MailMto;
...@@ -20,7 +21,6 @@ import pwc.taxtech.atms.dto.UpdateLogParams; ...@@ -20,7 +21,6 @@ import pwc.taxtech.atms.dto.UpdateLogParams;
import pwc.taxtech.atms.dto.user.UserAndUserRoleSaveDto; import pwc.taxtech.atms.dto.user.UserAndUserRoleSaveDto;
import pwc.taxtech.atms.dto.user.UserPasswordDto; import pwc.taxtech.atms.dto.user.UserPasswordDto;
import pwc.taxtech.atms.entity.Role; import pwc.taxtech.atms.entity.Role;
import pwc.taxtech.atms.entity.RoleExample;
import pwc.taxtech.atms.entity.User; import pwc.taxtech.atms.entity.User;
import pwc.taxtech.atms.entity.UserHistoricalPassword; import pwc.taxtech.atms.entity.UserHistoricalPassword;
import pwc.taxtech.atms.entity.UserHistoricalPasswordExample; import pwc.taxtech.atms.entity.UserHistoricalPasswordExample;
...@@ -58,6 +58,8 @@ public class UserAccountServiceImpl extends AbstractService { ...@@ -58,6 +58,8 @@ public class UserAccountServiceImpl extends AbstractService {
private AuthUserHelper authUserHelper; private AuthUserHelper authUserHelper;
@Autowired @Autowired
private AtmsApiSettings atmsApiSettings; private AtmsApiSettings atmsApiSettings;
@Autowired
private RoleData roleData;
public OperationResultDto<LoginOutputDto> changeExternalUserPassword(UserPasswordDto userPasswordDto) { public OperationResultDto<LoginOutputDto> changeExternalUserPassword(UserPasswordDto userPasswordDto) {
logger.debug("修改密码 Start"); logger.debug("修改密码 Start");
...@@ -313,7 +315,8 @@ public class UserAccountServiceImpl extends AbstractService { ...@@ -313,7 +315,8 @@ public class UserAccountServiceImpl extends AbstractService {
logger.debug("Start to insert new user [ {} ]", user.getId()); logger.debug("Start to insert new user [ {} ]", user.getId());
userMapper.insert(user); userMapper.insert(user);
List<String> arrRoles = userAndUserRoleSaveDto.getRoleIds(); List<String> arrRoles = userAndUserRoleSaveDto.getRoleIds();
List<Role> roleQuery = roleMapper.selectByExample(new RoleExample()); // List<Role> roleQuery = roleMapper.selectByExample(new RoleExample());
List<Role> roleQuery = roleData.selectByServiceTypeId(null);
if (arrRoles != null && !arrRoles.isEmpty()) { if (arrRoles != null && !arrRoles.isEmpty()) {
for (String role : arrRoles) { for (String role : arrRoles) {
UserRole userRole = new UserRole(); UserRole userRole = new UserRole();
......
...@@ -17,6 +17,7 @@ import pwc.taxtech.atms.common.message.LogMessage; ...@@ -17,6 +17,7 @@ import pwc.taxtech.atms.common.message.LogMessage;
import pwc.taxtech.atms.common.message.UserMessage; import pwc.taxtech.atms.common.message.UserMessage;
import pwc.taxtech.atms.constant.DimensionConstant; import pwc.taxtech.atms.constant.DimensionConstant;
import pwc.taxtech.atms.constant.UserConstant; import pwc.taxtech.atms.constant.UserConstant;
import pwc.taxtech.atms.data.RoleData;
import pwc.taxtech.atms.dpo.DimensionValueOrgDto; import pwc.taxtech.atms.dpo.DimensionValueOrgDto;
import pwc.taxtech.atms.dpo.OrganizationDto; import pwc.taxtech.atms.dpo.OrganizationDto;
import pwc.taxtech.atms.dpo.RoleInfo; import pwc.taxtech.atms.dpo.RoleInfo;
...@@ -64,6 +65,9 @@ public class UserRoleServiceImpl extends AbstractService { ...@@ -64,6 +65,9 @@ public class UserRoleServiceImpl extends AbstractService {
@Autowired @Autowired
private UserServiceImpl userService; private UserServiceImpl userService;
@Autowired
private RoleData roleData;
public OrgRoleDtoList getUserRoleByUserId(String userId) { public OrgRoleDtoList getUserRoleByUserId(String userId) {
logger.debug("UserRoleServiceImpl getUserRoleByUserId [ userId: {} ]", userId); logger.debug("UserRoleServiceImpl getUserRoleByUserId [ userId: {} ]", userId);
OrgRoleDtoList result = new OrgRoleDtoList(); OrgRoleDtoList result = new OrgRoleDtoList();
...@@ -1241,7 +1245,8 @@ public class UserRoleServiceImpl extends AbstractService { ...@@ -1241,7 +1245,8 @@ public class UserRoleServiceImpl extends AbstractService {
} }
// 添加日志 // 添加日志
for (UserDimensionValueRole r : target) { for (UserDimensionValueRole r : target) {
Role role = roleMapper.selectByPrimaryKey(r.getRoleId()); // Role role = roleMapper.selectByPrimaryKey(r.getRoleId());
Role role = roleData.selectByPrimaryKey(r.getRoleId());
String roleName = role == null ? "" : role.getName(); String roleName = role == null ? "" : role.getName();
addOrDeleteDataAddLog( addOrDeleteDataAddLog(
dimensionName + CommonConstants.DashSignSeparator + dimensionValueName dimensionName + CommonConstants.DashSignSeparator + dimensionValueName
...@@ -1291,7 +1296,8 @@ public class UserRoleServiceImpl extends AbstractService { ...@@ -1291,7 +1296,8 @@ public class UserRoleServiceImpl extends AbstractService {
} }
private RoleDto getRoleDtoById(String roleId) { private RoleDto getRoleDtoById(String roleId) {
Role query = roleMapper.selectByPrimaryKey(roleId); // Role query = roleMapper.selectByPrimaryKey(roleId);
Role query = roleData.selectByPrimaryKey(roleId);
return query == null ? new RoleDto() : CommonUtils.copyProperties(query, new RoleDto()); return query == null ? new RoleDto() : CommonUtils.copyProperties(query, new RoleDto());
} }
...@@ -1328,7 +1334,8 @@ public class UserRoleServiceImpl extends AbstractService { ...@@ -1328,7 +1334,8 @@ public class UserRoleServiceImpl extends AbstractService {
userOrganizationRoleMapper.deleteByPrimaryKey(r.getId()); userOrganizationRoleMapper.deleteByPrimaryKey(r.getId());
// 添加日志 // 添加日志
Role role = roleMapper.selectByPrimaryKey(r.getRoleId()); // Role role = roleMapper.selectByPrimaryKey(r.getRoleId());
Role role = roleData.selectByPrimaryKey(r.getRoleId());
String roleName = role == null ? "" : role.getName(); String roleName = role == null ? "" : role.getName();
addOrDeleteDataAddLog(orgName + CommonConstants.DashSignSeparator + roleName, operateUserName, addOrDeleteDataAddLog(orgName + CommonConstants.DashSignSeparator + roleName, operateUserName,
OperationModule.UserOrganizationRole.value(), OperationAction.Delete.value(), ""); OperationModule.UserOrganizationRole.value(), OperationAction.Delete.value(), "");
...@@ -1373,7 +1380,8 @@ public class UserRoleServiceImpl extends AbstractService { ...@@ -1373,7 +1380,8 @@ public class UserRoleServiceImpl extends AbstractService {
userRole.getRoleId()); userRole.getRoleId());
userOrganizationRoleMapper.insert(userRole); userOrganizationRoleMapper.insert(userRole);
// 添加日志 // 添加日志
Role roleObject = roleMapper.selectByPrimaryKey(item.getRoleId()); // Role roleObject = roleMapper.selectByPrimaryKey(item.getRoleId());
Role roleObject = roleData.selectByPrimaryKey(item.getRoleId());
String roleName = roleObject == null ? "" : roleObject.getName(); String roleName = roleObject == null ? "" : roleObject.getName();
addOrDeleteDataAddLog(orgName + CommonConstants.DashSignSeparator + roleName, operateUserName, addOrDeleteDataAddLog(orgName + CommonConstants.DashSignSeparator + roleName, operateUserName,
OperationModule.UserOrganizationRole.value(), OperationAction.New.value(), ""); OperationModule.UserOrganizationRole.value(), OperationAction.New.value(), "");
......
...@@ -28,6 +28,7 @@ import pwc.taxtech.atms.dao.RolePermissionMapper; ...@@ -28,6 +28,7 @@ import pwc.taxtech.atms.dao.RolePermissionMapper;
import pwc.taxtech.atms.dao.UserMapper; import pwc.taxtech.atms.dao.UserMapper;
import pwc.taxtech.atms.dao.UserOrganizationMapper; import pwc.taxtech.atms.dao.UserOrganizationMapper;
import pwc.taxtech.atms.dao.UserRoleMapper; import pwc.taxtech.atms.dao.UserRoleMapper;
import pwc.taxtech.atms.data.RoleData;
import pwc.taxtech.atms.dpo.RoleInfo; import pwc.taxtech.atms.dpo.RoleInfo;
import pwc.taxtech.atms.dpo.UserDto; import pwc.taxtech.atms.dpo.UserDto;
import pwc.taxtech.atms.dpo.UserRoleInfo; import pwc.taxtech.atms.dpo.UserRoleInfo;
...@@ -102,6 +103,8 @@ public class UserServiceImpl extends AbstractService { ...@@ -102,6 +103,8 @@ public class UserServiceImpl extends AbstractService {
@Autowired @Autowired
private UserRoleServiceImpl userRoleService; private UserRoleServiceImpl userRoleService;
@Autowired @Autowired
private RoleData roleData;
@Autowired
private JwtAuthenticationService jwtAuthenticationService; private JwtAuthenticationService jwtAuthenticationService;
@Value("${api.url}") @Value("${api.url}")
...@@ -374,7 +377,7 @@ public class UserServiceImpl extends AbstractService { ...@@ -374,7 +377,7 @@ public class UserServiceImpl extends AbstractService {
final String inputLoginName = input.getEmail(); final String inputLoginName = input.getEmail();
Assert.hasText(inputLoginName, "empty email"); Assert.hasText(inputLoginName, "empty email");
Assert.hasText(input.getPassword(), "empty password"); Assert.hasText(input.getPassword(), "empty password");
logger.debug("ready to call userMapper.selectByUserNameIgnoreCase"); logger.debug("ready to call userMapper.selectByserNameIgnoreCase");
// 查找用户时需要忽略大小写 // 查找用户时需要忽略大小写
User tempUser = userMapper.selectByUserNameIgnoreCase(inputLoginName); User tempUser = userMapper.selectByUserNameIgnoreCase(inputLoginName);
logger.debug("print tempUser is null?:{}", tempUser == null); logger.debug("print tempUser is null?:{}", tempUser == null);
...@@ -460,8 +463,8 @@ public class UserServiceImpl extends AbstractService { ...@@ -460,8 +463,8 @@ public class UserServiceImpl extends AbstractService {
// 参照C#代码设置password // 参照C#代码设置password
userDto.setPassword(input.getPassword()); userDto.setPassword(input.getPassword());
userDto.setHasValidPeriod(false); userDto.setHasValidPeriod(false);
// todo 登陆成功后清除缓存中的用户权限 // 登陆成功后清除缓存中的用户后台权限
jwtAuthenticationService.removeApiAuthList(tempUser.getUserName()); jwtAuthenticationService.removeApiAuthList(tempUser.getId());
} else { } else {
logger.error("状态异常"); logger.error("状态异常");
} }
...@@ -711,7 +714,8 @@ public class UserServiceImpl extends AbstractService { ...@@ -711,7 +714,8 @@ public class UserServiceImpl extends AbstractService {
logger.debug("Start to delete userRole [ {} ]", userRole.getId()); logger.debug("Start to delete userRole [ {} ]", userRole.getId());
userRoleMapper.deleteByPrimaryKey(userRole.getId()); userRoleMapper.deleteByPrimaryKey(userRole.getId());
} }
List<Role> roleQuery = roleMapper.selectByExample(new RoleExample()); // List<Role> roleQuery = roleMapper.selectByExample(new RoleExample());
List<Role> roleQuery = roleData.selectByServiceTypeId(null);
for (String role : userDto.getRoleIds()) { for (String role : userDto.getRoleIds()) {
if (oldUserRoleList.stream().anyMatch(sa -> Objects.equals(sa.getRoleId(), role))) { if (oldUserRoleList.stream().anyMatch(sa -> Objects.equals(sa.getRoleId(), role))) {
continue; continue;
...@@ -907,7 +911,8 @@ public class UserServiceImpl extends AbstractService { ...@@ -907,7 +911,8 @@ public class UserServiceImpl extends AbstractService {
logger.debug("Start to delete UserOrganizationRole [ {} ]", oneTarget.getId()); logger.debug("Start to delete UserOrganizationRole [ {} ]", oneTarget.getId());
userOrganizationRoleMapper.deleteByPrimaryKey(oneTarget.getId()); userOrganizationRoleMapper.deleteByPrimaryKey(oneTarget.getId());
// 添加日志 // 添加日志
Role role = roleMapper.selectByPrimaryKey(oneTarget.getRoleId()); // Role role = roleMapper.selectByPrimaryKey(oneTarget.getRoleId());
Role role = roleData.selectByPrimaryKey(oneTarget.getRoleId());
String roleName = role == null ? "" : role.getName(); String roleName = role == null ? "" : role.getName();
operationLogService operationLogService
.addOrDeleteDataAddLog(generateUpdateLogParams(OperateLogType.OperationLogUser.value(), .addOrDeleteDataAddLog(generateUpdateLogParams(OperateLogType.OperationLogUser.value(),
......
...@@ -44,6 +44,26 @@ ...@@ -44,6 +44,26 @@
overflowToDisk="false" overflowToDisk="false"
diskPersistent="false"/> diskPersistent="false"/>
<!-- roleByServiceTypeIdCache缓存 -->
<cache name="roleByServiceTypeIdCache"
maxElementsOnDisk="10000"
maxElementsInMemory="10000"
timeToIdleSeconds="86400"
timeToLiveSeconds="86400"
eternal="true"
overflowToDisk="false"
diskPersistent="false"/>
<!-- roleByIdCache缓存 -->
<cache name="roleByIdCache"
maxElementsOnDisk="10000"
maxElementsInMemory="10000"
timeToIdleSeconds="86400"
timeToLiveSeconds="86400"
eternal="true"
overflowToDisk="false"
diskPersistent="false"/>
</ehcache> </ehcache>
<!-- <!--
<diskStore>==========当内存缓存中对象数量超过maxElementsInMemory时,将缓存对象写到磁盘缓存中(需对象实现序列化接口) <diskStore>==========当内存缓存中对象数量超过maxElementsInMemory时,将缓存对象写到磁盘缓存中(需对象实现序列化接口)
......
...@@ -479,7 +479,7 @@ public class DataMigration extends CommonIT { ...@@ -479,7 +479,7 @@ public class DataMigration extends CommonIT {
taxRuleSetting.setGroupName(MapUtils.getString(item, "GroupName")); taxRuleSetting.setGroupName(MapUtils.getString(item, "GroupName"));
taxRuleSetting.setName(MapUtils.getString(item, "Name")); taxRuleSetting.setName(MapUtils.getString(item, "Name"));
taxRuleSetting.setIsDefault(MapUtils.getBoolean(item, "IsDefault")); taxRuleSetting.setIsDefault(MapUtils.getBoolean(item, "IsDefault"));
taxRuleSetting.setTaxRate(new BigDecimal(MapUtils.getFloat(item, "TaxRate"))); taxRuleSetting.setTaxRate(MapUtils.getFloat(item, "TaxRate"));
taxRuleSetting.setCreateBy(StringUtils.EMPTY); taxRuleSetting.setCreateBy(StringUtils.EMPTY);
taxRuleSetting.setUpdateBy(StringUtils.EMPTY); taxRuleSetting.setUpdateBy(StringUtils.EMPTY);
taxRuleSettingMapper.insert(taxRuleSetting); taxRuleSettingMapper.insert(taxRuleSetting);
......
...@@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyMapper; import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.dpo.OrganizationDto;
import pwc.taxtech.atms.entity.BusinessUnit; import pwc.taxtech.atms.entity.BusinessUnit;
import pwc.taxtech.atms.entity.BusinessUnitExample; import pwc.taxtech.atms.entity.BusinessUnitExample;
......
...@@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyMapper; import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.dpo.OrganizationDto;
import pwc.taxtech.atms.entity.Dimension; import pwc.taxtech.atms.entity.Dimension;
import pwc.taxtech.atms.entity.DimensionExample; import pwc.taxtech.atms.entity.DimensionExample;
......
...@@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyMapper; import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.dpo.DimensionValueJoinDimensionDto;
import pwc.taxtech.atms.entity.DimensionValue; import pwc.taxtech.atms.entity.DimensionValue;
import pwc.taxtech.atms.entity.DimensionValueExample; import pwc.taxtech.atms.entity.DimensionValueExample;
......
...@@ -5,6 +5,8 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -5,6 +5,8 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyMapper; import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.dpo.DimensionParamDto;
import pwc.taxtech.atms.dpo.UnionDimensionValueOrg;
import pwc.taxtech.atms.entity.DimensionValueOrg; import pwc.taxtech.atms.entity.DimensionValueOrg;
import pwc.taxtech.atms.entity.DimensionValueOrgExample; import pwc.taxtech.atms.entity.DimensionValueOrgExample;
......
...@@ -7,6 +7,7 @@ import org.apache.ibatis.session.RowBounds; ...@@ -7,6 +7,7 @@ import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyMapper; import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.entity.Industry; import pwc.taxtech.atms.entity.Industry;
import pwc.taxtech.atms.entity.IndustryExample; import pwc.taxtech.atms.entity.IndustryExample;
import pwc.taxtech.atms.entity.TemplateGroup;
@Mapper @Mapper
public interface IndustryMapper extends MyMapper { public interface IndustryMapper extends MyMapper {
......
...@@ -3,8 +3,13 @@ package pwc.taxtech.atms.dao; ...@@ -3,8 +3,13 @@ package pwc.taxtech.atms.dao;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyMapper; import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.dpo.DimensionValueOrgDto;
import pwc.taxtech.atms.dpo.OrgBasicDto;
import pwc.taxtech.atms.dpo.OrgGeneralInfoMiddleDto;
import pwc.taxtech.atms.dpo.OrganizationDto;
import pwc.taxtech.atms.entity.Organization; import pwc.taxtech.atms.entity.Organization;
import pwc.taxtech.atms.entity.OrganizationExample; import pwc.taxtech.atms.entity.OrganizationExample;
......
...@@ -73,4 +73,20 @@ public interface OrganizationTaxRuleMapper extends MyMapper { ...@@ -73,4 +73,20 @@ public interface OrganizationTaxRuleMapper extends MyMapper {
* @mbg.generated * @mbg.generated
*/ */
int updateByExample(@Param("record") OrganizationTaxRule record, @Param("example") OrganizationTaxRuleExample example); int updateByExample(@Param("record") OrganizationTaxRule record, @Param("example") OrganizationTaxRuleExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_tax_rule
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(OrganizationTaxRule record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization_tax_rule
*
* @mbg.generated
*/
int updateByPrimaryKey(OrganizationTaxRule record);
} }
\ No newline at end of file
...@@ -91,6 +91,8 @@ public class OrganizationDto { ...@@ -91,6 +91,8 @@ public class OrganizationDto {
private String businessScope; private String businessScope;
private Boolean isOversea;
public List<EnterpriseAccountSetOrgDto> enterpriseAccountSetOrgList; public List<EnterpriseAccountSetOrgDto> enterpriseAccountSetOrgList;
public List<OrganizationServiceTemplateGroupDto> organizationServiceTemplateGroupList; public List<OrganizationServiceTemplateGroupDto> organizationServiceTemplateGroupList;
public List<DimensionValueOrgDto> dimensionValueOrgList; public List<DimensionValueOrgDto> dimensionValueOrgList;
...@@ -595,6 +597,14 @@ public class OrganizationDto { ...@@ -595,6 +597,14 @@ public class OrganizationDto {
this.taxControlDiskList = taxControlDiskList; this.taxControlDiskList = taxControlDiskList;
} }
public Boolean getOversea() {
return isOversea;
}
public void setOversea(Boolean oversea) {
isOversea = oversea;
}
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
......
...@@ -45,7 +45,7 @@ public class CellTemplateConfig extends BaseEntity implements Serializable { ...@@ -45,7 +45,7 @@ public class CellTemplateConfig extends BaseEntity implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
private Long dataSourceType; private Integer dataSourceType;
/** /**
* *
...@@ -279,7 +279,7 @@ public class CellTemplateConfig extends BaseEntity implements Serializable { ...@@ -279,7 +279,7 @@ public class CellTemplateConfig extends BaseEntity implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
public Long getDataSourceType() { public Integer getDataSourceType() {
return dataSourceType; return dataSourceType;
} }
...@@ -291,7 +291,7 @@ public class CellTemplateConfig extends BaseEntity implements Serializable { ...@@ -291,7 +291,7 @@ public class CellTemplateConfig extends BaseEntity implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
public void setDataSourceType(Long dataSourceType) { public void setDataSourceType(Integer dataSourceType) {
this.dataSourceType = dataSourceType; this.dataSourceType = dataSourceType;
} }
......
...@@ -385,52 +385,52 @@ public class CellTemplateConfigExample { ...@@ -385,52 +385,52 @@ public class CellTemplateConfigExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDataSourceTypeEqualTo(Long value) { public Criteria andDataSourceTypeEqualTo(Integer value) {
addCriterion("data_source_type =", value, "dataSourceType"); addCriterion("data_source_type =", value, "dataSourceType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDataSourceTypeNotEqualTo(Long value) { public Criteria andDataSourceTypeNotEqualTo(Integer value) {
addCriterion("data_source_type <>", value, "dataSourceType"); addCriterion("data_source_type <>", value, "dataSourceType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDataSourceTypeGreaterThan(Long value) { public Criteria andDataSourceTypeGreaterThan(Integer value) {
addCriterion("data_source_type >", value, "dataSourceType"); addCriterion("data_source_type >", value, "dataSourceType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDataSourceTypeGreaterThanOrEqualTo(Long value) { public Criteria andDataSourceTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("data_source_type >=", value, "dataSourceType"); addCriterion("data_source_type >=", value, "dataSourceType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDataSourceTypeLessThan(Long value) { public Criteria andDataSourceTypeLessThan(Integer value) {
addCriterion("data_source_type <", value, "dataSourceType"); addCriterion("data_source_type <", value, "dataSourceType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDataSourceTypeLessThanOrEqualTo(Long value) { public Criteria andDataSourceTypeLessThanOrEqualTo(Integer value) {
addCriterion("data_source_type <=", value, "dataSourceType"); addCriterion("data_source_type <=", value, "dataSourceType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDataSourceTypeIn(List<Long> values) { public Criteria andDataSourceTypeIn(List<Integer> values) {
addCriterion("data_source_type in", values, "dataSourceType"); addCriterion("data_source_type in", values, "dataSourceType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDataSourceTypeNotIn(List<Long> values) { public Criteria andDataSourceTypeNotIn(List<Integer> values) {
addCriterion("data_source_type not in", values, "dataSourceType"); addCriterion("data_source_type not in", values, "dataSourceType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDataSourceTypeBetween(Long value1, Long value2) { public Criteria andDataSourceTypeBetween(Integer value1, Integer value2) {
addCriterion("data_source_type between", value1, value2, "dataSourceType"); addCriterion("data_source_type between", value1, value2, "dataSourceType");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDataSourceTypeNotBetween(Long value1, Long value2) { public Criteria andDataSourceTypeNotBetween(Integer value1, Integer value2) {
addCriterion("data_source_type not between", value1, value2, "dataSourceType"); addCriterion("data_source_type not between", value1, value2, "dataSourceType");
return (Criteria) this; return (Criteria) this;
} }
......
...@@ -56,6 +56,8 @@ public class EnterpriseAccountSetOrg extends BaseEntity implements Serializable ...@@ -56,6 +56,8 @@ public class EnterpriseAccountSetOrg extends BaseEntity implements Serializable
*/ */
private Date expiredDate; private Date expiredDate;
private Organization organization;
/** /**
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
* This field corresponds to the database table enterprise_account_set_org * This field corresponds to the database table enterprise_account_set_org
...@@ -184,6 +186,14 @@ public class EnterpriseAccountSetOrg extends BaseEntity implements Serializable ...@@ -184,6 +186,14 @@ public class EnterpriseAccountSetOrg extends BaseEntity implements Serializable
this.expiredDate = expiredDate; this.expiredDate = expiredDate;
} }
public Organization getOrganization() {
return organization;
}
public void setOrganization(Organization organization) {
this.organization = organization;
}
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table enterprise_account_set_org * This method corresponds to the database table enterprise_account_set_org
......
...@@ -63,7 +63,7 @@ public class TaxRuleSetting extends BaseEntity implements Serializable { ...@@ -63,7 +63,7 @@ public class TaxRuleSetting extends BaseEntity implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
private Byte taxRate; private Float taxRate;
/** /**
* *
...@@ -237,7 +237,7 @@ public class TaxRuleSetting extends BaseEntity implements Serializable { ...@@ -237,7 +237,7 @@ public class TaxRuleSetting extends BaseEntity implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
public Byte getTaxRate() { public Float getTaxRate() {
return taxRate; return taxRate;
} }
...@@ -249,7 +249,7 @@ public class TaxRuleSetting extends BaseEntity implements Serializable { ...@@ -249,7 +249,7 @@ public class TaxRuleSetting extends BaseEntity implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
public void setTaxRate(Byte taxRate) { public void setTaxRate(Float taxRate) {
this.taxRate = taxRate; this.taxRate = taxRate;
} }
......
...@@ -535,52 +535,52 @@ public class TaxRuleSettingExample { ...@@ -535,52 +535,52 @@ public class TaxRuleSettingExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTaxRateEqualTo(Byte value) { public Criteria andTaxRateEqualTo(Float value) {
addCriterion("tax_rate =", value, "taxRate"); addCriterion("tax_rate =", value, "taxRate");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTaxRateNotEqualTo(Byte value) { public Criteria andTaxRateNotEqualTo(Float value) {
addCriterion("tax_rate <>", value, "taxRate"); addCriterion("tax_rate <>", value, "taxRate");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTaxRateGreaterThan(Byte value) { public Criteria andTaxRateGreaterThan(Float value) {
addCriterion("tax_rate >", value, "taxRate"); addCriterion("tax_rate >", value, "taxRate");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTaxRateGreaterThanOrEqualTo(Byte value) { public Criteria andTaxRateGreaterThanOrEqualTo(Float value) {
addCriterion("tax_rate >=", value, "taxRate"); addCriterion("tax_rate >=", value, "taxRate");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTaxRateLessThan(Byte value) { public Criteria andTaxRateLessThan(Float value) {
addCriterion("tax_rate <", value, "taxRate"); addCriterion("tax_rate <", value, "taxRate");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTaxRateLessThanOrEqualTo(Byte value) { public Criteria andTaxRateLessThanOrEqualTo(Float value) {
addCriterion("tax_rate <=", value, "taxRate"); addCriterion("tax_rate <=", value, "taxRate");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTaxRateIn(List<Byte> values) { public Criteria andTaxRateIn(List<Float> values) {
addCriterion("tax_rate in", values, "taxRate"); addCriterion("tax_rate in", values, "taxRate");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTaxRateNotIn(List<Byte> values) { public Criteria andTaxRateNotIn(List<Float> values) {
addCriterion("tax_rate not in", values, "taxRate"); addCriterion("tax_rate not in", values, "taxRate");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTaxRateBetween(Byte value1, Byte value2) { public Criteria andTaxRateBetween(Float value1, Float value2) {
addCriterion("tax_rate between", value1, value2, "taxRate"); addCriterion("tax_rate between", value1, value2, "taxRate");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTaxRateNotBetween(Byte value1, Byte value2) { public Criteria andTaxRateNotBetween(Float value1, Float value2) {
addCriterion("tax_rate not between", value1, value2, "taxRate"); addCriterion("tax_rate not between", value1, value2, "taxRate");
return (Criteria) this; return (Criteria) this;
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id" />
<result column="cell_template_id" jdbcType="BIGINT" property="cellTemplateId" /> <result column="cell_template_id" jdbcType="BIGINT" property="cellTemplateId" />
<result column="report_template_id" jdbcType="BIGINT" property="reportTemplateId" /> <result column="report_template_id" jdbcType="BIGINT" property="reportTemplateId" />
<result column="data_source_type" jdbcType="BIGINT" property="dataSourceType" /> <result column="data_source_type" jdbcType="INTEGER" property="dataSourceType" />
<result column="formula" jdbcType="VARCHAR" property="formula" /> <result column="formula" jdbcType="VARCHAR" property="formula" />
<result column="formula_description" jdbcType="VARCHAR" property="formulaDescription" /> <result column="formula_description" jdbcType="VARCHAR" property="formulaDescription" />
<result column="account_codes" jdbcType="VARCHAR" property="accountCodes" /> <result column="account_codes" jdbcType="VARCHAR" property="accountCodes" />
...@@ -162,7 +162,7 @@ ...@@ -162,7 +162,7 @@
invoice_category, formula_data_source, validation, invoice_category, formula_data_source, validation,
validation_description, voucher_keyword) validation_description, voucher_keyword)
values (#{id,jdbcType=BIGINT}, #{cellTemplateId,jdbcType=BIGINT}, #{reportTemplateId,jdbcType=BIGINT}, values (#{id,jdbcType=BIGINT}, #{cellTemplateId,jdbcType=BIGINT}, #{reportTemplateId,jdbcType=BIGINT},
#{dataSourceType,jdbcType=BIGINT}, #{formula,jdbcType=VARCHAR}, #{formulaDescription,jdbcType=VARCHAR}, #{dataSourceType,jdbcType=INTEGER}, #{formula,jdbcType=VARCHAR}, #{formulaDescription,jdbcType=VARCHAR},
#{accountCodes,jdbcType=VARCHAR}, #{invoiceType,jdbcType=INTEGER}, #{taxRate,jdbcType=VARCHAR}, #{accountCodes,jdbcType=VARCHAR}, #{invoiceType,jdbcType=INTEGER}, #{taxRate,jdbcType=VARCHAR},
#{invoiceAmountType,jdbcType=INTEGER}, #{modelIds,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{invoiceAmountType,jdbcType=INTEGER}, #{modelIds,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
#{reportTemplateId,jdbcType=BIGINT}, #{reportTemplateId,jdbcType=BIGINT},
</if> </if>
<if test="dataSourceType != null"> <if test="dataSourceType != null">
#{dataSourceType,jdbcType=BIGINT}, #{dataSourceType,jdbcType=INTEGER},
</if> </if>
<if test="formula != null"> <if test="formula != null">
#{formula,jdbcType=VARCHAR}, #{formula,jdbcType=VARCHAR},
...@@ -327,7 +327,7 @@ ...@@ -327,7 +327,7 @@
report_template_id = #{record.reportTemplateId,jdbcType=BIGINT}, report_template_id = #{record.reportTemplateId,jdbcType=BIGINT},
</if> </if>
<if test="record.dataSourceType != null"> <if test="record.dataSourceType != null">
data_source_type = #{record.dataSourceType,jdbcType=BIGINT}, data_source_type = #{record.dataSourceType,jdbcType=INTEGER},
</if> </if>
<if test="record.formula != null"> <if test="record.formula != null">
formula = #{record.formula,jdbcType=VARCHAR}, formula = #{record.formula,jdbcType=VARCHAR},
...@@ -391,7 +391,7 @@ ...@@ -391,7 +391,7 @@
set id = #{record.id,jdbcType=BIGINT}, set id = #{record.id,jdbcType=BIGINT},
cell_template_id = #{record.cellTemplateId,jdbcType=BIGINT}, cell_template_id = #{record.cellTemplateId,jdbcType=BIGINT},
report_template_id = #{record.reportTemplateId,jdbcType=BIGINT}, report_template_id = #{record.reportTemplateId,jdbcType=BIGINT},
data_source_type = #{record.dataSourceType,jdbcType=BIGINT}, data_source_type = #{record.dataSourceType,jdbcType=INTEGER},
formula = #{record.formula,jdbcType=VARCHAR}, formula = #{record.formula,jdbcType=VARCHAR},
formula_description = #{record.formulaDescription,jdbcType=VARCHAR}, formula_description = #{record.formulaDescription,jdbcType=VARCHAR},
account_codes = #{record.accountCodes,jdbcType=VARCHAR}, account_codes = #{record.accountCodes,jdbcType=VARCHAR},
...@@ -426,7 +426,7 @@ ...@@ -426,7 +426,7 @@
report_template_id = #{reportTemplateId,jdbcType=BIGINT}, report_template_id = #{reportTemplateId,jdbcType=BIGINT},
</if> </if>
<if test="dataSourceType != null"> <if test="dataSourceType != null">
data_source_type = #{dataSourceType,jdbcType=BIGINT}, data_source_type = #{dataSourceType,jdbcType=INTEGER},
</if> </if>
<if test="formula != null"> <if test="formula != null">
formula = #{formula,jdbcType=VARCHAR}, formula = #{formula,jdbcType=VARCHAR},
...@@ -487,7 +487,7 @@ ...@@ -487,7 +487,7 @@
update cell_template_config update cell_template_config
set cell_template_id = #{cellTemplateId,jdbcType=BIGINT}, set cell_template_id = #{cellTemplateId,jdbcType=BIGINT},
report_template_id = #{reportTemplateId,jdbcType=BIGINT}, report_template_id = #{reportTemplateId,jdbcType=BIGINT},
data_source_type = #{dataSourceType,jdbcType=BIGINT}, data_source_type = #{dataSourceType,jdbcType=INTEGER},
formula = #{formula,jdbcType=VARCHAR}, formula = #{formula,jdbcType=VARCHAR},
formula_description = #{formulaDescription,jdbcType=VARCHAR}, formula_description = #{formulaDescription,jdbcType=VARCHAR},
account_codes = #{accountCodes,jdbcType=VARCHAR}, account_codes = #{accountCodes,jdbcType=VARCHAR},
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<result column="is_default" jdbcType="BIT" property="isDefault" /> <result column="is_default" jdbcType="BIT" property="isDefault" />
<result column="group_name" jdbcType="VARCHAR" property="groupName" /> <result column="group_name" jdbcType="VARCHAR" property="groupName" />
<result column="tax_base" jdbcType="VARCHAR" property="taxBase" /> <result column="tax_base" jdbcType="VARCHAR" property="taxBase" />
<result column="tax_rate" jdbcType="TINYINT" property="taxRate" /> <result column="tax_rate" jdbcType="REAL" property="taxRate" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" /> <result column="create_by" jdbcType="VARCHAR" property="createBy" />
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
create_time, update_time, create_by, create_time, update_time, create_by,
update_by) update_by)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{isDefault,jdbcType=BIT}, values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{isDefault,jdbcType=BIT},
#{groupName,jdbcType=VARCHAR}, #{taxBase,jdbcType=VARCHAR}, #{taxRate,jdbcType=TINYINT}, #{groupName,jdbcType=VARCHAR}, #{taxBase,jdbcType=VARCHAR}, #{taxRate,jdbcType=REAL},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=VARCHAR},
#{updateBy,jdbcType=VARCHAR}) #{updateBy,jdbcType=VARCHAR})
</insert> </insert>
...@@ -206,7 +206,7 @@ ...@@ -206,7 +206,7 @@
#{taxBase,jdbcType=VARCHAR}, #{taxBase,jdbcType=VARCHAR},
</if> </if>
<if test="taxRate != null"> <if test="taxRate != null">
#{taxRate,jdbcType=TINYINT}, #{taxRate,jdbcType=REAL},
</if> </if>
<if test="createTime != null"> <if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP},
...@@ -255,7 +255,7 @@ ...@@ -255,7 +255,7 @@
tax_base = #{record.taxBase,jdbcType=VARCHAR}, tax_base = #{record.taxBase,jdbcType=VARCHAR},
</if> </if>
<if test="record.taxRate != null"> <if test="record.taxRate != null">
tax_rate = #{record.taxRate,jdbcType=TINYINT}, tax_rate = #{record.taxRate,jdbcType=REAL},
</if> </if>
<if test="record.createTime != null"> <if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP}, create_time = #{record.createTime,jdbcType=TIMESTAMP},
...@@ -285,7 +285,7 @@ ...@@ -285,7 +285,7 @@
is_default = #{record.isDefault,jdbcType=BIT}, is_default = #{record.isDefault,jdbcType=BIT},
group_name = #{record.groupName,jdbcType=VARCHAR}, group_name = #{record.groupName,jdbcType=VARCHAR},
tax_base = #{record.taxBase,jdbcType=VARCHAR}, tax_base = #{record.taxBase,jdbcType=VARCHAR},
tax_rate = #{record.taxRate,jdbcType=TINYINT}, tax_rate = #{record.taxRate,jdbcType=REAL},
create_time = #{record.createTime,jdbcType=TIMESTAMP}, create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP}, update_time = #{record.updateTime,jdbcType=TIMESTAMP},
create_by = #{record.createBy,jdbcType=VARCHAR}, create_by = #{record.createBy,jdbcType=VARCHAR},
...@@ -314,7 +314,7 @@ ...@@ -314,7 +314,7 @@
tax_base = #{taxBase,jdbcType=VARCHAR}, tax_base = #{taxBase,jdbcType=VARCHAR},
</if> </if>
<if test="taxRate != null"> <if test="taxRate != null">
tax_rate = #{taxRate,jdbcType=TINYINT}, tax_rate = #{taxRate,jdbcType=REAL},
</if> </if>
<if test="createTime != null"> <if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
...@@ -341,7 +341,7 @@ ...@@ -341,7 +341,7 @@
is_default = #{isDefault,jdbcType=BIT}, is_default = #{isDefault,jdbcType=BIT},
group_name = #{groupName,jdbcType=VARCHAR}, group_name = #{groupName,jdbcType=VARCHAR},
tax_base = #{taxBase,jdbcType=VARCHAR}, tax_base = #{taxBase,jdbcType=VARCHAR},
tax_rate = #{taxRate,jdbcType=TINYINT}, tax_rate = #{taxRate,jdbcType=REAL},
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP},
create_by = #{createBy,jdbcType=VARCHAR}, create_by = #{createBy,jdbcType=VARCHAR},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment