Commit 40eb5a1a authored by gary's avatar gary

1、fixbug

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