|
|
@@ -29,6 +29,7 @@ import lombok.AllArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
@@ -308,7 +309,7 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
|
|
|
if(ObjectUtil.isNotNull(wfExerciseBookItem.getSubscriptionType()) && wfExerciseBookItem.getSubscriptionType().equals(ExerciseBookeTypeEnum.ExerciseBook2.getCode())){
|
|
|
setBookName(ExerciseBookeTypeEnum.ExerciseBook2.getValue());
|
|
|
}
|
|
|
-
|
|
|
+ setSpecificationsModels(wfExerciseBookItem.getSpecificationsModels());
|
|
|
setTextbookType(TextbookTypeEnum.TExerciseBook.getCode());
|
|
|
//年级id
|
|
|
if (ObjectUtil.isNotNull(wfExerciseBook.getClassId()) && wfExerciseBook.getClassId() > 0){
|
|
|
@@ -444,10 +445,18 @@ public class TextbookServiceImpl extends MPJBaseServiceImpl<TextbookMapper, Text
|
|
|
updateTextbook.setId(textbook.getId());
|
|
|
Integer oldStock = ObjectUtil.isNull(textbook.getStock()) ? 0 : textbook.getStock();
|
|
|
updateTextbook.setStock(oldStock + (ObjectUtil.isNull(dto.getWarehouseNumber()) ? 0 : dto.getWarehouseNumber()));
|
|
|
+ BigDecimal price = ObjectUtil.isNull(dto.getPrice())?new BigDecimal(0):dto.getPrice();
|
|
|
+ updateTextbook.setPrice(price);
|
|
|
+ Double discount = ObjectUtil.isNull(dto.getDiscount())?10:dto.getDiscount();
|
|
|
+ updateTextbook.setDiscount(discount);
|
|
|
+ BigDecimal subtotal = price.multiply(new BigDecimal(discount/10));
|
|
|
+ updateTextbook.setSubtotal(subtotal);
|
|
|
+
|
|
|
boolean isSuccess = this.updateById(updateTextbook);
|
|
|
|
|
|
TextbookWarehouseRecord textbookWarehouseRecord = BeanUtil.toBean(dto, TextbookWarehouseRecord.class);
|
|
|
textbookWarehouseRecord.setWarehouseMode(WarehouseModeEnum.WmManual.getCode());
|
|
|
+ textbookWarehouseRecord.setSubtotal(subtotal);
|
|
|
isSuccess = textbookClassWarehouseService.save(textbookWarehouseRecord);
|
|
|
|
|
|
return isSuccess;
|