bug修复
This commit is contained in:
parent
d260385851
commit
b475151988
|
|
@ -203,7 +203,7 @@ public class BackReceiveController extends BaseController {
|
||||||
if (res > 0) {
|
if (res > 0) {
|
||||||
return AjaxResult.success("接收成功");
|
return AjaxResult.success("接收成功");
|
||||||
} else {
|
} else {
|
||||||
return AjaxResult.error("未接收到数据");
|
return AjaxResult.error("退料未完成");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ public class MaPartTypeController extends BaseController {
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@Validated @RequestBody MaPartType maPartType) {
|
public AjaxResult add(@Validated @RequestBody MaPartType maPartType) {
|
||||||
System.out.println(maPartType);
|
System.out.println(maPartType);
|
||||||
if (!maPartTypeService.checkPaNameUnique(maPartType)) {
|
if (!maPartTypeService.checkPaNameUniqueAdd(maPartType)) {
|
||||||
return error("新增配件名称'" + maPartType.getPaName() + "'失败,配件名称已存在");
|
return error("新增配件名称'" + maPartType.getPaName() + "'失败,配件名称已存在");
|
||||||
}
|
}
|
||||||
maPartType.setCreateBy(SecurityUtils.getUsername());
|
maPartType.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
|
@ -167,7 +167,7 @@ public class MaPartTypeController extends BaseController {
|
||||||
public AjaxResult updateById (@RequestBody MaPartType maPartType){
|
public AjaxResult updateById (@RequestBody MaPartType maPartType){
|
||||||
maPartType.setUpdateBy(SecurityUtils.getUsername());
|
maPartType.setUpdateBy(SecurityUtils.getUsername());
|
||||||
// 先判断是否有重复名称
|
// 先判断是否有重复名称
|
||||||
if (!maPartTypeService.checkPaNameUnique(maPartType)) {
|
if (!maPartTypeService.checkPaNameUniqueEdit(maPartType)) {
|
||||||
return error("修改配件名称'" + maPartType.getPaName() + "'失败,配件名称已存在");
|
return error("修改配件名称'" + maPartType.getPaName() + "'失败,配件名称已存在");
|
||||||
}
|
}
|
||||||
return toAjax(maPartTypeService.updateById(maPartType));
|
return toAjax(maPartTypeService.updateById(maPartType));
|
||||||
|
|
|
||||||
|
|
@ -53,10 +53,14 @@ public interface MaPartTypeMapper {
|
||||||
|
|
||||||
int updateById(MaPartType maPartType);
|
int updateById(MaPartType maPartType);
|
||||||
|
|
||||||
int checkPartName(String paName);
|
int checkPartName(MaPartType maPartType);
|
||||||
|
|
||||||
|
int checkPartNameAdd(MaPartType maPartType);
|
||||||
|
|
||||||
List<MaPartType> selectPartName(String paName);
|
List<MaPartType> selectPartName(String paName);
|
||||||
|
|
||||||
List<MaPartType> selectPartNameByLevel(MaPartType maPartType);
|
List<MaPartType> selectPartNameByLevel(MaPartType maPartType);
|
||||||
|
|
||||||
|
List<MaPartType> selectPartNameByLevelAdd(MaPartType maPartType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,18 @@ import java.util.List;
|
||||||
public interface IPartTypeService {
|
public interface IPartTypeService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验配件名称唯一性
|
* 修改时校验配件名称唯一性
|
||||||
* @param maPartType
|
* @param maPartType
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean checkPaNameUnique(MaPartType maPartType);
|
boolean checkPaNameUniqueEdit(MaPartType maPartType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增时校验配件名称唯一性
|
||||||
|
* @param maPartType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean checkPaNameUniqueAdd(MaPartType maPartType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增配件类型
|
* 新增配件类型
|
||||||
|
|
|
||||||
|
|
@ -30,13 +30,13 @@ public class MaPartTypeServiceImpl implements IPartTypeService {
|
||||||
private MaPartTypeMapper maPartTypeMapper;
|
private MaPartTypeMapper maPartTypeMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验配件名称唯一性
|
* 修改时校验配件名称唯一性
|
||||||
*
|
*
|
||||||
* @param maPartType
|
* @param maPartType
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkPaNameUnique(MaPartType maPartType) {
|
public boolean checkPaNameUniqueEdit(MaPartType maPartType) {
|
||||||
// Long paId = StringUtils.isNull(maPartType.getPaId()) ? -1L : maPartType.getPaId();
|
// Long paId = StringUtils.isNull(maPartType.getPaId()) ? -1L : maPartType.getPaId();
|
||||||
// MaPartType info = maPartTypeMapper.checkPartNameUnique(maPartType.getPaId());
|
// MaPartType info = maPartTypeMapper.checkPartNameUnique(maPartType.getPaId());
|
||||||
// if (StringUtils.isNotNull(info) && info.getPaId().longValue() != paId.longValue()) {
|
// if (StringUtils.isNotNull(info) && info.getPaId().longValue() != paId.longValue()) {
|
||||||
|
|
@ -66,7 +66,59 @@ public class MaPartTypeServiceImpl implements IPartTypeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查是否存在相同paName的条目,并且该条目level为1
|
// 检查是否存在相同paName的条目,并且该条目level为1
|
||||||
int count = maPartTypeMapper.checkPartName(maPartType.getPaName());
|
int count = maPartTypeMapper.checkPartName(maPartType);
|
||||||
|
if (count > 0 && num != null && maPartTypes.get(num).getLevel().equals("1")) {
|
||||||
|
// 如果存在且找到的条目level为1,则名称不唯一
|
||||||
|
return UserConstants.NOT_UNIQUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果没有找到符合条件的条目,则名称唯一
|
||||||
|
return UserConstants.UNIQUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增时校验配件名称唯一性
|
||||||
|
*
|
||||||
|
* @param maPartType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean checkPaNameUniqueAdd(MaPartType maPartType) {
|
||||||
|
// Long paId = StringUtils.isNull(maPartType.getPaId()) ? -1L : maPartType.getPaId();
|
||||||
|
// MaPartType info = maPartTypeMapper.checkPartNameUnique(maPartType.getPaId());
|
||||||
|
// if (StringUtils.isNotNull(info) && info.getPaId().longValue() != paId.longValue()) {
|
||||||
|
// return UserConstants.NOT_UNIQUE;
|
||||||
|
// }
|
||||||
|
// 查询具有相同paName的所有MaPartType对象
|
||||||
|
if (maPartType.getLevel() != null && maPartType.getParentId() != null) {
|
||||||
|
List<MaPartType> maPartTypes = maPartTypeMapper.selectPartNameByLevelAdd(maPartType);
|
||||||
|
if (maPartTypes.size() > 0) {
|
||||||
|
return UserConstants.NOT_UNIQUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 查询具有相同paName的所有MaPartType对象
|
||||||
|
List<MaPartType> maPartTypes = maPartTypeMapper.selectPartName(maPartType.getPaName());
|
||||||
|
|
||||||
|
// 用于存储第一个level=1的MaPartType的索引
|
||||||
|
Integer num = null;
|
||||||
|
|
||||||
|
// 遍历查询结果
|
||||||
|
for (int i = 0; i < maPartTypes.size(); i++) {
|
||||||
|
MaPartType maPart = maPartTypes.get(i);
|
||||||
|
if ("1".equals(maPart.getLevel())) {
|
||||||
|
// 如果找到level=1的MaPartType,则记录其索引
|
||||||
|
num = i;
|
||||||
|
break; // 假设我们只需要第一个找到的,所以找到后退出循环
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(maPartType.getParentId()==null){
|
||||||
|
maPartType.setLevel("1");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否存在相同paName的条目,并且该条目level为1
|
||||||
|
int count = maPartTypeMapper.checkPartNameAdd(maPartType);
|
||||||
if (count > 0 && num != null && maPartTypes.get(num).getLevel().equals("1")) {
|
if (count > 0 && num != null && maPartTypes.get(num).getLevel().equals("1")) {
|
||||||
// 如果存在且找到的条目level为1,则名称不唯一
|
// 如果存在且找到的条目level为1,则名称不唯一
|
||||||
return UserConstants.NOT_UNIQUE;
|
return UserConstants.NOT_UNIQUE;
|
||||||
|
|
|
||||||
|
|
@ -608,7 +608,7 @@
|
||||||
bpl.lot_name AS lotName,
|
bpl.lot_name AS lotName,
|
||||||
bui.unit_id AS unitId,
|
bui.unit_id AS unitId,
|
||||||
bui.unit_name AS unitName,
|
bui.unit_name AS unitName,
|
||||||
bai.back_time AS backTime,
|
DATE_FORMAT(bai.back_time, '%Y-%m-%d') AS backTime,
|
||||||
bagi.agreement_code AS agreementCode,
|
bagi.agreement_code AS agreementCode,
|
||||||
tt.task_status AS taskStatus,
|
tt.task_status AS taskStatus,
|
||||||
sd.`name` AS taskName,
|
sd.`name` AS taskName,
|
||||||
|
|
|
||||||
|
|
@ -483,7 +483,7 @@
|
||||||
tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName,
|
tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName,
|
||||||
bpl.lot_id as proId,bpl.lot_name as proName,
|
bpl.lot_id as proId,bpl.lot_name as proName,
|
||||||
bui.unit_id as unitId,bui.unit_name as unitName,
|
bui.unit_id as unitId,bui.unit_name as unitName,
|
||||||
lai.lease_person as leasePerson, lai.phone as leasePhone, tt.create_by as applyFor,d.`name` as taskName,lai.lease_type as leaseType,lai.estimate_lease_time as estimateLeaseTime,
|
lai.lease_person as leasePerson, lai.phone as leasePhone, su.nick_name as applyFor,d.`name` as taskName,lai.lease_type as leaseType,lai.estimate_lease_time as estimateLeaseTime,
|
||||||
case when d.id = '31' then lai.company_audit_remark
|
case when d.id = '31' then lai.company_audit_remark
|
||||||
when d.id = '32' then lai.dept_audit_remark
|
when d.id = '32' then lai.dept_audit_remark
|
||||||
when d.id = '33' then lai.direct_audit_remark
|
when d.id = '33' then lai.direct_audit_remark
|
||||||
|
|
@ -496,7 +496,7 @@
|
||||||
tt.create_time as createTimes, tt.update_time as updateTimes
|
tt.create_time as createTimes, tt.update_time as updateTimes
|
||||||
FROM
|
FROM
|
||||||
tm_task tt
|
tm_task tt
|
||||||
LEFT JOIN sys_user su ON tt.create_by = su.user_name
|
LEFT JOIN sys_user su ON tt.create_by = su.user_id
|
||||||
LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id
|
LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id
|
||||||
LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id
|
LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id
|
||||||
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id
|
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id
|
||||||
|
|
@ -535,7 +535,7 @@
|
||||||
tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName,
|
tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName,
|
||||||
bpl.lot_id as proId,bpl.lot_name as proName,
|
bpl.lot_id as proId,bpl.lot_name as proName,
|
||||||
bui.unit_id as unitId,bui.unit_name as unitName,
|
bui.unit_id as unitId,bui.unit_name as unitName,
|
||||||
lai.lease_person as leasePerson, lai.phone as leasePhone,lai.lease_type as leaseType, lai.estimate_lease_time as estimateLeaseTime,tt.create_by as applyFor,d.`name` as taskName,
|
lai.lease_person as leasePerson, lai.phone as leasePhone,lai.lease_type as leaseType, lai.estimate_lease_time as estimateLeaseTime,su.nick_name as applyFor,d.`name` as taskName,
|
||||||
case when d.id = '31' then lai.company_audit_remark
|
case when d.id = '31' then lai.company_audit_remark
|
||||||
when d.id = '32' then lai.dept_audit_remark
|
when d.id = '32' then lai.dept_audit_remark
|
||||||
when d.id = '33' then lai.direct_audit_remark
|
when d.id = '33' then lai.direct_audit_remark
|
||||||
|
|
@ -548,7 +548,7 @@
|
||||||
tt.create_time as createTimes, tt.update_time as updateTimes
|
tt.create_time as createTimes, tt.update_time as updateTimes
|
||||||
FROM
|
FROM
|
||||||
tm_task tt
|
tm_task tt
|
||||||
LEFT JOIN sys_user su ON tt.create_by = su.user_name
|
LEFT JOIN sys_user su ON tt.create_by = su.user_id
|
||||||
LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id
|
LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id
|
||||||
LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id
|
LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id
|
||||||
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id
|
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id
|
||||||
|
|
@ -642,7 +642,7 @@
|
||||||
tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName,
|
tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName,
|
||||||
bpi.lot_id as proId, bpi.pro_id as projectId,bpi.lot_name as proName,
|
bpi.lot_id as proId, bpi.pro_id as projectId,bpi.lot_name as proName,
|
||||||
bui.unit_id as unitId,bui.unit_name as unitName,
|
bui.unit_id as unitId,bui.unit_name as unitName,
|
||||||
tt.create_by as applyFor,d.`name` as taskName,lai.cost_bearing_party as costBearingParty,lai.cost_bearing_party as costBearingParty,
|
su.nick_name as applyFor,d.`name` as taskName,lai.cost_bearing_party as costBearingParty,lai.cost_bearing_party as costBearingParty,
|
||||||
|
|
||||||
su2.user_name as companyAuditBy,
|
su2.user_name as companyAuditBy,
|
||||||
lai.company_audit_time as companyAuditTime,
|
lai.company_audit_time as companyAuditTime,
|
||||||
|
|
@ -664,7 +664,7 @@
|
||||||
bai.agreement_id as agreementId
|
bai.agreement_id as agreementId
|
||||||
FROM
|
FROM
|
||||||
tm_task tt
|
tm_task tt
|
||||||
LEFT JOIN sys_user su ON tt.create_by = su.user_name
|
LEFT JOIN sys_user su ON tt.create_by = su.user_id
|
||||||
LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id
|
LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id
|
||||||
LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id
|
LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id
|
||||||
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id
|
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = tta.agreement_id
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where pa_id = #{paId}
|
where pa_id = #{paId}
|
||||||
</select>
|
</select>
|
||||||
<select id="checkPartName" resultType="java.lang.Integer">
|
<select id="checkPartName" resultType="java.lang.Integer">
|
||||||
select count(*) from ma_part_type where pa_name = #{paName}
|
select count(*) from ma_part_type where pa_name = #{paName} and pa_id != #{paId} and level = #{level}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="checkPartNameAdd" resultType="java.lang.Integer">
|
||||||
|
select count(*) from ma_part_type where pa_name = #{paName} and level = #{level}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectPartName" resultType="com.bonus.sgzb.base.domain.MaPartType">
|
<select id="selectPartName" resultType="com.bonus.sgzb.base.domain.MaPartType">
|
||||||
select pa_id, pa_name, parent_id, status, num, unit_id, buy_price, level, warn_num, del_flag, create_by, create_time, remark, company_id
|
select pa_id, pa_name, parent_id, status, num, unit_id, buy_price, level, warn_num, del_flag, create_by, create_time, remark, company_id
|
||||||
|
|
@ -198,6 +202,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where pa_name = #{paName}
|
where pa_name = #{paName}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectPartNameByLevel" resultType="com.bonus.sgzb.base.domain.MaPartType">
|
<select id="selectPartNameByLevel" resultType="com.bonus.sgzb.base.domain.MaPartType">
|
||||||
|
select pa_id, pa_name, parent_id, status, num, unit_id, buy_price, level, warn_num, del_flag, create_by, create_time, remark, company_id
|
||||||
|
from ma_part_type
|
||||||
|
where pa_name = #{paName} and level = #{level} and parent_id = #{parentId} and pa_Id!= #{paId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectPartNameByLevelAdd" resultType="com.bonus.sgzb.base.domain.MaPartType">
|
||||||
select pa_id, pa_name, parent_id, status, num, unit_id, buy_price, level, warn_num, del_flag, create_by, create_time, remark, company_id
|
select pa_id, pa_name, parent_id, status, num, unit_id, buy_price, level, warn_num, del_flag, create_by, create_time, remark, company_id
|
||||||
from ma_part_type
|
from ma_part_type
|
||||||
where pa_name = #{paName} and level = #{level} and parent_id = #{parentId}
|
where pa_name = #{paName} and level = #{level} and parent_id = #{parentId}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue