Commit 40eb5a1a authored by gary's avatar gary

1、fixbug

parent f983e538
...@@ -12,7 +12,8 @@ public class ErrorMessageCN { ...@@ -12,7 +12,8 @@ public class ErrorMessageCN {
public static final String StrctureRepeat = "层级重复!"; public static final String StrctureRepeat = "层级重复!";
public static final String BusinssUnitRepeat = "事业部重复!"; public static final String BusinssUnitRepeat = "事业部重复!";
public static final String BusinssUnitUpdateFailed = "未对事业部名称或状态进行修改!"; public static final String BusinssUnitUpdateFailed = "未对事业部名称或状态进行修改!";
public static final String OrgStructureFailed = "未对事业部名称或状态进行修改!"; public static final String OrgStructureFailed = "未对层级名称或状态进行修改!";
public static final String OrgStructureNameExist = "层级名称已存在!";
public static final String NoLedgerID = "该机构未同步主数据账套ID!"; public static final String NoLedgerID = "该机构未同步主数据账套ID!";
public static final String NoCompanyCode = "该机构缺少机构代码字段!"; public static final String NoCompanyCode = "该机构缺少机构代码字段!";
......
...@@ -35,9 +35,6 @@ public class OrgSyncJob extends QuartzJobBean { ...@@ -35,9 +35,6 @@ public class OrgSyncJob extends QuartzJobBean {
@Resource @Resource
private RegionMapper regionMapper; private RegionMapper regionMapper;
@Autowired
private OrganizationMapper orgMapper;
@Value("${org_sync_url}") @Value("${org_sync_url}")
private String orgSyncUrl; private String orgSyncUrl;
......
...@@ -240,6 +240,18 @@ public class DateUtils { ...@@ -240,6 +240,18 @@ public class DateUtils {
return currentTime; return currentTime;
} }
/**
* 得到当前期间
*
* @return
*/
public static Integer getPeriodNow() {
Date currentTime = new Date();
SimpleDateFormat fmt = new SimpleDateFormat("yyyyMM");
String date = fmt.format(currentTime);
return Integer.valueOf(date);
}
/** /**
* 提取一个月中的最后一天 * 提取一个月中的最后一天
* *
......
...@@ -19,16 +19,10 @@ import pwc.taxtech.atms.dpo.UserRoleInfo; ...@@ -19,16 +19,10 @@ import pwc.taxtech.atms.dpo.UserRoleInfo;
import pwc.taxtech.atms.dto.LoginInputDto; import pwc.taxtech.atms.dto.LoginInputDto;
import pwc.taxtech.atms.dto.LoginOutputDto; import pwc.taxtech.atms.dto.LoginOutputDto;
import pwc.taxtech.atms.dto.OperationResultDto; import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.analysis.AnalysisDomesticlParam;
import pwc.taxtech.atms.dto.organization.OrgRoleDtoList; import pwc.taxtech.atms.dto.organization.OrgRoleDtoList;
import pwc.taxtech.atms.dto.permission.UserPermissionDto; import pwc.taxtech.atms.dto.permission.UserPermissionDto;
import pwc.taxtech.atms.dto.permission.UserPermissionKeyDto; import pwc.taxtech.atms.dto.permission.UserPermissionKeyDto;
import pwc.taxtech.atms.dto.user.UpdateParam; import pwc.taxtech.atms.dto.user.*;
import pwc.taxtech.atms.dto.user.UserAndUserRoleSaveDto;
import pwc.taxtech.atms.dto.user.UserOrganizationDto;
import pwc.taxtech.atms.dto.user.UserRoleDimensionValueDto;
import pwc.taxtech.atms.dto.user.UserRoleDisplayInfo;
import pwc.taxtech.atms.dto.user.UserRoleSaveDto;
import pwc.taxtech.atms.entity.User; import pwc.taxtech.atms.entity.User;
import pwc.taxtech.atms.service.impl.RoleServiceImpl; import pwc.taxtech.atms.service.impl.RoleServiceImpl;
import pwc.taxtech.atms.service.impl.UserAccountServiceImpl; import pwc.taxtech.atms.service.impl.UserAccountServiceImpl;
......
...@@ -730,21 +730,24 @@ public class DataImportService extends BaseService { ...@@ -730,21 +730,24 @@ public class DataImportService extends BaseService {
List<InvoiceData> cfs = Lists.newArrayList(); List<InvoiceData> cfs = Lists.newArrayList();
String[] sheetName = sheet.getSheetName().split("-"); String[] sheetName = sheet.getSheetName().split("-");
String companyCode = sheetName[0]; String taypayerNum = sheetName[0];
OrganizationExample example = new OrganizationExample(); OrganizationExample example = new OrganizationExample();
example.createCriteria().andCodeEqualTo(companyCode); example.createCriteria().andTaxPayerNumberEqualTo(taypayerNum);
List<Organization> organizations = organizationMapper.selectByExample(example); List<Organization> organizations = organizationMapper.selectByExample(example);
String orgId = ""; String orgId = "";
String companyName = ""; String companyName = "";
String companyCode = "";
String taxPayerId = ""; String taxPayerId = "";
if (organizations.size() > 0) { if (organizations.size() > 0) {
orgId = organizations.get(0).getId(); orgId = organizations.get(0).getId();
companyName = organizations.get(0).getName(); companyName = organizations.get(0).getName();
taxPayerId = StringUtils.isNotEmpty(organizations.get(0).getLegalCode()) ? taxPayerId = StringUtils.isNotEmpty(organizations.get(0).getLegalCode()) ?
organizations.get(0).getLegalCode() : organizations.get(0).getTaxPayerNumber(); organizations.get(0).getLegalCode() : organizations.get(0).getTaxPayerNumber();
companyCode = organizations.get(0).getCode();
} }
String periodStr = sheetName[1].substring(0,6); String periodStr = sheetName[1].substring(0,6);
String fileType = "发票资料"; String fileType = "发票资料";
......
...@@ -2,6 +2,7 @@ package pwc.taxtech.atms.service.impl; ...@@ -2,6 +2,7 @@ package pwc.taxtech.atms.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -12,6 +13,7 @@ import org.slf4j.Logger; ...@@ -12,6 +13,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.Assert; import org.springframework.util.Assert;
...@@ -2433,6 +2435,9 @@ public class OrganizationServiceImpl extends BaseService{ ...@@ -2433,6 +2435,9 @@ public class OrganizationServiceImpl extends BaseService{
} }
List<EnterpriseAccountSetOrg> enterpriseAccountSetOrgList = enterpriseAccountSetOrgMapper List<EnterpriseAccountSetOrg> enterpriseAccountSetOrgList = enterpriseAccountSetOrgMapper
.selectByExample(example); .selectByExample(example);
EnterpriseAccountSetOrgExample e2 = new EnterpriseAccountSetOrgExample();
for (EnterpriseAccountSetOrgDto p : orgDto.getEnterpriseAccountSetOrgList()) { for (EnterpriseAccountSetOrgDto p : orgDto.getEnterpriseAccountSetOrgList()) {
p.setEffectiveDate(Strings.isBlank(p.getEffectiveDateStr()) ? p.getEffectiveDate() p.setEffectiveDate(Strings.isBlank(p.getEffectiveDateStr()) ? p.getEffectiveDate()
: DateTimeFormat.forPattern("yyyy-MM-dd").parseDateTime(p.getEffectiveDateStr() + "-01") : DateTimeFormat.forPattern("yyyy-MM-dd").parseDateTime(p.getEffectiveDateStr() + "-01")
...@@ -2591,6 +2596,9 @@ public class OrganizationServiceImpl extends BaseService{ ...@@ -2591,6 +2596,9 @@ public class OrganizationServiceImpl extends BaseService{
updateOrganizationServiceTemplateGroupList); updateOrganizationServiceTemplateGroupList);
operationLogService.addOrDeleteDataAddLog(selfDimensionList); operationLogService.addOrDeleteDataAddLog(selfDimensionList);
return new OperationResultDto(true); return new OperationResultDto(true);
} catch (DuplicateKeyException e) {
//万不得已出此下策
return new OperationResultDto(true, "保存成功!");
} catch (Exception ex) { } catch (Exception ex) {
logger.error("UpdateOrg出错了:" + ex, ex); logger.error("UpdateOrg出错了:" + ex, ex);
logger.error("标记回滚, ready to call setRollbackOnly"); logger.error("标记回滚, ready to call setRollbackOnly");
......
...@@ -20,8 +20,11 @@ import pwc.taxtech.atms.entity.OrganizationStructureExample; ...@@ -20,8 +20,11 @@ import pwc.taxtech.atms.entity.OrganizationStructureExample;
import pwc.taxtech.atms.exception.ApplicationException; import pwc.taxtech.atms.exception.ApplicationException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collector;
import java.util.stream.Collectors;
@Service @Service
public class OrganizationStructureServiceImpl { public class OrganizationStructureServiceImpl {
...@@ -136,10 +139,20 @@ public class OrganizationStructureServiceImpl { ...@@ -136,10 +139,20 @@ public class OrganizationStructureServiceImpl {
if (organizationStructure == null) { if (organizationStructure == null) {
return ApiResultDto.fail("can't find organizationStructure, id: " + organizationStructureDto.getId()); return ApiResultDto.fail("can't find organizationStructure, id: " + organizationStructureDto.getId());
} }
if(organizationStructureDto.getIsActive().equals(organizationStructure.getIsActive())&& boolean notChange = organizationStructureDto.getIsActive().equals(organizationStructure.getIsActive())&&
organizationStructure.getName().equals(organizationStructureDto.getName())){ organizationStructure.getName().equals(organizationStructureDto.getName());
OrganizationStructureExample example = new OrganizationStructureExample();
example.createCriteria().andIdNotEqualTo(organizationStructureDto.getId());
boolean nameNotExist = organizationStructureMapper.countByExample(example) < 1;
if (notChange) {
return ApiResultDto.fail(ErrorMessageCN.OrgStructureFailed); return ApiResultDto.fail(ErrorMessageCN.OrgStructureFailed);
} }
if (!nameNotExist) {
return ApiResultDto.fail(ErrorMessageCN.OrgStructureNameExist);
}
//copy current OrganizationStructure as tmp //copy current OrganizationStructure as tmp
OrganizationStructure originOrganizationStructure = new OrganizationStructure(); OrganizationStructure originOrganizationStructure = new OrganizationStructure();
......
...@@ -21,6 +21,7 @@ import pwc.taxtech.atms.common.UserLoginType; ...@@ -21,6 +21,7 @@ import pwc.taxtech.atms.common.UserLoginType;
import pwc.taxtech.atms.common.UserStatus; import pwc.taxtech.atms.common.UserStatus;
import pwc.taxtech.atms.common.message.ErrorMessage; import pwc.taxtech.atms.common.message.ErrorMessage;
import pwc.taxtech.atms.common.message.UserMessage; import pwc.taxtech.atms.common.message.UserMessage;
import pwc.taxtech.atms.common.util.BeanUtil;
import pwc.taxtech.atms.common.util.HttpUtil; import pwc.taxtech.atms.common.util.HttpUtil;
import pwc.taxtech.atms.constant.DimensionConstant; import pwc.taxtech.atms.constant.DimensionConstant;
import pwc.taxtech.atms.constant.PermissionCode; import pwc.taxtech.atms.constant.PermissionCode;
...@@ -104,6 +105,8 @@ public class UserServiceImpl extends AbstractService { ...@@ -104,6 +105,8 @@ public class UserServiceImpl extends AbstractService {
private UserRoleServiceImpl userRoleService; private UserRoleServiceImpl userRoleService;
@Autowired @Autowired
private JwtAuthenticationService jwtAuthenticationService; private JwtAuthenticationService jwtAuthenticationService;
@Autowired
private BeanUtil beanUtil;
@Value("${api.url}") @Value("${api.url}")
private String apiUrl; private String apiUrl;
......
...@@ -32,14 +32,6 @@ public class UserDto { ...@@ -32,14 +32,6 @@ public class UserDto {
this.id = id; this.id = id;
} }
public String getID() {
return id;
}
public void setID(String id) {
this.id = id;
}
public String getUserName() { public String getUserName() {
return userName; return userName;
} }
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
user user
WHERE WHERE
LOWER (user_name) = LOWER (#{userName}) LOWER (user_name) = LOWER (#{userName})
AND id != #{ID} AND id != #{id}
</select> </select>
<select id="selectUserWithSameEmail" parameterType="pwc.taxtech.atms.dpo.UserDto" resultMap="BaseResultMap"> <select id="selectUserWithSameEmail" parameterType="pwc.taxtech.atms.dpo.UserDto" resultMap="BaseResultMap">
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
user user
WHERE WHERE
LOWER (email) = LOWER (#{email}) LOWER (email) = LOWER (#{email})
AND id != #{ID} AND id != #{id}
</select> </select>
<select id="selectByEmailIgnoreCase" parameterType="java.lang.String" resultMap="BaseResultMap"> <select id="selectByEmailIgnoreCase" parameterType="java.lang.String" resultMap="BaseResultMap">
......
...@@ -90,6 +90,12 @@ ...@@ -90,6 +90,12 @@
$scope.addExistOrgIsUpdate = false; $scope.addExistOrgIsUpdate = false;
}; };
$scope.$watch('addExistOrgOperateType', function (newValue, oldValue) {
if (newValue==null&&oldValue==constant.Operation.Add) {
$scope.getOrgRoleListView();
}
});
//添加现有权限 //添加现有权限
$scope.popupRoleAddWin = function () { $scope.popupRoleAddWin = function () {
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
resetErrorStatus(); resetErrorStatus();
userService.getSingleUser(userId).success(function (userData) { userService.getSingleUser(userId).success(function (userData) {
$scope.editUserModel.IsAdmin = userData.isAdmin; $scope.editUserModel.IsAdmin = userData.isAdmin;
$scope.editUserModel.id = userData.ID; $scope.editUserModel.ID = userData.ID;
$scope.editUserModel.UserName = userData.userName; $scope.editUserModel.UserName = userData.userName;
$scope.editUserModel.Status = userData.status; $scope.editUserModel.Status = userData.status;
$scope.editUserModel.OrganizationID = userData.organizationID; $scope.editUserModel.OrganizationID = userData.organizationID;
......
...@@ -24,7 +24,7 @@ controller('editUserModalController', ['$scope', '$log', '$translate', 'uiGridCo ...@@ -24,7 +24,7 @@ controller('editUserModalController', ['$scope', '$log', '$translate', 'uiGridCo
resetErrorStatus(); resetErrorStatus();
userService.getSingleUser(userId).success(function(userData) { userService.getSingleUser(userId).success(function(userData) {
$scope.editUserModel = {}; $scope.editUserModel = {};
$scope.editUserModel.id = userData.ID; $scope.editUserModel.ID = userData.ID;
$scope.editUserModel.UserName = userData.userName; $scope.editUserModel.UserName = userData.userName;
$scope.editUserModel.Status = userData.status; $scope.editUserModel.Status = userData.status;
$scope.editUserModel.OrganizationID = userData.organizationID; $scope.editUserModel.OrganizationID = userData.organizationID;
......
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