申请发布

This commit is contained in:
mashuai 2025-03-04 15:41:14 +08:00
parent 50b26aefe7
commit fc6916a2da
7 changed files with 528 additions and 1 deletions

View File

@ -0,0 +1,268 @@
package com.bonus.common.biz.domain.lease;
import com.bonus.common.biz.domain.BmFileInfo;
import com.bonus.common.core.annotation.Excel;
import com.bonus.common.core.web.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* 领料任务对象 lease_apply_info
*
* @author xsheng
* @date 2024-10-16
*/
@EqualsAndHashCode(callSuper = false)
@Data
@ToString
public class LeasePublishInfo extends BaseEntity{
private static final long serialVersionUID = 1L;
/** ID */
private Long id;
@ApiModelProperty(value = "登录用户id")
private Long userId;
@ApiModelProperty(value = "申请时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "申请时间", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@Excel(name = "申请人")
@ApiModelProperty(value = "申请人")
private String createBy;
@ApiModelProperty(value = "实施单位")
@Excel(name = "实施单位")
private String impUnitName;
@ApiModelProperty(value = "合同主体")
private String contractPart;
@ApiModelProperty(value = "领料单位")
@Excel(name = "申请项目部")
private String leaseUnit;
@ApiModelProperty(value = "发料单位")
private String sendUnit;
@ApiModelProperty(value = "领料id")
private Integer leaseUnitId;
@ApiModelProperty(value = "租赁工程")
@Excel(name = "申请工程")
private String leaseProject;
@ApiModelProperty(value = "领料工程id")
private Integer leaseProjectId;
@ApiModelProperty(value = "领料人签名URL")
private String leaseSignUrl;
@ApiModelProperty(value = "领料人签名类型")
private Byte leaseSignType;
/**
* 领料物资名称汇总
*/
@ApiModelProperty(value = "领料物资名称汇总")
@Excel(name = "领料物资类型")
private String maTypeNames;
@ApiModelProperty(value = "协议号")
private String agreementCode;
/** 任务编号: 领料单号 */
@ApiModelProperty(value = "业务联系单号")
@Excel(name = "业务联系单号")
private String code;
/** 任务ID */
@ApiModelProperty(value = "任务ID")
private Long taskId;
/** 领料人 */
@Excel(name = "领料人")
@ApiModelProperty(value = "领料人")
private String leasePerson;
@ApiModelProperty(value = "联系方式")
@Excel(name = "领料人电话")
private String phone;
/** 11级审批22级审批 */
@ApiModelProperty(value = "11级审批22级审批")
private String type;
/** 公司审批人 */
@ApiModelProperty(value = "公司审批人")
private Long companyAuditBy;
/** 公司审批时间 */
@ApiModelProperty(value = "公司审批时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date companyAuditTime;
/** 公司审批备注 */
@ApiModelProperty(value = "公司审批备注")
private String companyAuditRemark;
/** 分管审批人 */
@ApiModelProperty(value = "分管审批人")
private Long deptAuditBy;
/** 分管审批时间 */
@ApiModelProperty(value = "分管审批时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date deptAuditTime;
/** 分管审批备注 */
@ApiModelProperty(value = "分管审批备注")
private String deptAuditRemark;
/** 机具分公司审批 */
@ApiModelProperty(value = "机具分公司审批")
private Long directAuditBy;
/** 机具分公司审批时间 */
@ApiModelProperty(value = "机具分公司审批时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date directAuditTime;
/** 机具分公司审批备注 */
@ApiModelProperty(value = "机具分公司审批备注")
private String directAuditRemark;
/** 数据所属组织 */
@ApiModelProperty(value = "数据所属组织")
private Long companyId;
/** 1机具分公司审核通过2调试分公司审核通过3机具分公司审核驳回4调试分公司审核驳回5出库进行中5出库完成 */
// @Excel(name = "1机具分公司审核通过2调试分公司审核通过3机具分公司审核驳回4调试分公司审核驳回5出库进行中5出库完成")
// @ApiModelProperty(value = "1机具分公司审核通过2调试分公司审核通过3机具分公司审核驳回4调试分公司审核驳回5出库进行中5出库完成")
// private String status;
/** $column.columnComment */
private Long directId;
/** 0工程1长期 */
@ApiModelProperty(value = "0工程1长期")
private String leaseType;
/** 预领料时间 */
@ApiModelProperty(value = "预领料时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date estimateLeaseTime;
/** 费用承担方(01项目03分包) */
@ApiModelProperty(value = "费用承担方(01项目03分包)")
private String costBearingParty;
@ApiModelProperty(value = "协议id")
private Long agreementId;
/** 任务类型(定义数据字典) */
@ApiModelProperty(value = "任务类型(定义数据字典)")
private Integer taskType;
/** 任务状态(定义数据字典) */
@ApiModelProperty(value = "任务状态(定义数据字典)")
private Integer taskStatus;
@Excel(name = "状态")
@ApiModelProperty(value = "任务状态(定义数据字典)")
private String taskStatusName;
@ApiModelProperty(value = "任务当月序号 例如:1 插入及查询时请携带任务类型")
private Integer monthOrder;
@ApiModelProperty(value = "领料人手机号")
private String leasePhone;
@ApiModelProperty(value = "往来单位id")
private Long unitId;
@ApiModelProperty(value = "往来单位")
private String unitName;
@ApiModelProperty(value = "工程id")
private Long projectId;
/**
* 工程名称
*/
@ApiModelProperty(value = "工程名称")
private String projectName;
/**
* 预领料合计数
*/
@ApiModelProperty(value = "预领料合计数")
private BigDecimal preCountNum;
@ApiModelProperty(value = "已出库数量")
private BigDecimal alNum;
@ApiModelProperty(value = "开始时间")
private String startTime;
@ApiModelProperty(value = "结束时间")
private String endTime;
@ApiModelProperty(value = "关键字")
private String keyWord;
@ApiModelProperty(value = "备注")
@Excel(name = "备注")
private String remark;
@ApiModelProperty(value = "任务状态列表")
private List<Integer> statusList;
@ApiModelProperty(value = "审批人人签名URL")
private String directAuditSignUrl;
/**
* 分包商单位委托书
*/
@ApiModelProperty(value = "分包商单位委托书")
List<BmFileInfo> bmFileInfos;
/**
* 标准配置id
*/
@ApiModelProperty(value = "标准配置id")
private Long configId;
/**
* 是否为领用申请
*/
@ApiModelProperty(value = "是否为领用申请")
private Integer isLease;
@ApiModelProperty(value = "采购申请编号")
private String applyCode;
private Integer isApp;
@ApiModelProperty(value = "供应时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date supplierTime;
@ApiModelProperty(value = "供应地点")
private String supplierPlace;
@ApiModelProperty(value = "公司名称")
private String companyName;
}

View File

@ -3,6 +3,7 @@ package com.bonus.material.lease.controller;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import com.bonus.common.biz.config.ListPagingUtil; import com.bonus.common.biz.config.ListPagingUtil;
import com.bonus.common.biz.domain.lease.LeaseApplyInfo; import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
import com.bonus.common.biz.domain.lease.LeasePublishInfo;
import com.bonus.common.core.utils.ServletUtils; import com.bonus.common.core.utils.ServletUtils;
import com.bonus.common.core.utils.poi.ExcelUtil; import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.controller.BaseController;
@ -106,6 +107,57 @@ public class LeaseTaskController extends BaseController {
} }
} }
/**
* 领用发布查询
* @param leaseApplyInfo
* @return
*/
@ApiOperation(value = "领用发布查询")
@GetMapping("/getPublishList")
public AjaxResult getPublishList(LeaseApplyInfo leaseApplyInfo) {
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
try {
List<LeasePublishInfo> list = service.getPublishList(leaseApplyInfo);
if (leaseApplyInfo.getIsApp()==null){
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
}else {
return AjaxResult.success(list);
}
} catch (Exception e) {
if (leaseApplyInfo.getIsApp()==null){
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, new ArrayList<>()));
}else {
return AjaxResult.success(new ArrayList<>());
}
}
}
/**
* 领用发布详情
* @param leaseApplyInfo
* @return
*/
@ApiOperation(value = "领用发布详情")
@GetMapping("/getDetailsById")
public AjaxResult getDetailsById(LeaseApplyInfo leaseApplyInfo) {
return success(service.getDetailsById(leaseApplyInfo));
}
/**
* 导出领料发布列表
* @param response
* @param leaseApplyInfo
*/
@ApiOperation(value = "导出领料发布列表")
@PostMapping("/exportPublish")
public void exportPublish(HttpServletResponse response, LeaseApplyInfo leaseApplyInfo) {
List<LeasePublishInfo> list = service.getPublishList(leaseApplyInfo);
ExcelUtil<LeasePublishInfo> util = new ExcelUtil<>(LeasePublishInfo.class);
util.exportExcel(response, list, "领料发布列表数据");
}
/** /**
* 领用记录详情查看 * 领用记录详情查看
*/ */

View File

@ -73,6 +73,12 @@ public class LeaseApplyDetails extends BaseEntity {
@Excel(name = "当前库存") @Excel(name = "当前库存")
private BigDecimal storageNum; private BigDecimal storageNum;
@ApiModelProperty(value = "已发布数量")
private BigDecimal publishNum;
@ApiModelProperty(value = "待发布数量")
private BigDecimal pendingNum;
/** 预领料数 */ /** 预领料数 */
@Excel(name = "预领数量") @Excel(name = "预领数量")
@ApiModelProperty(value = "预领料数") @ApiModelProperty(value = "预领料数")

View File

@ -2,6 +2,7 @@ package com.bonus.material.lease.mapper;
import com.bonus.common.biz.domain.lease.LeaseApplyInfo; import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
import com.bonus.common.biz.domain.lease.LeasePublishInfo;
import com.bonus.material.lease.domain.LeaseApplyDetails; import com.bonus.material.lease.domain.LeaseApplyDetails;
import com.bonus.material.lease.domain.vo.LeaseDeptInfo; import com.bonus.material.lease.domain.vo.LeaseDeptInfo;
import com.bonus.material.ma.domain.Type; import com.bonus.material.ma.domain.Type;
@ -97,4 +98,18 @@ public interface LeaseTaskMapper {
LeaseApplyInfo getApplyInfo(Long taskId); LeaseApplyInfo getApplyInfo(Long taskId);
List<LeaseApplyDetails> getApplyDetails(Long taskId); List<LeaseApplyDetails> getApplyDetails(Long taskId);
/**
* 领用申请发布查询
* @param leaseApplyInfo
* @return
*/
List<LeasePublishInfo> getPublishList(LeaseApplyInfo leaseApplyInfo);
/**
* 领用申请发布详情查询
* @param leaseApplyInfo
* @return
*/
List<LeaseApplyDetails> selectPublishDetails(LeaseApplyInfo leaseApplyInfo);
} }

View File

@ -2,6 +2,7 @@ package com.bonus.material.lease.service;
import com.bonus.common.biz.domain.lease.LeaseApplyInfo; import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
import com.bonus.common.biz.domain.lease.LeasePublishInfo;
import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.lease.domain.LeaseApplyDetails; import com.bonus.material.lease.domain.LeaseApplyDetails;
import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo; import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo;
@ -92,5 +93,19 @@ public interface ILeaseTaskService {
List<LeaseApplyDetails> getApplyDetails(Long taskId); List<LeaseApplyDetails> getApplyDetails(Long taskId);
/**
* 领用申请发布查询
* @param leaseApplyInfo
* @return
*/
List<LeasePublishInfo> getPublishList(LeaseApplyInfo leaseApplyInfo);
/**
* 领用申请发布详情查询
* @param leaseApplyInfo
* @return
*/
LeaseApplyRequestVo getDetailsById(LeaseApplyInfo leaseApplyInfo);
} }

View File

@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import com.bonus.common.biz.constant.MaterialConstants; import com.bonus.common.biz.constant.MaterialConstants;
import com.bonus.common.biz.domain.BmFileInfo; import com.bonus.common.biz.domain.BmFileInfo;
import com.bonus.common.biz.domain.lease.LeaseApplyInfo; import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
import com.bonus.common.biz.domain.lease.LeasePublishInfo;
import com.bonus.common.biz.enums.LeaseTaskStatusEnum; import com.bonus.common.biz.enums.LeaseTaskStatusEnum;
import com.bonus.common.biz.enums.TmTaskTypeEnum; import com.bonus.common.biz.enums.TmTaskTypeEnum;
import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.exception.ServiceException;
@ -394,7 +395,6 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
(item.getCreateBy() != null && item.getCreateBy().contains(keyWord)) || (item.getCreateBy() != null && item.getCreateBy().contains(keyWord)) ||
(item.getLeasePerson() != null && item.getLeasePerson().contains(keyWord)) || (item.getLeasePerson() != null && item.getLeasePerson().contains(keyWord)) ||
(item.getLeasePhone() != null && item.getLeasePhone().contains(keyWord)) || (item.getLeasePhone() != null && item.getLeasePhone().contains(keyWord)) ||
(item.getContractPart() != null && item.getContractPart().contains(keyWord)) ||
(item.getImpUnitName() != null && item.getImpUnitName().contains(keyWord)); (item.getImpUnitName() != null && item.getImpUnitName().contains(keyWord));
} }
@ -528,4 +528,72 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
throw new RuntimeException("失败", e); throw new RuntimeException("失败", e);
} }
} }
/**
* 领用发布查询
* @param leaseApplyInfo
* @return
*/
@Override
public List<LeasePublishInfo> getPublishList(LeaseApplyInfo leaseApplyInfo) {
Long userId = SecurityUtils.getUserId();
leaseApplyInfo.setUserId(userId == 0 ? null : userId);
List<LeasePublishInfo> list = mapper.getPublishList(leaseApplyInfo);
if (!CollectionUtils.isEmpty(list)) {
String keyWord = leaseApplyInfo.getKeyWord();
// 如果关键字不为空进行过滤
if (!StringUtils.isBlank(keyWord)) {
list = list.stream()
.filter(item -> containsKeyWord(item, keyWord))
.collect(Collectors.toList());
}
}
return list;
}
/**
* 判断关键字是否包含在item中
* @param item
* @param keyWord
* @return
*/
private boolean containsKeyWord(LeasePublishInfo item, String keyWord) {
return (item.getMaTypeNames() != null && item.getMaTypeNames().contains(keyWord)) ||
(item.getUnitName() != null && item.getUnitName().contains(keyWord)) ||
(item.getProjectName() != null && item.getProjectName().contains(keyWord)) ||
(item.getCode() != null && item.getCode().contains(keyWord)) ||
(item.getCreateBy() != null && item.getCreateBy().contains(keyWord)) ||
(item.getLeasePerson() != null && item.getLeasePerson().contains(keyWord)) ||
(item.getPhone() != null && item.getPhone().contains(keyWord)) ||
(item.getImpUnitName() != null && item.getImpUnitName().contains(keyWord));
}
/**
* 获取详情
* @param leaseApplyInfo
* @return
*/
@Override
public LeaseApplyRequestVo getDetailsById(LeaseApplyInfo leaseApplyInfo) {
try {
/*LeaseApplyInfo applyInfo = new LeaseApplyInfo();
leaseApplyInfo.setId(leaseApplyInfo.getId());
Long userId = SecurityUtils.getUserId();
applyInfo.setUserId(userId);*/
Optional<LeaseApplyInfo> optionalInfo = Optional.ofNullable(mapper.selectLeaseApplyInfoById(leaseApplyInfo));
LeaseApplyRequestVo leaseApplyRequestVo = new LeaseApplyRequestVo();
optionalInfo.ifPresent(info -> {
leaseApplyRequestVo.setLeaseApplyInfo(info);
// 获取领料单详情
List<LeaseApplyDetails> details = mapper.selectPublishDetails(leaseApplyInfo);
if (!CollectionUtils.isEmpty(details)) {
leaseApplyRequestVo.setLeaseApplyDetailsList(details);
}
});
return leaseApplyRequestVo;
} catch (Exception e) {
throw new RuntimeException("Failed to select lease apply info", e);
}
}
} }

View File

@ -635,4 +635,107 @@
left join ma_type ma2 on ma1.parent_id = ma2.type_id left join ma_type ma2 on ma1.parent_id = ma2.type_id
where lai.task_id = #{taskId} and ma1.del_flag = 0 and ma2.del_flag = 0 where lai.task_id = #{taskId} and ma1.del_flag = 0 and ma2.del_flag = 0
</select> </select>
<select id="selectPublishDetails" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
SELECT
lad.id AS id,
lad.parent_id AS parentId,
mt.type_id AS typeId,
mt.type_name AS typeName,
mt2.type_name AS maTypeName,
CASE
mt.manage_type
WHEN 0 THEN
IFNULL( subquery0.num, 0 ) ELSE IFNULL( mt.storage_num, 0 )
END AS storageNum,
mt.manage_type AS manageType,
IFNULL( lad.pre_num, 0 ) AS preNum,
mt.unit_name AS unitName,
IFNULL( a.num, 0 ) AS publishNum,
IFNULL( b.num, 0 ) AS outNum,
IFNULL( lad.pre_num, 0 ) - IFNULL( a.num, 0 ) AS pendingNum
FROM
lease_apply_details lad
LEFT JOIN ma_type mt ON lad.type_id = mt.type_id
AND mt.`level` = '4'
AND mt.del_flag = '0'
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
AND mt2.`level` = '3'
AND mt2.del_flag = '0'
LEFT JOIN ( SELECT parent_id, type_id, sum( num ) AS num FROM lease_publish_details GROUP BY parent_id, type_id ) a
ON a.parent_id = lad.parent_id AND a.type_id = lad.type_id
LEFT JOIN ( SELECT parent_id, type_id, sum( out_num ) AS num FROM lease_out_details GROUP BY parent_id, type_id ) b
ON b.parent_id = lad.parent_id AND b.type_id = lad.type_id
LEFT JOIN (
SELECT
mt.type_id,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
count( mm.ma_id ) 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
WHERE
mm.ma_code IS NOT NULL
AND mm.ma_status IN ( 1 )
GROUP BY
mt.type_id
) AS subquery0 ON subquery0.type_id = mt.type_id
WHERE
lad.parent_id = #{id}
</select>
<select id="getPublishList" resultType="com.bonus.common.biz.domain.lease.LeasePublishInfo"
resultMap="LeaseApplyInfoResult">
select
lai.id, lai.code, lai.task_id, lai.lease_person, lai.phone, lai.type, lai.company_audit_by,lai.apply_code,
lai.company_audit_time, lai.company_audit_remark, lai.dept_audit_by, lai.dept_audit_time,
lai.dept_audit_remark, lai.direct_audit_by, lai.direct_audit_time, lai.direct_audit_remark,
lai.create_by, lai.create_time, lai.update_by, lai.update_time, lai.remark, lai.company_id,
lai.direct_id, lai.lease_type, lai.estimate_lease_time, lai.cost_bearing_party, lai.lease_sign_url,
lai.lease_sign_type,tt.task_id as taskId,
lai.unit_id,lai.project_id,bu.unit_name, bp.pro_name, tt.task_status as taskStatus,
case tt.task_status
when 0 then '待审核'
when 1 then '待审核'
when 2 then '审核中'
when 3 then '已完成'
when 4 then '已完成'
end as taskStatusName,
IFNULL(sum(lad.pre_num),0) as preCountNum,
IFNULL(sum(lad.al_num),0) as alNum,
GROUP_CONCAT(DISTINCT mt1.type_name) AS maTypeNames,
bp.contract_part as contractPart,
sd.dept_name as impUnitName
from
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 tm_task_agreement tta on lai.task_id = tta.task_id
left join bm_unit bu on bu.unit_id = lai.unit_id
left join bm_project bp on bp.pro_id = lai.project_id
left join sys_dept sd on sd.dept_id = bp.imp_unit
left join sys_dict_data sda on tt.task_status = sda.dict_value
and sda.dict_type = 'lease_task_status'
left join ma_type mt on lad.type_id = mt.type_id and mt.del_flag = '0'
left join ma_type mt1 on mt.parent_id = mt1.type_id and mt1.del_flag = '0'
where
tt.task_status = '1'
<if test="taskId != null ">and lai.task_id = #{taskId}</if>
<if test="statusList != null and statusList.size() > 0">
and tt.task_status in
<foreach item="item" collection="statusList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND DATE_FORMAT( lai.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime}
</if>
<if test="isApp != null and taskStatus==1">and (tt.task_status = 0 or tt.task_status = 1 or tt.task_status = 2) </if>
<if test="isApp != null and taskStatus==3">and (tt.task_status = 3 or tt.task_status = 4)</if>
GROUP BY lai.id
ORDER BY tt.task_status,tt.create_time desc
</select>
</mapper> </mapper>