支持工程与往来单位及协议修改
This commit is contained in:
parent
1666636cab
commit
7f73c243f5
|
|
@ -278,7 +278,16 @@ public class TmTaskController extends BaseController {
|
||||||
if (CollUtil.isEmpty(task.getLeaseApplyInfoList())){
|
if (CollUtil.isEmpty(task.getLeaseApplyInfoList())){
|
||||||
return AjaxResult.error("任务表修改完成,但领料任务明细为空,执行失败!");
|
return AjaxResult.error("任务表修改完成,但领料任务明细为空,执行失败!");
|
||||||
}
|
}
|
||||||
// 先删除原有的领料任务明细
|
|
||||||
|
// 根据参数判断是否需要修改工程与往来单位
|
||||||
|
if (StringUtils.isNotNull(task.getProjectId()) && StringUtils.isNotNull(task.getUnitId())) {
|
||||||
|
Integer agreementId = tmTaskService.getAgreementIdByUnit(task);
|
||||||
|
if (StringUtils.isNotNull(agreementId)) {
|
||||||
|
task.setAgreementId(agreementId);
|
||||||
|
tmTaskService.updateAgreementByTask(task); // 修改任务关联的协议
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (LeaseApplyInfo leaseApplyInfo : task.getLeaseApplyInfoList()) {
|
for (LeaseApplyInfo leaseApplyInfo : task.getLeaseApplyInfoList()) {
|
||||||
if (leaseApplyInfo == null || leaseApplyInfo.getId() == null) {
|
if (leaseApplyInfo == null || leaseApplyInfo.getId() == null) {
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -286,7 +295,7 @@ public class TmTaskController extends BaseController {
|
||||||
if (StringUtils.isEmpty(leaseApplyInfo.getLeaseApplyDetails())) {
|
if (StringUtils.isEmpty(leaseApplyInfo.getLeaseApplyDetails())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 执行删除
|
// 先删除之前的领料明细
|
||||||
tmTaskService.deleteDetailsByParentId(String.valueOf(leaseApplyInfo.getId()));
|
tmTaskService.deleteDetailsByParentId(String.valueOf(leaseApplyInfo.getId()));
|
||||||
// 删除后,插入新地领料任务明细
|
// 删除后,插入新地领料任务明细
|
||||||
if (StringUtils.isNotNull(leaseApplyInfo.getId())) {
|
if (StringUtils.isNotNull(leaseApplyInfo.getId())) {
|
||||||
|
|
|
||||||
|
|
@ -76,9 +76,13 @@ public interface TmTaskMapper {
|
||||||
|
|
||||||
int insertAgreement(TmTask record);
|
int insertAgreement(TmTask record);
|
||||||
|
|
||||||
|
int updateAgreementByTask(TmTask record);
|
||||||
|
|
||||||
int selectNumByMonth(Date nowDate);
|
int selectNumByMonth(Date nowDate);
|
||||||
|
|
||||||
TmTask getLeaseListTmTask(TmTask task);
|
TmTask getLeaseListTmTask(TmTask task);
|
||||||
|
|
||||||
LeaseApplyInfo getLeaseListByLeaseInfo(TmTask task);
|
LeaseApplyInfo getLeaseListByLeaseInfo(TmTask task);
|
||||||
|
|
||||||
|
Integer getAgreementIdByUnit(TmTask task);
|
||||||
}
|
}
|
||||||
|
|
@ -41,6 +41,10 @@ public interface TmTaskService{
|
||||||
|
|
||||||
int updateByPrimaryKeySelective(TmTask record);
|
int updateByPrimaryKeySelective(TmTask record);
|
||||||
|
|
||||||
|
Integer getAgreementIdByUnit(TmTask task);
|
||||||
|
|
||||||
|
int updateAgreementByTask(TmTask record);
|
||||||
|
|
||||||
int updateByPrimaryKey(TmTask record);
|
int updateByPrimaryKey(TmTask record);
|
||||||
|
|
||||||
int updateBatch(List<TmTask> list);
|
int updateBatch(List<TmTask> list);
|
||||||
|
|
|
||||||
|
|
@ -190,6 +190,24 @@ public class TmTaskServiceImpl implements TmTaskService{
|
||||||
return tmTaskMapper.updateByPrimaryKeySelective(record);
|
return tmTaskMapper.updateByPrimaryKeySelective(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param task 查询条件
|
||||||
|
* @return 协议的id
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Integer getAgreementIdByUnit(TmTask task) {
|
||||||
|
return tmTaskMapper.getAgreementIdByUnit(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param record 修改信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateAgreementByTask(TmTask record) {
|
||||||
|
return tmTaskMapper.updateAgreementByTask(record);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int updateByPrimaryKey(TmTask record) {
|
public int updateByPrimaryKey(TmTask record) {
|
||||||
return tmTaskMapper.updateByPrimaryKey(record);
|
return tmTaskMapper.updateByPrimaryKey(record);
|
||||||
|
|
|
||||||
|
|
@ -442,12 +442,17 @@
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
<insert id="insertAgreement">
|
<insert id="insertAgreement">
|
||||||
INSERT INTO tm_task_agreement ( `task_id`, `agreement_id`, `create_by`, `create_time`, `company_id` )
|
INSERT INTO tm_task_agreement ( `task_id`, `agreement_id`, `create_by`, `create_time`, `company_id` )
|
||||||
VALUES(#{id},#{agreementId},#{createBy},NOW(),#{companyId})
|
VALUES(#{id},#{agreementId},#{createBy},NOW(),#{companyId})
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
|
<update id="updateAgreementByTask">
|
||||||
|
update tm_task_agreement set agreement_id = #{agreementId}, update_time = now()
|
||||||
|
where task_id = #{taskId}
|
||||||
|
</update>
|
||||||
|
|
||||||
<select id="getAuditListByLeaseTmTask" resultType="com.bonus.sgzb.base.api.domain.TmTask">
|
<select id="getAuditListByLeaseTmTask" resultType="com.bonus.sgzb.base.api.domain.TmTask">
|
||||||
SELECT
|
SELECT
|
||||||
tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName,
|
tt.*, su.phonenumber AS phoneNumber, sd.dept_name as deptName,
|
||||||
|
|
@ -600,4 +605,10 @@
|
||||||
where
|
where
|
||||||
parennt_id = #{record.parenntId}
|
parennt_id = #{record.parenntId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<select id="getAgreementIdByUnit" resultType="java.lang.Integer">
|
||||||
|
select agreement_id from bm_agreement_info
|
||||||
|
where unit_id = #{unitId} and project_id = #{projectId}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue