| | |
| | | package com.billion.main.bs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.billion.common.exception.ServiceException; |
| | | import com.billion.common.utils.StringUtils; |
| | | import com.billion.common.utils.bean.BeanValidators; |
| | | import com.billion.main.bs.domain.BsBomChildInfo; |
| | | import com.billion.main.bs.mapper.BsBomChildInfoMapper; |
| | | import com.billion.main.bs.service.IBsBomChildInfoService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.validation.Validator; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | public class BsBomChildInfoServiceImpl extends ServiceImpl<BsBomChildInfoMapper, BsBomChildInfo> implements IBsBomChildInfoService |
| | | { |
| | | @Autowired |
| | | protected Validator validator; |
| | | |
| | | @Autowired |
| | | private IBsBomChildInfoService bsBomChildInfoService; |
| | | |
| | | @Override |
| | | public String importBomChild(List<BsBomChildInfo> bomChildList, Boolean isUpdateSupport, String operName) |
| | | { |
| | | if (StringUtils.isNull(bomChildList) || bomChildList.size() == 0) |
| | | { |
| | | throw new ServiceException("导入数据不能为空!"); |
| | | } |
| | | StringBuilder successMsg = new StringBuilder(); |
| | | for (BsBomChildInfo list : bomChildList) |
| | | { |
| | | try |
| | | { |
| | | BeanValidators.validateWithException(validator, list); |
| | | BsBomChildInfo bsBomChildInfo = new BsBomChildInfo(); |
| | | bsBomChildInfo.setProductCode(list.getProductCode()); |
| | | bsBomChildInfo.setProductName(list.getProductName()); |
| | | bsBomChildInfo.setLocationCode(list.getLocationCode()); |
| | | bsBomChildInfo.setLocationName(list.getLocationName()); |
| | | bsBomChildInfo.setMaterialCode(list.getMaterialCode()); |
| | | bsBomChildInfo.setMaterialName(list.getMaterialName()); |
| | | bsBomChildInfo.setCostQty(list.getCostQty()); |
| | | bsBomChildInfo.setBomCode(list.getBomCode()); |
| | | bsBomChildInfoService.insertBsBomChildInfo(bsBomChildInfo); |
| | | successMsg.append( " 更新成功"); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | String msg = " 导入失败"; |
| | | log.error(msg, e); |
| | | } |
| | | } |
| | | return successMsg.toString(); |
| | | } |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private BsBomChildInfoMapper bsBomChildInfoMapper; |
| | | |
| | | /** |