123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- package com.steerinfo.dil.service.impl;
- import com.steerinfo.dil.mapper.RmsCarrierMapper;
- import com.steerinfo.dil.mapper.RmsSupplierMapper;
- import com.steerinfo.dil.model.RmsSupplier;
- import com.steerinfo.dil.service.IRmsSupplierService;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import java.math.BigDecimal;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- @Service(value = "rmsSupplierService")
- public class RmsSupplierServiceImpl implements IRmsSupplierService {
- @Autowired
- private RmsSupplierMapper rmsSupplierMapper;
- @Autowired
- RmsCarrierMapper rmsCarrierMapper;
-
- @Override
- public int operationSupplier(Map<String, Object> mapVal) {
-
- String EASSupplierId = (String) mapVal.get("EASSupplierId");
-
- String supplierName = (String) mapVal.get("supplierName");
-
- String supplierAbbreviation = (String) mapVal.get("supplierAbbreviation");
-
- String supplierDutyParagraph = (String) mapVal.get("supplierDutyParagraph");
-
- String supplierAddress = (String) mapVal.get("supplierAddress");
-
- String supplierContactsName = (String) mapVal.get("supplierAgent");
-
- String supplierContactNumber = (String) mapVal.get("supplierContactNumber");
-
- Integer dataStatus = (Integer) mapVal.get("dataStatus");
-
- Object supplierScreenInfo = mapVal.get("supplierScreenInfo");
-
- Map<String,Object> map1 = new HashMap<>();
- map1.put("easSupplierId",EASSupplierId);
- Map<String,Object> map2 = new HashMap<>();
- BigDecimal deleted = new BigDecimal(0);
- List<RmsSupplier> rmsSuppliers = rmsSupplierMapper.selectByParameters(map1);
-
- RmsSupplier rmsSupplier = new RmsSupplier();
- rmsSupplier.setEasSupplierId(EASSupplierId);
- rmsSupplier.setSupplierName(supplierName);
- rmsSupplier.setSupplierAbbreviation(supplierAbbreviation);
- rmsSupplier.setSupplierDutyParagraph(supplierDutyParagraph);
- rmsSupplier.setSupplierAddress(supplierAddress);
- if (supplierScreenInfo != null) {
- rmsSupplier.setSupplierScreenInfo(supplierScreenInfo.toString());
- }
- rmsSupplier.setSupplierContactsName(supplierContactsName);
- rmsSupplier.setSupplierContactNumber(supplierContactNumber);
- rmsSupplier.setInsertTime(new Date());
- rmsSupplier.setInsertUsername("admin");
- rmsSupplier.setUpdateTime(new Date());
- rmsSupplier.setUpdateUsername("admin");
- rmsSupplier.setInsertUpdateRemark("无");
- int result = 0;
-
- if (rmsSuppliers.size() == 0) {
- BigDecimal supplierId = rmsSupplierMapper.getSupplierId();
- rmsSupplier.setSupplierId(supplierId);
- rmsSupplier.setDeleted(new BigDecimal(0));
- result += rmsSupplierMapper.insertSelective(rmsSupplier);
- }
-
- if (rmsSuppliers.size() != 0 && dataStatus == 1) {
- RmsSupplier rmsSupplier1 = rmsSuppliers.get(0);
- rmsSupplier.setSupplierId(rmsSupplier1.getSupplierId());
- rmsSupplier.setDeleted(deleted);
- result += rmsSupplierMapper.updateByPrimaryKeySelective(rmsSupplier);
- }
-
- if (rmsSuppliers.size() != 0 && dataStatus == 2) {
- RmsSupplier rmsSupplier1 = rmsSuppliers.get(0);
- rmsSupplier.setSupplierId(rmsSupplier1.getSupplierId());
- rmsSupplier.setDeleted(new BigDecimal(1));
- result += rmsSupplierMapper.updateByPrimaryKeySelective(rmsSupplier);
- }
- return result;
- }
-
- @Override
- public List<Map<String, Object>> getSupplierList(Map<String, Object> mapVal) {
- return rmsSupplierMapper.getSupplierList(mapVal);
- }
- }
|