修改服务包内容配置中服务频次修改后数据回显问题
This commit is contained in:
parent
a31d740f3a
commit
32fdc1b969
@ -164,24 +164,6 @@ public interface ServiceWayContentMapper {
|
||||
*/
|
||||
int countByServiceFrequencyDTO(ServiceFrequencyDTO serviceFrequencyDTO);
|
||||
|
||||
/**
|
||||
* 检查除当前记录之外是否存在同名的服务内容
|
||||
*
|
||||
* @param serviceContentId
|
||||
* @param serviceWayId
|
||||
* @param serviceContent
|
||||
* @return
|
||||
*/
|
||||
int countByContentExcludingId(@Param("serviceContentId") Long serviceContentId, @Param("serviceWayId") Long serviceWayId, @Param("serviceContent") String serviceContent);
|
||||
|
||||
/**
|
||||
* 检查除当前记录之外是否存在相同的服务频次
|
||||
*
|
||||
* @param serviceWayContentEditDTO
|
||||
* @return
|
||||
*/
|
||||
int countByServiceFrequencyExcludingId(@Param("serviceWayContentEditDTO") ServiceWayContentEditDTO serviceWayContentEditDTO);
|
||||
|
||||
/**
|
||||
* 判断当前服务方式下服务内容是否重复
|
||||
*
|
||||
@ -193,6 +175,7 @@ public interface ServiceWayContentMapper {
|
||||
|
||||
/**
|
||||
* 检查TEXT类型的serviceFrequencyText是否重复
|
||||
*
|
||||
* @param serviceWayContentEditDTO
|
||||
* @return
|
||||
*/
|
||||
@ -200,8 +183,16 @@ public interface ServiceWayContentMapper {
|
||||
|
||||
/**
|
||||
* 检查DIGIT类型的serviceFrequencyStart和serviceFrequencyEnd是否重复
|
||||
*
|
||||
* @param serviceWayContentEditDTO
|
||||
* @return
|
||||
*/
|
||||
boolean isServiceFrequencyDigitDuplicate(@Param("serviceWayContentEditDTO") ServiceWayContentEditDTO serviceWayContentEditDTO);
|
||||
|
||||
/**
|
||||
* 更新服务频次
|
||||
* @param currentFrequency
|
||||
* @return
|
||||
*/
|
||||
int updateServiceFrequency(ServiceWayContent currentFrequency);
|
||||
}
|
||||
|
||||
@ -76,8 +76,7 @@ public class OperationInfoServiceImpl implements IOperationInfoService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateOperationInfo(OperationInfo operationInfo) {
|
||||
// 检查除当前记录之外是否存在同名的手术名称
|
||||
if (!operationInfo.getOperationName().equals(operationInfoMapper.selectOperationInfoById(operationInfo.getId()))
|
||||
&& operationInfoMapper.countByOperationNameExcludingId(operationInfo.getId(), operationInfo.getDepartmentId(), operationInfo.getOperationName()) > 0) {
|
||||
if (operationInfoMapper.countByOperationNameExcludingId(operationInfo.getId(), operationInfo.getDepartmentId(), operationInfo.getOperationName()) > 0) {
|
||||
throw new ServiceException("手术名称已存在");
|
||||
}
|
||||
// 设置修改人,修改时间
|
||||
|
||||
@ -84,8 +84,7 @@ public class ScriptInfoServiceImpl implements IScriptInfoService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateScriptInfo(ScriptInfo scriptInfo) {
|
||||
// 检查除当前记录之外是否存在同名的话术名称
|
||||
if (!scriptInfo.getCommonScriptName().equals(scriptInfoMapper.selectScriptInfoById(scriptInfo.getId()).getCommonScriptName())
|
||||
&& scriptInfoMapper.countByScriptNameExcludingId(scriptInfo.getCommonScriptName(), scriptInfo.getDepartmentId(), scriptInfo.getId()) > 0) {
|
||||
if (scriptInfoMapper.countByScriptNameExcludingId(scriptInfo.getCommonScriptName(), scriptInfo.getDepartmentId(), scriptInfo.getId()) > 0) {
|
||||
// 存在同名的通用话术名称,不能进行更新
|
||||
throw new ServiceException("通用话术名称已存在,请使用其他名称。");
|
||||
} else {
|
||||
|
||||
@ -112,8 +112,7 @@ public class ServicePackageServiceImpl implements IServicePackageService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateServicePackage(ServicePackageAddDTO servicePackageAddDTO) {
|
||||
// 检查除当前记录之外是否存在同名的服务包名称
|
||||
if (!servicePackageAddDTO.getPackageName().equals(servicePackageMapper.selectServicePackagesById(servicePackageAddDTO.getId()))
|
||||
&& servicePackageMapper.countByPackageNameExcludingId(servicePackageAddDTO.getId(), servicePackageAddDTO.getDepartmentId(), servicePackageAddDTO.getPackageName()) > 0) {
|
||||
if (servicePackageMapper.countByPackageNameExcludingId(servicePackageAddDTO.getId(), servicePackageAddDTO.getDepartmentId(), servicePackageAddDTO.getPackageName()) > 0) {
|
||||
throw new ServiceException("当前科室下服务包名称已存在");
|
||||
}
|
||||
String username = SecurityUtils.getUsername();
|
||||
|
||||
@ -23,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 服务方式内容Service业务层处理
|
||||
@ -167,31 +168,26 @@ public class ServiceWayContentServiceImpl implements IServiceWayContentService {
|
||||
currentFrequency.setServiceContentId(newServiceContent.getId());
|
||||
}
|
||||
}
|
||||
|
||||
// 检查服务频次是否改变
|
||||
boolean serviceFrequencyChanged = false;
|
||||
boolean isFrequencyDuplicate = false;
|
||||
boolean serviceFrequencyChanged = !Objects.equals(currentFrequency.getServiceFrequencyType(), serviceWayContentEditDTO.getServiceFrequencyType())
|
||||
|| !Objects.equals(currentFrequency.getServiceFrequencyText(), serviceWayContentEditDTO.getServiceFrequencyText())
|
||||
|| !Objects.equals(currentFrequency.getServiceFrequencyStart(), serviceWayContentEditDTO.getServiceFrequencyStart())
|
||||
|| !Objects.equals(currentFrequency.getServiceFrequencyEnd(), serviceWayContentEditDTO.getServiceFrequencyEnd());
|
||||
|
||||
if ("TEXT".equals(serviceWayContentEditDTO.getServiceFrequencyType())) {
|
||||
serviceFrequencyChanged = !currentFrequency.getServiceFrequencyText().equals(serviceWayContentEditDTO.getServiceFrequencyText());
|
||||
if (serviceFrequencyChanged) {
|
||||
// 检查TEXT类型的serviceFrequencyText是否重复
|
||||
// 如果服务频次改变了,检查新服务频次的重复性
|
||||
if (serviceFrequencyChanged) {
|
||||
boolean isFrequencyDuplicate = false;
|
||||
if ("TEXT".equals(serviceWayContentEditDTO.getServiceFrequencyType())) {
|
||||
isFrequencyDuplicate = serviceWayContentMapper.isServiceFrequencyTextDuplicate(serviceWayContentEditDTO);
|
||||
}
|
||||
} else if ("DIGIT".equals(serviceWayContentEditDTO.getServiceFrequencyType())) {
|
||||
serviceFrequencyChanged = !currentFrequency.getServiceFrequencyStart().equals(serviceWayContentEditDTO.getServiceFrequencyStart())
|
||||
|| !currentFrequency.getServiceFrequencyEnd().equals(serviceWayContentEditDTO.getServiceFrequencyEnd());
|
||||
if (serviceFrequencyChanged) {
|
||||
// 检查DIGIT类型的serviceFrequencyStart和serviceFrequencyEnd是否重复
|
||||
} else if ("DIGIT".equals(serviceWayContentEditDTO.getServiceFrequencyType())) {
|
||||
isFrequencyDuplicate = serviceWayContentMapper.isServiceFrequencyDigitDuplicate(serviceWayContentEditDTO);
|
||||
}
|
||||
}
|
||||
// 如果服务频次改变了,检查新服务频次的重复性
|
||||
if (serviceFrequencyChanged && isFrequencyDuplicate) {
|
||||
throw new ServiceException("当前服务内容下服务频次已存在");
|
||||
if (isFrequencyDuplicate) {
|
||||
throw new ServiceException("当前服务内容下服务频次已存在");
|
||||
}
|
||||
}
|
||||
|
||||
// 更新服务频次记录
|
||||
// 更新服务频次
|
||||
currentFrequency.setServiceFrequencyType(serviceWayContentEditDTO.getServiceFrequencyType());
|
||||
currentFrequency.setServiceFrequencyText(serviceWayContentEditDTO.getServiceFrequencyText());
|
||||
currentFrequency.setServiceFrequencyStart(serviceWayContentEditDTO.getServiceFrequencyStart());
|
||||
@ -199,9 +195,11 @@ public class ServiceWayContentServiceImpl implements IServiceWayContentService {
|
||||
currentFrequency.setUpdateBy(username);
|
||||
currentFrequency.setUpdateTime(date);
|
||||
|
||||
if (serviceWayContentMapper.updateServiceWayContent(currentFrequency) <= 0) {
|
||||
// 执行更新操作
|
||||
if (serviceWayContentMapper.updateServiceFrequency(currentFrequency) <= 0) {
|
||||
throw new ServiceException("修改服务频次失败");
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -159,8 +159,7 @@ public class TextMessageServiceImpl implements ITextMessageService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateTextMessage(TextMessageTaskDTO textMessageTaskDTO) {
|
||||
// 检查除当前记录之外是否存在同名的短信模板名称
|
||||
if (!textMessageTaskDTO.getTextMessageName().equals(textMessageMapper.selectTextMessageById(textMessageTaskDTO.getId())) &&
|
||||
textMessageMapper.countByTextMessageNameExcludingId(textMessageTaskDTO.getId(), textMessageTaskDTO.getDepartmentId(), textMessageTaskDTO.getTextMessageName()) > 0) {
|
||||
if (textMessageMapper.countByTextMessageNameExcludingId(textMessageTaskDTO.getId(), textMessageTaskDTO.getDepartmentId(), textMessageTaskDTO.getTextMessageName()) > 0) {
|
||||
throw new ServiceException("短信模板名称已存在");
|
||||
}
|
||||
|
||||
|
||||
@ -148,8 +148,7 @@ public class WechatTemplateServiceImpl implements IWechatTemplateService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateWechatTemplate(WechatTemplateTaskDTO wechatTemplateTaskDTO) {
|
||||
// 检查除当前记录之外是否存在同名的微信模板名称
|
||||
if (!wechatTemplateTaskDTO.getWechatTemplateName().equals(wechatTemplateMapper.selectWechatTemplateById(wechatTemplateTaskDTO.getId())) &&
|
||||
wechatTemplateMapper.countByWechatTemplateNameExcludingId(wechatTemplateTaskDTO.getId(), wechatTemplateTaskDTO.getDepartmentId(), wechatTemplateTaskDTO.getWechatTemplateName()) > 0) {
|
||||
if (wechatTemplateMapper.countByWechatTemplateNameExcludingId(wechatTemplateTaskDTO.getId(), wechatTemplateTaskDTO.getDepartmentId(), wechatTemplateTaskDTO.getWechatTemplateName()) > 0) {
|
||||
throw new ServiceException("微信模板名称已存在");
|
||||
}
|
||||
// 设置修改者和修改时间
|
||||
|
||||
@ -316,39 +316,6 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="countByContentExcludingId" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from service_way_content
|
||||
where service_way_id = #{serviceWayId}
|
||||
and service_content = #{serviceContent}
|
||||
and id != #{serviceContentId}
|
||||
</select>
|
||||
|
||||
<select id="countByServiceFrequencyExcludingId" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from service_way_content
|
||||
<where>
|
||||
service_content_id =#{serviceWayContentEditDTO.serviceContentId}
|
||||
and id != #{serviceWayContentEditDTO.id}
|
||||
<if test="serviceWayContentEditDTO.serviceFrequencyType!=null and serviceWayContentEditDTO.serviceFrequencyType!=''">
|
||||
and service_frequency_type =
|
||||
#{serviceWayContentEditDTO.serviceFrequencyType}
|
||||
</if>
|
||||
<if test="serviceWayContentEditDTO.serviceFrequencyText!=null and serviceWayContentEditDTO.serviceFrequencyText!=''">
|
||||
and service_frequency_text =
|
||||
#{serviceWayContentEditDTO.serviceFrequencyText}
|
||||
</if>
|
||||
<if test="serviceWayContentEditDTO.serviceFrequencyStart!=null">
|
||||
and service_frequency_start =
|
||||
#{serviceWayContentEditDTO.serviceFrequencyStart}
|
||||
</if>
|
||||
<if test="serviceWayContentEditDTO.serviceFrequencyEnd!=null">
|
||||
and service_frequency_end =
|
||||
#{serviceWayContentEditDTO.serviceFrequencyEnd}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectServiceContentByName" resultType="java.lang.Integer">
|
||||
select count(*)
|
||||
from service_way_content
|
||||
@ -556,6 +523,56 @@
|
||||
where id = #{id} and service_type = 'SERVICE_WRY'
|
||||
</update>
|
||||
|
||||
<update id="updateServiceFrequency"
|
||||
parameterType="com.xinelu.manage.domain.servicewaycontent.ServiceWayContent">
|
||||
update service_way_content
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="serviceWayName != null">service_way_name =
|
||||
#{serviceWayName},
|
||||
</if>
|
||||
<if test="serviceWayCode != null">service_way_code =
|
||||
#{serviceWayCode},
|
||||
</if>
|
||||
<if test="serviceType != null">service_type =
|
||||
#{serviceType},
|
||||
</if>
|
||||
<if test="serviceWayId != null">service_way_id =
|
||||
#{serviceWayId},
|
||||
</if>
|
||||
<if test="serviceContent != null">service_content =
|
||||
#{serviceContent},
|
||||
</if>
|
||||
<if test="serviceContentId != null">service_content_id =
|
||||
#{serviceContentId},
|
||||
</if>
|
||||
<if test="serviceFrequencyType != null">service_frequency_type =
|
||||
#{serviceFrequencyType},
|
||||
</if>
|
||||
service_frequency_text = #{serviceFrequencyText},
|
||||
service_frequency_start = #{serviceFrequencyStart},
|
||||
service_frequency_end = #{serviceFrequencyEnd},
|
||||
<if test="serviceSort != null">service_sort =
|
||||
#{serviceSort},
|
||||
</if>
|
||||
<if test="serviceRemark != null">service_remark =
|
||||
#{serviceRemark},
|
||||
</if>
|
||||
<if test="createBy != null">create_by =
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="createTime != null">create_time =
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateBy != null">update_by =
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">update_time =
|
||||
#{updateTime},
|
||||
</if>
|
||||
</trim>
|
||||
where id = #{id} and service_type = 'SERVICE_FREQUENCY'
|
||||
</update>
|
||||
|
||||
<delete id="deleteServiceWayContentById" parameterType="Long">
|
||||
delete
|
||||
from service_way_content
|
||||
|
||||
Loading…
Reference in New Issue
Block a user