优化
This commit is contained in:
@@ -77,7 +77,7 @@ public class JobServiceImpl implements JobService {
|
|||||||
public void create(Job resources) {
|
public void create(Job resources) {
|
||||||
Job job = jobRepository.findByName(resources.getName());
|
Job job = jobRepository.findByName(resources.getName());
|
||||||
if(job != null){
|
if(job != null){
|
||||||
throw new EntityExistException(Job.class,"name",resources.getName());
|
throw new BadRequestException("已存在相同名称!");
|
||||||
}
|
}
|
||||||
jobRepository.save(resources);
|
jobRepository.save(resources);
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ public class JobServiceImpl implements JobService {
|
|||||||
Job job = jobRepository.findById(resources.getId()).orElseGet(Job::new);
|
Job job = jobRepository.findById(resources.getId()).orElseGet(Job::new);
|
||||||
Job old = jobRepository.findByName(resources.getName());
|
Job old = jobRepository.findByName(resources.getName());
|
||||||
if(old != null && !old.getId().equals(resources.getId())){
|
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());
|
ValidationUtil.isNull( job.getId(),"Job","id",resources.getId());
|
||||||
resources.setId(job.getId());
|
resources.setId(job.getId());
|
||||||
@@ -123,4 +123,4 @@ public class JobServiceImpl implements JobService {
|
|||||||
throw new BadRequestException("所选的岗位中存在用户关联,请解除关联再试!");
|
throw new BadRequestException("所选的岗位中存在用户关联,请解除关联再试!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class ParamServiceImpl implements ParamService {
|
|||||||
@Override
|
@Override
|
||||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||||
WQLObject wo = WQLObject.getWQLObject("sys_param");
|
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();
|
final JSONObject json = rb.pageResult();
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
@@ -74,14 +74,18 @@ public class ParamServiceImpl implements ParamService {
|
|||||||
public void create(ParamDto dto) {
|
public void create(ParamDto dto) {
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
String now = DateUtil.now();
|
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.setId(IdUtil.simpleUUID());
|
||||||
dto.setCreate_by(currentUsername);
|
dto.setCreate_by(currentUsername);
|
||||||
dto.setUpdate_by(currentUsername);
|
dto.setUpdate_by(currentUsername);
|
||||||
dto.setUpdate_time(now);
|
dto.setUpdate_time(now);
|
||||||
dto.setCreate_time(now);
|
dto.setCreate_time(now);
|
||||||
|
|
||||||
WQLObject wo = WQLObject.getWQLObject("sys_param");
|
|
||||||
JSONObject json = JSONObject.parseObject( JSONObject.toJSONString(dto));
|
JSONObject json = JSONObject.parseObject( JSONObject.toJSONString(dto));
|
||||||
wo.insert(json);
|
wo.insert(json);
|
||||||
}
|
}
|
||||||
@@ -92,12 +96,19 @@ public class ParamServiceImpl implements ParamService {
|
|||||||
ParamDto entity = this.findById(dto.getId());
|
ParamDto entity = this.findById(dto.getId());
|
||||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
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 currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
dto.setUpdate_time(now);
|
dto.setUpdate_time(now);
|
||||||
dto.setUpdate_by(currentUsername);
|
dto.setUpdate_by(currentUsername);
|
||||||
|
|
||||||
WQLObject wo = WQLObject.getWQLObject("sys_param");
|
|
||||||
JSONObject json = JSONObject.parseObject( JSONObject.toJSONString(dto));
|
JSONObject json = JSONObject.parseObject( JSONObject.toJSONString(dto));
|
||||||
wo.update(json);
|
wo.update(json);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,11 @@ public class PowderOrderQueryServiceImpl implements PowderOrderQueryService {
|
|||||||
for (int k = 0; k < mIdFormulaDtl.size(); k++) {
|
for (int k = 0; k < mIdFormulaDtl.size(); k++) {
|
||||||
JSONObject jsonObject = (JSONObject)mIdFormulaDtl.get(k);
|
JSONObject jsonObject = (JSONObject)mIdFormulaDtl.get(k);
|
||||||
resPcsn = resPcsn + jsonObject.getString("pcsn") + "+";
|
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")+"pcsn",resPcsn);
|
||||||
jsonResult.put(jsonDtl.getString("material_id") +"formula_qty",formula_qty);
|
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++) {
|
for (int k = 0; k < arr.size(); k++) {
|
||||||
JSONObject jsonObject = arr.getJSONObject(k);
|
JSONObject jsonObject = arr.getJSONObject(k);
|
||||||
resPcsn = resPcsn + jsonObject.getString("pcsn") + "+";
|
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")+"pcsn",resPcsn);
|
||||||
jsonResult.put(jsonDtl.getString("material_id") +"formula_qty",formula_qty);
|
jsonResult.put(jsonDtl.getString("material_id") +"formula_qty",formula_qty);
|
||||||
|
|||||||
Reference in New Issue
Block a user