Commit 58e23c59 authored by zhenbin wang's avatar zhenbin wang

feature-wzb:最低工资标准Bug修复

parent 39b3d982
......@@ -56,5 +56,9 @@ public interface TMinSalaryMapper extends BaseMapper<TMinSalary> {
*/
Integer selectByAreaName(String areaName);
Integer selectByPName(Integer id);
Integer selectByCName(Integer id);
Integer selectByTName(Integer id);
Integer selectId(String Id);
TMinSalary selectAddress();
}
......@@ -19,7 +19,9 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.constants.InsurancesConstants;
import com.yifu.cloud.plus.v1.yifu.insurances.util.ValidityUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceAddParam;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TMinSalary;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryEmployee;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TMinSalaryMapper;
......@@ -157,67 +159,132 @@ 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{
TMinSalary ll=baseMapper.selectById(data.getId());
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())){
if (Common.isEmpty(data.getLocation()) && Common.isEmpty(data.getSalaryBase()) && Common.isEmpty(data.getStatus())) {
data.setErrorFlag(true);
errorMessage.append("所在地、最低工资(元)、状态为空;");
}
if (CommonConstants.ZERO_INT == baseMapper.selectId(data.getId())) {
if(null !=data.getLocation()){
String location[] = data.getLocation().split("/");
if (!data.getLocation().isEmpty()) {
if (location.length == 1) {
data.setErrorFlag(true);
errorMessage.append("ID不存在无法更新,请核实后再操作!;");
errorMessage.append("所在地”请精确到市或县/区;");
}
String location[] = data.getLocation().split("/");
String redisProvinceName = getRedisAreaValue(location[CommonConstants.ZERO_INT]);
if (Common.isEmpty(redisProvinceName)) {
data.setErrorFlag(true);
errorMessage.append("对应区域不存在;");
}
if(location.length>1) {
}
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)) {
query.eq(TMinSalary::getProvince,redisProvinceName );
}
if (Common.isNotNull(redisCityName) ){
query.eq(TMinSalary::getCity, redisCityName);
}
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]);
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("对应区域不存在;");
}
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(!data.getLocation().isEmpty()){
if (location.length == 1) {
data.setErrorFlag(true);
errorMessage.append("所在地”请精确到市或县/区;");
}
}
if(null !=data.getSalaryBase()) {
}}
if (null != data.getSalaryBase()) {
if (!ValidityUtil.validateStandard(data.getSalaryBase())) {
data.setErrorFlag(true);
errorMessage.append("最低工资,请填写>0的两位小数;");
}
}
if(!data.getStatus().isEmpty()) {
if (!data.getStatus().isEmpty()) {
if (!(CommonConstants.START.equals(data.getStatus()) || CommonConstants.STOP.equals(data.getStatus()))) {
data.setErrorFlag(true);
errorMessage.append("填写的状态不是启用或停用");
}
}
}
}
if (data.isErrorFlag()) {
data.setErrorMessage(errorMessage.toString());
}
tMinSalaryImportVoList.add(data);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
......@@ -232,7 +299,9 @@ public class TMinSalaryServiceImpl extends ServiceImpl<TMinSalaryMapper, TMinSal
salaryImportsSuccessList.stream().forEach(e -> {
TMinSalary selectOne = new TMinSalary();
selectOne.setId(e.getId());
String location[] = e.getLocation().split("/");
if(location.length>1) {
for (int i = 0; i < location.length; i++) {
if (i == CommonConstants.ZERO_INT) {
int province = baseMapper.selectByAreaName(location[i]);
......@@ -248,6 +317,7 @@ public class TMinSalaryServiceImpl extends ServiceImpl<TMinSalaryMapper, TMinSal
;
}
}
}
if (CommonConstants.START.equals(e.getStatus())) {
selectOne.setStatus(CommonConstants.ONE_INT);
}
......
......@@ -230,16 +230,38 @@
</select>
<select id="selectByAreaName" resultType="integer">
<select id="selectByAreaName" resultType="Integer">
select id from sys_area
WHERE AREA_NAME=#{areaName}
limit 1
</select>
<select id="selectByPName" resultType="Integer">
select count(1) from t_min_salary
WHERE PROVINCE=#{id}
limit 1
</select>
<select id="selectByTName" resultType="Integer">
select count(1) from t_min_salary
WHERE CITY=#{id}
limit 1
</select>
<select id="selectByCName" resultType="Integer">
select count(1) from t_min_salary
WHERE TOWN=#{id}
limit 1
</select>
<select id="selectId" resultType="java.lang.Integer">
select count(1)
from t_min_salary
WHERE ID=#{Id}
</select>
<select id="selectAddress" resultType="com.yifu.cloud.plus.v1.yifu.salary.entity.TMinSalary">
select * from t_min_salary
</select>
</mapper>
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