| | |
| | | import com.highdatas.mdm.service.ISysMenuService; |
| | | import com.highdatas.mdm.util.Constant; |
| | | import com.highdatas.mdm.util.DbUtils; |
| | | import com.highdatas.mdm.util.WorkflowUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | public static final String key = "process"; |
| | | |
| | | @Override |
| | | public boolean create(String json, HttpSession session) { |
| | | public MenuMapping create(String json, HttpSession session) { |
| | | JSONObject jsonObject = JSONObject.parseObject(json); |
| | | // //1 |
| | | // Flows flows = activitiService.start(key, session); |
| | |
| | | menuMapping = objectMapper.readValue(json, MenuMapping.class); |
| | | } catch (JsonProcessingException e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | return null; |
| | | } |
| | | //menuMapping.setMaintainId(maintainId); |
| | | return create(menuMapping); |
| | |
| | | return null; |
| | | } |
| | | |
| | | public boolean create(MenuMapping menuMapping) { |
| | | public MenuMapping create(MenuMapping menuMapping) { |
| | | menuMapping.setCreateTime(new Date()); |
| | | menuMapping.setId(DbUtils.getUUID()); |
| | | return this.insert(menuMapping); |
| | | String name = menuMapping.getName(); |
| | | name = DbUtils.getChineseOrEnglishOrNumber(name); |
| | | String tableName = WorkflowUtils.toFirstChar(name.toLowerCase()); |
| | | tableName = Constant.MD + tableName; |
| | | String tableByName = tableInfoMapper.selectTableByName(tableName); |
| | | if (!StringUtils.isEmpty(tableByName)){ |
| | | tableName = tableName + "_" + DbUtils.getUUID(5); |
| | | } |
| | | menuMapping.setTableName(tableName); |
| | | boolean insert = this.insert(menuMapping); |
| | | if (insert) { |
| | | return menuMapping; |
| | | } else { |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |