Commit 66796549 authored by hezhuozhi's avatar hezhuozhi

35359 超设计使用年限后端详情,删除,保存,撤回接口开发

parent 4ded1b4c
......@@ -2,7 +2,7 @@ package com.yeejoin.amos.boot.module.jg.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
......
......@@ -2,7 +2,7 @@ package com.yeejoin.amos.boot.module.jg.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
......
package com.yeejoin.amos.boot.module.jg.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
......@@ -15,6 +16,8 @@ import org.springframework.web.bind.annotation.*;
import com.yeejoin.amos.boot.module.jg.api.entity.JgOverDesignServiceLife;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import java.util.Collections;
import java.util.List;
/**
......@@ -66,10 +69,17 @@ public class JgOverDesignServiceLifeController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除", notes = "根据sequenceNbr删除")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(jgOverDesignServiceLifeServiceImpl.removeById(sequenceNbr));
public ResponseModel<Boolean> deleteBySequenceNbr(@PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(jgOverDesignServiceLifeServiceImpl.deleteBatchBySequenceNbrs(Collections.singletonList(sequenceNbr)));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/deleteBatch")
@ApiOperation(httpMethod = "POST", value = "批量删除", notes = "批量删除")
public ResponseModel<Boolean> deleteBySequenceNbr(@RequestBody JSONObject map){
List<Long> ids = (List<Long>) map.get("ids");
return ResponseHelper.buildResponse(jgOverDesignServiceLifeServiceImpl.deleteBatchBySequenceNbrs(ids));
}
/**
* 根据sequenceNbr查询
*
......@@ -80,7 +90,7 @@ public class JgOverDesignServiceLifeController extends BaseController {
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个", notes = "根据sequenceNbr查询单个")
public ResponseModel<JgOverDesignServiceLife> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(jgOverDesignServiceLifeServiceImpl.queryBySeq(sequenceNbr));
return ResponseHelper.buildResponse(jgOverDesignServiceLifeServiceImpl.detail(sequenceNbr));
}
/**
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.yeejoin.amos.boot.module.jg.api.entity.JgOverDesignServiceLife;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgOverDesignServiceLifeMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgOverDesignServiceLifeService;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
import java.util.Objects;
/**
* 服务实现类
......@@ -16,6 +23,12 @@ import java.util.List;
*/
@Service
public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesignServiceLife,JgOverDesignServiceLife,JgOverDesignServiceLifeMapper> implements IJgOverDesignServiceLifeService {
@Autowired
private CommonServiceImpl commonService;
@Autowired
private JgOverDesignServiceLifeEqServiceImpl jgOverDesignServiceLifeEqService;
@Autowired
private JgRegistrationHistoryServiceImpl jgRegistrationHistoryService;
/**
* 分页查询
*/
......@@ -29,4 +42,37 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
public List<JgOverDesignServiceLife> queryForJgOverDesignServiceLifeList() {
return this.queryForList("" , false);
}
@Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class)
public Boolean deleteBatchBySequenceNbrs(List<Long> sequenceNbrs) {
if (CollUtil.isNotEmpty(sequenceNbrs)) {
for (Long sequenceNbr : sequenceNbrs) {
JgOverDesignServiceLife overDesignServiceLife = this.baseMapper.selectById(sequenceNbr);
// 删除代办 + 中止流程
commonService.deleteTaskModel(String.valueOf(sequenceNbr), overDesignServiceLife.getInstanceId());
// 删除单子
LambdaUpdateWrapper<JgOverDesignServiceLife> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(JgOverDesignServiceLife::getSequenceNbr, sequenceNbr).set(JgOverDesignServiceLife::getIsDelete, true);
this.update(updateWrapper);
// 更新 eq 对应数据的 isDelete 字段为true(逻辑删除)
LambdaUpdateWrapper<JgOverDesignServiceLifeEq> overDesignServiceLifeEqWrapper = new LambdaUpdateWrapper<JgOverDesignServiceLifeEq>()
.eq(JgOverDesignServiceLifeEq::getEquId, sequenceNbr)
.set(JgOverDesignServiceLifeEq::getIsDelete, true);
jgOverDesignServiceLifeEqService.getBaseMapper().update(null,overDesignServiceLifeEqWrapper);
// 删除单子对应历史表数据
jgRegistrationHistoryService.getBaseMapper().update(null,
new LambdaUpdateWrapper<JgRegistrationHistory>()
.eq(JgRegistrationHistory::getCurrentDocumentId, overDesignServiceLife.getApplyNo())
.set(JgRegistrationHistory::getIsDelete, true)
);
}
}
return Boolean.TRUE;
}
public JgOverDesignServiceLife detail(Long sequenceNbr) {
return null;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment