This commit is contained in:
mashuai 2025-10-27 14:27:13 +08:00
parent 712142380a
commit 34e155d2cc
15 changed files with 240 additions and 43 deletions

View File

@ -249,7 +249,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
public List<MaterialLeaseApplyInfo> getTotalList(MaterialLeaseApplyInfo leaseApplyInfo) {
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
String username = SecurityUtils.getLoginUser().getUsername();
BmTeam teamData = new BmTeam();
BmTeam teamData = null;
// 检查用户是否具有特殊角色
boolean hasSpecialRole = hasSpecialRole(userRoles);
if (!hasSpecialRole) {
@ -439,7 +439,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
public List<MaterialLeaseApplyDetailExport> getTotalDetailsList(MaterialLeaseApplyInfo bean) {
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
String username = SecurityUtils.getLoginUser().getUsername();
BmTeam teamData = new BmTeam();
BmTeam teamData = null;
// 检查用户是否具有特殊角色
boolean hasSpecialRole = hasSpecialRole(userRoles);
if (!hasSpecialRole) {

View File

@ -52,7 +52,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
public List<Machine> getMachineInfo(Machine machine) {
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
String username = SecurityUtils.getLoginUser().getUsername();
BmTeam teamData = new BmTeam();
BmTeam teamData = null;
// 检查用户是否具有特殊角色
boolean hasSpecialRole = hasSpecialRole(userRoles);
if (!hasSpecialRole) {
@ -645,7 +645,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
}*/
String username = SecurityUtils.getLoginUser().getUsername();
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
BmTeam teamData = new BmTeam();
BmTeam teamData = null;
// 检查用户是否具有特殊角色
boolean hasSpecialRole = hasSpecialRole(userRoles);
if (!hasSpecialRole) {
@ -690,7 +690,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
public List<MaterialRetainedTeamTotalVo> getTeamNumList(MaterialRetainedEquipmentInfo bean) {
String username = SecurityUtils.getLoginUser().getUsername();
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
BmTeam teamData = new BmTeam();
BmTeam teamData = null;
// 检查用户是否具有特殊角色
boolean hasSpecialRole = hasSpecialRole(userRoles);
if (!hasSpecialRole) {
@ -772,7 +772,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
public SafeMaterialEquipmentInfo getSafeNumList(MaterialRetainedEquipmentInfo bean) {
String username = SecurityUtils.getLoginUser().getUsername();
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
BmTeam teamData = new BmTeam();
BmTeam teamData = null;
// 检查用户是否具有特殊角色
boolean hasSpecialRole = hasSpecialRole(userRoles);
if (!hasSpecialRole) {

View File

@ -193,7 +193,7 @@ public interface LeaseTaskMapper {
* 根据code查询领用申请详情
* @return
*/
LeasePublishDetails selectPublishDetailsByCode();
LeasePublishDetails selectPublishDetailsByCode(@Param("year") String year, @Param("month") String month);
TmTaskAgreement getAgreementInfo(LeaseApplyInfo leaseApplyInfo);

View File

@ -790,7 +790,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
list.addAll(leaseApplyOutList);
}
for (LeaseApplyInfo applyInfo : list) {
if (applyInfo.getTaskStatus() != null && applyInfo.getTaskStatus() == 1) {
if (applyInfo.getTaskStatus() != null && (applyInfo.getTaskStatus() == 1 || applyInfo.getTaskStatus() == 4)) {
continue;
}
if (applyInfo.getPreCountNum().compareTo(applyInfo.getAlNum()) == 0) {
@ -1323,7 +1323,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
leaseApplyRequestVo.getLeaseApplyInfo().setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
try {
int thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId());
LeasePublishDetails publishDetails = mapper.selectPublishDetailsByCode();
LeasePublishDetails publishDetails = mapper.selectPublishDetailsByCode(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth());
if (publishDetails != null && StringUtils.isNotBlank(publishDetails.getCode())) {
String code = publishDetails.getCode();
if (code.contains("-")) {

View File

@ -1090,7 +1090,7 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
Long parentId = leaseApplyDetailsList.get(0).getParentId();
int thisMonthMaxOrder = mapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth());
int monthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId());
LeasePublishDetails publishDetails = mapper.selectPublishDetailsByCode();
LeasePublishDetails publishDetails = mapper.selectPublishDetailsByCode(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth());
if (publishDetails != null && StringUtils.isNotBlank(publishDetails.getCode())) {
String code = publishDetails.getCode();
if (code.contains("-")) {

View File

@ -1,24 +1,22 @@
package com.bonus.material.ma.controller;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.*;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
import com.bonus.common.log.enums.OperaType;
import com.bonus.material.basic.domain.BmQrcodeInfo;
import com.bonus.material.codeCollection.domain.WsMaInfo;
import com.bonus.material.common.annotation.PreventRepeatSubmit;
import com.bonus.material.ma.domain.MachineSynch;
import com.bonus.material.ma.domain.Type;
import com.bonus.material.ma.domain.vo.MachineExportVo;
import com.bonus.material.ma.domain.vo.MachineVo;
import com.bonus.material.ma.domain.vo.SampleSync;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
@ -87,14 +85,21 @@ public class MachineController extends BaseController {
* 导出机具设备管理列表
*/
@ApiOperation(value = "导出机具设备管理列表")
@PreventRepeatSubmit
@RequiresPermissions("ma:machine:export")
//@PreventRepeatSubmit
//@RequiresPermissions("ma:machine:export")
@SysLog(title = "机具设备管理", businessType = OperaType.EXPORT, logType = 1, module = "仓储管理->导出机具设备管理")
@PostMapping("/export")
public void export(HttpServletResponse response, Machine machine) {
List<MachineVo> list = machineService.selectMachineList(machine);
ExcelUtil<MachineVo> util = new ExcelUtil<MachineVo>(MachineVo.class);
util.exportExcel(response, list, "机具设备管理数据");
List<MachineExportVo> exportVos = list.stream()
.map(machineVo -> {
MachineExportVo exportVo = new MachineExportVo();
BeanUtils.copyProperties(machineVo, exportVo); // 自动拷贝同名属性
return exportVo;
})
.collect(Collectors.toList());
ExcelUtil<MachineExportVo> util = new ExcelUtil<>(MachineExportVo.class);
util.exportExcel(response, exportVos, "机具设备管理数据");
}
/**

View File

@ -84,13 +84,12 @@ public class TypeController extends BaseController {
@PostMapping("/export")
public void export(HttpServletResponse response, MaTypeVo maTypeVo) {
List<Integer> parentIds = typeService.selectParentId(maTypeVo);
List<MaTypeVo> maTypeVos = new ArrayList<>();
ExcelUtil<MaTypeVo> util = new ExcelUtil<>(MaTypeVo.class);
for (Integer parentId : parentIds) {
/*for (Integer parentId : parentIds) {
maTypeVos.addAll(typeService.getListByParentId(parentId.longValue(), maTypeVo));
}
}*/
// 采用集合查询的方式不采用循环
List<MaTypeVo> maTypeVos = typeService.getListByParentIds(parentIds, maTypeVo);
if (BooleanUtils.isTrue(maTypeVo.getDisplayBindRelationship())) {
Long userId = maTypeVo.getNewUserId();
List<MaTypeVo> finalMaTypeVos = typeService.getMyTypeAndBindUsers(maTypeVos,userId);
@ -117,12 +116,13 @@ public class TypeController extends BaseController {
return AjaxResult.success(new ArrayList<>());
}
List<MaTypeVo> maTypeVos = new ArrayList<>();
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
for (Integer parentId : parentIds) {
/*for (Integer parentId : parentIds) {
maTypeVos.addAll(typeService.getListByParentId(parentId.longValue(), maTypeVo));
}
}*/
// 采用集合查询的方式不采用循环
List<MaTypeVo> maTypeVos = typeService.getListByParentIds(parentIds, maTypeVo);
if (BooleanUtils.isTrue(maTypeVo.getDisplayBindRelationship())) {
Long userId = maTypeVo.getUserId();
List<MaTypeVo> finalMaTypeVos = typeService.getMyTypeAndBindUsers(maTypeVos,userId);

View File

@ -13,6 +13,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
/**
* 物资类型对象 ma_type
@ -45,7 +46,7 @@ public class Type extends BaseEntity {
/** 库管员昵称 */
@ApiModelProperty(value = "库管员昵称")
@Excel(name = "库管员昵称",sort = 7)
@Excel(name = "库管员",sort = 7)
private String keeperNickName;
/** 库管员昵称 */
@ -58,7 +59,7 @@ public class Type extends BaseEntity {
/** 维修员昵称 */
@ApiModelProperty(value = "维修员昵称")
@Excel(name = "维修员昵称",sort = 9)
@Excel(name = "维修员",sort = 9)
private String repairNickName;
/** 维修员昵称 */
@ -78,7 +79,7 @@ public class Type extends BaseEntity {
private Long parentId;
/** 实时库存 */
@Excel(name = "实时库存",sort = 11)
@Excel(name = "实时库存",sort = 11, cellType = Excel.ColumnType.NUMERIC, align = HorizontalAlignment.RIGHT)
@ApiModelProperty(value = "实时库存")
private BigDecimal storageNum;
/** 实时库存 */
@ -115,7 +116,7 @@ public class Type extends BaseEntity {
/** 计量单位名称值0整型1小数 */
@ApiModelProperty(value = "计量单位名称0整型1小数")
@Excel(name = "计量单位0整型1小数",sort = 13)
//@Excel(name = "计量单位0整型1小数",sort = 13)
private String unitValue;
/** 排序 */
@ -126,12 +127,12 @@ public class Type extends BaseEntity {
private transient int maxSortPriority;
/** 管理方式(0编号 1计数) */
@Excel(name = "管理方式(0编码 1数量)",readConverterExp = "0=编码,1=数量")
@Excel(name = "管理方式",readConverterExp = "0=编码,1=数量")
@ApiModelProperty(value = "管理方式(0编号 1计数)")
private String manageType;
/** 内部租赁单价 */
@Excel(name = "内部租赁单价",sort = 16)
@Excel(name = "内部租赁单价",sort = 16, cellType = Excel.ColumnType.NUMERIC, align = HorizontalAlignment.RIGHT)
@ApiModelProperty(value = "内部租赁单价")
private BigDecimal leasePrice;
@ -141,21 +142,21 @@ public class Type extends BaseEntity {
/** 租赁费用生效时间 */
@ApiModelProperty(value = "租赁费用生效时间")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "租赁费用生效时间", width = 30, dateFormat = "yyyy-MM-dd",sort = 17)
//@Excel(name = "租赁费用生效时间", width = 30, dateFormat = "yyyy-MM-dd",sort = 17)
private Date effTime;
/** 外部租赁单价 */
@Excel(name = "外部租赁单价",sort = 18)
@Excel(name = "外部租赁单价",sort = 18, cellType = Excel.ColumnType.NUMERIC, align = HorizontalAlignment.RIGHT)
@ApiModelProperty(value = "外部租赁单价")
private BigDecimal rentPrice;
/** 采购价原值 */
@Excel(name = "采购价原值",sort = 19)
@Excel(name = "采购价原值",sort = 19, cellType = Excel.ColumnType.NUMERIC, align = HorizontalAlignment.RIGHT)
@ApiModelProperty(value = "采购价原值")
private BigDecimal buyPrice;
/** 丢失赔偿比率 */
@Excel(name = "丢失赔偿比率",sort = 20)
//@Excel(name = "丢失赔偿比率",sort = 20)
@ApiModelProperty(value = "丢失赔偿比率")
private BigDecimal payRatio;
@ -175,19 +176,19 @@ public class Type extends BaseEntity {
private String level;
/** 额定载荷 */
@Excel(name = "额定载荷",sort = 21)
@Excel(name = "额定载荷",sort = 21, cellType = Excel.ColumnType.NUMERIC, align = HorizontalAlignment.RIGHT)
@ApiModelProperty(value = "额定载荷")
private String ratedLoad;
/** 试验载荷 */
@Excel(name = "试验载荷",sort = 22)
@Excel(name = "试验载荷",sort = 22, cellType = Excel.ColumnType.NUMERIC, align = HorizontalAlignment.RIGHT)
@ApiModelProperty(value = "试验载荷")
private String testLoad;
/** 持荷时间 */
@ApiModelProperty(value = "持荷时间")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "持荷时间", width = 30, dateFormat = "yyyy-MM-dd",sort = 23)
@Excel(name = "持荷时间", width = 30,sort = 23, cellType = Excel.ColumnType.NUMERIC, align = HorizontalAlignment.RIGHT)
private String holdingTime;
/** 库存预警数量 */
@ -204,7 +205,7 @@ public class Type extends BaseEntity {
private String isAncuo;
/** 厂家规格型号 */
@Excel(name = "厂家规格型号",sort = 27)
//@Excel(name = "厂家规格型号",sort = 27)
@ApiModelProperty(value = "厂家规格型号")
private String facModel;

View File

@ -0,0 +1,71 @@
package com.bonus.material.ma.domain.vo;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 设备导出返回vo
* @Author ma_sh
* @create 2024/10/17 13:25
*/
@Data
public class MachineExportVo {
@ApiModelProperty("物品类型-一级")
private String itemType;
@ApiModelProperty("物品种类-二级")
@Excel(name = "物品类型")
private String materialType;
@ApiModelProperty("设备类型-三级")
@Excel(name = "设备类型")
private String materialName;
@ApiModelProperty("规格型号-四级")
@Excel(name = "规格型号")
private String materialModel;
@Excel(name = "设备编号")
@ApiModelProperty(value = "设备编号")
private String maCode;
@ApiModelProperty("状态名称")
@Excel(name = "设备状态")
private String statusName;
@Excel(name = "固定资产编号")
@ApiModelProperty(value = "固定资产编号")
private String assetsCode;
@Excel(name = "购置批次")
@ApiModelProperty(value = "购置批次")
private String buyTask;
@Excel(name = "二维码")
@ApiModelProperty(value = "二维码")
private String qrCode;
@ApiModelProperty("库管员id")
private String keeperId;
@ApiModelProperty("库管员名称")
private String keeperName;
@ApiModelProperty("维修员id")
private String repairId;
@ApiModelProperty("维修员名称")
private String repairName;
@ApiModelProperty("资产属性名称")
private String assetName;
@ApiModelProperty("机具类型1机具2安全工器具")
private int jiJuType;
@ApiModelProperty(value = "是否检验0不检验1检验")
private String isCheck;
}

View File

@ -256,4 +256,12 @@ public interface TypeMapper {
BigDecimal getMaCodeNum(Type type);
void insertBmStorageNumLog(Type type);
/**
* 根据父级ID查询
* @param parentIds
* @param maTypeVo
* @return
*/
List<MaTypeVo> getListByParentIds(@Param("list") List<Integer> parentIds, @Param("type") MaTypeVo maTypeVo);
}

View File

@ -1,5 +1,6 @@
package com.bonus.material.ma.service;
import java.util.Collection;
import java.util.List;
import com.bonus.common.biz.domain.TreeSelect;
@ -153,4 +154,12 @@ public interface ITypeService {
* @return
*/
int updateNumAddOrSubtract(Type type);
/**
* 根据父级id查询所有子级
* @param parentIds
* @param maTypeVo
* @return
*/
List<MaTypeVo> getListByParentIds(List<Integer> parentIds, MaTypeVo maTypeVo);
}

View File

@ -309,6 +309,17 @@ public class TypeServiceImpl implements ITypeService {
}
}
/**
* 根据parent_id查询结果
* @param parentIds
* @param maTypeVo
* @return
*/
@Override
public List<MaTypeVo> getListByParentIds(List<Integer> parentIds, MaTypeVo maTypeVo) {
return typeMapper.getListByParentIds(parentIds, maTypeVo);
}
@Override
public List<MaTypeSelectVo> selectMaTypeListByHouseId(Long houseId) {

View File

@ -54,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bai.unit_id,bai.project_id,bu.unit_name, bp.pro_name, bai.agreement_code, tt.task_status as taskStatus,
sda.dict_label as taskStatusName,
IFNULL(sum(lad.pre_num),0) as preCountNum,
IFNULL(sum(lad.al_num),0) as alNum,
IFNULL(sum(lod.num),0) as alNum,
GROUP_CONCAT(DISTINCT mt1.type_name) as maTypeNames,
bp.contract_part as contractPart,
sd.dept_name as impUnitName,
@ -67,6 +67,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
lease_apply_info lai
left join tm_task tt on lai.task_id = tt.task_id
left join lease_apply_details lad on lai.id = lad.parent_id
LEFT JOIN (SELECT parent_id,type_id ,IFNULL( sum( out_num ), 0 ) as num FROM lease_out_details
GROUP BY parent_id,type_id) lod ON lai.id = lod.parent_id and lad.type_id = lod.type_id
left join tm_task_agreement tta on lai.task_id = tta.task_id
left join bm_agreement_info bai on tta.agreement_id = bai.agreement_id
left join bm_unit bu on bu.unit_id = bai.unit_id

View File

@ -1080,6 +1080,8 @@
type_id as typeId,
code as code
FROM lease_publish_details
WHERE
month(create_time) = #{month} and year(create_time) = #{year}
order by create_time desc
LIMIT 1
</select>

View File

@ -1216,4 +1216,92 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = mt.type_id
WHERE mt.del_flag = '0' and mt.type_id = #{typeId}
</select>
<select id="getListByParentIds" resultType="com.bonus.material.ma.domain.vo.MaTypeVo">
SELECT
m3.type_name AS itemType,
m2.type_name AS materialType,
m1.type_name AS materialName,
m.type_id AS typeId,
CASE m.manage_type
WHEN 0 THEN
IFNULL(subquery0.num, 0)
ELSE
IFNULL(m.storage_num, 0)
END AS storageNum,
m.type_name AS typeName,
m.parent_id as parentId,
m.manage_type as manageType,
m.unit_name as unitName,
m.lease_price as leasePrice,
m.rent_price as rentPrice,
m.eff_time as effTime,
m.buy_price as buyPrice,
m.LEVEL as level,
m.rated_load as ratedLoad,
m.test_load as testLoad,
m.holding_time as holdingTime,
m.remark as remark,
m.fac_model AS facModel,
mtk.keeperNickName AS keeperNickName,
mtr.repairNickName AS repairNickName
FROM ma_type m
LEFT JOIN ma_type m1 ON m.parent_id = m1.type_id AND m1.del_flag = '0'
LEFT JOIN ma_type m2 ON m1.parent_id = m2.type_id AND m2.del_flag = '0'
LEFT JOIN ma_type m3 ON m2.parent_id = m3.type_id AND m3.del_flag = '0'
LEFT JOIN (
SELECT
mt.type_id,
mt4.type_name AS constructionType,
mt4.type_id AS firstTypeId,
mt3.type_name AS materialType,
mt3.type_id AS secondTypeId,
mt2.type_name AS typeName,
mt2.type_id AS thirdTypeId,
mt.type_name AS typeModelName,
count(mm.ma_id) AS num
FROM ma_machine mm
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
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)
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = m.type_id
LEFT JOIN (
SELECT
type_id,
GROUP_CONCAT(DISTINCT su.nick_name) AS keeperNickName
FROM ma_type_keeper mtk
LEFT JOIN sys_user su ON mtk.user_id = su.user_id
GROUP BY type_id
) AS mtk ON m.type_id = mtk.type_id
LEFT JOIN (
SELECT
type_id,
GROUP_CONCAT(DISTINCT su2.nick_name) AS repairNickName
FROM ma_type_repair mtr
LEFT JOIN sys_user su2 ON mtr.user_id = su2.user_id
GROUP BY type_id
) AS mtr ON m.type_id = mtr.type_id
WHERE m.del_flag = '0' and
m.parent_id in
<foreach item="id" collection="list" open="(" separator="," close=")">
#{id}
</foreach>
<if test="type.keyword != null and type.keyword !=''">
AND (m.type_name like concat('%',#{type.keyword},'%')
or m1.type_name like concat('%',#{type.keyword},'%')
or m2.type_name like concat('%',#{type.keyword},'%')
or m3.type_name like concat('%',#{type.keyword},'%')
)
</if>
GROUP BY m.type_id
ORDER BY
m.sort_num ASC,
CASE
WHEN m.update_time > m.create_time THEN
m.update_time ELSE m.create_time
END DESC,
m.create_time DESC
</select>
</mapper>