| | |
| | | package com.vincent.rsf.server.manager.service.impl; |
| | | |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.manager.entity.WarehouseAreas; |
| | | import com.vincent.rsf.server.manager.mapper.LocReviseMapper; |
| | | import com.vincent.rsf.server.manager.entity.LocRevise; |
| | | import com.vincent.rsf.server.manager.service.LocReviseService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vincent.rsf.server.manager.service.WarehouseAreasService; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Objects; |
| | | |
| | | @Service("locReviseService") |
| | | public class LocReviseServiceImpl extends ServiceImpl<LocReviseMapper, LocRevise> implements LocReviseService { |
| | | |
| | | @Autowired |
| | | private WarehouseAreasService warehouseAreasService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public LocRevise saveRevise(LocRevise locRevise) { |
| | | if (Objects.isNull(locRevise.getId())) { |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_LOC_REVISE_CODE, null); |
| | | locRevise.setCode(ruleCode); |
| | | } |
| | | WarehouseAreas areas = warehouseAreasService.getById(locRevise.getAreaId()); |
| | | if (!Objects.isNull(areas)) { |
| | | locRevise.setAreaId(areas.getId()) |
| | | .setAreaName(areas.getName()); |
| | | } |
| | | if (!this.save(locRevise)) { |
| | | throw new CoolException("保存失败!!"); |
| | | } |
| | | return locRevise; |
| | | } |
| | | } |