Commit 2a8e5ea7 authored by zhangch's avatar zhangch

护理机构详情页面相关接口

parent 0fd8a25e
package com.hungraim.ltc.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.entity.SysConfig.ChCfgSrvOrganType;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndSrvOrganLevel;
import com.hungraim.ltc.pojo.vo.disable.SrvOrganListVo;
import com.hungraim.ltc.pojo.vo.system.SrvOrganVo;
import com.hungraim.ltc.service.SrvOrganService;
import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
......@@ -61,4 +62,66 @@ public class SrvOrganController {
}
/**
* 添加护理机构
*
* @param srvOrganVo 护理机构包装对象
* @return 返回操作结果
*/
@PostMapping("/srvOrgan")
public Result saveSrvOrgan(SrvOrganVo srvOrganVo) {
if (StrUtil.isBlank(srvOrganVo.getOrganId()) || StrUtil.isBlank(srvOrganVo.getDistrictProvincial()) || StrUtil.isBlank(srvOrganVo.getDistrictCity()) || StrUtil.isBlank(srvOrganVo.getDistrictArea()) || StrUtil.isBlank(srvOrganVo.getAcptProvincial()) || StrUtil.isBlank(srvOrganVo.getAcptCity()) || StrUtil.isBlank(srvOrganVo.getAcptArea()) || StrUtil.isBlank(srvOrganVo.getAcptStreet()) || StrUtil.isBlank(srvOrganVo.getAcptStreet()) || StrUtil.isBlank(srvOrganVo.getBankDistrictProvincial()) || StrUtil.isBlank(srvOrganVo.getBankDistrictCity()) || StrUtil.isBlank(srvOrganVo.getSrvOrganName()) || StrUtil.isBlank(srvOrganVo.getPermitId()) || null == srvOrganVo.getOrganTypeId() || null == srvOrganVo.getLevelCode() || StrUtil.isBlank(srvOrganVo.getLinkName()) || StrUtil.isBlank(srvOrganVo.getLinkTel()) || StrUtil.isBlank(srvOrganVo.getSrvType()) || null == srvOrganVo.getBunk() || StrUtil.isBlank(srvOrganVo.getUnifiedSocialCreditCode()) || StrUtil.isBlank(srvOrganVo.getSrvType()) || StrUtil.isBlank(srvOrganVo.getAccName()) || StrUtil.isBlank(srvOrganVo.getBankAccCode()) || StrUtil.isBlank(srvOrganVo.getBankAccName()) || StrUtil.isBlank(srvOrganVo.getBankNo()) || StrUtil.isBlank(srvOrganVo.getBankDistrictWebsite()) || null == srvOrganVo.getCardType() || null == srvOrganVo.getFileDataList() || srvOrganVo.getFileDataList().size() < 3) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
// 参数校验通过,调用service添加护理机构
srvOrganService.saveOrUpdateSrvOrgan(srvOrganVo);
return Result.success();
}
/**
* 修改护理机构
*
* @param srvOrganVo 护理机构包装对象
* @return 返回操作结果
*/
@PutMapping("/srvOrgan")
public Result updateSrvOrgan(SrvOrganVo srvOrganVo) {
if (null == srvOrganVo.getSrvOrganId() || StrUtil.isBlank(srvOrganVo.getOrganId()) || StrUtil.isBlank(srvOrganVo.getDistrictProvincial()) || StrUtil.isBlank(srvOrganVo.getDistrictCity()) || StrUtil.isBlank(srvOrganVo.getDistrictArea()) || StrUtil.isBlank(srvOrganVo.getAcptProvincial()) || StrUtil.isBlank(srvOrganVo.getAcptCity()) || StrUtil.isBlank(srvOrganVo.getAcptArea()) || StrUtil.isBlank(srvOrganVo.getAcptStreet()) || StrUtil.isBlank(srvOrganVo.getAcptStreet()) || StrUtil.isBlank(srvOrganVo.getBankDistrictProvincial()) || StrUtil.isBlank(srvOrganVo.getBankDistrictCity()) || StrUtil.isBlank(srvOrganVo.getSrvOrganName()) || StrUtil.isBlank(srvOrganVo.getPermitId()) || null == srvOrganVo.getOrganTypeId() || null == srvOrganVo.getLevelCode() || StrUtil.isBlank(srvOrganVo.getLinkName()) || StrUtil.isBlank(srvOrganVo.getLinkTel()) || StrUtil.isBlank(srvOrganVo.getSrvType()) || null == srvOrganVo.getBunk() || StrUtil.isBlank(srvOrganVo.getUnifiedSocialCreditCode()) || StrUtil.isBlank(srvOrganVo.getSrvType()) || StrUtil.isBlank(srvOrganVo.getAccName()) || StrUtil.isBlank(srvOrganVo.getBankAccCode()) || StrUtil.isBlank(srvOrganVo.getBankAccName()) || StrUtil.isBlank(srvOrganVo.getBankNo()) || StrUtil.isBlank(srvOrganVo.getBankDistrictWebsite()) || null == srvOrganVo.getCardType() || null == srvOrganVo.getFileDataList() || srvOrganVo.getFileDataList().size() < 3) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
// 参数校验通过,调用service修改护理机构
srvOrganService.saveOrUpdateSrvOrgan(srvOrganVo);
return Result.success();
}
/**
* 查询护理机构详情
*
* @param srvOrganId 护理机构id
* @return 返回护理机构详情
*/
@GetMapping("/srvOrgan")
public Result<SrvOrganVo> getSrvOrganDetail(Long srvOrganId) {
if (null == srvOrganId) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
SrvOrganVo srvOrganVo = srvOrganService.getSrvOrganDetail(srvOrganId);
return Result.success(srvOrganVo);
}
/**
* 删除护理机构
*
* @param srvOrganId 护理机构id
* @return 返回执行结果
*/
@DeleteMapping("/srvOrgan")
public Result<SrvOrganVo> deleteSrvOrgan(Long srvOrganId) {
if (null == srvOrganId) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
srvOrganService.deleteSrvOrgan(srvOrganId);
return Result.success();
}
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.entity.SysConfig.ChCfgSrvOrganType;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndSrvOrganLevel;
import com.hungraim.ltc.pojo.vo.disable.SrvOrganListVo;
import com.hungraim.ltc.pojo.vo.system.SrvOrganVo;
import java.util.List;
......@@ -34,4 +35,26 @@ public interface SrvOrganService {
* @return 返回所有服务机构类型
*/
List<ChCfgSrvOrganType> getSrvOrganTypes();
/**
* 添加护理机构
*
* @param srvOrganVo 护理机构包装对象
*/
void saveOrUpdateSrvOrgan(SrvOrganVo srvOrganVo);
/**
* 查询护理机构详情
*
* @param srvOrganId 护理机构id
* @return 返回护理机构详情
*/
SrvOrganVo getSrvOrganDetail(Long srvOrganId);
/**
* 删除护理机构
*
* @param srvOrganId 护理机构id
*/
void deleteSrvOrgan(Long srvOrganId);
}
......@@ -2,24 +2,38 @@ package com.hungraim.ltc.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.api.AttachFeignService;
import com.hungraim.ltc.dao.ChCfgSrvOrganTypeMapper;
import com.hungraim.ltc.dao.ChFndSrvOrganLevelMapper;
import com.hungraim.ltc.dao.SrvModeMapper;
import com.hungraim.ltc.dao.SrvOrganMapper;
import com.hungraim.ltc.pojo.entity.SysConfig.ChCfgSrvOrganType;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndSrvOrganLevel;
import com.hungraim.ltc.pojo.entity.disable.ChSrvOrgan;
import com.hungraim.ltc.pojo.vo.disable.SrvModeVo;
import com.hungraim.ltc.pojo.vo.disable.SrvOrganListVo;
import com.hungraim.ltc.pojo.vo.system.AttachUpdateVo;
import com.hungraim.ltc.pojo.vo.system.AttachVo;
import com.hungraim.ltc.pojo.vo.system.SrvOrganVo;
import com.hungraim.ltc.service.OrganService;
import com.hungraim.ltc.service.SrvOrganService;
import com.hungraim.ltc.util.AttachType;
import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Service
@AllArgsConstructor
@Slf4j
public class SrvOrganServiceImpl implements SrvOrganService {
private final SrvOrganMapper srvOrganMapper;
......@@ -32,6 +46,9 @@ public class SrvOrganServiceImpl implements SrvOrganService {
private final ChCfgSrvOrganTypeMapper chCfgSrvOrganTypeMapper;
private final AttachFeignService attachFeignService;
@Override
public Page<SrvOrganListVo> getSrvOrganList(Page<SrvOrganListVo> page, Long organId, Boolean isInvolveChild, String creditCode, String srvOrganName) {
List<Long> organIds = organService.getOrganIds(organId, isInvolveChild);
......@@ -65,5 +82,73 @@ public class SrvOrganServiceImpl implements SrvOrganService {
return chCfgSrvOrganTypeMapper.selectList(null);
}
@Transactional(rollbackFor = Exception.class)
@Override
public void saveOrUpdateSrvOrgan(SrvOrganVo srvOrganVo) {
Integer srvOrganId = srvOrganVo.getSrvOrganId();
List<ChFndAttach> fileDataList = srvOrganVo.getFileDataList();
ChSrvOrgan chSrvOrgan = new ChSrvOrgan();
BeanUtils.copyProperties(srvOrganVo, chSrvOrgan);
if (srvOrganId != null) {
// 修改操作
srvOrganMapper.updateById(chSrvOrgan);
AttachUpdateVo attachUpdateVo = new AttachUpdateVo();
attachUpdateVo.setCtrlId(Long.valueOf(srvOrganId));
attachUpdateVo.setAttachType(AttachType.SRV_ORGAN.getUploadType());
attachUpdateVo.setChFndAttachs(fileDataList);
Result attachs = attachFeignService.updateAttachs(attachUpdateVo);
if (!StrUtil.equals(attachs.getCode(), Result.success().getCode())) {
log.error("同步修改文件数据失败,失败原因:{}", attachs.getMsg());
}
} else {
// 添加操作
chSrvOrgan.setStatus(0);
chSrvOrgan.setEffTime(new Date());
srvOrganMapper.insert(chSrvOrgan);
AttachUpdateVo attachUpdateVo = new AttachUpdateVo();
attachUpdateVo.setCtrlId(Long.valueOf(chSrvOrgan.getSrvOrganId()));
attachUpdateVo.setAttachType(AttachType.SRV_ORGAN.getUploadType());
attachUpdateVo.setChFndAttachs(fileDataList);
Result attachs = attachFeignService.updateAttachs(attachUpdateVo);
if (!StrUtil.equals(attachs.getCode(), ResultCode.SUCCESS.getCode())) {
log.error("同步修改文件数据失败,失败原因:{}", attachs.getMsg());
}
}
}
@Override
public SrvOrganVo getSrvOrganDetail(Long srvOrganId) {
ChSrvOrgan chSrvOrgan = srvOrganMapper.selectById(srvOrganId);
SrvOrganVo srvOrganVo = new SrvOrganVo();
BeanUtils.copyProperties(chSrvOrgan, srvOrganVo);
try {
Result<List<AttachVo>> listResult = attachFeignService.selectAttachs(srvOrganId, AttachType.SRV_ORGAN.getUploadType());
if (StrUtil.equals(listResult.getCode(), ResultCode.SUCCESS.getCode())) {
List<AttachVo> data = listResult.getData();
if (data != null) {
List<ChFndAttach> attaches = new ArrayList<>();
for (AttachVo attachVo : data) {
ChFndAttach chFndAttach = new ChFndAttach();
BeanUtils.copyProperties(attachVo, chFndAttach);
attaches.add(chFndAttach);
}
srvOrganVo.setFileDataList(attaches);
}
} else {
log.error("查询id为{}的护理机构文件列表失败,失败原因:{}", srvOrganId, listResult.getMsg());
}
} catch (Exception e) {
e.printStackTrace();
log.error("查询id为{}的护理机构文件列表失败,失败原因:{}", srvOrganId, e.getMessage());
}
return srvOrganVo;
}
@Override
public void deleteSrvOrgan(Long srvOrganId) {
ChSrvOrgan chSrvOrgan = new ChSrvOrgan();
chSrvOrgan.setSrvOrganId(srvOrganId.intValue());
chSrvOrgan.setStatus(1);
srvOrganMapper.updateById(chSrvOrgan);
}
}
package com.hungraim.ltc.pojo.entity.disable;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hungraim.ltc.pojo.entity.PageInfo;
......@@ -12,8 +14,9 @@ import java.io.Serializable;
*/
@Data
@TableName("CH_SRV_ORGAN")
@KeySequence("SEQ_CH_SRV_ORGAN")
public class ChSrvOrgan extends PageInfo implements Serializable {
@TableId("srv_organ_id")
@TableId(type = IdType.INPUT)
private Integer srvOrganId;
private String acptRoadDetail;
private String acptLongitude;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment