|
|
@ -42,6 +42,7 @@ import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.net.URLEncoder; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
@ -118,7 +119,17 @@ public class SmsSalesBillRest { |
|
|
|
@PostMapping("/save") |
|
|
|
public ResultBean<String> save(@RequestBody SmsSalesBillDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String sid = smsSalesBillService.saveOrUpdateDto(dto); |
|
|
|
List<SalesGoodsVo> goodsVos = dto.getGoodsVos(); |
|
|
|
if (!goodsVos.isEmpty()) { |
|
|
|
for (SalesGoodsVo goodsVo : goodsVos) { |
|
|
|
BigDecimal count = new BigDecimal(goodsVo.getCount()); |
|
|
|
BigDecimal currentCount = new BigDecimal(goodsVo.getCurrentCount()); |
|
|
|
if (count.compareTo(currentCount) > 0) { |
|
|
|
return rb.setMsg("商品数量不能大于库存数量"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
String sid = smsSalesBillService.saveOrUpdateDto(dto); |
|
|
|
return rb.success().setData(sid); |
|
|
|
} |
|
|
|
|
|
|
|