This commit is contained in:
mashuai 2025-07-26 12:51:23 +08:00
parent bb90f2eda0
commit 264061c917
9 changed files with 96 additions and 47 deletions

View File

@ -333,4 +333,7 @@ public class LeaseApplyInfo extends BaseEntity{
@ApiModelProperty(value = "查询类型") @ApiModelProperty(value = "查询类型")
private String queryType; private String queryType;
@ApiModelProperty(value = "发布人id")
private Long publisher;
} }

View File

@ -169,4 +169,11 @@ public interface LeaseApplyInfoMapper {
* @return * @return
*/ */
List<LeaseApplyInfo> selectPublish(LeaseApplyInfo leaseApplyInfo); List<LeaseApplyInfo> selectPublish(LeaseApplyInfo leaseApplyInfo);
/**
* 根据id去查询出库数量
* @param applyInfo
* @return
*/
LeaseApplyInfo getOutList(LeaseApplyInfo applyInfo);
} }

View File

@ -283,6 +283,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
} }
// 提取details中的signType和signUrl单独作为一个集合并去重 // 提取details中的signType和signUrl单独作为一个集合并去重
List<LeaseOutSign> approveSignList = details.stream() List<LeaseOutSign> approveSignList = details.stream()
.filter(detail -> detail.getSignUrl() != null)
.map(detail -> new LeaseOutSign(detail.getSignType(), detail.getSignUrl())) .map(detail -> new LeaseOutSign(detail.getSignType(), detail.getSignUrl()))
.distinct() .distinct()
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -495,6 +496,19 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
// 领用数据 // 领用数据
List<LeaseApplyInfo> leaseApplyOutList = leaseApplyInfoMapper.selectPublish(leaseApplyInfo); List<LeaseApplyInfo> leaseApplyOutList = leaseApplyInfoMapper.selectPublish(leaseApplyInfo);
if (!CollectionUtils.isEmpty(leaseApplyOutList)) { if (!CollectionUtils.isEmpty(leaseApplyOutList)) {
for (LeaseApplyInfo applyInfo : leaseApplyOutList) {
// 根据id去查询出库数量
LeaseApplyInfo outList = leaseApplyInfoMapper.getOutList(applyInfo);
if (outList != null) {
if (applyInfo.getPreCountNum().compareTo(outList.getAlNum()) == 0) {
applyInfo.setIsConfirm(2);
} else {
applyInfo.setIsConfirm(1);
}
} else {
applyInfo.setIsConfirm(1);
}
}
list.addAll(leaseApplyOutList); list.addAll(leaseApplyOutList);
} }
//材料站权限过滤 //材料站权限过滤
@ -577,9 +591,26 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
@Override @Override
public List<LeaseApplyInfo> getConfirmTaskList(LeaseApplyInfo leaseApplyInfo) { public List<LeaseApplyInfo> getConfirmTaskList(LeaseApplyInfo leaseApplyInfo) {
leaseApplyInfo.setUserId(SecurityUtils.getLoginUser().getUserid()); leaseApplyInfo.setUserId(SecurityUtils.getLoginUser().getUserid());
// 领料数据
List<LeaseApplyInfo> list = leaseApplyInfoMapper.selectCompleteOutList(leaseApplyInfo); List<LeaseApplyInfo> list = leaseApplyInfoMapper.selectCompleteOutList(leaseApplyInfo);
// 领用数据
List<LeaseApplyInfo> leaseApplyOutList = leaseApplyInfoMapper.selectPublish(leaseApplyInfo);
if (!CollectionUtils.isEmpty(leaseApplyOutList)) {
for (LeaseApplyInfo applyInfo : leaseApplyOutList) {
// 根据id去查询出库数量
LeaseApplyInfo outList = leaseApplyInfoMapper.getOutList(applyInfo);
if (outList != null) {
if (applyInfo.getPreCountNum().compareTo(outList.getAlNum()) == 0) {
applyInfo.setIsConfirm(2);
} else {
applyInfo.setIsConfirm(1);
}
} else {
applyInfo.setIsConfirm(1);
}
}
list.addAll(leaseApplyOutList);
}
if (leaseApplyInfo.getIsConfirm()!=null) { if (leaseApplyInfo.getIsConfirm()!=null) {
if (leaseApplyInfo.getIsConfirm() == 2) { if (leaseApplyInfo.getIsConfirm() == 2) {
@ -856,7 +887,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
} }
try { try {
leaseApplyInfo.setReleaseTime(DateUtils.getTime()); leaseApplyInfo.setReleaseTime(DateUtils.getTime());
leaseApplyInfo.setUpdateBy(SecurityUtils.getLoginUser().getUserid().toString()); leaseApplyInfo.setPublisher(SecurityUtils.getLoginUser().getUserid());
int result = leaseApplyInfoMapper.updateLeaseApplyInfo(leaseApplyInfo); int result = leaseApplyInfoMapper.updateLeaseApplyInfo(leaseApplyInfo);
if (result > 0) { if (result > 0) {
// 同步修改tm_task任务状态, 如果不需要审核改成 LEASE_TASK_IN_PROGRESS 如果需要审核改成 LEASE_TASK_TO_AUDIT // 同步修改tm_task任务状态, 如果不需要审核改成 LEASE_TASK_IN_PROGRESS 如果需要审核改成 LEASE_TASK_TO_AUDIT
@ -966,7 +997,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
Date nowDate = DateUtils.getNowDate(); Date nowDate = DateUtils.getNowDate();
String format = dateFormat.format(nowDate); String format = dateFormat.format(nowDate);
String result = format.replace("-", ""); String result = format.replace("-", "");
return MaterialConstants.LEASE_TASK_TYPE_LABEL + result + String.format("-%03d", thisMonthMaxOrder + 1); return MaterialConstants.LEASE_TASK_TYPE_LABEL + result + String.format("-%05d", thisMonthMaxOrder + 1);
} }
/** /**

View File

@ -447,29 +447,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
int res = 0; int res = 0;
// 领用任务单独判断 // 领用任务单独判断
if (StringUtils.isNotBlank(record.getPublishTask())) { if (StringUtils.isNotBlank(record.getPublishTask())) {
LeaseApplyInfo applyInfo = new LeaseApplyInfo(); return 1;
applyInfo.setPublishTask(record.getPublishTask());
// 根据领用批次查询领用详情
boolean isFinished = true;
List<LeaseApplyDetails> details = leaseApplyDetailsMapper.getDetailsPublish(applyInfo);
if (!CollectionUtils.isEmpty(details)) {
for (LeaseApplyDetails bean : details) {
if (bean.getAlNum().compareTo(bean.getPreNum()) != 0) {
isFinished = false;
break;
}
}
}
if (isFinished) {
String taskId = leaseApplyInfoMapper.getTaskId(record.getParentId());
// 领用任务状态改为已完成
res = tmTaskMapper.updateTaskStatus(taskId, LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatus());
if (res == 0) {
throw new RuntimeException("领用任务状态修改失败");
}
}
res = 1;
return res;
} }
// 进行状态判断 // 进行状态判断
List<LeaseApplyDetails> leaseApplyDetailsList = leaseApplyDetailsMapper.getByParentId(record.getParentId()); List<LeaseApplyDetails> leaseApplyDetailsList = leaseApplyDetailsMapper.getByParentId(record.getParentId());

View File

@ -18,7 +18,9 @@ import com.bonus.common.core.utils.bean.BeanUtils;
import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils; import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.back.domain.vo.MaCodeVo; import com.bonus.material.back.domain.vo.MaCodeVo;
import com.bonus.material.basic.domain.BmAgreementInfo;
import com.bonus.material.basic.domain.dto.SysUserRoleVo; import com.bonus.material.basic.domain.dto.SysUserRoleVo;
import com.bonus.material.basic.mapper.BmAgreementInfoMapper;
import com.bonus.material.basic.mapper.BmFileInfoMapper; import com.bonus.material.basic.mapper.BmFileInfoMapper;
import com.bonus.material.basic.mapper.BmUserRoleMapper; import com.bonus.material.basic.mapper.BmUserRoleMapper;
import com.bonus.material.lease.domain.LeaseApplyDetails; import com.bonus.material.lease.domain.LeaseApplyDetails;
@ -38,7 +40,6 @@ import com.bonus.material.task.mapper.TmTaskMapper;
import com.bonus.material.work.domain.SysWorkflowConfig; import com.bonus.material.work.domain.SysWorkflowConfig;
import com.bonus.material.work.domain.SysWorkflowNode; import com.bonus.material.work.domain.SysWorkflowNode;
import com.bonus.material.work.domain.SysWorkflowRecordHistory; import com.bonus.material.work.domain.SysWorkflowRecordHistory;
import com.bonus.material.work.domain.SysWorkflowType;
import com.bonus.material.work.mapper.*; import com.bonus.material.work.mapper.*;
import com.bonus.material.work.service.SysWorkflowRecordService; import com.bonus.material.work.service.SysWorkflowRecordService;
import com.bonus.system.api.domain.SysUser; import com.bonus.system.api.domain.SysUser;
@ -96,6 +97,9 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
@Resource @Resource
private BmUserRoleMapper bmUserRoleMapper; private BmUserRoleMapper bmUserRoleMapper;
@Resource
private BmAgreementInfoMapper bmAgreementInfoMapper;
/** /**
* 新增领用任务 * 新增领用任务
@ -176,7 +180,17 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
tmTaskMapper.insertTmTask(tmTask); tmTaskMapper.insertTmTask(tmTask);
leaseApplyInfo.setTaskId(tmTask.getTaskId()); leaseApplyInfo.setTaskId(tmTask.getTaskId());
leaseApplyInfo.setCode(taskCode); leaseApplyInfo.setCode(taskCode);
BmAgreementInfo bmAgreementInfo = new BmAgreementInfo();
bmAgreementInfo.setUnitId(leaseApplyInfo.getUnitId());
bmAgreementInfo.setProjectId(leaseApplyInfo.getProjectId());
List<BmAgreementInfo> bmAgreementInfos = bmAgreementInfoMapper.selectBmAgreementInfoList(bmAgreementInfo);
if (!CollectionUtils.isEmpty(bmAgreementInfos)) {
bmAgreementInfo = bmAgreementInfos.get(0);
TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), bmAgreementInfo.getAgreementId());
tmTaskAgreement.setCreateTime(DateUtils.getNowDate());
tmTaskAgreement.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getNickName());
tmTaskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement);
}
// 设置审批人为默认的董班长 // 设置审批人为默认的董班长
Long peopleId = leaseApplyInfoMapper.getDirectAuditBy(); Long peopleId = leaseApplyInfoMapper.getDirectAuditBy();
leaseApplyInfo.setDirectAuditBy(peopleId); leaseApplyInfo.setDirectAuditBy(peopleId);

View File

@ -312,7 +312,9 @@ public class MachineController extends BaseController {
@GetMapping(value = "/getInfoByTypeId") @GetMapping(value = "/getInfoByTypeId")
public AjaxResult getInfoByTypeId(Machine machine) { public AjaxResult getInfoByTypeId(Machine machine) {
try { try {
return AjaxResult.success(machineService.getInfoByTypeId(machine)); startPage();
List<Machine> list = machineService.getInfoByTypeId(machine);
return AjaxResult.success(getDataTable(list));
} catch (Exception e) { } catch (Exception e) {
return error("查询失败,请联系管理员"); return error("查询失败,请联系管理员");
} }

View File

@ -261,7 +261,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="estimateLeaseTime != null">estimate_lease_time = #{estimateLeaseTime},</if> <if test="estimateLeaseTime != null">estimate_lease_time = #{estimateLeaseTime},</if>
release_time = now(), release_time = now(),
<if test="costBearingParty != null">cost_bearing_party = #{costBearingParty},</if> <if test="costBearingParty != null">cost_bearing_party = #{costBearingParty},</if>
<if test="updateBy != null and updateBy != ''">publisher = #{updateBy},</if> <if test="publisher != null ">publisher = #{publisher},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
@ -351,7 +351,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
lease_publish_details lpd lease_publish_details lpd
LEFT JOIN lease_apply_info lai ON lai.id = lpd.parent_id LEFT JOIN lease_apply_info lai ON lai.id = lpd.parent_id
LEFT JOIN tm_task tt ON lai.task_id = tt.task_id LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
LEFT JOIN (SELECT IFNULL( sum(out_num ), 0) AS num, parent_id, publish_task from lease_out_details LEFT JOIN (SELECT IFNULL( sum(out_num ), 0) AS num, parent_id, publish_task from lease_out_details a
<if test="userId != null">
JOIN ma_type_keeper mtk ON mtk.type_id = a.type_id AND mtk.user_id = #{userId}
</if>
GROUP BY parent_id, publish_task) lod ON lpd.parent_id = lod.parent_id GROUP BY parent_id, publish_task) lod ON lpd.parent_id = lod.parent_id
AND lpd.publish_task = lod.publish_task AND lpd.publish_task = lod.publish_task
LEFT JOIN bm_unit bu ON bu.unit_id = lpd.unit_id LEFT JOIN bm_unit bu ON bu.unit_id = lpd.unit_id
@ -401,6 +404,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectLeaseApplyInfoVoTwo"/> <include refid="selectLeaseApplyInfoVoTwo"/>
where where
lod.out_num >0 and lod.lease_sign_id is not null and bp.external_id is not null lod.out_num >0 and lod.lease_sign_id is not null and bp.external_id is not null
and tt.task_type = 2
<if test="code != null and code != ''"> and lai.code = #{code}</if> <if test="code != null and code != ''"> and lai.code = #{code}</if>
<if test="taskId != null "> and lai.task_id = #{taskId}</if> <if test="taskId != null "> and lai.task_id = #{taskId}</if>
<if test="leasePerson != null and leasePerson != ''"> and lai.lease_person = #{leasePerson}</if> <if test="leasePerson != null and leasePerson != ''"> and lai.lease_person = #{leasePerson}</if>
@ -450,7 +454,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
su.nick_name as confirmPerson, su.nick_name as confirmPerson,
lod.confirm_remark as confirmRemark, lod.confirm_remark as confirmRemark,
GROUP_CONCAT(DISTINCT mt2.type_name) as maTypeNames, GROUP_CONCAT(DISTINCT mt2.type_name) as maTypeNames,
lod.lease_sign_id as leaseSignId lod.lease_sign_id as leaseSignId,
lod.publish_task as publishTask
from lease_out_details lod from lease_out_details lod
left join ma_type mt1 on lod.type_id = mt1.type_id left join ma_type mt1 on lod.type_id = mt1.type_id
left join ma_type mt2 on mt1.parent_id = mt2.type_id left join ma_type mt2 on mt1.parent_id = mt2.type_id
@ -711,7 +716,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bu.unit_name AS unitName, bu.unit_name AS unitName,
bp.pro_name AS projectName, bp.pro_name AS projectName,
bai.agreement_code AS agreementCode, bai.agreement_code AS agreementCode,
IFNULL( sum( lpd.num ), 0 ) AS preCountNum, IFNULL( lad.num, 0) AS preCountNum,
IFNULL(lod.num, 0) AS alNum, IFNULL(lod.num, 0) AS alNum,
GROUP_CONCAT( DISTINCT mt1.type_name ) AS maTypeNames, GROUP_CONCAT( DISTINCT mt1.type_name ) AS maTypeNames,
lpd.publish_task AS publishTask, lpd.publish_task AS publishTask,
@ -724,19 +729,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
lod.confirm_remark AS confirmRemark, lod.confirm_remark AS confirmRemark,
mt3.type_id AS firstId, mt3.type_id AS firstId,
lpd.create_time AS releaseTime, lpd.create_time AS releaseTime,
bp.external_id as externalId, bp.external_id as externalId
CASE
WHEN IFNULL(sum(lad.pre_num),0) = SUM(CASE WHEN lod.is_confirm = 2 THEN lod.num ELSE 0 END) THEN 2
ELSE 1
END as isConfirm
FROM FROM
lease_publish_details lpd lease_apply_info lai
LEFT JOIN lease_apply_info lai ON lai.id = lpd.parent_id LEFT JOIN (SELECT parent_id, SUM(pre_num) as num FROM lease_apply_details GROUP BY parent_id) lad ON lai.id = lad.parent_id
LEFT JOIN lease_apply_details lad ON lai.id = lad.parent_id
LEFT JOIN tm_task tt ON lai.task_id = tt.task_id LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
LEFT JOIN lease_publish_details lpd ON lai.id = lpd.parent_id
LEFT JOIN (SELECT IFNULL( sum(out_num ), 0) AS num, parent_id, publish_task, is_confirm, confirm_remark, confirm_time, lease_sign_id from lease_out_details LEFT JOIN (SELECT IFNULL( sum(out_num ), 0) AS num, parent_id, publish_task, is_confirm, confirm_remark, confirm_time, lease_sign_id from lease_out_details
GROUP BY parent_id, publish_task) lod ON lpd.parent_id = lod.parent_id GROUP BY parent_id) lod ON lpd.parent_id = lod.parent_id
AND lpd.publish_task = lod.publish_task
LEFT JOIN bm_unit bu ON bu.unit_id = lpd.unit_id LEFT JOIN bm_unit bu ON bu.unit_id = lpd.unit_id
LEFT JOIN bm_project bp ON bp.pro_id = lpd.project_id LEFT JOIN bm_project bp ON bp.pro_id = lpd.project_id
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
@ -750,7 +750,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND lpd.project_id = bai.project_id AND lpd.project_id = bai.project_id
left join sys_user su on lpd.create_by = su.user_id left join sys_user su on lpd.create_by = su.user_id
where where
lod.lease_sign_id is not null and bp.external_id is not null lod.lease_sign_id is not null and bp.external_id is not null and tt.task_type = '19'
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''"> <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[ AND DATE_FORMAT( lpd.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]> <![CDATA[ AND DATE_FORMAT( lpd.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
</if> </if>
@ -761,11 +761,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND lpd.publish_task = #{publishTask} AND lpd.publish_task = #{publishTask}
</if> </if>
GROUP BY GROUP BY
lpd.publish_task lai.id
ORDER BY ORDER BY
lpd.create_time DESC lpd.create_time DESC
</select> </select>
<select id="getOutList" resultType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">
SELECT
parent_id as id,
SUM( lod.out_num ) as alNum
FROM
lease_out_details lod
WHERE
is_confirm = 2
AND parent_id = #{id}
</select>
<update id="confirmLeaseTask"> <update id="confirmLeaseTask">
update update
lease_out_details lease_out_details

View File

@ -804,8 +804,8 @@
case tt.task_status case tt.task_status
when 1 then '未完成' when 1 then '未完成'
when 4 then '已完成'
when 3 then '已完成' when 3 then '已完成'
when 4 then '已完成'
when 5 then '已终止' when 5 then '已终止'
end as taskStatusName, end as taskStatusName,
IFNULL(sum(lad.pre_num),0) as preCountNum, IFNULL(sum(lad.pre_num),0) as preCountNum,

View File

@ -771,5 +771,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="typeId != null "> <if test="typeId != null ">
and wsi.model_id = #{typeId} and wsi.model_id = #{typeId}
</if> </if>
<if test="maCode != null and maCode != ''">
and wsi.ma_code LIKE CONCAT('%',#{maCode},'%')
</if>
</select> </select>
</mapper> </mapper>