|
@@ -29,6 +29,7 @@ import com.platform.service.base.impl.BaseServiceImpl;
|
|
import com.platform.service.longyanpurchaseorder.LongYanPurchaseOrderService;
|
|
import com.platform.service.longyanpurchaseorder.LongYanPurchaseOrderService;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
import tk.mybatis.mapper.weekend.Weekend;
|
|
import tk.mybatis.mapper.weekend.Weekend;
|
|
import tk.mybatis.mapper.weekend.WeekendCriteria;
|
|
import tk.mybatis.mapper.weekend.WeekendCriteria;
|
|
|
|
|
|
@@ -173,6 +174,7 @@ public class LongYanPurchaseOrderServiceImpl extends BaseServiceImpl<LongYanPurc
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public void modModelByDTO(LongYanPurchaseOrderDTO model) {
|
|
public void modModelByDTO(LongYanPurchaseOrderDTO model) {
|
|
UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
LongYanPurchaseOrder order = BeanConverterUtil.copyObjectProperties(model,LongYanPurchaseOrder.class);
|
|
LongYanPurchaseOrder order = BeanConverterUtil.copyObjectProperties(model,LongYanPurchaseOrder.class);
|
|
@@ -184,25 +186,72 @@ public class LongYanPurchaseOrderServiceImpl extends BaseServiceImpl<LongYanPurc
|
|
longYanPurchaseDetailMapper.delete(detail);
|
|
longYanPurchaseDetailMapper.delete(detail);
|
|
BigDecimal totalNum = new BigDecimal(0);
|
|
BigDecimal totalNum = new BigDecimal(0);
|
|
List<LongYanPurchaseDetailDTO> detailDTOS = model.getDetailDTOS();
|
|
List<LongYanPurchaseDetailDTO> detailDTOS = model.getDetailDTOS();
|
|
|
|
+
|
|
|
|
+ ProjectVO project = projectMapper.selectById(model.getProjectId());
|
|
|
|
+
|
|
|
|
+ DecimalFormat df = new DecimalFormat("#.0000");
|
|
if (detailDTOS!=null&&detailDTOS.size()>0) {
|
|
if (detailDTOS!=null&&detailDTOS.size()>0) {
|
|
- for (LongYanPurchaseDetailDTO item:detailDTOS) {
|
|
|
|
- item.setId(IdGeneratorUtils.getObjectId());
|
|
|
|
- item.setLongYangPurchaseOrderId(model.getId());
|
|
|
|
- item.setCreatedUserId(userInfo.getUserId());
|
|
|
|
- item.setCreatedUserName(userInfo.getRealName());
|
|
|
|
- item.setCreatedTime(LocalDateTime.now());
|
|
|
|
- item.setUpdateUserId(userInfo.getUserId());
|
|
|
|
- item.setUpdateUserName(userInfo.getRealName());
|
|
|
|
- item.setUpdateTime(LocalDateTime.now());
|
|
|
|
-// Double iorisum = (new Double(item.getFtaxprice())*(item.getNum().doubleValue()*(1+item.getIpertaxrate()*0.01)));
|
|
|
|
-// BigDecimal b = new BigDecimal(iorisum);
|
|
|
|
-// Double f1 = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
-// item.setIorisum(f1);
|
|
|
|
- totalNum = totalNum.add(item.getNum());
|
|
|
|
|
|
+ if (project != null) {
|
|
|
|
+ for (LongYanPurchaseDetailDTO detailDTO : detailDTOS) {
|
|
|
|
+ detailDTO.setId(IdGeneratorUtils.getObjectId());
|
|
|
|
+ detailDTO.setCdefine26(Double.parseDouble(df.format(detailDTO.getFunitprice() * 1.13)));
|
|
|
|
+ detailDTO.setCreatedTime(LocalDateTime.now());
|
|
|
|
+ detailDTO.setCreatedUserId(userInfo.getUserId());
|
|
|
|
+ detailDTO.setCreatedUserName(userInfo.getUsername());
|
|
|
|
+ detailDTO.setProjectNo(project.getParentNo());
|
|
|
|
+ detailDTO.setProjectName(project.getParentName());
|
|
|
|
+ detailDTO.setProjectSecondNo(project.getNo());
|
|
|
|
+ detailDTO.setProjectSecondName(project.getName());
|
|
|
|
+ detailDTO.setCdefine30(model.getPositionNo());
|
|
|
|
+
|
|
|
|
+// Double iorisum = (new Double(detailDTO.getFtaxprice())*(detailDTO.getNum().doubleValue()*(1+detailDTO.getIpertaxrate()*0.01)));
|
|
|
|
+// BigDecimal b = new BigDecimal(iorisum);
|
|
|
|
+// Double f1 = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
+// detailDTO.setIorisum(f1);
|
|
|
|
+ totalNum = totalNum.add(detailDTO.getNum());
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ for (LongYanPurchaseDetailDTO detailDTO : detailDTOS) {
|
|
|
|
+ detailDTO.setId(IdGeneratorUtils.getObjectId());
|
|
|
|
+ detailDTO.setCdefine26(Double.parseDouble(df.format(detailDTO.getFunitprice() * 1.13)));
|
|
|
|
+ detailDTO.setCreatedTime(LocalDateTime.now());
|
|
|
|
+ detailDTO.setCreatedUserId(userInfo.getUserId());
|
|
|
|
+ detailDTO.setCreatedUserName(userInfo.getUsername());
|
|
|
|
+ detailDTO.setCdefine30(model.getPositionNo());
|
|
|
|
+// Double iorisum = (new Double(detailDTO.getFtaxprice())*(detailDTO.getNum().doubleValue()*(1+detailDTO.getIpertaxrate()*0.01)));
|
|
|
|
+// BigDecimal b = new BigDecimal(iorisum);
|
|
|
|
+// Double f1 = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
+// detailDTO.setIorisum(f1);
|
|
|
|
+ totalNum = totalNum.add(detailDTO.getNum());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
longYanPurchaseDetailMapper.insertListforComplex(BeanConverterUtil.copyListProperties(detailDTOS,LongYanPurchaseDetail.class));
|
|
longYanPurchaseDetailMapper.insertListforComplex(BeanConverterUtil.copyListProperties(detailDTOS,LongYanPurchaseDetail.class));
|
|
}
|
|
}
|
|
order.setTotalNum(totalNum);
|
|
order.setTotalNum(totalNum);
|
|
|
|
+//
|
|
|
|
+// if (detailDTOS!=null&&detailDTOS.size()>0) {
|
|
|
|
+// for (LongYanPurchaseDetailDTO item:detailDTOS) {
|
|
|
|
+// item.setId(IdGeneratorUtils.getObjectId());
|
|
|
|
+// item.setLongYangPurchaseOrderId(model.getId());
|
|
|
|
+// item.setCreatedUserId(userInfo.getUserId());
|
|
|
|
+// item.setCreatedUserName(userInfo.getRealName());
|
|
|
|
+// item.setCreatedTime(LocalDateTime.now());
|
|
|
|
+// item.setUpdateUserId(userInfo.getUserId());
|
|
|
|
+// item.setUpdateUserName(userInfo.getRealName());
|
|
|
|
+// item.setUpdateTime(LocalDateTime.now());
|
|
|
|
+// if (item.getIpertaxrate()!=null){
|
|
|
|
+// item.setCdefine26(item.getFunitprice()*1.13);
|
|
|
|
+//
|
|
|
|
+// }
|
|
|
|
+//// Double iorisum = (new Double(item.getFtaxprice())*(item.getNum().doubleValue()*(1+item.getIpertaxrate()*0.01)));
|
|
|
|
+//// BigDecimal b = new BigDecimal(iorisum);
|
|
|
|
+//// Double f1 = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
+//// item.setIorisum(f1);
|
|
|
|
+// totalNum = totalNum.add(item.getNum());
|
|
|
|
+// }
|
|
|
|
+// longYanPurchaseDetailMapper.insertListforComplex(BeanConverterUtil.copyListProperties(detailDTOS,LongYanPurchaseDetail.class));
|
|
|
|
+// }
|
|
|
|
+ order.setTotalNum(totalNum);
|
|
mapper.updateByPrimaryKeySelective(order);
|
|
mapper.updateByPrimaryKeySelective(order);
|
|
|
|
|
|
}
|
|
}
|
|
@@ -232,6 +281,7 @@ public class LongYanPurchaseOrderServiceImpl extends BaseServiceImpl<LongYanPurc
|
|
System.out.println(df.format(num));
|
|
System.out.println(df.format(num));
|
|
}
|
|
}
|
|
@Override
|
|
@Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public LongYanPurchaseOrder saveModelByDTO(LongYanPurchaseOrderDTO model) {
|
|
public LongYanPurchaseOrder saveModelByDTO(LongYanPurchaseOrderDTO model) {
|
|
UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
|
|