diff --git a/aucma-api/src/main/java/com/aucma/api/domain/vo/SAPResultOrderInfoVo.java b/aucma-api/src/main/java/com/aucma/api/domain/vo/SAPResultOrderInfoVo.java new file mode 100644 index 0000000..6260f9e --- /dev/null +++ b/aucma-api/src/main/java/com/aucma/api/domain/vo/SAPResultOrderInfoVo.java @@ -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>> O_TAB; + + @JsonProperty(value = "WERKS") + private WERKSDto WERKS; + + @JsonProperty(value = "O_RETURN") + private WERKSDto O_RETURN; + + public HashMap>> getO_TAB() { + return O_TAB; + } + + public void setO_TAB(HashMap>> 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 + + '}'; + } +} diff --git a/aucma-api/src/main/java/com/aucma/api/service/ISAPPortService.java b/aucma-api/src/main/java/com/aucma/api/service/ISAPPortService.java index 243ad35..7f14607 100644 --- a/aucma-api/src/main/java/com/aucma/api/service/ISAPPortService.java +++ b/aucma-api/src/main/java/com/aucma/api/service/ISAPPortService.java @@ -17,7 +17,6 @@ import java.util.List; @Service("SAPPort") public interface ISAPPortService { - /** * 获取SAP物料主数据 * @param sapPortDto diff --git a/aucma-api/src/main/java/com/aucma/api/service/ISAPPutStorageService.java b/aucma-api/src/main/java/com/aucma/api/service/ISAPPutStorageService.java index 0ba9eb0..529ba74 100644 --- a/aucma-api/src/main/java/com/aucma/api/service/ISAPPutStorageService.java +++ b/aucma-api/src/main/java/com/aucma/api/service/ISAPPutStorageService.java @@ -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 insertSAPBaseOrderInfo(SAPResultVo resultVo) throws ParseException; + public ArrayList insertSAPBaseOrderInfo(SAPResultOrderInfoVo resultVo) throws ParseException; /** * 转设备台账实体类 保存数据 * @param resultVo * @return */ - public ArrayList insertSAPDeviceLedger(SAPResultVo resultVo) throws ParseException; + public ArrayList insertSAPDeviceLedger(SAPResultOrderInfoVo resultVo) throws ParseException; /** * 转换产品bom信息实体类 保存数据 * * */ - public ArrayList insertSAPOrderBomInfo(SAPResultBomVo resultVo) throws ParseException; + public ArrayList insertSAPOrderBomInfo(SAPResultOrderInfoVo resultVo) throws ParseException; } diff --git a/aucma-api/src/main/java/com/aucma/api/service/impl/SAPPortServiceImpl.java b/aucma-api/src/main/java/com/aucma/api/service/impl/SAPPortServiceImpl.java index ac26a17..a341aef 100644 --- a/aucma-api/src/main/java/com/aucma/api/service/impl/SAPPortServiceImpl.java +++ b/aucma-api/src/main/java/com/aucma/api/service/impl/SAPPortServiceImpl.java @@ -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); diff --git a/aucma-api/src/main/java/com/aucma/api/service/impl/SAPPutStorageServiceImpl.java b/aucma-api/src/main/java/com/aucma/api/service/impl/SAPPutStorageServiceImpl.java index 2d7443f..9ee182f 100644 --- a/aucma-api/src/main/java/com/aucma/api/service/impl/SAPPutStorageServiceImpl.java +++ b/aucma-api/src/main/java/com/aucma/api/service/impl/SAPPutStorageServiceImpl.java @@ -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 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 insertSAPBaseOrderInfo(SAPResultVo resultVo) throws ParseException { + public ArrayList insertSAPBaseOrderInfo(SAPResultOrderInfoVo resultVo) throws ParseException { ArrayList baseOrderInfoList = new ArrayList<>(); List> itemList = resultVo.getO_TAB().get("item"); for (HashMap map : itemList) { @@ -119,7 +121,7 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService { * @return */ @Override - public ArrayList insertSAPDeviceLedger(SAPResultVo resultVo) throws ParseException { + public ArrayList insertSAPDeviceLedger(SAPResultOrderInfoVo resultVo) throws ParseException { ArrayList baseDeviceLedgerArrayList = new ArrayList<>(); List> itemList = resultVo.getO_TAB().get("item"); for (HashMap map : itemList) { @@ -146,22 +148,23 @@ public class SAPPutStorageServiceImpl implements ISAPPutStorageService { } @Override - public ArrayList insertSAPOrderBomInfo(SAPResultBomVo resultVo) throws ParseException { + public ArrayList insertSAPOrderBomInfo(SAPResultOrderInfoVo resultVo) throws ParseException { ArrayList orderBomInfoList = new ArrayList<>(); List> itemList = resultVo.getO_TAB().get("item"); for (HashMap map : itemList) { OrderBomInfo orderBomInfo1 = new OrderBomInfo(); - orderBomInfo1.setBomCode(map.get("IDNRK")); + orderBomInfo1.setMaterialCode(map.get("IDNRK")); List 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; } - } diff --git a/aucma-base/src/main/java/com/aucma/base/controller/BaseMonitorInfoController.java b/aucma-base/src/main/java/com/aucma/base/controller/BaseMonitorInfoController.java index 3a1606a..797c7c7 100644 --- a/aucma-base/src/main/java/com/aucma/base/controller/BaseMonitorInfoController.java +++ b/aucma-base/src/main/java/com/aucma/base/controller/BaseMonitorInfoController.java @@ -44,6 +44,9 @@ public class BaseMonitorInfoController extends BaseController { List list = baseMonitorInfoService.selectBaseMonitorInfoList(baseMonitorInfo); return success(list); } + /** + * 查询计量设备信息下拉树结构 + * */ @PostMapping("/monitorInfoTree") public AjaxResult getMonitorInfoTree(BaseMonitorInfo baseMonitorInfo) { List list = baseMonitorInfoService.selectBaseMonitorInfoTreeList(baseMonitorInfo); diff --git a/aucma-base/src/main/java/com/aucma/base/controller/BaseMonitorWorkUnitController.java b/aucma-base/src/main/java/com/aucma/base/controller/BaseMonitorWorkUnitController.java new file mode 100644 index 0000000..c220795 --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/controller/BaseMonitorWorkUnitController.java @@ -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 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 list = baseMonitorWorkUnitService.selectBaseMonitorWorkUnitList(baseMonitorWorkUnit); + ExcelUtil util = new ExcelUtil(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)); + } +} diff --git a/aucma-base/src/main/java/com/aucma/base/controller/BaseWorkUnitController.java b/aucma-base/src/main/java/com/aucma/base/controller/BaseWorkUnitController.java new file mode 100644 index 0000000..fbe363c --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/controller/BaseWorkUnitController.java @@ -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 list = baseWorkUnitService.selectBaseWorkUnitList(baseWorkUnit); + return success(list); + } + /** + * 查询计量设备信息下拉树结构 + * */ + @PostMapping("/workUnitTree") + public AjaxResult getMonitorInfoTree(BaseWorkUnit baseWorkUnit) { + List 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 list = baseWorkUnitService.selectBaseWorkUnitList(baseWorkUnit); + ExcelUtil util = new ExcelUtil(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)); + } +} diff --git a/aucma-base/src/main/java/com/aucma/base/domain/BaseMonitorWorkUnit.java b/aucma-base/src/main/java/com/aucma/base/domain/BaseMonitorWorkUnit.java new file mode 100644 index 0000000..6844810 --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/domain/BaseMonitorWorkUnit.java @@ -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(); + } + } diff --git a/aucma-base/src/main/java/com/aucma/base/domain/BaseWorkUnit.java b/aucma-base/src/main/java/com/aucma/base/domain/BaseWorkUnit.java new file mode 100644 index 0000000..eb5bdc4 --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/domain/BaseWorkUnit.java @@ -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 children = new ArrayList(); + + private String parentName; + + private Long parentId; + + private Integer orderNum; + + private String ancestors; + + public List getChildren() { + return children; + } + + public void setChildren(List 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(); + } + } diff --git a/aucma-base/src/main/java/com/aucma/base/domain/OrderBomInfo.java b/aucma-base/src/main/java/com/aucma/base/domain/OrderBomInfo.java index 271e569..1d658ca 100644 --- a/aucma-base/src/main/java/com/aucma/base/domain/OrderBomInfo.java +++ b/aucma-base/src/main/java/com/aucma/base/domain/OrderBomInfo.java @@ -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) { diff --git a/aucma-base/src/main/java/com/aucma/base/domain/TreeSelects.java b/aucma-base/src/main/java/com/aucma/base/domain/TreeSelects.java index d8b3c4f..3eb5bc9 100644 --- a/aucma-base/src/main/java/com/aucma/base/domain/TreeSelects.java +++ b/aucma-base/src/main/java/com/aucma/base/domain/TreeSelects.java @@ -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) { diff --git a/aucma-base/src/main/java/com/aucma/base/mapper/BaseMonitorWorkUnitMapper.java b/aucma-base/src/main/java/com/aucma/base/mapper/BaseMonitorWorkUnitMapper.java new file mode 100644 index 0000000..e459669 --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/mapper/BaseMonitorWorkUnitMapper.java @@ -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 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); +} diff --git a/aucma-base/src/main/java/com/aucma/base/mapper/BaseWorkUnitMapper.java b/aucma-base/src/main/java/com/aucma/base/mapper/BaseWorkUnitMapper.java new file mode 100644 index 0000000..d03015a --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/mapper/BaseWorkUnitMapper.java @@ -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 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); +} diff --git a/aucma-base/src/main/java/com/aucma/base/service/IBaseMonitorWorkUnitService.java b/aucma-base/src/main/java/com/aucma/base/service/IBaseMonitorWorkUnitService.java new file mode 100644 index 0000000..19b860a --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/service/IBaseMonitorWorkUnitService.java @@ -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 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); +} diff --git a/aucma-base/src/main/java/com/aucma/base/service/IBaseWorkUnitService.java b/aucma-base/src/main/java/com/aucma/base/service/IBaseWorkUnitService.java new file mode 100644 index 0000000..0b2169d --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/service/IBaseWorkUnitService.java @@ -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 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 selectBaseWorkUnitTreeList(BaseWorkUnit baseWorkUnit); + + public List buildWorkUnitTreeSelect(List baseWorkUnits); + + public List buildWorkUnitTree(List baseWorkUnits); + +} diff --git a/aucma-base/src/main/java/com/aucma/base/service/impl/BaseMonitorWorkUnitServiceImpl.java b/aucma-base/src/main/java/com/aucma/base/service/impl/BaseMonitorWorkUnitServiceImpl.java new file mode 100644 index 0000000..230a0fe --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/service/impl/BaseMonitorWorkUnitServiceImpl.java @@ -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 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); + } +} diff --git a/aucma-base/src/main/java/com/aucma/base/service/impl/BaseWorkUnitServiceImpl.java b/aucma-base/src/main/java/com/aucma/base/service/impl/BaseWorkUnitServiceImpl.java new file mode 100644 index 0000000..b6e3240 --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/service/impl/BaseWorkUnitServiceImpl.java @@ -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 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 selectBaseWorkUnitTreeList(BaseWorkUnit baseWorkUnit) { + List baseWorkUnits = selectBaseWorkUnitList(baseWorkUnit); + return buildWorkUnitTreeSelect(baseWorkUnits); + } + + @Override + public List buildWorkUnitTreeSelect(List baseWorkUnits) { + List baseWorkUnitsTrees = buildWorkUnitTree(baseWorkUnits); + return baseWorkUnitsTrees.stream().map(TreeSelects::new).collect(Collectors.toList()); + } + + @Override + public List buildWorkUnitTree(List baseWorkUnits) { + List returnList = new ArrayList(); + List 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 list, BaseWorkUnit t) + { + // 得到子节点列表 + List childList = getChildList(list, t); + t.setChildren(childList); + for (BaseWorkUnit tChild : childList) + { + if (hasChild(list, tChild)) + { + recursionFn(list, tChild); + } + } + } + /** + * 得到子节点列表 + */ + private List getChildList(List list, BaseWorkUnit t) + { + List tlist = new ArrayList(); + Iterator 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 list, BaseWorkUnit t) + { + return getChildList(list, t).size() > 0; + } + +} diff --git a/aucma-base/src/main/resources/mapper/base/BaseMonitorWorkUnitMapper.xml b/aucma-base/src/main/resources/mapper/base/BaseMonitorWorkUnitMapper.xml new file mode 100644 index 0000000..681b7f2 --- /dev/null +++ b/aucma-base/src/main/resources/mapper/base/BaseMonitorWorkUnitMapper.xml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + insert into base_monitor_work_unit + + 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, + + + #{objId}, + #{monitorCode}, + #{workUnitCode}, + #{monitorStatus}, + #{monitorType}, + #{formulaMode}, + #{proportion}, + #{remark}, + #{isFlag}, + #{createdBy}, + #{createdTime}, + #{updatedBy}, + #{updatedTime}, + + + + + update base_monitor_work_unit + + monitor_code = #{monitorCode}, + work_unit_code = #{workUnitCode}, + monitor_status = #{monitorStatus}, + monitor_type = #{monitorType}, + formula_mode = #{formulaMode}, + proportion = #{proportion}, + remark = #{remark}, + is_flag = #{isFlag}, + created_by = #{createdBy}, + created_time = #{createdTime}, + updated_by = #{updatedBy}, + updated_time = #{updatedTime}, + + where obj_id = #{objId} + + + + delete from base_monitor_work_unit where obj_id = #{objId} + + + + delete from base_monitor_work_unit where obj_id in + + #{objId} + + + \ No newline at end of file diff --git a/aucma-base/src/main/resources/mapper/base/BaseWorkUnitMapper.xml b/aucma-base/src/main/resources/mapper/base/BaseWorkUnitMapper.xml new file mode 100644 index 0000000..c03a2fc --- /dev/null +++ b/aucma-base/src/main/resources/mapper/base/BaseWorkUnitMapper.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + + SELECT seq_report_day_dnb.NEXTVAL as objId FROM DUAL + + insert into base_work_unit + + 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, + + + #{objId}, + #{workUnitCode}, + #{parentId}, + #{workUnitName}, + #{workUnitAddress}, + #{ancestors}, + #{workUnitSort}, + #{productLineCode}, + #{workUnitType}, + #{isFlag}, + #{createdBy}, + #{createdTime}, + #{updatedBy}, + #{updatedTime}, + + + + + update base_work_unit + + work_unit_code = #{workUnitCode}, + parent_id = #{parentId}, + work_unit_name = #{workUnitName}, + work_unit_address = #{workUnitAddress}, + ancestors = #{ancestors}, + work_unit_sort = #{workUnitSort}, + product_line_code = #{productLineCode}, + work_unit_type = #{workUnitType}, + is_flag = #{isFlag}, + created_by = #{createdBy}, + created_time = #{createdTime}, + updated_by = #{updatedBy}, + updated_time = #{updatedTime}, + + where obj_id = #{objId} + + + + delete from base_work_unit where obj_id = #{objId} + + + + delete from base_work_unit where obj_id in + + #{objId} + + + diff --git a/aucma-report/src/main/java/com/aucma/report/controller/ReportPointDnbController.java b/aucma-report/src/main/java/com/aucma/report/controller/ReportPointDnbController.java index f18464b..cf8d893 100644 --- a/aucma-report/src/main/java/com/aucma/report/controller/ReportPointDnbController.java +++ b/aucma-report/src/main/java/com/aucma/report/controller/ReportPointDnbController.java @@ -42,7 +42,6 @@ public class ReportPointDnbController extends BaseController { @GetMapping("/list" ) public TableDataInfo list(ReportPointDnb reportPointDnb) { startPage(); - System.out.println(reportPointDnb); List list = reportPointDnbService.selectReportPointDnbList(reportPointDnb); return getDataTable(list); }