| | |
| | | package zy.cloud.wms.manager.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import zy.cloud.wms.manager.entity.FlowStatus; |
| | | import zy.cloud.wms.manager.entity.ProjectPlan; |
| | | import zy.cloud.wms.manager.entity.ProjectType; |
| | | import zy.cloud.wms.manager.mapper.ItemMapper; |
| | | import zy.cloud.wms.manager.entity.Item; |
| | | import zy.cloud.wms.manager.service.FlowStatusService; |
| | | import zy.cloud.wms.manager.service.ItemService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | import zy.cloud.wms.manager.service.ProjectPlanService; |
| | | import zy.cloud.wms.manager.service.ProjectTypeService; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service("itemService") |
| | | public class ItemServiceImpl extends ServiceImpl<ItemMapper, Item> implements ItemService { |
| | | @Autowired |
| | | private ProjectPlanService planService; |
| | | @Autowired |
| | | private FlowStatusService flowStatusService; |
| | | |
| | | @Override |
| | | public Item selectByName(String name) { |
| | |
| | | item.setName(name); |
| | | return this.selectOne(new EntityWrapper<>(item)); |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public void insertAll(Item item) { |
| | | this.insert(item); |
| | | List<FlowStatus> allTypes = flowStatusService.selectList(new EntityWrapper<FlowStatus>() |
| | | .eq("type", item.getType()) |
| | | .orderBy("weight_num",true)); |
| | | for (FlowStatus oneType : allTypes) { |
| | | ProjectPlan projectPlan = new ProjectPlan(); |
| | | projectPlan.setItemId(item.getId()); |
| | | projectPlan.setWeightNum(oneType.getWeightNum()); |
| | | projectPlan.setFlowId(oneType.getId()); |
| | | projectPlan.setStartTime(item.getStartTime()); |
| | | projectPlan.setEndTime(item.getEndTime()); |
| | | projectPlan.setRealStartTime(null); |
| | | projectPlan.setRealEndTime(null); |
| | | projectPlan.setCreateId(item.getCreateBy()); |
| | | projectPlan.setCreateTime(item.getCreateTime()); |
| | | projectPlan.setModifyId(item.getUpdateBy()); |
| | | projectPlan.setModifyTime(item.getUpdateTime()); |
| | | planService.insert(projectPlan); |
| | | } |
| | | |
| | | } |
| | | } |