提交 8efcb418 编写于 作者: misaka's avatar misaka

update

上级 8d8709f8
......@@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.context.annotation.Primary;
import org.springframework.util.NumberUtils;
import java.math.BigDecimal;
import java.sql.Timestamp;
......@@ -329,10 +330,10 @@ public class Purchase_orderExService extends Purchase_orderServiceImpl {
public Purchase_order calc_amount(Purchase_order et) {
Purchase_order_lineSearchContext ctx = new Purchase_order_lineSearchContext() ;
ctx.setN_order_id_eq(et.getId());
Map calc = purchaseOrderLineService.searchCalc_order_amount(ctx).getContent().get(0);
et.setAmountTax(BigDecimal.valueOf((Double)calc.get("price_tax")));
et.setAmountUntaxed((BigDecimal)calc.get("price_subtotal"));
et.setAmountTotal((BigDecimal)calc.get("price_total"));
Map<String,Number> calc = purchaseOrderLineService.searchCalc_order_amount(ctx).getContent().get(0);
et.setAmountTax(NumberUtils.convertNumberToTargetClass(calc.get("price_tax"),BigDecimal.class));
et.setAmountUntaxed(NumberUtils.convertNumberToTargetClass(calc.get("price_tax"),BigDecimal.class));
et.setAmountTotal(NumberUtils.convertNumberToTargetClass(calc.get("price_tax"),BigDecimal.class));
this.update(et);
return super.calc_amount(et);
}
......
package cn.ibizlab.businesscentral.core.config;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.convert.converter.Converter;
import org.springframework.core.convert.support.GenericConversionService;
import org.springframework.util.NumberUtils;
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
import javax.annotation.PostConstruct;
@Configuration
public class UndefinedConvertConfiguration {
@Autowired
private RequestMappingHandlerAdapter requestMappingHandlerAdapter;
@PostConstruct
public void addConversionConfig() {
ConfigurableWebBindingInitializer initializer = (ConfigurableWebBindingInitializer) requestMappingHandlerAdapter.getWebBindingInitializer();
if (initializer.getConversionService() != null) {
GenericConversionService genericConversionService = (GenericConversionService)initializer.getConversionService();
genericConversionService.addConverter(new Converter<String, Long>() {
@Override
public Long convert(String source) {
if(StringUtils.compare("undefined",source)==0)
return 0l;
return NumberUtils.parseNumber(source, Long.class);
}
}) ;
}
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册