|  |  | @ -12,10 +12,12 @@ import com.epmet.commons.tools.utils.Result; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.constant.DataSourceConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dao.evaluationindex.indexcoll.ScreenPyHistoryScoreDao; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dao.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailDao; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dao.evaluationindex.indexcoll.ScreenPyWeightConfigurationDao; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.dto.govorg.result.GridLivelyResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dataaggre.feign.DataAggregatorOpenFeignClient; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.indexcollect.ScreenPyHistoryScoreDetailDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.indexcollect.ScreenPyWeightConfigurationDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.indexcollect.form.HistoryScoreComputeFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.indexcollect.form.HistoryScoreFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO; | 
			
		
	
	
		
			
				
					|  |  | @ -34,6 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.stereotype.Service; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | import java.math.BigDecimal; | 
			
		
	
		
			
				
					|  |  |  | import java.text.NumberFormat; | 
			
		
	
		
			
				
					|  |  |  | import java.util.ArrayList; | 
			
		
	
		
			
				
					|  |  |  | import java.util.List; | 
			
		
	
	
		
			
				
					|  |  | @ -56,6 +59,8 @@ public class ScreenPyHistoryScoreServiceImpl implements ScreenPyHistoryScoreServ | 
			
		
	
		
			
				
					|  |  |  |     private ScreenPyHistoryScoreDetailDao screenPyHistoryScoreDetailDao; | 
			
		
	
		
			
				
					|  |  |  |     @Autowired | 
			
		
	
		
			
				
					|  |  |  |     private DataAggregatorOpenFeignClient dataAggregatorOpenFeignClient; | 
			
		
	
		
			
				
					|  |  |  |     @Autowired | 
			
		
	
		
			
				
					|  |  |  |     private ScreenPyWeightConfigurationDao screenPyWeightConfigurationDao; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     @Override | 
			
		
	
	
		
			
				
					|  |  | @ -73,11 +78,18 @@ public class ScreenPyHistoryScoreServiceImpl implements ScreenPyHistoryScoreServ | 
			
		
	
		
			
				
					|  |  |  |         ScreenPyHistoryScoreEntity entity = ConvertUtils.sourceToTarget(formDTO, ScreenPyHistoryScoreEntity.class); | 
			
		
	
		
			
				
					|  |  |  |         screenPyHistoryScoreDao.insert(entity); | 
			
		
	
		
			
				
					|  |  |  |         //2.明细表新增数据
 | 
			
		
	
		
			
				
					|  |  |  |         ScreenPyWeightConfigurationDTO wcDTO = screenPyWeightConfigurationDao.selectOneDTO(); | 
			
		
	
		
			
				
					|  |  |  |         List<ScreenPyHistoryScoreDetailEntity> list = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |         formDTO.getDetailList().forEach(dto -> { | 
			
		
	
		
			
				
					|  |  |  |             ScreenPyHistoryScoreDetailEntity detailEntity = ConvertUtils.sourceToTarget(dto, ScreenPyHistoryScoreDetailEntity.class); | 
			
		
	
		
			
				
					|  |  |  |             detailEntity.setCustomerId(formDTO.getCustomerId()); | 
			
		
	
		
			
				
					|  |  |  |             detailEntity.setHistoryScoreId(entity.getId()); | 
			
		
	
		
			
				
					|  |  |  |             if (null != wcDTO) { | 
			
		
	
		
			
				
					|  |  |  |                 BigDecimal nldf = detailEntity.getWghyd().multiply(wcDTO.getWghyd()).add(detailEntity.getWghyd().multiply(wcDTO.getWghyd())) | 
			
		
	
		
			
				
					|  |  |  |                         .add(detailEntity.getWghyd().multiply(wcDTO.getWghyd())).add(detailEntity.getWghyd().multiply(wcDTO.getWghyd())) | 
			
		
	
		
			
				
					|  |  |  |                         .add(detailEntity.getWghyd().multiply(wcDTO.getWghyd())).add(detailEntity.getWghyd().multiply(wcDTO.getWghyd())); | 
			
		
	
		
			
				
					|  |  |  |                 detailEntity.setNldf(nldf); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             list.add(detailEntity); | 
			
		
	
		
			
				
					|  |  |  |         }); | 
			
		
	
		
			
				
					|  |  |  |         screenPyHistoryScoreDetailServiceImpl.insertBatch(list); | 
			
		
	
	
		
			
				
					|  |  | @ -96,10 +108,17 @@ public class ScreenPyHistoryScoreServiceImpl implements ScreenPyHistoryScoreServ | 
			
		
	
		
			
				
					|  |  |  |         screenPyHistoryScoreDao.updateById(newEntity); | 
			
		
	
		
			
				
					|  |  |  |         //2.更新字表 字表先删后增
 | 
			
		
	
		
			
				
					|  |  |  |         List<ScreenPyHistoryScoreDetailEntity> list = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |         ScreenPyWeightConfigurationDTO wcDTO = screenPyWeightConfigurationDao.selectOneDTO(); | 
			
		
	
		
			
				
					|  |  |  |         formDTO.getDetailList().forEach(dto -> { | 
			
		
	
		
			
				
					|  |  |  |             ScreenPyHistoryScoreDetailEntity detailEntity = ConvertUtils.sourceToTarget(dto, ScreenPyHistoryScoreDetailEntity.class); | 
			
		
	
		
			
				
					|  |  |  |             detailEntity.setCustomerId(entity.getCustomerId()); | 
			
		
	
		
			
				
					|  |  |  |             detailEntity.setHistoryScoreId(entity.getId()); | 
			
		
	
		
			
				
					|  |  |  |             if (null != wcDTO) { | 
			
		
	
		
			
				
					|  |  |  |                 BigDecimal nldf = detailEntity.getWghyd().multiply(wcDTO.getWghyd()).add(detailEntity.getWghyd().multiply(wcDTO.getWghyd())) | 
			
		
	
		
			
				
					|  |  |  |                         .add(detailEntity.getWghyd().multiply(wcDTO.getWghyd())).add(detailEntity.getWghyd().multiply(wcDTO.getWghyd())) | 
			
		
	
		
			
				
					|  |  |  |                         .add(detailEntity.getWghyd().multiply(wcDTO.getWghyd())).add(detailEntity.getWghyd().multiply(wcDTO.getWghyd())); | 
			
		
	
		
			
				
					|  |  |  |                 detailEntity.setNldf(nldf); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |             list.add(detailEntity); | 
			
		
	
		
			
				
					|  |  |  |         }); | 
			
		
	
		
			
				
					|  |  |  |         screenPyHistoryScoreDetailDao.delByHistoryScoreId(formDTO.getId(), formDTO.getUserId()); | 
			
		
	
	
		
			
				
					|  |  | 
 |