统计计量信息/统计单元信息/获取数据修改

master
zhouhy 1 year ago
parent c7b35364d7
commit 403a9daec7

@ -0,0 +1,58 @@
package com.aucma.api.domain.vo;
import com.aucma.api.domain.dto.WERKSDto;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.HashMap;
import java.util.List;
/**
*
*
* @Author YinQ
* @create 2023-09-27 13:37
*/
public class SAPResultOrderInfoVo {
@JsonProperty(value = "O_TAB")
private HashMap<String, List<HashMap<String, String>>> O_TAB;
@JsonProperty(value = "WERKS")
private WERKSDto WERKS;
@JsonProperty(value = "O_RETURN")
private WERKSDto O_RETURN;
public HashMap<String, List<HashMap<String, String>>> getO_TAB() {
return O_TAB;
}
public void setO_TAB(HashMap<String, List<HashMap<String, String>>> o_TAB) {
O_TAB = o_TAB;
}
public WERKSDto getWERKS() {
return WERKS;
}
public void setWERKS(WERKSDto WERKS) {
this.WERKS = WERKS;
}
public WERKSDto getO_RETURN() {
return O_RETURN;
}
public void setO_RETURN(WERKSDto o_RETURN) {
O_RETURN = o_RETURN;
}
@Override
public String toString() {
return "SAPResultVo{" +
"O_TAB=" + O_TAB +
", WERKS='" + WERKS + '\'' +
", O_RETURN=" + O_RETURN +
'}';
}
}

@ -17,7 +17,6 @@ import java.util.List;
@Service("SAPPort")
public interface ISAPPortService {
/**
* SAP
* @param sapPortDto

@ -1,6 +1,7 @@
package com.aucma.api.service;
import com.aucma.api.domain.vo.SAPResultBomVo;
import com.aucma.api.domain.vo.SAPResultOrderInfoVo;
import com.aucma.api.domain.vo.SAPResultVo;
import com.aucma.base.domain.BaseDeviceLedger;
import com.aucma.base.domain.BaseMaterialInfo;
@ -30,18 +31,18 @@ public interface ISAPPutStorageService {
*
*
* */
public ArrayList<BaseOrderInfo> insertSAPBaseOrderInfo(SAPResultVo resultVo) throws ParseException;
public ArrayList<BaseOrderInfo> insertSAPBaseOrderInfo(SAPResultOrderInfoVo resultVo) throws ParseException;
/**
*
* @param resultVo
* @return
*/
public ArrayList<BaseDeviceLedger> insertSAPDeviceLedger(SAPResultVo resultVo) throws ParseException;
public ArrayList<BaseDeviceLedger> insertSAPDeviceLedger(SAPResultOrderInfoVo resultVo) throws ParseException;
/**
* bom
*
* */
public ArrayList<OrderBomInfo> insertSAPOrderBomInfo(SAPResultBomVo resultVo) throws ParseException;
public ArrayList<OrderBomInfo> insertSAPOrderBomInfo(SAPResultOrderInfoVo resultVo) throws ParseException;
}

@ -4,6 +4,7 @@ package com.aucma.api.service.impl;
import com.aucma.api.domain.dto.SAPPortDto;
import com.aucma.api.domain.dto.WERKSDto;
import com.aucma.api.domain.vo.SAPResultBomVo;
import com.aucma.api.domain.vo.SAPResultOrderInfoVo;
import com.aucma.api.domain.vo.SAPResultVo;
import com.aucma.api.service.ISAPPortService;
import com.aucma.api.service.ISAPPutStorageService;
@ -34,6 +35,7 @@ public class SAPPortServiceImpl implements ISAPPortService {
@Autowired
private ISAPPutStorageService storageService;
/**
* SAP
*
@ -62,11 +64,15 @@ public class SAPPortServiceImpl implements ISAPPortService {
// 处理接口返回消息
// result = "{\"O_TAB\":{\"item\":[{\"MAKTX\":\"压缩机,GP14TG,R134a,ACC\",\"WERKS\":\"2004\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000125\"},{\"MAKTX\":\"压缩机,GP14TG,R134a,ACC\",\"WERKS\":\"2006\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000125\"},{\"MAKTX\":\"压缩机,NL7CLX,R404a,丹佛斯\",\"WERKS\":\"2004\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000126\"},{\"MAKTX\":\"压缩机,NL7CLX,R404a,丹佛斯\",\"WERKS\":\"2006\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000126\"},{\"MAKTX\":\"压缩机,HVY57AA,R600a,奥地利ACC\",\"WERKS\":\"2004\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000127\"},{\"MAKTX\":\"压缩机,HVY57AA,R600a,奥地利ACC\",\"WERKS\":\"2006\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000127\"},{\"MAKTX\":\"压缩机,HVY67AA,R600a,奥地利ACC\",\"WERKS\":\"2004\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000128\"},{\"MAKTX\":\"压缩机,HVY67AA,R600a,奥地利ACC\",\"WERKS\":\"2006\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000128\"},{\"MAKTX\":\"压缩机,MR22FB,R404a,ACC\",\"WERKS\":\"2004\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000129\"},{\"MAKTX\":\"压缩机,MR22FB,R404a,ACC\",\"WERKS\":\"2006\",\"MTART\":\"ROH\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-21\",\"MATNR\":\"000000003000000129\"},{\"MAKTX\":\"盖后加固体,BC/BD-127FA\",\"WERKS\":\"2004\",\"MTART\":\"HALB\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-06\",\"MATNR\":\"000000008106000102\"},{\"MAKTX\":\"SC-246,YZXGWB乳品\",\"WERKS\":\"2006\",\"MTART\":\"FERT\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-22\",\"MATNR\":\"000000009002003478\"},{\"MAKTX\":\"SD-460,YZXGW蒙牛冰品\",\"WERKS\":\"2004\",\"MTART\":\"FERT\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-22\",\"MATNR\":\"000000009000004735\"},{\"MAKTX\":\"BC-100E,特需\",\"WERKS\":\"2006\",\"MTART\":\"FERT\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-02\",\"MATNR\":\"000000009001002406\"},{\"MAKTX\":\"BD(C)-310T,特需\",\"WERKS\":\"2004\",\"MTART\":\"FERT\",\"MEINS\":\"EA\",\"UDATE\":\"2019-08-20\",\"MATNR\":\"000000009000000225\"}]},\"WERKS\":null,\"O_RETURN\":{\"item\":[{\"MESSAGE\":\"查询成功1\",\"ID\":\" 0\",\"TYPE\":\"S\"}]}}";
ObjectMapper resultMapper = new ObjectMapper();
// 将 JSON 字符串转换为 Java 对象
// 将 JSON 字符串 转换为 Java 对象
System.out.println(result);
SAPResultVo resultVo = resultMapper.readValue(result, SAPResultVo.class);
//判断返回数据是否正确
if (StringUtils.isNull(resultVo.getO_RETURN()) || !"0".equals(resultVo.getO_RETURN().getItem().get(0).get("ID"))){
throw new BaseException("处理接口返回消息错误ID不为0或O_RETURN为空");
if (StringUtils.isNull(resultVo.getO_RETURN()) || !" 0".equals(resultVo.getO_RETURN().getItem().get(0).get("ID"))){
Integer integer = Integer.valueOf(resultVo.getO_RETURN().getItem().get(0).get("ID"));
if (integer!=0){
throw new BaseException("处理接口返回消息错误ID不为0或O_RETURN为空");
}
}
//转物料实体类 保存数据
materialVos = storageService.insertSAPMaterialInfo(resultVo);
@ -102,15 +108,23 @@ public class SAPPortServiceImpl implements ISAPPortService {
ObjectMapper objectMapper = new ObjectMapper();
requestParam = objectMapper.writeValueAsString(sapPortDto);
//发送post请求 调用获取工单接口
result = ApiUtils.sendSAPHttpPost(SAPConstants.SAP_PREFIX_URL + SAPConstants.PRODUCTION_ORDERS_URL, requestParam);
// 处理接口返回消息
ObjectMapper resultMapper = new ObjectMapper();
// 将 JSON 字符串转换为 Java 对象
SAPResultVo resultVo = resultMapper.readValue(result, SAPResultVo.class);
SAPResultOrderInfoVo resultVo = resultMapper.readValue(result, SAPResultOrderInfoVo.class);
//判断返回数据是否正确
if (StringUtils.isNull(resultVo.getO_RETURN()) || !"0".equals(resultVo.getO_RETURN().getItem().get(0).get("ID"))){
if (StringUtils.isNull(resultVo.getO_RETURN()) || !" 0".equals(resultVo.getO_RETURN().getItem().get(0).get("ID"))){
System.out.println(resultVo.getO_RETURN().getItem().get(0).get("ID"));
String id = resultVo.getO_RETURN().getItem().get(0).get("ID");
Integer integer = Integer.valueOf(id);
if (integer!=0&&integer!=null){
throw new BaseException("处理接口返回消息错误ID不为0或O_RETURN为空");
}
}
//转物料实体类 保存数据
baseOrderInfoVos = storageService.insertSAPBaseOrderInfo(resultVo);
//保存接口日志
@ -149,9 +163,9 @@ public class SAPPortServiceImpl implements ISAPPortService {
// 处理接口返回消息
ObjectMapper resultMapper = new ObjectMapper();
// 将 JSON 字符串转换为 Java 对象
SAPResultVo resultVo = resultMapper.readValue(result, SAPResultVo.class);
SAPResultOrderInfoVo resultVo = resultMapper.readValue(result, SAPResultOrderInfoVo.class);
//判断返回数据是否正确
if (StringUtils.isNull(resultVo.getO_RETURN()) || !"0".equals(resultVo.getO_RETURN().getItem().get(0).get("ID"))){
if (StringUtils.isNull(resultVo.getO_RETURN()) || !" 0".equals(resultVo.getO_RETURN().getItem().get(0).get("ID"))){
throw new BaseException("处理接口返回消息错误ID不为0或O_RETURN为空");
}
//转物料实体类 保存数据
@ -191,12 +205,18 @@ public class SAPPortServiceImpl implements ISAPPortService {
requestParam = objectMapper.writeValueAsString(sapPortDto);
result = ApiUtils.sendSAPHttpPost(SAPConstants.SAP_PREFIX_URL + SAPConstants.PRODUCTS_BOM_URL, requestParam);
// 处理接口返回消息
System.out.println(result);
ObjectMapper resultMapper = new ObjectMapper();
// 将 JSON 字符串转换为 Java 对象
SAPResultBomVo resultVo = resultMapper.readValue(result, SAPResultBomVo.class);
SAPResultOrderInfoVo resultVo = resultMapper.readValue(result, SAPResultOrderInfoVo.class);
//判断返回数据是否正确
if (StringUtils.isNull(resultVo.getO_RETURN()) || !"0".equals(resultVo.getO_RETURN().getItem().get(0).get("ID"))){
throw new BaseException("处理接口返回消息错误ID不为0或O_RETURN为空");
if (StringUtils.isNull(resultVo.getO_RETURN()) || !" 0".equals(resultVo.getO_RETURN().getItem().get(0).get("ID"))){
String id = resultVo.getO_RETURN().getItem().get(0).get("ID");
String s = id.replaceAll(" ", "");
if (0!=Long.valueOf(s)){
throw new BaseException("处理接口返回消息错误ID不为0或O_RETURN为空");
}
}
//转物料实体类 保存数据
orderBomInfosVos = storageService.insertSAPOrderBomInfo(resultVo);

@ -1,6 +1,7 @@
package com.aucma.api.service.impl;
import com.aucma.api.domain.vo.SAPResultBomVo;
import com.aucma.api.domain.vo.SAPResultOrderInfoVo;
import com.aucma.api.domain.vo.SAPResultVo;
import com.aucma.api.service.ISAPPutStorageService;
import com.aucma.base.domain.BaseDeviceLedger;
@ -19,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.format.DateTimeFormatter;
@ -60,7 +62,7 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
BaseMaterialInfo baseMaterialInfo = new BaseMaterialInfo();
baseMaterialInfo.setMaterialCode(map.get("MATNR"));
List<BaseMaterialInfo> baseMaterialInfoList = baseMaterialInfoService.selectBaseMaterialInfoList(baseMaterialInfo);
if (!baseMaterialInfoList.isEmpty()) {
if (baseMaterialInfoList.isEmpty()) {
BaseMaterialInfo materialInfo = new BaseMaterialInfo();
materialInfo.setMaterialCode(map.get("MATNR"));
materialInfo.setMaterialName(map.get("MAKTX"));
@ -78,7 +80,7 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
*
*/
@Override
public ArrayList<BaseOrderInfo> insertSAPBaseOrderInfo(SAPResultVo resultVo) throws ParseException {
public ArrayList<BaseOrderInfo> insertSAPBaseOrderInfo(SAPResultOrderInfoVo resultVo) throws ParseException {
ArrayList<BaseOrderInfo> baseOrderInfoList = new ArrayList<>();
List<HashMap<String, String>> itemList = resultVo.getO_TAB().get("item");
for (HashMap<String, String> map : itemList) {
@ -119,7 +121,7 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
* @return
*/
@Override
public ArrayList<BaseDeviceLedger> insertSAPDeviceLedger(SAPResultVo resultVo) throws ParseException {
public ArrayList<BaseDeviceLedger> insertSAPDeviceLedger(SAPResultOrderInfoVo resultVo) throws ParseException {
ArrayList<BaseDeviceLedger> baseDeviceLedgerArrayList = new ArrayList<>();
List<HashMap<String, String>> itemList = resultVo.getO_TAB().get("item");
for (HashMap<String, String> map : itemList) {
@ -146,22 +148,23 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
}
@Override
public ArrayList<OrderBomInfo> insertSAPOrderBomInfo(SAPResultBomVo resultVo) throws ParseException {
public ArrayList<OrderBomInfo> insertSAPOrderBomInfo(SAPResultOrderInfoVo resultVo) throws ParseException {
ArrayList<OrderBomInfo> orderBomInfoList = new ArrayList<>();
List<HashMap<String, String>> itemList = resultVo.getO_TAB().get("item");
for (HashMap<String, String> map : itemList) {
OrderBomInfo orderBomInfo1 = new OrderBomInfo();
orderBomInfo1.setBomCode(map.get("IDNRK"));
orderBomInfo1.setMaterialCode(map.get("IDNRK"));
List<OrderBomInfo> orderBomInfos = orderBomInfoService.selectOrderBomInfoList(orderBomInfo1);
if (!orderBomInfos.isEmpty()) {
if (orderBomInfos.isEmpty()) {
OrderBomInfo orderBomInfo = new OrderBomInfo();
orderBomInfo.setFactoryCode(map.get("WERKS"));
orderBomInfo.setParentId(map.get("MATNR"));
orderBomInfo.setMaterialCode(map.get("IDNRK"));
if (!map.get("MENGE").isEmpty()) {
orderBomInfo.setStandardAmount(Long.parseLong(map.get("MENGE")));
orderBomInfo.setStandardAmount(new BigDecimal(map.get("MENGE")));
}
orderBomInfo.setSort(map.get("SORTF"));
orderBomInfo.setVbeln(map.get("VBELN"));
orderBomInfo.setVbpos(map.get("VBPOS"));
orderBomInfo.setCreatedTime(DateUtils.getNowDate());
@ -174,5 +177,4 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService {
return orderBomInfoList;
}
}

@ -44,6 +44,9 @@ public class BaseMonitorInfoController extends BaseController {
List<BaseMonitorInfo> list = baseMonitorInfoService.selectBaseMonitorInfoList(baseMonitorInfo);
return success(list);
}
/**
*
* */
@PostMapping("/monitorInfoTree")
public AjaxResult getMonitorInfoTree(BaseMonitorInfo baseMonitorInfo) {
List<TreeSelects> list = baseMonitorInfoService.selectBaseMonitorInfoTreeList(baseMonitorInfo);

@ -0,0 +1,103 @@
package com.aucma.base.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.aucma.common.utils.DateUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.aucma.common.annotation.Log;
import com.aucma.common.core.controller.BaseController;
import com.aucma.common.core.domain.AjaxResult;
import com.aucma.common.enums.BusinessType;
import com.aucma.base.domain.BaseMonitorWorkUnit;
import com.aucma.base.service.IBaseMonitorWorkUnitService;
import com.aucma.common.utils.poi.ExcelUtil;
import com.aucma.common.core.page.TableDataInfo;
/**
* Controller
*
* @author Yinq
* @date 2023-10-12
*/
@RestController
@RequestMapping("/base/monitorWorkUnit" )
public class BaseMonitorWorkUnitController extends BaseController {
@Autowired
private IBaseMonitorWorkUnitService baseMonitorWorkUnitService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('base:monitorWorkUnit:list')" )
@GetMapping("/list" )
public TableDataInfo list(BaseMonitorWorkUnit baseMonitorWorkUnit) {
startPage();
List<BaseMonitorWorkUnit> list = baseMonitorWorkUnitService.selectBaseMonitorWorkUnitList(baseMonitorWorkUnit);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('base:monitorWorkUnit:export')" )
@Log(title = "统计计量信息" , businessType = BusinessType.EXPORT)
@PostMapping("/export" )
public void export(HttpServletResponse response, BaseMonitorWorkUnit baseMonitorWorkUnit) {
List<BaseMonitorWorkUnit> list = baseMonitorWorkUnitService.selectBaseMonitorWorkUnitList(baseMonitorWorkUnit);
ExcelUtil<BaseMonitorWorkUnit> util = new ExcelUtil<BaseMonitorWorkUnit>(BaseMonitorWorkUnit. class);
util.exportExcel(response, list, "统计计量信息数据" );
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('base:monitorWorkUnit:query')" )
@GetMapping(value = "/{objId}" )
public AjaxResult getInfo(@PathVariable("objId" ) Long objId) {
return success(baseMonitorWorkUnitService.selectBaseMonitorWorkUnitByObjId(objId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('base:monitorWorkUnit:add')" )
@Log(title = "统计计量信息" , businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BaseMonitorWorkUnit baseMonitorWorkUnit) {
baseMonitorWorkUnit.setCreatedBy(getUsername());
baseMonitorWorkUnit.setCreatedTime(DateUtils.getNowDate());
return toAjax(baseMonitorWorkUnitService.insertBaseMonitorWorkUnit(baseMonitorWorkUnit));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('base:monitorWorkUnit:edit')" )
@Log(title = "统计计量信息" , businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BaseMonitorWorkUnit baseMonitorWorkUnit) {
baseMonitorWorkUnit.setUpdatedBy(getUsername());
baseMonitorWorkUnit.setUpdatedTime(DateUtils.getNowDate());
return toAjax(baseMonitorWorkUnitService.updateBaseMonitorWorkUnit(baseMonitorWorkUnit));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('base:monitorWorkUnit:remove')" )
@Log(title = "统计计量信息" , businessType = BusinessType.DELETE)
@DeleteMapping("/{objIds}" )
public AjaxResult remove(@PathVariable Long[] objIds) {
return toAjax(baseMonitorWorkUnitService.deleteBaseMonitorWorkUnitByObjIds(objIds));
}
}

@ -0,0 +1,111 @@
package com.aucma.base.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.aucma.base.domain.BaseMonitorInfo;
import com.aucma.base.domain.TreeSelects;
import com.aucma.common.utils.DateUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.aucma.common.annotation.Log;
import com.aucma.common.core.controller.BaseController;
import com.aucma.common.core.domain.AjaxResult;
import com.aucma.common.enums.BusinessType;
import com.aucma.base.domain.BaseWorkUnit;
import com.aucma.base.service.IBaseWorkUnitService;
import com.aucma.common.utils.poi.ExcelUtil;
/**
* Controller
*
* @author Yinq
* @date 2023-10-12
*/
@RestController
@RequestMapping("/base/workUnit" )
public class BaseWorkUnitController extends BaseController {
@Autowired
private IBaseWorkUnitService baseWorkUnitService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('base:workUnit:list')" )
@GetMapping("/list" )
public AjaxResult list(BaseWorkUnit baseWorkUnit) {
List<BaseWorkUnit> list = baseWorkUnitService.selectBaseWorkUnitList(baseWorkUnit);
return success(list);
}
/**
*
* */
@PostMapping("/workUnitTree")
public AjaxResult getMonitorInfoTree(BaseWorkUnit baseWorkUnit) {
List<TreeSelects> list = baseWorkUnitService.selectBaseWorkUnitTreeList(baseWorkUnit);
return success(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('base:workUnit:export')" )
@Log(title = "统计单元信息" , businessType = BusinessType.EXPORT)
@PostMapping("/export" )
public void export(HttpServletResponse response, BaseWorkUnit baseWorkUnit) {
List<BaseWorkUnit> list = baseWorkUnitService.selectBaseWorkUnitList(baseWorkUnit);
ExcelUtil<BaseWorkUnit> util = new ExcelUtil<BaseWorkUnit>(BaseWorkUnit. class);
util.exportExcel(response, list, "统计单元信息数据" );
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('base:workUnit:query')" )
@GetMapping(value = "/{objId}" )
public AjaxResult getInfo(@PathVariable("objId" ) Long objId) {
return success(baseWorkUnitService.selectBaseWorkUnitByObjId(objId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('base:workUnit:add')" )
@Log(title = "统计单元信息" , businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BaseWorkUnit baseWorkUnit) {
baseWorkUnit.setCreatedBy(getUsername());
baseWorkUnit.setCreatedTime(DateUtils.getNowDate());
return toAjax(baseWorkUnitService.insertBaseWorkUnit(baseWorkUnit));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('base:workUnit:edit')" )
@Log(title = "统计单元信息" , businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BaseWorkUnit baseWorkUnit) {
baseWorkUnit.setUpdatedBy(getUsername());
baseWorkUnit.setUpdatedTime(DateUtils.getNowDate());
return toAjax(baseWorkUnitService.updateBaseWorkUnit(baseWorkUnit));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('base:workUnit:remove')" )
@Log(title = "统计单元信息" , businessType = BusinessType.DELETE)
@DeleteMapping("/{objIds}" )
public AjaxResult remove(@PathVariable Long[] objIds) {
return toAjax(baseWorkUnitService.deleteBaseWorkUnitByObjIds(objIds));
}
}

@ -0,0 +1,197 @@
package com.aucma.base.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.aucma.common.annotation.Excel;
import com.aucma.common.core.domain.BaseEntity;
/**
* base_monitor_work_unit
*
* @author Yinq
* @date 2023-10-12
*/
public class BaseMonitorWorkUnit extends BaseEntity
{
private static final long serialVersionUID=1L;
/** 主键标识 */
@Excel(name = "主键标识")
private Long objId;
/** 计量设备编号 */
@Excel(name = "计量设备编号")
private String monitorCode;
/** 统计单元编号 */
@Excel(name = "统计单元编号")
private String workUnitCode;
/** 计量设备状态 */
@Excel(name = "计量设备状态")
private Long monitorStatus;
/** 计量设备类型 */
@Excel(name = "计量设备类型")
private Long monitorType;
/** 计算方式0-加1-减) */
@Excel(name = "计算方式", readConverterExp = "0=-加1-减")
private Long formulaMode;
/** 比率 */
@Excel(name = "比率")
private Long proportion;
/** 启用标识 */
@Excel(name = "启用标识")
private Long isFlag;
/** 创建人 */
@Excel(name = "创建人")
private String createdBy;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createdTime;
/** 修改人 */
@Excel(name = "修改人")
private String updatedBy;
/** 修改时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "修改时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date updatedTime;
public void setObjId(Long objId)
{
this.objId = objId;
}
public Long getObjId()
{
return objId;
}
public void setMonitorCode(String monitorCode)
{
this.monitorCode = monitorCode;
}
public String getMonitorCode()
{
return monitorCode;
}
public void setWorkUnitCode(String workUnitCode)
{
this.workUnitCode = workUnitCode;
}
public String getWorkUnitCode()
{
return workUnitCode;
}
public void setMonitorStatus(Long monitorStatus)
{
this.monitorStatus = monitorStatus;
}
public Long getMonitorStatus()
{
return monitorStatus;
}
public void setMonitorType(Long monitorType)
{
this.monitorType = monitorType;
}
public Long getMonitorType()
{
return monitorType;
}
public void setFormulaMode(Long formulaMode)
{
this.formulaMode = formulaMode;
}
public Long getFormulaMode()
{
return formulaMode;
}
public void setProportion(Long proportion)
{
this.proportion = proportion;
}
public Long getProportion()
{
return proportion;
}
public void setIsFlag(Long isFlag)
{
this.isFlag = isFlag;
}
public Long getIsFlag()
{
return isFlag;
}
public void setCreatedBy(String createdBy)
{
this.createdBy = createdBy;
}
public String getCreatedBy()
{
return createdBy;
}
public void setCreatedTime(Date createdTime)
{
this.createdTime = createdTime;
}
public Date getCreatedTime()
{
return createdTime;
}
public void setUpdatedBy(String updatedBy)
{
this.updatedBy = updatedBy;
}
public String getUpdatedBy()
{
return updatedBy;
}
public void setUpdatedTime(Date updatedTime)
{
this.updatedTime = updatedTime;
}
public Date getUpdatedTime()
{
return updatedTime;
}
@Override
public String toString(){
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("objId",getObjId())
.append("monitorCode",getMonitorCode())
.append("workUnitCode",getWorkUnitCode())
.append("monitorStatus",getMonitorStatus())
.append("monitorType",getMonitorType())
.append("formulaMode",getFormulaMode())
.append("proportion",getProportion())
.append("remark",getRemark())
.append("isFlag",getIsFlag())
.append("createdBy",getCreatedBy())
.append("createdTime",getCreatedTime())
.append("updatedBy",getUpdatedBy())
.append("updatedTime",getUpdatedTime())
.toString();
}
}

@ -0,0 +1,251 @@
package com.aucma.base.domain;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.aucma.common.core.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.aucma.common.annotation.Excel;
import com.aucma.common.core.domain.TreeEntity;
/**
* base_work_unit
*
* @author Yinq
* @date 2023-10-12
*/
public class BaseWorkUnit extends BaseEntity
{
private static final long serialVersionUID=1L;
/** 主键标识 */
@Excel(name = "主键标识")
private Long objId;
/** 统计单元编号 */
@Excel(name = "统计单元编号")
private String workUnitCode;
/** 统计单元名称 */
@Excel(name = "统计单元名称")
private String workUnitName;
/** 统计区域 */
@Excel(name = "统计区域")
private String workUnitAddress;
/** 排序 */
@Excel(name = "排序")
private Long workUnitSort;
/** 产线/工位 */
@Excel(name = "产线/工位")
private String productLineCode;
/** 统计单元类型 */
@Excel(name = "统计单元类型")
private Long workUnitType;
/** 启用标识 */
@Excel(name = "启用标识")
private Long isFlag;
/** 创建人 */
@Excel(name = "创建人")
private String createdBy;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createdTime;
/** 更新人 */
@Excel(name = "更新人")
private String updatedBy;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date updatedTime;
private List<BaseWorkUnit> children = new ArrayList<BaseWorkUnit>();
private String parentName;
private Long parentId;
private Integer orderNum;
private String ancestors;
public List<BaseWorkUnit> getChildren() {
return children;
}
public void setChildren(List<BaseWorkUnit> children) {
this.children = children;
}
public String getParentName() {
return parentName;
}
public void setParentName(String parentName) {
this.parentName = parentName;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public Integer getOrderNum() {
return orderNum;
}
public void setOrderNum(Integer orderNum) {
this.orderNum = orderNum;
}
public String getAncestors() {
return ancestors;
}
public void setAncestors(String ancestors) {
this.ancestors = ancestors;
}
public void setObjId(Long objId)
{
this.objId = objId;
}
public Long getObjId()
{
return objId;
}
public void setWorkUnitCode(String workUnitCode)
{
this.workUnitCode = workUnitCode;
}
public String getWorkUnitCode()
{
return workUnitCode;
}
public void setWorkUnitName(String workUnitName)
{
this.workUnitName = workUnitName;
}
public String getWorkUnitName()
{
return workUnitName;
}
public void setWorkUnitAddress(String workUnitAddress)
{
this.workUnitAddress = workUnitAddress;
}
public String getWorkUnitAddress()
{
return workUnitAddress;
}
public void setWorkUnitSort(Long workUnitSort)
{
this.workUnitSort = workUnitSort;
}
public Long getWorkUnitSort()
{
return workUnitSort;
}
public void setProductLineCode(String productLineCode)
{
this.productLineCode = productLineCode;
}
public String getProductLineCode()
{
return productLineCode;
}
public void setWorkUnitType(Long workUnitType)
{
this.workUnitType = workUnitType;
}
public Long getWorkUnitType()
{
return workUnitType;
}
public void setIsFlag(Long isFlag)
{
this.isFlag = isFlag;
}
public Long getIsFlag()
{
return isFlag;
}
public void setCreatedBy(String createdBy)
{
this.createdBy = createdBy;
}
public String getCreatedBy()
{
return createdBy;
}
public void setCreatedTime(Date createdTime)
{
this.createdTime = createdTime;
}
public Date getCreatedTime()
{
return createdTime;
}
public void setUpdatedBy(String updatedBy)
{
this.updatedBy = updatedBy;
}
public String getUpdatedBy()
{
return updatedBy;
}
public void setUpdatedTime(Date updatedTime)
{
this.updatedTime = updatedTime;
}
public Date getUpdatedTime()
{
return updatedTime;
}
@Override
public String toString(){
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("objId",getObjId())
.append("workUnitCode",getWorkUnitCode())
.append("parentId",getParentId())
.append("workUnitName",getWorkUnitName())
.append("workUnitAddress",getWorkUnitAddress())
.append("ancestors",getAncestors())
.append("workUnitSort",getWorkUnitSort())
.append("productLineCode",getProductLineCode())
.append("workUnitType",getWorkUnitType())
.append("isFlag",getIsFlag())
.append("createdBy",getCreatedBy())
.append("createdTime",getCreatedTime())
.append("updatedBy",getUpdatedBy())
.append("updatedTime",getUpdatedTime())
.toString();
}
}

@ -1,5 +1,6 @@
package com.aucma.base.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.aucma.common.core.domain.model.TreeStringEntity;
@ -51,7 +52,7 @@ public class OrderBomInfo extends TreeStringEntity {
*
*/
@Excel(name = "标准数量")
private Long standardAmount;
private BigDecimal standardAmount;
/**
*
@ -149,12 +150,12 @@ public class OrderBomInfo extends TreeStringEntity {
return materialType;
}
public void setStandardAmount(Long standardAmount) {
this.standardAmount = standardAmount;
public BigDecimal getStandardAmount() {
return standardAmount;
}
public Long getStandardAmount() {
return standardAmount;
public void setStandardAmount(BigDecimal standardAmount) {
this.standardAmount = standardAmount;
}
public void setIsFlag(Long isFlag) {

@ -46,6 +46,12 @@ public class TreeSelects implements Serializable
this.code = baseMonitorInfo.getMonitorCode();
this.children = baseMonitorInfo.getChildren().stream().map(TreeSelects::new).collect(Collectors.toList());
}
public TreeSelects(BaseWorkUnit baseWorkUnit){
this.id = baseWorkUnit.getObjId();
this.label = baseWorkUnit.getWorkUnitName();
this.code = baseWorkUnit.getWorkUnitCode();
this.children = baseWorkUnit.getChildren().stream().map(TreeSelects::new).collect(Collectors.toList());
}
public TreeSelects(SysMenu menu)
{

@ -0,0 +1,61 @@
package com.aucma.base.mapper;
import java.util.List;
import com.aucma.base.domain.BaseMonitorWorkUnit;
/**
* Mapper
*
* @author Yinq
* @date 2023-10-12
*/
public interface BaseMonitorWorkUnitMapper
{
/**
*
*
* @param objId
* @return
*/
public BaseMonitorWorkUnit selectBaseMonitorWorkUnitByObjId(Long objId);
/**
*
*
* @param baseMonitorWorkUnit
* @return
*/
public List<BaseMonitorWorkUnit> selectBaseMonitorWorkUnitList(BaseMonitorWorkUnit baseMonitorWorkUnit);
/**
*
*
* @param baseMonitorWorkUnit
* @return
*/
public int insertBaseMonitorWorkUnit(BaseMonitorWorkUnit baseMonitorWorkUnit);
/**
*
*
* @param baseMonitorWorkUnit
* @return
*/
public int updateBaseMonitorWorkUnit(BaseMonitorWorkUnit baseMonitorWorkUnit);
/**
*
*
* @param objId
* @return
*/
public int deleteBaseMonitorWorkUnitByObjId(Long objId);
/**
*
*
* @param objIds
* @return
*/
public int deleteBaseMonitorWorkUnitByObjIds(Long[] objIds);
}

@ -0,0 +1,61 @@
package com.aucma.base.mapper;
import java.util.List;
import com.aucma.base.domain.BaseWorkUnit;
/**
* Mapper
*
* @author Yinq
* @date 2023-10-12
*/
public interface BaseWorkUnitMapper
{
/**
*
*
* @param objId
* @return
*/
public BaseWorkUnit selectBaseWorkUnitByObjId(Long objId);
/**
*
*
* @param baseWorkUnit
* @return
*/
public List<BaseWorkUnit> selectBaseWorkUnitList(BaseWorkUnit baseWorkUnit);
/**
*
*
* @param baseWorkUnit
* @return
*/
public int insertBaseWorkUnit(BaseWorkUnit baseWorkUnit);
/**
*
*
* @param baseWorkUnit
* @return
*/
public int updateBaseWorkUnit(BaseWorkUnit baseWorkUnit);
/**
*
*
* @param objId
* @return
*/
public int deleteBaseWorkUnitByObjId(Long objId);
/**
*
*
* @param objIds
* @return
*/
public int deleteBaseWorkUnitByObjIds(Long[] objIds);
}

@ -0,0 +1,61 @@
package com.aucma.base.service;
import java.util.List;
import com.aucma.base.domain.BaseMonitorWorkUnit;
/**
* Service
*
* @author Yinq
* @date 2023-10-12
*/
public interface IBaseMonitorWorkUnitService
{
/**
*
*
* @param objId
* @return
*/
public BaseMonitorWorkUnit selectBaseMonitorWorkUnitByObjId(Long objId);
/**
*
*
* @param baseMonitorWorkUnit
* @return
*/
public List<BaseMonitorWorkUnit> selectBaseMonitorWorkUnitList(BaseMonitorWorkUnit baseMonitorWorkUnit);
/**
*
*
* @param baseMonitorWorkUnit
* @return
*/
public int insertBaseMonitorWorkUnit(BaseMonitorWorkUnit baseMonitorWorkUnit);
/**
*
*
* @param baseMonitorWorkUnit
* @return
*/
public int updateBaseMonitorWorkUnit(BaseMonitorWorkUnit baseMonitorWorkUnit);
/**
*
*
* @param objIds
* @return
*/
public int deleteBaseMonitorWorkUnitByObjIds(Long[] objIds);
/**
*
*
* @param objId
* @return
*/
public int deleteBaseMonitorWorkUnitByObjId(Long objId);
}

@ -0,0 +1,71 @@
package com.aucma.base.service;
import java.util.List;
import com.aucma.base.domain.BaseMonitorInfo;
import com.aucma.base.domain.BaseWorkUnit;
import com.aucma.base.domain.TreeSelects;
/**
* Service
*
* @author Yinq
* @date 2023-10-12
*/
public interface IBaseWorkUnitService
{
/**
*
*
* @param objId
* @return
*/
public BaseWorkUnit selectBaseWorkUnitByObjId(Long objId);
/**
*
*
* @param baseWorkUnit
* @return
*/
public List<BaseWorkUnit> selectBaseWorkUnitList(BaseWorkUnit baseWorkUnit);
/**
*
*
* @param baseWorkUnit
* @return
*/
public int insertBaseWorkUnit(BaseWorkUnit baseWorkUnit);
/**
*
*
* @param baseWorkUnit
* @return
*/
public int updateBaseWorkUnit(BaseWorkUnit baseWorkUnit);
/**
*
*
* @param objIds
* @return
*/
public int deleteBaseWorkUnitByObjIds(Long[] objIds);
/**
*
*
* @param objId
* @return
*/
public int deleteBaseWorkUnitByObjId(Long objId);
List<TreeSelects> selectBaseWorkUnitTreeList(BaseWorkUnit baseWorkUnit);
public List<TreeSelects> buildWorkUnitTreeSelect(List<BaseWorkUnit> baseWorkUnits);
public List<BaseWorkUnit> buildWorkUnitTree(List<BaseWorkUnit> baseWorkUnits);
}

@ -0,0 +1,93 @@
package com.aucma.base.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.aucma.base.mapper.BaseMonitorWorkUnitMapper;
import com.aucma.base.domain.BaseMonitorWorkUnit;
import com.aucma.base.service.IBaseMonitorWorkUnitService;
/**
* Service
*
* @author Yinq
* @date 2023-10-12
*/
@Service
public class BaseMonitorWorkUnitServiceImpl implements IBaseMonitorWorkUnitService
{
@Autowired
private BaseMonitorWorkUnitMapper baseMonitorWorkUnitMapper;
/**
*
*
* @param objId
* @return
*/
@Override
public BaseMonitorWorkUnit selectBaseMonitorWorkUnitByObjId(Long objId)
{
return baseMonitorWorkUnitMapper.selectBaseMonitorWorkUnitByObjId(objId);
}
/**
*
*
* @param baseMonitorWorkUnit
* @return
*/
@Override
public List<BaseMonitorWorkUnit> selectBaseMonitorWorkUnitList(BaseMonitorWorkUnit baseMonitorWorkUnit)
{
return baseMonitorWorkUnitMapper.selectBaseMonitorWorkUnitList(baseMonitorWorkUnit);
}
/**
*
*
* @param baseMonitorWorkUnit
* @return
*/
@Override
public int insertBaseMonitorWorkUnit(BaseMonitorWorkUnit baseMonitorWorkUnit)
{
return baseMonitorWorkUnitMapper.insertBaseMonitorWorkUnit(baseMonitorWorkUnit);
}
/**
*
*
* @param baseMonitorWorkUnit
* @return
*/
@Override
public int updateBaseMonitorWorkUnit(BaseMonitorWorkUnit baseMonitorWorkUnit)
{
return baseMonitorWorkUnitMapper.updateBaseMonitorWorkUnit(baseMonitorWorkUnit);
}
/**
*
*
* @param objIds
* @return
*/
@Override
public int deleteBaseMonitorWorkUnitByObjIds(Long[] objIds)
{
return baseMonitorWorkUnitMapper.deleteBaseMonitorWorkUnitByObjIds(objIds);
}
/**
*
*
* @param objId
* @return
*/
@Override
public int deleteBaseMonitorWorkUnitByObjId(Long objId)
{
return baseMonitorWorkUnitMapper.deleteBaseMonitorWorkUnitByObjId(objId);
}
}

@ -0,0 +1,174 @@
package com.aucma.base.service.impl;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import com.aucma.base.domain.BaseMonitorInfo;
import com.aucma.base.domain.TreeSelects;
import com.aucma.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.aucma.base.mapper.BaseWorkUnitMapper;
import com.aucma.base.domain.BaseWorkUnit;
import com.aucma.base.service.IBaseWorkUnitService;
/**
* Service
*
* @author Yinq
* @date 2023-10-12
*/
@Service
public class BaseWorkUnitServiceImpl implements IBaseWorkUnitService
{
@Autowired
private BaseWorkUnitMapper baseWorkUnitMapper;
/**
*
*
* @param objId
* @return
*/
@Override
public BaseWorkUnit selectBaseWorkUnitByObjId(Long objId)
{
return baseWorkUnitMapper.selectBaseWorkUnitByObjId(objId);
}
/**
*
*
* @param baseWorkUnit
* @return
*/
@Override
public List<BaseWorkUnit> selectBaseWorkUnitList(BaseWorkUnit baseWorkUnit)
{
return baseWorkUnitMapper.selectBaseWorkUnitList(baseWorkUnit);
}
/**
*
*
* @param baseWorkUnit
* @return
*/
@Override
public int insertBaseWorkUnit(BaseWorkUnit baseWorkUnit)
{
return baseWorkUnitMapper.insertBaseWorkUnit(baseWorkUnit);
}
/**
*
*
* @param baseWorkUnit
* @return
*/
@Override
public int updateBaseWorkUnit(BaseWorkUnit baseWorkUnit)
{
return baseWorkUnitMapper.updateBaseWorkUnit(baseWorkUnit);
}
/**
*
*
* @param objIds
* @return
*/
@Override
public int deleteBaseWorkUnitByObjIds(Long[] objIds)
{
return baseWorkUnitMapper.deleteBaseWorkUnitByObjIds(objIds);
}
/**
*
*
* @param objId
* @return
*/
@Override
public int deleteBaseWorkUnitByObjId(Long objId)
{
return baseWorkUnitMapper.deleteBaseWorkUnitByObjId(objId);
}
@Override
public List<TreeSelects> selectBaseWorkUnitTreeList(BaseWorkUnit baseWorkUnit) {
List<BaseWorkUnit> baseWorkUnits = selectBaseWorkUnitList(baseWorkUnit);
return buildWorkUnitTreeSelect(baseWorkUnits);
}
@Override
public List<TreeSelects> buildWorkUnitTreeSelect(List<BaseWorkUnit> baseWorkUnits) {
List<BaseWorkUnit> baseWorkUnitsTrees = buildWorkUnitTree(baseWorkUnits);
return baseWorkUnitsTrees.stream().map(TreeSelects::new).collect(Collectors.toList());
}
@Override
public List<BaseWorkUnit> buildWorkUnitTree(List<BaseWorkUnit> baseWorkUnits) {
List<BaseWorkUnit> returnList = new ArrayList<BaseWorkUnit>();
List<Long> tempList = baseWorkUnits.stream().map(BaseWorkUnit::getObjId).collect(Collectors.toList());
for (BaseWorkUnit baseWorkUnit : baseWorkUnits)
{
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(baseWorkUnit.getParentId()))
{
recursionFn(baseWorkUnits, baseWorkUnit);
returnList.add(baseWorkUnit);
}
}
if (returnList.isEmpty())
{
returnList = baseWorkUnits;
}
return returnList;
}
/**
*
*/
private void recursionFn(List<BaseWorkUnit> list, BaseWorkUnit t)
{
// 得到子节点列表
List<BaseWorkUnit> childList = getChildList(list, t);
t.setChildren(childList);
for (BaseWorkUnit tChild : childList)
{
if (hasChild(list, tChild))
{
recursionFn(list, tChild);
}
}
}
/**
*
*/
private List<BaseWorkUnit> getChildList(List<BaseWorkUnit> list, BaseWorkUnit t)
{
List<BaseWorkUnit> tlist = new ArrayList<BaseWorkUnit>();
Iterator<BaseWorkUnit> it = list.iterator();
while (it.hasNext())
{
BaseWorkUnit n = (BaseWorkUnit) it.next();
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getObjId().longValue())
{
tlist.add(n);
}
}
return tlist;
}
/**
*
*/
private boolean hasChild(List<BaseWorkUnit> list, BaseWorkUnit t)
{
return getChildList(list, t).size() > 0;
}
}

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.aucma.base.mapper.BaseMonitorWorkUnitMapper">
<resultMap type="BaseMonitorWorkUnit" id="BaseMonitorWorkUnitResult">
<result property="objId" column="obj_id" />
<result property="monitorCode" column="monitor_code" />
<result property="workUnitCode" column="work_unit_code" />
<result property="monitorStatus" column="monitor_status" />
<result property="monitorType" column="monitor_type" />
<result property="formulaMode" column="formula_mode" />
<result property="proportion" column="proportion" />
<result property="remark" column="remark" />
<result property="isFlag" column="is_flag" />
<result property="createdBy" column="created_by" />
<result property="createdTime" column="created_time" />
<result property="updatedBy" column="updated_by" />
<result property="updatedTime" column="updated_time" />
</resultMap>
<sql id="selectBaseMonitorWorkUnitVo">
select obj_id, monitor_code, work_unit_code, monitor_status, monitor_type, formula_mode, proportion, remark, is_flag, created_by, created_time, updated_by, updated_time from base_monitor_work_unit
</sql>
<select id="selectBaseMonitorWorkUnitList" parameterType="BaseMonitorWorkUnit" resultMap="BaseMonitorWorkUnitResult">
<include refid="selectBaseMonitorWorkUnitVo"/>
<where>
<if test="objId != null "> and obj_id = #{objId}</if>
<if test="monitorCode != null and monitorCode != ''"> and monitor_code = #{monitorCode}</if>
<if test="workUnitCode != null and workUnitCode != ''"> and work_unit_code = #{workUnitCode}</if>
<if test="monitorStatus != null "> and monitor_status = #{monitorStatus}</if>
<if test="monitorType != null "> and monitor_type = #{monitorType}</if>
<if test="formulaMode != null "> and formula_mode = #{formulaMode}</if>
<if test="proportion != null "> and proportion = #{proportion}</if>
<if test="isFlag != null "> and is_flag = #{isFlag}</if>
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if>
<if test="createdTime != null "> and created_time = #{createdTime}</if>
<if test="updatedBy != null and updatedBy != ''"> and updated_by = #{updatedBy}</if>
<if test="updatedTime != null "> and updated_time = #{updatedTime}</if>
</where>
</select>
<select id="selectBaseMonitorWorkUnitByObjId" parameterType="Long" resultMap="BaseMonitorWorkUnitResult">
<include refid="selectBaseMonitorWorkUnitVo"/>
where obj_id = #{objId}
</select>
<insert id="insertBaseMonitorWorkUnit" parameterType="BaseMonitorWorkUnit">
insert into base_monitor_work_unit
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="objId != null">obj_id,</if>
<if test="monitorCode != null and monitorCode != ''">monitor_code,</if>
<if test="workUnitCode != null">work_unit_code,</if>
<if test="monitorStatus != null">monitor_status,</if>
<if test="monitorType != null">monitor_type,</if>
<if test="formulaMode != null">formula_mode,</if>
<if test="proportion != null">proportion,</if>
<if test="remark != null">remark,</if>
<if test="isFlag != null">is_flag,</if>
<if test="createdBy != null">created_by,</if>
<if test="createdTime != null">created_time,</if>
<if test="updatedBy != null">updated_by,</if>
<if test="updatedTime != null">updated_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="objId != null">#{objId},</if>
<if test="monitorCode != null and monitorCode != ''">#{monitorCode},</if>
<if test="workUnitCode != null">#{workUnitCode},</if>
<if test="monitorStatus != null">#{monitorStatus},</if>
<if test="monitorType != null">#{monitorType},</if>
<if test="formulaMode != null">#{formulaMode},</if>
<if test="proportion != null">#{proportion},</if>
<if test="remark != null">#{remark},</if>
<if test="isFlag != null">#{isFlag},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="createdTime != null">#{createdTime},</if>
<if test="updatedBy != null">#{updatedBy},</if>
<if test="updatedTime != null">#{updatedTime},</if>
</trim>
</insert>
<update id="updateBaseMonitorWorkUnit" parameterType="BaseMonitorWorkUnit">
update base_monitor_work_unit
<trim prefix="SET" suffixOverrides=",">
<if test="monitorCode != null and monitorCode != ''">monitor_code = #{monitorCode},</if>
<if test="workUnitCode != null">work_unit_code = #{workUnitCode},</if>
<if test="monitorStatus != null">monitor_status = #{monitorStatus},</if>
<if test="monitorType != null">monitor_type = #{monitorType},</if>
<if test="formulaMode != null">formula_mode = #{formulaMode},</if>
<if test="proportion != null">proportion = #{proportion},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="isFlag != null">is_flag = #{isFlag},</if>
<if test="createdBy != null">created_by = #{createdBy},</if>
<if test="createdTime != null">created_time = #{createdTime},</if>
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
</trim>
where obj_id = #{objId}
</update>
<delete id="deleteBaseMonitorWorkUnitByObjId" parameterType="Long">
delete from base_monitor_work_unit where obj_id = #{objId}
</delete>
<delete id="deleteBaseMonitorWorkUnitByObjIds" parameterType="String">
delete from base_monitor_work_unit where obj_id in
<foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId}
</foreach>
</delete>
</mapper>

@ -0,0 +1,122 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.aucma.base.mapper.BaseWorkUnitMapper">
<resultMap type="BaseWorkUnit" id="BaseWorkUnitResult">
<result property="objId" column="obj_id" />
<result property="workUnitCode" column="work_unit_code" />
<result property="parentId" column="parent_id" />
<result property="workUnitName" column="work_unit_name" />
<result property="workUnitAddress" column="work_unit_address" />
<result property="ancestors" column="ancestors" />
<result property="workUnitSort" column="work_unit_sort" />
<result property="productLineCode" column="product_line_code" />
<result property="workUnitType" column="work_unit_type" />
<result property="isFlag" column="is_flag" />
<result property="createdBy" column="created_by" />
<result property="createdTime" column="created_time" />
<result property="updatedBy" column="updated_by" />
<result property="updatedTime" column="updated_time" />
</resultMap>
<sql id="selectBaseWorkUnitVo">
select obj_id, work_unit_code, parent_id, work_unit_name, work_unit_address, ancestors, work_unit_sort, product_line_code, work_unit_type, is_flag, created_by, created_time, updated_by, updated_time from base_work_unit
</sql>
<select id="selectBaseWorkUnitList" parameterType="BaseWorkUnit" resultMap="BaseWorkUnitResult">
<include refid="selectBaseWorkUnitVo"/>
<where>
<if test="objId != null "> and obj_id = #{objId}</if>
<if test="workUnitCode != null and workUnitCode != ''"> and work_unit_code = #{workUnitCode}</if>
<if test="parentId != null and parentId != ''"> and parent_id = #{parentId}</if>
<if test="workUnitName != null and workUnitName != ''"> and work_unit_name like concat(concat('%', #{workUnitName}), '%')</if>
<if test="workUnitAddress != null and workUnitAddress != ''"> and work_unit_address = #{workUnitAddress}</if>
<if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
<if test="workUnitSort != null "> and work_unit_sort = #{workUnitSort}</if>
<if test="productLineCode != null and productLineCode != ''"> and product_line_code = #{productLineCode}</if>
<if test="workUnitType != null "> and work_unit_type = #{workUnitType}</if>
<if test="isFlag != null "> and is_flag = #{isFlag}</if>
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if>
<if test="createdTime != null "> and created_time = #{createdTime}</if>
<if test="updatedBy != null and updatedBy != ''"> and updated_by = #{updatedBy}</if>
<if test="updatedTime != null "> and updated_time = #{updatedTime}</if>
</where>
</select>
<select id="selectBaseWorkUnitByObjId" parameterType="Long" resultMap="BaseWorkUnitResult">
<include refid="selectBaseWorkUnitVo"/>
where obj_id = #{objId}
</select>
<insert id="insertBaseWorkUnit" parameterType="BaseWorkUnit">
<selectKey keyProperty="objId" resultType="long" order="BEFORE">
SELECT seq_report_day_dnb.NEXTVAL as objId FROM DUAL
</selectKey>
insert into base_work_unit
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="objId != null">obj_id,</if>
<if test="workUnitCode != null and workUnitCode != ''">work_unit_code,</if>
<if test="parentId != null">parent_id,</if>
<if test="workUnitName != null">work_unit_name,</if>
<if test="workUnitAddress != null">work_unit_address,</if>
<if test="ancestors != null">ancestors,</if>
<if test="workUnitSort != null">work_unit_sort,</if>
<if test="productLineCode != null">product_line_code,</if>
<if test="workUnitType != null">work_unit_type,</if>
<if test="isFlag != null">is_flag,</if>
<if test="createdBy != null">created_by,</if>
<if test="createdTime != null">created_time,</if>
<if test="updatedBy != null">updated_by,</if>
<if test="updatedTime != null">updated_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="objId != null">#{objId},</if>
<if test="workUnitCode != null and workUnitCode != ''">#{workUnitCode},</if>
<if test="parentId != null">#{parentId},</if>
<if test="workUnitName != null">#{workUnitName},</if>
<if test="workUnitAddress != null">#{workUnitAddress},</if>
<if test="ancestors != null">#{ancestors},</if>
<if test="workUnitSort != null">#{workUnitSort},</if>
<if test="productLineCode != null">#{productLineCode},</if>
<if test="workUnitType != null">#{workUnitType},</if>
<if test="isFlag != null">#{isFlag},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="createdTime != null">#{createdTime},</if>
<if test="updatedBy != null">#{updatedBy},</if>
<if test="updatedTime != null">#{updatedTime},</if>
</trim>
</insert>
<update id="updateBaseWorkUnit" parameterType="BaseWorkUnit">
update base_work_unit
<trim prefix="SET" suffixOverrides=",">
<if test="workUnitCode != null and workUnitCode != ''">work_unit_code = #{workUnitCode},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="workUnitName != null">work_unit_name = #{workUnitName},</if>
<if test="workUnitAddress != null">work_unit_address = #{workUnitAddress},</if>
<if test="ancestors != null">ancestors = #{ancestors},</if>
<if test="workUnitSort != null">work_unit_sort = #{workUnitSort},</if>
<if test="productLineCode != null">product_line_code = #{productLineCode},</if>
<if test="workUnitType != null">work_unit_type = #{workUnitType},</if>
<if test="isFlag != null">is_flag = #{isFlag},</if>
<if test="createdBy != null">created_by = #{createdBy},</if>
<if test="createdTime != null">created_time = #{createdTime},</if>
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
</trim>
where obj_id = #{objId}
</update>
<delete id="deleteBaseWorkUnitByObjId" parameterType="Long">
delete from base_work_unit where obj_id = #{objId}
</delete>
<delete id="deleteBaseWorkUnitByObjIds" parameterType="String">
delete from base_work_unit where obj_id in
<foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId}
</foreach>
</delete>
</mapper>

@ -42,7 +42,6 @@ public class ReportPointDnbController extends BaseController {
@GetMapping("/list" )
public TableDataInfo list(ReportPointDnb reportPointDnb) {
startPage();
System.out.println(reportPointDnb);
List<ReportPointDnb> list = reportPointDnbService.selectReportPointDnbList(reportPointDnb);
return getDataTable(list);
}

Loading…
Cancel
Save