5号库改造-综合查询

This commit is contained in:
hayu 2026-01-09 15:28:35 +08:00
parent 89e2d0f8f2
commit e1140f5bb8
9 changed files with 107 additions and 0 deletions

View File

@ -18,6 +18,7 @@ import com.bonus.material.basic.domain.vo.MaTypeSelectInfo;
import com.bonus.material.basic.service.ComplexQueryService;
import com.bonus.material.common.annotation.PreventRepeatSubmit;
import com.bonus.material.ma.domain.Type;
import com.bonus.material.ma.service.ITypeService;
import com.bonus.material.part.domain.PartInventory;
import com.bonus.material.push.domain.MachineInfoBean;
import com.bonus.material.push.domain.MachineInfoExport;
@ -43,6 +44,9 @@ public class ComplexQueryController extends BaseController {
@Resource
private ComplexQueryService complexQueryService;
@Resource
private ITypeService typeService;
/**
* 保有设备总量查询
* @param bean
@ -53,6 +57,8 @@ public class ComplexQueryController extends BaseController {
public AjaxResult getRetainedEquipmentList(RetainedEquipmentInfo bean) {
bean.setIsExport(1);
bean.setUserId(SecurityUtils.getLoginUser().getUserid());
Long deptId = typeService.getUserDeptId();
bean.setCompanyId(Math.toIntExact(deptId));
if (bean.getIsApp() != null && bean.getIsApp() == 1) {
List<RetainedEquipmentInfo> pageList = complexQueryService.getRetainedEquipmentList(bean);
return AjaxResult.success(pageList);
@ -72,6 +78,8 @@ public class ComplexQueryController extends BaseController {
public AjaxResult getRetainedEquipmentListNoPage(RetainedEquipmentInfo bean) {
bean.setIsExport(0);
bean.setUserId(SecurityUtils.getLoginUser().getUserid());
Long deptId = typeService.getUserDeptId();
bean.setCompanyId(Math.toIntExact(deptId));
List<RetainedEquipmentInfo> list = complexQueryService.getRetainedEquipmentList(bean);
RetainedEquipmentInfo dto = new RetainedEquipmentInfo();
if (CollectionUtils.isNotEmpty(list)) {
@ -105,6 +113,8 @@ public class ComplexQueryController extends BaseController {
{
bean.setUserId(SecurityUtils.getLoginUser().getUserid());
bean.setIsExport(0);
Long deptId = typeService.getUserDeptId();
bean.setCompanyId(Math.toIntExact(deptId));
List<RetainedEquipmentInfo> list = complexQueryService.getRetainedEquipmentList(bean);
ExcelUtil<RetainedEquipmentInfo> util = new ExcelUtil<>(RetainedEquipmentInfo.class);
util.exportExcel(response, list, "综合查询--保有设备总量查询");
@ -147,6 +157,8 @@ public class ComplexQueryController extends BaseController {
public AjaxResult getUserRecords(UseStorageInfo bean) {
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
Long deptId = typeService.getUserDeptId();
bean.setCompanyId(deptId);
List<UseStorageInfo> list = complexQueryService.getUserRecords(bean);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
}
@ -159,6 +171,8 @@ public class ComplexQueryController extends BaseController {
@ApiOperation(value = "综合查询--导出在用设备详情")
@PostMapping("/exportUserRecordList")
public void exportUserRecordList(HttpServletResponse response, UseStorageInfo bean) {
Long deptId = typeService.getUserDeptId();
bean.setCompanyId(deptId);
List<UseStorageInfo> list = complexQueryService.getUserRecords(bean);
ExcelUtil<UseStorageInfo> util = new ExcelUtil<>(UseStorageInfo.class);
util.exportExcel(response, list, "综合查询--导出在用设备详情");
@ -174,6 +188,8 @@ public class ComplexQueryController extends BaseController {
public AjaxResult getRepairRecordList(RepairStorageInfo bean) {
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
Long deptId = typeService.getUserDeptId();
bean.setCompanyId(deptId);
List<RepairStorageInfo> list = complexQueryService.getRepairRecordList(bean);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
}
@ -186,6 +202,8 @@ public class ComplexQueryController extends BaseController {
@ApiOperation(value = "综合查询--导出在修设备详情")
@PostMapping("/exportRepairRecordList")
public void exportRepairRecordList(HttpServletResponse response, RepairStorageInfo bean) {
Long deptId = typeService.getUserDeptId();
bean.setCompanyId(deptId);
List<RepairStorageInfo> list = complexQueryService.getRepairRecordList(bean);
ExcelUtil<RepairStorageInfo> util = new ExcelUtil<>(RepairStorageInfo.class);
util.exportExcel(response, list, "综合查询--导出在修设备详情");
@ -200,6 +218,8 @@ public class ComplexQueryController extends BaseController {
@GetMapping("/getPurchaseRecordList")
public AjaxResult getPurchaseRecordList(PurchaseInputInfo bean) {
startPage();
Long deptId = typeService.getUserDeptId();
bean.setCompanyId(deptId);
List<PurchaseInputInfo> list = complexQueryService.getPurchaseRecordList(bean);
return AjaxResult.success(getDataTable(list));
}
@ -212,6 +232,8 @@ public class ComplexQueryController extends BaseController {
@ApiOperation(value = "综合查询--导出新购待入库详情")
@PostMapping("/exportPurchaseRecordList")
public void exportPurchaseRecordList(HttpServletResponse response, PurchaseInputInfo bean) {
Long deptId = typeService.getUserDeptId();
bean.setCompanyId(deptId);
List<PurchaseInputInfo> list = complexQueryService.getPurchaseRecordList(bean);
ExcelUtil<PurchaseInputInfo> util = new ExcelUtil<>(PurchaseInputInfo.class);
util.exportExcel(response, list, "综合查询--导出新购待入库详情");
@ -226,6 +248,8 @@ public class ComplexQueryController extends BaseController {
@GetMapping("/getRepairInputList")
public AjaxResult getRepairInputList(RepairInputRecord bean) {
startPage();
Long deptId = typeService.getUserDeptId();
bean.setCompanyId(deptId);
List<RepairInputRecord> list = complexQueryService.getRepairInputList(bean);
return AjaxResult.success(getDataTable(list));
}
@ -238,6 +262,8 @@ public class ComplexQueryController extends BaseController {
@ApiOperation(value = "综合查询--导出修饰待入库详情")
@PostMapping("/exportRepairInputList")
public void exportRepairInputList(HttpServletResponse response, RepairInputRecord bean) {
Long deptId = typeService.getUserDeptId();
bean.setCompanyId(deptId);
List<RepairInputRecord> list = complexQueryService.getRepairInputList(bean);
ExcelUtil<RepairInputRecord> util = new ExcelUtil<>(RepairInputRecord.class);
util.exportExcel(response, list, "综合查询--导出修饰待入库详情");
@ -358,6 +384,8 @@ public class ComplexQueryController extends BaseController {
public AjaxResult getMachineHistoryRecordList(MachineHistoryRecordBean bean) {
bean.setUserId(SecurityUtils.getLoginUser().getUserid());
startPage();
Long deptId = typeService.getUserDeptId();
bean.setCompanyId(deptId);
List<MachineHistoryRecordBean> list = complexQueryService.getMachineHistoryRecordList(bean);
return AjaxResult.success(getDataTable(list));
}
@ -372,6 +400,8 @@ public class ComplexQueryController extends BaseController {
public void exportMachineHistoryRecord(HttpServletResponse response, MachineHistoryRecordBean bean)
{
bean.setUserId(SecurityUtils.getLoginUser().getUserid());
Long deptId = typeService.getUserDeptId();
bean.setCompanyId(deptId);
List<MachineHistoryRecordBean> list = complexQueryService.getMachineHistoryRecordList(bean);
ExcelUtil<MachineHistoryRecordBean> util = new ExcelUtil<>(MachineHistoryRecordBean.class);
util.exportExcel(response, list, "综合查询--设备使用追溯查询");
@ -385,6 +415,8 @@ public class ComplexQueryController extends BaseController {
public AjaxResult getInputRecordList(InputRecordInfo bean) {
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
Long deptId = typeService.getUserDeptId();
bean.setCompanyId(deptId);
List<InputRecordInfo> list = complexQueryService.getInputRecordList(bean);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
}
@ -398,6 +430,8 @@ public class ComplexQueryController extends BaseController {
@PostMapping("/exportInputRecord")
public void exportInputRecord(HttpServletResponse response, InputRecordInfo bean)
{
Long deptId = typeService.getUserDeptId();
bean.setCompanyId(deptId);
List<InputRecordInfo> list = complexQueryService.getInputRecordList(bean);
ExcelUtil<InputRecordInfo> util = new ExcelUtil<>(InputRecordInfo.class);
util.exportExcel(response, list, "综合查询--机具入库查询");
@ -413,6 +447,8 @@ public class ComplexQueryController extends BaseController {
public AjaxResult getOutRecordList(OutRecordInfo bean) {
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
Long deptId = typeService.getUserDeptId();
bean.setCompanyId(deptId);
List<OutRecordInfo> list = complexQueryService.getOutRecordList(bean);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
}
@ -421,6 +457,8 @@ public class ComplexQueryController extends BaseController {
@PostMapping("/exportOutRecord")
public void exportOutRecord(HttpServletResponse response, OutRecordInfo bean)
{
Long deptId = typeService.getUserDeptId();
bean.setCompanyId(deptId);
List<OutRecordInfo> list = complexQueryService.getOutRecordList(bean);
ExcelUtil<OutRecordInfo> util = new ExcelUtil<>(OutRecordInfo.class);
util.exportExcel(response, list, "综合查询--机具出库查询");

View File

@ -82,4 +82,7 @@ public class InputRecordInfo {
@ApiModelProperty(value = "装备管理方式")
private String manageType;
@ApiModelProperty(value = "组织id")
private Long companyId;
}

View File

@ -109,4 +109,7 @@ public class MachineHistoryRecordBean {
private String keyWord;
private Long userId;
@ApiModelProperty(value = "组织id")
private Long companyId;
}

View File

@ -109,4 +109,7 @@ public class OutRecordInfo {
@ApiModelProperty(value = "一级ID集合")
private List<Integer> firstTypeIdList;
@ApiModelProperty(value = "组织id")
private Long companyId;
}

View File

@ -65,4 +65,7 @@ public class PurchaseInputInfo {
private String keyWord;
private String manageType;
@ApiModelProperty(value = "组织id")
private Long companyId;
}

View File

@ -64,4 +64,7 @@ public class RepairInputRecord {
@ApiModelProperty(value = "关键字")
private String keyWord;
@ApiModelProperty(value = "组织id")
private Long companyId;
}

View File

@ -70,4 +70,7 @@ public class RepairStorageInfo {
@ApiModelProperty(value = "维修类型 1 定损 2 在修 3 修试待审核")
private Integer type;
@ApiModelProperty(value = "组织id")
private Long companyId;
}

View File

@ -70,4 +70,7 @@ public class UseStorageInfo {
@ApiModelProperty(value = "关键字")
private String keyWord;
@ApiModelProperty(value = "组织id")
private Long companyId;
}

View File

@ -206,6 +206,9 @@
END = #{statusName}
)
</if>
<if test="companyId!=null">
and sai.company_id = #{companyId}
</if>
ORDER BY
sai.end_time
</select>
@ -260,6 +263,9 @@
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND bs.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
</if>
<if test="companyId!=null">
and bs.company_id = #{companyId}
</if>
order by bs.create_time desc
</select>
@ -335,6 +341,9 @@
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND bs.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
</if>
<if test="companyId!=null">
and bs.company_id = #{companyId}
</if>
order by bs.create_time desc
</select>
@ -405,6 +414,9 @@
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
WHERE mm.ma_code is not null and mm.ma_status in (1)
<if test="companyId !=null">
AND mm.company_id = #{companyId}
</if>
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = mt.type_id
LEFT JOIN (
SELECT
@ -428,6 +440,9 @@
AND (sai.source = 1 OR sai.source is NULL)
AND sai.end_time IS NULL
AND sai.back_id IS NULL
<if test="companyId !=null">
AND sai.company_id = #{companyId}
</if>
GROUP BY mt.type_id
) AS subquery1
ON mt.type_id = subquery1.type_id
@ -452,6 +467,9 @@
WHERE
tt.task_status IN (0, 4)
and tt.code is not null
<if test="companyId !=null">
AND rad.company_id = #{companyId}
</if>
GROUP BY
mt.type_id) AS subquery2 ON subquery2.type_id = mt.type_id
LEFT JOIN (
@ -474,6 +492,9 @@
WHERE
tt.code is not null
and rad.`status` = '0'
<if test="companyId !=null">
AND rad.company_id = #{companyId}
</if>
GROUP BY
mt.type_id) AS subquery12 ON subquery12.type_id = mt.type_id
LEFT JOIN (
@ -496,6 +517,9 @@
LEFT JOIN tm_task tt ON rid.task_id = tt.task_id
WHERE IFNULL(rid.repair_num, 0) - IFNULL(rid.input_num, 0) - IFNULL(rid.reject_num, 0) > 0
and tt.task_status = 0
<if test="companyId !=null">
AND rid.company_id = #{companyId}
</if>
GROUP BY
mt.type_id) AS subquery3 ON subquery3.type_id = mt.type_id
LEFT JOIN (
@ -517,6 +541,9 @@
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
WHERE IFNULL(pcd.check_num, 0) - IFNULL(pcd.input_num, 0) > 0
and pcd.status in (3,4, 13,14)
<if test="companyId !=null">
AND pcd.company_id = #{companyId}
</if>
GROUP BY
mt.type_id) AS subquery4 ON subquery4.type_id = mt.type_id
/*LEFT JOIN (
@ -600,6 +627,9 @@
<if test="jiJuType != null and jiJuType != ''">
AND mt.jiju_type = #{jiJuType}
</if>
<if test="companyId !=null">
and mt.company_id = #{companyId}
</if>
HAVING allNum > 0
order by mt4.type_name, mt3.type_name, mt2.type_name, mt.type_name
</select>
@ -1031,6 +1061,9 @@
<if test="typeId != null">
AND type_id = #{typeId}
</if>
<if test="companyId !=null">
AND company_id = #{companyId}
</if>
GROUP BY
type_id,
ma_id,
@ -1097,6 +1130,9 @@
su.nick_name like concat('%',#{keyWord},'%')
)
</if>
<if test="companyId != null">
AND rad.company_id = #{companyId}
</if>
GROUP BY mm.ma_id,tt.`code`,mt.type_id
</select>
@ -1129,6 +1165,9 @@
<if test="typeId != null">
AND pcd.type_id = #{typeId}
</if>
<if test="companyId!=null">
AND pcd.company_id = #{companyId}
</if>
GROUP BY tt.`code`,
mt.type_id
</select>
@ -1180,6 +1219,9 @@
mm.ma_code like concat('%',#{keyWord},'%')
)
</if>
<if test="companyId != null">
AND rid.company_id = #{companyId}
</if>
GROUP BY mm.ma_id, tt.`code`, mt.type_id
</select>
@ -1697,6 +1739,9 @@
<foreach item="item" collection="list" index="index" separator="," close=")" open="(">
#{item}
</foreach>
<if test="companyId != null">
and lod.company_id= #{companyId}
</if>
GROUP BY lod.parent_id
</select>
@ -1967,6 +2012,9 @@
su.nick_name like concat('%',#{keyWord},'%')
)
</if>
<if test="companyId!=null">
AND rad.company_id = #{companyId}
</if>
GROUP BY mm.ma_id,tt.`code`,mt.type_id
</select>
<select id="getPartInventory" resultType="com.bonus.material.part.domain.PartInventory">