|
@@ -21,26 +21,32 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.springblade.business.controller.EntrustInfoController;
|
|
|
import org.springblade.business.entity.EntrustInfo;
|
|
|
+import org.springblade.business.entity.InformationQuery;
|
|
|
+import org.springblade.business.entity.Task;
|
|
|
import org.springblade.business.mapper.EntrustInfoMapper;
|
|
|
import org.springblade.business.service.IEntrustInfoService;
|
|
|
+import org.springblade.business.service.IInformationQueryService;
|
|
|
import org.springblade.business.vo.EntrustDataInfoVO;
|
|
|
import org.springblade.business.vo.EntrustInfoVO;
|
|
|
import org.springblade.business.vo.LoadDataInfoVO;
|
|
|
import org.springblade.business.vo.TrialSampleDataInfoVO;
|
|
|
+import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
|
+import org.springblade.core.secure.utils.SecureUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
import org.springblade.manager.entity.WbsTreePrivate;
|
|
|
import org.springblade.manager.feign.ExcelTabClient;
|
|
|
import org.springblade.manager.feign.WbsTreePrivateClient;
|
|
|
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 委托单信息表 服务实现类
|
|
@@ -56,8 +62,9 @@ public class EntrustInfoServiceImpl extends BaseServiceImpl<EntrustInfoMapper, E
|
|
|
private final JdbcTemplate jdbcTemplate;
|
|
|
private final WbsTreePrivateClient wbsTreePrivateClient;
|
|
|
private final EntrustInfoMapper entrustInfoMapper;
|
|
|
+ private final IInformationQueryService informationQueryService;
|
|
|
|
|
|
- @Override
|
|
|
+ @Override
|
|
|
public IPage<EntrustInfoVO> selectEntrustInfoPage(IPage<EntrustInfoVO> page, EntrustInfoVO entrustInfo) {
|
|
|
return page.setRecords(baseMapper.selectEntrustInfoPage(page, entrustInfo));
|
|
|
}
|
|
@@ -158,7 +165,10 @@ public class EntrustInfoServiceImpl extends BaseServiceImpl<EntrustInfoMapper, E
|
|
|
}
|
|
|
}
|
|
|
entrustInfo.setEntrustName(wbsTreePrivate.getNodeName());
|
|
|
- this.saveOrUpdate(entrustInfo);
|
|
|
+ if(dataInfo.containsKey("id")){
|
|
|
+ entrustInfo.setId(Long.parseLong(dataInfo.get("id").toString()));
|
|
|
+ }
|
|
|
+ this.saveOrUpdate(entrustInfo);
|
|
|
dataInfo.put("groupId",entrustInfo.getId());
|
|
|
dataInfo.put("pkeyId", dataInfo.getString("nodeErTreeId"));
|
|
|
excelTabClient.saveEntrustTabData(dataInfo);
|
|
@@ -204,4 +214,50 @@ public class EntrustInfoServiceImpl extends BaseServiceImpl<EntrustInfoMapper, E
|
|
|
}
|
|
|
return R.success("操作成功");
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public R annul(String id) {
|
|
|
+ if (ObjectUtil.isEmpty(SecureUtil.getUserId()) || SecureUtil.getUserId() == -1L) {
|
|
|
+ throw new ServiceException("未获取到当前用户信息");
|
|
|
+ }
|
|
|
+ String[] ids = id.split(",");
|
|
|
+ List<String>formDataIds=new ArrayList<>();
|
|
|
+ if(ids.length>0){
|
|
|
+ for (String i : ids) {
|
|
|
+ EntrustInfo entrustInfo = entrustInfoMapper.selectById(Long.parseLong(i));
|
|
|
+ if(entrustInfo.getStatus()!=2&&entrustInfo.getStatus()!=3){
|
|
|
+ throw new ServiceException("该委托单不能废除"+entrustInfo.getEntrustNo());
|
|
|
+ }
|
|
|
+ entrustInfo.setEntrustEPdf(null);
|
|
|
+ entrustInfo.setStatus(1);
|
|
|
+ entrustInfoMapper.updateById(entrustInfo);
|
|
|
+ }
|
|
|
+ List<InformationQuery> queryList = this.informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getId, Arrays.asList(ids)));
|
|
|
+ if (queryList.size() == 0) {
|
|
|
+ //试验填报数据
|
|
|
+ queryList = new ArrayList<>(this.informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, Arrays.asList(ids))));
|
|
|
+ //重新绑定trialSelfInspectionRecordId使用map
|
|
|
+ //试验记录 和 委托单 ids重新赋值映射为数据源ids
|
|
|
+ formDataIds = queryList.stream().map(InformationQuery::getId).map(String::valueOf).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ if(formDataIds.size()>0){
|
|
|
+ for (String formDataId : formDataIds) {
|
|
|
+ String sql="Select * from u_task where form_data_id="+formDataId +" and status!=3 and is_deleted=0";
|
|
|
+ Task task = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(Task.class));
|
|
|
+ if(task!=null){
|
|
|
+ String updateTaskParallel="update u_task_parallel set status=3 where process_instance_id='" + task.getProcessInstanceId() + "'";
|
|
|
+ String updateTask="update u_task set status=3 where id="+task.getId()+" and status!=3 and is_deleted=0";
|
|
|
+ String deleted="DELETE u_task_batch WHERE JSON_EXTRACT(json_data,'$.taskId')="+task.getId();
|
|
|
+ jdbcTemplate.update(updateTaskParallel);
|
|
|
+ jdbcTemplate.update(updateTask);
|
|
|
+ jdbcTemplate.execute(deleted);
|
|
|
+ }
|
|
|
+ String updateinformationQuery="update u_information_query set status=3,e_visa_pdf_url= null where id="+formDataId;
|
|
|
+ jdbcTemplate.update(updateinformationQuery);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return R.success("操作成功");
|
|
|
+ }
|
|
|
}
|