Commit 119679b2 authored by 蔡镇泽's avatar 蔡镇泽

新增评定机构或更新评定机构信息

parent 8acfe3f3
...@@ -2,16 +2,14 @@ package com.hungraim.ltc.governance.controller; ...@@ -2,16 +2,14 @@ package com.hungraim.ltc.governance.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.governance.service.AprOrganService; import com.hungraim.ltc.governance.service.AprOrganService;
import com.hungraim.ltc.pojo.entity.serviceManage.ChAprOrgan;
import com.hungraim.ltc.pojo.vo.governance.AprOrganVO; import com.hungraim.ltc.pojo.vo.governance.AprOrganVO;
import com.hungraim.ltc.util.Result; import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode; import com.hungraim.ltc.util.ResultCode;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/** /**
* 评定机构及评定机构人员信息管理Controller * 评定机构及评定机构人员信息管理Controller
...@@ -45,6 +43,21 @@ public class AprOrganController { ...@@ -45,6 +43,21 @@ public class AprOrganController {
} }
/** /**
* 获取评定机构信息
*
* @param aprOrganId 评定机构id
* @return 返回相关信息
*/
@GetMapping("/getAprOrganInfo")
public Result<ChAprOrgan> getAprOrganInfo(Long aprOrganId) {
if (null == aprOrganId) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
ChAprOrgan chAprOrgan = aprOrganService.getAprOrganInfo(aprOrganId);
return Result.success(chAprOrgan);
}
/**
* 更改评定机构状态 * 更改评定机构状态
* *
* @param aprOrganId 监管机构id * @param aprOrganId 监管机构id
...@@ -59,4 +72,107 @@ public class AprOrganController { ...@@ -59,4 +72,107 @@ public class AprOrganController {
return Result.success(); return Result.success();
} }
/**
* 新增评定机构或更新评定机构信息(有apr_organ_id就更新,没有就新增)
*
* @param updateType 更新类型(1:账户信息修改,2:基本信息修改),新增不传
*/
@DeleteMapping("/updateAprOrganStatus")
public Result addOrUpdateAprOrgan(ChAprOrgan chAprOrgan, Short updateType) {
if (chAprOrgan == null) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (chAprOrgan.getAprOrganId() == null) {
//新增
if (StringUtils.isBlank(chAprOrgan.getOrganId())) {//适用机构
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (StringUtils.isBlank(chAprOrgan.getDistrictProvincial()) || StringUtils.isBlank(chAprOrgan.getDistrictArea()) || StringUtils.isBlank(chAprOrgan.getDistrictCity())) {//所在省市区
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (StringUtils.isBlank(chAprOrgan.getOrganName())) {//评定机构名称
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (StringUtils.isBlank(chAprOrgan.getUnifiedSocialCreditCode())) {//统一社会信用代码
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (chAprOrgan.getOrganTypeId() == null) {//机构类型id
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (StringUtils.isBlank(chAprOrgan.getAcptProvincial()) || StringUtils.isBlank(chAprOrgan.getAcptCity()) || StringUtils.isBlank(chAprOrgan.getAcptArea()) || StringUtils.isBlank(chAprOrgan.getAcptAddress()) || StringUtils.isBlank(chAprOrgan.getAcptStreet())) {//机构详细地址
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (StringUtils.isBlank(chAprOrgan.getLinkName())) {//机构联系人姓名
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (StringUtils.isBlank(chAprOrgan.getLinkTel())) {//机构联系人手机号
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (chAprOrgan.getGroupDetailId() == null) {//评定起点地址
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (StringUtils.isBlank(chAprOrgan.getAccName())) {//银行账户名称
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (StringUtils.isBlank(chAprOrgan.getBankNo())) {//银行账号
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (StringUtils.isBlank(chAprOrgan.getBankDistrictProvincial()) || StringUtils.isBlank(chAprOrgan.getBankDistrictCity())) {//账号所属省市
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (StringUtils.isBlank(chAprOrgan.getBankDistrictWebsite())) {//账号所属网点
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (chAprOrgan.getCardType() == null) {//卡类型
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
} else {
//更新
if (updateType != 1 && updateType != 2) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (updateType == 1) {//账户信息修改
if (StringUtils.isBlank(chAprOrgan.getAccName())) {//银行账户名称
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (StringUtils.isBlank(chAprOrgan.getBankNo())) {//银行账号
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (StringUtils.isBlank(chAprOrgan.getBankDistrictProvincial()) || StringUtils.isBlank(chAprOrgan.getBankDistrictCity())) {//账号所属省市
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (StringUtils.isBlank(chAprOrgan.getBankDistrictWebsite())) {//账号所属网点
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (chAprOrgan.getCardType() == null) {//卡类型
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
} else {//基本信息修改
if (StringUtils.isBlank(chAprOrgan.getDistrictProvincial()) || StringUtils.isBlank(chAprOrgan.getDistrictArea()) || StringUtils.isBlank(chAprOrgan.getDistrictCity())) {//所在省市区
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (StringUtils.isBlank(chAprOrgan.getUnifiedSocialCreditCode())) {//统一社会信用代码
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (chAprOrgan.getOrganTypeId() == null) {//机构类型id
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (StringUtils.isBlank(chAprOrgan.getAcptArea()) || StringUtils.isBlank(chAprOrgan.getAcptAddress()) || StringUtils.isBlank(chAprOrgan.getAcptStreet())) {//机构详细地址
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (StringUtils.isBlank(chAprOrgan.getLinkName())) {//机构联系人姓名
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (StringUtils.isBlank(chAprOrgan.getLinkTel())) {//机构联系人手机号
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
if (chAprOrgan.getGroupDetailId() == null) {//评定起点地址
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
}
}
aprOrganService.addOrUpdateAprOrgan(chAprOrgan, updateType);
return Result.success();
}
} }
package com.hungraim.ltc.governance.service; package com.hungraim.ltc.governance.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.entity.serviceManage.ChAprOrgan;
import com.hungraim.ltc.pojo.vo.governance.AprOrganVO; import com.hungraim.ltc.pojo.vo.governance.AprOrganVO;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -14,4 +15,8 @@ public interface AprOrganService { ...@@ -14,4 +15,8 @@ public interface AprOrganService {
Page<AprOrganVO> aprOrganList(Page<AprOrganVO> page, Long organId, Boolean isIncluded, String organName, String code); Page<AprOrganVO> aprOrganList(Page<AprOrganVO> page, Long organId, Boolean isIncluded, String organName, String code);
void updateAprOrganStatus(String aprOrganId, Short status); void updateAprOrganStatus(String aprOrganId, Short status);
void addOrUpdateAprOrgan(ChAprOrgan chAprOrgan, Short updateType);
ChAprOrgan getAprOrganInfo(Long aprOrganId);
} }
...@@ -11,6 +11,7 @@ import lombok.AllArgsConstructor; ...@@ -11,6 +11,7 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List; import java.util.List;
...@@ -42,4 +43,47 @@ public class AprOrganServiceImpl implements AprOrganService { ...@@ -42,4 +43,47 @@ public class AprOrganServiceImpl implements AprOrganService {
chAprOrgan.setStatus(status); chAprOrgan.setStatus(status);
aprOrganMapper.updateById(chAprOrgan); aprOrganMapper.updateById(chAprOrgan);
} }
@Override
public void addOrUpdateAprOrgan(ChAprOrgan chAprOrgan, Short updateType) {
if (chAprOrgan.getAprOrganId() == null) {
//新增
chAprOrgan.setEffTime(new Date());
chAprOrgan.setStatus((short) 0);
aprOrganMapper.insert(chAprOrgan);
} else {
//更新
ChAprOrgan aprOrgan = aprOrganMapper.selectById(chAprOrgan.getAprOrganId());
if (updateType == 1) {//账户信息修改
aprOrgan.setAccName(chAprOrgan.getAccName());
aprOrgan.setBankAccName(chAprOrgan.getBankAccName());
aprOrgan.setBankNo(chAprOrgan.getBankNo());
aprOrgan.setBankDistrictProvincial(chAprOrgan.getBankDistrictProvincial());
aprOrgan.setBankDistrictCity(chAprOrgan.getBankDistrictCity());
aprOrgan.setBankDistrictWebsite(chAprOrgan.getBankDistrictWebsite());
aprOrgan.setCardType(chAprOrgan.getCardType());
aprOrgan.setRemark(chAprOrgan.getRemark());
aprOrganMapper.updateById(aprOrgan);
} else {//基本信息修改
aprOrgan.setDistrictProvincial(chAprOrgan.getDistrictProvincial());
aprOrgan.setDistrictCity(chAprOrgan.getDistrictCity());
aprOrgan.setDistrictArea(chAprOrgan.getDistrictArea());
aprOrgan.setUnifiedSocialCreditCode(chAprOrgan.getUnifiedSocialCreditCode());
aprOrgan.setOrganTypeId(chAprOrgan.getOrganTypeId());
aprOrgan.setAcptArea(chAprOrgan.getAcptArea());
aprOrgan.setAcptAddress(chAprOrgan.getAcptAddress());
aprOrgan.setAcptStreet(chAprOrgan.getAcptStreet());
aprOrgan.setLinkName(chAprOrgan.getLinkName());
aprOrgan.setLinkTel(chAprOrgan.getLinkTel());
aprOrgan.setGroupDetailId(chAprOrgan.getGroupDetailId());
aprOrgan.setLinkMail(chAprOrgan.getLinkMail());
aprOrganMapper.updateById(aprOrgan);
}
}
}
@Override
public ChAprOrgan getAprOrganInfo(Long aprOrganId) {
return aprOrganMapper.selectById(aprOrganId);
}
} }
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