diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/CompositeQueryController.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/CompositeQueryController.java index 8b0451c5..0b3e574d 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/CompositeQueryController.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/CompositeQueryController.java @@ -1,6 +1,7 @@ package com.bonus.sgzb.app.controller; import cn.hutool.core.collection.CollUtil; +import com.bonus.sgzb.app.domain.StorageStatus; import com.bonus.sgzb.app.service.HoldingLedgerService; import com.bonus.sgzb.base.api.domain.LeaseOutDetails; import com.bonus.sgzb.common.core.web.controller.BaseController; @@ -30,9 +31,8 @@ public class CompositeQueryController extends BaseController { */ @Log(title = "抱杆台账查询", businessType = BusinessType.UPDATE) @GetMapping("/getHoldingLedger") - public AjaxResult getHoldingLedger() { + public AjaxResult getHoldingLedger(StorageStatus storageStatus) { startPage(); - return AjaxResult.success(getDataTable(holdingLedgerService.getHoldingLedger())); + return AjaxResult.success(getDataTable(holdingLedgerService.getHoldingLedger(storageStatus))); } - } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/StorageStatus.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/StorageStatus.java new file mode 100644 index 00000000..da369acd --- /dev/null +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/domain/StorageStatus.java @@ -0,0 +1,210 @@ +package com.bonus.sgzb.app.domain; + +import com.bonus.sgzb.common.core.annotation.Excel; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; +import java.util.List; + +/** +* @description 综合查询--成套抱杆查询 +* @author hay +* @date 2024/2/26 14:51 +*/ +@ApiModel(description = "成套抱杆查询") +@Data +public class StorageStatus { + + private static final long serialVersionUID = 2227217051604273598L; + + @ApiModelProperty(value = "") + private Integer id; + + /** + * 协议号 + */ + @ApiModelProperty(value = "协议号") + private String agreementCode; + + + /** + * 类型名称 + */ + @ApiModelProperty(value = "类型名称") + @Excel(name = "机具名称") + private String typeName; + + /** + * 规格ID + */ + @ApiModelProperty(value = "规格ID") + private Integer typeId; + + /** + * 规格型号 + */ + @ApiModelProperty(value = "规格型号") + @Excel(name = "规格名称") + private String typeModelName; + + /** + * 计量单位 + */ + @ApiModelProperty(value = "计量单位") + @Excel(name = "单位") + private String unit; + + /** + * 在库数量 + */ + @ApiModelProperty(value = "在库数量") + @Excel(name = "在库数量",cellType = Excel.ColumnType.NUMERIC) + private Double num; + + /** + * 在用数量 + */ + @ApiModelProperty(value = "在用数量") + @Excel(name = "在用数量",cellType = Excel.ColumnType.NUMERIC) + private Double usNum; + + /** + * 在修数量 + */ + @ApiModelProperty(value = "在修数量") + @Excel(name = "在修数量",cellType = Excel.ColumnType.NUMERIC) + private Double repairNum; + + /** + * 修试后待入库 + */ + @ApiModelProperty(value = "修试后待入库") + @Excel(name = "修试后待入库",cellType = Excel.ColumnType.NUMERIC) + private Double repairInputNum; + + /** + * 新购待入库 + */ + @ApiModelProperty(value = "新购待入库") + @Excel(name = "新购待入库",cellType = Excel.ColumnType.NUMERIC) + private Double inputNum; + + /** + * 总保有量 + */ + @ApiModelProperty(value = "总保有量") + @Excel(name = "总保有量",cellType = Excel.ColumnType.NUMERIC) + private Double allNum; + + /** + * 是否计数 + */ + @ApiModelProperty(value = "是否计数") + @Excel(name = "是否计数") + private String manageType; + + + /** + * 租赁数量 + */ + @ApiModelProperty(value = "租赁数量") + @Excel(name = "租赁数量",cellType = Excel.ColumnType.NUMERIC) + private Double outNum; + + /** + * 归还数量 + */ + @ApiModelProperty(value = "归还数量") + @Excel(name = "归还数量",cellType = Excel.ColumnType.NUMERIC) + private Double backNum; + + + /** + * 在用总价值 + */ + @ApiModelProperty(value = "在用总价值") + private Double usPrice; + + /** + * 投入总价值 + */ + @ApiModelProperty(value = "投入总价值") + private Double totalPrice; + + /** + * 退料人 + */ + @ApiModelProperty(value = "退料人") + private String backPerson; + + + + /** + * 创建者 + */ + @ApiModelProperty(value = "创建者") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + /** + * 更新者 + */ + @ApiModelProperty(value = "更新者") + private String updateBy; + + /** + * 更新时间 + */ + @ApiModelProperty(value = "更新时间 ") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; + + + /** + * 备注 + */ + @ApiModelProperty(value = "备注") + private String remark; + + /** + * 关键字 + */ + @ApiModelProperty(value = "关键字") + private String keyWord; + + @ApiModelProperty(value="开始时间") + private String startTime; + + @ApiModelProperty(value="结束时间") + private String endTime; + + + /** + * 设备所属类型 + */ + @ApiModelProperty(value = "数据所属组织") + private Integer companyId; + + + /** + * 装备管理方式(0编号 1计数) + */ + @ApiModelProperty(value = "装备管理方式名称") + private String manageTypeName; + + @ApiModelProperty(value = "成套机具配件详细") + private List wholeSetDetails; + +} \ No newline at end of file diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/HoldingLedgerMapper.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/HoldingLedgerMapper.java index 9f494115..7e022e99 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/HoldingLedgerMapper.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/HoldingLedgerMapper.java @@ -1,6 +1,7 @@ package com.bonus.sgzb.app.mapper; import com.bonus.sgzb.app.domain.MachinePart; +import com.bonus.sgzb.app.domain.StorageStatus; import com.bonus.sgzb.app.domain.TmTask; import org.apache.ibatis.annotations.Mapper; @@ -12,9 +13,7 @@ import java.util.List; */ @Mapper public interface HoldingLedgerMapper { - List getHoldingLedger(); + List getHoldingLedger(StorageStatus storageStatus); - List getHoldingLedgerDetail(TmTask tmTask); - - MachinePart getMachineParts(TmTask typeId); + List getWholeSetDetails(StorageStatus storageStatus); } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/HoldingLedgerService.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/HoldingLedgerService.java index b09e9d4d..9a50278a 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/HoldingLedgerService.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/HoldingLedgerService.java @@ -1,5 +1,6 @@ package com.bonus.sgzb.app.service; +import com.bonus.sgzb.app.domain.StorageStatus; import com.bonus.sgzb.app.domain.TmTask; import java.util.List; @@ -9,5 +10,5 @@ import java.util.List; * @date:2024/4/19 - 17:48 */ public interface HoldingLedgerService{ - List getHoldingLedger(); + List getHoldingLedger(StorageStatus storageStatus); } diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/HoldingLedgerImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/HoldingLedgerImpl.java index e6732ae8..a22563d0 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/HoldingLedgerImpl.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/HoldingLedgerImpl.java @@ -1,6 +1,7 @@ package com.bonus.sgzb.app.service.impl; import com.bonus.sgzb.app.domain.MachinePart; +import com.bonus.sgzb.app.domain.StorageStatus; import com.bonus.sgzb.app.domain.TmTask; import com.bonus.sgzb.app.mapper.HoldingLedgerMapper; import com.bonus.sgzb.app.service.HoldingLedgerService; @@ -21,17 +22,14 @@ public class HoldingLedgerImpl implements HoldingLedgerService { private HoldingLedgerMapper holdingLedgerMapper; @Override - public List getHoldingLedger() { - /*List holdingLedger = holdingLedgerMapper.getHoldingLedger(); - for (TmTask tmTask : holdingLedger) { - List holdingLedgerDetail = holdingLedgerMapper.getHoldingLedgerDetail(tmTask); - holdingLedgerDetail.removeIf(item -> item == null); - for (TmTask typeId : holdingLedgerDetail) { - MachinePart machinePart = holdingLedgerMapper.getMachineParts(typeId); - machinePart.setPartNum((int) (typeId.getPartNum() * leaseApplyDetail.getPreNum())); - machineParts.add(machinePart); + public List getHoldingLedger(StorageStatus storageStatus) { + List holdingLedger = holdingLedgerMapper.getHoldingLedger(storageStatus); + if (holdingLedger.size() > 0) { + for (StorageStatus bean : holdingLedger) { + List wholeSetDetails = holdingLedgerMapper.getWholeSetDetails(bean); + bean.setWholeSetDetails(wholeSetDetails); } - }*/ - return null; + } + return holdingLedger; } } diff --git a/sgzb-modules/sgzb-base/src/main/resources/mapper/base/HoldingLedgerMapper.xml b/sgzb-modules/sgzb-base/src/main/resources/mapper/base/HoldingLedgerMapper.xml index cf18dc32..82b73ca2 100644 --- a/sgzb-modules/sgzb-base/src/main/resources/mapper/base/HoldingLedgerMapper.xml +++ b/sgzb-modules/sgzb-base/src/main/resources/mapper/base/HoldingLedgerMapper.xml @@ -3,39 +3,144 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - - - SELECT + mt2.type_name AS typeName, mt.type_name AS typeModelName, - mt.type_id as modelId, - mt.unit_name as unitName, - m2.type_name As typeName + mt.unit_name AS unit, + mt.type_id AS typeId, + IFNULL( mt.num, 0 ) AS num, + IFNULL( subquery1.usNum, 0 ) AS usNum, + IFNULL( subquery2.repairNum, 0 ) AS repairNum, + IFNULL( subquery3.repairInputNum, 0 ) AS repairInputNum, + IFNULL( subquery4.inputNum, 0 ) AS inputNum, + IFNULL( mt.num, 0 ) + IFNULL( subquery1.usNum, 0 ) + IFNULL( subquery2.repairNum, 0 ) + IFNULL( subquery3.repairInputNum, 0 ) AS allNum, + CASE + mt.manage_type + WHEN 0 THEN + '否' ELSE '是' + END manageType FROM ma_type mt - LEFT JOIN ma_type m2 ON mt.parent_id = m2.type_id + LEFT JOIN ( + SELECT + subquery1.type_id, + subquery1.typeName, + subquery1.typeModelName, + IFNULL( subquery1.outNum, 0 ) AS outNum, + IFNULL( subquery2.backNum, 0 ) AS backNum, + CASE + + WHEN IFNULL( subquery1.outNum, 0 ) - IFNULL( subquery2.backNum, 0 ) > 0 THEN + IFNULL( subquery1.outNum, 0 ) - IFNULL( subquery2.backNum, 0 ) ELSE 0 + END AS usNum + FROM + ( + SELECT + mt.type_id, + mt2.type_name AS typeName, + mt.type_name AS typeModelName, + SUM( + IFNULL( lod.out_num, 0 )) AS outNum + FROM + lease_out_details lod + LEFT JOIN ma_type mt ON mt.type_id = lod.type_id + LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id + GROUP BY + mt.type_id + ) AS subquery1 + LEFT JOIN ( + SELECT + mt.type_id, + mt2.type_name AS typeName, + mt.type_name AS typeModelName, + SUM( + IFNULL( bcd.back_num, 0 )) backNum + FROM + back_check_details bcd + LEFT JOIN ma_type mt ON mt.type_id = bcd.type_id + LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id + LEFT JOIN ma_machine mm ON mm.ma_id = bcd.ma_id + GROUP BY + mt.type_id + ) AS subquery2 ON subquery1.type_id = subquery2.type_id + ) AS subquery1 ON mt.type_id = subquery1.type_id + LEFT JOIN ( + SELECT + mt.type_id, + mt2.type_name AS typeName, + mt.type_name AS typeModelName, + SUM( + IFNULL( rad.repair_num, 0 ) - IFNULL( rad.repaired_num, 0 ) - IFNULL( rad.scrap_num, 0 )) AS repairNum + FROM + repair_apply_details rad + LEFT JOIN ma_type mt ON mt.type_id = rad.type_id + LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id + WHERE + IFNULL( rad.repair_num, 0 ) - IFNULL( rad.repaired_num, 0 ) - IFNULL( rad.scrap_num, 0 ) > 0 + GROUP BY + mt.type_id + ) AS subquery2 ON subquery2.type_id = mt.type_id + LEFT JOIN ( + SELECT + mt.type_id, + mt2.type_name AS typeName, + mt.type_name AS typeModelName, + SUM( + IFNULL( rid.repair_num, 0 ) - IFNULL( rid.input_num, 0 )) AS repairInputNum + FROM + repair_input_details rid + LEFT JOIN ma_type mt ON mt.type_id = rid.type_id + LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id + WHERE + IFNULL( rid.repair_num, 0 ) - IFNULL( rid.input_num, 0 ) > 0 + GROUP BY + mt.type_id + ) AS subquery3 ON subquery3.type_id = mt.type_id + LEFT JOIN ( + SELECT + mt.type_id, + mt2.type_name AS typeName, + mt.type_name AS typeModelName, + SUM( + IFNULL( pcd.check_num, 0 ) - IFNULL( pcd.input_num, 0 )) AS inputNum + FROM + purchase_check_details pcd + LEFT JOIN ma_type mt ON mt.type_id = pcd.type_id + LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id + WHERE + IFNULL( pcd.check_num, 0 ) - IFNULL( pcd.input_num, 0 ) > 0 + GROUP BY + mt.type_id + ) AS subquery4 ON subquery4.type_id = mt.type_id + LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id WHERE - mt.type_id = #{typeId} + mt.`level` = 4 + AND mt.del_flag = '0' + AND mt.manage_type = 2 + + and mt.type_id = #{typeId} + + + \ No newline at end of file diff --git a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/controller/SysRoleController.java b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/controller/SysRoleController.java index bd533915..3ad5e033 100644 --- a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/controller/SysRoleController.java +++ b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/controller/SysRoleController.java @@ -34,13 +34,12 @@ import com.bonus.sgzb.system.service.ISysUserService; /** * 角色信息 - * + * * @author ruoyi */ @RestController @RequestMapping("/role") -public class SysRoleController extends BaseController -{ +public class SysRoleController extends BaseController { @Autowired private ISysRoleService roleService; @@ -52,8 +51,7 @@ public class SysRoleController extends BaseController @RequiresPermissions("system:role:list") @GetMapping("/list") - public TableDataInfo list(SysRole role) - { + public TableDataInfo list(SysRole role) { startPage(); List list = roleService.selectRoleList(role); return getDataTable(list); @@ -62,8 +60,7 @@ public class SysRoleController extends BaseController @Log(title = "角色管理", businessType = BusinessType.EXPORT) @RequiresPermissions("system:role:export") @PostMapping("/export") - public void export(HttpServletResponse response, SysRole role) - { + public void export(HttpServletResponse response, SysRole role) { List list; list = roleService.selectRoleList(role); //根据前端列表选中选择性列表导出 @@ -80,8 +77,7 @@ public class SysRoleController extends BaseController */ @RequiresPermissions("system:role:query") @GetMapping(value = "/{roleId}") - public AjaxResult getInfo(@PathVariable Long roleId) - { + public AjaxResult getInfo(@PathVariable Long roleId) { roleService.checkRoleDataScope(roleId); return success(roleService.selectRoleById(roleId)); } @@ -92,14 +88,10 @@ public class SysRoleController extends BaseController @RequiresPermissions("system:role:add") @Log(title = "角色管理", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@Validated @RequestBody SysRole role) - { - if (!roleService.checkRoleNameUnique(role)) - { + public AjaxResult add(@Validated @RequestBody SysRole role) { + if (!roleService.checkRoleNameUnique(role)) { return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在"); - } - else if (!roleService.checkRoleKeyUnique(role)) - { + } else if (!roleService.checkRoleKeyUnique(role)) { return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); } role.setCreateBy(SecurityUtils.getUsername()); @@ -113,16 +105,12 @@ public class SysRoleController extends BaseController @RequiresPermissions("system:role:edit") @Log(title = "角色管理", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@Validated @RequestBody SysRole role) - { + public AjaxResult edit(@Validated @RequestBody SysRole role) { roleService.checkRoleAllowed(role); roleService.checkRoleDataScope(role.getRoleId()); - if (!roleService.checkRoleNameUnique(role)) - { + if (!roleService.checkRoleNameUnique(role)) { return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在"); - } - else if (!roleService.checkRoleKeyUnique(role)) - { + } else if (!roleService.checkRoleKeyUnique(role)) { return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); } role.setUpdateBy(SecurityUtils.getUsername()); @@ -135,8 +123,7 @@ public class SysRoleController extends BaseController @RequiresPermissions("system:role:edit") @Log(title = "角色管理", businessType = BusinessType.UPDATE) @PutMapping("/dataScope") - public AjaxResult dataScope(@RequestBody SysRole role) - { + public AjaxResult dataScope(@RequestBody SysRole role) { roleService.checkRoleAllowed(role); roleService.checkRoleDataScope(role.getRoleId()); return toAjax(roleService.authDataScope(role)); @@ -148,8 +135,7 @@ public class SysRoleController extends BaseController @RequiresPermissions("system:role:edit") @Log(title = "角色管理", businessType = BusinessType.UPDATE) @PutMapping("/changeStatus") - public AjaxResult changeStatus(@RequestBody SysRole role) - { + public AjaxResult changeStatus(@RequestBody SysRole role) { roleService.checkRoleAllowed(role); roleService.checkRoleDataScope(role.getRoleId()); role.setUpdateBy(SecurityUtils.getUsername()); @@ -162,8 +148,7 @@ public class SysRoleController extends BaseController @RequiresPermissions("system:role:remove") @Log(title = "角色管理", businessType = BusinessType.DELETE) @DeleteMapping("/{roleIds}") - public AjaxResult remove(@PathVariable Long[] roleIds) - { + public AjaxResult remove(@PathVariable Long[] roleIds) { return toAjax(roleService.deleteRoleByIds(roleIds)); } @@ -172,17 +157,16 @@ public class SysRoleController extends BaseController */ @RequiresPermissions("system:role:query") @GetMapping("/optionselect") - public AjaxResult optionselect() - { + public AjaxResult optionselect() { return success(roleService.selectRoleAll()); } + /** * 查询已分配用户角色列表 */ @RequiresPermissions("system:role:list") @GetMapping("/authUser/allocatedList") - public TableDataInfo allocatedList(SysUser user) - { + public TableDataInfo allocatedList(SysUser user) { startPage(); List list = userService.selectAllocatedList(user); return getDataTable(list); @@ -193,8 +177,7 @@ public class SysRoleController extends BaseController */ @RequiresPermissions("system:role:list") @GetMapping("/authUser/unallocatedList") - public TableDataInfo unallocatedList(SysUser user) - { + public TableDataInfo unallocatedList(SysUser user) { startPage(); List list = userService.selectUnallocatedList(user); return getDataTable(list); @@ -206,8 +189,7 @@ public class SysRoleController extends BaseController @RequiresPermissions("system:role:edit") @Log(title = "角色管理", businessType = BusinessType.GRANT) @PutMapping("/authUser/cancel") - public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) - { + public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) { return toAjax(roleService.deleteAuthUser(userRole)); } @@ -217,8 +199,7 @@ public class SysRoleController extends BaseController @RequiresPermissions("system:role:edit") @Log(title = "角色管理", businessType = BusinessType.GRANT) @PutMapping("/authUser/cancelAll") - public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) - { + public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) { return toAjax(roleService.deleteAuthUsers(roleId, userIds)); } @@ -228,8 +209,7 @@ public class SysRoleController extends BaseController @RequiresPermissions("system:role:edit") @Log(title = "角色管理", businessType = BusinessType.GRANT) @PutMapping("/authUser/selectAll") - public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) - { + public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) { roleService.checkRoleDataScope(roleId); return toAjax(roleService.insertAuthUsers(roleId, userIds)); } @@ -239,8 +219,7 @@ public class SysRoleController extends BaseController */ @RequiresPermissions("system:role:query") @GetMapping(value = "/deptTree/{roleId}") - public AjaxResult deptTree(@PathVariable("roleId") Long roleId) - { + public AjaxResult deptTree(@PathVariable("roleId") Long roleId) { AjaxResult ajax = AjaxResult.success(); ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));