Commit 21d6e011 authored by 何龙龙's avatar 何龙龙
parents 0776aeb5 cd09d72e
...@@ -10,7 +10,7 @@ spring: ...@@ -10,7 +10,7 @@ spring:
nacos: nacos:
discovery: discovery:
server-addr: qw.hungraim.com:31158 server-addr: qw.hungraim.com:31158
namespace: 3b93a812-d992-482e-a891-fcb3e455dc36 namespace: 0e0f834a-a665-4d27-ae04-9d53c2e02140
config: config:
namespace: 0e0f834a-a665-4d27-ae04-9d53c2e02140 namespace: 0e0f834a-a665-4d27-ae04-9d53c2e02140
server-addr: qw.hungraim.com:31158 server-addr: qw.hungraim.com:31158
......
...@@ -10,7 +10,7 @@ spring: ...@@ -10,7 +10,7 @@ spring:
nacos: nacos:
discovery: discovery:
server-addr: qw.hungraim.com:31158 server-addr: qw.hungraim.com:31158
namespace: 3b93a812-d992-482e-a891-fcb3e455dc36 namespace: 0e0f834a-a665-4d27-ae04-9d53c2e02140
config: config:
namespace: 0e0f834a-a665-4d27-ae04-9d53c2e02140 namespace: 0e0f834a-a665-4d27-ae04-9d53c2e02140
server-addr: qw.hungraim.com:31158 server-addr: qw.hungraim.com:31158
......
...@@ -10,7 +10,7 @@ spring: ...@@ -10,7 +10,7 @@ spring:
nacos: nacos:
discovery: discovery:
server-addr: qw.hungraim.com:31158 server-addr: qw.hungraim.com:31158
namespace: 3b93a812-d992-482e-a891-fcb3e455dc36 namespace: 0e0f834a-a665-4d27-ae04-9d53c2e02140
config: config:
namespace: 0e0f834a-a665-4d27-ae04-9d53c2e02140 namespace: 0e0f834a-a665-4d27-ae04-9d53c2e02140
server-addr: qw.hungraim.com:31158 server-addr: qw.hungraim.com:31158
......
...@@ -9,7 +9,7 @@ spring: ...@@ -9,7 +9,7 @@ spring:
nacos: nacos:
discovery: discovery:
server-addr: qw.hungraim.com:31158 server-addr: qw.hungraim.com:31158
namespace: 3b93a812-d992-482e-a891-fcb3e455dc36 namespace: 0e0f834a-a665-4d27-ae04-9d53c2e02140
config: config:
namespace: 0e0f834a-a665-4d27-ae04-9d53c2e02140 namespace: 0e0f834a-a665-4d27-ae04-9d53c2e02140
server-addr: qw.hungraim.com:31158 server-addr: qw.hungraim.com:31158
......
package com.hungraim.ltc.governance.controller;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.hungraim.ltc.governance.service.DisableAssessmentCriteriaService;
import com.hungraim.ltc.pojo.vo.governance.SrvTaskInfoVO;
import com.hungraim.ltc.util.Result;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 失能评定标准Controller
*
* @author czz
*/
@RestController
@RequestMapping("/api.governance/resource")
@Slf4j
public class DisableAssessmentCriteriaController {
@Autowired
private DisableAssessmentCriteriaService disableAssessmentCriteriaService;
/**
* 失能评定标准定义新增
*
* @param jsonParam json参数:
* <p>
* organId 适用机构id
* estimateName 失能评定标准名称
* remark 备注
* status 未生效:0;已生效:1;
* project[]{projectNama,minVal,maxVal,projectScoreCriteria[]{criteria,reference}} 评定项目
* <p>
* projectNama 评定项目名称
* minVal 评定项目最小值
* maxVal 评定项目最大值
* projectScoreCriteria 评定项目评分标准
* criteria 评分标准
* reference 分值参考
*/
@RequestMapping("/addDisableAssessmentCriteria")
public Result<SrvTaskInfoVO> addDisableAssessmentCriteria(String jsonParam) {
//参数校验
if (StringUtils.isBlank(jsonParam)) {
return Result.failed("参数不能为空!");
}
JSONObject jsonObject = JSONUtil.parseObj(jsonParam);
String organId = jsonObject.getStr("organId");
if (StringUtils.isBlank(organId)) {
return Result.failed("适用机构不能为空!");
}
String estimateName = jsonObject.getStr("estimateName");
if (StringUtils.isBlank(estimateName)) {
return Result.failed("失能评定标准名称不能为空!");
}
Integer status = jsonObject.getInt("status");
if (status == null || (status != 0 && status != 1)) {
return Result.failed("状态格式不正确!");
}
JSONArray project = jsonObject.getJSONArray("project");
if (project == null || project.size() <= 0) {
return Result.failed("评定项目不能为空!");
}
for (int i = 0; i < project.size(); i++) {
JSONObject itemObject = project.getJSONObject(i);
String projectNama = itemObject.getStr("projectNama");
String minVal = itemObject.getStr("minVal");
String maxVal = itemObject.getStr("maxVal");
short min = Short.parseShort(minVal);
short max = Short.parseShort(maxVal);
if (StringUtils.isBlank(projectNama)) {
return Result.failed("评定项目名称不能为空!");
}
if (min > max) {
return Result.failed("最小值不能大于最大值!");
}
JSONArray projectScoreCriteria = project.getJSONObject(i).getJSONArray("projectScoreCriteria");
if (projectScoreCriteria == null || projectScoreCriteria.size() <= 0) {
return Result.failed("评定项目评分标准不能为空!");
}
for (int j = 0; j < projectScoreCriteria.size(); j++) {
JSONObject clauseObject = projectScoreCriteria.getJSONObject(j);
String criteria = clauseObject.getStr("criteria");
String reference = clauseObject.getStr("reference");
if (StringUtils.isBlank(criteria)) {
return Result.failed("评分标准不能为空!");
}
if (StringUtils.isBlank(reference)) {
return Result.failed("分值参考不能为空!");
}
}
}
String remark = jsonObject.getStr("remark");
try {
disableAssessmentCriteriaService.addDisableAssessmentCriteria(organId, estimateName, remark, status, project);
} catch (Exception e) {
//添加失败
return Result.failed(e.getMessage());
}
//添加成功
return Result.success();
}
}
package com.hungraim.ltc.governance.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hungraim.ltc.pojo.entity.assessment.ChCfgAprItemClause;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
@Mapper
@Repository
public interface ChCfgAprItemClauseMapper extends BaseMapper<ChCfgAprItemClause> {
}
package com.hungraim.ltc.governance.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hungraim.ltc.pojo.entity.assessment.ChCfgAprItem;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
@Mapper
@Repository
public interface ChCfgAprItemMapper extends BaseMapper<ChCfgAprItem> {
}
package com.hungraim.ltc.governance.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hungraim.ltc.pojo.entity.assessment.ChCfgApr;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
@Mapper
@Repository
public interface ChCfgAprMapper extends BaseMapper<ChCfgApr> {
}
package com.hungraim.ltc.governance.service;
import cn.hutool.json.JSONArray;
import org.springframework.stereotype.Service;
/**
* 失能评定标准service
*
* @author czz
*/
@Service
public interface DisableAssessmentCriteriaService {
void addDisableAssessmentCriteria(String organId, String estimateName, String remark, Integer status, JSONArray project);
}
package com.hungraim.ltc.governance.service.impl;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import com.hungraim.ltc.governance.dao.ChCfgAprItemClauseMapper;
import com.hungraim.ltc.governance.dao.ChCfgAprItemMapper;
import com.hungraim.ltc.governance.dao.ChCfgAprMapper;
import com.hungraim.ltc.governance.service.DisableAssessmentCriteriaService;
import com.hungraim.ltc.pojo.entity.assessment.ChCfgApr;
import com.hungraim.ltc.pojo.entity.assessment.ChCfgAprItem;
import com.hungraim.ltc.pojo.entity.assessment.ChCfgAprItemClause;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
/**
* 失能评定标准service
*
* @author czz
*/
@Service
public class DisableAssessmentCriteriaServiceImpl implements DisableAssessmentCriteriaService {
@Autowired
private ChCfgAprMapper chCfgAprMapper;
@Autowired
private ChCfgAprItemMapper chCfgAprItemMapper;
@Autowired
private ChCfgAprItemClauseMapper chCfgAprItemClauseMapper;
@Transactional(rollbackFor = Exception.class)
@Override
public void addDisableAssessmentCriteria(String organId, String estimateName, String remark, Integer status, JSONArray project) {
Date date = new Date();
//鉴定标准配置
ChCfgApr apr = new ChCfgApr();
apr.setOrganId(organId);
apr.setEstimateName(estimateName);
apr.setRemark(remark);
apr.setEffTime(date);
apr.setStatus(status.shortValue());
chCfgAprMapper.insert(apr);
//鉴定项目定义
for (int i = 0; i < project.size(); i++) {
ChCfgAprItem item = new ChCfgAprItem();
JSONObject itemObject = project.getJSONObject(i);
String projectNama = itemObject.getStr("projectNama");
String minVal = itemObject.getStr("minVal");
String maxVal = itemObject.getStr("maxVal");
item.setItemName(projectNama);
item.setMinValue(Short.parseShort(minVal));
item.setMaxValue(Short.parseShort(maxVal));
item.setAprId(apr.getAprId());
chCfgAprItemMapper.insert(item);
//鉴定项目定义明细
JSONArray projectScoreCriteria = itemObject.getJSONArray("projectScoreCriteria");
for (int j = 0; j < projectScoreCriteria.size(); j++) {
ChCfgAprItemClause clause = new ChCfgAprItemClause();
JSONObject clauseObject = projectScoreCriteria.getJSONObject(j);
String criteria = clauseObject.getStr("criteria");
String reference = clauseObject.getStr("reference");
clause.setClauseDesc(criteria);
clause.setClauseValue(Short.parseShort(reference));
clause.setItemId(item.getItemId());
clause.setAprId(apr.getAprId());
chCfgAprItemClauseMapper.insert(clause);
}
}
}
}
...@@ -9,7 +9,7 @@ spring: ...@@ -9,7 +9,7 @@ spring:
nacos: nacos:
discovery: discovery:
server-addr: qw.hungraim.com:31158 server-addr: qw.hungraim.com:31158
namespace: 3b93a812-d992-482e-a891-fcb3e455dc36 namespace: 0e0f834a-a665-4d27-ae04-9d53c2e02140
config: config:
namespace: 0e0f834a-a665-4d27-ae04-9d53c2e02140 namespace: 0e0f834a-a665-4d27-ae04-9d53c2e02140
server-addr: qw.hungraim.com:31158 server-addr: qw.hungraim.com:31158
......
...@@ -10,7 +10,7 @@ spring: ...@@ -10,7 +10,7 @@ spring:
nacos: nacos:
discovery: discovery:
server-addr: qw.hungraim.com:31158 server-addr: qw.hungraim.com:31158
namespace: 3b93a812-d992-482e-a891-fcb3e455dc36 namespace: 0e0f834a-a665-4d27-ae04-9d53c2e02140
config: config:
namespace: 0e0f834a-a665-4d27-ae04-9d53c2e02140 namespace: 0e0f834a-a665-4d27-ae04-9d53c2e02140
server-addr: qw.hungraim.com:31158 server-addr: qw.hungraim.com:31158
......
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