This commit is contained in:
zds
2022-12-01 13:00:22 +08:00
parent 1091de1e92
commit 9b0d70ae33
3 changed files with 28 additions and 9 deletions

View File

@@ -77,7 +77,7 @@ public class JobServiceImpl implements JobService {
public void create(Job resources) {
Job job = jobRepository.findByName(resources.getName());
if(job != null){
throw new EntityExistException(Job.class,"name",resources.getName());
throw new BadRequestException("已存在相同名称!");
}
jobRepository.save(resources);
}
@@ -89,7 +89,7 @@ public class JobServiceImpl implements JobService {
Job job = jobRepository.findById(resources.getId()).orElseGet(Job::new);
Job old = jobRepository.findByName(resources.getName());
if(old != null && !old.getId().equals(resources.getId())){
throw new EntityExistException(Job.class,"name",resources.getName());
throw new BadRequestException("已存在相同名称!");
}
ValidationUtil.isNull( job.getId(),"Job","id",resources.getId());
resources.setId(job.getId());
@@ -123,4 +123,4 @@ public class JobServiceImpl implements JobService {
throw new BadRequestException("所选的岗位中存在用户关联,请解除关联再试!");
}
}
}
}

View File

@@ -40,7 +40,7 @@ public class ParamServiceImpl implements ParamService {
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
WQLObject wo = WQLObject.getWQLObject("sys_param");
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "", "update_time desc");
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "", "code");
final JSONObject json = rb.pageResult();
return json;
}
@@ -74,14 +74,18 @@ public class ParamServiceImpl implements ParamService {
public void create(ParamDto dto) {
String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now();
WQLObject wo = WQLObject.getWQLObject("sys_param");
JSONObject old = wo.query("is_delete='0' and code='"+dto.getCode()+"'").uniqueResult(0);
if(old!=null){
throw new BadRequestException("已存在相同编码!");
}
dto.setId(IdUtil.simpleUUID());
dto.setCreate_by(currentUsername);
dto.setUpdate_by(currentUsername);
dto.setUpdate_time(now);
dto.setCreate_time(now);
WQLObject wo = WQLObject.getWQLObject("sys_param");
JSONObject json = JSONObject.parseObject( JSONObject.toJSONString(dto));
wo.insert(json);
}
@@ -92,12 +96,19 @@ public class ParamServiceImpl implements ParamService {
ParamDto entity = this.findById(dto.getId());
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
String id = dto.getId();
WQLObject wo = WQLObject.getWQLObject("sys_param");
JSONObject old = wo.query("is_delete='0' and code='"+dto.getCode()+"' and id<>'"+id+"'").uniqueResult(0);
if(old!=null){
throw new BadRequestException("已存在相同编码!");
}
String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now();
dto.setUpdate_time(now);
dto.setUpdate_by(currentUsername);
WQLObject wo = WQLObject.getWQLObject("sys_param");
JSONObject json = JSONObject.parseObject( JSONObject.toJSONString(dto));
wo.update(json);
}

View File

@@ -78,7 +78,11 @@ public class PowderOrderQueryServiceImpl implements PowderOrderQueryService {
for (int k = 0; k < mIdFormulaDtl.size(); k++) {
JSONObject jsonObject = (JSONObject)mIdFormulaDtl.get(k);
resPcsn = resPcsn + jsonObject.getString("pcsn") + "+";
formula_qty = formula_qty + NumberUtil.round(jsonObject.getDouble("formula_qty"),3)+"+";
if(k == (mIdFormulaDtl.size()-1)){
formula_qty = formula_qty + NumberUtil.round(jsonObject.getDouble("formula_qty"),3);
}else{
formula_qty = formula_qty + NumberUtil.round(jsonObject.getDouble("formula_qty"),3)+"+";
}
}
jsonResult.put(jsonDtl.getString("material_id")+"pcsn",resPcsn);
jsonResult.put(jsonDtl.getString("material_id") +"formula_qty",formula_qty);
@@ -197,7 +201,11 @@ public class PowderOrderQueryServiceImpl implements PowderOrderQueryService {
for (int k = 0; k < arr.size(); k++) {
JSONObject jsonObject = arr.getJSONObject(k);
resPcsn = resPcsn + jsonObject.getString("pcsn") + "+";
formula_qty = formula_qty + NumberUtil.round(jsonObject.getDouble("formula_qty"),3)+"+";
if(k == (arr.size()-1)){
formula_qty = formula_qty + NumberUtil.round(jsonObject.getDouble("formula_qty"),3);
}else{
formula_qty = formula_qty + NumberUtil.round(jsonObject.getDouble("formula_qty"),3)+"+";
}
}
jsonResult.put(jsonDtl.getString("material_id")+"pcsn",resPcsn);
jsonResult.put(jsonDtl.getString("material_id") +"formula_qty",formula_qty);