|
@@ -6,6 +6,8 @@ import com.dk.common.model.pojo.PageList;
|
|
|
import com.dk.common.response.ResponseResultUtil;
|
|
import com.dk.common.response.ResponseResultUtil;
|
|
|
import com.dk.common.response.ResponseResultVO;
|
|
import com.dk.common.response.ResponseResultVO;
|
|
|
import com.dk.mdm.infrastructure.convert.mst.SupplierConvert;
|
|
import com.dk.mdm.infrastructure.convert.mst.SupplierConvert;
|
|
|
|
|
+import com.dk.mdm.infrastructure.util.AuthUtils;
|
|
|
|
|
+import com.dk.mdm.mapper.common.CommonMapper;
|
|
|
import com.dk.mdm.mapper.mac.OtherPayableMapper;
|
|
import com.dk.mdm.mapper.mac.OtherPayableMapper;
|
|
|
import com.dk.mdm.model.pojo.mst.Supplier;
|
|
import com.dk.mdm.model.pojo.mst.Supplier;
|
|
|
import com.dk.mdm.mapper.mst.SupplierMapper;
|
|
import com.dk.mdm.mapper.mst.SupplierMapper;
|
|
@@ -31,6 +33,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
@@ -46,6 +49,7 @@ public class SupplierService extends BaseService<Supplier> {
|
|
|
public String getPrimaryKey() {
|
|
public String getPrimaryKey() {
|
|
|
return "sup_id";
|
|
return "sup_id";
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public BaseMapper<Supplier> getRepository() {
|
|
public BaseMapper<Supplier> getRepository() {
|
|
|
return supplierMapper;
|
|
return supplierMapper;
|
|
@@ -53,6 +57,8 @@ public class SupplierService extends BaseService<Supplier> {
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private SupplierMapper supplierMapper;
|
|
private SupplierMapper supplierMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private AuthUtils authUtils;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private SupplierConvert supplierConvert;
|
|
private SupplierConvert supplierConvert;
|
|
@@ -63,6 +69,9 @@ public class SupplierService extends BaseService<Supplier> {
|
|
|
private OtherPayableService otherPayableService;
|
|
private OtherPayableService otherPayableService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private OtherPayableMapper otherPayableMapper;
|
|
private OtherPayableMapper otherPayableMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private CommonMapper commonMapper;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @desc : 条件查询
|
|
* @desc : 条件查询
|
|
|
* @author : 王英杰
|
|
* @author : 王英杰
|
|
@@ -72,33 +81,30 @@ public class SupplierService extends BaseService<Supplier> {
|
|
|
public ResponseResultVO<PageList<Supplier>> selectByCond(SupplierQuery supplierQuery) {
|
|
public ResponseResultVO<PageList<Supplier>> selectByCond(SupplierQuery supplierQuery) {
|
|
|
List<SpplierResponse> list = new ArrayList<>();
|
|
List<SpplierResponse> list = new ArrayList<>();
|
|
|
list = supplierMapper.selectByCond(supplierQuery);
|
|
list = supplierMapper.selectByCond(supplierQuery);
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- for(int i =0;i<list.size();i++){ //显示明细第一条的 内容
|
|
|
|
|
|
|
+ for (int i = 0; i < list.size(); i++) { //显示明细第一条的 内容
|
|
|
list.get(i).getSupId();
|
|
list.get(i).getSupId();
|
|
|
// 转账明细
|
|
// 转账明细
|
|
|
List<OtherPayableResponse> itemList = otherPayableMapper.selectByCond(new OtherPayableQuery().setObjectId(list.get(i).getSupId()).setBusinessType(0));
|
|
List<OtherPayableResponse> itemList = otherPayableMapper.selectByCond(new OtherPayableQuery().setObjectId(list.get(i).getSupId()).setBusinessType(0));
|
|
|
- if(itemList.size()>0){
|
|
|
|
|
|
|
+ if (itemList.size() > 0) {
|
|
|
BigDecimal sumAmtPayableValue = (itemList != null && !itemList.isEmpty() && itemList.get(0).getSumAmtPayable() != null) ?
|
|
BigDecimal sumAmtPayableValue = (itemList != null && !itemList.isEmpty() && itemList.get(0).getSumAmtPayable() != null) ?
|
|
|
itemList.get(0).getSumAmtPayable() :
|
|
itemList.get(0).getSumAmtPayable() :
|
|
|
BigDecimal.ZERO;
|
|
BigDecimal.ZERO;
|
|
|
list.get(i).setSumAmtPayable(sumAmtPayableValue);
|
|
list.get(i).setSumAmtPayable(sumAmtPayableValue);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- return super.mergeListWithCount(supplierQuery,list ,
|
|
|
|
|
|
|
+ return super.mergeListWithCount(supplierQuery, list,
|
|
|
supplierMapper.countByCond(supplierQuery));
|
|
supplierMapper.countByCond(supplierQuery));
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @desc : 停用 供应商
|
|
* @desc : 停用 供应商
|
|
|
* @author : 王英杰
|
|
* @author : 王英杰
|
|
|
* @date : 2023/1/10 17:19
|
|
* @date : 2023/1/10 17:19
|
|
|
*/
|
|
*/
|
|
|
public ResponseResultVO<?> deactivateData(SupplierVo supplierVo) {
|
|
public ResponseResultVO<?> deactivateData(SupplierVo supplierVo) {
|
|
|
- return super.disable(supplierVo.getSupId());
|
|
|
|
|
|
|
+ return super.disable(supplierVo.getSupId());
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @desc : 新建供应商
|
|
* @desc : 新建供应商
|
|
|
* @author : 王英杰
|
|
* @author : 王英杰
|
|
@@ -108,46 +114,46 @@ public class SupplierService extends BaseService<Supplier> {
|
|
|
public ResponseResultVO<?> insert(SupplierVo supplierVo) {
|
|
public ResponseResultVO<?> insert(SupplierVo supplierVo) {
|
|
|
// 转化实体
|
|
// 转化实体
|
|
|
Supplier supplier = supplierConvert.convertToPo(supplierVo);
|
|
Supplier supplier = supplierConvert.convertToPo(supplierVo);
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.SUPPLIER.getName(), true);
|
|
|
|
|
-
|
|
|
|
|
- supplier.setSupId(codeMap.get("outId").toString());
|
|
|
|
|
- supplier.setSupCode(codeMap.get("outNote").toString()); //插入供应商表的实体
|
|
|
|
|
-
|
|
|
|
|
- super.insert(supplier);// 先插入自己的供应商表
|
|
|
|
|
- if ((supplier.getBrandIds() != null) && (supplier.getBrandIds().size()>0)) { //如果有 商品品牌 一起插入品牌
|
|
|
|
|
- List<Supplier> Supplierlst = new ArrayList<>();
|
|
|
|
|
- List<String> BrandIdList = new ArrayList<>();
|
|
|
|
|
- BrandIdList = supplier.getBrandIds();
|
|
|
|
|
- Supplier supplier_center = null;
|
|
|
|
|
- for (int i = 0; i< BrandIdList.size();i++){
|
|
|
|
|
- supplier_center= new Supplier();
|
|
|
|
|
- supplier_center.setBrandId(BrandIdList.get(i));
|
|
|
|
|
- supplier_center.setSupId(supplier.getSupId());
|
|
|
|
|
- Supplierlst.add(supplier_center);
|
|
|
|
|
- }
|
|
|
|
|
- supplierMapper.insertSupplierBrandtBatch(Supplierlst); // 向供应商品牌表插入数据
|
|
|
|
|
|
|
+ Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.SUPPLIER.getName(), true);
|
|
|
|
|
+ supplier.setSupId(codeMap.get("outId").toString());
|
|
|
|
|
+ supplier.setSupCode(codeMap.get("outNote").toString()); //插入供应商表的实体
|
|
|
|
|
+ super.insert(supplier);// 先插入自己的供应商表
|
|
|
|
|
+ if ((supplier.getBrandIds() != null) && (supplier.getBrandIds().size() > 0)) { //如果有 商品品牌 一起插入品牌
|
|
|
|
|
+ List<Supplier> Supplierlst = new ArrayList<>();
|
|
|
|
|
+ List<String> BrandIdList = new ArrayList<>();
|
|
|
|
|
+ BrandIdList = supplier.getBrandIds();
|
|
|
|
|
+ Supplier supplier_center = null;
|
|
|
|
|
+ for (int i = 0; i < BrandIdList.size(); i++) {
|
|
|
|
|
+ supplier_center = new Supplier();
|
|
|
|
|
+ supplier_center.setBrandId(BrandIdList.get(i));
|
|
|
|
|
+ supplier_center.setSupId(supplier.getSupId());
|
|
|
|
|
+ Supplierlst.add(supplier_center);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- 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();
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ supplierMapper.insertSupplierBrandtBatch(Supplierlst); // 向供应商品牌表插入数据
|
|
|
|
|
+ }
|
|
|
|
|
+ if (supplierVo.getStartAmount() != null && supplierVo.getStartAmount().compareTo(BigDecimal.ZERO) > 0) { //说明有起始欠款 需要插入其他支出
|
|
|
|
|
+ //先组装明细
|
|
|
|
|
+ List<OtherPayableItemVO> itemList = new ArrayList<>();
|
|
|
|
|
+ OtherPayableItemVO otherPayableItemVO = new OtherPayableItemVO();
|
|
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
|
|
+ param.put("cpId", authUtils.getStaff().getCpId());
|
|
|
|
|
+ param.put("dictCode", "基础资料-支出");
|
|
|
|
|
+ param.put("dataValue", "期初");
|
|
|
|
|
+ Map<String, Object> data = commonMapper.selectDictionaryData(param);
|
|
|
|
|
+ String dataId = String.valueOf(data.get("dataId"));
|
|
|
|
|
+ otherPayableItemVO.setPayableType(dataId);
|
|
|
|
|
+ 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();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @desc : 编辑方法
|
|
* @desc : 编辑方法
|
|
|
* @author : 王英杰
|
|
* @author : 王英杰
|
|
@@ -159,22 +165,22 @@ public class SupplierService extends BaseService<Supplier> {
|
|
|
public ResponseResultVO<?> update(SupplierVo supplierVo) {
|
|
public ResponseResultVO<?> update(SupplierVo supplierVo) {
|
|
|
// 转化实体
|
|
// 转化实体
|
|
|
Supplier supplier = supplierConvert.convertToPo(supplierVo);
|
|
Supplier supplier = supplierConvert.convertToPo(supplierVo);
|
|
|
- super.updateByUuid(supplier);// 先更新的供应商表
|
|
|
|
|
- if ((supplier.getBrandIds() != null) && (supplier.getBrandIds().size()>0)) { //如果有 商品品牌 一起插入品牌
|
|
|
|
|
- supplierMapper.batchDeleteBrand(supplier.getSupId());//批量删除供应商对应的供应商品牌
|
|
|
|
|
- List<Supplier> Supplierlst = new ArrayList<>();
|
|
|
|
|
- List<String> BrandIdList = new ArrayList<>();
|
|
|
|
|
- BrandIdList = supplier.getBrandIds();
|
|
|
|
|
- Supplier supplier_center = null;
|
|
|
|
|
- for (int i = 0; i< BrandIdList.size();i++){
|
|
|
|
|
- supplier_center= new Supplier();
|
|
|
|
|
- supplier_center.setBrandId(BrandIdList.get(i));
|
|
|
|
|
- supplier_center.setSupId(supplier.getSupId());
|
|
|
|
|
- Supplierlst.add(supplier_center);
|
|
|
|
|
- }
|
|
|
|
|
- supplierMapper.insertSupplierBrandtBatch(Supplierlst); // 向供应商品牌表插入数据
|
|
|
|
|
|
|
+ super.updateByUuid(supplier);// 先更新的供应商表
|
|
|
|
|
+ if ((supplier.getBrandIds() != null) && (supplier.getBrandIds().size() > 0)) { //如果有 商品品牌 一起插入品牌
|
|
|
|
|
+ supplierMapper.batchDeleteBrand(supplier.getSupId());//批量删除供应商对应的供应商品牌
|
|
|
|
|
+ List<Supplier> supplierlst = new ArrayList<>();
|
|
|
|
|
+ List<String> BrandIdList = new ArrayList<>();
|
|
|
|
|
+ BrandIdList = supplier.getBrandIds();
|
|
|
|
|
+ Supplier supplier_center = null;
|
|
|
|
|
+ for (int i = 0; i < BrandIdList.size(); i++) {
|
|
|
|
|
+ supplier_center = new Supplier();
|
|
|
|
|
+ supplier_center.setBrandId(BrandIdList.get(i));
|
|
|
|
|
+ supplier_center.setSupId(supplier.getSupId());
|
|
|
|
|
+ supplierlst.add(supplier_center);
|
|
|
}
|
|
}
|
|
|
- return ResponseResultUtil.success();
|
|
|
|
|
|
|
+ supplierMapper.insertSupplierBrandtBatch(supplierlst); // 向供应商品牌表插入数据
|
|
|
|
|
+ }
|
|
|
|
|
+ return ResponseResultUtil.success();
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|