基础分类修改
This commit is contained in:
@@ -7,13 +7,12 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.common.anno.Log;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.basedata.master.service.ClassstandardService;
|
||||
import org.nl.wms.basedata.master.service.dto.ClassstandardDto;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -122,4 +121,12 @@ public class ClassstandardController {
|
||||
return new ResponseEntity<>(ClassstandardService.getType(type_id,level), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getClassName")
|
||||
@Log("获取分类名称下拉框")
|
||||
@ApiOperation("获取分类名称下拉框")
|
||||
public ResponseEntity<Object> getClassName() {
|
||||
return new ResponseEntity<>(ClassstandardService.getClassName(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -124,4 +124,9 @@ public interface ClassstandardService {
|
||||
*/
|
||||
String getAllChildIdStr(String class_idStr);
|
||||
|
||||
/**
|
||||
* 获取分类名称下拉框
|
||||
* @return
|
||||
*/
|
||||
JSONArray getClassName();
|
||||
}
|
||||
|
||||
@@ -3,12 +3,9 @@ package org.nl.wms.basedata.master.service.dto;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
@@ -22,8 +19,6 @@ public class ClassstandardDto implements Serializable {
|
||||
@JsonSerialize(using= ToStringSerializer.class)
|
||||
private Long class_id;
|
||||
|
||||
private String base_data_type;
|
||||
|
||||
private String path_code;
|
||||
|
||||
private String class_code;
|
||||
@@ -56,9 +51,9 @@ public class ClassstandardDto implements Serializable {
|
||||
|
||||
private String create_time;
|
||||
|
||||
private String update_id;
|
||||
private String update_optid;
|
||||
|
||||
private String update_name;
|
||||
private String update_optname;
|
||||
|
||||
private String update_time;
|
||||
}
|
||||
|
||||
@@ -11,11 +11,10 @@ import cn.hutool.db.Entity;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.common.anno.Log;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
@@ -23,10 +22,6 @@ import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.basedata.master.service.ClassstandardService;
|
||||
import org.nl.wms.basedata.master.service.dto.ClassstandardDto;
|
||||
|
||||
|
||||
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -49,10 +44,10 @@ public class ClassstandardServiceImpl implements ClassstandardService {
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
|
||||
String base_data_type = (String) whereJson.get("base_data_type");
|
||||
String class_code = (String) whereJson.get("class_code");
|
||||
String where = "";
|
||||
if (!StrUtil.isEmpty(base_data_type)) {
|
||||
where = "AND base_data_type = '" + base_data_type + "'";
|
||||
if (!StrUtil.isEmpty(class_code)) {
|
||||
where = "AND class_code = '" + class_code + "'";
|
||||
}
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "(parent_class_id is null OR parent_class_id = '0') AND is_delete = '0'" + where + "", "update_time desc");
|
||||
final JSONObject json = rb.pageResult();
|
||||
@@ -105,30 +100,26 @@ public class ClassstandardServiceImpl implements ClassstandardService {
|
||||
public void create(ClassstandardDto dto) {
|
||||
String class_code = dto.getClass_code();
|
||||
ClassstandardDto classstandardDto = this.findByCode(class_code);
|
||||
if (classstandardDto != null && classstandardDto.getIs_delete().equals("0") && dto.getBase_data_type().equals(classstandardDto.getBase_data_type())) {
|
||||
if (classstandardDto != null && classstandardDto.getIs_delete().equals("0") ) {
|
||||
throw new BadRequestException("存在相同的基础类别编号");
|
||||
}
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setClass_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_name(nickName);
|
||||
dto.setUpdate_id(currentUserId);
|
||||
dto.setUpdate_name(nickName);
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
dto.setCreate_time(DateUtil.now());
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
dto.setIs_leaf("1");
|
||||
dto.setClass_level(Math.ceil(dto.getClass_code().length() / 2.0) + "");
|
||||
dto.setSub_count(new BigDecimal(0));
|
||||
dto.setPath_code(dto.getClass_code());
|
||||
dto.setLong_class_code(dto.getClass_code());
|
||||
|
||||
if (StrUtil.equals(dto.getBase_data_type(), "03")) {
|
||||
dto.setIs_modify("0");
|
||||
}
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
@@ -149,7 +140,7 @@ public class ClassstandardServiceImpl implements ClassstandardService {
|
||||
|
||||
String class_code = dto.getClass_code();
|
||||
ClassstandardDto classstandardDto = this.findByCode(class_code);
|
||||
if (classstandardDto != null && !dto.getClass_id().equals(classstandardDto.getClass_id()) && classstandardDto.getIs_delete().equals("0") && dto.getBase_data_type().equals(classstandardDto.getBase_data_type())) {
|
||||
if (classstandardDto != null && !dto.getClass_id().equals(classstandardDto.getClass_id()) && classstandardDto.getIs_delete().equals("0") ) {
|
||||
throw new BadRequestException("存在相同的供应商编号");
|
||||
}
|
||||
|
||||
@@ -163,10 +154,10 @@ public class ClassstandardServiceImpl implements ClassstandardService {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
dto.setUpdate_id(currentUserId);
|
||||
dto.setUpdate_name(nickName);
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
@@ -182,7 +173,7 @@ public class ClassstandardServiceImpl implements ClassstandardService {
|
||||
public void deleteAll(Long[] ids) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
|
||||
for (Long class_id : ids) {
|
||||
@@ -192,7 +183,7 @@ public class ClassstandardServiceImpl implements ClassstandardService {
|
||||
param.put("is_delete", "1");
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_time", DateUtil.now());
|
||||
param.put("update_time", now);
|
||||
wo.update(param);
|
||||
|
||||
JSONArray child_rows = wo.query("parent_class_id = '" + String.valueOf(class_id) + "'").getResultJSONArray(0);
|
||||
@@ -245,15 +236,10 @@ public class ClassstandardServiceImpl implements ClassstandardService {
|
||||
|
||||
@Override
|
||||
public JSONArray getSuperior(JSONObject jo, JSONArray ja) {
|
||||
String base_data_type=jo.getString("base_data_type");
|
||||
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
|
||||
if (StrUtil.isEmpty(jo.getString("parent_class_id")) || jo.getString("parent_class_id").equals("0")) {
|
||||
JSONArray null_pids = new JSONArray();
|
||||
if (jo.getString("base_data_type").equals(base_data_type)) {
|
||||
null_pids = wo.query("(parent_class_id = '0' OR parent_class_id is null) and is_delete = '0' and base_data_type = '"+base_data_type+"'").getResultJSONArray(0);
|
||||
} else {
|
||||
null_pids = wo.query("(parent_class_id = '0' OR parent_class_id is null) and is_delete = '0'").getResultJSONArray(0);
|
||||
}
|
||||
null_pids = wo.query("(parent_class_id = '0' OR parent_class_id is null) and is_delete = '0'").getResultJSONArray(0);
|
||||
|
||||
for (int m = 0; m < null_pids.size(); m++) {
|
||||
JSONObject null_pid = null_pids.getJSONObject(m);
|
||||
@@ -541,6 +527,21 @@ public class ClassstandardServiceImpl implements ClassstandardService {
|
||||
return str;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getClassName() {
|
||||
WQLObject wo = WQLObject.getWQLObject("MD_PB_ClassStandard");
|
||||
// 获取的是父节点
|
||||
JSONArray result = wo.query("(parent_class_id is null OR parent_class_id = '0') AND is_delete = '0'").getResultJSONArray(0);
|
||||
JSONArray res = new JSONArray();
|
||||
for (int i=0; i<result.size(); i++) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("label", result.getJSONObject(i).get("class_name"));
|
||||
jsonObject.put("value", result.getJSONObject(i).get("class_code"));
|
||||
res.add(jsonObject);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
public void updateSubCnt(Long Id) {
|
||||
if (Id != null && Id != 0) {
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user