修复仓位id与点位id不相同

This commit is contained in:
2022-12-19 11:06:36 +08:00
parent 1b42b03a40
commit e9abf08ab4
2 changed files with 16 additions and 11 deletions

View File

@@ -91,11 +91,16 @@ public class StructattrServiceImpl implements StructattrService {
StructattrDto byCode = this.findByCode(struct_code); StructattrDto byCode = this.findByCode(struct_code);
if (ObjectUtil.isNotEmpty(byCode)) throw new BadRequestException("编码已存在!"); if (ObjectUtil.isNotEmpty(byCode)) throw new BadRequestException("编码已存在!");
// 获取点位信息
WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point");
JSONObject jsonObject = pointTab.query("point_code = '" + struct_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonObject)) throw new BadRequestException("点位编码为[" + struct_code + "]不存在!");
Long currentUserId = SecurityUtils.getCurrentUserId(); Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getNickName(); String nickName = SecurityUtils.getNickName();
String now = DateUtil.now(); String now = DateUtil.now();
dto.setStruct_id(IdUtil.getSnowflake(1, 1).nextId()); dto.setStruct_id(jsonObject.getLong("point_id"));
dto.setCreate_id(currentUserId); dto.setCreate_id(currentUserId);
dto.setCreate_name(nickName); dto.setCreate_name(nickName);
dto.setUpdate_optid(currentUserId); dto.setUpdate_optid(currentUserId);