|
@@ -33,6 +33,7 @@ import org.springblade.core.mp.base.BaseServiceImpl;
|
|
import org.springblade.meter.utils.ForestNodeMerger;
|
|
import org.springblade.meter.utils.ForestNodeMerger;
|
|
import org.springblade.meter.vo.*;
|
|
import org.springblade.meter.vo.*;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
@@ -71,7 +72,7 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
|
|
* 添加清单
|
|
* 添加清单
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public List<ResolveInventoryVO> addFormList(Long contractId,Long contractPeriodId,Long nodeId ,String ids) {
|
|
|
|
|
|
+ public List<ResolveInventoryVO> addFormList(Long id,Long contractId,Long contractPeriodId,Long nodeId ,String ids) {
|
|
//获取当前节点下关联的清单,如果没有直接返回
|
|
//获取当前节点下关联的清单,如果没有直接返回
|
|
List<ResolveInventoryVO> vos = new ArrayList<>();
|
|
List<ResolveInventoryVO> vos = new ArrayList<>();
|
|
List<Long> list = formMeterService.getNodeAllForm(nodeId);
|
|
List<Long> list = formMeterService.getNodeAllForm(nodeId);
|
|
@@ -79,7 +80,7 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
|
|
return vos;
|
|
return vos;
|
|
}
|
|
}
|
|
//获取当前计量期,当前节点下其他申请所包含的清单
|
|
//获取当前计量期,当前节点下其他申请所包含的清单
|
|
- List<Long> formIds = baseMapper.getNodeOtherFormId(contractId,contractPeriodId,nodeId);
|
|
|
|
|
|
+ List<Long> formIds = baseMapper.getNodeOtherFormId(id,contractId,contractPeriodId,nodeId);
|
|
if (formIds.size() != 0){
|
|
if (formIds.size() != 0){
|
|
list.removeAll(formIds);
|
|
list.removeAll(formIds);
|
|
}
|
|
}
|
|
@@ -195,8 +196,8 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public MiddleMeterTokenVO getNodeToken(Long contractId,Long nodeId, String formIds, String businessDate) {
|
|
public MiddleMeterTokenVO getNodeToken(Long contractId,Long nodeId, String formIds, String businessDate) {
|
|
- if (nodeId == null || StringUtils.isBlank(formIds) || StringUtils.isBlank(businessDate)){
|
|
|
|
- throw new ServiceException("请求参数错误,请检查是否有节点id,业务日期,和计量清单");
|
|
|
|
|
|
+ if (contractId == null || nodeId == null || StringUtils.isBlank(businessDate)){
|
|
|
|
+ throw new ServiceException("请求参数错误,请检查是否有节点id,业务日期");
|
|
}
|
|
}
|
|
MiddleMeterTokenVO vo = new MiddleMeterTokenVO();
|
|
MiddleMeterTokenVO vo = new MiddleMeterTokenVO();
|
|
//当前没有清单就没有变更令
|
|
//当前没有清单就没有变更令
|
|
@@ -458,6 +459,48 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
|
|
return baseMapper.getCurrentMeterMoney(middleMeterApply.getContractId(),middleMeterApply.getContractPeriodId());
|
|
return baseMapper.getCurrentMeterMoney(middleMeterApply.getContractId(),middleMeterApply.getContractPeriodId());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 异步重新计算受变更影响的中间计量申请附件,ids为中间计量申请和清单表的id,需要重新获取
|
|
|
|
+ * @param ids
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional
|
|
|
|
+ @Async
|
|
|
|
+ public void asyncCalculateMiddleMeter(List<Long> ids) {
|
|
|
|
+ //等待一秒
|
|
|
|
+ try {
|
|
|
|
+ Thread.sleep(1000L);
|
|
|
|
+ } catch (InterruptedException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ //根据中间表id获取中间计量申请表id,并且去重
|
|
|
|
+ Set<Long> middleIds = baseMapper.getMiddleIds(ids);
|
|
|
|
+ //获取所有的中间计量申请,并且携带所有关联的中间表的清单ids
|
|
|
|
+ List<MiddleMeterApplyVO2> vo2s = baseMapper.getAllAPPlyAndForm(middleIds);
|
|
|
|
+ //删除所有id的变更附件
|
|
|
|
+ attachmentFormService.deleteByMasterIds(middleIds);
|
|
|
|
+ //调用方法获取最新的变更编号,变更令,附件信息
|
|
|
|
+ List<AttachmentForm> fs = new ArrayList<>();
|
|
|
|
+ for (MiddleMeterApplyVO2 vo2 : vo2s) {
|
|
|
|
+ MiddleMeterTokenVO vo = this.getNodeToken(vo2.getContractId(), vo2.getContractUnitId(), vo2.getFormIds(), vo2.getBusinessDate().toString());
|
|
|
|
+ vo2.setChangeTokenNumber(vo.getChangeTokenNumber());
|
|
|
|
+ vo2.setChangeTokenIds(vo.getChangeTokenIds());
|
|
|
|
+ if (vo.getFiles() != null){
|
|
|
|
+ List<AttachmentForm> files = vo.getFiles();
|
|
|
|
+ for (AttachmentForm file : files) {
|
|
|
|
+ file.setMasterId(vo2.getId());
|
|
|
|
+ fs.add(file);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //批量修改变更编号,变更令
|
|
|
|
+ baseMapper.batchUpdateMiddle(vo2s);
|
|
|
|
+ //批量新增附件信息
|
|
|
|
+ if (fs.size() > 0) {
|
|
|
|
+ attachmentFormService.saveBatch(fs);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public String test() {
|
|
public String test() {
|
|
Long contractId = 1612329251049537537L;
|
|
Long contractId = 1612329251049537537L;
|