|
@@ -25,7 +25,6 @@ import cn.ezhizao.project.business.workOrder.service.IBizWorkOrderService;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import lombok.Getter;
|
|
import lombok.Getter;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
@@ -86,12 +85,19 @@ public class BizRecycleBinController extends BaseController {
|
|
"biz_housing_fund_confirm_detail", "biz_housing_fund_confirm_detail_employee", "biz_housing_fund_declare", "biz_housing_fund_declare_detail",
|
|
"biz_housing_fund_confirm_detail", "biz_housing_fund_confirm_detail_employee", "biz_housing_fund_declare", "biz_housing_fund_declare_detail",
|
|
"biz_social_security_confirm", "biz_social_security_confirm_detail", "biz_social_security_confirm_detail_employee",
|
|
"biz_social_security_confirm", "biz_social_security_confirm_detail", "biz_social_security_confirm_detail_employee",
|
|
"biz_social_security_declare", "biz_social_security_declare_detail"};
|
|
"biz_social_security_declare", "biz_social_security_declare_detail"};
|
|
|
|
+
|
|
//订单关联的数据表
|
|
//订单关联的数据表
|
|
@Getter
|
|
@Getter
|
|
private String[] ordertabs = {"biz_archive_input_detail", "biz_archive_input_detail_process", "biz_work_order", "biz_work_order_detail"
|
|
private String[] ordertabs = {"biz_archive_input_detail", "biz_archive_input_detail_process", "biz_work_order", "biz_work_order_detail"
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ //订单关联的数据表(根据worlOrderId筛选)
|
|
|
|
+ @Getter
|
|
|
|
+ private String[] workOrderTabs = {"biz_financial_individual_income_tax", "biz_financial_keep_account", "biz_financial_receive_ticket", "biz_financial_report_tax",
|
|
|
|
+ "biz_financial_salary"
|
|
|
|
+ };
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 查询回收站列表
|
|
* 查询回收站列表
|
|
*/
|
|
*/
|
|
@@ -209,7 +215,6 @@ public class BizRecycleBinController extends BaseController {
|
|
@PreAuthorize("@ss.hasPermi('business:archive:order:bin')")
|
|
@PreAuthorize("@ss.hasPermi('business:archive:order:bin')")
|
|
@Log(title = "订单回收站", businessType = BusinessType.INSERT)
|
|
@Log(title = "订单回收站", businessType = BusinessType.INSERT)
|
|
@PostMapping("/order/{ids}")
|
|
@PostMapping("/order/{ids}")
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
|
public AjaxResult addOrder(@PathVariable List<Long> ids) throws NoSuchFieldException, IllegalAccessException {
|
|
public AjaxResult addOrder(@PathVariable List<Long> ids) throws NoSuchFieldException, IllegalAccessException {
|
|
|
|
|
|
// 判断是否可以删除
|
|
// 判断是否可以删除
|
|
@@ -254,34 +259,67 @@ public class BizRecycleBinController extends BaseController {
|
|
|
|
|
|
//遍历id查询订单数据数据并在回收站中插入
|
|
//遍历id查询订单数据数据并在回收站中插入
|
|
for (Long id : ids) {
|
|
for (Long id : ids) {
|
|
|
|
+ //订单明细
|
|
|
|
+ BizArchiveInputDetail bizArchiveInputDetail = new BizArchiveInputDetail();
|
|
|
|
+ bizArchiveInputDetail.setContractId(id);
|
|
|
|
+ BizArchiveInputDetail detail = bizArchiveInputDetailService.getDetail(bizArchiveInputDetail);
|
|
|
|
+
|
|
BizArchiveInput archiveInput = new BizArchiveInput();
|
|
BizArchiveInput archiveInput = new BizArchiveInput();
|
|
BizRecycleBin bin = new BizRecycleBin();
|
|
BizRecycleBin bin = new BizRecycleBin();
|
|
archiveInput = bizArchiveInputService.getById(id);
|
|
archiveInput = bizArchiveInputService.getById(id);
|
|
BizCompany com = bizCompanyService.getById(archiveInput.getCompanyId());
|
|
BizCompany com = bizCompanyService.getById(archiveInput.getCompanyId());
|
|
bin.setFromId(0L);
|
|
bin.setFromId(0L);
|
|
bin.setSourceValue(com.getName());
|
|
bin.setSourceValue(com.getName());
|
|
|
|
+ bin.setArchiveCode(archiveInput.getContractNo());
|
|
bin.setSourceTableName("biz_archive_input");
|
|
bin.setSourceTableName("biz_archive_input");
|
|
bin.setSourceId(archiveInput.getId());
|
|
bin.setSourceId(archiveInput.getId());
|
|
setTenantId(bin);
|
|
setTenantId(bin);
|
|
bizRecycleBinService.save(bin);
|
|
bizRecycleBinService.save(bin);
|
|
//软删除订单关联子表数据
|
|
//软删除订单关联子表数据
|
|
- bizRecycleBinService.deleteArchiveData(id, ordertabs);
|
|
|
|
|
|
+ bizRecycleBinService.deleteArchiveData(id,ordertabs);
|
|
|
|
|
|
//查询订单关联子表数据在回收站中插入
|
|
//查询订单关联子表数据在回收站中插入
|
|
- for (String tab : ordertabs) {
|
|
|
|
|
|
+ for (String tab:ordertabs) {
|
|
//查询客户关联子表id
|
|
//查询客户关联子表id
|
|
- Long childId = bizRecycleBinService.getArchiveById(id, tab);
|
|
|
|
|
|
+ Long childId=bizRecycleBinService.getArchiveById(id,tab);
|
|
//如果返回id不为空则将数据插入回收站
|
|
//如果返回id不为空则将数据插入回收站
|
|
- if (childId != null && !childId.equals("")) {
|
|
|
|
- BizRecycleBin rbiz = new BizRecycleBin();
|
|
|
|
|
|
+ if (childId!=null&& !childId.equals("")){
|
|
|
|
+ BizRecycleBin rbiz =new BizRecycleBin();
|
|
rbiz.setFromId(bin.getId());
|
|
rbiz.setFromId(bin.getId());
|
|
rbiz.setSourceValue(com.getName());
|
|
rbiz.setSourceValue(com.getName());
|
|
rbiz.setSourceTableName(tab);
|
|
rbiz.setSourceTableName(tab);
|
|
|
|
+ rbiz.setArchiveCode(archiveInput.getContractNo());
|
|
rbiz.setSourceId(childId);
|
|
rbiz.setSourceId(childId);
|
|
setTenantId(rbiz);
|
|
setTenantId(rbiz);
|
|
bizRecycleBinService.save(rbiz);
|
|
bizRecycleBinService.save(rbiz);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ //合同工单
|
|
|
|
+ BizWorkOrderDetail workOrderDetaul = new BizWorkOrderDetail();
|
|
|
|
+ workOrderDetaul.setContractDetailId(detail.getId());
|
|
|
|
+ workOrderDetaul.setTaskTypeId(1L);
|
|
|
|
+ BizWorkOrderDetail orderDetail = bizWorkOrderDetailService.getDetail(workOrderDetaul);
|
|
|
|
+
|
|
|
|
+ if (orderDetail != null) {
|
|
|
|
+ //查询订单任务关联子表数据在回收站中插入
|
|
|
|
+ for (String tab : workOrderTabs) {
|
|
|
|
+ //查询客户关联子表id
|
|
|
|
+ Long childId = bizRecycleBinService.getWorkOrderDitailById(orderDetail.getWorkOrderId(), tab);
|
|
|
|
+ //如果返回id不为空则将数据插入回收站
|
|
|
|
+ if (childId != null && !childId.equals("")) {
|
|
|
|
+ BizRecycleBin rbiz = new BizRecycleBin();
|
|
|
|
+ rbiz.setFromId(bin.getId());
|
|
|
|
+ rbiz.setSourceValue(com.getName());
|
|
|
|
+ rbiz.setArchiveCode(archiveInput.getContractNo());
|
|
|
|
+ rbiz.setSourceTableName(tab);
|
|
|
|
+ rbiz.setSourceId(childId);
|
|
|
|
+ setTenantId(rbiz);
|
|
|
|
+ bizRecycleBinService.save(rbiz);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return toAjax(bizArchiveInputService.removeBinByIds(ids));
|
|
return toAjax(bizArchiveInputService.removeBinByIds(ids));
|
|
}
|
|
}
|