Commit 0bd6e881 authored by zhenbin wang's avatar zhenbin wang

feature-wzb:最低工资bug修复

parent a106eb90
...@@ -171,212 +171,212 @@ public class TMinSalaryServiceImpl extends ServiceImpl<TMinSalaryMapper, TMinSal ...@@ -171,212 +171,212 @@ public class TMinSalaryServiceImpl extends ServiceImpl<TMinSalaryMapper, TMinSal
if (Common.isEmpty(data.getLocation()) && Common.isEmpty(data.getSalaryBase()) && Common.isEmpty(data.getStatus())) { if (Common.isEmpty(data.getLocation()) && Common.isEmpty(data.getSalaryBase()) && Common.isEmpty(data.getStatus())) {
data.setErrorFlag(true); data.setErrorFlag(true);
errorMessage.append("所在地、最低工资(元)、状态为空;"); errorMessage.append("所在地、最低工资(元)、状态为空;");
}
if (null != data.getLocation()) {
if (data.getLocation().contains("/")) {
String location[] = data.getLocation().split("/");
if (!data.getLocation().isEmpty()) {
if (location.length == 1) {
data.setErrorFlag(true);
errorMessage.append("所在地”请精确到市或县/区;");
}
String redisProvinceName = getRedisAreaValue(location[CommonConstants.ZERO_INT]);
if (Common.isEmpty(redisProvinceName)) {
data.setErrorFlag(true);
errorMessage.append("对应区域不存在;");
}
}
if (location.length == 2) {
String redisProvinceName = getRedisAreaValue(location[CommonConstants.ZERO_INT]);
if (Common.isEmpty(redisProvinceName)) {
data.setErrorFlag(true);
errorMessage.append("对应区域不存在;");
}
String redisCityName = getRedisAreaValue(location[CommonConstants.ONE_INT] + "_" + location[CommonConstants.ZERO_INT]);
if (Common.isEmpty(redisCityName)) {
data.setErrorFlag(true);
errorMessage.append("对应区域不存在;");
}
TMinSalary entity = baseMapper.selectById(data.getId());
if (Common.isNotNull(entity)) {
LambdaQueryWrapper<TMinSalary> query = new LambdaQueryWrapper<>();
if (Common.isNotNull(redisProvinceName)) { if (null != data.getLocation()) {
query.eq(TMinSalary::getProvince, redisProvinceName); if (data.getLocation().contains("/")) {
} String location[] = data.getLocation().split("/");
if (Common.isNotNull(redisCityName)) { if (!data.getLocation().isEmpty()) {
query.eq(TMinSalary::getCity, redisCityName); if (location.length == 1) {
data.setErrorFlag(true);
errorMessage.append("所在地”请精确到市或县/区;");
} }
String redisProvinceName = getRedisAreaValue(location[CommonConstants.ZERO_INT]);
long res = baseMapper.selectCount(query); if (Common.isEmpty(redisProvinceName)) {
if (res > CommonConstants.ZERO_INT) {
data.setErrorFlag(true); data.setErrorFlag(true);
errorMessage.append("已存在对应区域在用的配置信息;"); errorMessage.append("对应区域不存在;");
} }
} }
} if (location.length == 2) {
if (location.length > 2) { String redisProvinceName = getRedisAreaValue(location[CommonConstants.ZERO_INT]);
String redisProvinceName = getRedisAreaValue(location[CommonConstants.ZERO_INT]); if (Common.isEmpty(redisProvinceName)) {
if (Common.isEmpty(redisProvinceName)) { data.setErrorFlag(true);
data.setErrorFlag(true); errorMessage.append("对应区域不存在;");
errorMessage.append("对应区域不存在;");
}
String redisCityName = getRedisAreaValue(location[CommonConstants.ONE_INT] + "_" + location[CommonConstants.ZERO_INT]);
if (Common.isEmpty(redisCityName)) {
data.setErrorFlag(true);
errorMessage.append("对应区域不存在;");
}
String redisTownName = getRedisAreaValue(location[CommonConstants.TWO_INT] + "_" + location[CommonConstants.ONE_INT]);
if (Common.isEmpty(redisTownName)) {
data.setErrorFlag(true);
errorMessage.append("对应区域不存在;");
}
TMinSalary entity = baseMapper.selectById(data.getId());
if (Common.isNotNull(entity)) {
LambdaQueryWrapper<TMinSalary> query = new LambdaQueryWrapper<>();
if (Common.isNotNull(redisCityName)) {
query.eq(TMinSalary::getProvince, redisCityName);
} }
if (Common.isNotNull(redisCityName)) { String redisCityName = getRedisAreaValue(location[CommonConstants.ONE_INT] + "_" + location[CommonConstants.ZERO_INT]);
query.eq(TMinSalary::getCity, redisCityName); if (Common.isEmpty(redisCityName)) {
data.setErrorFlag(true);
errorMessage.append("对应区域不存在;");
} }
if (Common.isNotNull(redisTownName)) { TMinSalary entity = baseMapper.selectById(data.getId());
query.eq(TMinSalary::getTown, redisTownName); if (Common.isNotNull(entity)) {
LambdaQueryWrapper<TMinSalary> query = new LambdaQueryWrapper<>();
if (Common.isNotNull(redisProvinceName)) {
query.eq(TMinSalary::getProvince, redisProvinceName);
}
if (Common.isNotNull(redisCityName)) {
query.eq(TMinSalary::getCity, redisCityName);
}
query.ne(TMinSalary::getId, data.getId());
long res = baseMapper.selectCount(query);
if (res > CommonConstants.ZERO_INT) {
data.setErrorFlag(true);
errorMessage.append("已存在对应区域在用的配置信息;");
}
} }
if (Common.isEmpty(location[2])) { }
query.isNull(TMinSalary::getTown); if (location.length > 2) {
String redisProvinceName = getRedisAreaValue(location[CommonConstants.ZERO_INT]);
if (Common.isEmpty(redisProvinceName)) {
data.setErrorFlag(true);
errorMessage.append("对应区域不存在;");
} }
query.ne(TMinSalary::getId, data.getId()); String redisCityName = getRedisAreaValue(location[CommonConstants.ONE_INT] + "_" + location[CommonConstants.ZERO_INT]);
long res = baseMapper.selectCount(query); if (Common.isEmpty(redisCityName)) {
if (res > CommonConstants.ZERO_INT) {
data.setErrorFlag(true); data.setErrorFlag(true);
errorMessage.append("已存在对应区域在用的配置信息;"); errorMessage.append("对应区域不存在;");
} }
String redisTownName = getRedisAreaValue(location[CommonConstants.TWO_INT] + "_" + location[CommonConstants.ONE_INT]);
if (Common.isEmpty(redisTownName)) {
data.setErrorFlag(true);
errorMessage.append("对应区域不存在;");
}
TMinSalary entity = baseMapper.selectById(data.getId());
if (Common.isNotNull(entity)) {
LambdaQueryWrapper<TMinSalary> query = new LambdaQueryWrapper<>();
if (Common.isNotNull(redisCityName)) {
query.eq(TMinSalary::getProvince, redisCityName);
}
if (Common.isNotNull(redisCityName)) {
query.eq(TMinSalary::getCity, redisCityName);
}
if (Common.isNotNull(redisTownName)) {
query.eq(TMinSalary::getTown, redisTownName);
}
if (Common.isEmpty(location[2])) {
query.isNull(TMinSalary::getTown);
}
query.ne(TMinSalary::getId, data.getId());
long res = baseMapper.selectCount(query);
if (res > CommonConstants.ZERO_INT) {
data.setErrorFlag(true);
errorMessage.append("已存在对应区域在用的配置信息;");
}
}
} }
} if (null != data.getSalaryBase()) {
if (null != data.getSalaryBase()) { if (!ValidityUtil.validateStandard(data.getSalaryBase())) {
if (!ValidityUtil.validateStandard(data.getSalaryBase())) { data.setErrorFlag(true);
data.setErrorFlag(true); errorMessage.append("最低工资,请填写>0的两位小数;");
errorMessage.append("最低工资,请填写>0的两位小数;"); }
}
}
if (!data.getStatus().isEmpty()) {
if (!(CommonConstants.START.equals(data.getStatus()) || CommonConstants.STOP.equals(data.getStatus()))) {
data.setErrorFlag(true);
errorMessage.append("填写的状态不是启用或停用");
}
}
}
if (data.getLocation().contains("-")) {
String location[] = data.getLocation().split("-");
if (!data.getLocation().isEmpty()) {
if (location.length == 1) {
data.setErrorFlag(true);
errorMessage.append("所在地”请精确到市或县/区;");
} }
String redisProvinceName = getRedisAreaValue(location[CommonConstants.ZERO_INT]); if (!data.getStatus().isEmpty()) {
if (Common.isEmpty(redisProvinceName)) { if (!(CommonConstants.START.equals(data.getStatus()) || CommonConstants.STOP.equals(data.getStatus()))) {
data.setErrorFlag(true); data.setErrorFlag(true);
errorMessage.append("对应区域不存在;"); errorMessage.append("填写的状态不是启用或停用");
}
} }
} }
if (location.length == 2) {
String redisProvinceName = getRedisAreaValue(location[CommonConstants.ZERO_INT]);
if (Common.isEmpty(redisProvinceName)) {
data.setErrorFlag(true);
errorMessage.append("对应区域不存在;");
}
String redisCityName = getRedisAreaValue(location[CommonConstants.ONE_INT] + "_" + location[CommonConstants.ZERO_INT]);
if (Common.isEmpty(redisCityName)) {
data.setErrorFlag(true);
errorMessage.append("对应区域不存在;");
}
TMinSalary entity = baseMapper.selectById(data.getId());
if (Common.isNotNull(entity)) {
LambdaQueryWrapper<TMinSalary> query = new LambdaQueryWrapper<>();
if (Common.isNotNull(redisProvinceName)) { if (data.getLocation().contains("-")) {
query.eq(TMinSalary::getProvince, redisProvinceName); String location[] = data.getLocation().split("-");
} if (!data.getLocation().isEmpty()) {
if (Common.isNotNull(redisCityName)) { if (location.length == 1) {
query.eq(TMinSalary::getCity, redisCityName); data.setErrorFlag(true);
errorMessage.append("所在地”请精确到市或县/区;");
} }
String redisProvinceName = getRedisAreaValue(location[CommonConstants.ZERO_INT]);
long res = baseMapper.selectCount(query); if (Common.isEmpty(redisProvinceName)) {
if (res > CommonConstants.ZERO_INT) {
data.setErrorFlag(true); data.setErrorFlag(true);
errorMessage.append("已存在对应区域在用的配置信息;"); errorMessage.append("对应区域不存在;");
} }
} }
} if (location.length == 2) {
if (location.length > 2) { String redisProvinceName = getRedisAreaValue(location[CommonConstants.ZERO_INT]);
String redisProvinceName = getRedisAreaValue(location[CommonConstants.ZERO_INT]); if (Common.isEmpty(redisProvinceName)) {
if (Common.isEmpty(redisProvinceName)) { data.setErrorFlag(true);
data.setErrorFlag(true); errorMessage.append("对应区域不存在;");
errorMessage.append("对应区域不存在;");
}
String redisCityName = getRedisAreaValue(location[CommonConstants.ONE_INT] + "_" + location[CommonConstants.ZERO_INT]);
if (Common.isEmpty(redisCityName)) {
data.setErrorFlag(true);
errorMessage.append("对应区域不存在;");
}
String redisTownName = getRedisAreaValue(location[CommonConstants.TWO_INT] + "_" + location[CommonConstants.ONE_INT]);
if (Common.isEmpty(redisTownName)) {
data.setErrorFlag(true);
errorMessage.append("对应区域不存在;");
}
TMinSalary entity = baseMapper.selectById(data.getId());
if (Common.isNotNull(entity)) {
LambdaQueryWrapper<TMinSalary> query = new LambdaQueryWrapper<>();
if (Common.isNotNull(redisCityName)) {
query.eq(TMinSalary::getProvince, redisCityName);
} }
if (Common.isNotNull(redisCityName)) { String redisCityName = getRedisAreaValue(location[CommonConstants.ONE_INT] + "_" + location[CommonConstants.ZERO_INT]);
query.eq(TMinSalary::getCity, redisCityName); if (Common.isEmpty(redisCityName)) {
data.setErrorFlag(true);
errorMessage.append("对应区域不存在;");
} }
if (Common.isNotNull(redisTownName)) { TMinSalary entity = baseMapper.selectById(data.getId());
query.eq(TMinSalary::getTown, redisTownName); if (Common.isNotNull(entity)) {
LambdaQueryWrapper<TMinSalary> query = new LambdaQueryWrapper<>();
if (Common.isNotNull(redisProvinceName)) {
query.eq(TMinSalary::getProvince, redisProvinceName);
}
if (Common.isNotNull(redisCityName)) {
query.eq(TMinSalary::getCity, redisCityName);
}
query.ne(TMinSalary::getId, data.getId());
long res = baseMapper.selectCount(query);
if (res > CommonConstants.ZERO_INT) {
data.setErrorFlag(true);
errorMessage.append("已存在对应区域在用的配置信息;");
}
} }
if (Common.isEmpty(location[2])) { }
query.isNull(TMinSalary::getTown); if (location.length > 2) {
String redisProvinceName = getRedisAreaValue(location[CommonConstants.ZERO_INT]);
if (Common.isEmpty(redisProvinceName)) {
data.setErrorFlag(true);
errorMessage.append("对应区域不存在;");
} }
query.ne(TMinSalary::getId, data.getId()); String redisCityName = getRedisAreaValue(location[CommonConstants.ONE_INT] + "_" + location[CommonConstants.ZERO_INT]);
long res = baseMapper.selectCount(query); if (Common.isEmpty(redisCityName)) {
if (res > CommonConstants.ZERO_INT) {
data.setErrorFlag(true); data.setErrorFlag(true);
errorMessage.append("已存在对应区域在用的配置信息;"); errorMessage.append("对应区域不存在;");
} }
String redisTownName = getRedisAreaValue(location[CommonConstants.TWO_INT] + "_" + location[CommonConstants.ONE_INT]);
if (Common.isEmpty(redisTownName)) {
data.setErrorFlag(true);
errorMessage.append("对应区域不存在;");
}
TMinSalary entity = baseMapper.selectById(data.getId());
if (Common.isNotNull(entity)) {
LambdaQueryWrapper<TMinSalary> query = new LambdaQueryWrapper<>();
if (Common.isNotNull(redisCityName)) {
query.eq(TMinSalary::getProvince, redisCityName);
}
if (Common.isNotNull(redisCityName)) {
query.eq(TMinSalary::getCity, redisCityName);
}
if (Common.isNotNull(redisTownName)) {
query.eq(TMinSalary::getTown, redisTownName);
}
if (Common.isEmpty(location[2])) {
query.isNull(TMinSalary::getTown);
}
query.ne(TMinSalary::getId, data.getId());
long res = baseMapper.selectCount(query);
if (res > CommonConstants.ZERO_INT) {
data.setErrorFlag(true);
errorMessage.append("已存在对应区域在用的配置信息;");
}
}
} }
} if (null != data.getSalaryBase()) {
if (null != data.getSalaryBase()) { if (!ValidityUtil.validateStandard(data.getSalaryBase())) {
if (!ValidityUtil.validateStandard(data.getSalaryBase())) { data.setErrorFlag(true);
data.setErrorFlag(true); errorMessage.append("最低工资,请填写>0的两位小数;");
errorMessage.append("最低工资,请填写>0的两位小数;"); }
} }
} if (null != data.getStatus()) {
if (null!=data.getStatus()) { if (!(CommonConstants.START.equals(data.getStatus()) || CommonConstants.STOP.equals(data.getStatus()))) {
if (!(CommonConstants.START.equals(data.getStatus()) || CommonConstants.STOP.equals(data.getStatus()))) { data.setErrorFlag(true);
data.setErrorFlag(true); errorMessage.append("填写的状态不是启用或停用");
errorMessage.append("填写的状态不是启用或停用"); }
} }
} }
} }
} }
} }
if (data.isErrorFlag()) { if (data.isErrorFlag()) {
data.setErrorMessage(errorMessage.toString()); data.setErrorMessage(errorMessage.toString());
} }
...@@ -398,54 +398,47 @@ public class TMinSalaryServiceImpl extends ServiceImpl<TMinSalaryMapper, TMinSal ...@@ -398,54 +398,47 @@ public class TMinSalaryServiceImpl extends ServiceImpl<TMinSalaryMapper, TMinSal
salaryImportsSuccessList.stream().forEach(e -> { salaryImportsSuccessList.stream().forEach(e -> {
TMinSalary selectOne = new TMinSalary(); TMinSalary selectOne = new TMinSalary();
selectOne.setId(e.getId()); selectOne.setId(e.getId());
if (e.getLocation().contains("/")) { if(null!=e.getLocation()) {
String location[] = e.getLocation().split("/"); if (e.getLocation().contains("/")) {
if (location.length > 1) { String location[] = e.getLocation().split("/");
for (int i = 0; i < location.length; i++) { if (location.length > 1) {
if (i == CommonConstants.ZERO_INT) { for (int i = 0; i < location.length; i++) {
int province = baseMapper.selectByAreaName(location[i]); if (i == CommonConstants.ZERO_INT) {
selectOne.setProvince(province); int province = baseMapper.selectByAreaName(location[i]);
} selectOne.setProvince(province);
if (i == CommonConstants.ONE_INT) { }
int city = baseMapper.selectByAreaName(location[i]); if (i == CommonConstants.ONE_INT) {
selectOne.setCity(city); int city = baseMapper.selectByAreaName(location[i]);
} selectOne.setCity(city);
if (i == CommonConstants.TWO_INT) { }
int town = baseMapper.selectByAreaName(location[i]); if (i == CommonConstants.TWO_INT) {
selectOne.setTown(town); int town = baseMapper.selectByAreaName(location[i]);
; selectOne.setTown(town);
}
} }
} }
} }
if (CommonConstants.START.equals(e.getStatus())) { if (e.getLocation().contains("-")) {
selectOne.setStatus(CommonConstants.ONE_INT); String location[] = e.getLocation().split("-");
} if (location.length > 1) {
if (CommonConstants.STOP.equals(e.getStatus())) { for (int i = 0; i < location.length; i++) {
selectOne.setStatus(CommonConstants.TWO_INT); if (i == CommonConstants.ZERO_INT) {
} int province = baseMapper.selectByAreaName(location[i]);
selectOne.setSalaryBase(e.getSalaryBase()); selectOne.setProvince(province);
selectOne.setUpdateTime(LocalDateTime.now()); }
baseMapper.updateById(selectOne); if (i == CommonConstants.ONE_INT) {
} int city = baseMapper.selectByAreaName(location[i]);
if (e.getLocation().contains("-")) { selectOne.setCity(city);
String location[] = e.getLocation().split("-"); }
if (location.length > 1) { if (i == CommonConstants.TWO_INT) {
for (int i = 0; i < location.length; i++) { int town = baseMapper.selectByAreaName(location[i]);
if (i == CommonConstants.ZERO_INT) { selectOne.setTown(town);
int province = baseMapper.selectByAreaName(location[i]);
selectOne.setProvince(province); }
}
if (i == CommonConstants.ONE_INT) {
int city = baseMapper.selectByAreaName(location[i]);
selectOne.setCity(city);
}
if (i == CommonConstants.TWO_INT) {
int town = baseMapper.selectByAreaName(location[i]);
selectOne.setTown(town);
;
} }
} }
} }
}
if (CommonConstants.START.equals(e.getStatus())) { if (CommonConstants.START.equals(e.getStatus())) {
selectOne.setStatus(CommonConstants.ONE_INT); selectOne.setStatus(CommonConstants.ONE_INT);
} }
...@@ -456,7 +449,7 @@ public class TMinSalaryServiceImpl extends ServiceImpl<TMinSalaryMapper, TMinSal ...@@ -456,7 +449,7 @@ public class TMinSalaryServiceImpl extends ServiceImpl<TMinSalaryMapper, TMinSal
selectOne.setUpdateTime(LocalDateTime.now()); selectOne.setUpdateTime(LocalDateTime.now());
baseMapper.updateById(selectOne); baseMapper.updateById(selectOne);
} }
}); );
} }
} }
......
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