Browse Source

代码修改

LAPTOP-KB9HII50\70708 3 years ago
parent
commit
87bf67a588

+ 77 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/gw/BaseHomePageDO.java

@ -0,0 +1,77 @@
package com.yihu.jw.entity.base.gw;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 制度表
 * Created by yeshijie on 2022/2/21.
 */
@Entity
@Table(name = "base_home_page")
public class BaseHomePageDO extends UuidIdentityEntityWithCreateTime {
    private String name;//名称
    private Integer type;//1 banner,2产品生态与亮点 3解决方案 4新闻中心
    private String img;//图片
    private String url;//链接
    private Integer del;//失效标志 0失效 1生效
    private Long sort;//排序
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "type")
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    @Column(name = "img")
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
    @Column(name = "url")
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    @Column(name = "del")
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    @Column(name = "sort")
    public Long getSort() {
        return sort;
    }
    public void setSort(Long sort) {
        this.sort = sort;
    }
}

+ 57 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/gw/BaseRulesDO.java

@ -0,0 +1,57 @@
package com.yihu.jw.entity.base.gw;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 制度表
 * Created by yeshijie on 2022/2/21.
 */
@Entity
@Table(name = "base_rules")
public class BaseRulesDO extends UuidIdentityEntityWithCreateTime {
    private String name;//制度名称
    private String fileUrl;//文件地址
    private String img;//
    private Integer del;//失效标志 0失效 1生效
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "file_url")
    public String getFileUrl() {
        return fileUrl;
    }
    public void setFileUrl(String fileUrl) {
        this.fileUrl = fileUrl;
    }
    @Column(name = "img")
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
    @Column(name = "del")
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 67 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/gw/BaseWebInfoDO.java

@ -0,0 +1,67 @@
package com.yihu.jw.entity.base.gw;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 制度表
 * Created by yeshijie on 2022/2/21.
 */
@Entity
@Table(name = "base_web_info")
public class BaseWebInfoDO extends UuidIdentityEntityWithCreateTime {
    private String name;
    private String address;//地址
    private String mobile;//联系方式
    private String recordNumber;//备案号
    private String qrcode;//二维码
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "address")
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    @Column(name = "mobile")
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    @Column(name = "record_number")
    public String getRecordNumber() {
        return recordNumber;
    }
    public void setRecordNumber(String recordNumber) {
        this.recordNumber = recordNumber;
    }
    @Column(name = "qrcode")
    public String getQrcode() {
        return qrcode;
    }
    public void setQrcode(String qrcode) {
        this.qrcode = qrcode;
    }
}

+ 12 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/gw/BaseHomePageDao.java

@ -0,0 +1,12 @@
package com.yihu.jw.base.dao.gw;
import com.yihu.jw.entity.base.gw.BaseHomePageDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2022/2/21.
 */
public interface BaseHomePageDao extends PagingAndSortingRepository<BaseHomePageDO, String>, JpaSpecificationExecutor<BaseHomePageDO> {
}

+ 12 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/gw/BaseRulesDao.java

@ -0,0 +1,12 @@
package com.yihu.jw.base.dao.gw;
import com.yihu.jw.entity.base.gw.BaseRulesDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2022/2/21.
 */
public interface BaseRulesDao extends PagingAndSortingRepository<BaseRulesDO, String>, JpaSpecificationExecutor<BaseRulesDO> {
}

+ 17 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/gw/BaseWebInfoDao.java

@ -0,0 +1,17 @@
package com.yihu.jw.base.dao.gw;
import com.yihu.jw.entity.base.gw.BaseWebInfoDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by yeshijie on 2022/2/21.
 */
public interface BaseWebInfoDao extends PagingAndSortingRepository<BaseWebInfoDO, String>, JpaSpecificationExecutor<BaseWebInfoDO> {
    @Query("from BaseWebInfoDO")
    List<BaseWebInfoDO> findAll();
}

+ 18 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/FileUploadController.java

@ -11,9 +11,11 @@ import com.yihu.jw.file_upload.FileManageService;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.restmodel.MutilFileInfo;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -94,6 +96,22 @@ public class FileUploadController extends EnvelopRestEndpoint {
        return success("上传成功", uploadVO);
    }
    @PostMapping(value = "upload_stream_attachmentLimit")
    @ApiOperation(value = "文件流上传附件", notes = "文件流上传附件限制格式")
    public ObjEnvelop<UploadVO> uploadAttachmentLimit(@ApiParam(value = "文件", required = true)
                                                 @RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
        UploadVO uploadVO = new UploadVO();
        // 得到文件的完整名称  xxx.txt
        String originalFilename = file.getOriginalFilename();
        //得到文件类型
        String fileType = originalFilename.substring(originalFilename.lastIndexOf(".") + 1).toLowerCase();
        if(StringUtils.isBlank(fileType)||!"doc、docx、pdf、xls、xlsx、ppt、pptx".contains(fileType)){
            return ObjEnvelop.getError("文件格式不支持");
        }
        InputStream inputStream = file.getInputStream();
        uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);
        return success("上传成功", uploadVO);
    }
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM_ATTACHMENT)
    @ApiOperation(value = "文件流上传附件", notes = "文件流上传附件")

+ 239 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/gw/ZjxlGwEndpoint.java

@ -0,0 +1,239 @@
package com.yihu.jw.base.endpoint.gw;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.base.service.article.KnowledgeArticleService;
import com.yihu.jw.base.service.gw.BaseHomePageService;
import com.yihu.jw.base.service.gw.BaseRulesService;
import com.yihu.jw.base.service.gw.BaseWebInfoService;
import com.yihu.jw.base.service.gw.ZjxlGwService;
import com.yihu.jw.entity.base.gw.BaseHomePageDO;
import com.yihu.jw.entity.base.gw.BaseRulesDO;
import com.yihu.jw.entity.base.gw.BaseWebInfoDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDictDO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
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.util.Date;
import java.util.List;
/**
 * Created by yeshijie on 2022/2/21.
 */
@RestController
@RequestMapping(value = "/zjxlGw")
@Api(value = "公司官网", tags = {"公司官网"})
public class ZjxlGwEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private ZjxlGwService zjxlGwService;
    @Autowired
    private BaseHomePageService baseHomePageService;
    @Autowired
    private BaseWebInfoService baseWebInfoService;
    @Autowired
    private BaseRulesService baseRulesService;
    @Autowired
    private KnowledgeArticleService knowledgeArticleService;
    @GetMapping(value = "searchKnowledgePageList")
    @ApiOperation(value = "获取文章列表")
    public Envelop searchKnowledgePageList(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1")
            @RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
            @ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
            @RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize){
        try {
            List<KnowledgeArticleDictDO> list  = knowledgeArticleService.search(fields,filters,sorts,page,pageSize);
            List<KnowledgeArticleDictDO> totals  = knowledgeArticleService.search(fields,filters,sorts);
            JSONObject result = new JSONObject();
            result.put("total",totals.size());
            result.put("detailModelList",list);
            return success(result);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @PostMapping(value = "addOrUpdRules")
    @ApiOperation(value = "创建或修改制度")
    public Envelop addOrUpdRules(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData){
        try {
            BaseRulesDO baseRulesDO = toEntity(jsonData, BaseRulesDO.class);
            if(baseRulesDO.getCreateTime()==null){
                baseRulesDO.setCreateTime(new Date());
            }
            baseRulesService.save(baseRulesDO);
            return success("操作成功");
        }catch (Exception e){
            e.printStackTrace();
            return failed("操作失败");
        }
    }
    @PostMapping(value = "deleteRules")
    @ApiOperation(value = "删除制度")
    public Envelop deleteRules(
            @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
            @RequestParam(value = "ids") String ids) {
        try {
            baseRulesService.delete(ids.split(","));
            return success("删除成功");
        }catch (Exception e){
            e.printStackTrace();
            return failed("删除失败");
        }
    }
    @GetMapping(value = "rulesPage")
    @ApiOperation(value = "获取制度分页")
    public PageEnvelop<BaseRulesDO> rulesPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) {
        try {
            List<BaseRulesDO> baseOrgs = baseRulesService.search(fields, filters, sorts, page, size);
            int count = (int) baseRulesService.getCount(filters);
            return success(baseOrgs, count, page, size, BaseRulesDO.class);
        }catch (Exception e){
            e.printStackTrace();
            return PageEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "findRulesById")
    @ApiOperation(value = "根据id查询制度")
    public ObjEnvelop findRulesById (
            @ApiParam(name = "id", value = "id")
            @RequestParam(value = "id", required = true) String id){
        try {
            BaseRulesDO baseRulesDO = zjxlGwService.findRulesById(id);
            return ObjEnvelop.getSuccess("查询成功",baseRulesDO);
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "findWebInfo")
    @ApiOperation(value = "网页基本信息")
    public ObjEnvelop findWebInfo(){
        try {
            BaseWebInfoDO webInfoDO = zjxlGwService.findWebInfo();
            return ObjEnvelop.getSuccess("查询成功",webInfoDO);
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("查询失败");
        }
    }
    @PostMapping(value = "addOrUpdWebInfo")
    @ApiOperation(value = "创建或修改网页基本信息")
    public Envelop addOrUpdWebInfo(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData){
        try {
            BaseWebInfoDO webInfoDO = toEntity(jsonData, BaseWebInfoDO.class);
            if(webInfoDO.getCreateTime()==null){
                webInfoDO.setCreateTime(new Date());
            }
            baseWebInfoService.save(webInfoDO);
            return success("操作成功");
        }catch (Exception e){
            e.printStackTrace();
            return failed("操作失败");
        }
    }
    @PostMapping(value = "addOrUpdHomePage")
    @ApiOperation(value = "创建或修改首页")
    public Envelop addOrUpdHomePage(
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData){
        try {
            BaseHomePageDO baseHomePageDO = toEntity(jsonData, BaseHomePageDO.class);
            if(baseHomePageDO.getCreateTime()==null){
                baseHomePageDO.setCreateTime(new Date());
            }
            baseHomePageService.save(baseHomePageDO);
            return success("操作成功");
        }catch (Exception e){
            e.printStackTrace();
            return failed("操作失败");
        }
    }
    @PostMapping(value = "deleteHomePage")
    @ApiOperation(value = "删除首页")
    public Envelop deleteHomePage(
            @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
            @RequestParam(value = "ids") String ids) {
        try {
            baseHomePageService.delete(ids.split(","));
            return success("删除成功");
        }catch (Exception e){
            e.printStackTrace();
            return failed("删除失败");
        }
    }
    @GetMapping(value = "homePagePage")
    @ApiOperation(value = "获取制度分页")
    public PageEnvelop<BaseHomePageDO> homePagePage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) {
        try {
            List<BaseHomePageDO> homePageDOS = baseHomePageService.search(fields, filters, sorts, page, size);
            int count = (int) baseHomePageService.getCount(filters);
            return success(homePageDOS, count, page, size, BaseHomePageDO.class);
        }catch (Exception e){
            e.printStackTrace();
            return PageEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "findHomePageById")
    @ApiOperation(value = "根据id查询首页")
    public ObjEnvelop findHomePageById (
            @ApiParam(name = "id", value = "id")
            @RequestParam(value = "id", required = true) String id){
        try {
            BaseHomePageDO baseHomePageDO = zjxlGwService.findHomePageById(id);
            return ObjEnvelop.getSuccess("查询成功",baseHomePageDO);
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("查询失败");
        }
    }
}

+ 20 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/gw/BaseHomePageService.java

@ -0,0 +1,20 @@
package com.yihu.jw.base.service.gw;
import com.yihu.jw.base.dao.gw.BaseHomePageDao;
import com.yihu.jw.entity.base.gw.BaseHomePageDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * Created by yeshijie on 2022/2/21.
 */
@Service
public class BaseHomePageService extends BaseJpaService<BaseHomePageDO, BaseHomePageDao> {
    @Autowired
    private BaseHomePageDao baseHomePageDao;
}

+ 18 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/gw/BaseRulesService.java

@ -0,0 +1,18 @@
package com.yihu.jw.base.service.gw;
import com.yihu.jw.base.dao.gw.BaseRulesDao;
import com.yihu.jw.entity.base.gw.BaseRulesDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * Created by yeshijie on 2022/2/21.
 */
@Service
public class BaseRulesService extends BaseJpaService<BaseRulesDO, BaseRulesDao> {
    @Autowired
    private BaseRulesDao baseRulesDao;
}

+ 20 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/gw/BaseWebInfoService.java

@ -0,0 +1,20 @@
package com.yihu.jw.base.service.gw;
import com.yihu.jw.base.dao.gw.BaseWebInfoDao;
import com.yihu.jw.entity.base.gw.BaseWebInfoDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * Created by yeshijie on 2022/2/21.
 */
@Service
public class BaseWebInfoService extends BaseJpaService<BaseWebInfoDO, BaseWebInfoDao> {
    @Autowired
    private BaseWebInfoDao baseWebInfoDao;
}

+ 44 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/gw/ZjxlGwService.java

@ -0,0 +1,44 @@
package com.yihu.jw.base.service.gw;
import com.yihu.jw.base.dao.gw.BaseHomePageDao;
import com.yihu.jw.base.dao.gw.BaseRulesDao;
import com.yihu.jw.base.dao.gw.BaseWebInfoDao;
import com.yihu.jw.entity.base.gw.BaseHomePageDO;
import com.yihu.jw.entity.base.gw.BaseRulesDO;
import com.yihu.jw.entity.base.gw.BaseWebInfoDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * 公司官网
 * Created by yeshijie on 2022/2/21.
 */
@Service
public class ZjxlGwService {
    @Autowired
    private BaseHomePageDao baseHomePageDao;
    @Autowired
    private BaseWebInfoDao baseWebInfoDao;
    @Autowired
    private BaseRulesDao baseRulesDao;
    public BaseRulesDO findRulesById(String id){
        return baseRulesDao.findOne(id);
    }
    public BaseHomePageDO findHomePageById(String id){
        return baseHomePageDao.findOne(id);
    }
    public BaseWebInfoDO findWebInfo(){
        List<BaseWebInfoDO> list = baseWebInfoDao.findAll();
        if(list.size()>0){
            return list.get(0);
        }
        return null;
    }
}

+ 1 - 1
svr/svr-base/src/main/resources/bootstrap.yml

@ -1,6 +1,6 @@
spring:
  application:
    name: svr-base
    name: svr-base-ysj
  cloud:
    config:
      failFast: true