重庆领料审核修改后无数据bug
This commit is contained in:
parent
763c003c34
commit
ffe7c67c6f
|
|
@ -527,9 +527,9 @@ public class TmTaskController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 修改任务信息
|
||||
* 宁夏修改任务信息
|
||||
*/
|
||||
@Log(title = "修改任务信息", businessType = BusinessType.UPDATE)
|
||||
@Log(title = "宁夏修改任务信息", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody TmTask task) {
|
||||
try {
|
||||
|
|
@ -543,7 +543,23 @@ public class TmTaskController extends BaseController {
|
|||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 重庆修改任务信息
|
||||
*/
|
||||
@Log(title = "重庆修改任务信息", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/editCq")
|
||||
public AjaxResult editCq(@RequestBody TmTask task) {
|
||||
try {
|
||||
if (StringUtils.isNull(task)) {
|
||||
return AjaxResult.error("参数错误,传入信息为空!");
|
||||
}
|
||||
tmTaskService.editCq(task);
|
||||
return AjaxResult.success("修改成功");
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("修改失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public interface LeaseApplyInfoMapper {
|
|||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(LeaseApplyInfo record);
|
||||
LeaseApplyInfo selectByTaskIdAndCompId(@Param("taskId") String taskId, @Param("companyId") String companyId);
|
||||
LeaseApplyInfo selectByTaskIdAndCompId(@Param("taskId") String taskId, @Param("companyId") Integer companyId);
|
||||
|
||||
int insertOrUpdate(LeaseApplyInfo record);
|
||||
|
||||
|
|
@ -37,4 +37,6 @@ public interface LeaseApplyInfoMapper {
|
|||
int updateBatchSelective(List<LeaseApplyInfo> list);
|
||||
|
||||
int batchInsert(@Param("list") List<LeaseApplyInfo> list);
|
||||
|
||||
LeaseApplyInfo selectByTaskIdAndCompIdCq(@Param("taskId") String taskId);
|
||||
}
|
||||
|
|
@ -138,4 +138,8 @@ public interface TmTaskMapper {
|
|||
* @return
|
||||
*/
|
||||
int deleteTaskAgreementByTaskId(@Param("taskId") String taskId);
|
||||
|
||||
int updateLeaseApplyInfoRejectInfoCq(@Param("record") LeaseApplyInfo leaseApplyInfo);
|
||||
|
||||
int updateLeaseApplyInfoAuditInfoCq(@Param("record") LeaseApplyInfo leaseApplyInfo);
|
||||
}
|
||||
|
|
@ -70,6 +70,7 @@ public interface TmTaskService{
|
|||
int updateByPrimaryKeySelective(TmTask record);
|
||||
|
||||
int edit(TmTask tmTask);
|
||||
int editCq(TmTask tmTask);
|
||||
|
||||
Integer getAgreementIdByUnit(TmTask task);
|
||||
|
||||
|
|
|
|||
|
|
@ -205,8 +205,11 @@ public class TmTaskServiceImpl implements TmTaskService {
|
|||
if (CollUtil.isNotEmpty(leaseApplyInfoList)) {
|
||||
for (LeaseApplyInfo leaseApplyInfo : leaseApplyInfoList) {
|
||||
if (leaseApplyInfo != null) {
|
||||
//leaseApplyInfo.setExamineStatusId(record.getExamineStatusId());
|
||||
result += tmTaskMapper.updateLeaseApplyInfoAuditInfo(leaseApplyInfo);
|
||||
if (leaseApplyInfo.getCompanyId() == null) {
|
||||
result += tmTaskMapper.updateLeaseApplyInfoAuditInfoCq(leaseApplyInfo);
|
||||
} else {
|
||||
result += tmTaskMapper.updateLeaseApplyInfoAuditInfo(leaseApplyInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -904,8 +907,11 @@ public class TmTaskServiceImpl implements TmTaskService {
|
|||
if (CollUtil.isNotEmpty(leaseApplyInfoList)) {
|
||||
for (LeaseApplyInfo leaseApplyInfo : leaseApplyInfoList) {
|
||||
if (leaseApplyInfo != null) {
|
||||
//leaseApplyInfo.setExamineStatusId(record.getExamineStatusId());
|
||||
result += tmTaskMapper.updateLeaseApplyInfoRejectInfo(leaseApplyInfo);
|
||||
if (leaseApplyInfo.getCompanyId() == null) {
|
||||
result += tmTaskMapper.updateLeaseApplyInfoRejectInfoCq(leaseApplyInfo);
|
||||
} else {
|
||||
result += tmTaskMapper.updateLeaseApplyInfoRejectInfo(leaseApplyInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1025,12 +1031,12 @@ public class TmTaskServiceImpl implements TmTaskService {
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int edit(TmTask tmTask) {
|
||||
int flag = 0;
|
||||
int res = 0;
|
||||
int taskResult = this.updateByPrimaryKeySelective(tmTask);
|
||||
//修改任务信息(tm_task)
|
||||
this.updateByPrimaryKeySelective(tmTask);
|
||||
try {
|
||||
if (CollUtil.isEmpty(tmTask.getLeaseApplyInfoList())) {
|
||||
flag = 1;
|
||||
throw new RuntimeException("参数异常");
|
||||
}
|
||||
// 修改任务关联的协议
|
||||
this.updateAgreementByTask(tmTask);
|
||||
|
|
@ -1056,7 +1062,44 @@ public class TmTaskServiceImpl implements TmTaskService {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int editCq(TmTask tmTask) {
|
||||
int res = 0;
|
||||
//修改任务信息(tm_task)
|
||||
this.updateByPrimaryKeySelective(tmTask);
|
||||
try {
|
||||
if (CollUtil.isEmpty(tmTask.getLeaseApplyInfoList())) {
|
||||
throw new RuntimeException("参数异常");
|
||||
}
|
||||
// 修改任务关联的协议
|
||||
this.updateAgreementByTask(tmTask);
|
||||
//先删除leaseApplyDetail
|
||||
res = deletePreDetailData(tmTask);
|
||||
if (res == 0) {
|
||||
throw new RuntimeException("删除leaseApplyDetail异常");
|
||||
}
|
||||
//再删除leaseApplyInfo
|
||||
res = deletePreData(tmTask);
|
||||
if (res == 0) {
|
||||
throw new RuntimeException("删除leaseApplyInfo异常");
|
||||
}
|
||||
// 先查询lease apply info,根据task id,company id,不存在则插入,领料任务,领料单号,领料人,联系电话,备注,存在则不插入
|
||||
res = insertNewDataCq(tmTask);
|
||||
if (res == 0) {
|
||||
throw new RuntimeException("insertNewData异常");
|
||||
}
|
||||
// 再插入lease apply detail
|
||||
res = insertNewDetailData(tmTask);
|
||||
if (res == 0) {
|
||||
throw new RuntimeException("insertNewDetailData异常");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
@ -1085,7 +1128,53 @@ public class TmTaskServiceImpl implements TmTaskService {
|
|||
Long taskId = task.getTaskId();
|
||||
if (CollUtil.isNotEmpty(leaseApplyDetails)) {
|
||||
for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) {
|
||||
LeaseApplyInfo leaseApplyInfos = leaseApplyInfoMapper.selectByTaskIdAndCompId(String.valueOf(taskId), String.valueOf(leaseApplyDetail.getCompanyId()));
|
||||
LeaseApplyInfo leaseApplyInfos = new LeaseApplyInfo();
|
||||
if (leaseApplyDetail.getCompanyId() == null) {
|
||||
leaseApplyInfos = leaseApplyInfoMapper.selectByTaskIdAndCompIdCq(String.valueOf(taskId));
|
||||
} else {
|
||||
leaseApplyInfos = leaseApplyInfoMapper.selectByTaskIdAndCompId(String.valueOf(taskId), leaseApplyDetail.getCompanyId());
|
||||
}
|
||||
if (leaseApplyInfos == null) {
|
||||
LeaseApplyInfo leaseApplyInfo = new LeaseApplyInfo();
|
||||
String code = this.genderLeaseCode();
|
||||
leaseApplyInfo.setCode(code);
|
||||
leaseApplyInfo.setTaskId(task.getTaskId().intValue());
|
||||
leaseApplyInfo.setCode(task.getLeaseApplyInfoList().get(0).getCode());
|
||||
leaseApplyInfo.setLeasePerson(leasePerson);
|
||||
leaseApplyInfo.setPhone(phone);
|
||||
if (task.getTaskStatus() == 32 && task.getSouceByRefuse() == 1) {
|
||||
leaseApplyInfo.setDeptAuditBy(task.getLeaseApplyInfoList().get(0).getDeptAuditBy());
|
||||
leaseApplyInfo.setDeptAuditTime(task.getLeaseApplyInfoList().get(0).getDeptAuditTime());
|
||||
leaseApplyInfo.setDeptAuditRemark(task.getLeaseApplyInfoList().get(0).getDeptAuditRemark());
|
||||
}
|
||||
leaseApplyInfo.setRemark(remark);
|
||||
leaseApplyInfo.setType(task.getLeaseApplyInfoList().get(0).getType());
|
||||
leaseApplyInfo.setCompanyId(leaseApplyDetail.getCompanyId());
|
||||
leaseApplyInfo.setEstimateLeaseTime(task.getEstimateLeaseTime());
|
||||
leaseApplyInfo.setLeaseType(task.getLeaseType());
|
||||
res = leaseApplyInfoMapper.insert(leaseApplyInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private int insertNewDataCq(TmTask task) {
|
||||
int res = 0;
|
||||
LeaseApplyInfo leaseApplyInfo1 = task.getLeaseApplyInfo();
|
||||
String leasePerson = "";
|
||||
String remark = "";
|
||||
String phone = "";
|
||||
if (leaseApplyInfo1 != null) {
|
||||
leasePerson = leaseApplyInfo1.getLeasePerson();
|
||||
remark = leaseApplyInfo1.getRemark();
|
||||
phone = leaseApplyInfo1.getPhone();
|
||||
}
|
||||
List<LeaseApplyDetails> leaseApplyDetails = task.getLeaseApplyDetails();
|
||||
Long taskId = task.getTaskId();
|
||||
if (CollUtil.isNotEmpty(leaseApplyDetails)) {
|
||||
for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) {
|
||||
LeaseApplyInfo leaseApplyInfos = leaseApplyInfoMapper.selectByTaskIdAndCompIdCq(String.valueOf(taskId));
|
||||
if (leaseApplyInfos == null) {
|
||||
LeaseApplyInfo leaseApplyInfo = new LeaseApplyInfo();
|
||||
String code = this.genderLeaseCode();
|
||||
|
|
@ -1117,9 +1206,17 @@ public class TmTaskServiceImpl implements TmTaskService {
|
|||
Long taskId = task.getTaskId();
|
||||
if (CollUtil.isNotEmpty(leaseApplyDetails)) {
|
||||
for (LeaseApplyDetails leaseApplyDetail : leaseApplyDetails) {
|
||||
LeaseApplyInfo leaseApplyInfos = leaseApplyInfoMapper.selectByTaskIdAndCompId(String.valueOf(taskId), String.valueOf(leaseApplyDetail.getCompanyId()));
|
||||
LeaseApplyInfo leaseApplyInfos = new LeaseApplyInfo();
|
||||
if (leaseApplyDetail.getCompanyId() == null) {
|
||||
leaseApplyInfos = leaseApplyInfoMapper.selectByTaskIdAndCompIdCq(String.valueOf(taskId));
|
||||
} else {
|
||||
leaseApplyInfos = leaseApplyInfoMapper.selectByTaskIdAndCompId(String.valueOf(taskId), leaseApplyDetail.getCompanyId());
|
||||
}
|
||||
Integer id = leaseApplyInfos.getId();
|
||||
if (leaseApplyDetail.getCompanyId().equals(leaseApplyInfos.getCompanyId())) {
|
||||
if (leaseApplyDetail.getCompanyId() == null && leaseApplyInfos.getCompanyId() == null) {
|
||||
leaseApplyDetail.setParenntId(id);
|
||||
res = leaseApplyDetailsMapper.insert(leaseApplyDetail);
|
||||
} else if (leaseApplyDetail.getCompanyId().equals(leaseApplyInfos.getCompanyId())) {
|
||||
leaseApplyDetail.setParenntId(id);
|
||||
res = leaseApplyDetailsMapper.insert(leaseApplyDetail);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,15 @@
|
|||
where task_id = #{taskId}
|
||||
and company_id = #{companyId}
|
||||
</select>
|
||||
<select id="selectByTaskIdAndCompIdCq" resultType="com.bonus.sgzb.app.domain.LeaseApplyInfo">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
lease_apply_info
|
||||
WHERE
|
||||
task_id = #{taskId}
|
||||
AND company_id IS NULL
|
||||
</select>
|
||||
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
<!--@mbg.generated-->
|
||||
|
|
|
|||
|
|
@ -810,6 +810,75 @@
|
|||
UPDATE lease_apply_info SET lease_person = #{leasePerson}, phone = #{phone}, remark = #{remark}
|
||||
WHERE task_id = #{taskId}
|
||||
</update>
|
||||
<update id="updateLeaseApplyInfoRejectInfoCq">
|
||||
UPDATE
|
||||
lease_apply_info
|
||||
set
|
||||
<trim suffixOverrides=",">
|
||||
<if test="record.examineStatusId == 98 and record.examineStatusId == '98'">
|
||||
company_audit_by = #{record.companyAuditBy},
|
||||
company_audit_time = now(),
|
||||
company_audit_remark = #{record.companyAuditRemark},
|
||||
status = #{record.status},
|
||||
</if>
|
||||
<if test="record.examineStatusId == 99 and record.examineStatusId == '99'">
|
||||
dept_audit_by = #{record.companyAuditBy},
|
||||
dept_audit_time = now(),
|
||||
dept_audit_remark = #{record.companyAuditRemark},
|
||||
status = #{record.status},
|
||||
</if>
|
||||
<if test="record.examineStatusId == 100 and record.examineStatusId == '100'">
|
||||
direct_audit_by = #{record.companyAuditBy},
|
||||
direct_audit_time = now(),
|
||||
direct_audit_remark = #{record.companyAuditRemark},
|
||||
status = #{record.status},
|
||||
</if>
|
||||
</trim>
|
||||
WHERE
|
||||
task_id = #{record.taskId} and company_id is null
|
||||
</update>
|
||||
<update id="updateLeaseApplyInfoAuditInfoCq">
|
||||
UPDATE
|
||||
lease_apply_info
|
||||
set
|
||||
<trim suffixOverrides=",">
|
||||
<if test="record.examineStatusId == 30 and record.examineStatusId == '30'">
|
||||
company_audit_by = #{record.companyAuditBy},
|
||||
company_audit_time = now(),
|
||||
company_audit_remark = #{record.companyAuditRemark},
|
||||
</if>
|
||||
<if test="record.examineStatusId == 31 and record.examineStatusId == '31'">
|
||||
dept_audit_by = #{record.companyAuditBy},
|
||||
dept_audit_time = now(),
|
||||
dept_audit_remark = #{record.companyAuditRemark},
|
||||
status = #{record.status},
|
||||
</if>
|
||||
<if test="record.examineStatusId == 32 and record.examineStatusId == '32'">
|
||||
direct_audit_by = #{record.companyAuditBy},
|
||||
direct_audit_time = now(),
|
||||
direct_audit_remark = #{record.companyAuditRemark},
|
||||
status = #{record.status},
|
||||
</if>
|
||||
<if test="record.examineStatusId == 33 and record.examineStatusId == '33'">
|
||||
update_by = #{record.companyAuditBy},
|
||||
update_time = now(),
|
||||
</if>
|
||||
<if test="record.examineStatusId == 34 and record.examineStatusId == '34'">
|
||||
update_by = #{record.companyAuditBy},
|
||||
update_time = now(),
|
||||
</if>
|
||||
<if test="record.examineStatusId == 35 and record.examineStatusId == '35'">
|
||||
update_by = #{record.companyAuditBy},
|
||||
update_time = now(),
|
||||
</if>
|
||||
<if test="record.examineStatusId == 117 and record.examineStatusId == '117'">
|
||||
update_by = #{record.companyAuditBy},
|
||||
update_time = now(),
|
||||
</if>
|
||||
</trim>
|
||||
WHERE
|
||||
task_id = #{record.taskId} and company_id is null
|
||||
</update>
|
||||
|
||||
<select id="getAgreementIdByUnit" resultType="java.lang.Integer">
|
||||
select agreement_id from bm_agreement_info
|
||||
|
|
|
|||
Loading…
Reference in New Issue