This commit is contained in:
mashuai 2025-08-29 18:33:50 +08:00
parent 9ebd493f87
commit 1eb3a39b1f
8 changed files with 185 additions and 12 deletions

View File

@ -10,6 +10,7 @@ import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.clz.domain.machine.MaterialUseStorageInfo; import com.bonus.material.clz.domain.machine.MaterialUseStorageInfo;
import com.bonus.material.clz.domain.vo.MaterialRetainedTeamTotalVo; import com.bonus.material.clz.domain.vo.MaterialRetainedTeamTotalVo;
import com.bonus.material.clz.domain.vo.MaterialRetainedTeamVo; import com.bonus.material.clz.domain.vo.MaterialRetainedTeamVo;
import com.bonus.material.clz.domain.vo.MaterialTotalMentInfo;
import com.bonus.material.ma.domain.Machine; import com.bonus.material.ma.domain.Machine;
import com.bonus.material.clz.domain.machine.MaterialStorageInfo; import com.bonus.material.clz.domain.machine.MaterialStorageInfo;
import com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo; import com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo;
@ -87,6 +88,33 @@ public class MaterialMachineController extends BaseController {
return AjaxResult.success(dto); return AjaxResult.success(dto);
} }
/**
* 工器具台账
* @param bean
* @return
*/
@ApiOperation(value = "工器具台账查询")
@GetMapping("/getTotalList")
public AjaxResult getTotalList(MaterialRetainedEquipmentInfo bean) {
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
List<MaterialTotalMentInfo> list = materialMachineService.getTotalList(bean);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
}
/**
* 导出工器具台账查询
* @param bean
* @return
*/
@ApiOperation(value = "综合查询--导出工器具台账查询")
@PostMapping("/exportTotalList")
public void exportTotalList(HttpServletResponse response, MaterialRetainedEquipmentInfo bean) {
List<MaterialTotalMentInfo> list = materialMachineService.getTotalList(bean);
ExcelUtil<MaterialTotalMentInfo> util = new ExcelUtil<>(MaterialTotalMentInfo.class);
util.exportExcel(response, list, "综合查询--工器具台账查询");
}
/** /**
* 导出保有设备总量查询 * 导出保有设备总量查询
* @param bean * @param bean

View File

@ -243,4 +243,7 @@ public class MaterialRetainedEquipmentInfo {
private Long agreementId; private Long agreementId;
private Long deptId; private Long deptId;
@ApiModelProperty(value = "项目部名称")
private String proCenter;
} }

View File

@ -0,0 +1,41 @@
package com.bonus.material.clz.domain.vo;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* @description 综合查询--保有设备总量查询
* @author ma_sh
* @date 2024/2/26 14:51
*/
@ApiModel(description = "保有设备总量查询")
@Data
public class MaterialTotalMentInfo {
private static final long serialVersionUID = 2227217051604273598L;
@ApiModelProperty(value = "主键id")
private Integer id;
@ApiModelProperty(value = "仓库信息")
private String whHouseName;
@ApiModelProperty(value = "工程id")
private String proId;
@ApiModelProperty(value = "项目部名称")
@Excel(name = "项目部名称", width = 30)
private String proCenter;
@ApiModelProperty(value = "工程名称")
@Excel(name = "工程名称", width = 80)
private String proName;
@ApiModelProperty(value = "总保有量")
@Excel(name = "总保有量")
private BigDecimal allNum;
}

View File

@ -4,6 +4,7 @@ import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.clz.domain.machine.MaterialUseStorageInfo; import com.bonus.material.clz.domain.machine.MaterialUseStorageInfo;
import com.bonus.material.clz.domain.vo.MaterialRetainedTeamTotalVo; import com.bonus.material.clz.domain.vo.MaterialRetainedTeamTotalVo;
import com.bonus.material.clz.domain.vo.MaterialRetainedTeamVo; import com.bonus.material.clz.domain.vo.MaterialRetainedTeamVo;
import com.bonus.material.clz.domain.vo.MaterialTotalMentInfo;
import com.bonus.material.ma.domain.Machine; import com.bonus.material.ma.domain.Machine;
import com.bonus.material.clz.domain.machine.MaterialStorageInfo; import com.bonus.material.clz.domain.machine.MaterialStorageInfo;
import com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo; import com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo;
@ -120,4 +121,11 @@ public interface MaterialMachineService {
* @return * @return
*/ */
AjaxResult getAgreementId(MaterialRetainedEquipmentInfo bean); AjaxResult getAgreementId(MaterialRetainedEquipmentInfo bean);
/**
* 工器具台账查询
* @param bean
* @return
*/
List<MaterialTotalMentInfo> getTotalList(MaterialRetainedEquipmentInfo bean);
} }

View File

@ -174,9 +174,9 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
recordList = recordList.stream() recordList = recordList.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard())) .filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} else { } /*else {
recordList = filterInfo(recordList, username); recordList = filterInfo(recordList, username);
} }*/
} }
if (CollectionUtils.isNotEmpty(recordList)) { if (CollectionUtils.isNotEmpty(recordList)) {
for (MaterialRetainedEquipmentInfo retainedEquipmentInfo : recordList) { for (MaterialRetainedEquipmentInfo retainedEquipmentInfo : recordList) {
@ -743,6 +743,89 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
return AjaxResult.success(agreementIdList); return AjaxResult.success(agreementIdList);
} }
/**
* 工器具台账查询
* @param bean
* @return
*/
@Override
public List<MaterialTotalMentInfo> getTotalList(MaterialRetainedEquipmentInfo bean) {
String username = SecurityUtils.getLoginUser().getUsername();
// 根据用户名判断用户是否为班组长
BmTeam teamData = materialMachineMapper.getTeamData(username);
if (teamData == null) {
// 根据用户名查询项目部信息
String departId = mapper.getDepartId(username);
// 根据项目部id查询工程信息
List<String> projectIdList = mapper.getProjectId(departId);
if (!org.springframework.util.CollectionUtils.isEmpty(projectIdList)) {
bean.setProjectIdList(projectIdList);
}
}
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
if (deptId != null) {
bean.setImpUnit(deptId.toString());
}
List<MaterialRetainedEquipmentInfo> recordList = materialMachineMapper.getRetainedEquipmentList(bean);
if (!CollectionUtils.isEmpty(recordList)) {
if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理
recordList = recordList.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
.collect(Collectors.toList());
}
}
List<MaterialTotalMentInfo> groupedList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(recordList)) {
// 用于分组的Map键为包含proCenter和proId的组合对象值为分组后的汇总信息
Map<String, MaterialTotalMentInfo> groupMap = new HashMap<>();
for (MaterialRetainedEquipmentInfo record : recordList) {
// 构建唯一的分组键将proCenter和proId拼接确保相同组合的键一致
String groupKey = record.getProCenter() + "_" + record.getProId();
// 检查Map中是否已存在该分组
if (groupMap.containsKey(groupKey)) {
// 已存在则累加allNum
MaterialTotalMentInfo existingRecord = groupMap.get(groupKey);
existingRecord.setAllNum(existingRecord.getAllNum().add(record.getAllNum()));
} else {
// 不存在则新增分组注意如果需要保留原始对象其他字段建议创建新对象避免修改原数据
MaterialTotalMentInfo newRecord = new MaterialTotalMentInfo();
newRecord.setProCenter(record.getProCenter());
newRecord.setProId(record.getProId());
newRecord.setProName(record.getProName());
newRecord.setAllNum(record.getAllNum());
// 如需保留其他字段在这里继续设置
groupMap.put(groupKey, newRecord);
}
}
// 分组后的结果集合可根据需要转换为List
groupedList = new ArrayList<>(groupMap.values());
// 如果关键字不为空进行过滤
if (CollectionUtils.isNotEmpty(groupedList)) {
if (StringUtils.isNotBlank(bean.getKeyWord())) {
groupedList = groupedList.stream()
.filter(item -> containsTotalKeyword(item, bean.getKeyWord()))
.collect(Collectors.toList());
}
}
}
return groupedList;
}
/**
* 工器具台账关键字查询
* @param item
* @param keyWord
* @return
*/
private boolean containsTotalKeyword(MaterialTotalMentInfo item, String keyWord) {
return (item.getProCenter() != null && item.getProCenter().contains(keyWord)) ||
(item.getProName() != null && item.getProName().contains(keyWord));
}
/** /**
* 在用设备模糊匹配 * 在用设备模糊匹配
* @param item * @param item

View File

@ -119,7 +119,7 @@ public class PurchaseBindController extends BaseController {
*/ */
@ApiOperation(value = "二维码生成下载") @ApiOperation(value = "二维码生成下载")
@PostMapping(value = "/downloadQrCode") @PostMapping(value = "/downloadQrCode")
@PreventRepeatSubmit //@PreventRepeatSubmit
//@RequiresPermissions("purchase:bind:download") //@RequiresPermissions("purchase:bind:download")
public void downloadQrCode(HttpServletResponse response, PurchaseDto purchaseDto) { public void downloadQrCode(HttpServletResponse response, PurchaseDto purchaseDto) {
purchaseBindService.downloadQrCode(response, purchaseDto); purchaseBindService.downloadQrCode(response, purchaseDto);

View File

@ -35,7 +35,7 @@ public class PurchaseMacodeInfoController extends BaseController {
* 查询新购验收编号管理列表 * 查询新购验收编号管理列表
*/ */
@ApiOperation(value = "查询新购验收编号管理列表") @ApiOperation(value = "查询新购验收编号管理列表")
@RequiresPermissions("purchase:info:list") //@RequiresPermissions("purchase:info:list")
@GetMapping("/list") @GetMapping("/list")
public AjaxResult list(PurchaseMacodeInfo purchaseMacodeInfo) { public AjaxResult list(PurchaseMacodeInfo purchaseMacodeInfo) {
// startPage(); // startPage();
@ -48,7 +48,7 @@ public class PurchaseMacodeInfoController extends BaseController {
*/ */
@ApiOperation(value = "导出新购验收编号管理列表") @ApiOperation(value = "导出新购验收编号管理列表")
@PreventRepeatSubmit @PreventRepeatSubmit
@RequiresPermissions("purchase:info:export") //@RequiresPermissions("purchase:info:export")
@SysLog(title = "新购验收编号管理", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出新购验收编号管理") @SysLog(title = "新购验收编号管理", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出新购验收编号管理")
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, PurchaseMacodeInfo purchaseMacodeInfo) { public void export(HttpServletResponse response, PurchaseMacodeInfo purchaseMacodeInfo) {
@ -61,7 +61,7 @@ public class PurchaseMacodeInfoController extends BaseController {
* 获取新购验收编号管理详细信息 * 获取新购验收编号管理详细信息
*/ */
@ApiOperation(value = "获取新购验收编号管理详细信息") @ApiOperation(value = "获取新购验收编号管理详细信息")
@RequiresPermissions("purchase:info:query") //@RequiresPermissions("purchase:info:query")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) { public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(purchaseMacodeInfoService.selectPurchaseMacodeInfoById(id)); return success(purchaseMacodeInfoService.selectPurchaseMacodeInfoById(id));
@ -72,7 +72,7 @@ public class PurchaseMacodeInfoController extends BaseController {
*/ */
@ApiOperation(value = "新增新购验收编号管理") @ApiOperation(value = "新增新购验收编号管理")
@PreventRepeatSubmit @PreventRepeatSubmit
@RequiresPermissions("purchase:info:add") //@RequiresPermissions("purchase:info:add")
@SysLog(title = "新购验收编号管理", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增新购验收编号管理") @SysLog(title = "新购验收编号管理", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增新购验收编号管理")
@PostMapping @PostMapping
public AjaxResult add(@RequestBody PurchaseMacodeInfo purchaseMacodeInfo) { public AjaxResult add(@RequestBody PurchaseMacodeInfo purchaseMacodeInfo) {
@ -88,7 +88,7 @@ public class PurchaseMacodeInfoController extends BaseController {
*/ */
@ApiOperation(value = "修改新购验收编号管理") @ApiOperation(value = "修改新购验收编号管理")
@PreventRepeatSubmit @PreventRepeatSubmit
@RequiresPermissions("purchase:info:edit") //@RequiresPermissions("purchase:info:edit")
@SysLog(title = "新购验收编号管理", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改新购验收编号管理") @SysLog(title = "新购验收编号管理", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改新购验收编号管理")
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody PurchaseMacodeInfo purchaseMacodeInfo) { public AjaxResult edit(@RequestBody PurchaseMacodeInfo purchaseMacodeInfo) {

View File

@ -76,7 +76,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
'编码' '编码'
ELSE ELSE
'数量' '数量'
END manageType END manageType,
subquery1.proCenter AS proCenter
FROM ma_type mt FROM ma_type mt
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
@ -93,7 +94,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bp.pro_id as proId, bp.pro_id as proId,
bp.external_id as externalId, bp.external_id as externalId,
bp.imp_unit AS impUnit, bp.imp_unit AS impUnit,
bu.bzz_idcard AS idCard bu.bzz_idcard AS idCard,
bp.pro_center AS proCenter
FROM FROM
slt_agreement_info sai slt_agreement_info sai
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
@ -126,7 +128,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bp.pro_id as proId, bp.pro_id as proId,
bp.external_id as externalId, bp.external_id as externalId,
bp.imp_unit AS impUnit, bp.imp_unit AS impUnit,
bu.bzz_idcard AS idCard bu.bzz_idcard AS idCard,
bp.pro_center AS proCenter
FROM FROM
clz_slt_agreement_info sai clz_slt_agreement_info sai
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
@ -157,6 +160,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and mt2.parent_id = #{typeId} and mt2.parent_id = #{typeId}
</if> </if>
</if> </if>
<if test="proId != null">
and subquery1.proId = #{proId}
</if>
<if test="proCenter != null and proCenter != ''">
and subquery1.proCenter like concat('%',#{proCenter},'%')
</if>
<if test="keyWord != null and keyWord != ''"> <if test="keyWord != null and keyWord != ''">
and ( and (
mt4.type_name like concat('%',#{keyWord},'%') or mt4.type_name like concat('%',#{keyWord},'%') or
@ -183,7 +192,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if> </if>
GROUP BY GROUP BY
mt.type_id, mt.type_id,
subquery1.proId subquery1.proId,
subquery1.proCenter
</select> </select>
<select id="getMaCodeList" <select id="getMaCodeList"