|
|
@@ -6,18 +6,30 @@ import com.dk.common.model.pojo.PageList;
|
|
|
import com.dk.common.response.ResponseResultUtil;
|
|
|
import com.dk.common.response.ResponseResultVO;
|
|
|
import com.dk.mdm.infrastructure.convert.mst.SupplierConvert;
|
|
|
+import com.dk.mdm.mapper.mac.OtherPayableMapper;
|
|
|
import com.dk.mdm.model.pojo.mst.Supplier;
|
|
|
import com.dk.mdm.mapper.mst.SupplierMapper;
|
|
|
import com.dk.common.service.BaseService;
|
|
|
import com.dk.common.mapper.BaseMapper;
|
|
|
+import com.dk.mdm.model.query.mac.MacTransferItemQuery;
|
|
|
+import com.dk.mdm.model.query.mac.OtherPayableQuery;
|
|
|
import com.dk.mdm.model.query.mst.SupplierQuery;
|
|
|
+import com.dk.mdm.model.response.mac.MacTransferItemResponse;
|
|
|
+import com.dk.mdm.model.response.mac.MacTransferResponse;
|
|
|
+import com.dk.mdm.model.response.mac.OtherPayableResponse;
|
|
|
+import com.dk.mdm.model.response.mst.SpplierResponse;
|
|
|
+import com.dk.mdm.model.vo.mac.OtherPayableItemVO;
|
|
|
+import com.dk.mdm.model.vo.mac.OtherPayableVO;
|
|
|
import com.dk.mdm.model.vo.mst.SupplierVo;
|
|
|
import com.dk.mdm.service.common.CommonService;
|
|
|
+import com.dk.mdm.service.mac.OtherPayableService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.time.LocalDate;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
@@ -46,6 +58,11 @@ public class SupplierService extends BaseService<Supplier> {
|
|
|
private SupplierConvert supplierConvert;
|
|
|
@Autowired
|
|
|
private CommonService commonService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private OtherPayableService otherPayableService;
|
|
|
+ @Autowired
|
|
|
+ private OtherPayableMapper otherPayableMapper;
|
|
|
/**
|
|
|
* @desc : 条件查询
|
|
|
* @author : 王英杰
|
|
|
@@ -53,7 +70,22 @@ public class SupplierService extends BaseService<Supplier> {
|
|
|
*/
|
|
|
@Pagination
|
|
|
public ResponseResultVO<PageList<Supplier>> selectByCond(SupplierQuery supplierQuery) {
|
|
|
- return super.mergeListWithCount(supplierQuery, supplierMapper.selectByCond(supplierQuery),
|
|
|
+ List<SpplierResponse> list = new ArrayList<>();
|
|
|
+ list = supplierMapper.selectByCond(supplierQuery);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ for(int i =0;i<list.size();i++){ //显示明细第一条的 内容
|
|
|
+ list.get(i).getSupId();
|
|
|
+ // 转账明细
|
|
|
+ List<OtherPayableResponse> itemList = otherPayableMapper.selectByCond(new OtherPayableQuery().setObjectId(list.get(i).getSupId()).setBusinessType(0));
|
|
|
+ if(itemList.size()>0){
|
|
|
+ list.get(i).setSumAmtPayable(itemList.get(0).getSumAmtPayable());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return super.mergeListWithCount(supplierQuery,list ,
|
|
|
supplierMapper.countByCond(supplierQuery));
|
|
|
}
|
|
|
/**
|
|
|
@@ -74,7 +106,7 @@ public class SupplierService extends BaseService<Supplier> {
|
|
|
// 转化实体
|
|
|
Supplier supplier = supplierConvert.convertToPo(supplierVo);
|
|
|
|
|
|
- try {
|
|
|
+
|
|
|
Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.SUPPLIER.getName(), true);
|
|
|
|
|
|
supplier.setSupId(codeMap.get("outId").toString());
|
|
|
@@ -95,15 +127,22 @@ public class SupplierService extends BaseService<Supplier> {
|
|
|
supplierMapper.insertSupplierBrandtBatch(Supplierlst); // 向供应商品牌表插入数据
|
|
|
}
|
|
|
|
|
|
- if(supplier.getStartAmount()>0) {
|
|
|
-
|
|
|
+ if(supplierVo.getStartAmount()!=null && supplierVo.getStartAmount().compareTo(BigDecimal.ZERO) > 0) { //说明有起始欠款 需要插入其他支出
|
|
|
+ //先组装明细
|
|
|
+ List<OtherPayableItemVO> itemList = new ArrayList<>();
|
|
|
+ OtherPayableItemVO otherPayableItemVO = new OtherPayableItemVO();
|
|
|
+ otherPayableItemVO.setPayableType("10112024-0415-0000-0000-0000300dd508");
|
|
|
+ otherPayableItemVO.setAmtPayable(supplierVo.getStartAmount());
|
|
|
+ itemList.add(otherPayableItemVO);
|
|
|
+ //调用 新建其他支出
|
|
|
+ OtherPayableVO otherPayableVO = new OtherPayableVO().setBusinessType(0).setObjectId(supplier.getSupId())
|
|
|
+ .setSumAmtPayable(supplierVo .getStartAmount()).setStaffId(supplier.getStaffId())
|
|
|
+ .setOrgId(supplier.getOrgId()).setAccDate(LocalDate.now()).setMakeStaff(supplierVo
|
|
|
+ .getMakeStaff()).setItemList(itemList).setSumAmtPay(BigDecimal.ZERO);
|
|
|
+ otherPayableService.insert(otherPayableVO);
|
|
|
}
|
|
|
return ResponseResultUtil.success();
|
|
|
- } catch (Exception e) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); // 手动回滚事务
|
|
|
|
|
|
- return ResponseResultUtil.error("保存失败");
|
|
|
- }
|
|
|
|
|
|
}
|
|
|
/**
|