Browse Source

代码修改

LAPTOP-KB9HII50\70708 2 years ago
parent
commit
efa126b0d5
58 changed files with 6531 additions and 25 deletions
  1. 4 10
      svr/svr-basic/src/main/java/com/yihu/jw/basic/patient/service/ArchiveRelationService.java
  2. 92 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/standard/controller/StdRelationController.java
  3. 3 15
      svr/svr-basic/src/main/java/com/yihu/jw/basic/standard/dao/SQLGeneralDAO.java
  4. 152 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/standard/model/standard/StdDatasetRelation.java
  5. 91 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/standard/model/standard/StdIndex.java
  6. 8 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/standard/service/bo/StandardVersion.java
  7. 45 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/standard/service/standard/StdRelationService.java
  8. 147 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/BaseDictController.java
  9. 145 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/DatasourceController.java
  10. 214 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/DictController.java
  11. 254 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/EsbDictEndPoint.java
  12. 72 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/EsbSystemDictEntryEndPoint.java
  13. 228 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/FlowController.java
  14. 160 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/OrgController.java
  15. 143 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/ParamController.java
  16. 82 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/ProcessController.java
  17. 133 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/ProcessorController.java
  18. 111 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/SystemController.java
  19. 263 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/UserController.java
  20. 122 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/BaseDictDao.java
  21. 123 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/DatasourceDao.java
  22. 83 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/DictDao.java
  23. 46 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/DictListDao.java
  24. 60 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/FlowClassDao.java
  25. 41 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/FlowDao.java
  26. 33 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/FlowProcessDao.java
  27. 51 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/FlowTempDao.java
  28. 79 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/OrganizationDao.java
  29. 38 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/ProcessorDao.java
  30. 52 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/SystemParamDao.java
  31. 60 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/UserDao.java
  32. 45 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/ProcessResultModel.java
  33. 26 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SyncMessage.java
  34. 17 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SyncStandardMessage.java
  35. 79 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SystemArea.java
  36. 87 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SystemDatasource.java
  37. 90 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SystemDict.java
  38. 130 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SystemDictList.java
  39. 196 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SystemOrganization.java
  40. 65 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SystemParam.java
  41. 122 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SystemServiceFlow.java
  42. 75 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SystemServiceFlowClass.java
  43. 37 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SystemServiceFlowConfig.java
  44. 58 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SystemServiceFlowProcess.java
  45. 40 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SystemServiceFlowProcessor.java
  46. 93 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SystemServiceFlowTemp.java
  47. 158 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/BaseDictManager.java
  48. 160 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/DatasourceManager.java
  49. 154 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/DictManager.java
  50. 817 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/FlowManager.java
  51. 143 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/OrganizationManager.java
  52. 211 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/ProcessEditor.java
  53. 267 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/ProcessManager.java
  54. 47 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/ProcessorManager.java
  55. 11 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/SystemDictService.java
  56. 83 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/SystemManager.java
  57. 60 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/SystemParamManager.java
  58. 125 0
      svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/UserManager.java

+ 4 - 10
svr/svr-basic/src/main/java/com/yihu/jw/basic/patient/service/ArchiveRelationService.java

@ -151,21 +151,15 @@ public class ArchiveRelationService extends BaseJpaService<ArchiveRelation, XArc
        return archiveRelationDao.findInAndOutPatientCount();
    }
    public int getTodayInWarehouseCount() {
        Session session = entityManager.unwrap(Session.class);
    public Integer getTodayInWarehouseCount() {
        String sql = "select count(id) from Archive_Relation WHERE DATE_FORMAT(create_date,'%Y-%m-%d') = CURDATE()";
        SQLQuery query = session.createSQLQuery(sql);
        Object ob  = (query.list().get(0));
        int result = Integer.parseInt(ob.toString());
        Integer result = jdbcTemplate.queryForObject(sql,Integer.class);
        return result;
    }
    public int getDailyAdd() {
        Session session = entityManager.unwrap(Session.class);
    public Integer getDailyAdd() {
        String sql = "select count(id) from Archive_Relation WHERE identify_flag = 1 AND DATE_FORMAT(event_date,'%Y-%m-%d') = CURDATE()";
        SQLQuery query = session.createSQLQuery(sql);
        Object ob  = (query.list().get(0));
        int result = Integer.parseInt(ob.toString());
        Integer result = jdbcTemplate.queryForObject(sql,Integer.class);
        return result;
    }

+ 92 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/standard/controller/StdRelationController.java

@ -0,0 +1,92 @@
package com.yihu.jw.basic.standard.controller;
import com.yihu.ehr.constants.ServiceApi;
import com.yihu.jw.basic.standard.model.standard.StdDatasetRelation;
import com.yihu.jw.basic.standard.model.standard.StdIndex;
import com.yihu.jw.basic.standard.service.bo.StandardVersion;
import com.yihu.jw.basic.standard.service.standard.StdRelationService;
import com.yihu.jw.restmodel.ehr.standard.MStdDatasetRelation;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@Api(value = "stdRelation", description = "标准关联关系相关")
@RestController("StdRelationController")
public class StdRelationController extends EnvelopRestEndpoint {
    @Autowired
    private StdRelationService stdRelationService;
    @ApiOperation("获取列表数据(分页)")
    @RequestMapping(value = ServiceApi.StdRelation.List, method = RequestMethod.GET)
    public Envelop getList(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件", defaultValue = "")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "rows", value = "分页大小", defaultValue = "15")
            @RequestParam(value = "rows", required = false) int rows,
            @ApiParam(name = "page", value = "页码", defaultValue = "1")
            @RequestParam(value = "page", required = false) int page,
            @ApiParam(name = "version", value = "版本", defaultValue = "")
            @RequestParam(value = "version") String version) throws IOException {
        List<StdDatasetRelation> responseEntity = stdRelationService.searchPage(StdIndex.class, StandardVersion.StdIndexTable,version, filters, sorts, page, rows,true);
        List<StdDatasetRelation> all = stdRelationService.searchPage(StdIndex.class, StandardVersion.StdIndexTable,version, filters, sorts, null, null,true);
        Long count = Long.valueOf(all.size());
        List<MStdDatasetRelation> list = (List<MStdDatasetRelation>) convertToModels(responseEntity, new ArrayList<MStdDatasetRelation>(responseEntity.size()), MStdDatasetRelation.class, null);
        return PageEnvelop.getSuccessListWithPage("查询成功",list,page,rows,count);
    }
    @ApiOperation("获取列表数据(不分页)")
    @RequestMapping(value = ServiceApi.StdRelation.ListNoPage, method = RequestMethod.GET)
    public Envelop getListNoPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件", defaultValue = "")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "version", value = "版本", defaultValue = "")
            @RequestParam(value = "version") String version) throws IOException {
        List<StdDatasetRelation> responseEntity = stdRelationService.searchPage(StdDatasetRelation.class, StandardVersion.StdRelationTable,version, filters, sorts, null, null,true);
        List<MStdDatasetRelation> list = (List<MStdDatasetRelation>) convertToModels(responseEntity, new ArrayList<MStdDatasetRelation>(responseEntity.size()), MStdDatasetRelation.class, null);
        return ListEnvelop.getSuccess("查询成功",list);
    }
    @ApiOperation("保存/修改标准关联关系")
    @RequestMapping(value = ServiceApi.StdRelation.Modify, method = RequestMethod.POST)
    public Envelop modify(@ApiParam(name = "list", value = "json字符串")
                          @RequestParam(value = "list") String list,
                          @ApiParam(name = "version", value = "版本号")
                          @RequestParam(value = "version") String version){
        Envelop envelop = new Envelop();
        try {
            List<StdDatasetRelation> stdDatasetRelations = Arrays.asList(objectMapper.readValue(list, StdDatasetRelation[].class));
            stdRelationService.modifyRelation(version,stdDatasetRelations);
            envelop.setStatus(200);
            envelop.setMessage("操作成功");
        } catch (Exception e) {
            e.printStackTrace();
            envelop.setStatus(-1);
            envelop.setMessage("操作失败");
        }
        return envelop;
    }
}

+ 3 - 15
svr/svr-basic/src/main/java/com/yihu/jw/basic/standard/dao/SQLGeneralDAO.java

@ -401,8 +401,7 @@ public class SQLGeneralDAO implements XSQLGeneralDAO {
        }
        String sql1 = sqlCreator.countData(tableName);
        Query query1 = this.getQuery(sqlCreator, sql1);
        Integer count1 = Integer.parseInt(StringUtil.toString(query1.list().get(0)));
        Integer count1 = jdbcTemplate.queryForObject(sql1,Integer.class);
        return count1;
    }
@ -554,7 +553,6 @@ public class SQLGeneralDAO implements XSQLGeneralDAO {
                            tokens[0] += " " + tokens[j];
                    }
                }
//            if (tokens.length > 2) throw new IllegalArgumentException("无效过滤参数");
                String group = null;
                if (tokens.length >= 2) group = tokens[1];
@ -600,7 +598,6 @@ public class SQLGeneralDAO implements XSQLGeneralDAO {
                            tokens[0] += " " + tokens[j];
                    }
                }
//            if (tokens.length > 2) throw new IllegalArgumentException("无效过滤参数");
                String group = null;
                if (tokens.length >= 2) group = tokens[1];
@ -612,11 +609,7 @@ public class SQLGeneralDAO implements XSQLGeneralDAO {
        }
        String sql = sqlCreator.countData(tableName);
        Query query = getCurrentSession().createSQLQuery(sql);
        for (String key : sqlCreator.getKeyValueMap().keySet()) {
            query.setParameter(key, sqlCreator.getKeyValueMap().get(key));
        }
        Long count = Long.valueOf(StringUtil.toString(query.list().get(0)));
        Long count = jdbcTemplate.queryForObject(sql,Long.class);
        return count;
    }
@ -670,11 +663,7 @@ public class SQLGeneralDAO implements XSQLGeneralDAO {
        }
        String sql = sqlCreator.countData(tableName);
        Query query = getCurrentSession().createSQLQuery(sql);
        for (String key : sqlCreator.getKeyValueMap().keySet()) {
            query.setParameter(key, sqlCreator.getKeyValueMap().get(key));
        }
        Long count = Long.valueOf(StringUtil.toString(query.list().get(0)));
        Long count = jdbcTemplate.queryForObject(sql,Long.class);
        return count;
    }
@ -697,7 +686,6 @@ public class SQLGeneralDAO implements XSQLGeneralDAO {
                            tokens[0] += " " + tokens[j] ;
                    }
                }
//            if (tokens.length > 2) throw new IllegalArgumentException("无效过滤参数");
                String group = null;
                if (tokens.length >= 2) group = tokens[1];

+ 152 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/standard/model/standard/StdDatasetRelation.java

@ -0,0 +1,152 @@
package com.yihu.jw.basic.standard.model.standard;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
@MappedSuperclass
public class StdDatasetRelation {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Integer id;
    @Column(name = "parent_dataset_id", nullable = false)
    private Long parentDatasetId;
    @Column(name = "parent_dataset_code", nullable = false, length = 50)
    private String parentDatasetCode;
    @Column(name = "parent_dataset_name", nullable = false, length = 250)
    private String parentDatasetName;
    @Column(name = "parent_metadata_id", nullable = false)
    private Long parentMetadataId;
    @Column(name = "parent_metadata_code", nullable = false, length = 50)
    private String parentMetadataCode;
    @Column(name = "parent_metadata_name", nullable = false, length = 250)
    private String parentMetadataName;
    @Column(name = "relation", nullable = false, length = 250)
    private String relation;
    @Column(name = "child_dataset_id", nullable = false)
    private Long childDatasetId;
    @Column(name = "child_dataset_code", nullable = false, length = 50)
    private String childDatasetCode;
    @Column(name = "child_dataset_name", nullable = false, length = 250)
    private String childDatasetName;
    @Column(name = "child_metadata_id", nullable = false)
    private Long childMetadataId;
    @Column(name = "child_metadata_code", nullable = false, length = 50)
    private String childMetadataCode;
    @Column(name = "child_metadata_name", nullable = false, length = 250)
    private String childMetadataName;
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public Long getParentDatasetId() {
        return parentDatasetId;
    }
    public void setParentDatasetId(Long parentDatasetId) {
        this.parentDatasetId = parentDatasetId;
    }
    public String getParentDatasetCode() {
        return parentDatasetCode;
    }
    public void setParentDatasetCode(String parentDatasetCode) {
        this.parentDatasetCode = parentDatasetCode;
    }
    public String getParentDatasetName() {
        return parentDatasetName;
    }
    public void setParentDatasetName(String parentDatasetName) {
        this.parentDatasetName = parentDatasetName;
    }
    public Long getParentMetadataId() {
        return parentMetadataId;
    }
    public void setParentMetadataId(Long parentMetadataId) {
        this.parentMetadataId = parentMetadataId;
    }
    public String getParentMetadataCode() {
        return parentMetadataCode;
    }
    public void setParentMetadataCode(String parentMetadataCode) {
        this.parentMetadataCode = parentMetadataCode;
    }
    public String getParentMetadataName() {
        return parentMetadataName;
    }
    public void setParentMetadataName(String parentMetadataName) {
        this.parentMetadataName = parentMetadataName;
    }
    public String getRelation() {
        return relation;
    }
    public void setRelation(String relation) {
        this.relation = relation;
    }
    public Long getChildDatasetId() {
        return childDatasetId;
    }
    public void setChildDatasetId(Long childDatasetId) {
        this.childDatasetId = childDatasetId;
    }
    public String getChildDatasetCode() {
        return childDatasetCode;
    }
    public void setChildDatasetCode(String childDatasetCode) {
        this.childDatasetCode = childDatasetCode;
    }
    public String getChildDatasetName() {
        return childDatasetName;
    }
    public void setChildDatasetName(String childDatasetName) {
        this.childDatasetName = childDatasetName;
    }
    public Long getChildMetadataId() {
        return childMetadataId;
    }
    public void setChildMetadataId(Long childMetadataId) {
        this.childMetadataId = childMetadataId;
    }
    public String getChildMetadataCode() {
        return childMetadataCode;
    }
    public void setChildMetadataCode(String childMetadataCode) {
        this.childMetadataCode = childMetadataCode;
    }
    public String getChildMetadataName() {
        return childMetadataName;
    }
    public void setChildMetadataName(String childMetadataName) {
        this.childMetadataName = childMetadataName;
    }
}

+ 91 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/standard/model/standard/StdIndex.java

@ -0,0 +1,91 @@
package com.yihu.jw.basic.standard.model.standard;
import javax.persistence.*;
@MappedSuperclass
public class StdIndex {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Integer id;//主键id
    @Column(name = "std_dataset_id", nullable = false)
    private Long stdDatasetId;//所属的数据集id
    @Column(name = "std_dataset_code", nullable = true, length = 32)
    private String stdDatasetCode;//所属的数据集code
    @Column(name = "index_name", nullable = true, length = 255)
    private String indexName;//索引名
    @Column(name = "index_field", nullable = false, length = 255)
    private String indexField;//字段,多个用,分割
    @Column(name = "index_type", nullable = false, length = 50)
    private String indexType;//索引类型   字典名: INDEX_TYPE
    @Column(name = "index_method", nullable = false, length = 50)
    private String indexMethod;//索引方法   字典名: INDEX_METHOD
    @Column(name = "version", nullable = false)
    private String version;//版本号
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public Long getStdDatasetId() {
        return stdDatasetId;
    }
    public void setStdDatasetId(Long stdDatasetId) {
        this.stdDatasetId = stdDatasetId;
    }
    public String getStdDatasetCode() {
        return stdDatasetCode;
    }
    public void setStdDatasetCode(String stdDatasetCode) {
        this.stdDatasetCode = stdDatasetCode;
    }
    public String getIndexName() {
        return indexName;
    }
    public void setIndexName(String indexName) {
        this.indexName = indexName;
    }
    public String getIndexField() {
        return indexField;
    }
    public void setIndexField(String indexField) {
        this.indexField = indexField;
    }
    public String getIndexType() {
        return indexType;
    }
    public void setIndexType(String indexType) {
        this.indexType = indexType;
    }
    public String getIndexMethod() {
        return indexMethod;
    }
    public void setIndexMethod(String indexMethod) {
        this.indexMethod = indexMethod;
    }
    public String getVersion() {
        return version;
    }
    public void setVersion(String version) {
        this.version = version;
    }
}

+ 8 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/standard/service/bo/StandardVersion.java

@ -9,6 +9,8 @@ public class StandardVersion {
    public final static String DictEntryTable = "std_dictionary_entry";
    public final static String CDADocumentTable = "std_cda_document";
    public final static String CDADatasetTable = "std_cda_dataset";
    public static final String StdIndexTable = "std_index";
    public static final String StdRelationTable = "std_dataset_relation";
    private ObjectVersion version;
@ -75,6 +77,12 @@ public class StandardVersion {
            case CDADatasetTable:
                tableName = CDADatasetTable + VersionBoundSymbol + version;
                break;
            case StdIndexTable:
                tableName = StdIndexTable + VersionBoundSymbol + version;
                break;
            case StdRelationTable:
                tableName = StdRelationTable + VersionBoundSymbol + version;
                break;
            default:
                tableName = null;
                break;

+ 45 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/standard/service/standard/StdRelationService.java

@ -0,0 +1,45 @@
package com.yihu.jw.basic.standard.service.standard;
import com.fasterxml.jackson.databind.JsonNode;
import com.yihu.jw.basic.standard.dao.SQLGeneralDAO;
import com.yihu.jw.basic.standard.model.standard.StdDatasetRelation;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.util.sql.SqlCreator;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.io.IOException;
import java.util.List;
@Transactional
@Service
public class StdRelationService extends SQLGeneralDAO {
    @Transactional
    public boolean modifyRelation(String version,List<StdDatasetRelation>  stdDatasetRelations) {
        boolean b = false;
        String tableName = "std_dataset_relation_"+version;
        String deleteSql = "DELETE FROM "+tableName;
        try {
            //删除该表记录
            jdbcTemplate.execute(deleteSql);
            //重新保存
            if(!CollectionUtils.isEmpty(stdDatasetRelations)){
                for (StdDatasetRelation model : stdDatasetRelations) {
                    SqlCreator sqlCreator = new SqlCreator(StdDatasetRelation.class);
                    JsonNode jsonNode =objectMapper.readTree(objectMapper.writeValueAsString(model));
                    String sql = sqlCreator.insertDataToSQL(tableName, jsonNode);
                    jdbcTemplate.execute(sql);
                }
            }
            b=true;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return b;
    }
}

+ 147 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/BaseDictController.java

@ -0,0 +1,147 @@
package com.yihu.jw.basic.system.controller;
import com.yihu.jw.basic.system.model.SystemDict;
import com.yihu.jw.basic.system.model.SystemDictList;
import com.yihu.jw.basic.system.service.BaseDictManager;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
 * Created by hzp on 2016/01/11.
 */
@RequestMapping("/basedict")
@RestController
public class BaseDictController extends EnvelopRestEndpoint {
    @Autowired
    private BaseDictManager dictManager;
    /****************** 字典目录 *****************************/
    /**
     * 获取字典目录
     */
    @GetMapping("getDictList")
    public Envelop getDictList(String condition, int page, int rows) {
        try {
            return dictManager.getSystemDictList(condition, page, rows);
        }
        catch (Exception e){
            e.printStackTrace();
            return failed("查询失败");
        }
    }
    /**
     * 新增字典
     */
    @PostMapping("addDict")
    public Envelop addDict() {
        try {
            SystemDictList dict = new SystemDictList();
            return dictManager.addDict(dict);
        }
        catch (Exception e){
            e.printStackTrace();
            return failed("新增失败");
        }
    }
    /**
     * 修改字典
     */
    @PostMapping("updateDict")
    public Envelop updateDict() {
        try {
            SystemDictList dict = new SystemDictList();
            return dictManager.updateDict(dict);
        }
        catch (Exception e){
            e.printStackTrace();
            return failed("修改失败");
        }
    }
    /**
     * 删除字典
     */
    @PostMapping("deleteDict")
    public Envelop deleteDict() {
        try {
            SystemDictList dict = new SystemDictList();
            return dictManager.deleteDict(dict);
        }
        catch (Exception e){
            e.printStackTrace();
            return failed("删除失败");
        }
    }
    /****************** 字典维护 *****************************/
    /**
     * 根据字典名称获取字典项(常用)
     */
    @GetMapping(value = "getDict",produces = "application/json")
    public Envelop getDict(String name,String where,String type) {
        try {
            return dictManager.getDict(name, where, type);
        }
        catch (Exception e){
            e.printStackTrace();
            return failed("查询失败");
        }
    }
    /**
     * 新增字典项
     */
    @PostMapping("addDictItem")
    public Envelop addDictItem() {
        try {
            SystemDict dict = new SystemDict();
            return dictManager.addDictItem(dict);
        }
        catch (Exception e){
            e.printStackTrace();
            return failed("新增失败");
        }
    }
    /**
     * 新增字典项
     */
    @PostMapping("updateDictItem")
    public Envelop updateDictItem() {
        try {
            SystemDict dict = new SystemDict();
            return dictManager.updateDictItem(dict);
        }
        catch (Exception e){
            e.printStackTrace();
            return failed("修改失败");
        }
    }
    /**
     * 删除字典项
     */
    @PostMapping("deleteDictItem")
    public Envelop deleteDictItem() {
        try {
            SystemDict dict = new SystemDict();
            return dictManager.deleteDictItem(dict);
        }
        catch (Exception e){
            e.printStackTrace();
            return failed("删除失败");
        }
    }
}

+ 145 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/DatasourceController.java

@ -0,0 +1,145 @@
//package com.yihu.jw.basic.system.controller;
//
//import com.yihu.hos.common.Services;
//import com.yihu.hos.system.model.SystemDatasource;
//import com.yihu.hos.system.model.SystemOrganization;
//import com.yihu.hos.system.service.DatasourceManager;
//import com.yihu.hos.system.service.OrganizationManager;
//import com.yihu.hos.web.framework.model.DataGridResult;
//import com.yihu.hos.web.framework.model.Result;
//import com.yihu.hos.web.framework.util.controller.BaseController;
//import org.apache.commons.beanutils.BeanUtils;
//import org.apache.commons.collections4.CollectionUtils;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import javax.annotation.Resource;
//import javax.servlet.http.HttpServletRequest;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
///**
// * 数据源管理
// */
//@RequestMapping("/datasource")
//@Controller
//public class DatasourceController extends BaseController {
//
//    @Resource(name = Services.Datasource)
//    DatasourceManager datasource;
//    @Resource(name = Services.Organization)
//    OrganizationManager organization;
//
//
//    /*******************************
//     * 数据源配置
//     ******************************************************/
//    /*
//       获取数据源列表
//    */
//    @RequestMapping("getDatasource")
//    @ResponseBody
//    public Result getDatasource(String orgId, String name, String type, int page, int rows) {
//        try {
//            Map<String, Object> map = new HashMap<>();
//            map.put("orgId", orgId);
//            map.put("name", name);
//            map.put("type", type);
//            DataGridResult dataGridResult = datasource.getDatasource(map, page, rows);
//            if (CollectionUtils.isNotEmpty(dataGridResult.getDetailModelList())) {
//                for (Object obj : dataGridResult.getDetailModelList()) {
//                    SystemDatasource datasource = (SystemDatasource) obj;
//                    SystemOrganization _tempOrg = organization.getOrgById(datasource.getOrgId());
//                    if (null != _tempOrg) {
//                        datasource.setOrgName(_tempOrg.getFullName());
//                    }
//                }
//            }
//            return dataGridResult;
//        } catch (Exception ex) {
//            return Result.error(ex.getMessage());
//        }
//    }
//
//    /*
//      根据组织获取数据源列表
//   */
//    @RequestMapping("getDatasourceByOrg")
//    @ResponseBody
//    public Result getDatasourceByOrg(String orgId) {
//        try {
//            return datasource.getDatasourceByOrg(orgId);
//        } catch (Exception ex) {
//            return Result.error(ex.getMessage());
//        }
//    }
//
//    /*
//        新增数据源
//     */
//    @RequestMapping("addDatasource")
//    @ResponseBody
//    public Result addDatasource(HttpServletRequest request) {
//        try {
//            SystemDatasource obj = new SystemDatasource();
//            BeanUtils.populate(obj, request.getParameterMap());
//
//            return datasource.addDatasource(obj);
//        } catch (Exception ex) {
//            return Result.error(ex.getMessage());
//        }
//    }
//
//    /*
//        修改数据源
//     */
//    @RequestMapping("updateDatasource")
//    @ResponseBody
//    public Result updateDatasource(HttpServletRequest request) {
//        try {
//            SystemDatasource obj = new SystemDatasource();
//            BeanUtils.populate(obj, request.getParameterMap());
//
//            return datasource.updateDatasource(obj);
//        } catch (Exception ex) {
//            return Result.error(ex.getMessage());
//        }
//    }
//
//    /*
//        测试数据源连接
//     */
//    @RequestMapping("testDatasource")
//    @ResponseBody
//    public Result testDatasource(String dataSource, String config) {
//        try {
//            return datasource.testDatasource(dataSource, config);
//        } catch (Exception ex) {
//            return Result.error(ex.getMessage());
//        }
//    }
//
//    /*
//        删除数据源
//     */
//    @RequestMapping("deleteDatasource")
//    @ResponseBody
//    public Result DeleteDatasource(String id) {
//        try {
//            return datasource.deleteDatasource(id);
//        } catch (Exception ex) {
//            return Result.error(ex.getMessage());
//        }
//    }
//
//    @RequestMapping(path = "data", method = RequestMethod.GET)
//    @ResponseBody
//    public List getData(@RequestParam(value = "lastUpdate", required = false)String lastUpdate) {
//        return datasource.getData();
//    }
//}

+ 214 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/DictController.java

@ -0,0 +1,214 @@
//package com.yihu.jw.basic.system.controller;
//
//import com.yihu.hos.system.model.SystemDict;
//import com.yihu.hos.system.model.SystemDictList;
//import com.yihu.hos.system.service.DictManager;
//import com.yihu.hos.web.framework.model.Result;
//import org.apache.commons.beanutils.BeanUtils;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.util.StringUtils;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import javax.annotation.Resource;
//import javax.servlet.http.HttpServletRequest;
//import java.util.HashMap;
//import java.util.Map;
//
///**
// * Created by chenweida on 2016/1/20.
// */
//@Controller
//@RequestMapping("/dict")
//public class DictController {
//    @Resource(name = DictManager.BEAN_ID)
//    private DictManager dictManager;
//
//    @RequestMapping("/initial")
//    public String dictInitial(Model model) {
//        model.addAttribute("contentPage", "system/dict/dict");
//        return "partView";
//    }
//
//    @RequestMapping("/dictDialog")
//    public String resourceRestDialog(Model model, String id, String mode) {
//        SystemDictList sdl;
//        try {
//            if ("view".equals(mode)) {
//                sdl = dictManager.getSystemDictListById(id);
//            } else if ("modify".equals(mode)) {
//                sdl = dictManager.getSystemDictListById(id);
//            } else {
//                sdl = new SystemDictList();
//            }
//            model.addAttribute("resourceId", id);
//            model.addAttribute("mode", mode);
//            model.addAttribute("model", sdl);
//            model.addAttribute("contentPage", "system/dict/dictDialog");
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//        return "pageView";
//    }
//
//    @RequestMapping("/dictItemDialog")
//    public String resourceRestDetailDialog(Model model, String id, String mode, String dictName) {
//        SystemDict sd = null;
//        try {
//            if ("view".equals(mode)) {
//                sd = dictManager.getSystemDictById(id);
//            } else if ("modify".equals(mode)) {
//                sd = dictManager.getSystemDictById(id);
//            } else {
//                sd = new SystemDict();
//                // sd.setInnerCode(chineseName);
//                sd.setDictName(dictName);
//
//            }
//            model.addAttribute("resourceId", id);
//            model.addAttribute("mode", mode);
//            model.addAttribute("model", sd);
//            model.addAttribute("contentPage", "system/dict/dictItemDialog");
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//        return "pageView";
//    }
//
//    /**
//     * 获取字典列表
//     */
//    @RequestMapping("/getDictList")
//    @ResponseBody
//    public Result getDictList(HttpServletRequest request) {
//        try {
//            Map<String, Object> params = new HashMap<>();
//            String name = request.getParameter("name");
//            params.put("name", name);
//            String page = StringUtils.isEmpty(request.getParameter("page")) ? "1" : request.getParameter("page");
//            String rows = StringUtils.isEmpty(request.getParameter("rows")) ? "10" : request.getParameter("rows");
//
//            params.put("page", page);
//            params.put("rows", rows);
//
//            return dictManager.getDictList(params);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error(ex.getMessage());
//        }
//    }
//
//
//    @RequestMapping("/deleteDict")
//    @ResponseBody
//    public Result deleteDict(HttpServletRequest request) {
//        try {
//            String id = request.getParameter("id");
//            return dictManager.deleteDict(id);
//        } catch (Exception e) {
//            e.printStackTrace();
//            return Result.error("删除失败");
//        }
//
//    }
//
//    @RequestMapping("/addDict")
//    @ResponseBody
//    public Result addDict(HttpServletRequest request) {
//        try {
//            SystemDictList rr = new SystemDictList();
//            BeanUtils.populate(rr, request.getParameterMap());
//            return dictManager.addDict(rr);
//        } catch (Exception e) {
//            e.printStackTrace();
//            return Result.error("新增失败");
//        }
//
//    }
//
//    @RequestMapping("/updateDict")
//    @ResponseBody
//    public Result updateDict(HttpServletRequest request) {
//        try {
//            SystemDictList rr = new SystemDictList();
//            BeanUtils.populate(rr, request.getParameterMap());
//            return dictManager.updateDict(rr);
//        } catch (Exception e) {
//            e.printStackTrace();
//            return Result.error("更新失败");
//        }
//
//    }
//
//
//    //-------------------------字典项----------------------------
//
//    /**
//     * 获取字典列表
//     */
//    @RequestMapping("/getDictItemList")
//    @ResponseBody
//    public Result getDictItemList(HttpServletRequest request) {
//        try {
//            Map<String, Object> params = new HashMap<>();
//            String name = request.getParameter("name");
//            String dictId = request.getParameter("dictId");
//            params.put("name", name);
//            String page = StringUtils.isEmpty(request.getParameter("page")) ? "1" : request.getParameter("page");
//            String rows = StringUtils.isEmpty(request.getParameter("rows")) ? "10" : request.getParameter("rows");
//
//            params.put("dictId", dictId);
//            params.put("page", page);
//            params.put("rows", rows);
//
//            return dictManager.getDictItemList(params);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error(ex.getMessage());
//        }
//    }
//
//
//    @RequestMapping("/deleteDictItem")
//    @ResponseBody
//    public Result deleteDictItem(HttpServletRequest request) {
//        try {
//            String id = request.getParameter("id");
//            return dictManager.deleteDictItem(id);
//        } catch (Exception e) {
//            e.printStackTrace();
//            return Result.error("删除失败");
//        }
//
//    }
//
//    @RequestMapping("/addDictItem")
//    @ResponseBody
//    public Result addDictItem(HttpServletRequest request) {
//        try {
//            SystemDict rr = new SystemDict();
//            BeanUtils.populate(rr, request.getParameterMap());
//            return dictManager.addDictItem(rr);
//        } catch (Exception e) {
//            e.printStackTrace();
//            return Result.error("新增失败");
//        }
//
//    }
//
//    @RequestMapping("/updateDictItem")
//    @ResponseBody
//    public Result updateDictItem(HttpServletRequest request) {
//        try {
//            SystemDict rr = new SystemDict();
//            BeanUtils.populate(rr, request.getParameterMap());
//            return dictManager.updateDictItem(rr);
//        } catch (Exception e) {
//            e.printStackTrace();
//            return Result.error("更新失败");
//        }
//
//    }
//
//}

+ 254 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/EsbDictEndPoint.java

@ -0,0 +1,254 @@
//package com.yihu.jw.basic.system.controller;
//
//import com.yihu.hos.core.constants.MicroServices;
//import com.yihu.hos.model.standard.MConventionalDict;
//import com.yihu.hos.system.model.SystemDict;
//import com.yihu.hos.system.service.DictManager;
//import com.yihu.hos.web.framework.util.controller.BaseController;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.annotation.Resource;
//import java.util.ArrayList;
//import java.util.Collection;
//import java.util.List;
//
///**
// * 惯用字典接口,用于快速提取常用的字典项。  提供给ehr
// */
//@RestController
//@RequestMapping(MicroServices.ApiVersion.Version1_0)
//@Api(value = "EIP-EHR-Dictionaries", description = "EHR调用EIP.获取常用字典项", tags = {"惯用字典"})
//public class EsbDictEndPoint extends BaseController {
//
//    @Resource(name = DictManager.BEAN_ID)
//    private DictManager dictManager;
//
//    @RequestMapping(value = "/dictionaries/app_catalog", method = RequestMethod.GET)
//    @ApiOperation(value = "获取应用类别字典项", response = MConventionalDict.class)
//    public MConventionalDict getAppCatalog(
//            @ApiParam(name = "code", value = "字典代码", defaultValue = "")
//            @RequestParam(value = "code") String code) {
//        SystemDict dict = dictManager.getDictIetm("APP_TYPE", code);
//        return changeToEhrDic(dict);
//    }
//
//    @RequestMapping(value = "/dictionaries/application_source", method = RequestMethod.GET)
//    @ApiOperation(value = "应用来源", response = MConventionalDict.class)
//    public MConventionalDict getApplicationSource(
//            @ApiParam(name = "code", value = "字典代码", defaultValue = "")
//            @RequestParam(value = "code") String code){
//        SystemDict dict = dictManager.getDictIetm("SOURCE_TYPE", code);
//        return changeToEhrDic(dict);
//    }
//
//    @RequestMapping(value = "/dictionaries/application_source_list", method = RequestMethod.GET)
//    @ApiOperation(value = "应用来源", response = MConventionalDict.class)
//    public Collection<MConventionalDict> getApplicationSourceList() {
//        List<SystemDict> list = dictManager.getDictEntries("SOURCE_TYPE",null);
//        List<MConventionalDict> result = new ArrayList<>();
//        for(SystemDict systemDict:list){
//            result.add(changeToEhrDic(systemDict));
//        }
//        return result;
//    }
//
//    @RequestMapping(value = "/dictionaries/app_status", method = RequestMethod.GET)
//    @ApiOperation(value = "获取应用状态字典项", response = MConventionalDict.class)
//    public MConventionalDict getAppStatus(
//            @ApiParam(name = "code", value = "字典代码", defaultValue = "")
//            @RequestParam(value = "code") String code) {
//        SystemDict dict = dictManager.getDictIetm("APP_STATUS", code);
//        return changeToEhrDic(dict);
//
//    }
//
//    @RequestMapping(value = "/dictionaries/application_menu_type", method = RequestMethod.GET)
//    @ApiOperation(value = "应用菜单类型", response = SystemDict.class)
//    public MConventionalDict getApplicationMenuType(
//            @ApiParam(name = "code", value = "字典代码", defaultValue = "")
//            @RequestParam(value = "code") String code){
//        SystemDict dict = dictManager.getDictIetm("APP_MENU_TYPE", code);
//        return changeToEhrDic(dict);
//    }
//
//    @RequestMapping(value = "/dictionaries/application_menu_type_list", method = RequestMethod.GET)
//    @ApiOperation(value = "应用菜单类型", response = MConventionalDict.class)
//    Collection<MConventionalDict> getApplicationMenuTypeList(){
//        List<SystemDict> list = dictManager.getDictEntries("APP_MENU_TYPE",null);
//        List<MConventionalDict> result = new ArrayList<>();
//        for(SystemDict systemDict:list){
//            result.add(changeToEhrDic(systemDict));
//        }
//        return result;
//    }
//
//    @RequestMapping(value = "/dictionaries/audit_level", method = RequestMethod.GET)
//    @ApiOperation(value = "审计等级", response = SystemDict.class)
//    public MConventionalDict getAuditLevel(
//            @ApiParam(name = "code", value = "字典代码", defaultValue = "")
//            @RequestParam(value = "code") String code){
//        SystemDict dict =  dictManager.getDictIetm("AUDIT_STATUS", code);
//        return changeToEhrDic(dict);
//    }
//
//    @RequestMapping(value = "/dictionaries/audit_level_list", method = RequestMethod.GET)
//    @ApiOperation(value = "审计等级", response = MConventionalDict.class)
//    Collection<MConventionalDict> getAuditLevelList(){
//        List<SystemDict> list = dictManager.getDictEntries("AUDIT_STATUS",null);
//        List<MConventionalDict> result = new ArrayList<>();
//        for(SystemDict systemDict:list){
//            result.add(changeToEhrDic(systemDict));
//        }
//        return result;
//    }
//
//    @RequestMapping(value = "/dictionaries/open_level", method = RequestMethod.GET)
//    @ApiOperation(value = "开放等级", response = SystemDict.class)
//    public MConventionalDict getOpenLevel(
//            @ApiParam(name = "code", value = "字典代码", defaultValue = "")
//            @RequestParam(value = "code") String code){
//        SystemDict dict =  dictManager.getDictIetm("OPEN_LEVEL", code);
//        return changeToEhrDic(dict);
//    }
//
//    @RequestMapping(value = "/dictionaries/open_level_list", method = RequestMethod.GET)
//    @ApiOperation(value = "开放等级", response = MConventionalDict.class)
//    Collection<MConventionalDict> getOpenLevelList(){
//        List<SystemDict> list = dictManager.getDictEntries("OPEN_LEVEL",null);
//        List<MConventionalDict> result = new ArrayList<>();
//        for(SystemDict systemDict:list){
//            result.add(changeToEhrDic(systemDict));
//        }
//        return result;
//    }
//
//    @RequestMapping(value = "/dictionaries/api_parameter_type", method = RequestMethod.GET)
//    @ApiOperation(value = "API参数类型", response = SystemDict.class)
//    public MConventionalDict getApiParameterType(
//            @ApiParam(name = "code", value = "字典代码", defaultValue = "")
//            @RequestParam(value = "code") String code){
//        SystemDict dict =  dictManager.getDictIetm("APICSLX", code);
//        return changeToEhrDic(dict);
//    }
//
//    @RequestMapping(value = "/dictionaries/api_parameter_type_list", method = RequestMethod.GET)
//    @ApiOperation(value = "API参数类型", response = MConventionalDict.class)
//    Collection<MConventionalDict> getApiParameterTypeList(){
//        List<SystemDict> list = dictManager.getDictEntries("APICSLX",null);
//        List<MConventionalDict> result = new ArrayList<>();
//        for(SystemDict systemDict:list){
//            result.add(changeToEhrDic(systemDict));
//        }
//        return result;
//    }
//
//    @RequestMapping(value = "/dictionaries/api_parameter_data_type", method = RequestMethod.GET)
//    @ApiOperation(value = "API参数数据类型", response = SystemDict.class)
//    public MConventionalDict getApiParameterDataType(
//            @ApiParam(name = "code", value = "字典代码", defaultValue = "")
//            @RequestParam(value = "code") String code){
//        SystemDict dict =  dictManager.getDictIetm("APICSSJLX", code);
//        return changeToEhrDic(dict);
//    }
//
//    @RequestMapping(value = "/dictionaries/api_parameter_data_type_list", method = RequestMethod.GET)
//    @ApiOperation(value = "API参数数据类型", response = MConventionalDict.class)
//    Collection<MConventionalDict> getApiParameterDataTypeList(){
//        List<SystemDict> list = dictManager.getDictEntries("APICSSJLX",null);
//        List<MConventionalDict> result = new ArrayList<>();
//        for(SystemDict systemDict:list){
//            result.add(changeToEhrDic(systemDict));
//        }
//        return result;
//    }
//
//    @RequestMapping(value = "/dictionaries/api_parameter_data_required", method = RequestMethod.GET)
//    @ApiOperation(value = "API参数必输标识", response = SystemDict.class)
//    public MConventionalDict getApiParameterDataRequired(
//            @ApiParam(name = "code", value = "字典代码", defaultValue = "")
//            @RequestParam(value = "code") String code){
//        SystemDict dict =  dictManager.getDictIetm("APICSBSBS", code);
//        return changeToEhrDic(dict);
//    }
//
//    @RequestMapping(value = "/dictionaries/api_parameter_data_required_list", method = RequestMethod.GET)
//    @ApiOperation(value = "API参数必输标识", response = MConventionalDict.class)
//    Collection<MConventionalDict> getApiParameterDataRequiredList(){
//        List<SystemDict> list = dictManager.getDictEntries("APICSBSBS",null);
//        List<MConventionalDict> result = new ArrayList<>();
//        for(SystemDict systemDict:list){
//            result.add(changeToEhrDic(systemDict));
//        }
//        return result;
//    }
//
//    @RequestMapping(value = "/dictionaries/api_protocol", method = RequestMethod.GET)
//    @ApiOperation(value = "API协议", response = MConventionalDict.class)
//    MConventionalDict getApiProtocol(
//            @ApiParam(name = "code", value = "字典代码", defaultValue = "")
//            @RequestParam(value = "code") String code){
//        SystemDict dict =  dictManager.getDictIetm("APIXY", code);
//        return changeToEhrDic(dict);
//    }
//
//    @RequestMapping(value = "/dictionaries/api_protocol_list", method = RequestMethod.GET)
//    @ApiOperation(value = "API协议", response = MConventionalDict.class)
//    Collection<MConventionalDict> getApiProtocolList(){
//        List<SystemDict> list = dictManager.getDictEntries("APIXY",null);
//        List<MConventionalDict> result = new ArrayList<>();
//        for(SystemDict systemDict:list){
//            result.add(changeToEhrDic(systemDict));
//        }
//        return result;
//    }
//
//    @RequestMapping(value = "/dictionaries/api_method", method = RequestMethod.GET)
//    @ApiOperation(value = "API方法", response = MConventionalDict.class)
//    MConventionalDict getApiMethod(
//            @ApiParam(name = "code", value = "字典代码", defaultValue = "")
//            @RequestParam(value = "code") String code){
//        SystemDict dict =  dictManager.getDictIetm("HTTP_TYPE", code);
//        return changeToEhrDic(dict);
//    }
//
//    @RequestMapping(value = "/dictionaries/api_method_list", method = RequestMethod.GET)
//    @ApiOperation(value = "API方法", response = MConventionalDict.class)
//    Collection<MConventionalDict> getApiMethodList(){
//        List<SystemDict> list = dictManager.getDictEntries("HTTP_TYPE",null);
//        List<MConventionalDict> result = new ArrayList<>();
//        for(SystemDict systemDict:list){
//            result.add(changeToEhrDic(systemDict));
//        }
//        return result;
//    }
//
//    @RequestMapping(value = "/dictionaries/api_type", method = RequestMethod.GET)
//    @ApiOperation(value = "API类型", response = MConventionalDict.class)
//    MConventionalDict getApiType(
//            @ApiParam(name = "code", value = "字典代码", defaultValue = "")
//            @RequestParam(value = "code") String code){
//        SystemDict dict =  dictManager.getDictIetm("APP_API_TYPE", code);
//        return changeToEhrDic(dict);
//    }
//
//    /**
//     * 将SystemDict 转换成ehr的 MConventionalDict类型(未包含主键id,因类型不同      未包含catalog,因eip没有此字段)
//     * @param dict
//     * @return
//     */
//    private MConventionalDict changeToEhrDic(SystemDict dict){
//        MConventionalDict mConventionalDict = new MConventionalDict();
//        mConventionalDict.setCode(dict.getCode());
//        mConventionalDict.setValue(dict.getValue());
//        mConventionalDict.setPhoneticCode(dict.getPyCode());
//        mConventionalDict.setSort(dict.getSort());
//        return mConventionalDict;
//    }
//
//}

+ 72 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/EsbSystemDictEntryEndPoint.java

@ -0,0 +1,72 @@
//package com.yihu.jw.basic.system.controller;
//
//import com.yihu.ehr.constants.ApiVersion;
//import com.yihu.hos.model.standard.MDictionaryEntry;
//import com.yihu.hos.system.model.SystemDict;
//import com.yihu.hos.system.service.SystemDictService;
//import com.yihu.hos.web.framework.util.controller.BaseController;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * @author Sand
// * @version 1.0
// * @created 2016.02.15 18:25
// */
//@RestController
//@RequestMapping(ApiVersion.Version1_0)
//@Api(value = "DictionaryEntry", description = "系统全局字典项管理", tags = {"系统字典-系统全局字典项管理"})
//public class EsbSystemDictEntryEndPoint extends BaseController {
//
//    @Autowired
//    private SystemDictService systemDictService;
//
//    @ApiOperation(value = "获取字典项列表")
//    @RequestMapping(value = "/esb/dictionaries/entries", method = RequestMethod.GET)
//    public List<MDictionaryEntry> getDictEntries(
//            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "")
//            @RequestParam(value = "fields", required = false) String fields,
//            @ApiParam(name = "filters", value = "过滤器", defaultValue = "")
//            @RequestParam(value = "filters", required = false) String filters,
//            @ApiParam(name = "sorts", value = "排序", defaultValue = "")
//            @RequestParam(value = "sorts", required = false) String sorts,
//            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
//            @RequestParam(value = "size", required = false) Integer size,
//            @ApiParam(name = "page", value = "页码", defaultValue = "1")
//            @RequestParam(value = "page", required = false) Integer page,
//            HttpServletRequest request,
//            HttpServletResponse response) throws Exception {
//        List<SystemDict> list = systemDictService.search(fields,filters,sorts,page,size);
//        pagedResponse(request, response,systemDictService.getCount(filters), page, size);
//        List<MDictionaryEntry> result = new ArrayList<>();
//        for(SystemDict systemDict:list){
//            result.add(changeToEhrDic(systemDict));
//        }
//        return result;
//    }
//
//    /**
//     * 将SystemDict 转换成ehr的 MConventionalDict类型(未包含主键id,因类型不同      未包含catalog,因eip没有此字段)
//     * @param dict
//     * @return
//     */
//    private MDictionaryEntry changeToEhrDic(SystemDict dict){
//        MDictionaryEntry mConventionalDict = new MDictionaryEntry();
//        mConventionalDict.setCode(dict.getCode());
//        mConventionalDict.setValue(dict.getValue());
//        mConventionalDict.setPhoneticCode(dict.getPyCode());
//        mConventionalDict.setSort(dict.getSort());
//        return mConventionalDict;
//    }
//}

+ 228 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/FlowController.java

@ -0,0 +1,228 @@
//package com.yihu.jw.basic.system.controller;
//
//import com.fasterxml.jackson.databind.ObjectMapper;
//import com.yihu.hos.config.BeanConfig;
//import com.yihu.hos.core.datatype.ClassFileUtil;
//import com.yihu.hos.system.model.SystemServiceFlow;
//import com.yihu.hos.system.model.SystemServiceFlowClass;
//import com.yihu.hos.system.model.SystemServiceFlowTemp;
//import com.yihu.hos.system.service.FlowManager;
//import com.yihu.hos.web.framework.constant.ServiceFlowConstant;
//import com.yihu.hos.web.framework.model.ActionResult;
//import com.yihu.hos.web.framework.model.DataGridResult;
//import com.yihu.hos.web.framework.model.Result;
//import com.yihu.hos.web.framework.util.controller.BaseController;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.util.StringUtils;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RequestPart;
//import org.springframework.web.bind.annotation.ResponseBody;
//import org.springframework.web.multipart.MultipartFile;
//
//import javax.annotation.Resource;
//import javax.servlet.http.HttpServletRequest;
//import java.io.File;
//import java.io.IOException;
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
///**
// * 流程管理
// *
// * @author HZY
// * @vsrsion 1.0
// * Created at 2016/8/18.
// */
//@RequestMapping("/flow")
//@Controller
//public class FlowController extends BaseController {
//
//    @Resource(name = FlowManager.BEAN_ID)
//    private FlowManager flowManage;
//    @Autowired
//    private BeanConfig beanConfig;
//
//    /**
//     * 流程管理管理界面
//     *
//     * @param model
//     * @return
//     */
//    @RequestMapping("/initial")
//    public String appInitial(Model model) {
//        model.addAttribute("contentPage", "system/flow/flow");
//        model.addAttribute("dfs", beanConfig.getFsUrl());
//        return "partView";
//    }
//
//    @RequestMapping("/getFlowList")
//    @ResponseBody
//    public Result getFlowList(HttpServletRequest request, String name, String valid) {
//        try {
//            Map<String, Object> params = new HashMap<>();
//            params.put("name", name);
//            params.put("valid", valid);
//
//            String page = StringUtils.isEmpty(request.getParameter("page")) ? "1" : request.getParameter("page");
//            String rows = StringUtils.isEmpty(request.getParameter("rows")) ? "10" : request.getParameter("rows");
//
//            params.put("page", page);
//            params.put("rows", rows);
//            DataGridResult result = (DataGridResult) flowManage.getFlowList(params);
//            List<SystemServiceFlow> detailModelList = result.getDetailModelList();
//            return result;
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error(ex.getMessage());
//        }
//    }
//
//    /**
//     * 流程管理-新增/修改页面
//     *
//     * @param model
//     * @param id
//     * @return
//     */
//    @RequestMapping("/editorFlow")
//    public String editorFlow(Model model, String id) {
//        try {
//            ObjectMapper objectMapper = new ObjectMapper();
//            SystemServiceFlow flow = null;
//            List<SystemServiceFlowClass> flowClassList = null;
//            List<SystemServiceFlowTemp> flowTempList = null;
//            if (id != null && id.length() > 0) {
//                flow = flowManage.getFlowById(Integer.parseInt(id));
//                flowClassList = flowManage.getFlowClassByFlowId(flow.getId());
//                flowTempList = flowManage.getFlowTempByFlowId(flow.getId());
//
//                if (ServiceFlowConstant.CLASS.equals(flow.getFileType())) {
//                    model.addAttribute("flowClass", objectMapper.writeValueAsString(flowClassList));
//                } else if (ServiceFlowConstant.JAVA.equals(flow.getFileType())) {
//                    model.addAttribute("flowClass", objectMapper.writeValueAsString(flowTempList));
//                }
//            } else {
//                flow = new SystemServiceFlow();
//                flowClassList = new ArrayList<>();
//                flowTempList = new ArrayList<>();
//            }
//            flow.setFlowClassArray(flowClassList);
//            flow.setFlowTempArray(flowTempList);
//            model.addAttribute("model", flow);
//            model.addAttribute("dfs", beanConfig.getFsUrl());
//            model.addAttribute("contentPage", "/system/flow/editorFlow");
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//        return "pageView";
//    }
//
//
//    /**
//     * 新增流程信息
//     *
//     * @param request
//     * @return
//     */
//    @RequestMapping("addFlow")
//    @ResponseBody
//    public Result addFlow(HttpServletRequest request, String flowClass) {
//        try {
//            ObjectMapper objectMapper = new ObjectMapper();
//            SystemServiceFlow flow = objectMapper.readValue(flowClass, SystemServiceFlow.class);
//
//            return flowManage.addFlow(flow);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error(ex.getMessage());
//        }
//    }
//
//    /**
//     * 删除流程信息
//     *
//     * @param request
//     * @return
//     */
//    @RequestMapping("/deleteFlow")
//    @ResponseBody
//    public Result deleteFlow(HttpServletRequest request) {
//
//        try {
//            String id = request.getParameter("id");
//            if (id != null && id.length() > 0) {
//                flowManage.deleteFlow(Integer.parseInt(id));
//                return Result.success("删除成功!");
//            } else {
//                return Result.error("删除失败,该流程已不存在!");
//            }
//
//        } catch (Exception e) {
//            e.printStackTrace();
//            return Result.error("删除失败!");
//        }
//    }
//
//    /**
//     * 修改流程信息
//     */
//    @RequestMapping("updateFlow")
//    @ResponseBody
//    public Result updateFlow(HttpServletRequest request, String flowClass) {
//        try {
//            ObjectMapper objectMapper = new ObjectMapper();
//            SystemServiceFlow flow = objectMapper.readValue(flowClass, SystemServiceFlow.class);
//            return flowManage.updateFlow(flow);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error(ex.getMessage());
//        }
//    }
//
//
//    @RequestMapping(value = "/flowTempList", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
//    @ResponseBody
//    public Result flowTempList(String type) {
//        try {
//            Result result = flowManage.getFlowList(type);
//            return result;
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error(ex.getMessage());
//        }
//    }
//
//    /**
//     * 上传文件并解析文件属性:包名,类名等
//     *
//     * @param file
//     * @return
//     */
//    @RequestMapping(value = "parseFile", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
//    @ResponseBody
//    public Result uploadAndParse(@RequestPart MultipartFile file) {
//        ActionResult re = new ActionResult();
//        File tempFile = new File(System.getProperty("java.io.tmpdir") + System.getProperty("file.separator") + file.getOriginalFilename());
//        try {
//            file.transferTo(tempFile);
//            // 解析文件并返回类属性
//            Map<String, String> map = flowManage.uploadAndParse(tempFile);
//            String path = ClassFileUtil.uploadFile(beanConfig.getFsUrl(), tempFile, file.getName());
//            map.put("path", path);
//            re.setData(map);
//            if (!StringUtils.isEmpty(path)) {
//                tempFile.delete();
//            }
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
//        return re;
//    }
//
//
//}

+ 160 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/OrgController.java

@ -0,0 +1,160 @@
//package com.yihu.jw.basic.system.controller;
//
//import com.yihu.hos.core.datatype.StringUtil;
//import com.yihu.hos.system.model.SystemOrganization;
//import com.yihu.hos.system.service.OrganizationManager;
//import com.yihu.hos.web.framework.model.Result;
//import com.yihu.hos.web.framework.util.controller.BaseController;
//import org.apache.commons.beanutils.BeanUtils;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import javax.annotation.Resource;
//import javax.servlet.http.HttpServletRequest;
//import java.util.HashMap;
//import java.util.Map;
//
///**
// * 机构管理
// * Created by hzp on 2016/1/12.
// */
//@RequestMapping("/org")
//@Controller
//public class OrgController extends BaseController {
//
//    @Resource(name = OrganizationManager.BEAN_ID)
//    private OrganizationManager organization;
//
//    /**
//     * 组织管理界面
//     * @param model
//     * @return
//     */
//    @RequestMapping("initial")
//    public String organization(Model model) {
//        model.addAttribute("contentPage","system/org/organization");
//        return "partView";
//    }
//
//
//    /**
//     * 组织编辑界面
//     */
//    @RequestMapping("editorOrganization")
//    public String editorOrganization(Model model,String orgId) {
//        try {
//            //是否编辑
//            if (orgId != null && orgId.length() > 0) {
//                //获取机构信息
//                SystemOrganization org = organization.getOrgById(orgId);
//                model.addAttribute("model", org);
//            }
//            model.addAttribute("contentPage", "system/org/editorOrganization");
//            return "pageView";
//        } catch (Exception ex) {
//            model.addAttribute("contentPage", "organization/editorOrganization");
//            return "pageView";
//        }
//    }
//
//
//    /**
//     * 获取组织列表
//     */
//    @RequestMapping("getOrgList")
//    @ResponseBody
//    public Result getOrgList(String pid,String name,String activityFlag,Integer page, Integer rows) {
//        try {
//            Map<String, Object> map = new HashMap<>();
//            map.put("pid", pid);
//            map.put("name", name);
//            map.put("activityFlag", activityFlag);
//
//            return organization.getOrgList(map, page, rows);
//        }
//        catch (Exception ex)
//        {
//            return Result.error(ex.getMessage());
//        }
//    }
//
//    /**
//     * 新增组织
//     */
//    @RequestMapping("addOrg")
//    @ResponseBody
//    public Result addOrg(HttpServletRequest request) {
//        try {
//            SystemOrganization obj = new SystemOrganization();
//
//            BeanUtils.populate(obj, request.getParameterMap());
//            obj.setActivityFlag("1");
//            return organization.addOrg(obj);
//
//            }
//            catch(Exception ex)
//            {
//                return Result.error(ex.getMessage());
//            }
//
//    }
//
//
//    /**
//     * 修改组织
//     */
//
//    @RequestMapping("updateOrg")
//    @ResponseBody
//    public Result updateOrg(HttpServletRequest request) {
//        try {
//
//            SystemOrganization obj = new SystemOrganization();
//            BeanUtils.populate(obj, request.getParameterMap());
//            if(!StringUtil.isEmpty(obj.getSettledWay()))
//            {
//                obj.setSettled("1");
//            }
//            else{
//                obj.setSettled("0");
//            }
//            return organization.updateOrg(obj);
//        }
//        catch (Exception ex)
//        {
//            return Result.error(ex.getMessage());
//        }
//    }
//
//    /**
//     * 删除组织
//     */
//    @RequestMapping("deleteOrg")
//    @ResponseBody
//    public Result deleteOrg(String orgId) {
//        try {
//            return organization.deleteOrg(orgId);
//        }
//        catch (Exception ex)
//        {
//            return Result.error(ex.getMessage());
//        }
//    }
//
//    /**
//     * 修改组织状态
//     *//*
//    @RequestMapping("activityOrg")
//    @ResponseBody
//    public Result activityOrg(String orgId,String activityFlag) {
//        try {
//            return organization.activityOrg(orgId,activityFlag);
//        }
//        catch (Exception ex)
//        {
//            return Result.error(ex.getMessage());
//        }
//    }*/
//}

+ 143 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/ParamController.java

@ -0,0 +1,143 @@
//package com.yihu.jw.basic.system.controller;
//
//import com.yihu.hos.system.model.SystemParam;
//import com.yihu.hos.system.service.SystemParamManager;
//import com.yihu.hos.web.framework.model.Result;
//import com.yihu.hos.web.framework.util.controller.BaseController;
//import org.apache.commons.beanutils.BeanUtils;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.util.StringUtils;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import javax.annotation.Resource;
//import javax.servlet.http.HttpServletRequest;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
///**
// * 系统参数管理
// */
//@RequestMapping("/param")
//@Controller
//public class ParamController extends BaseController {
//    @Resource(name = SystemParamManager.BEAN_ID)
//    private SystemParamManager systemParamManager;
//
//    /**
//     * 系统参数管理界面
//     *
//     * @param model
//     * @return
//     */
//    @RequestMapping("/initial")
//    public String roleInitial(Model model) {
//        model.addAttribute("contentPage", "system/systemparam/systemParam");
//        return "partView";
//    }
//
//    /**
//     * 系统参数列表
//     *
//     * @param request
//     * @return
//     */
//    @RequestMapping("getParamList")
//    @ResponseBody
//    public Result getParamList(HttpServletRequest request) {
//        try {
//            Map<String, Object> params = new HashMap<>();
//            String name = request.getParameter("name");
//            params.put("name", name);
//            String page = StringUtils.isEmpty(request.getParameter("page")) ? "1" : request.getParameter("page");
//            String rows = StringUtils.isEmpty(request.getParameter("rows")) ? "10" : request.getParameter("rows");
//
//            params.put("page", page);
//            params.put("rows", rows);
//            return systemParamManager.getParamList(params);
//        } catch (Exception ex) {
//            return Result.error(ex.getMessage());
//        }
//    }
//
//    /**
//     * 系统参数编辑界面
//     */
//    @RequestMapping("editorParam")
//    public String editorParam(Model model, String id) {
//        try {
//            //是否编辑
//            if (id != null && id.length() > 0) {
//                //获取菜单信息
//                SystemParam role = systemParamManager.getParamById(id);
//                model.addAttribute("model", role);
//            }
//            model.addAttribute("contentPage", "system/systemparam/editorParam");
//            return "pageView";
//        } catch (Exception ex) {
//            model.addAttribute("contentPage", "system/systemparam/editorParam");
//            return "pageView";
//        }
//    }
//
//    /**
//     * 新增系统参数
//     */
//    @RequestMapping("addParam")
//    @ResponseBody
//    public Result addParam(HttpServletRequest request) {
//        try {
//            SystemParam obj = new SystemParam();
//            BeanUtils.populate(obj, request.getParameterMap());
//
//            return systemParamManager.addParam(obj);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error(ex.getMessage());
//        }
//    }
//
//    /**
//     * 修改系统参数
//     */
//    @RequestMapping("updateParam")
//    @ResponseBody
//    public Result updateParam(HttpServletRequest request) {
//        try {
//            SystemParam obj = new SystemParam();
//            BeanUtils.populate(obj, request.getParameterMap());
//
//            return systemParamManager.updateParam(obj);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error(ex.getMessage());
//        }
//    }
//
//    /**
//     * 删除系统参数
//     */
//    @RequestMapping("deleteParam")
//    @ResponseBody
//    public Result deleteParam(HttpServletRequest request) {
//        try {
//            String id = request.getParameter("id");
//
//            return systemParamManager.deleteParam(id);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error(ex.getMessage());
//        }
//    }
//
//    @RequestMapping(path = "data", method = RequestMethod.GET)
//    @ResponseBody
//    public List getData(@RequestParam(value = "lastUpdate", required = false) String lastUpdate) {
//        return systemParamManager.getData(lastUpdate);
//    }
//
//}

+ 82 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/ProcessController.java

@ -0,0 +1,82 @@
//package com.yihu.jw.basic.system.controller;
//
//import com.yihu.hos.system.service.ProcessManager;
//import com.yihu.hos.web.framework.model.Result;
//import com.yihu.hos.web.framework.util.controller.BaseController;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//@RequestMapping("/process")
//@Controller
//public class ProcessController  extends BaseController {
//
//    @Autowired
//    private ProcessManager processManager;
//    /**
//     *  流程管理界面
//     *
//     * @param model
//     * @return
//     */
//    @RequestMapping("/initial")
//    public String processInitial(Model model, Integer flowId) {
//        model.addAttribute("flowId", flowId);
//        model.addAttribute("contentPage", "system/process/process");
//        return "partView";
//    }
//
//    @RequestMapping(value = "/getAllEndpoints", method = RequestMethod.GET)
//    @ResponseBody
//    public Result getAllEndpoints(String endpointName) {
//        try {
//            return processManager.getAllEndpoints(endpointName);
//        } catch (Exception e) {
//            return Result.error("查找端点失败");
//        }
//    }
//
//    @RequestMapping(value = "/getAllProcessors", method = RequestMethod.GET)
//    @ResponseBody
//    public Result getAllProcessor(String processorName) {
//        try {
//            return processManager.getAllProcessor(processorName);
//        } catch (Exception e) {
//            return Result.error("查找所有转换器失败");
//        }
//    }
//
//    @RequestMapping(value = "/chart", method = RequestMethod.GET)
//    @ResponseBody
//    public Result getFlowchart(Integer flowId) {
//        try {
//            if (flowId != null) {
//                String flowchart = processManager.getFlowchart(flowId);
//                return Result.success(flowchart);
//            } else {
//                return Result.success("无初始化数据");
//            }
//        } catch (Exception e) {
//            return Result.error("生成业务流程失败");
//        }
//    }
//
//    @RequestMapping(value = "/json", method = RequestMethod.POST)
//    @ResponseBody
//    public Result formatJson(String code, String name, String positionJson, String flowJson) {
//        try {
//            Integer flowId = processManager.generateFlow(code, name, flowJson);
//            if (flowId == null) {
//                return Result.error("生成业务流程失败,请确认流程图是否编辑错误");
//            }
//            processManager.saveProcess(code, name, flowId, positionJson, flowJson);
//
//            return Result.success("生成业务流程成功");
//        } catch (Exception e) {
//            return Result.error("生成业务流程失败");
//        }
//    }
//}

+ 133 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/ProcessorController.java

@ -0,0 +1,133 @@
//package com.yihu.jw.basic.system.controller;
//
//import com.yihu.hos.system.model.SystemServiceFlowProcessor;
//import com.yihu.hos.system.service.ProcessorManager;
//import com.yihu.hos.web.framework.model.Result;
//import com.yihu.hos.web.framework.util.controller.BaseController;
//import org.apache.commons.beanutils.BeanUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.util.StringUtils;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import javax.servlet.http.HttpServletRequest;
//import java.util.HashMap;
//import java.util.Map;
//
///**
// *  流程管理
// * @author HZY
// * @vsrsion 1.0
// * Created at 2016/8/12.
// */
//@RequestMapping("/processor")
//@Controller
//public class ProcessorController extends BaseController {
//
//    @Autowired
//    private ProcessorManager processorManager;
//
//    @RequestMapping("/initial")
//    public String processInitial(Model model) {
//        model.addAttribute("contentPage", "system/processor/processor");
//        return "partView";
//    }
//
//    @RequestMapping("/getProcessorList")
//    @ResponseBody
//    public Result getProcessorList(HttpServletRequest request,String name) {
//        try {
//            Map<String, Object> params = new HashMap<>();
//            params.put("name", name);
//
//            String page = StringUtils.isEmpty(request.getParameter("page")) ? "1" : request.getParameter("page");
//            String rows = StringUtils.isEmpty(request.getParameter("rows")) ? "10" : request.getParameter("rows");
//
//            params.put("page", page);
//            params.put("rows", rows);
//            Result result = processorManager.getProcessorList(params);
//            return result;
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error(ex.getMessage());
//        }
//
//    }
//
//    @RequestMapping("/editorProcessor")
//    public String editorAppServicePage(Model model, String id) {
//        try {
//            SystemServiceFlowProcessor serviceFlowProcessor = null;
//            if (id != null && id.length() > 0) {
//                serviceFlowProcessor = processorManager.getProcessorById(id);
//            }  else {
//                serviceFlowProcessor = new SystemServiceFlowProcessor();
//            }
//            model.addAttribute("model", serviceFlowProcessor);
//            model.addAttribute("contentPage", "/system/processor/editorProcessor");
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//        return "pageView";
//    }
//
//    @RequestMapping("/processorDetail")
//    public String appServiceDetail(Model model, String id) {
//        try {
//            SystemServiceFlowProcessor processor = null;
//            if (id != null && id.length() > 0) {
//                processor = processorManager.getProcessorById(id);
//            }  else {
//                processor = new SystemServiceFlowProcessor();
//            }
//            model.addAttribute("model", processor);
//            model.addAttribute("contentPage", "/system/processor/processorDetail");
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//        return "pageView";
//    }
//
//    @RequestMapping("addProcessor")
//    @ResponseBody
//    public Result addProcessor(HttpServletRequest request) {
//        try {
//            SystemServiceFlowProcessor obj = new SystemServiceFlowProcessor();
//            BeanUtils.populate(obj, request.getParameterMap());
//            return processorManager.addProcessor(obj);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error(ex.getMessage());
//        }
//    }
//
//    @RequestMapping("/deleteProcessor")
//    @ResponseBody
//    public Result deleteProcessor(HttpServletRequest request) {
//
//        try {
//            String id = request.getParameter("id");
//            processorManager.deleteProcessor(id);
//            return Result.success("删除成功!");
//        } catch (Exception e) {
//            e.printStackTrace();
//            return Result.error("删除失败!");
//        }
//    }
//
//    @RequestMapping("updateProcessor")
//    @ResponseBody
//    public Result updateProcessor(HttpServletRequest request) {
//        try {
//            SystemServiceFlowProcessor obj = new SystemServiceFlowProcessor();
//            BeanUtils.populate(obj, request.getParameterMap());
//
//            return processorManager.updateProcessor(obj);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error(ex.getMessage());
//        }
//    }
//}

+ 111 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/SystemController.java

@ -0,0 +1,111 @@
//package com.yihu.jw.basic.system.controller;
//
//import com.yihu.hos.system.service.SystemManager;
//import com.yihu.hos.tenant.model.TenantSession;
//import com.yihu.hos.tenant.service.AuthenticateService;
//import com.yihu.hos.web.framework.constant.ContextAttributes;
//import com.yihu.hos.web.framework.model.ActionResult;
//import com.yihu.hos.web.framework.model.Result;
//import com.yihu.hos.web.framework.thread.LocalContext;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.MediaType;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import javax.annotation.Resource;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import javax.servlet.http.HttpSession;
//import java.util.Map;
//
//
///**
// * 数据采集配置页面
// * Created by hzp on 2015/8/12.
// */
//@RequestMapping("/system")
//@Controller("systemController")
//public class SystemController {
//
//    @Resource(name = SystemManager.BEAN_ID)
//    private SystemManager ehr;
//
//    @Autowired
//    private AuthenticateService authenticateService;
//
//    /**
//     * 判断是否登录
//     *
//     * @return
//     */
//    @RequestMapping("isLogin")
//    @ResponseBody
//    public Result isLogin(HttpServletRequest request, HttpServletResponse response) {
//        try {
//            HttpSession session = request.getSession();
//            Object userInfo = session.getAttribute("userInfo");
//            if (userInfo == null) {
//                //重定向到指定页面
//                response.sendRedirect(request.getContextPath() + "/loginPage");
//                return Result.success("未登录!");
//            }
//            return Result.success("已登录!");
//        } catch (Exception ex) {
//            return Result.error(ex.getMessage());
//        }
//    }
//
//    /**
//     * 登录操作
//     */
//    @RequestMapping(value = "loginAction", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ResponseBody
//    public ActionResult loginAction(HttpServletRequest request, @RequestBody Map<String, Object> params) {
//        try {
//            HttpSession session = request.getSession();
//            String username = params.get("username").toString();
//            String password = params.get("password").toString();
//            return ehr.loginAction(session, username, password);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            ActionResult result = new ActionResult(false, "登录失败!密码错误!");
//            result.setData(ex.getMessage());
//            return result;
//        }
//    }
//
//    /*
//       退出操作
//        */
//    @RequestMapping("logoutAction")
//    @ResponseBody
//    public ActionResult logoutAction(HttpServletRequest request) {
//        try {
//            HttpSession session = request.getSession();
//            String userCode = "";
//            String tenant = "";
//            if (session == null) {
//                tenant = LocalContext.getContext().getAttachment(ContextAttributes.TENANT_NAME);
//            } else {
//                TenantSession tenantSession = (TenantSession) session.getAttribute(ContextAttributes.TENANT_SESSION);
//                if (tenantSession != null) {
//                    userCode = tenantSession.getUserCode();
//                    authenticateService.logout(session);
//                }
//                tenant = tenantSession.getTenant();
//            }
//            session.removeAttribute("userInfo");
//            LocalContext.getContext().removeAttachment(ContextAttributes.TENANT_NAME);
//            ActionResult re = new ActionResult(true, "登出成功!");
//            re.setData(tenant);
//            return re;
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return new ActionResult(false, "登出异常!");
//        }
//    }
//
//}

+ 263 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/controller/UserController.java

@ -0,0 +1,263 @@
//package com.yihu.jw.basic.system.controller;
//
//import com.yihu.hos.system.model.SystemUser;
//import com.yihu.hos.system.model.SystemUserRole;
//import com.yihu.hos.system.service.UserManager;
//import com.yihu.hos.web.framework.model.Result;
//import com.yihu.hos.web.framework.util.PKUtil;
//import com.yihu.hos.web.framework.util.controller.BaseController;
//import org.apache.commons.beanutils.BeanUtils;
//import org.apache.commons.codec.digest.DigestUtils;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.util.StringUtils;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import javax.annotation.Resource;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpSession;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
///**
// * 用户管理
// * Created by hzp on 2016/01/11.
// */
//@RequestMapping("/user")
//@Controller
//public class UserController extends BaseController {
//    @Resource(name = UserManager.BEAN_ID)
//    private UserManager userManager;
//
//
//    /**
//     * 用户管理界面
//     *
//     * @param model
//     * @return
//     */
//    @RequestMapping("/initial")
//    public String roleInitial(Model model) {
//        model.addAttribute("contentPage", "system/user/user");
//        return "partView";
//    }
//
//    /**
//     * 用户列表
//     *
//     * @param request
//     * @return
//     */
//    @RequestMapping("getUserList")
//    @ResponseBody
//    public Result getUserList(HttpServletRequest request) {
//        try {
//            Map<String, Object> params = new HashMap<>();
//            String name = request.getParameter("name");
//            params.put("name", name);
//            String page = StringUtils.isEmpty(request.getParameter("page")) ? "1" : request.getParameter("page");
//            String rows = StringUtils.isEmpty(request.getParameter("rows")) ? "10" : request.getParameter("rows");
//
//            params.put("page", page);
//            params.put("rows", rows);
//            return userManager.getUserList(params);
//        } catch (Exception ex) {
//            return Result.error(ex.getMessage());
//        }
//    }
//
//    /**
//     * 用户编辑界面
//     */
//    @RequestMapping("editorUser")
//    public String editorUser(Model model, String userId) {
//        try {
//            //是否编辑
//            if (userId != null && userId.length() > 0) {
//                //获取菜单信息
//                SystemUser user = userManager.getUserById(userId);
//                model.addAttribute("model", user);
//                model.addAttribute("userId", userId);
//            }
//            model.addAttribute("contentPage", "system/user/editorUser");
//            return "pageView";
//        } catch (Exception ex) {
//            return "error";
//        }
//    }
//
//
//    /**
//     * 用户编辑界面
//     */
//    @RequestMapping("roleDistribute")
//    public String roleDistribute(Model model, String userId) {
//        try {
//            //是否编辑
//            if (userId != null && userId.length() > 0) {
//                //获取菜单信息
//                SystemUser user = userManager.getUserById(userId);
//                List<SystemUserRole> userRoles = userManager.getUserRoleByUserId(userId);
//                String roleId = "";
//
//                if(userRoles != null)
//                {
//                    for(SystemUserRole userRole:userRoles)
//                    {
//                        roleId += (StringUtils.isEmpty(roleId)?"":",") + userRole.getRoleId();
//                    }
//                }
//
//                model.addAttribute("roleId", roleId);
//                model.addAttribute("model", user);
//                model.addAttribute("userId", userId);
//            }
//            model.addAttribute("contentPage", "system/user/roleDistribute");
//            return "pageView";
//        } catch (Exception ex) {
//            return "error";
//        }
//    }
//
//    /**
//     * 新增用户
//     */
//    @RequestMapping("addUser")
//    @ResponseBody
//    public Result addUser(HttpServletRequest request) {
//        try {
//            SystemUser obj = new SystemUser();
//            BeanUtils.populate(obj, request.getParameterMap());
//            String password = request.getParameter("password");
//            String passwordTwo = request.getParameter("passwordTwo");
//            if (!passwordTwo.equals(password)) {
//                throw new Exception("密码不一致");
//            }
//            String saltValu = PKUtil.getUuid();
//            obj.setSaltValue(saltValu);
//            obj.setActivated(SystemUser.ACTIVATED_FORBIDDEN);//未激活
//            obj.setPassword(DigestUtils.md5Hex(password + saltValu));
//            return userManager.addUser(obj);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error("新增用户异常,异常信息:\n"+ex.getMessage());
//        }
//    }
//
//    /**
//     * 修改用户
//     */
//    @RequestMapping("updateUser")
//    @ResponseBody
//    public Result updateUser(HttpServletRequest request) {
//        try {
//            SystemUser obj = new SystemUser();
//            BeanUtils.populate(obj, request.getParameterMap());
//
//            return userManager.updateUser(obj);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error("修改用户异常,异常信息:\n"+ex.getMessage());
//        }
//    }
//
//    /**
//     * 修改菜单状态
//     */
//    @RequestMapping("activityUser")
//    @ResponseBody
//    public Result activityUser(String userid, String flag) {
//        try {
//            return userManager.activityUser(userid, flag);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error("修改菜单状态异常,异常信息:\n"+ex.getMessage());
//
//        }
//    }
//
//    /**
//     * 密码重置
//     */
//    @RequestMapping("resetPassword")
//    @ResponseBody
//    public Result resetPassword(HttpServletRequest request) {
//        try {
//            String userid = request.getParameter("userid");
//            return userManager.resetPassword(userid);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error("密码异常,异常信息:\n"+ex.getMessage());
//        }
//    }
//    /**
//     * 修改密码界面
//     */
//    @RequestMapping("renewPassword")
//    public String renewPassword(Model model) {
//        try {
//
//            model.addAttribute("model",null);
//
//            model.addAttribute("contentPage", "system/user/changePassword");
//            return "pageView";
//        } catch (Exception ex) {
//            return "error";
//        }
//    }
//    /**
//     * 修改密码
//     */
//    @RequestMapping("changePassword")
//    @ResponseBody
//    public Result changePassword(HttpServletRequest request) {
//        try {
//            HttpSession session = request.getSession();
//            String s="username";
//            SystemUser user = (SystemUser) session.getAttribute("userInfo");
//            String oldPassword = request.getParameter("oldPassword");
//
//            userManager.getUserByLoginCode(user.getLoginCode()).getSaltValue();
//            String test= DigestUtils.md5Hex(oldPassword +  userManager.getUserByLoginCode(user.getLoginCode()).getSaltValue());
//            if(!userManager.getUserByLoginCode(user.getLoginCode()).getPassword().equals(test)){
//                return Result.error("旧密码输入错误");
//            }
//            String newPassword = request.getParameter("newPassword");
//           return userManager.changePassword(userManager.getUserByLoginCode(user.getLoginCode()).getId(), newPassword);
//
//
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error("修改密码异常,异常信息:\n"+ex.getMessage());
//
//        }
//    }
//
//    /**
//     * 删除用户
//     */
//    @RequestMapping("deleteUser")
//    @ResponseBody
//    public Result deleteUser(String userid) {
//        try {
//            return userManager.deleteUser(userid);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error("用户删除异常,异常信息:\n"+ex.getMessage());
//        }
//    }
//
//
//    @RequestMapping("/userRoleDistribute")
//    @ResponseBody
//    public Result userRoleDistribute(HttpServletRequest request,String userId,String roleId)
//    {
//        try {
//            return userManager.userRoleDistribute(userId,roleId);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            return Result.error("角色分配异常,异常信息:\n"+ex.getMessage());
//        }
//    }
//}

+ 122 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/BaseDictDao.java

@ -0,0 +1,122 @@
package com.yihu.jw.basic.system.dao;
import com.yihu.jw.basic.standard.dao.SQLGeneralDAO;
import com.yihu.jw.basic.standard.model.DictItem;
import com.yihu.jw.basic.system.model.SystemDict;
import com.yihu.jw.basic.system.model.SystemDictList;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.util.common.StringUtil;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by hzp on 2016/1/11.
 */
@Repository("BaseDictDao")
public class BaseDictDao extends SQLGeneralDAO {
    public static final String BEAN_ID = "BaseDictDao";
    /**
     * 获取系统字典列表
     * @return
     */
   
    public Envelop getSystemDictList(String condition, Integer page, Integer pageSize) throws Exception  {
        return null;
    }
    /**
     * 通过ID获取系统字典信息
     * @return
     */
   
    public SystemDictList getSystemDictInfoById(String id) throws Exception  {
        String sql = "select * from system_dict_list where id = '"+id+"'";
        return super.queryObjBySql(sql,SystemDictList.class);
    }
    /**
     * 通过dictName获取字典信息
     * @return
     */
   
    public SystemDictList getSystemDictInfoByName(String dictName) throws Exception {
        String sql = "select * from system_dict_list where dict_name = '"+dictName+"'";
        return super.queryObjBySql(sql,SystemDictList.class);
    }
    /**
     * 获取某字典数据
     * @return
     */
   
    public Envelop getSystemDict(String dictName) throws Exception
    {
        String sql = "select * from system_dict where dict_name = '"+dictName+"' order by sort";
        List<SystemDict> list = super.queryListBySql(sql,SystemDict.class);
        if(list!=null&&list.size()>0)
        {
            List<DictItem> dictList = new ArrayList<>();
            for(SystemDict item:list){
                DictItem dict = new DictItem();
                dict.setCode(item.getCode());
                dict.setValue(item.getValue());
                dict.setExtend(item.getPyCode());
                dictList.add(dict);
            }
        }
        return ListEnvelop.getSuccess("查询成功",list);
    }
    /**
     * 获取某字典数据
     * @return
     */
   
    public Envelop getRelationDict(String tableName,String codeCol,String valueCole,String extendCol,String Where) throws Exception
    {
        String sql = "select "+ codeCol+" as code,"+valueCole +" as value";
        if(!StringUtil.isEmpty(extendCol))
        {
            sql +=","+extendCol +" as extend";
        }
        else{
            sql+=",'' as extend";
        }
        sql += " from "+tableName.toLowerCase();
        if(!StringUtil.isEmpty(Where))
        {
            sql +=" where " + Where;
        }
        sql += " order by " + valueCole;
        List<DictItem> list = super.queryListBySql(sql,DictItem.class);
        return ListEnvelop.getSuccess("查询成功",list);
    }
    /**
     * 获取标准字典数据
     * @return
     */
    public Envelop getStdDict(String code) throws Exception
    {
        return null;
    }
}

+ 123 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/DatasourceDao.java

@ -0,0 +1,123 @@
//package com.yihu.jw.basic.system.dao;
//
//import com.yihu.hos.system.model.SystemDatasource;
//import com.yihu.jw.basic.standard.dao.SQLGeneralDAO;
//import com.yihu.jw.basic.standard.model.DataGridResult;
//import org.hibernate.Query;
//import org.springframework.stereotype.Repository;
//import org.springframework.util.StringUtils;
//
//import java.sql.Connection;
//import java.sql.DriverManager;
//import java.util.List;
//import java.util.Map;
//
///**
// * 数据源管理
// * Created by hzp on 2016/1/16.
// */
//@Repository("DatasourceDao")
//public class DatasourceDao extends SQLGeneralDAO {
//
//    public static final String BEAN_ID = "DatasourceDao";
//
//    /**
//     * 测试连接数据源
//     */
//
//    public void testDatasource(String type,String config) throws Exception
//    {
//        String driver = "";
//        switch(type.toLowerCase())
//        {
//            case "mysql"://"MYSQL"
//            {
//                driver = "com.mysql.jdbc.Driver";
//                break;
//            }
//            case "oracle"://ORACLE
//            {
//                driver = "oracle.jdbc.driver.OracleDriver";
//                break;
//            }
//            case "sqlserver"://SQL SERVER
//            {
//                driver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
//                break;
//            }
//        }
//
//        Class.forName(driver).newInstance();
//        Connection con = DriverManager.getConnection(config);
//        con.close();
//
//    }
//
//    /**
//     * 获取数据源列表
//     * @return
//     */
//
//    public DataGridResult getDatasource(Map<String, Object> conditionMap, Integer page, Integer pageSize) throws Exception
//    {
//        StringBuilder sb = new StringBuilder();
//        sb.append("from SystemDatasource t where 1=1 ");
//        if (!StringUtils.isEmpty(conditionMap.get("orgId"))) //组织ID
//        {
//            sb.append(" and t.orgId = '" + conditionMap.get("orgId") + "'");
//        }
//        if (!StringUtils.isEmpty(conditionMap.get("type"))) //数据源类型
//        {
//            sb.append(" and t.type = '" + conditionMap.get("type") + "'");
//        }
//        if (!StringUtils.isEmpty(conditionMap.get("name"))) {
//            sb.append(" and t.name like '%" + conditionMap.get("name") + "%'");
//        }
//        return getDataGridResult(sb.toString(),page,pageSize);
//    }
//
//    public List getData() {
//        Query query = getCurrentSession().createQuery("from SystemDatasource t");
//        return query.list();
//    }
//
//    /**
//     * 获取全部数据源列表
//     * @return
//     */
//
//    public DataGridResult getDatasourceByOrg(String orgId) throws Exception
//    {
//        DataGridResult re = new DataGridResult();
//        String sql = "select * from system_datasource";
//        if(orgId!=null&&orgId.length()>0){
//            sql += " where org_id ='"+orgId+"'";
//        }
//
//        List<SystemDatasource> list = super.queryListBySql(sql,SystemDatasource.class);
//        re.setDetailModelList(list);
//
//        return re;
//    }
//
//    /**
//     * 修改数据源状态(暂弃)
//     */
//
//    public void validDatasource(String id,String valid)  throws Exception
//    {
//        String sql = "update system_datasource set activity_Flag='"+valid+"' where Id='"+id+"'";
//        super.execute(sql);
//    }
//
//
//    public List<SystemDatasource> getDatasources(String orgId) throws Exception {
//        String sql = "select * from system_datasource";
//        if(orgId!=null&&orgId.length()>0){
//            sql += " where org_id ='"+orgId+"'";
//        }
//
//        List<SystemDatasource> list = super.queryListBySql(sql,SystemDatasource.class);
//        return list;
//    }
//}

+ 83 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/DictDao.java

@ -0,0 +1,83 @@
package com.yihu.jw.basic.system.dao;
import com.yihu.jw.basic.standard.dao.SQLGeneralDAO;
import com.yihu.jw.basic.standard.model.Result;
import com.yihu.jw.basic.system.model.SystemDict;
import org.springframework.stereotype.Repository;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.Map;
/**
 * Created by chenweida on 2016/1/20.
 */
@Repository("dictDao")
public class DictDao extends SQLGeneralDAO {
    public static final String BEAN_ID = "dictDao";
   
    public Result getDictList(Map<String, Object> params) throws Exception {
        StringBuilder sb = new StringBuilder(" from SystemDict s where 1=1 ");
        if (!StringUtils.isEmpty(params.get("dictId"))) {
            sb.append(" and  (s.dictName = '" + params.get("dictId") +"')");
        }
       else if (!StringUtils.isEmpty(params.get("name"))) {
            sb.append(" and  (s.code like '%" + params.get("name") + "%' or s.value like '%" + params.get("name")+"%')");
        }
        return super.getDataGridResult(sb.toString(), Integer.valueOf(params.get("page").toString()), Integer.valueOf(params.get("rows").toString()));
    }
   
//    public SystemDict getDictItemByCodeWithOutId(String code, String id) throws Exception  {
//        List<SystemDict> sds = (List<SystemDict>) super.hibernateTemplate.find("from SystemDict s where s.code=? and s.id != ?", code, id);
//        if (sds != null && sds.size() > 0) {
//            return sds.get(0);
//        }
//        return null;
//    }
//
//
//    public SystemDict getDictItemByCode(String code) throws Exception {
//        List<SystemDict> sds = (List<SystemDict>) super.hibernateTemplate.find("from SystemDict s where s.code=? ", code);
//        if (sds != null && sds.size() > 0) {
//            return sds.get(0);
//        }
//        return null;
//    }
   
    public void delDictItemByDictName(String dictName) throws Exception
    {
        String sqlStr = "delete from system_dict where dict_name='" + dictName + "'";
        super.execute(sqlStr);
    }
//    public SystemDict getDictIetmValue(String dictName, String code) {
//        List<SystemDict> sds = (List<SystemDict>) super.hibernateTemplate.find("from SystemDict s where s.dictName=? and s.code = ?", dictName, code);
//        if (sds != null && sds.size() > 0) {
//            return sds.get(0);
//        }
//        return null;
//
//    }
//    public List<SystemDict> getDictEntries(String dictName, String[] codes) {
//        List<SystemDict> sds = null;
//        if(codes != null && codes.length>0){
//            String codeStr = "";
//            for(String code: codes){
//                codeStr+=","+code;
//            }
//            codeStr = codeStr.substring(1,codeStr.length());
//            sds =  (List<SystemDict>) super.hibernateTemplate.find("from SystemDict s where s.dictName=? and s.code in ("+ codeStr+")" , dictName);
//        }else{
//            sds = (List<SystemDict>) super.hibernateTemplate.find("from SystemDict s where s.dictName=? ", dictName);
//        }
//        return sds;
//
//    }
}

+ 46 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/DictListDao.java

@ -0,0 +1,46 @@
//package com.yihu.jw.basic.system.dao;
//
//import com.yihu.hos.system.model.SystemDictList;
//import com.yihu.hos.web.framework.dao.SQLGeneralDAO;
//import com.yihu.hos.web.framework.model.Result;
//import org.springframework.stereotype.Repository;
//import org.springframework.util.StringUtils;
//
//import java.util.List;
//import java.util.Map;
//
///**
// * Created by chenweida on 2016/1/20.
// */
//@Repository("dictListDao")
//public class DictListDao extends SQLGeneralDAO  {
//
//    public static final String BEAN_ID = "dictListDao";
//
//    public Result getDictList(Map<String, Object> params) throws Exception {
//        StringBuilder sb = new StringBuilder("from SystemDictList s where 1=1 ");
//        if (!StringUtils.isEmpty(params.get("name"))) {
//            sb.append(" and  s.chineseName like '%" + params.get("name") + "%' ");
//        }
//        sb.append(" order by dictName desc");
//        return super.getDataGridResult(sb.toString(), Integer.valueOf(params.get("page").toString()), Integer.valueOf(params.get("rows").toString()));
//    }
//
//
//    public SystemDictList getDitcByName(String dictName) throws Exception {
//        List<SystemDictList> sdl = (List<SystemDictList>) super.hibernateTemplate.find("from SystemDictList s where s.dictName=?", dictName);
//        if (sdl != null && sdl.size() > 0) {
//            return sdl.get(0);
//        }
//        return null;
//    }
//
//
//    public SystemDictList getDitcByNameWithOutId(String dictName, String id) throws Exception {
//        List<SystemDictList> sdl = (List<SystemDictList>) super.hibernateTemplate.find("from SystemDictList s where s.dictName=? and s.id!=?", dictName, id);
//        if (sdl != null && sdl.size() > 0) {
//            return sdl.get(0);
//        }
//        return null;
//    }
//}

+ 60 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/FlowClassDao.java

@ -0,0 +1,60 @@
//package com.yihu.jw.basic.system.dao;
//
//import com.yihu.hos.system.model.SystemServiceFlowClass;
//import com.yihu.hos.web.framework.dao.SQLGeneralDAO;
//import org.hibernate.Query;
//import org.hibernate.Session;
//import org.springframework.stereotype.Repository;
//
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * @author HZY
// * @vsrsion 1.0
// * Created at 2016/8/19.
// */
//@Repository("flowClassDao")
//public class FlowClassDao extends SQLGeneralDAO {
//    public static final String BEAN_ID = "flowClassDao";
//
//
//    public List<SystemServiceFlowClass> getFlowClassByFlowId(Integer flowId) throws Exception {
//        List<SystemServiceFlowClass> flowClasses = (List<SystemServiceFlowClass>) super.hibernateTemplate.find("from SystemServiceFlowClass s where s.flowId=? ", flowId);
//        if (flowClasses != null && flowClasses.size() > 0) {
//            return flowClasses;
//        }
//        return new ArrayList<>();
//    }
//
//    public List<SystemServiceFlowClass> getFlowClass(Integer flowId, String type) throws Exception {
//        List<SystemServiceFlowClass> flowClasses = (List<SystemServiceFlowClass>) super.hibernateTemplate.find("from SystemServiceFlowClass s where s.flowId=? and type=? ", flowId, type);
//        if (flowClasses != null && flowClasses.size() > 0) {
//            return flowClasses;
//        }
//        return new ArrayList<>();
//    }
//
//    public boolean deleteFlowClassByFlowId(Integer flowId) {
//        try {
//            Session session = getCurrentSession();
//            String sql = "delete from system_service_flow_class where flow_id = :flowId";
//            Query query = session.createSQLQuery(sql);
//            query.setInteger("flowId", flowId);
//            query.executeUpdate();
//            return true;
//        } catch (Exception e) {
//            e.printStackTrace();
//            return false;
//        }
//
//    }
//
//    public List<Integer> getFlowClassIds(Integer flowId) {
//        Session session = getCurrentSession();
//        String sql = "SELECT id from system_service_flow_class where flow_id = :flowId";
//        Query query = session.createSQLQuery(sql);
//        query.setInteger("flowId", flowId);
//        return query.list();
//    }
//}

+ 41 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/FlowDao.java

@ -0,0 +1,41 @@
//package com.yihu.jw.basic.system.dao;
//
//import com.yihu.hos.system.model.SystemServiceFlow;
//import com.yihu.hos.web.framework.dao.SQLGeneralDAO;
//import com.yihu.hos.web.framework.model.Result;
//import org.springframework.stereotype.Repository;
//import org.springframework.util.StringUtils;
//
//import java.util.List;
//import java.util.Map;
//
///**
// * @author HZY
// * @vsrsion 1.0
// * Created at 2016/8/19.
// */
//@Repository("flowDao")
//public class FlowDao extends SQLGeneralDAO {
//    public static final String BEAN_ID = "flowDao";
//
//    public Result getFlowList(Map<String, Object> params) throws Exception {
//        StringBuilder sb = new StringBuilder("from SystemServiceFlow t where 1=1 ");
//        if (!StringUtils.isEmpty(params.get("valid"))) //是否有效
//        {
//            sb.append(" and t.valid = '" + params.get("valid") + "'");
//        }
//        Object name = params.get("name");
//        if (!StringUtils.isEmpty(name)) {
//            sb.append(" and (t.name like '%" + name + "%' or t.code like '%" + name + "%')");
//        }
//
//        return super.getDataGridResult(sb.toString(), Integer.valueOf(params.get("page").toString()), Integer.valueOf(params.get("rows").toString()));
//    }
//
//    public List<SystemServiceFlow> getFlowList(String type) throws Exception {
//        List<SystemServiceFlow> list = (List<SystemServiceFlow>) super.hibernateTemplate.find("from SystemServiceFlow s where s.valid=1 and fileType=? ",  type);
//        return list;
//    }
//
//
//}

+ 33 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/FlowProcessDao.java

@ -0,0 +1,33 @@
//package com.yihu.jw.basic.system.dao;
//
//import com.yihu.hos.core.datatype.CollectionUtil;
//import com.yihu.hos.system.model.SystemServiceFlowProcess;
//import com.yihu.hos.web.framework.dao.SQLGeneralDAO;
//import org.springframework.stereotype.Repository;
//
//import java.util.List;
//
//@Repository("flowProcessDao")
//public class FlowProcessDao extends SQLGeneralDAO {
//    public static final String BEAN_ID = "flowProcessDao";
//    public List<SystemServiceFlowProcess> getFlowProcessList(String type) throws Exception {
//        List<SystemServiceFlowProcess> list = (List<SystemServiceFlowProcess>) super.hibernateTemplate.find("from SystemServiceFlowProcess");
//        return list;
//    }
//
//    public SystemServiceFlowProcess getFlowProcessByCode(String code) throws Exception {
//        List<SystemServiceFlowProcess> list = (List<SystemServiceFlowProcess>) super.hibernateTemplate.find("from SystemServiceFlowProcess s where code=? ", code);
//        if (!CollectionUtil.isEmpty(list)) {
//            return list.get(0);
//        }
//        return null;
//    }
//
//    public SystemServiceFlowProcess getFlowProcessByFlowId(Integer flowId) throws Exception {
//        List<SystemServiceFlowProcess> list = (List<SystemServiceFlowProcess>) super.hibernateTemplate.find("from SystemServiceFlowProcess s where flowId=? ", flowId);
//        if (!CollectionUtil.isEmpty(list)) {
//            return list.get(0);
//        }
//        return null;
//    }
//}

+ 51 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/FlowTempDao.java

@ -0,0 +1,51 @@
//package com.yihu.jw.basic.system.dao;
//
//import com.yihu.hos.system.model.SystemServiceFlowTemp;
//import com.yihu.hos.web.framework.dao.SQLGeneralDAO;
//import org.hibernate.Query;
//import org.hibernate.Session;
//import org.springframework.stereotype.Repository;
//
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * @author HZY
// * @vsrsion 1.0
// * Created at 2016/8/19.
// */
//@Repository("flowTempDao")
//public class FlowTempDao extends SQLGeneralDAO {
//
//    public static final String BEAN_ID = "flowTempDao";
//
//    public List<SystemServiceFlowTemp> getFlowTempByFlowId(Integer flowId) throws Exception {
//        List<SystemServiceFlowTemp> flowTemps = (List<SystemServiceFlowTemp>) super.hibernateTemplate.find("from SystemServiceFlowTemp s where s.flowId=? ", flowId);
//        if (flowTemps != null && flowTemps.size() > 0) {
//            return flowTemps;
//        }
//        return new ArrayList<>();
//    }
//
//    public List<SystemServiceFlowTemp> getFlowTemps(Integer flowId, String type) throws Exception {
//        List<SystemServiceFlowTemp> flowTemps = (List<SystemServiceFlowTemp>) super.hibernateTemplate.find("from SystemServiceFlowTemp s where s.flowId=? and type=? ", flowId,type);
//        if (flowTemps != null && flowTemps.size() > 0) {
//            return flowTemps;
//        }
//        return new ArrayList<>();
//    }
//
//    public boolean deleteFlowTempByFlowId(Integer flowId) {
//        try {
//            Session session = getCurrentSession();
//            String sql = "delete from system_service_flow_template where flow_id = :flowId";
//            Query query = session.createSQLQuery(sql);
//            query.setInteger("flowId", flowId);
//            query.executeUpdate();
//            return true;
//        }catch (Exception e){
//            e.printStackTrace();
//            return false;
//        }
//    }
//}

+ 79 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/OrganizationDao.java

@ -0,0 +1,79 @@
//package com.yihu.jw.basic.system.dao;
//
//import com.yihu.hos.system.model.SystemOrganization;
//import com.yihu.hos.web.framework.dao.SQLGeneralDAO;
//import com.yihu.hos.web.framework.model.DataGridResult;
//import org.springframework.stereotype.Repository;
//import org.springframework.util.StringUtils;
//
//import java.util.List;
//import java.util.Map;
//
///**
// * Created by hzp on 2016/1/11.
// */
//@Repository("OrganizationDao")
//public class OrganizationDao extends SQLGeneralDAO  {
//
//    public static final String BEAN_ID = "OrganizationDao";
//
//    /**
//     * 获取组织列表
//     * @return
//     */
//    public DataGridResult getOrgList(Map<String, Object> conditionMap, Integer page, Integer pageSize) throws Exception
//    {
//        StringBuilder sb = new StringBuilder();
//
//        sb.append("from SystemOrganization t where 1=1 ");
//        if (!StringUtils.isEmpty(conditionMap.get("pid"))) //父级ID
//        {
//            sb.append(" and t.pid = '" + conditionMap.get("pid") + "'");
//        }
//        Object name = conditionMap.get("name");
//        if (!StringUtils.isEmpty(name)) {
//            sb.append(" and (t.code like '%" + name + "%' or t.fullName like '%" + name + "%' or t.shortName like '%" + name + "%' or t.pyCode like '%" + name + "%')");
//        }
//        if (!StringUtils.isEmpty(conditionMap.get("activityFlag"))) //是否有效
//        {
//            sb.append(" and t.activityFlag = '" + conditionMap.get("activityFlag") + "'");
//        }
//
//        return getDataGridResult(sb.toString(),page,pageSize);
//    }
//
//    /**
//     * 获取获取组织信息ByCodeAndName
//     * @return
//     */
//    public List getOrgByCodeOrName(String code, String name) throws Exception
//    {
//        String sql = "select * from system_organization where code = '"+code+"'or full_name = '"+name+"'";
//        List<SystemOrganization> list = super.queryListBySql(sql,SystemOrganization.class);
//
//        return list;
//    }
//
//
//    /**
//     * 修改组织状态
//     */
//    public void activityOrg(String orgId,String activityFlag) throws Exception
//    {
//        String sql = "update System_Organization set activity_Flag='"+activityFlag+"' where Id='"+orgId+"'";
//        super.execute(sql);
//    }
//
//    public SystemOrganization getOrgByIde(String orgId) throws Exception
//    {
//        String sql = "select * from system_organization where id = '"+orgId+"'and activity_flag = '1'";
//        List<SystemOrganization> list = super.queryListBySql(sql, SystemOrganization.class);
//        if (list!=null && list.size()>0){
//            return list.get(0);
//        }else {
//            return null;
//        }
//
//    }
//
//}

+ 38 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/ProcessorDao.java

@ -0,0 +1,38 @@
//package com.yihu.jw.basic.system.dao;
//
//import com.yihu.hos.core.datatype.StringUtil;
//import com.yihu.hos.system.model.SystemServiceFlowProcessor;
//import com.yihu.hos.web.framework.dao.SQLGeneralDAO;
//import com.yihu.hos.web.framework.model.Result;
//import org.springframework.stereotype.Repository;
//import org.springframework.util.StringUtils;
//
//import java.util.List;
//import java.util.Map;
//
///**
// * @author HZY
// * @vsrsion 1.0
// * Created at 2016/8/16.
// */
//@Repository("processorDao")
//public class ProcessorDao extends SQLGeneralDAO {
//    public static final String BEAN_ID = "processorDao";
//
//    public Result getProcessorList(Map<String, Object> params) throws Exception {
//        StringBuilder sb = new StringBuilder("from SystemServiceFlowProcessor t where 1=1 ");
//        Object name = params.get("name");
//        if (!StringUtils.isEmpty(name)) {
//            sb.append(" and (t.name like '%" + name + "%'')");
//        }
//        return super.getDataGridResult(sb.toString(), Integer.valueOf(params.get("page").toString()), Integer.valueOf(params.get("rows").toString()));
//    }
//
//    public List<SystemServiceFlowProcessor> getListByName(String processorName) throws Exception {
//        String hql = "from SystemServiceFlowProcessor";
//        if (!StringUtil.isEmpty(processorName)) {
//            hql += " where name = "+processorName+"";
//        }
//        return getEntityList(SystemServiceFlowProcessor.class, hql);
//    }
//}

+ 52 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/SystemParamDao.java

@ -0,0 +1,52 @@
//package com.yihu.jw.basic.system.dao;
//
//import com.yihu.hos.system.model.SystemParam;
//import com.yihu.hos.web.framework.dao.SQLGeneralDAO;
//import com.yihu.hos.web.framework.model.Result;
//import org.hibernate.Query;
//import org.springframework.stereotype.Repository;
//import org.springframework.util.StringUtils;
//
//import java.util.List;
//import java.util.Map;
//
///**
// * Created by chenweida on 2016/1/19.
// */
//@Repository("systemParamDao")
//public class SystemParamDao extends SQLGeneralDAO {
//
//    public static final String BEAN_ID = "systemParamDao";
//
//
//    public Result getParamList(Map<String, Object> params) throws Exception {
//        StringBuilder sb = new StringBuilder("from SystemParam t where 1=1 ");
//        if (!StringUtils.isEmpty(params.get("name"))) {
//            sb.append(" and (t.paramKey like '%" + params.get("name") + "%' or t.paramValue like '%" + params.get("name") + "%')");
//        }
//        return super.getDataGridResult(sb.toString(), Integer.valueOf(params.get("page").toString()), Integer.valueOf(params.get("rows").toString()));
//    }
//
//
//    public SystemParam getParamByKey(String paramKey) throws Exception {
//        List<SystemParam> sParams = (List<SystemParam>) super.hibernateTemplate.find("from SystemParam s where s.paramKey = ?", paramKey);
//        if (sParams != null && sParams.size() > 0) {
//            return sParams.get(0);
//        }
//        return null;
//    }
//
//
//    public SystemParam getParamByKeyWithOutId(String paramKey, String id) throws Exception {
//        List<SystemParam> sParams = (List<SystemParam>) super.hibernateTemplate.find("from SystemParam s where s.paramKey=? and s.id!=?", paramKey, id);
//        if (sParams != null && sParams.size() > 0) {
//            return sParams.get(0);
//        }
//        return null;
//    }
//
//    public List getData(String lastUpdate) {
//        Query query = getCurrentSession().createQuery("from SystemParam t");
//        return query.list();
//    }
//}

+ 60 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/dao/UserDao.java

@ -0,0 +1,60 @@
//package com.yihu.jw.basic.system.dao;
//
//import com.yihu.hos.system.model.SystemUser;
//import com.yihu.hos.system.model.SystemUserRole;
//import com.yihu.hos.web.framework.dao.SQLGeneralDAO;
//import com.yihu.hos.web.framework.model.Result;
//import org.springframework.stereotype.Repository;
//import org.springframework.util.StringUtils;
//
//import java.util.List;
//import java.util.Map;
//
///**
// * Created by chenweida on 2016/1/19.
// */
//@Repository("userDao")
//public class UserDao extends SQLGeneralDAO {
//
//    public static final String BEAN_ID = "userDao";
//
//
//    public Result getUserList(Map<String, Object> params) throws Exception {
//        StringBuilder sb = new StringBuilder("from SystemUser t where 1=1  and t.activated != '"+SystemUser.ACTIVATED_DELETE+"'");
//        if (!StringUtils.isEmpty(params.get("name"))) {
//            sb.append(" and t.loginCode like '%" + params.get("name") + "%' ");
//        }
//        return super.getDataGridResult(sb.toString(), Integer.valueOf(params.get("page").toString()), Integer.valueOf(params.get("rows").toString()));
//    }
//
//
//    public void activityUser(String useid, String flag) throws Exception {
//        String sql = "update System_user set activated='" + flag + "' where Id='" + useid + "'";
//        super.execute(sql);
//    }
//
//
//    public SystemUser getUserByLoginCode(String loginCode) {
//        List<SystemUser> users = (List<SystemUser>) hibernateTemplate.find("from SystemUser s where s.loginCode =? and s.activated!=?", loginCode,SystemUser.ACTIVATED_DELETE);
//        if (users != null && users.size() > 0) {
//            return users.get(0);
//        }
//        return null;
//    }
//
//    public void deleteUserRoleByUserId(String userId) throws Exception
//    {
//        String sql = "delete from system_user_role where user_id ='"+ userId + "'";
//        super.execute(sql);
//    }
//
//    public List<SystemUserRole> getUserRoleByUserId(String userId) throws Exception
//    {
//        List<SystemUserRole> userRolse = (List<SystemUserRole>) hibernateTemplate.find("from SystemUserRole s where s.userId =? ", userId);
//        if (userRolse != null && userRolse.size() > 0) {
//            return userRolse;
//        }
//        return null;
//    }
//
//}

+ 45 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/ProcessResultModel.java

@ -0,0 +1,45 @@
package com.yihu.jw.basic.system.model;
/**
 * SystemApp entity. @author MyEclipse Persistence Tools
 */
public class ProcessResultModel implements java.io.Serializable {
	private String name;
	private String value;
	private String config;
	private String nodeType;
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getValue() {
		return value;
	}
	public void setValue(String value) {
		this.value = value;
	}
	public String getConfig() {
		return config;
	}
	public void setConfig(String config) {
		this.config = config;
	}
	public String getNodeType() {
		return nodeType;
	}
	public void setNodeType(String nodeType) {
		this.nodeType = nodeType;
	}
}

+ 26 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SyncMessage.java

@ -0,0 +1,26 @@
package com.yihu.jw.basic.system.model;
/**
 * @author Airhead
 * @created 2018-03-30
 */
public class SyncMessage {
    private String lastUpdate;
    private String url;
    public String getLastUpdate() {
        return lastUpdate;
    }
    public void setLastUpdate(String lastUpdate) {
        this.lastUpdate = lastUpdate;
    }
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
}

+ 17 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SyncStandardMessage.java

@ -0,0 +1,17 @@
package com.yihu.jw.basic.system.model;
/**
 * @author Airhead
 * @created 2018-04-02
 */
public class SyncStandardMessage extends SyncMessage {
    private String version;
    public String getVersion() {
        return version;
    }
    public void setVersion(String version) {
        this.version = version;
    }
}

+ 79 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SystemArea.java

@ -0,0 +1,79 @@
package com.yihu.jw.basic.system.model;
/**
 * SystemArea entity. @author MyEclipse Persistence Tools
 */
public class SystemArea implements java.io.Serializable {
	// Fields
	private String id;
	private String name;
	private String pid;
	private String shortName;
	private String postCode;
	// Constructors
	/** default constructor */
	public SystemArea() {
	}
	/** minimal constructor */
	public SystemArea(String name, String pid) {
		this.name = name;
		this.pid = pid;
	}
	/** full constructor */
	public SystemArea(String name, String pid, String shortName, String postCode) {
		this.name = name;
		this.pid = pid;
		this.shortName = shortName;
		this.postCode = postCode;
	}
	// Property accessors
	public String getId() {
		return this.id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getName() {
		return this.name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getPid() {
		return this.pid;
	}
	public void setPid(String pid) {
		this.pid = pid;
	}
	public String getShortName() {
		return this.shortName;
	}
	public void setShortName(String shortName) {
		this.shortName = shortName;
	}
	public String getPostCode() {
		return this.postCode;
	}
	public void setPostCode(String postCode) {
		this.postCode = postCode;
	}
}

+ 87 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SystemDatasource.java

@ -0,0 +1,87 @@
package com.yihu.jw.basic.system.model;
/**
 * SystemDatasource entity. @author MyEclipse Persistence Tools
 */
public class SystemDatasource implements java.io.Serializable {
	// Fields
	private String id;
	private String orgId;
	private String name;
	private String config;
	private String type;
	// 显示作用,不用持久化到数据库
	private String orgName;
	// Constructors
	/** default constructor */
	public SystemDatasource() {
	}
	/** minimal constructor */
	public SystemDatasource(String name) {
		this.name = name;
	}
	/** full constructor */
	public SystemDatasource(String orgId, String name, String config, String type) {
		this.orgId = orgId;
		this.name = name;
		this.config = config;
		this.type = type;
	}
	// Property accessors
	public String getId() {
		return this.id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getOrgId() {
		return this.orgId;
	}
	public void setOrgId(String orgId) {
		this.orgId = orgId;
	}
	public String getName() {
		return this.name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getConfig() {
		return this.config;
	}
	public void setConfig(String config) {
		this.config = config;
	}
	public String getType() {
		return this.type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getOrgName() {
		return orgName;
	}
	public void setOrgName(String orgName) {
		this.orgName = orgName;
	}
}

+ 90 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SystemDict.java

@ -0,0 +1,90 @@
package com.yihu.jw.basic.system.model;
/**
 * SystemDict entity. @author MyEclipse Persistence Tools
 */
public class SystemDict implements java.io.Serializable {
	// Fields
	private String id;
	private String dictName;
	private String code;
	private String value;
	private String pyCode;
	private Integer sort;
	// Constructors
	/** default constructor */
	public SystemDict() {
	}
	/** minimal constructor */
	public SystemDict(String dictName, String code, String value) {
		this.dictName = dictName;
		this.code = code;
		this.value = value;
	}
	/** full constructor */
	public SystemDict(String dictName, String code, String value, String pyCode, Integer sort) {
		this.dictName = dictName;
		this.code = code;
		this.value = value;
		this.pyCode = pyCode;
		this.sort = sort;
	}
	// Property accessors
	public String getId() {
		return this.id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getDictName() {
		return this.dictName;
	}
	public void setDictName(String dictName) {
		this.dictName = dictName;
	}
	public String getCode() {
		return this.code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getValue() {
		return this.value;
	}
	public void setValue(String value) {
		this.value = value;
	}
	public String getPyCode() {
		return this.pyCode;
	}
	public void setPyCode(String pyCode) {
		this.pyCode = pyCode;
	}
	public Integer getSort() {
		return this.sort;
	}
	public void setSort(Integer sort) {
		this.sort = sort;
	}
}

+ 130 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SystemDictList.java

@ -0,0 +1,130 @@
package com.yihu.jw.basic.system.model;
/**
 * SystemDictList entity. @author MyEclipse Persistence Tools
 */
public class SystemDictList implements java.io.Serializable {
	// Fields
	private String id;
	private String dictName;
	private String chineseName;
	private String pyCode;
	private String pid;
	private String remark;
	private String relationTable;
	private String relationColCode;
	private String relationColValue;
	private String relationColExtend;
	// Constructors
	/** default constructor */
	public SystemDictList() {
	}
	/** minimal constructor */
	public SystemDictList(String dictName, String chineseName, String pid) {
		this.dictName = dictName;
		this.chineseName = chineseName;
		this.pid = pid;
	}
	/** full constructor */
	public SystemDictList(String dictName, String chineseName, String pyCode, String pid, String desc
			, String relationTable, String relationColCode, String relationColValue,String relationColExtend) {
		this.dictName = dictName;
		this.chineseName = chineseName;
		this.pyCode = pyCode;
		this.pid = pid;
		this.relationTable = relationTable;
		this.relationColCode = relationColCode;
		this.relationColValue = relationColValue;
		this.relationColExtend = relationColExtend;
	}
	// Property accessors
	public String getId() {
		return this.id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getDictName() {
		return this.dictName;
	}
	public void setDictName(String dictName) {
		this.dictName = dictName;
	}
	public String getChineseName() {
		return this.chineseName;
	}
	public void setChineseName(String chineseName) {
		this.chineseName = chineseName;
	}
	public String getPyCode() {
		return this.pyCode;
	}
	public void setPyCode(String pyCode) {
		this.pyCode = pyCode;
	}
	public String getPid() {
		return this.pid;
	}
	public void setPid(String pid) {
		this.pid = pid;
	}
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public String getRelationTable() {
		return this.relationTable;
	}
	public void setRelationTable(String relationTable) {
		this.relationTable = relationTable;
	}
	public String getRelationColCode() {
		return this.relationColCode;
	}
	public void setRelationColCode(String relationColCode) {
		this.relationColCode = relationColCode;
	}
	public String getRelationColValue() {
		return this.relationColValue;
	}
	public void setRelationColValue(String relationColValue) {
		this.relationColValue = relationColValue;
	}
	public String getRelationColExtend() {
		return this.relationColExtend;
	}
	public void setRelationColExtend(String relationColExtend) {
		this.relationColExtend = relationColExtend;
	}
}

+ 196 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SystemOrganization.java

@ -0,0 +1,196 @@
package com.yihu.jw.basic.system.model;
/**
 * SystemOrganization entity. @author MyEclipse Persistence Tools
 */
public class SystemOrganization implements java.io.Serializable {
	// Fields
	private String id;
	private String fullName;
	private String pid;
	private String activityFlag;
	private String code;
	private String shortName;
	private String pyCode;
	private String area;
	private String address;
	private String orgType;
	private String settled;
	private String settledWay;
	private String tel;
	private String tags;
	private String qlcOrgCode;
	private String qlcAdapterVersion;
	// Constructors
	/** default constructor */
	public SystemOrganization() {
	}
	/** minimal constructor */
	public SystemOrganization(String fullName, String pid, String activityFlag) {
		this.fullName = fullName;
		this.pid = pid;
		this.activityFlag = activityFlag;
	}
	/** full constructor */
	public SystemOrganization(String fullName, String pid, String activityFlag, String code, String shortName, String pyCode, String area, String address, String orgType, String settled, String settledWay, String tel, String tags) {
		this.fullName = fullName;
		this.pid = pid;
		this.activityFlag = activityFlag;
		this.code = code;
		this.shortName = shortName;
		this.pyCode = pyCode;
		this.area = area;
		this.address = address;
		this.orgType = orgType;
		this.settled = settled;
		this.settledWay = settledWay;
		this.tel = tel;
		this.tags = tags;
	}
	// Property accessors
	public String getId() {
		return this.id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getFullName() {
		return this.fullName;
	}
	public void setFullName(String fullName) {
		this.fullName = fullName;
	}
	public String getPid() {
		return this.pid;
	}
	public void setPid(String pid) {
		this.pid = pid;
	}
	public String getActivityFlag() {
		return this.activityFlag;
	}
	public void setActivityFlag(String activityFlag) {
		this.activityFlag = activityFlag;
	}
	public String getCode() {
		return this.code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getShortName() {
		return this.shortName;
	}
	public void setShortName(String shortName) {
		this.shortName = shortName;
	}
	public String getPyCode() {
		return this.pyCode;
	}
	public void setPyCode(String pyCode) {
		this.pyCode = pyCode;
	}
	public String getArea() {
		return this.area;
	}
	public void setArea(String area) {
		this.area = area;
	}
	public String getAddress() {
		return this.address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getOrgType() {
		return this.orgType;
	}
	public void setOrgType(String orgType) {
		this.orgType = orgType;
	}
	public String getSettled() {
		return this.settled;
	}
	public void setSettled(String settled) {
		this.settled = settled;
	}
	public String getSettledWay() {
		return this.settledWay;
	}
	public void setSettledWay(String settledWay) {
		this.settledWay = settledWay;
	}
	public String getTel() {
		return this.tel;
	}
	public void setTel(String tel) {
		this.tel = tel;
	}
	public String getTags() {
		return this.tags;
	}
	public void setTags(String tags) {
		this.tags = tags;
	}
	public String getQlcOrgCode() {
		return qlcOrgCode;
	}
	public void setQlcOrgCode(String qlcOrgCode) {
		this.qlcOrgCode = qlcOrgCode;
	}
	public String getQlcAdapterVersion() {
		return qlcAdapterVersion;
	}
	public void setQlcAdapterVersion(String qlcAdapterVersion) {
		this.qlcAdapterVersion = qlcAdapterVersion;
	}
}

+ 65 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SystemParam.java

@ -0,0 +1,65 @@
package com.yihu.jw.basic.system.model;
/**
 * SystemParam entity. @author MyEclipse Persistence Tools
 */
public class SystemParam implements java.io.Serializable {
    // Fields
    private String id;
    private String paramKey;
    private String paramValue;
    private String remark;
    private String orgId;
    // Constructors
    /**
     * default constructor
     */
    public SystemParam() {
    }
    public String getParamKey() {
        return paramKey;
    }
    public void setParamKey(String paramKey) {
        this.paramKey = paramKey;
    }
    public String getParamValue() {
        return paramValue;
    }
    public void setParamValue(String paramValue) {
        this.paramValue = paramValue;
    }
    public String getId() {
        return this.id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getRemark() {
        return this.remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getOrgId() {
        return this.orgId;
    }
    public void setOrgId(String orgId) {
        this.orgId = orgId;
    }
}

+ 122 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SystemServiceFlow.java

@ -0,0 +1,122 @@
package com.yihu.jw.basic.system.model;
import java.util.Date;
import java.util.List;
/**
 *  系统管理-服务流程
 * @author HZY
 * @vsrsion 1.0
 * Created at 2016/8/19.
 */
public class SystemServiceFlow implements java.io.Serializable {
    private Integer id;
    private String code;
    private String name;
    private String path;//流程路径
    private String chart;//流程图路径
    private String description;
    private Integer valid;
    private Date createDate;
    private String fileType;
    private String flowClassList;
    private List<SystemServiceFlowClass> flowClassArray;
    private List<SystemServiceFlowTemp> flowTempArray;
    public List<SystemServiceFlowTemp> getFlowTempArray() {
        return flowTempArray;
    }
    public void setFlowTempArray(List<SystemServiceFlowTemp> flowTempArray) {
        this.flowTempArray = flowTempArray;
    }
    public String getFileType() {
        return fileType;
    }
    public void setFileType(String fileType) {
        this.fileType = fileType;
    }
    public String getFlowClassList() {
        return flowClassList;
    }
    public void setFlowClassList(String flowClassList) {
        this.flowClassList = flowClassList;
    }
    public List<SystemServiceFlowClass> getFlowClassArray() {
        return flowClassArray;
    }
    public void setFlowClassArray(List<SystemServiceFlowClass> flowClassArray) {
        this.flowClassArray = flowClassArray;
    }
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getPath() {
        return path;
    }
    public void setPath(String path) {
        this.path = path;
    }
    public String getChart() {
        return chart;
    }
    public void setChart(String chart) {
        this.chart = chart;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public Integer getValid() {
        return valid;
    }
    public void setValid(Integer valid) {
        this.valid = valid;
    }
    public Date getCreateDate() {
        return createDate;
    }
    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }
}

+ 75 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SystemServiceFlowClass.java

@ -0,0 +1,75 @@
package com.yihu.jw.basic.system.model;
/**
 *  系统服务流程class
 * @author HZY
 * @vsrsion 1.0
 * Created at 2016/8/19.
 */
public class SystemServiceFlowClass implements java.io.Serializable {
    private Integer id;
    private String className;
    private String packageName;
    private String classPath;
    private Integer flowId;
    private String type;
    //标识 是否有做文件上传
    private String isUpdate;
    public String getIsUpdate() {
        return isUpdate;
    }
    public void setIsUpdate(String isUpdate) {
        this.isUpdate = isUpdate;
    }
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public String getClassName() {
        return className;
    }
    public void setClassName(String className) {
        this.className = className;
    }
    public String getPackageName() {
        return packageName;
    }
    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }
    public String getClassPath() {
        return classPath;
    }
    public void setClassPath(String classPath) {
        this.classPath = classPath;
    }
    public Integer getFlowId() {
        return flowId;
    }
    public void setFlowId(Integer flowId) {
        this.flowId = flowId;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
}

+ 37 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SystemServiceFlowConfig.java

@ -0,0 +1,37 @@
package com.yihu.jw.basic.system.model;
/**
 *  系统管理-服务流程
 * @author HZY
 * @vsrsion 1.0
 * Created at 2016/8/19.
 */
public class SystemServiceFlowConfig implements java.io.Serializable {
    private Integer id;
    private Integer flowId;
    private String endpointId;
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public Integer getFlowId() {
        return flowId;
    }
    public void setFlowId(Integer flowId) {
        this.flowId = flowId;
    }
    public String getEndpointId() {
        return endpointId;
    }
    public void setEndpointId(String endpointId) {
        this.endpointId = endpointId;
    }
}

+ 58 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SystemServiceFlowProcess.java

@ -0,0 +1,58 @@
package com.yihu.jw.basic.system.model;
public class SystemServiceFlowProcess implements java.io.Serializable {
    private Integer id;
    private String code;
    private String name;
    private Integer flowId;
    private String result;
    private String flowResult;
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getResult() {
        return result;
    }
    public void setResult(String result) {
        this.result = result;
    }
    public String getFlowResult() {
        return flowResult;
    }
    public void setFlowResult(String flowResult) {
        this.flowResult = flowResult;
    }
    public Integer getFlowId() {
        return flowId;
    }
    public void setFlowId(Integer flowId) {
        this.flowId = flowId;
    }
}

+ 40 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SystemServiceFlowProcessor.java

@ -0,0 +1,40 @@
package com.yihu.jw.basic.system.model;
public class SystemServiceFlowProcessor implements java.io.Serializable {
    private Integer id;
    private String name;
    private String className;
    private String packageName;
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getClassName() {
        return className;
    }
    public void setClassName(String className) {
        this.className = className;
    }
    public String getPackageName() {
        return packageName;
    }
    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }
}

+ 93 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/model/SystemServiceFlowTemp.java

@ -0,0 +1,93 @@
package com.yihu.jw.basic.system.model;
/**
 *  系统服务流程模板文件类
 * @author HZY
 * @vsrsion 1.0
 * Created at 2016/8/19.
 */
public class SystemServiceFlowTemp implements java.io.Serializable {
    private Integer id;
    private String name;
    private Integer valid;
    private String className;
    private String packageName;
    private String classPath;
    private String type;
    private Integer flowId;
    private String isUpdate;
    public String getClassName() {
        return className;
    }
    public void setClassName(String className) {
        this.className = className;
    }
    public String getClassPath() {
        return classPath;
    }
    public void setClassPath(String classPath) {
        this.classPath = classPath;
    }
    public String getIsUpdate() {
        return isUpdate;
    }
    public void setIsUpdate(String isUpdate) {
        this.isUpdate = isUpdate;
    }
    public Integer getFlowId() {
        return flowId;
    }
    public void setFlowId(Integer flowId) {
        this.flowId = flowId;
    }
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Integer getValid() {
        return valid;
    }
    public void setValid(Integer valid) {
        this.valid = valid;
    }
    public String getPackageName() {
        return packageName;
    }
    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
}

+ 158 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/BaseDictManager.java

@ -0,0 +1,158 @@
package com.yihu.jw.basic.system.service;
import com.yihu.jw.basic.standard.model.DataGridResult;
import com.yihu.jw.basic.system.dao.BaseDictDao;
import com.yihu.jw.basic.system.model.SystemDict;
import com.yihu.jw.basic.system.model.SystemDictList;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.util.common.StringUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
 * Created by hzp on 2016/1/11.
 */
@Service
@Transactional
public class BaseDictManager {
    public static final String BEAN_ID = "BaseDictManager";
    @Resource(name = BaseDictDao.BEAN_ID)
    private BaseDictDao baseDictDao;
    /**
     * 获取字典数据(常用)
     * @return
     */
   
    public Envelop getDict(String name,String where,String type) throws Exception
    {
        if(type == "1")
        {
            return baseDictDao.getStdDict(name);
        }
        else if(type == "2")
        {
            return baseDictDao.getStdDict(name);
        }
        else{
            SystemDictList dict = baseDictDao.getSystemDictInfoByName(name);
            if(dict!=null)
            {
                String table = dict.getRelationTable();
                String codeCol = dict.getRelationColCode();
                String valueCol = dict.getRelationColValue();
                String extendCol = dict.getRelationColExtend();
                //表字典查询
                if(!StringUtil.isEmpty(table)&&!StringUtil.isEmpty(codeCol)&&!StringUtil.isEmpty(valueCol))
                {
                    return baseDictDao.getRelationDict(table,codeCol,valueCol,extendCol,where);
                }
                else{
                    return baseDictDao.getSystemDict(name);
                }
            }
            return null;
        }
    }
    /**
     * 获取字典列表
     * @return
     */
   
    public Envelop getSystemDictList(String condition, Integer page, Integer pageSize) throws Exception
    {
        return baseDictDao.getSystemDictList(condition,page,pageSize);
    }
    /**
     * 通过ID获取系统字典信息
     * @return
     */
   
    public SystemDictList getSystemDictInfoById(String id) throws Exception
    {
        return baseDictDao.getSystemDictInfoById(id);
    }
    /**
     * 通过dictName获取字典信息
     * @return
     */
   
    public SystemDictList getSystemDictInfoByName(String dictName) throws Exception
    {
        return baseDictDao.getSystemDictInfoByName(dictName);
    }
    /**
     * 新增字典信息
     */
   
    @Transactional
    public Envelop addDict(SystemDictList obj) throws Exception
    {
        return null;
    }
    /**
     * 修改字典信息
     */
   
    @Transactional
    public Envelop updateDict(SystemDictList obj) throws Exception
    {
        return null;
    }
    /**
     * 删除字典信息
     */
   
    @Transactional
    public Envelop deleteDict(SystemDictList obj) throws Exception
    {
        return null;
    }
    /**
     * 新增字典项
     */
   
    @Transactional
    public Envelop addDictItem(SystemDict obj) throws Exception
    {
        return null;
    }
    /**
     * 修改字典项
     */
   
    @Transactional
    public Envelop updateDictItem(SystemDict obj) throws Exception
    {
        return null;
    }
    /**
     * 删除字典项
     */
   
    @Transactional
    public Envelop deleteDictItem(SystemDict obj) throws Exception
    {
        return null;
    }
}

+ 160 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/DatasourceManager.java

@ -0,0 +1,160 @@
//package com.yihu.jw.basic.system.service;
//
//import com.yihu.hos.common.Services;
//import com.yihu.hos.system.dao.DatasourceDao;
//import com.yihu.hos.system.model.SystemDatasource;
//import com.yihu.hos.web.framework.model.ActionResult;
//import com.yihu.hos.web.framework.model.DataGridResult;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//
//import javax.annotation.Resource;
//import java.util.List;
//import java.util.Map;
//
///**
// * Created by hzp on 2016/1/11.
// */
//@Service(Services.Datasource)
//@Transactional
//public class DatasourceManager {
//
//    public static final String BEAN_ID = Services.Datasource;
//
//    @Resource(name = DatasourceDao.BEAN_ID)
//    private DatasourceDao datasourceDao;
//
//    /**
//     * 测试连接
//     */
//    private boolean testDB(String type, String config)
//    {
//        try {
//            datasourceDao.testDatasource(type,config);
//            return true;
//        } catch (Exception e) {
//            return false;
//        }
//    }
//
//
//    /**
//     * 根据ID获取数据源信息
//     * @return
//     */
//
//    public SystemDatasource getDatasourcegById(String id) throws Exception
//    {
//        return datasourceDao.getEntity(SystemDatasource.class, id);
//    }
//
//    /**
//     * 获取数据源列表
//     * @param page
//     * @param rows
//     * @return
//     * @throws Exception
//     */
//
//    public DataGridResult getDatasource(Map<String, Object> conditionMap, int page, int rows) throws Exception{
//        return datasourceDao.getDatasource(conditionMap,page,rows);
//    }
//
//    /**
//     * 根据组织ID获取据源列表
//     */
//
//    public DataGridResult getDatasourceByOrg(String orgId) throws Exception{
//        return datasourceDao.getDatasourceByOrg(orgId);
//    }
//
//    /**
//     * 测试数据源
//     * @param dataSource
//     * @param config
//     * @return
//     */
//
//    public ActionResult testDatasource(String dataSource, String config) {
//        try {
//            boolean re = testDB(dataSource, config);
//
//            if(re)
//                return new ActionResult(true,"测试成功!");
//            else
//                return new ActionResult(false,"测试失败!");
//        }
//        catch (Exception e)
//        {
//            System.out.print(e.getMessage());
//            return new ActionResult(false,"测试失败!");
//        }
//    }
//
//    /**
//     * 新增数据源
//     * @param obj
//     * @return
//     */
//
//    @Transactional
//    public ActionResult addDatasource(SystemDatasource obj) {
//        try{
//            datasourceDao.saveEntity(obj);
//            return new ActionResult(true,"新增成功!");
//        }
//        catch (Exception ex)
//        {
//            return new ActionResult(false,"新增失败!");
//        }
//    }
//
//    /**
//     * 修改数据源
//     * @param obj
//     * @return
//     */
//
//    @Transactional
//    public ActionResult updateDatasource(SystemDatasource obj) {
//        try{
//            datasourceDao.updateEntity(obj);
//            return new ActionResult(true,"修改成功!");
//        }
//        catch (Exception ex)
//        {
//            return new ActionResult(false,"修改失败!");
//        }
//    }
//
//    /**
//     * 删除数据源
//     */
//
//    @Transactional
//    public ActionResult deleteDatasource(String id)
//    {
//        try{
//            datasourceDao.deleteEntity(SystemDatasource.class,id);
//            return new ActionResult(true,"删除成功!");
//        }
//        catch (Exception ex)
//        {
//            return new ActionResult(false,"删除失败!");
//        }
//    }
//
//
//    public List<SystemDatasource> getDatasources(String orgId) {
//        try {
//            return datasourceDao.getDatasources(orgId);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//        return null;
//    }
//
//    public List getData() {
//        return datasourceDao.getData();
//    }
//}

+ 154 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/DictManager.java

@ -0,0 +1,154 @@
//package com.yihu.jw.basic.system.service;
//
//import com.yihu.hos.system.dao.DictDao;
//import com.yihu.hos.system.dao.DictListDao;
//import com.yihu.hos.system.model.SystemDict;
//import com.yihu.hos.system.model.SystemDictList;
//import com.yihu.hos.web.framework.model.Result;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//
//import javax.annotation.Resource;
//import java.util.List;
//import java.util.Map;
//
///**
// * Created by chenweida on 2016/1/20.
// */
//@Service("dictManager")
//public class DictManager  {
//
//    public static final String BEAN_ID = "dictManager";
//
//    @Resource(name =DictDao.BEAN_ID )
//    private DictDao dictItemDao;//字典项
//    @Resource(name = DictListDao.BEAN_ID)
//    private DictListDao dictDao;//字典
//
//
//    /**
//     * 通过字典名字,
//     * 字典项的code查找字典项值
//     * @param dictName
//     * @param code
//     * @return
//     */
//    public String getDictIetmValue(String dictName,String code){
//        SystemDict  dictItem = dictItemDao.getDictIetmValue(dictName, code);
//        if(dictItem!=null){
//            return dictItem.getValue();
//        }
//        return "";
//    }
//
//    @Transactional
//    public Result getDictList(Map<String, Object> params) throws Exception {
//        return dictDao.getDictList(params);
//    }
//
//    @Transactional
//    public Result getDictItemList(Map<String, Object> params) throws Exception {
//        return dictItemDao.getDictList(params);
//    }
//
//
//    public SystemDict getSystemDictById(String id) throws Exception {
//        return dictItemDao.getEntity(SystemDict.class, id);
//    }
//
//
//    public SystemDictList getSystemDictListById(String id) throws Exception {
//        return dictDao.getEntity(SystemDictList.class, id);
//    }
//
//    @Transactional
//    public Result deleteDict(String id) throws Exception {
//        SystemDictList sd = dictDao.getEntity(SystemDictList.class, id);
//        dictItemDao.delDictItemByDictName(sd.getDictName());
//        dictDao.deleteEntity(sd);
//        return Result.success("删除成功");
//    }
//
//    @Transactional
//    public Result addDict(SystemDictList rr) throws Exception {
//        SystemDictList systemDictListTemp = dictDao.getDitcByName(rr.getDictName());
//        if (systemDictListTemp != null) {
//            return Result.error("字典代码重复");
//        }
//        dictDao.saveEntity(rr);
//        return Result.success("保存成功");
//    }
//
//    @Transactional
//    public Result updateDict(SystemDictList rr) throws Exception {
//        SystemDictList systemDictListTemp = dictDao.getDitcByNameWithOutId(rr.getDictName(), rr.getId());
//        if (systemDictListTemp != null) {
//            return Result.error("字典代码重复");
//        }
//        SystemDictList sd = dictDao.getEntity(SystemDictList.class, rr.getId());
//        sd.setPid(rr.getPid());
//        sd.setChineseName(rr.getChineseName());
//        sd.setDictName(rr.getDictName());
//        sd.setPyCode(rr.getPyCode());
//        sd.setRelationColCode(rr.getRelationColCode());
//        sd.setRelationColValue(rr.getRelationColValue());
//        sd.setRelationTable(rr.getRelationTable());
//        sd.setRemark(rr.getRemark());
//        sd.setRelationColExtend(rr.getRelationColExtend());
//        return Result.success("更新成功");
//    }
//
//    @Transactional
//    public Result deleteDictItem(String id) throws Exception {
//        SystemDict sd = dictItemDao.getEntity(SystemDict.class, id);
//        dictItemDao.deleteEntity(sd);
//        return Result.success("删除成功");
//    }
//
//    @Transactional
//    public Result addDictItem(SystemDict rr) throws Exception {
//       // SystemDict rrTemp = dictItemDao.getDictItemByCode(rr.getInnerCode());
//       // if (rrTemp != null) {
//       //     return Result.error("字典项代码已经存在");
//      //  }
//        dictItemDao.saveEntity(rr);
//
//        return Result.success("保存成功");
//    }
//
//    @Transactional
//    public Result updateDictItem(SystemDict rr) throws Exception {
//      //  SystemDict rrTemp = dictItemDao.getDictItemByCodeWithOutId(rr.getInnerCode(),rr.getId());
//       // if (rrTemp != null) {
//       //    return Result.error("字典项代码已经存在");
//      //  }
//        SystemDict sd = dictItemDao.getEntity(SystemDict.class, rr.getId());
//        sd.setPyCode(rr.getPyCode());
//        sd.setDictName(rr.getDictName());
//        sd.setCode(rr.getCode());
//        sd.setSort(rr.getSort());
//        sd.setValue(rr.getValue());
//        return Result.success("更新成功");
//    }
//
//    /**
//     * 通过字典名字,
//     * 字典项的code查找字典项值
//     * @param dictName
//     * @param code
//     * @return
//     */
//    public SystemDict getDictIetm(String dictName,String code){
//        SystemDict dictItem = dictItemDao.getDictIetmValue(dictName, code);
//        return dictItem;
//    }
//
//    /**
//     * @param dictName
//     * @param codes
//     * @return
//     */
//    public List<SystemDict> getDictEntries(String dictName,String[] codes) {
//       return dictItemDao.getDictEntries(dictName,codes);
//    }
//}

+ 817 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/FlowManager.java

@ -0,0 +1,817 @@
//package com.yihu.jw.basic.system.service;
//
//import com.yihu.hos.config.BeanConfig;
//import com.yihu.hos.core.datatype.ClassFileUtil;
//import com.yihu.hos.core.file.FileUtil;
//import com.yihu.hos.services.ServiceFlowEventService;
//import com.yihu.hos.system.dao.FlowClassDao;
//import com.yihu.hos.system.dao.FlowDao;
//import com.yihu.hos.system.dao.FlowTempDao;
//import com.yihu.hos.system.model.SystemServiceFlow;
//import com.yihu.hos.system.model.SystemServiceFlowClass;
//import com.yihu.hos.system.model.SystemServiceFlowTemp;
//import com.yihu.hos.web.framework.constant.ContextAttributes;
//import com.yihu.hos.web.framework.constant.ServiceFlowConstant;
//import com.yihu.hos.web.framework.model.ActionResult;
//import com.yihu.hos.web.framework.model.DictItem;
//import com.yihu.hos.web.framework.model.Result;
//import com.yihu.hos.web.framework.model.bo.ServiceFlow;
//import com.yihu.hos.web.framework.thread.LocalContext;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//
//import javax.annotation.Resource;
//import java.io.File;
//import java.nio.charset.StandardCharsets;
//import java.util.*;
//import java.util.stream.Collectors;
//
///**
// * 系统流程管理业务类
// *
// * @author HZY
// * @vsrsion 1.0
// * Created at 2016/8/19.
// */
//@Service("flowManager")
//public class FlowManager {
//    public static final String BEAN_ID = "flowManager";
//    @Autowired
//    ServiceFlowEventService serviceFlowEventService;
//    @Autowired
//    private BeanConfig beanConfig;
//
//    @Resource(name = "flowDao")
//    private FlowDao flowDao;
//    @Resource(name = FlowClassDao.BEAN_ID)
//    private FlowClassDao flowClassDao;
//    @Resource(name = FlowTempDao.BEAN_ID)
//    private FlowTempDao flowTempDao;
//    @Value("${hos.filesystem.url}")
//    private String fsUrl;
//
//    /**
//     * 生成Route流程的java文件
//     *
//     * @param routeId      流程Id
//     * @param className    模板类名
//     * @param tempFilePath 模板文件路径
//     * @param newCron      cron表达式
//     * @return
//     */
//    public String genRouteJavaFile(String jobId, String routeId, String className, String tempFilePath, String newCron) {
//        try {
//            //TODO 临时文件夹
//            String newFileName = className + routeId + ".java";
//            String newFilePath = System.getProperty("java.io.tmpdir") + System.getProperty("file.separator")  + newFileName;
//            String uploadUrl = fsUrl + "/" + tempFilePath;
//            byte[] content = ClassFileUtil.down(uploadUrl);
//            if (content == null) {
//                return null;
//            }
//
//            String text = new String(content, StandardCharsets.UTF_8);
//            if (text.contains("?cron=")) {
//                text = text.replace("?cron=",routeId+"?cron=");//job名重新命名
//                String oldStr = text.substring(text.indexOf("?cron=") + 6);
//                String cron = oldStr.substring(0, oldStr.indexOf("\""));
//                text = text.replace(cron, newCron);
//            }
//            //修改java类名
//            if (text.contains(className)) {
//                text = text.replace(className, className + routeId);//新类名规则=旧类名+routeId
//            }
//            //修改routeId;模板规则 routeId("routeId")
//            text = text.replace("routeId(\"routeId\")", "routeId(\"" + routeId + "\")");
//            //修改jobId;模板规则 "{\"jobId\": \"jobId\"}"
//            text = text.replace("{\\\"jobId\\\": \\\"jobId\\\"}", "{\\\"jobId\\\": \\\"" + jobId + "\\\"}");
//            boolean succ = FileUtil.writeFile(newFilePath, text, "UTF-8");
//            if (succ) {
//                newFileName = ClassFileUtil.uploadFile(beanConfig.getFsUrl(), new File(newFilePath), newFileName);
//            } else {
//                return null;
//            }
//
//            return newFileName;
//        } catch (Exception e) {
//            System.out.println("修改Route的java文件操作出错");
//            e.printStackTrace();
//        }
//        return null;
//    }
//
//    /**
//     * 生成processor的java文件
//     *
//     * @param jobId        任务Id
//     * @param routeId      流程Code
//     * @param tempFilePath 模板文件名
//     * @param className    模板类名
//     * @return
//     */
//    public String genProcessorJavaFile(String jobId, String routeId, String tempFilePath, String className) {
//        try {
//            String newFileName = className + routeId + ".java";
//            //TODO 临时文件夹设置
//            String newFilePath = System.getProperty("java.io.tmpdir") + System.getProperty("file.separator") +  newFileName;
//            String uploadUrl = fsUrl + "/" + tempFilePath;
//            byte[] content = ClassFileUtil.down(uploadUrl);
//            if (content == null) {
//                return null;
//            }
//
//            String text = new String(content, StandardCharsets.UTF_8);
//            text = text.replace("jobId=jobId", "jobId=" + jobId);
//            boolean succ = FileUtil.writeFile(newFilePath, text, "UTF-8");
//            //TODO 上传到GridFS
//            if (succ) {
//                newFileName = ClassFileUtil.uploadFile(beanConfig.getFsUrl(), new File(newFilePath), newFileName);
//                return newFileName;
//            }
//        } catch (Exception e) {
//            System.out.println("生成processor的java文件操作出错");
//            e.printStackTrace();
//        }
//        return null;
//    }
//
//
//    public Result getFlowList(Map<String, Object> params) throws Exception {
//        return flowDao.getFlowList(params);
//    }
//
//    /**
//     * @return List<ServiceFlow> 返回所有可运行流程
//     * @throws Exception ...
//     */
//    public List<ServiceFlow> getServiceFlowList() throws Exception {
//        List<ServiceFlow> serviceFlowList = new ArrayList<>();
//        List<SystemServiceFlow> classFlowList = flowDao.getFlowList(ServiceFlowConstant.CLASS);
//        for (SystemServiceFlow systemServiceFlow : classFlowList) {
//            String tenant = LocalContext.getContext().getAttachment(ContextAttributes.TENANT_NAME);
//            ServiceFlow serviceFlow = new ServiceFlow();
//            serviceFlow.setRouteCode(systemServiceFlow.getCode());
//            serviceFlow.setFlowType(systemServiceFlow.getFileType());
//            serviceFlow.setTenant(tenant);
//            List<SystemServiceFlowClass> classList = flowClassDao.getFlowClassByFlowId(systemServiceFlow.getId());
//            ArrayList<ServiceFlow.HandleFile> handleFileList = new ArrayList<>();
//            for (SystemServiceFlowClass flowClass : classList) {
//                ServiceFlow.HandleFile handleFile = new ServiceFlow.HandleFile();
//                handleFile.setFileType(ServiceFlowConstant.CLASS);
//                handleFile.setClassName(flowClass.getClassName());
//                handleFile.setPackageName(flowClass.getPackageName());
//                handleFile.setFilePath(flowClass.getClassPath());
//                handleFile.setUsage(flowClass.getType());
//                handleFile.setRouteCode(serviceFlow.getRouteCode());
//
//                handleFileList.add(handleFile);
//            }
//            serviceFlow.setHandleFiles(handleFileList);
//
//            serviceFlowList.add(serviceFlow);
//        }
//
//        return serviceFlowList;
//    }
//
//        /* ===================================  flowClass 部分================================================*/
//
//
//    public SystemServiceFlow getFlowById(Integer id) throws Exception {
//        return flowDao.getEntity(SystemServiceFlow.class, id);
//    }
//
//    @Transactional
//    public Result addFlow(SystemServiceFlow obj) throws Exception {
//        obj.setCreateDate(new Date());
//        flowDao.saveEntity(obj);
//
//        if (ServiceFlowConstant.CLASS.equals(obj.getFileType())) {
//            List<SystemServiceFlowClass> flowClassList = obj.getFlowClassArray();
//
//            ServiceFlow serviceFlow = new ServiceFlow();
//            serviceFlow.setRouteCode(obj.getCode());
//            serviceFlow.setFlowType(ServiceFlowConstant.CLASS);
//
//            for (SystemServiceFlowClass flowClass : flowClassList) {
//                flowClass.setFlowId(obj.getId());
//                flowDao.saveEntity(flowClass);
//
//                ServiceFlow.HandleFile handleFile = new ServiceFlow.HandleFile();
//                handleFile.setRouteCode(obj.getCode());
//                handleFile.setFileType(ServiceFlowConstant.CLASS);
//                handleFile.setPackageName(flowClass.getPackageName());
//                handleFile.setClassName(flowClass.getClassName());
//                handleFile.setFilePath(flowClass.getClassPath());
//                handleFile.setUsage(flowClass.getType());
//                serviceFlow.addHandleFile(handleFile);
//            }
//
//            serviceFlowEventService.serviceFlowAdded(serviceFlow);
//        } else if (ServiceFlowConstant.JAVA.equals(obj.getFileType())) {
//            List<SystemServiceFlowTemp> flowTempList = obj.getFlowTempArray();
//            for (SystemServiceFlowTemp flowTemp : flowTempList) {
//                flowTemp.setFlowId(obj.getId());
//                flowDao.saveEntity(flowTemp);
//            }
//        }
//
//        return Result.success("保存成功");
//    }
//
//    @Transactional
//    public Result updateFlow(SystemServiceFlow obj) throws Exception {
//        ServiceFlow serviceFlow = new ServiceFlow();
//
//        SystemServiceFlow flow = flowDao.getEntity(SystemServiceFlow.class, obj.getId());
//        flow.setCode(obj.getCode());
//        flow.setName(obj.getName());
//        flow.setPath(obj.getPath());
//        flow.setChart(obj.getChart());
//        flow.setValid(obj.getValid());
//        flow.setFileType(obj.getFileType());
//
//
//        if (ServiceFlowConstant.JAVA.equals(flow.getFileType())) {
//            List<SystemServiceFlowTemp> flowTempList = obj.getFlowTempArray();
//            boolean succ = flowTempDao.deleteFlowTempByFlowId(obj.getId());
//            if (succ) {
//                for (SystemServiceFlowTemp flowTemp : flowTempList) {
//                    flowTempDao.saveEntity(flowTemp);
//                }
//            }
//        } else if (ServiceFlowConstant.CLASS.equals(flow.getFileType())) {
//            List<Integer> classIds = flowClassDao.getFlowClassIds(obj.getId());//原flowclass集合
//            List<SystemServiceFlowClass> flowClassList = obj.getFlowClassArray();
//            SystemServiceFlowClass flowClassRoute = null;
//            serviceFlow.setRouteCode(obj.getCode());
//            serviceFlow.setFlowType(ServiceFlowConstant.CLASS);
//            for (SystemServiceFlowClass flowClass : flowClassList) {
//                if (flowClass.getId() != null) {
//                    classIds.remove(flowClass.getId());
//                    flowClassDao.updateEntity(flowClass);
//                } else {
//                    if (!flowClass.getType().equals(ServiceFlowConstant.FLOW_TYPE_ROUTE)) {
//                        flowClassDao.saveEntity(flowClass);
//                    }
//                }
//
//                ServiceFlow.HandleFile handleFile = new ServiceFlow.HandleFile();
//                handleFile.setRouteCode(obj.getCode());
//                handleFile.setFileType(ServiceFlowConstant.CLASS);
//                handleFile.setPackageName(flowClass.getPackageName());
//                handleFile.setClassName(flowClass.getClassName());
//                handleFile.setFilePath(flowClass.getClassPath());
//                handleFile.setUsage(flowClass.getType());
//                serviceFlow.addHandleFile(handleFile);
//
//            }
//
//            serviceFlowEventService.serviceFlowModifiedAdd(serviceFlow);
//
//            //删除判断
//            if (classIds != null && classIds.size() > 0) {
//                for (Integer id : classIds) {
//                    SystemServiceFlowClass flowClass = getFlowClassById(id);
//                    flowClassDao.deleteEntity(flowClass);
//                    if (flowClass.getType().equals(ServiceFlowConstant.FLOW_TYPE_ROUTE)) {
//                        flowClassRoute = flowClass;
//                        flowClassRoute.setIsUpdate("1");
//                    }
//                }
//            }
//        }
//
//        flowDao.updateEntity(flow);
//
//
//        return Result.success("更新成功");
//    }
//
//    @Transactional
//    public Result deleteFlow(Integer id) throws Exception {
//        SystemServiceFlow flow = flowDao.getEntity(SystemServiceFlow.class, id);
//        if (flow == null) {
//            return Result.error("删除流程失败");
//        }
//        ArrayList<ServiceFlow.HandleFile> handleFiles = new ArrayList<>();
//        List<SystemServiceFlowClass> flowClassList = flowClassDao.getFlowClassByFlowId(id);
//        if (ServiceFlowConstant.JAVA.equals(flow.getFileType())) {
//            flowTempDao.deleteFlowTempByFlowId(id);
//        } else {
//            ServiceFlow serviceFlow = new ServiceFlow();
//            serviceFlow.setRouteCode(flow.getCode());
//            serviceFlow.setFlowType(ServiceFlowConstant.CLASS);
//            for (SystemServiceFlowClass flowClass : flowClassList) {
//                ServiceFlow.HandleFile handleFile = new ServiceFlow.HandleFile();
//                handleFile.setRouteCode(flow.getCode());
//                handleFile.setFileType(ServiceFlowConstant.JAVA);
//                handleFile.setPackageName(flowClass.getPackageName());
//                handleFile.setClassName(flowClass.getClassName());
//                handleFile.setFilePath(flowClass.getClassPath());
//                handleFile.setUsage(flowClass.getType());
//                handleFiles.add(handleFile);
//
//                flowClassDao.deleteEntity(flowClass);
//            }
//            serviceFlow.setHandleFiles(handleFiles);
//            serviceFlowEventService.serviceFlowDelete(serviceFlow);
//
//        }
//
//        flowDao.deleteEntity(flow);
//        return Result.success("删除流程成功");
//
//    }
//
//
//    public List<String> getFlowIdList(List<SystemServiceFlow> routeLis) throws Exception {
//        List<String> routeCodes = new ArrayList<>();
//        if (routeLis!=null && !routeLis.isEmpty()){
//            routeCodes = routeLis.stream().filter(route -> ServiceFlowConstant.CLASS.equals(route.getFileType())).map(SystemServiceFlow::getCode).collect(Collectors.toList());
//        }
//        return routeCodes;
//    }
//
//    public Map<String,String> getFlowStausList(List<String> routeCodeLis) throws Exception {
//        Map<String,String>  routeCodesStaus = new HashMap<>();
//        if (routeCodeLis!=null && !routeCodeLis.isEmpty()){
//
//        }
//        return routeCodesStaus;
//    }
//
//    public List<SystemServiceFlowClass> getFlowClassByFlowId(Integer flowId) throws Exception {
//        return flowClassDao.getFlowClassByFlowId(flowId);
//    }
//
//    public SystemServiceFlowClass getFlowClassById(Integer id) throws Exception {
//        return flowClassDao.getEntity(SystemServiceFlowClass.class, id);
//    }
//
//    @Transactional
//    public Result addFlowClass(SystemServiceFlowClass obj) throws Exception {
//        flowDao.saveEntity(obj);
//        return Result.success("保存成功");
//    }
//
//    @Transactional
//    public Result updateFlowClass(SystemServiceFlowClass obj) throws Exception {
//        return null;
//    }
//
//    @Transactional
//    public boolean deleteFlowClassByFlowId(Integer flowId) {
//        boolean succ = flowClassDao.deleteFlowClassByFlowId(flowId);
//        return succ;
//    }
//
//
//    public List<SystemServiceFlowTemp> getFlowTempByFlowId(Integer id) throws Exception {
//        return flowTempDao.getFlowTempByFlowId(id);
//    }
//
//    //TODO
//
//    public boolean genFlewByflowTempId(Integer flowTempId) throws Exception {
//        SystemServiceFlow flow = getFlowById(flowTempId);
//        //生成新的route类
//
//        //添加新processor记录
//        return false;
//    }
//
//
//    /**
//     * 发送MQ消息-更新路由
//     *
//     * @param flowCode  服务流程Code标识
//     * @param flowClass
//     * @param operate
//     */
//    public void sendUpdateMessage(String flowCode, SystemServiceFlowClass flowClass, String operate) {
//        if ("1".equals(flowClass.getIsUpdate())) {
//            ServiceFlow serviceFlow = new ServiceFlow();
//            serviceFlow.setRouteCode(flowCode);
//            serviceFlow.setFlowType(ServiceFlowConstant.CLASS);
//            ServiceFlow.HandleFile handleFile = new ServiceFlow.HandleFile();
//            handleFile.setRouteCode(flowCode);
//            handleFile.setFileType(ServiceFlowConstant.CLASS);
//            handleFile.setPackageName(flowClass.getPackageName());
//            handleFile.setClassName(flowClass.getClassName());
//            handleFile.setFilePath(flowClass.getClassPath());
//            handleFile.setUsage(flowClass.getType());
//            serviceFlow.addHandleFile(handleFile);
//
//            switch (operate) {
//                case ServiceFlowConstant.FLOW_OP_ADD:
//                case ServiceFlowConstant.FLOW_OP_UPDATE:
//                    serviceFlowEventService.serviceFlowModifiedAdd(serviceFlow);
//                    break;
//                case ServiceFlowConstant.FLOW_OP_DELETE:
//                    serviceFlowEventService.serviceFlowModifiedReduce(serviceFlow);
//                    break;
//                default:
//                    break;
//            }
//        }
//    }
//
//    /**
//     * 获取流程列表
//     *
//     * @param type 流程的文件类型
//     * @return
//     * @throws Exception
//     */
//
//    public ActionResult getFlowList(String type) throws Exception {
//        List<SystemServiceFlow> flowList = flowDao.getFlowList(type);
//        ActionResult re = new ActionResult();
//        if (flowList != null && flowList.size() > 0) {
//            List<DictItem> dictList = new ArrayList<>();
//            for (SystemServiceFlow item : flowList) {
//                DictItem dict = new DictItem();
//                dict.setCode(item.getId().toString());
//                dict.setValue(item.getName());
//                dict.setExtend("");
//                dictList.add(dict);
//            }
//            re.setData(dictList);
//        }
//        return re;
//    }
//
//    /**
//     * 发送消息到broker,生成camel相关文件
//     *
//     * @param flowTempId
//     * @param newCron
//     * @throws Exception
//     */
//    public Integer genCamelFile(String jobId, Integer flowTempId, String newCron) throws Exception {
//        Long timestamp = System.currentTimeMillis();
//        //发送生成processor文件的消息
//        Integer newFlowId = sendAddProcessor(jobId, flowTempId, timestamp, newCron);
//        if (newFlowId != null) {
//            //发送生成route文件的消息
////            newFlowId = sendAddRoute(flowTempId, newFlowId, newCron);
////            if (newFlowId != null) {
////                return newFlowId;
////            } else {
////                System.out.println("生成route文件失败");
////                return null;
////            }
//            return newFlowId;
//        } else {
//            System.out.println("生成processor文件失败");
//            return null;
//        }
//    }
//
//    /**
//     * 修改任务,修改camel相关文件
//     *
//     * @param flowId  流程ID
//     * @param newCron 新cron
//     * @return
//     * @throws Exception
//     */
//
//    public Integer updateCamelFile(String jobId, Integer flowTempId, Integer flowId, String newCron) throws Exception {
//         /* 修改route文件无需重新生成flowClass记录,文件名根据className+routeId 生成;*/
//        List<SystemServiceFlowTemp> flowTempRouters = flowTempDao.getFlowTemps(flowTempId, ServiceFlowConstant.FLOW_TYPE_ROUTE);
//        List<SystemServiceFlowTemp> flowTempProces = flowTempDao.getFlowTemps(flowTempId, ServiceFlowConstant.FLOW_TYPE_PROCESSOR);
//        System.out.println("updateCamelFile ,---SCHEMA: " +LocalContext.getContext().getAttachment(ContextAttributes.SCHEMA));
//        SystemServiceFlow flow = flowDao.getEntity(SystemServiceFlow.class, flowId);
//        if (flow==null){
//            //流程已经被删除,重新生成流程
//            return genCamelFile(jobId,flowTempId,newCron);
//        }
//        //route模板文件记录是否存在。不存在就返回。
//        if (!flowTempRouters.isEmpty()) {
//            SystemServiceFlowTemp flowTemp = flowTempRouters.get(0);
//            ArrayList<ServiceFlow.HandleFile> handleFiles = new ArrayList<>();
//            ServiceFlow serviceFlow = new ServiceFlow();
//            //新增processor记录
//            for (SystemServiceFlowTemp process : flowTempProces) {
//                String newPath = genProcessorJavaFile(jobId, flow.getCode(), process.getClassPath(), process.getClassName());
//                if (newPath != null) {
//                    //发送消息
//                    serviceFlow.setRouteCode(flow.getCode());
//                    serviceFlow.setFlowType(ServiceFlowConstant.CLASS);
//                    ServiceFlow.HandleFile handleFile = new ServiceFlow.HandleFile();
//                    handleFile.setRouteCode(flow.getCode());
//                    handleFile.setFileType(ServiceFlowConstant.JAVA);
//                    handleFile.setPackageName(process.getPackageName());
//                    handleFile.setClassName(process.getClassName());
//                    handleFile.setFilePath(newPath);
//                    handleFile.setUsage(ServiceFlowConstant.FLOW_TYPE_PROCESSOR);
//                    handleFiles.add(handleFile);
//                    serviceFlow.setHandleFiles(handleFiles);
//                } else {
//                    System.out.println("生成processor的java文件过程出错");
//                    return null;
//                }
//            }
//
//            //生成新的route文件
//            String newPath = genRouteJavaFile(jobId, flow.getCode(), flowTemp.getClassName(), flowTemp.getClassPath(), newCron);
//            serviceFlow.setRouteCode(flow.getCode());
//            serviceFlow.setFlowType(ServiceFlowConstant.JAVA);
//            ServiceFlow.HandleFile handleFile = new ServiceFlow.HandleFile();
//            handleFile.setRouteCode(flow.getCode());
//            handleFile.setFileType(ServiceFlowConstant.JAVA);
//            handleFile.setPackageName(flowTemp.getPackageName());
//            handleFile.setClassName(flowTemp.getClassName() + flow.getCode());
//            handleFile.setFilePath(newPath);
//            handleFile.setUsage(ServiceFlowConstant.FLOW_TYPE_ROUTE);
//            handleFiles.add(handleFile);
//            serviceFlow.setHandleFiles(handleFiles);
//            serviceFlowEventService.serviceFlowModifiedAdd(serviceFlow);
//            return flowId;
//        }else {
//            System.out.println(" 模板文件为空,请确认模板文件是否上传!");
//        }
//        return null;
//    }
//
//    /* *********************       发送消息方式生成文件   ********************************/
//    public Integer sendAddRoute(Integer tempId, Integer flowId, String newCron) throws Exception {
//        List<SystemServiceFlowTemp> flowTempRouters = flowTempDao.getFlowTemps(tempId, ServiceFlowConstant.FLOW_TYPE_ROUTE);
//        SystemServiceFlow newFlow = getFlowById(flowId);
//
//        //route模板文件记录是否存在。不存在就返回。
//        if (!flowTempRouters.isEmpty()) {
//            SystemServiceFlowTemp flowTemp = flowTempRouters.get(0);
//            StringBuilder basePath = new StringBuilder();
//            ;
//            if (flowTemp.getPackageName() != null) {
//                String packagePath[] = flowTemp.getPackageName().split("\\.");
//                for (int i = 0; i < packagePath.length; i++) {
//                    basePath.append(packagePath[i]).append("/");
//                }
//            }
//
//            //新增processor记录
//            String newPath = genRouteJavaFile("", newFlow.getCode(), flowTemp.getClassName(), flowTemp.getClassPath(), newCron);
//            SystemServiceFlowClass newFlowClass = new SystemServiceFlowClass();
//            newFlowClass.setPackageName(flowTemp.getPackageName());
//            newFlowClass.setClassName(flowTemp.getClassName() + newFlow.getCode());
//            newFlowClass.setClassPath(flowTemp.getClassPath());
//            newFlowClass.setFlowId(newFlow.getId());
//            newFlowClass.setType(ServiceFlowConstant.FLOW_TYPE_ROUTE);
//            flowClassDao.saveEntity(newFlowClass);
//            newFlowClass.setIsUpdate("1");
//
//
//            if (newPath != null) {
//                ServiceFlow serviceFlow = new ServiceFlow();
//                serviceFlow.setRouteCode(newFlow.getCode());
//                serviceFlow.setFlowType(ServiceFlowConstant.CLASS);
//                ServiceFlow.HandleFile handleFile = new ServiceFlow.HandleFile();
//                handleFile.setRouteCode(newFlow.getCode());
//                handleFile.setFileType(ServiceFlowConstant.JAVA);
//                handleFile.setPackageName(flowTemp.getPackageName());
//                handleFile.setClassName(flowTemp.getClassName() + newFlow.getCode());
//                handleFile.setFilePath(newPath);
//                handleFile.setUsage(ServiceFlowConstant.FLOW_TYPE_ROUTE);
//                ArrayList<ServiceFlow.HandleFile> handleFiles = new ArrayList<>();
//                handleFiles.add(handleFile);
//                serviceFlow.setHandleFiles(handleFiles);
//                serviceFlowEventService.serviceFlowModifiedAdd(serviceFlow);
//                return newFlow.getId();
//            } else {
//                System.out.println("生成route的java文件过程出错");
//                return null;
//            }
//        }
//
//        return null;
//    }
//
//    public Integer sendAddRoute(String code, String name, String javaName, String packageName, String fileInfo) throws Exception {
//
//        String fileName = javaName + ".java";
//        String filePath = this.getClass().getProtectionDomain().getClassLoader().getResource("").getPath() + "temp/" + fileName;
//        boolean succ = FileUtil.writeFile(filePath, fileInfo, "UTF-8");
//        String path = "";
//        if (succ) {
//            path = ClassFileUtil.uploadFile(beanConfig.getFsUrl(), new File(filePath), fileName);
//        } else {
//            return null;
//        }
//
//        if (fileName != null) {
//            SystemServiceFlow systemServiceFlow = new SystemServiceFlow();
//            systemServiceFlow.setName(name);
//            systemServiceFlow.setCode(code);
//            systemServiceFlow.setCreateDate(new Date());
//            systemServiceFlow.setValid(1);
//            systemServiceFlow.setFileType(ServiceFlowConstant.JAVA);
//            flowDao.saveEntity(systemServiceFlow);
//
//            ServiceFlow serviceFlow = new ServiceFlow();
//            serviceFlow.setRouteCode(code);
//            serviceFlow.setFlowType(ServiceFlowConstant.CLASS);
//            ServiceFlow.HandleFile handleFile = new ServiceFlow.HandleFile();
//            handleFile.setRouteCode(code);
//            handleFile.setFileType(ServiceFlowConstant.JAVA);
//            handleFile.setPackageName(packageName);
//            handleFile.setClassName(javaName);
//            handleFile.setFilePath(path);
//            handleFile.setUsage(ServiceFlowConstant.FLOW_TYPE_ROUTE);
//            ArrayList<ServiceFlow.HandleFile> handleFiles = new ArrayList<>();
//            handleFiles.add(handleFile);
//            serviceFlow.setHandleFiles(handleFiles);
//            serviceFlowEventService.serviceFlowAdded(serviceFlow);
//
//            SystemServiceFlowClass flowClass = new SystemServiceFlowClass();
//            flowClass.setPackageName(packageName);
//            flowClass.setClassName(javaName);
//            flowClass.setClassPath(path);
//            flowClass.setFlowId(systemServiceFlow.getId());
//            flowClass.setType(ServiceFlowConstant.FLOW_TYPE_ROUTE);
//            flowClass.setIsUpdate("1");
//            flowClassDao.saveEntity(flowClass);
//
//            return systemServiceFlow.getId();
//        } else {
//            System.out.println("生成route的java文件过程出错");
//            return null;
//        }
//    }
//
//    public Integer sendAddProcessor(String jobId, Integer flowId, Long timestamp, String newCron) throws Exception {
//        List<SystemServiceFlowTemp> flowTempRouters = flowTempDao.getFlowTemps(flowId, ServiceFlowConstant.FLOW_TYPE_ROUTE);
//        List<SystemServiceFlowTemp> flowTempProces = flowTempDao.getFlowTempByFlowId(flowId);
//        SystemServiceFlow oldFlow = getFlowById(flowId);
//
//        //route模板文件记录是否存在。不存在就返回。
//        if (!flowTempRouters.isEmpty()) {
//
//            //成功生成文件后,添加flow和flowclass记录
//            SystemServiceFlow newFlow = new SystemServiceFlow();
//            newFlow.setName(oldFlow.getName() + timestamp);
//            newFlow.setCode(oldFlow.getCode() + timestamp);
//            newFlow.setChart(oldFlow.getChart());
//            newFlow.setValid(1);
//            newFlow.setCreateDate(new Date());
//            newFlow.setFileType(ServiceFlowConstant.CLASS);
//            flowDao.saveEntity(newFlow);
//            ArrayList<ServiceFlow.HandleFile> handleFiles = new ArrayList<>();
//
//            //新增processor记录
//            ServiceFlow serviceFlow = new ServiceFlow();
//            serviceFlow.setRouteCode(newFlow.getCode());
//            serviceFlow.setFlowType(ServiceFlowConstant.JAVA);
//            for (SystemServiceFlowTemp process : flowTempProces) {
//                StringBuilder proPath = new StringBuilder();
//                if (process.getPackageName() != null) {
//                    //生成“/"分割的包名
//                    String packagePath[] = process.getPackageName().split("\\.");
//                    for (int i = 0; i < packagePath.length; i++) {
//                        proPath.append(packagePath[i]).append("/");
//                    }
//                }
//
//                SystemServiceFlowClass processClass = new SystemServiceFlowClass();
//                processClass.setPackageName(process.getPackageName());
//                processClass.setClassName(process.getClassName());
//                processClass.setClassPath(processClass.getClassPath());
//                processClass.setFlowId(newFlow.getId());
//                processClass.setType(process.getType());
//                processClass.setIsUpdate("1");
//
//                //发送消息
//                ServiceFlow.HandleFile handleFile = new ServiceFlow.HandleFile();
//                handleFile.setRouteCode(newFlow.getCode());
//                handleFile.setFileType(ServiceFlowConstant.JAVA);
//                handleFile.setPackageName(processClass.getPackageName());
//                handleFile.setUsage(processClass.getType());
//
//                String newPath = null;
//                if (ServiceFlowConstant.FLOW_TYPE_PROCESSOR.equals(process.getType())) {
//                    newPath = genProcessorJavaFile(jobId, newFlow.getCode(), process.getClassPath(), process.getClassName());
//                    handleFile.setClassName(processClass.getClassName());
//                } else {
//                    newPath = genRouteJavaFile(jobId, newFlow.getCode(), process.getClassName(), process.getClassPath(), newCron);
//                    handleFile.setClassName(processClass.getClassName() + newFlow.getCode());
//                }
//
//                if (newPath != null) {
//                    handleFile.setFilePath(newPath);
//                    handleFiles.add(handleFile);
//                    processClass.setClassPath(newPath);
//                    flowClassDao.saveEntity(processClass);
//                } else {
//                    System.out.println("生成processor的java文件过程出错");
//                    return null;
//                }
//            }
//
//            serviceFlow.setHandleFiles(handleFiles);
//            serviceFlowEventService.serviceFlowAdded(serviceFlow);
//
//            return newFlow.getId();
//        }
//
//        return null;
//    }
//
//    /**
//     * 服务启动/暂停
//     *
//     * @param flowId 流程ID
//     * @param oper   服务操作;1:启动;0:暂停
//     * @return
//     * @throws Exception
//     */
//    public boolean serviceOpenOrPause(Integer flowId, Integer oper) throws Exception {
//        SystemServiceFlow flow = flowDao.getEntity(SystemServiceFlow.class, flowId);
//        if (flow != null) {
//            List<SystemServiceFlowClass> flowClassList = flowClassDao.getFlowClassByFlowId(flowId);
//            //route模板文件记录是否存在。不存在就返回。
//            ArrayList<ServiceFlow.HandleFile> handleFiles = new ArrayList<>();
//            //新增processor记录
//            ServiceFlow serviceFlow = new ServiceFlow();
//            serviceFlow.setRouteCode(flow.getCode());
//            serviceFlow.setFlowType(ServiceFlowConstant.CLASS);
//            for (SystemServiceFlowClass flowClass : flowClassList) {
////                String deName = DES.decrypt(flowClass.getClassPath(), DES.COMMON_PASSWORD);//吉阿米果的文件名
//                //发送消息
//                ServiceFlow.HandleFile handleFile = new ServiceFlow.HandleFile();
//                handleFile.setRouteCode(flow.getCode());
//                handleFile.setFileType(ServiceFlowConstant.CLASS);
//                handleFile.setPackageName(flowClass.getPackageName());
//                handleFile.setClassName(flowClass.getClassName());
//                handleFile.setFilePath(flowClass.getClassPath());
//                handleFile.setUsage(ServiceFlowConstant.FLOW_TYPE_PROCESSOR);
//                handleFiles.add(handleFile);
//            }
//            serviceFlow.setHandleFiles(handleFiles);
//            if (1 == oper) {
//                serviceFlowEventService.serviceFlowStarted(serviceFlow);
//            } else if (0 == oper) {
//                serviceFlowEventService.serviceFlowStopped(serviceFlow);
//            } else {
//                return false;
//            }
//            return true;
//        } else {
//            return false;
//        }
//    }
//
//    /**
//     * 解析文件 包名和类名
//     *
//     * @param file java文件流
//     * @return
//     */
//    public Map<String, String> uploadAndParse(File file) {
//        Map<String, String> result = null;
//        String text = null;
//        String packageName = null;
//        String className = StringUtils.substringBefore(file.getName(), ".");
//        if (file.getName().contains(".class")) {
//            try {//class文件解析
//                text = parseClassFile(file);
//                packageName = StringUtils.substringBefore(StringUtils.substringAfter(text, "public class "), "." + className);//通过javap解析的结构不一样
//            } catch (Exception e) {
//                e.printStackTrace();
//            }
//        } else {//java文件解析
//            text = FileUtil.readFileText(file);
//            packageName = StringUtils.substringAfter(StringUtils.substringBefore(text, ";"), "package ");
//        }
//        result = new HashMap<>();
//        result.put("package", packageName);
//        result.put("class", className);
//
//
//        return result;
//    }
//
//    /**
//     * 解析class文件
//     *
//     * @param file
//     * @return
//     * @throws Exception
//     */
//    public String parseClassFile(File file) throws Exception {
//        String path = file.getAbsolutePath();
//        String command = "javap " + path;
//        Process ps = Runtime.getRuntime().exec(command);
//        String result = FileUtil.readFileText(ps.getInputStream());
//        System.out.println(result);
//        return result;
//
//    }
//
//
//}

+ 143 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/OrganizationManager.java

@ -0,0 +1,143 @@
//package com.yihu.jw.basic.system.service;
//
//import com.yihu.hos.common.Services;
//import com.yihu.hos.system.dao.DatasourceDao;
//import com.yihu.hos.system.dao.OrganizationDao;
//import com.yihu.hos.system.model.SystemOrganization;
//import com.yihu.hos.web.framework.model.DataGridResult;
//import com.yihu.hos.web.framework.model.Result;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//
//import javax.annotation.Resource;
//import java.util.List;
//import java.util.Map;
//
///**
// * Created by hzp on 2016/1/11.
// */
//@Service(Services.Organization)
//public class OrganizationManager {
//
//    public static final String BEAN_ID = Services.Organization;
//
//
//    @Resource(name = OrganizationDao.BEAN_ID)
//    private OrganizationDao organizationDao;
//
//    @Resource(name = DatasourceDao.BEAN_ID)
//    private DatasourceDao datasourceDao;
//
//    /**
//     * 根据ID获取组织详细
//     * @return
//     */
//
//    public SystemOrganization getOrgById(String id) throws Exception
//    {
//        return organizationDao.getEntity(SystemOrganization.class,id);
//    }
//
//    /**
//     * 获取组织列表
//     */
//
//    public DataGridResult getOrgList(Map<String, Object> conditionMap, Integer page, Integer rows) throws Exception
//    {
//        return organizationDao.getOrgList(conditionMap,page,rows);
//    }
//
//    /**
//     * 新增组织
//     */
//
//    @Transactional
//    public Result addOrg(SystemOrganization obj) throws Exception {
//        String code= obj.getCode() ;
//        String name=obj.getFullName();
//        List org =organizationDao.getOrgByCodeOrName(code, name);
//        if (org != null && org.size()>0) {
//            return Result.error("机构已经存在了!");
//        }else {
//
//            organizationDao.saveEntity(obj);
//            return Result.success("新增成功!");
//        }
//    }
//    /**
//     * 修改组织
//     */
//
//    @Transactional
//    public Result updateOrg(SystemOrganization obj) {
//
//        try{
//            String code= obj.getCode() ;
//            String name=obj.getFullName();
//            List<SystemOrganization> org =organizationDao.getOrgByCodeOrName(code, name);
//            if(org!=null) {
//                for (int i = 0; i < org.size(); i++) {
//                    if (!org.get(i).getId().equals(obj.getId())) {
//                        return Result.error("机构已存在!");
//                    }
//                }
//            }
//            organizationDao.saveOrUpdateEntity(obj);
//            return Result.success("修改成功!");
//
//        }
//        catch (Exception ex)
//        {
//            return Result.error("修改失败!");
//        }
//    }
//
//    /**
//     * 删除组织
//     */
//
//    @Transactional
//    public Result deleteOrg(String id) {
//        try{
//            //判断是否有存在机构数据源
//            DataGridResult list = datasourceDao.getDatasourceByOrg(id);
//            if(list.getTotalCount()>0)
//            {
//                return Result.error("该机构关联数据库,无法删除!");
//            }
//            else{
//                organizationDao.deleteEntity(SystemOrganization.class,id);
//                return Result.success("删除成功!");
//            }
//
//        }
//        catch (Exception ex)
//        {
//            return Result.error("删除失败!");
//        }
//    }
//
//
//    public SystemOrganization getOrgByIde(String orgId) throws Exception {
//        return organizationDao.getOrgByIde(orgId);
//    }
//
//    /**
//     * 修改组织状态
//     * @param orgId
//     * @param activityFlag
//     * @return
//     * @throws Exception
//     *//*
//    public ActionResult activityOrg(String orgId,String activityFlag)
//    {
//        try {
//            organizationDao.activityOrg(orgId, activityFlag);
//            return new ActionResult(true,"状态修改成功!");
//        }
//        catch (Exception ex)
//        {
//            return new ActionResult(false,"状态修改失败!");
//        }
//    }*/
//}

+ 211 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/ProcessEditor.java

@ -0,0 +1,211 @@
//package com.yihu.jw.basic.system.service;
//
//import com.fasterxml.jackson.databind.JsonNode;
//import com.yihu.hos.common.graph.Edge;
//import com.yihu.hos.common.graph.IDGraph;
//import com.yihu.hos.core.datatype.CollectionUtil;
//import com.yihu.hos.core.datatype.StringUtil;
//
//import java.io.IOException;
//import java.util.ArrayList;
//import java.util.Iterator;
//import java.util.List;
//import java.util.Map;
//
//public class ProcessEditor {
//
//    private String code;
//    private Map<String, JsonNode> lineMap;
//    private Map<String, JsonNode> nodeMap;
//    private Iterator<String> nodeIt;
//    private IDGraph<String> mDG;
//    private StringBuilder bodyBuilder = new StringBuilder();
//    private List<String> packageList = new ArrayList<>();
//    private StringBuilder otherRouteBuilder = new StringBuilder();
//    private StringBuilder preferBuilder = new StringBuilder();
//
//    public String generate(String javaName, String packageName) throws IOException {
//        Boolean isFirstNodeFlg = true;
//        StringBuilder allBuilder = new StringBuilder();
//
////        packageBuilder.append("import org.apache.camel.Exchange;\n");
//        addPackageList("import org.apache.camel.builder.RouteBuilder;\n");
//
//        preferBuilder.append("public class "+javaName+" extends RouteBuilder {\n");
//        preferBuilder.append("public void configure() throws Exception {\n");
//        String nodeName = "";
//        while(nodeIt.hasNext()) {
//            if (isFirstNodeFlg) {
//                nodeName = nodeIt.next();
//                isFirstNodeFlg = false;
//                bodyBuilder.append(montage(nodeName));
//            } else {
//                List<Edge<String>> edgeList = mDG.getEdgeList(nodeName);
//                if (CollectionUtil.isEmpty(edgeList)) {
//                    nodeIt.next();
//                }
//                for (Edge<String> edge : edgeList) {
//                    nodeIt.next();
//                    nodeName = edge.getDest();
//                    bodyBuilder.append(montage(nodeName));
//                }
//            }
//        }
//        bodyBuilder.append(";");
//        bodyBuilder.append(otherRouteBuilder);
//        bodyBuilder.append("\n}\n}");
//        StringBuilder packageBuilder = new StringBuilder();
//        packageBuilder.append("package " + packageName + ";\n\n");
//        packageList.forEach(packageBuilder::append);
//        allBuilder.append(packageBuilder).append(preferBuilder).append(bodyBuilder);
//        System.out.println(allBuilder.toString());
//        return allBuilder.toString();
//    }
//
//    public StringBuilder montage(String nodeName) {
//        JsonNode node = nodeMap.get(nodeName);
//        String nodeType = node.get("nodeType").asText();
//        String config = node.get("config").asText();
////        String name = node.get("name").asText();
//        StringBuilder bodyBuilderTemp = new StringBuilder();
//        if (nodeType.equals("start")) {
//            bodyBuilder.append("from(\"");
//            bodyBuilder.append(config + "\")");
//            if (!StringUtil.isEmpty(code)) {
//                bodyBuilder.append(".routeId(\""+code+"\")");
//            }
//        } else if (nodeType.equals("processor")) {
//            String value = node.get("value").asText();
//            String className = value.substring(value.lastIndexOf(".") + 1, value.length());
//
//            addPackageList("import " + value + ";\n");
//            if (config == null) {
//                bodyBuilderTemp.append("\n.process(new "+className+"(\"\"))");
//            } else {
//                bodyBuilderTemp.append("\n.process(new "+className+"("+config+"))");
//            }
//        } else if (nodeType.equals("judgement")) {
//            judgement(config, nodeName, bodyBuilderTemp);
//        } else if (nodeType.equals("circle")) {
//            split(config, bodyBuilderTemp);
//        } else if (nodeType.equals("aggregate")) {
//            aggregate(config, bodyBuilderTemp);
//        } else if (nodeType.equals("multicast")) {
//            multicast(config, nodeName, bodyBuilderTemp);
//        } else if (nodeType.equals("format")) {
//            format(config, nodeName, bodyBuilderTemp);
//        } else {
////                    bodyBuilder.append("\n.setHeader(Exchange.HTTP_METHOD, constant(\"POST\"))");
//            bodyBuilderTemp.append("\n.to(\"");
//            bodyBuilderTemp.append(config + "\")");
//        }
//        while (nodeIt.hasNext()) {
//            List<Edge<String>> edgeList = mDG.getEdgeList(nodeName);
//            if (CollectionUtil.isEmpty(edgeList)) {
//                return bodyBuilderTemp;
//            }
//            for (Edge<String> edge : edgeList) {
//                nodeIt.next();
//                nodeName = edge.getDest();
//                bodyBuilderTemp.append(montage(nodeName));
//            }
//        }
//        return bodyBuilderTemp;
//    }
//
//    public void judgement(String config, String nodeName, StringBuilder builder) {
//        builder.append("\n.choice()");
//        builder.append("\n.when("+config+")");
//        String trueNodeName = "";
//        String falseNodeName = "";
//        for (Edge<String> edge : mDG.getEdgeList(nodeName)) {
//            nodeIt.next();
//            String nextNodeName = edge.getDest();
//            String nextLineName = edge.getName();
//            JsonNode nextLine = lineMap.get(nextLineName);
//            if (nextLine.get("config") != null && nextLine.get("config").asText().equals("true")) {
//                trueNodeName = nextNodeName;
//            } else {
//                falseNodeName = nextNodeName;
//            }
//        }
//
//        builder.append("\n.to(\"direct:ja\")");
//        builder.append("\n.otherwise()");
//        builder.append("\n.to(\"direct:jb\")");
//        builder.append("\n.end()");
//
//        StringBuilder trueBuilder = montage(trueNodeName);
//        StringBuilder falseBuilder = montage(falseNodeName);
//        otherRouteBuilder.append("\nfrom(\"direct:ja\")").append(trueBuilder).append(";");
//        otherRouteBuilder.append("\nfrom(\"direct:jb\")").append(falseBuilder).append(";");
//
//    }
//
//    public void split(String config, StringBuilder builder) {
//        addPackageList("import com.yihu.hos.broker.util.Split;\n");
//        builder.append("\n.split().method(Split.class, \""+config+"\")");
//    }
//
//    public void aggregate(String config, StringBuilder builder) {
//        addPackageList("import com.yihu.hos.broker.util.Aggregate;\n");
//        builder.append("\n.aggregate(header(\""+config+"\"), new Aggregate()).completionSize(3)");
//    }
//
//    public void multicast(String config, String nodeName, StringBuilder builder) {
//
//        String directs = "";
//        int i = 'a';
//        List<String> directList = new ArrayList<>();
//        List<Edge<String>> edgeList = mDG.getEdgeList(nodeName);
//        for (Edge<String> edge : edgeList) {
//            nodeIt.next();
//            String direct = "direct:m" + (char)i++;
//            directList.add(direct);
//            directs += "\"" + direct + "\",";
//            StringBuilder directBuilder = new StringBuilder();
//            directBuilder.append("\nfrom(\"");
//            directBuilder.append(direct + "\")");
//            nodeName = edge.getDest();
//            otherRouteBuilder.append(directBuilder).append(montage(nodeName)).append(";");
//        }
//
//        directs = StringUtil.substring(directs, 0, directs.length() - 1);
//
//        builder.append("\n.multicast().stopOnException().to("+directs+").end()");
//    }
//
//    public void format(String config, String nodeName, StringBuilder builder) {
//
//        addPackageList("import org.apache.camel.model.dataformat.XmlJsonDataFormat;\n");
//        preferBuilder.append("XmlJsonDataFormat xmlJsonFormat = new XmlJsonDataFormat();\n");
//        builder.append("\n."+config + "(xmlJsonFormat)");
//    }
//
//    public void addPackageList(String pack) {
//        if (!packageList.contains(pack)) {
//            packageList.add(pack);
//        }
//    }
//
//    public void setCode(String code) {
//        this.code = code;
//    }
//
//
//    public void setLineMap(Map<String, JsonNode> lineMap) {
//        this.lineMap = lineMap;
//    }
//
//    public void setNodeIt(Iterator<String> nodeIt) {
//        this.nodeIt = nodeIt;
//    }
//
//    public void setNodeMap(Map<String, JsonNode> nodeMap) {
//        this.nodeMap = nodeMap;
//    }
//
//    public void setmDG(IDGraph<String> mDG) {
//        this.mDG = mDG;
//    }
//}

+ 267 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/ProcessManager.java

@ -0,0 +1,267 @@
//package com.yihu.jw.basic.system.service;
//
//import com.fasterxml.jackson.databind.JsonNode;
//import com.fasterxml.jackson.databind.ObjectMapper;
//import com.yihu.hos.app.dao.AppDao;
//import com.yihu.hos.app.dao.AppServiceDao;
//import com.yihu.hos.app.model.App;
//import com.yihu.hos.app.model.SystemServiceEndpoint;
//import com.yihu.hos.common.graph.DGraphImpl;
//import com.yihu.hos.common.graph.Edge;
//import com.yihu.hos.common.graph.IDGraph;
//import com.yihu.hos.core.datatype.StringUtil;
//import com.yihu.hos.system.dao.FlowProcessDao;
//import com.yihu.hos.system.dao.ProcessorDao;
//import com.yihu.hos.system.model.ProcessResultModel;
//import com.yihu.hos.system.model.SystemServiceFlowProcess;
//import com.yihu.hos.system.model.SystemServiceFlowProcessor;
//import com.yihu.hos.web.framework.model.Result;
//import net.sf.json.JSONArray;
//import net.sf.json.JSONObject;
//import org.springframework.stereotype.Service;
//
//import javax.annotation.Resource;
//import java.util.*;
//
//@Service("ProcessManager")
//public class ProcessManager {
//
//    public static final String BEAN_ID = "ProcessManager";
//
//    @Resource(name = AppDao.BEAN_ID)
//    private AppDao appDao;
//    @Resource(name = AppServiceDao.BEAN_ID)
//    private AppServiceDao appServiceDao;
//    @Resource(name = ProcessorDao.BEAN_ID)
//    private ProcessorDao processorDao;
//    @Resource(name = FlowProcessDao.BEAN_ID)
//    private FlowProcessDao processDao;
//    @Resource(name = FlowManager.BEAN_ID)
//    private FlowManager flowManager;
//
//    private ObjectMapper objectMapper = new ObjectMapper();
//
//    public Result getAllEndpoints(String endpointName) throws Exception {
//
//        List<SystemServiceEndpoint> serviceEndpointList = appServiceDao.getListByName(endpointName);
//        List<String> appIdList = new ArrayList<>();
//        Map<String, List<ProcessResultModel>> appServiceMap = new HashMap<>();
//        for (SystemServiceEndpoint endpoint : serviceEndpointList) {
//            ProcessResultModel resultModel = new ProcessResultModel();
//            resultModel.setName(endpoint.getName());
//            resultModel.setValue(endpoint.getEndpoint());
//            resultModel.setConfig(endpoint.getEndpoint());
//            resultModel.setNodeType("service");
//            appIdList.add(endpoint.getAppId());
//
//            List<ProcessResultModel> endpointList;
//            if (appServiceMap.get(endpoint.getAppId()) != null) {
//                endpointList = appServiceMap.get(endpoint.getAppId());
//            } else {
//                endpointList = new ArrayList<>();
//            }
//            endpointList.add(resultModel);
//            appServiceMap.put(endpoint.getAppId(), endpointList);
//        }
//        List<App> appList = appDao.getAllByIdList(appIdList);
//        JSONArray jsonArray = new JSONArray();
//        for (App app : appList) {
//            JSONObject jsonObject = new JSONObject();
//            jsonObject.put("title", app.getName());
//            List<ProcessResultModel> resultModelList = appServiceMap.get(app.getId());
//            List<ProcessResultModel> resultModelListListTemp = new ArrayList<>();
//            if (app.getName().equals("起始端点")) {
//
//                for (ProcessResultModel resultModel : resultModelList) {
//                    resultModel.setNodeType("start");
//                    resultModelListListTemp.add(resultModel);
//                }
//                jsonObject.put("list", resultModelListListTemp);
//                jsonArray.add(0, jsonObject);
//            } else if (app.getName().equals("结束端点")) {
//
//                for (ProcessResultModel resultModel : resultModelList) {
//                    resultModel.setNodeType("end");
//                    resultModelListListTemp.add(resultModel);
//                }
//                jsonObject.put("list", resultModelListListTemp);
//                jsonArray.add(1, jsonObject);
//            } else {
//                resultModelListListTemp = resultModelList;
//                jsonObject.put("list", resultModelListListTemp);
//                jsonArray.add(jsonObject);
//            }
//        }
//        return Result.success(jsonArray.toString());
//    }
//
////    public Result getAppServiceByAppId(String appId) throws Exception {
////        String hql = "from SystemServiceEndpoint where appId = "+appId+"";
////        List<SystemServiceEndpoint> serviceEndpointList = appServiceDao.getEntityList(SystemServiceEndpoint.class, hql);
////        String result = objectMapper.writeValueAsString(serviceEndpointList);
////        return Result.success(result);
////    }
//
//    public String getFlowchart(Integer flowId) throws Exception {
//        SystemServiceFlowProcess serviceFlowProcess = processDao.getFlowProcessByFlowId(flowId);
//        JSONObject jsonObject = new JSONObject();
//        jsonObject.put("code", serviceFlowProcess.getCode());
//        jsonObject.put("name", serviceFlowProcess.getName());
//        jsonObject.put("flowId", serviceFlowProcess.getFlowId());
//        jsonObject.put("result", serviceFlowProcess.getResult());
//
//        return jsonObject.toString();
//    }
//
//    public Result getAllProcessor(String processorName) throws Exception {
//        List<SystemServiceFlowProcessor> processorList = processorDao.getListByName(processorName);
//        List<ProcessResultModel> resultModelList = new ArrayList<>();
//        ProcessResultModel json2xml = new ProcessResultModel();
//        json2xml.setName("json转xml格式转换器");
//        json2xml.setValue("unmarshal");
//        json2xml.setConfig("unmarshal");
//        json2xml.setNodeType("format");
//
//        ProcessResultModel xml2json = new ProcessResultModel();
//        xml2json.setName("xml转json格式转换器");
//        xml2json.setValue("marshal");
//        xml2json.setConfig("marshal");
//        xml2json.setNodeType("format");
//        resultModelList.add(json2xml);
//        resultModelList.add(xml2json);
//
//        for (SystemServiceFlowProcessor processor : processorList) {
//            ProcessResultModel resultModel = new ProcessResultModel();
//            resultModel.setName(processor.getName());
//            resultModel.setValue(processor.getPackageName() + "." + processor.getClassName());
//            resultModel.setConfig("");
//            resultModel.setNodeType("processor");
//            resultModelList.add(resultModel);
//        }
//        String result = objectMapper.writeValueAsString(resultModelList);
//        return Result.success(result);
//    }
//
//    public void saveProcess(String code, String name, Integer flowId, String positionJsonStr, String flowJsonStr) throws Exception {
//        SystemServiceFlowProcess process = new SystemServiceFlowProcess();
//        process.setCode(code);
//        process.setName(name);
//        process.setResult(positionJsonStr);
//        process.setFlowId(flowId);
//        process.setFlowResult(flowJsonStr);
//        processDao.saveEntity(process);
//    }
//
//    public void main(String[] args) throws Exception {
//        String flowJsonStr = "{\n" +
//                "    \"nodes\": {\n" +
//                "        \"node_1\": {\n" +
//                "            \"name\": \"Quartz\",\n" +
//                "            \"value\": \"quartz://myGroup/myTimerName?cron=0/3 * * * * ?\",\n" +
//                "            \"nodeType\": \"start\"\n" +
//                "        },\n" +
//                "        \"node_2\": {\n" +
//                "            \"name\": \"DefaultHttpProcessor0\",\n" +
//                "            \"value\": \"com.yihu.hos.broker.common.processor.DefaultHttpProcessor\",\n" +
//                "\t\t\t\"param\": \"{\\\"jobId\\\":\\\"5ad5c11655d443c30155d477a6b10000\\\"}\",\n" +
//                "            \"nodeType\": \"processor\"\n" +
//                "        },\n" +
//                "        \"node_3\": {\n" +
//                "            \"name\": \"Crawler0\",\n" +
//                "            \"value\": \"http4://localhost:8088/crawler/patientList?method=post\",\n" +
//                "            \"nodeType\": \"service\"\n" +
//                "        },\n" +
//                "\t\t\"node_4\": {\n" +
//                "            \"name\": \"xml2json\",\n" +
//                "            \"value\": \"marshal\",\n" +
//                "            \"nodeType\": \"format\"\n" +
//                "        },\n" +
//                "\t\t\"node_5\": {\n" +
//                "            \"name\": \"Stream\",\n" +
//                "            \"value\": \"stream:out\",\n" +
//                "            \"nodeType\": \"end\"\n" +
//                "        }\n" +
//                "    },\n" +
//                "    \"lines\": {\n" +
//                "        \"line_1\": {\n" +
//                "            \"from\": \"node_1\",\n" +
//                "            \"to\": \"node_2\"\n" +
//                "        },\n" +
//                "        \"line_2\": {\n" +
//                "            \"from\": \"node_2\",\n" +
//                "            \"to\": \"node_3\"\n" +
//                "        },\n" +
//                "        \"line3\": {\n" +
//                "            \"from\": \"node_3\",\n" +
//                "            \"to\": \"node_4\"\n" +
//                "        },\n" +
//                "\t\t\"line4\": {\n" +
//                "            \"from\": \"node_4\",\n" +
//                "            \"to\": \"node_5\"\n" +
//                "        }\n" +
//                "    }\n" +
//                "}";
////        generateFlow("crawler", "业务流程图", flowJsonStr);
//    }
//
//    public Integer generateFlow(String code, String name, String flowJsonStr) throws Exception {
//        SystemServiceFlowProcess process = processDao.getFlowProcessByCode(code);
//        if (process != null) {
//            return null;
//        }
//        String root = "";
//        ObjectMapper objectMapper = new ObjectMapper();
//        JsonNode flowJson = objectMapper.readValue(flowJsonStr, JsonNode.class);
//        //sort flow by lines
//
//        JsonNode lines = flowJson.get("lines");
//        Iterator<Map.Entry<String, JsonNode>> lineIterator = lines.fields();
//        //get nodeMap by nodes
//        JsonNode nodes = flowJson.get("nodes");
//        Iterator<Map.Entry<String, JsonNode>> nodeIterator = nodes.fields();
//        //for the java code import processor class
//        Map<String, JsonNode> nodeMap = new HashMap<>();
//        Map<String, JsonNode> lineMap = new HashMap<>();
//        IDGraph<String> mDG = new DGraphImpl<String>();
//        while (nodeIterator.hasNext()) {
//            Map.Entry<String, JsonNode> map = nodeIterator.next();
//            nodeMap.put(map.getKey(), map.getValue());
//            String type = map.getValue().get("nodeType").asText();
//            if (StringUtil.isEmpty(root) && type.equals("start")) {
//                root = map.getKey();
//            }
//            mDG.add(map.getKey());
//        }
//
//        while (lineIterator.hasNext()) {
//            Map.Entry<String, JsonNode> map = lineIterator.next();
//            lineMap.put(map.getKey(), map.getValue());
//            String nodeNameFrom = map.getValue().get("from").asText();
//            String nodeNameTo = map.getValue().get("to").asText();
//            mDG.add(new Edge<>(nodeNameFrom, nodeNameTo, map.getKey()));
//        }
//        ProcessEditor editor = new ProcessEditor();
//        Iterator<String> nodeIt = mDG.iterator(root);
//        editor.setCode(code);
//        editor.setNodeIt(nodeIt);
//        editor.setmDG(mDG);
//        editor.setLineMap(lineMap);
//        editor.setNodeMap(nodeMap);
//        //generate the java code
//        String javaName = toUpperCaseFirstOne(code)+"Route";
//        String packageName = code+".route";
//
//        String fileInfo = editor.generate(javaName, packageName);
//
////        Integer flowId = flowManager.sendAddRoute(code, name, javaName, packageName, fileInfo);
//        return null;
//    }
//
//    //首字母转大写
//    public static String toUpperCaseFirstOne(String s) {
//        if(Character.isUpperCase(s.charAt(0)))
//            return s;
//        else
//            return (new StringBuilder()).append(Character.toUpperCase(s.charAt(0))).append(s.substring(1)).toString();
//    }
//}

+ 47 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/ProcessorManager.java

@ -0,0 +1,47 @@
//package com.yihu.jw.basic.system.service;
//
//import com.yihu.hos.system.dao.ProcessorDao;
//import com.yihu.hos.system.model.SystemServiceFlowProcessor;
//import com.yihu.hos.web.framework.model.Result;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//
//import java.util.Map;
//
//@Service("ProcessorManager")
//public class ProcessorManager {
//
//    public static final String BEAN_ID = "ProcessorManager";
//    @Autowired
//    private ProcessorDao processorDao;
//
//    public Result getProcessorList(Map<String, Object> params) throws Exception {
//        return processorDao.getProcessorList(params);
//    }
//
//
//    public SystemServiceFlowProcessor getProcessorById(String id) throws Exception {
//        SystemServiceFlowProcessor serviceFlowProcessor = processorDao.getEntity(SystemServiceFlowProcessor.class, Integer.parseInt(id));
//        return serviceFlowProcessor;
//    }
//
//    @Transactional
//    public Result addProcessor(SystemServiceFlowProcessor obj) throws Exception {
//        processorDao.saveEntity(obj);
//        return Result.success("保存成功");
//    }
//
//    @Transactional
//    public Result updateProcessor(SystemServiceFlowProcessor obj) throws Exception {
//        processorDao.updateEntity(obj);
//        return Result.success("更新成功");
//    }
//
//    @Transactional
//    public Result deleteProcessor(String id) throws Exception {
//        SystemServiceFlowProcessor serviceFlowProcessor = processorDao.getEntity(SystemServiceFlowProcessor.class, Integer.parseInt(id));
//        processorDao.deleteEntity(serviceFlowProcessor);
//        return Result.success("删除成功");
//    }
//}

+ 11 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/SystemDictService.java

@ -0,0 +1,11 @@
//package com.yihu.jw.basic.system.service;
//
//import com.yihu.hos.system.model.SystemDict;
//import com.yihu.hos.web.framework.baseservice.BaseService;
//import org.springframework.stereotype.Service;
//
//@Service
//public class SystemDictService  extends BaseService<SystemDict> {
//
//
//}

+ 83 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/SystemManager.java

@ -0,0 +1,83 @@
//package com.yihu.jw.basic.system.service;
//
//import com.yihu.hos.system.model.SystemUser;
//import com.yihu.hos.tenant.model.TenantSession;
//import com.yihu.hos.web.framework.constant.ContextAttributes;
//import com.yihu.hos.web.framework.model.ActionResult;
//import com.yihu.hos.web.framework.thread.LocalContext;
//import org.apache.commons.codec.digest.DigestUtils;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Service;
//
//import javax.annotation.Resource;
//import javax.servlet.http.HttpSession;
//
///**
// * Created by HZP on 2016/02/26.
// */
//@Service("systemManager")
//public class SystemManager {
//
//    public static final String BEAN_ID = "systemManager";
//
//    @Resource(name = UserManager.BEAN_ID)
//    private UserManager userManager;
//
//    @Value("${hos.saasAdmin}")
//    private String saasAdmin;
//
//    /*
//    登录操作
//     */
//
//    public  ActionResult loginAction(HttpSession session,String user,String password) throws Exception
//    {
//        ActionResult result = null;
//        TenantSession tenantSession = (TenantSession)session.getAttribute(ContextAttributes.TENANT_SESSION);
//        if (saasAdmin.equals(tenantSession.getTenant())){
//            tenantSession.setRole("admin");//标识为中心管理员角色
//        }
//        //特殊账户
//        if(user.equals("admin") && password.equals("JKZL"))
//        {
//            SystemUser userInfo = new SystemUser();
//            userInfo.setLoginCode("admin");
//            userInfo.setUserName("管理员");
//            session.setAttribute("userInfo",userInfo);
//            tenantSession.setUserCode("admin");//设置租户code
//            session.setAttribute(ContextAttributes.TENANT_SESSION, tenantSession);
//            LocalContext.getContext().setAttachment(ContextAttributes.TENANT_NAME,tenantSession.getTenant());
//            LocalContext.getContext().setAttachment(ContextAttributes.SCHEMA, tenantSession.getSchema());
//
//            result = new ActionResult(true,"登录成功!");
//            result.setData(tenantSession);
//            return result;
//        }
//
//        //根据用户名/密码到总平台校验
//        SystemUser userInfo = userManager.getUserByLoginCode(user);
//        if(userInfo==null && !user.equals("admin"))
//        {
//            result = new ActionResult(false,"登录失败!用户不存在!");
//            return result;
//        }
//        else{
//            String saltValue =userInfo.getSaltValue();
//            String userPassword = userInfo.getPassword();
//            if(userPassword.equals(DigestUtils.md5Hex(password + saltValue)))
//            {
//                tenantSession.setUserCode(user);
//                session.setAttribute(ContextAttributes.TENANT_SESSION, tenantSession);
//                session.setAttribute("userInfo",userInfo);
//                result = new ActionResult(true,"登录成功!");
//                result.setData(tenantSession);
//                return result;
//            }
//            else{
//                result = new ActionResult(false,"登录失败!密码错误!");
//                return result;
//            }
//        }
//
//    }
//}

+ 60 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/SystemParamManager.java

@ -0,0 +1,60 @@
//package com.yihu.jw.basic.system.service;
//
//import com.yihu.hos.system.dao.SystemParamDao;
//import com.yihu.hos.system.model.SystemParam;
//import com.yihu.hos.web.framework.model.Result;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//
//import javax.annotation.Resource;
//import java.util.List;
//import java.util.Map;
//
///**
// * Created by chenweida on 2016/1/19.
// */
//@Service("systemParamManager")
//public class SystemParamManager {
//
//    public static final String BEAN_ID = "systemParamManager";
//
//    @Resource(name = SystemParamDao.BEAN_ID)
//    private SystemParamDao systemParamDao;
//
//
//    public Result getParamList(Map<String, Object> params) throws Exception {
//
//        return systemParamDao.getParamList(params);
//    }
//
//
//    public SystemParam getParamById(String id) throws Exception {
//        return systemParamDao.getEntity(SystemParam.class, id);
//    }
//
//    @Transactional
//    public Result addParam(SystemParam obj) throws Exception {
//        systemParamDao.saveEntity(obj);
//        return Result.success("保存成功");
//    }
//
//    @Transactional
//    public Result updateParam(SystemParam obj) throws Exception {
//        SystemParam systemParam = systemParamDao.getEntity(SystemParam.class, obj.getId());
//        systemParam.setRemark(obj.getRemark());
//        systemParam.setParamKey(obj.getParamKey());
//        systemParam.setParamValue(obj.getParamValue());
//        return Result.success("更新成功");
//    }
//
//    @Transactional
//    public Result deleteParam(String id) throws Exception {
//        SystemParam systemParam = systemParamDao.getEntity(SystemParam.class, id);
//        systemParamDao.deleteEntity(systemParam);
//        return Result.success("删除成功");
//    }
//
//    public List getData(String lastUpdate) {
//        return systemParamDao.getData(lastUpdate);
//    }
//}

+ 125 - 0
svr/svr-basic/src/main/java/com/yihu/jw/basic/system/service/UserManager.java

@ -0,0 +1,125 @@
//package com.yihu.jw.basic.system.service;
//
//import com.yihu.hos.system.dao.UserDao;
//import com.yihu.hos.system.model.SystemUser;
//import com.yihu.hos.system.model.SystemUserRole;
//import com.yihu.hos.web.framework.model.ActionResult;
//import com.yihu.hos.web.framework.model.Result;
//import org.apache.commons.codec.digest.DigestUtils;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//
//import javax.annotation.Resource;
//import java.util.List;
//import java.util.Map;
//
///**
// * Created by chenweida on 2016/1/19.
// */
//@Service("UserManager")
//public class UserManager {
//
//    public static final String BEAN_ID = "UserManager";
//
//    @Resource(name = UserDao.BEAN_ID)
//    private UserDao userdao;
//
//
//    public Result getUserList(Map<String, Object> params) throws Exception {
//
//        return userdao.getUserList(params);
//    }
//
//
//    public SystemUser getUserByLoginCode(String loginCode)  {
//        return userdao.getUserByLoginCode(loginCode);
//    }
//
//
//    public SystemUser getUserById(String userid) throws Exception {
//        return userdao.getEntity(SystemUser.class, userid);
//    }
//
//    @Transactional
//    public Result addUser(SystemUser obj) throws Exception {
//        SystemUser user = userdao.getUserByLoginCode(obj.getLoginCode());
//        if (user != null) {
//            throw new Exception("用户名存在");
//        }
//        userdao.saveEntity(obj);
//
//        return Result.success("保存成功");
//    }
//
//    @Transactional
//    public Result updateUser(SystemUser obj) throws Exception {
//        SystemUser systemUser = userdao.getEntity(SystemUser.class, obj.getId());
//        systemUser.setUserBirthday(obj.getUserBirthday());
//        systemUser.setUserName(obj.getUserName());
//        systemUser.setUserWechat(obj.getUserWechat());
//        systemUser.setUserQq(obj.getUserQq());
//        systemUser.setUserEmail(obj.getUserEmail());
//        systemUser.setUserSex(obj.getUserSex());
//        systemUser.setUserMobile(obj.getUserMobile());
//        return Result.success("更新成功");
//    }
//
//    @Transactional
//    public Result activityUser(String useid, String flag) throws Exception {
//        try {
//            userdao.activityUser(useid, flag);
//            return new ActionResult(true, "修改成功!");
//        } catch (Exception ex) {
//            return new ActionResult(false, "状态修改失败!");
//        }
//    }
//
//    @Transactional
//    public Result deleteUser(String userid) throws Exception {
//        userdao.activityUser(userid, SystemUser.ACTIVATED_DELETE);
//        return Result.success("删除成功");
//    }
//
//    @Transactional
//    public Result resetPassword(String userid) throws Exception {
//        SystemUser systemUser=userdao.getEntity(SystemUser.class,userid);
//        String saltString=systemUser.getSaltValue();
//        systemUser.setPassword(DigestUtils.md5Hex("111111"+saltString));
//        return Result.success("重置成功");
//    }
//
//    @Transactional
//    public Result changePassword(String userid, String newps) throws Exception {
//        SystemUser systemUser=userdao.getEntity(SystemUser.class,userid);
//        String saltString=systemUser.getSaltValue();
//        systemUser.setPassword(DigestUtils.md5Hex(newps+saltString));
//        return Result.success("密码修改成功");
//    }
//
//    @Transactional
//    public Result userRoleDistribute(String userId,String roleId) throws Exception
//    {
//        userdao.deleteUserRoleByUserId(userId);
//        if(!StringUtils.isEmpty(roleId))
//        {
//            String[] roles = roleId.split(",");
//
//            for(String role:roles)
//            {
//                SystemUserRole userRole = new SystemUserRole();
//                userRole.setUserId(userId);
//                userRole.setRoleId(role);
//
//                userdao.saveEntity(userRole);
//            }
//        }
//
//        return Result.success("角色分配成功");
//    }
//
//    public List<SystemUserRole> getUserRoleByUserId(String userId) throws Exception
//    {
//         return userdao.getUserRoleByUserId(userId);
//    }
//}