| | |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.aps.common.core.utils.DateUtils; |
| | | import com.aps.common.core.utils.uuid.IdUtils; |
| | | import com.aps.core.domain.ApsPartPlanTemp; |
| | | import com.aps.core.mapper.ApsPartPlanTempMapper; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.aps.core.mapper.ApsPartPlanMapper; |
| | | import com.aps.core.domain.ApsPartPlan; |
| | | import com.aps.core.service.IApsPartPlanService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | /** |
| | | * 零件计划管理Service业务层处理 |
| | |
| | | { |
| | | @Autowired |
| | | private ApsPartPlanMapper apsPartPlanMapper; |
| | | @Autowired |
| | | private ApsPartPlanTempMapper apsPartPlanTempMapper; |
| | | |
| | | /** |
| | | * 查询零件计划管理 |
| | |
| | | public int insertApsPartPlan(ApsPartPlan apsPartPlan) |
| | | { |
| | | apsPartPlan.setId(IdUtils.fastUUID()); |
| | | apsPartPlan.setCreateTime(DateUtils.getNowDate()); |
| | | return apsPartPlanMapper.insertApsPartPlan(apsPartPlan); |
| | | } |
| | | |
| | |
| | | { |
| | | return apsPartPlanMapper.deleteApsPartPlanById(id); |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public int confirmPart(ApsPartPlanTemp apsPartPlanTemp) { |
| | | |
| | | apsPartPlanMapper.removeAllPartPlans(); |
| | | //查询临时表数据 |
| | | List<ApsPartPlanTemp> apsPartPlanTemps=apsPartPlanTempMapper.selectApsPartPlanTempList(apsPartPlanTemp); |
| | | int count=0; |
| | | List<String> aids=apsPartPlanTemps.stream().map(ApsPartPlanTemp::getId).toList(); |
| | | String[] ids=aids.toArray(new String[0]); |
| | | // for (int i = 0; i <apsPartPlanTemps.size() ; i++) { |
| | | // //记录临时表id |
| | | // ids[i]=apsPartPlanTemps.get(i).getId(); |
| | | // ApsPartPlan apsPartPlan=new ApsPartPlan(); |
| | | // BeanUtils.copyProperties(apsPartPlanTemps.get(i), apsPartPlan); |
| | | // apsPartPlan.setId(IdUtils.fastUUID()); |
| | | // //插入正式表,并记录 |
| | | // apsPartPlanMapper.insertApsPartPlan(apsPartPlan); |
| | | // count++; |
| | | // } |
| | | count =apsPartPlanMapper.insertBatch(apsPartPlanTemps); |
| | | //插入数量与临时表查询一直则删除临时表数据 |
| | | if (count==apsPartPlanTemps.size()) { |
| | | apsPartPlanTempMapper.deleteApsPartPlanTempByIds(ids); |
| | | } |
| | | return 1; |
| | | } |
| | | } |