| | |
| | | package org.jeecg.modules.system.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.constant.FillRuleConstant; |
| | | import org.jeecg.common.util.FillRuleUtil; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.system.entity.MdcProduction; |
| | | import org.jeecg.modules.system.entity.MdcProductionEquipment; |
| | |
| | | mdcProduction.setParentId(""); |
| | | } |
| | | mdcProduction.setId(IdWorker.getIdStr(mdcProduction)); |
| | | // 先判断该对象有无父级ID,有则意味着不是最高级,否则意味着是最高级 |
| | | // 获取父级ID |
| | | String parentId = mdcProduction.getParentId(); |
| | | JSONObject formData = new JSONObject(); |
| | | formData.put("parentId",parentId); |
| | | String[] codeArray = (String[]) FillRuleUtil.executeRule(FillRuleConstant.PRODUCTION,formData); |
| | | mdcProduction.setOrgCode(codeArray[0]); |
| | | String orgType = codeArray[1]; |
| | | mdcProduction.setOrgType(String.valueOf(orgType)); |
| | | mdcProduction.setDelFlag(CommonConstant.DEL_FLAG_0.toString()); |
| | | this.save(mdcProduction); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 递归查询所有子节点id |
| | | */ |
| | | @Override |
| | | public List<String> recursionChildren(String productionId) { |
| | | return this.baseMapper.recursionChildren(productionId); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户id和车间id获取用户拥有的车间id |
| | | * @param userId |
| | | * @param productionId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String findFirstProduction(String userId, String productionId) { |
| | | return this.baseMapper.findFirstProduction(userId, productionId); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户id查询用户工段权限 |
| | | */ |
| | | @Override |
| | | public String findThreeProductionId(String userId) { |
| | | return this.baseMapper.findThreeProductionId(userId); |
| | | } |
| | | |
| | | @Override |
| | | public MdcProduction findProductionList(String equipmentId) { |
| | | return this.baseMapper.findProductionList(equipmentId); |
| | | } |
| | | |
| | | /** |
| | | * delete 方法调用 递归查找子集id |
| | | */ |
| | | private void checkChildrenExists(String id, List<String> idList) { |