新增彩印通成本
This commit is contained in:
@@ -379,6 +379,7 @@ public class ProductController {
|
||||
}
|
||||
product.setRole(user.getRole());
|
||||
PricingStrategy pricingStrategy = PricingStrategyFactory.getStrategy(product.getProTypeValue());
|
||||
assert pricingStrategy != null;
|
||||
PricingListVo listvo = pricingStrategy.calculatePrice(product, user.getRole());
|
||||
if (listvo.getCode() != 0) {
|
||||
return Msg.fail(listvo.getMsg());
|
||||
@@ -408,6 +409,52 @@ public class ProductController {
|
||||
return Msg.success().add("proList", proList);
|
||||
}
|
||||
|
||||
@RequestMapping("/getProductCastPrice")
|
||||
public Msg getProductCastPrice(Product product, HttpServletRequest request) {
|
||||
SysUser user = (SysUser) request.getSession().getAttribute("USER_SESSION");
|
||||
|
||||
if (StringUtils.isEmpty(product.getCount()) || product.getCount() <= 0) {
|
||||
return Msg.fail("数量必须大于0");
|
||||
}
|
||||
String size = product.getSize();
|
||||
|
||||
if (!StringUtils.isEmpty(size)) {
|
||||
product.setLength(Double.valueOf(size.substring(0, size.indexOf("*"))));
|
||||
String other_size = size;
|
||||
if (size.contains(",")) {
|
||||
size = size.split(",")[0];
|
||||
}
|
||||
if (size.indexOf(("*"), size.indexOf("*") + 1) == -1) {
|
||||
product.setWidth(Double.valueOf(size.substring(size.indexOf("*") + 1)));
|
||||
} else {
|
||||
product.setWidth(Double.valueOf(size.substring(size.indexOf("*") + 1, size.indexOf(("*"), size.indexOf("*") + 1))));
|
||||
product.setLength(Math.abs(Double.parseDouble(size.substring(size.indexOf(("*"), size.indexOf("*") + 1) + 1))));
|
||||
}
|
||||
}
|
||||
product.setRole(user.getRole());
|
||||
|
||||
PricingListVo listvo = priceService.getCostPrice(product);
|
||||
if (listvo.getCode() != 0) {
|
||||
return Msg.fail(listvo.getMsg());
|
||||
}
|
||||
List<ProductVo> proList = listvo.getProList();
|
||||
if (proList == null || proList.size() == 0 || proList.get(0).getPrice() == 0) {
|
||||
return Msg.fail("暂无报价");
|
||||
}
|
||||
|
||||
if (listvo.getCode() != 0) {
|
||||
return Msg.fail(listvo.getMsg());
|
||||
}
|
||||
proList = listvo.getProList();
|
||||
|
||||
// 把角色存入,前台判断,区分不同价格
|
||||
for (ProductVo p : proList) {
|
||||
p.setRole(user.getRole());
|
||||
}
|
||||
|
||||
return Msg.success().add("proList", proList);
|
||||
}
|
||||
|
||||
/*public List<Product> f_getPrice( int priceArr[], int count, String craftMo) {
|
||||
List<Product> list = new ArrayList<Product>();
|
||||
Product p = new Product();
|
||||
|
||||
Reference in New Issue
Block a user