|
@@ -51,13 +51,16 @@ public class FormulaDaoImpl implements IFormulaDao {
|
|
|
public Function<Long,MeterPeriodInfo> getMeterPeriod(){
|
|
|
return id-> {
|
|
|
List<MeterPeriodInfo> beans = this.jdbcTemplate.query("select period_number periodNumber,period_name periodName,form_print_date formPrintDate from s_meter_period where id= "+id, new BeanPropertyRowMapper<>(MeterPeriodInfo.class));
|
|
|
-
|
|
|
if(beans.size()>0){
|
|
|
MeterPeriodInfo bean = beans.get(0);
|
|
|
List<Map<String,Object>> listMap= this.jdbcTemplate.queryForList("select sum(b.current_amount) currentAmount from s_meter_period a join s_meter_period b on (a.contract_id=b.contract_id and a.type=b.type) where a.id="+id+" and b.id<>"+id);
|
|
|
if(listMap.size()>0) {
|
|
|
- bean.setPreTotal(StringUtils.number2String(listMap.get(0).get("currentAmount").toString(),2));
|
|
|
+ String str=StringUtils.handleNull(listMap.get(0).get("currentAmount"));
|
|
|
+ if(StringUtils.isNumber(str)) {
|
|
|
+ bean.setPreTotal(StringUtils.number2String(str, 2));
|
|
|
+ }
|
|
|
}
|
|
|
+ return bean;
|
|
|
}
|
|
|
return new MeterPeriodInfo();
|
|
|
};
|
|
@@ -66,7 +69,7 @@ public class FormulaDaoImpl implements IFormulaDao {
|
|
|
@Override
|
|
|
public Function<Long, List<Material>> getMaterialForm() {
|
|
|
return id->{
|
|
|
- List<Map<String,Object>> mapList = this.jdbcTemplate.queryForList("select b.material_name name,b.unit,b.price,a.meter_amount amount,a.material_source source,material_conform materialConform,a.storage_place storagePlace,a.storage_status storageStatus,a.storage_conform storageConform,a.remark from s_material_meter_form a left join s_contract_material b on a.contract_material_id = b.id where a.meter_period_id="+id+" and a.is_deleted=0");
|
|
|
+ List<Map<String,Object>> mapList = this.jdbcTemplate.queryForList("select b.material_name name,b.unit,b.price,a.meter_amount amount,meter_money sum,a.material_source source,material_conform materialConform,a.storage_place storagePlace,a.storage_status storageStatus,a.storage_conform storageConform,a.remark from s_material_meter_form a left join s_contract_material b on a.contract_material_id = b.id where a.meter_period_id="+id+" and a.is_deleted=0");
|
|
|
if(Func.isNotEmpty(mapList)){
|
|
|
return mapList.stream().map(m->BeanUtil.toBean(m,Material.class)).collect(Collectors.toList());
|
|
|
}
|