Commit daa2cea5 authored by fangxinjiang's avatar fangxinjiang

工资最低配置更新

parent be408c47
......@@ -159,126 +159,7 @@ public class TMinSalaryServiceImpl extends ServiceImpl<TMinSalaryMapper, TMinSal
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex + 1);
StringBuilder errorMessage = new StringBuilder("");
if (Common.isEmpty(data.getId())) {
data.setErrorFlag(true);
errorMessage.append("ID为空;");
} else {
if (Common.isEmpty(baseMapper.selectById(data.getId()))) {
data.setErrorFlag(true);
errorMessage.append("ID不存在无法更新,请核实后再操作!;");
}
if (Common.isEmpty(data.getLocation()) && Common.isEmpty(data.getSalaryBase()) && Common.isEmpty(data.getStatus())) {
data.setErrorFlag(true);
errorMessage.append("所在地、最低工资(元)、状态为空;");
}
if(null!=data.getLocation()) {
if (data.getLocation().contains("-")) {
data.setErrorFlag(true);
errorMessage.append("所在地格式与列表保持一致;");
}
}else {
if (null != data.getLocation()) {
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("对应区域不存在;");
} else {
TMinSalary entity = baseMapper.selectById(data.getId());
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.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 (location.length > 2) {
String redisProvinceName = getRedisAreaValue(location[CommonConstants.ZERO_INT]);
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("对应区域不存在;");
}
else {
TMinSalary entity = baseMapper.selectById(data.getId());
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);
}
if (Common.isNotNull(redisTownName)) {
query.eq(TMinSalary::getTown, redisTownName);
}
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 (!ValidityUtil.validateStandard(data.getSalaryBase())) {
data.setErrorFlag(true);
errorMessage.append("最低工资,请填写>0的两位小数;");
}
}
if (null != data.getStatus()) {
if (!(CommonConstants.START.equals(data.getStatus()) || CommonConstants.STOP.equals(data.getStatus()))) {
data.setErrorFlag(true);
errorMessage.append("填写的状态不是启用或停用");
}
}
if(data.isErrorFlag())
{
extracted(data, errorMessage); if(data.isErrorFlag()){
data.setErrorMessage(errorMessage.toString());
}
tMinSalaryImportVoList.add(data);
......@@ -359,6 +240,136 @@ public class TMinSalaryServiceImpl extends ServiceImpl<TMinSalaryMapper, TMinSal
}
private void extracted(TMinSalaryImportVo data, StringBuilder errorMessage) {
if (Common.isEmpty(data.getId())) {
data.setErrorFlag(true);
errorMessage.append("ID为空;");
return;
} else {
if (Common.isEmpty(baseMapper.selectById(data.getId()))) {
data.setErrorFlag(true);
errorMessage.append("ID不存在无法更新,请核实后再操作!;");
return;
}
if (Common.isEmpty(data.getLocation()) && Common.isEmpty(data.getSalaryBase()) && Common.isEmpty(data.getStatus())) {
data.setErrorFlag(true);
errorMessage.append("所在地、最低工资(元)、状态为空;");
return;
}
if(null!= data.getLocation()) {
if (data.getLocation().contains("-")) {
data.setErrorFlag(true);
errorMessage.append("所在地格式与列表保持一致;");
return;
}
}
if (null != data.getLocation()) {
String location[] = data.getLocation().split("/");
if (!data.getLocation().isEmpty()) {
if (location.length == 1) {
data.setErrorFlag(true);
errorMessage.append("所在地”请精确到市或县/区;");
return;
}
String redisProvinceName = getRedisAreaValue(location[CommonConstants.ZERO_INT]);
if (Common.isEmpty(redisProvinceName)) {
data.setErrorFlag(true);
errorMessage.append("对应区域不存在;");
return;
}
}
if (location.length == 2) {
String redisProvinceName = getRedisAreaValue(location[CommonConstants.ZERO_INT]);
if (Common.isEmpty(redisProvinceName)) {
data.setErrorFlag(true);
errorMessage.append("对应区域不存在;");
return;
}
String redisCityName = getRedisAreaValue(location[CommonConstants.ONE_INT] + "_" + location[CommonConstants.ZERO_INT]);
if (Common.isEmpty(redisCityName)) {
data.setErrorFlag(true);
errorMessage.append("对应区域不存在;");
return;
} else {
TMinSalary entity = baseMapper.selectById(data.getId());
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.isNull(TMinSalary::getTown);
query.ne(TMinSalary::getId, data.getId());
long res = baseMapper.selectCount(query);
if (res > CommonConstants.ZERO_INT) {
data.setErrorFlag(true);
errorMessage.append("已存在对应区域在用的配置信息;");
return;
}
}
}
}
if (location.length > 2) {
String redisProvinceName = getRedisAreaValue(location[CommonConstants.ZERO_INT]);
String redisCityName = getRedisAreaValue(location[CommonConstants.ONE_INT] + "_" + location[CommonConstants.ZERO_INT]);
if (Common.isEmpty(redisCityName)) {
data.setErrorFlag(true);
errorMessage.append("对应区域不存在;");
return;
}
String redisTownName = getRedisAreaValue(location[CommonConstants.TWO_INT] + "_" + location[CommonConstants.ONE_INT]);
if (Common.isEmpty(redisTownName)) {
data.setErrorFlag(true);
errorMessage.append("对应区域不存在;");
return;
}
else {
TMinSalary entity = baseMapper.selectById(data.getId());
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);
}
if (Common.isNotNull(redisTownName)) {
query.eq(TMinSalary::getTown, redisTownName);
}
query.ne(TMinSalary::getId, data.getId());
long res = baseMapper.selectCount(query);
if (res > CommonConstants.ZERO_INT) {
data.setErrorFlag(true);
errorMessage.append("已存在对应区域在用的配置信息;");
return;
}
}
}
}
}
}
if (Common.isNotNull(data)){
if (null != data.getSalaryBase()) {
if (!ValidityUtil.validateStandard(data.getSalaryBase())) {
data.setErrorFlag(true);
errorMessage.append("最低工资,请填写>0的两位小数;");
}
}
if (null != data.getStatus()) {
if (!(CommonConstants.START.equals(data.getStatus()) || CommonConstants.STOP.equals(data.getStatus()))) {
data.setErrorFlag(true);
errorMessage.append("填写的状态不是启用或停用");
}
}
}
}
private String getRedisAreaValue(String areaString) {
return String.valueOf(RedisUtil.redis.opsForValue().get(CacheConstants.AREA_VALUE + areaString));
......
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