|
@@ -1,14 +1,20 @@
|
|
|
package cn.ezhizao.project.business.workOrder.service.impl;
|
|
|
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.time.ZoneId;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
import javax.annotation.Resource;
|
|
|
+
|
|
|
+import cn.ezhizao.common.utils.SecurityUtils;
|
|
|
+import cn.ezhizao.project.business.entrust.mapper.BizEntrustMapper;
|
|
|
+import cn.ezhizao.project.business.order.mapper.BizArchiveInputMapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import cn.ezhizao.project.business.workOrder.mapper.BizWorkOrderMapper;
|
|
|
import cn.ezhizao.project.business.workOrder.domain.BizWorkOrder;
|
|
|
import cn.ezhizao.project.business.workOrder.service.IBizWorkOrderService;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
/**
|
|
|
* 工单信息Service业务层处理
|
|
@@ -19,8 +25,17 @@ import cn.ezhizao.project.business.workOrder.service.IBizWorkOrderService;
|
|
|
@Service
|
|
|
public class BizWorkOrderServiceImpl extends ServiceImpl<BizWorkOrderMapper, BizWorkOrder> implements IBizWorkOrderService
|
|
|
{
|
|
|
+ @Resource
|
|
|
+ private BizArchiveInputMapper bizArchiveInputMapper;
|
|
|
@Resource
|
|
|
private BizWorkOrderMapper bizWorkOrderMapper;
|
|
|
+ @Resource
|
|
|
+ private BizEntrustMapper bizEntrustMapper;
|
|
|
+ final String[] reportTaskTableNames = {"biz_financial_individual_income_tax", "biz_financial_keep_account", "biz_financial_receive_ticket", "biz_financial_report_tax", "biz_financial_salary"};
|
|
|
+
|
|
|
+ final String[] housingFundTaskTableNames = {"biz_housing_fund_confirm", "biz_housing_fund_declare"};
|
|
|
+
|
|
|
+ final String[] socialSecurityTaskTableNames = {"biz_social_security_confirm", "biz_social_security_declare"};
|
|
|
|
|
|
/**
|
|
|
* 查询工单信息列表
|
|
@@ -57,8 +72,37 @@ public class BizWorkOrderServiceImpl extends ServiceImpl<BizWorkOrderMapper, Bi
|
|
|
return bizWorkOrderMapper.stopTasks(tableValues);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void continueStop(List<BizWorkOrder> list) {
|
|
|
+
|
|
|
+ for(BizWorkOrder bizWorkOrder : list){
|
|
|
+// Date endMonth = bizWorkOrder.getEndMonth();
|
|
|
+ //工单实际结束时间,代理记账要多一个月
|
|
|
+ Date endDate;
|
|
|
+ LocalDate now = LocalDate.now();
|
|
|
+ // 获取上一个月的第一天
|
|
|
+ LocalDate firstDayOfLastMonth = now.minusMonths(1).withDayOfMonth(1);
|
|
|
+ LocalDate firstDayOfMonth = now.withDayOfMonth(1);
|
|
|
+ if (bizWorkOrder.getTaskTypeId()==1){
|
|
|
+ // 将 LocalDate 对象转换为 Date 对象
|
|
|
+ endDate = Date.from(firstDayOfLastMonth.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
|
|
+ if(endDate.compareTo(bizWorkOrder.getEndMonth())>0){
|
|
|
+ //endDate = Date.from(firstDayOfMonth.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
|
|
+ bizEntrustMapper.deleteByDate(bizWorkOrder.getId(),endDate,bizWorkOrder.getTaskTypeId(), SecurityUtils.getUserId());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ // 将 LocalDate 对象转换为 Date 对象
|
|
|
+ endDate = Date.from(firstDayOfMonth.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
|
|
+ if(endDate.compareTo(bizWorkOrder.getEndMonth())>0){
|
|
|
+ bizEntrustMapper.deleteByDate(bizWorkOrder.getId(),endDate,bizWorkOrder.getTaskTypeId(), SecurityUtils.getUserId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public int setContinue(List<Long> ids, Integer state) {
|
|
|
+
|
|
|
return bizWorkOrderMapper.setContinue(ids, state);
|
|
|
}
|
|
|
|
|
@@ -76,5 +120,50 @@ public class BizWorkOrderServiceImpl extends ServiceImpl<BizWorkOrderMapper, Bi
|
|
|
bizWorkOrderMapper.updateByWorkOrderId(ids);
|
|
|
}
|
|
|
|
|
|
+ public boolean stopLoopTasks(BizWorkOrder workOrder) {
|
|
|
+ if (workOrder.getTaskTypeId() == 1L) {
|
|
|
+ return stopReportTask(workOrder);
|
|
|
+ } else if (workOrder.getTaskTypeId() == 2L) {
|
|
|
+ return stopSocialSecurity(workOrder);
|
|
|
+ } else if (workOrder.getTaskTypeId() == 3L) {
|
|
|
+ return stopHousingFund(workOrder);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ private boolean stopHousingFund(BizWorkOrder workOrder) {
|
|
|
+ List<Map<String, Object>> maps = Arrays.stream(housingFundTaskTableNames).map(v -> {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("tableName", v);
|
|
|
+ map.put("workOrderId", workOrder.getId());
|
|
|
+ map.put("is_continue", 0);
|
|
|
+ return map;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ this.stopTasks(maps);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ private boolean stopSocialSecurity(BizWorkOrder workOrder) {
|
|
|
+ List<Map<String, Object>> maps = Arrays.stream(socialSecurityTaskTableNames).map(v -> {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("tableName", v);
|
|
|
+ map.put("workOrderId", workOrder.getId());
|
|
|
+ map.put("is_continue", 0);
|
|
|
+ return map;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ this.stopTasks(maps);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
+ private boolean stopReportTask(BizWorkOrder workOrder) {
|
|
|
+ List<Map<String, Object>> maps = Arrays.stream(reportTaskTableNames).map(v -> {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("tableName", v);
|
|
|
+ map.put("workOrderId", workOrder.getId());
|
|
|
+ map.put("is_continue", 0);
|
|
|
+ return map;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ this.stopTasks(maps);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|