修改微信模板修改和短信模板修改接口

This commit is contained in:
youxilong 2024-03-06 13:21:52 +08:00
parent 32911dfa2d
commit d9f279dc8d
18 changed files with 236 additions and 112 deletions

View File

@ -11,6 +11,8 @@ import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.NotBlank;
/** /**
* 手术信息对象 operation_info * 手术信息对象 operation_info
* *
@ -49,6 +51,7 @@ public class OperationInfo extends BaseEntity {
*/ */
@ApiModelProperty(value = "手术名称") @ApiModelProperty(value = "手术名称")
@Excel(name = "手术名称") @Excel(name = "手术名称")
@NotBlank(message = "手术名称不能为空")
private String operationName; private String operationName;
/** /**
@ -63,6 +66,7 @@ public class OperationInfo extends BaseEntity {
*/ */
@ApiModelProperty(value = "术式信息") @ApiModelProperty(value = "术式信息")
@Excel(name = "术式信息") @Excel(name = "术式信息")
@NotBlank(message = "术式信息不能为空")
private String operationInfo; private String operationInfo;
/** /**

View File

@ -70,12 +70,12 @@ public interface OperationInfoMapper {
int countByDepartmentIdAndOperationName(@Param("departmentId") Long departmentId, @Param("operationName") String operationName); int countByDepartmentIdAndOperationName(@Param("departmentId") Long departmentId, @Param("operationName") String operationName);
/** /**
* 检查所属科室同一手术名称下术式信息是否重复 * 检查除当前记录之外是否存在同名的手术名称
* *
* @param id
* @param departmentId * @param departmentId
* @param operationName * @param operationName
* @param operationInfo
* @return * @return
*/ */
int countByDepartmentIdAndOperationInfo(@Param("departmentId") Long departmentId, @Param("operationName") String operationName, @Param("operationInfo") String operationInfo); int countByOperationNameExcludingId(@Param("id") Long id, @Param("departmentId") Long departmentId, @Param("operationName") String operationName);
} }

View File

@ -88,7 +88,7 @@ public interface ServicePackageMapper {
List<ServicePackageContentVO> selectServicePackageVOListById(Long id); List<ServicePackageContentVO> selectServicePackageVOListById(Long id);
/** /**
* 判断所属科室下 * 判断所属科室下服务包名称是否存在
* *
* @param departmentId * @param departmentId
* @param packageName * @param packageName
@ -104,4 +104,14 @@ public interface ServicePackageMapper {
* @return * @return
*/ */
int editReleaseStatus(@Param("id") Long id, @Param("whetherRelease") Integer whetherRelease); int editReleaseStatus(@Param("id") Long id, @Param("whetherRelease") Integer whetherRelease);
/**
* 检查除当前记录之外是否存在同名的服务包名称
*
* @param id
* @param departmentId
* @param packageName
* @return
*/
int countByPackageNameExcludingId(@Param("id") Long id, @Param("departmentId") Long departmentId, @Param("packageName") String packageName);
} }

View File

@ -163,4 +163,24 @@ public interface ServiceWayContentMapper {
* @return * @return
*/ */
int countByServiceFrequencyDTO(ServiceFrequencyDTO serviceFrequencyDTO); 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 id
* @param serviceContentId
* @param serviceWayContentEditDTO
* @return
*/
int countByServiceFrequencyExcludingId(@Param("id") Long id, @Param("serviceContentId") Long serviceContentId, @Param("serviceWayContentEditDTO") ServiceWayContentEditDTO serviceWayContentEditDTO);
} }

View File

@ -112,17 +112,20 @@ public interface TextMessageMapper {
*/ */
int updateTextMessageSuitTask(@Param("task") TextMessageSuitTask task); int updateTextMessageSuitTask(@Param("task") TextMessageSuitTask task);
/**
* 根据textMessageId查询适用任务类型id
*
* @param textMessageId
* @return
*/
List<TextMessageSuitTask> selectTextMessageSuitTask(Long textMessageId);
/** /**
* 根据id删除之前的适用任务类型 * 根据id删除之前的适用任务类型
*
* @param id * @param id
*/ */
void deleteTextMessageSuitTask(Long id); void deleteTextMessageSuitTask(Long id);
/**
* 检查除当前记录之外是否存在同名的短信模板名称
*
* @param id
* @param departmentId
* @param textMessageName
* @return
*/
int countByTextMessageNameExcludingId(@Param("id") Long id, @Param("departmentId") Long departmentId, @Param("textMessageName") String textMessageName);
} }

View File

@ -114,8 +114,18 @@ public interface WechatTemplateMapper {
/** /**
* 根据id删除之前存储的适用模板任务类型 * 根据id删除之前存储的适用模板任务类型
*
* @param id * @param id
*/ */
void deleteWechatTemplateSuitTaskById(Long id); void deleteWechatTemplateSuitTaskById(Long id);
/**
* 检查除当前记录之外是否存在同名的微信模板名称
*
* @param id
* @param departmentId
* @param wechatTemplateName
* @return
*/
int countByWechatTemplateNameExcludingId(@Param("id") Long id, @Param("departmentId") Long departmentId, @Param("wechatTemplateName") String wechatTemplateName);
} }

View File

@ -55,24 +55,11 @@ public class OperationInfoServiceImpl implements IOperationInfoService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int insertOperationInfo(OperationInfo operationInfo) { public int insertOperationInfo(OperationInfo operationInfo) {
// 检查手术名称是否为空
if (StringUtils.isEmpty(operationInfo.getOperationName())) {
throw new ServiceException("手术名称不能为空");
}
// 检查手术信息是否为空
if (StringUtils.isEmpty(operationInfo.getOperationInfo())) {
throw new ServiceException("术式信息不能为空");
}
// 检查手术名称是否已存在 // 检查手术名称是否已存在
int existingNameCount = operationInfoMapper.countByDepartmentIdAndOperationName(operationInfo.getDepartmentId(), operationInfo.getOperationName()); int existingNameCount = operationInfoMapper.countByDepartmentIdAndOperationName(operationInfo.getDepartmentId(), operationInfo.getOperationName());
if (existingNameCount > 0) { if (existingNameCount > 0) {
throw new ServiceException("手术名称已存在"); throw new ServiceException("手术名称已存在");
} }
// 检查在所属科室同一手术名称下术式信息是否已存在
int existingInfoCount = operationInfoMapper.countByDepartmentIdAndOperationInfo(operationInfo.getDepartmentId(), operationInfo.getOperationName(), operationInfo.getOperationInfo());
if (existingInfoCount > 0) {
throw new ServiceException("术式信息已存在");
}
// 设置创建人创建时间 // 设置创建人创建时间
operationInfo.setCreateBy(SecurityUtils.getUsername()); operationInfo.setCreateBy(SecurityUtils.getUsername());
operationInfo.setCreateTime(DateUtils.getNowDate()); operationInfo.setCreateTime(DateUtils.getNowDate());
@ -88,14 +75,10 @@ public class OperationInfoServiceImpl implements IOperationInfoService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int updateOperationInfo(OperationInfo operationInfo) { public int updateOperationInfo(OperationInfo operationInfo) {
// 检查手术信息是否为空 // 检查除当前记录之外是否存在同名的手术名称
if (StringUtils.isEmpty(operationInfo.getOperationInfo())) { if (!operationInfo.getOperationName().equals(operationInfoMapper.selectOperationInfoById(operationInfo.getId()))
throw new ServiceException("术式信息不能为空"); && operationInfoMapper.countByOperationNameExcludingId(operationInfo.getId(), operationInfo.getDepartmentId(), operationInfo.getOperationName()) > 0) {
} throw new ServiceException("手术名称已存在");
// 检查在所属科室同一手术名称下术式信息是否已存在
int existingInfoCount = operationInfoMapper.countByDepartmentIdAndOperationInfo(operationInfo.getDepartmentId(), operationInfo.getOperationName(), operationInfo.getOperationInfo());
if (existingInfoCount > 0) {
throw new ServiceException("术式信息已存在");
} }
// 设置修改人修改时间 // 设置修改人修改时间
operationInfo.setUpdateBy(SecurityUtils.getUsername()); operationInfo.setUpdateBy(SecurityUtils.getUsername());

View File

@ -84,9 +84,9 @@ public class ScriptInfoServiceImpl implements IScriptInfoService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int updateScriptInfo(ScriptInfo scriptInfo) { public int updateScriptInfo(ScriptInfo scriptInfo) {
// 检查除当前记录之外是否存在同名的话术名称 // 检查除当前记录之外是否存在同名的话术名称
if (!scriptInfo.getCommonScriptName().equals(scriptInfoMapper.selectScriptInfoById(scriptInfo.getId())) if (!scriptInfo.getCommonScriptName().equals(scriptInfoMapper.selectScriptInfoById(scriptInfo.getId()).getCommonScriptName())
&& scriptInfoMapper.countByScriptNameExcludingId(scriptInfo.getCommonScriptName(), scriptInfo.getDepartmentId(), scriptInfo.getId()) > 0) { && scriptInfoMapper.countByScriptNameExcludingId(scriptInfo.getCommonScriptName(), scriptInfo.getDepartmentId(), scriptInfo.getId()) > 0) {
// 存在同名的话术名称不能进行更新 // 存在同名的通用话术名称不能进行更新
throw new ServiceException("通用话术名称已存在,请使用其他名称。"); throw new ServiceException("通用话术名称已存在,请使用其他名称。");
} else { } else {
// 不存在同名的话术名称或者名称未改变设置修改人和修改时间 // 不存在同名的话术名称或者名称未改变设置修改人和修改时间

View File

@ -83,15 +83,17 @@ public class ServicePackageServiceImpl implements IServicePackageService {
if (existNameCount > 0) { if (existNameCount > 0) {
throw new ServiceException("当前科室下服务包名称已存在"); throw new ServiceException("当前科室下服务包名称已存在");
} }
String username = SecurityUtils.getUsername();
Date nowDate = DateUtils.getNowDate();
// 初始化ServicePackage将servicePackageAddDTO赋值给ServicePackage新增服务包 // 初始化ServicePackage将servicePackageAddDTO赋值给ServicePackage新增服务包
ServicePackage servicePackage = new ServicePackage(); ServicePackage servicePackage = new ServicePackage();
BeanUtils.copyProperties(servicePackageAddDTO, servicePackage); BeanUtils.copyProperties(servicePackageAddDTO, servicePackage);
servicePackage.setCreateBy(username);
servicePackage.setCreateTime(nowDate);
if (servicePackageMapper.insertServicePackage(servicePackage) <= 0) { if (servicePackageMapper.insertServicePackage(servicePackage) <= 0) {
throw new ServiceException("新增服务包失败"); throw new ServiceException("新增服务包失败");
} }
// 新增服务内容 // 新增服务内容
String username = SecurityUtils.getUsername();
Date nowDate = DateUtils.getNowDate();
for (ServicePackageContentVO vo : servicePackageAddDTO.getVoList()) { for (ServicePackageContentVO vo : servicePackageAddDTO.getVoList()) {
Long serviceWayId = createServiceWay(servicePackage, vo, username, nowDate); Long serviceWayId = createServiceWay(servicePackage, vo, username, nowDate);
Long serviceContentId = createServiceContent(servicePackage, vo, serviceWayId, username, nowDate); Long serviceContentId = createServiceContent(servicePackage, vo, serviceWayId, username, nowDate);
@ -109,14 +111,18 @@ public class ServicePackageServiceImpl implements IServicePackageService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int updateServicePackage(ServicePackageAddDTO servicePackageAddDTO) { public int updateServicePackage(ServicePackageAddDTO servicePackageAddDTO) {
// 判断所属科室下服务包名称是否存在 // 检查除当前记录之外是否存在同名的服务包名称
int existNameCount = servicePackageMapper.existNameCount(servicePackageAddDTO.getDepartmentId(), servicePackageAddDTO.getPackageName()); if (!servicePackageAddDTO.getPackageName().equals(servicePackageMapper.selectServicePackagesById(servicePackageAddDTO.getId()))
if (existNameCount > 0) { && servicePackageMapper.countByPackageNameExcludingId(servicePackageAddDTO.getId(), servicePackageAddDTO.getDepartmentId(), servicePackageAddDTO.getPackageName()) > 0) {
throw new ServiceException("当前科室下服务包名称已存在"); throw new ServiceException("当前科室下服务包名称已存在");
} }
String username = SecurityUtils.getUsername();
Date nowDate = DateUtils.getNowDate();
// 初始化ServicePackage将servicePackageAddDTO赋值给ServicePackage更新服务包 // 初始化ServicePackage将servicePackageAddDTO赋值给ServicePackage更新服务包
ServicePackage servicePackage = new ServicePackage(); ServicePackage servicePackage = new ServicePackage();
BeanUtils.copyProperties(servicePackageAddDTO, servicePackage); BeanUtils.copyProperties(servicePackageAddDTO, servicePackage);
servicePackage.setCreateBy(username);
servicePackage.setCreateTime(nowDate);
if (servicePackageMapper.updateServicePackage(servicePackage) <= 0) { if (servicePackageMapper.updateServicePackage(servicePackage) <= 0) {
throw new ServiceException("修改服务包失败"); throw new ServiceException("修改服务包失败");
} }
@ -125,8 +131,6 @@ public class ServicePackageServiceImpl implements IServicePackageService {
throw new ServiceException("删除服务包内容失败"); throw new ServiceException("删除服务包内容失败");
} }
// 新增服务内容 // 新增服务内容
String username = SecurityUtils.getUsername();
Date nowDate = DateUtils.getNowDate();
for (ServicePackageContentVO vo : servicePackageAddDTO.getVoList()) { for (ServicePackageContentVO vo : servicePackageAddDTO.getVoList()) {
Long serviceWayId = createServiceWay(servicePackage, vo, username, nowDate); Long serviceWayId = createServiceWay(servicePackage, vo, username, nowDate);
Long serviceContentId = createServiceContent(servicePackage, vo, serviceWayId, username, nowDate); Long serviceContentId = createServiceContent(servicePackage, vo, serviceWayId, username, nowDate);

View File

@ -131,36 +131,16 @@ public class ServiceWayContentServiceImpl implements IServiceWayContentService {
*/ */
@Override @Override
public int updateServiceWayContent(ServiceWayContentEditDTO serviceWayContentEditDTO) { public int updateServiceWayContent(ServiceWayContentEditDTO serviceWayContentEditDTO) {
// 判断服务内容在服务内容表中是否存在 // // 判断服务内容在服务内容表中是否存在
ServiceWayContentVO serviceWayContentVO = serviceWayContentMapper.countByWayIdAndContent(serviceWayContentEditDTO.getServiceWayId(), serviceWayContentEditDTO.getServiceContent()); // ServiceWayContentVO serviceWayContentVO = serviceWayContentMapper.countByWayIdAndContent(serviceWayContentEditDTO.getServiceWayId(), serviceWayContentEditDTO.getServiceContent());
String username = SecurityUtils.getUsername(); String username = SecurityUtils.getUsername();
Date date = DateUtils.getNowDate(); Date date = DateUtils.getNowDate();
ServiceWayContent serviceFrequency = new ServiceWayContent(); ServiceWayContent serviceFrequency = new ServiceWayContent();
// 如果服务内容在服务内容表中存在 // 检查除当前记录之外是否存在同名的服务内容
if (ObjectUtils.isNotEmpty(serviceWayContentVO)) { if (!serviceWayContentEditDTO.getServiceContent().equals(serviceWayContentMapper.selectServiceWayContentById(serviceWayContentEditDTO.getServiceContentId()))
// 判断服务频次是否在服务频次表中是否存在 && serviceWayContentMapper.countByContentExcludingId(serviceWayContentEditDTO.getServiceContentId(), serviceWayContentEditDTO.getServiceWayId(), serviceWayContentEditDTO.getServiceContent()) > 0) {
ServiceFrequencyDTO serviceFrequencyDTO = new ServiceFrequencyDTO(); throw new ServiceException("服务内容已存在");
BeanUtils.copyProperties(serviceWayContentEditDTO, serviceFrequencyDTO);
serviceFrequencyDTO.setServiceContentId(serviceWayContentVO.getId());
// 如果当前服务内容下服务频次已存在
if (serviceWayContentMapper.countByServiceFrequencyDTO(serviceFrequencyDTO) > 0) {
throw new ServiceException("当前服务内容下服务频次已存在");
} }
// 如果当前服务内容下服务频次不存在更新服务频次
serviceFrequency.setId(serviceWayContentEditDTO.getId());
serviceFrequency.setServiceContentId(serviceWayContentVO.getId());
serviceFrequency.setServiceFrequencyType(serviceWayContentEditDTO.getServiceFrequencyType());
serviceFrequency.setServiceFrequencyText(serviceWayContentEditDTO.getServiceFrequencyText());
serviceFrequency.setServiceFrequencyStart(serviceWayContentEditDTO.getServiceFrequencyStart());
serviceFrequency.setServiceFrequencyEnd(serviceWayContentEditDTO.getServiceFrequencyEnd());
serviceFrequency.setUpdateBy(username);
serviceFrequency.setUpdateTime(date);
if (serviceWayContentMapper.updateServiceWayContent(serviceFrequency) <= 0) {
throw new ServiceException("更新服务频次失败");
}
} else {
// 如果服务内容在服务内容表不存在更新服务内容更新服务频次
// 更新服务内容
ServiceWayContent serviceContent = new ServiceWayContent(); ServiceWayContent serviceContent = new ServiceWayContent();
serviceContent.setId(serviceWayContentEditDTO.getServiceContentId()); serviceContent.setId(serviceWayContentEditDTO.getServiceContentId());
serviceContent.setServiceWayId(serviceWayContentEditDTO.getServiceWayId()); serviceContent.setServiceWayId(serviceWayContentEditDTO.getServiceWayId());
@ -168,11 +148,16 @@ public class ServiceWayContentServiceImpl implements IServiceWayContentService {
serviceContent.setUpdateBy(username); serviceContent.setUpdateBy(username);
serviceContent.setUpdateTime(date); serviceContent.setUpdateTime(date);
if (serviceWayContentMapper.updateServiceWayContent(serviceContent) <= 0) { if (serviceWayContentMapper.updateServiceWayContent(serviceContent) <= 0) {
throw new ServiceException("更新服务内容失败"); throw new ServiceException("修改服务内容失败");
} }
// 修改服务频次 // 检查除当前记录之外是否存在相同的服务频次
if (!serviceWayContentEditDTO.equals(serviceWayContentMapper.selectServiceWayContentById(serviceWayContentEditDTO.getId()))
&& serviceWayContentMapper.countByServiceFrequencyExcludingId(serviceWayContentEditDTO.getId(), serviceWayContentEditDTO.getServiceContentId(), serviceWayContentEditDTO) > 0) {
throw new ServiceException("服务频次已存在");
}
// 如果当前服务内容下服务频次不存在更新服务频次
serviceFrequency.setId(serviceWayContentEditDTO.getId()); serviceFrequency.setId(serviceWayContentEditDTO.getId());
serviceFrequency.setServiceContentId(serviceContent.getId()); serviceFrequency.setServiceContentId(serviceWayContentEditDTO.getServiceContentId());
serviceFrequency.setServiceFrequencyType(serviceWayContentEditDTO.getServiceFrequencyType()); serviceFrequency.setServiceFrequencyType(serviceWayContentEditDTO.getServiceFrequencyType());
serviceFrequency.setServiceFrequencyText(serviceWayContentEditDTO.getServiceFrequencyText()); serviceFrequency.setServiceFrequencyText(serviceWayContentEditDTO.getServiceFrequencyText());
serviceFrequency.setServiceFrequencyStart(serviceWayContentEditDTO.getServiceFrequencyStart()); serviceFrequency.setServiceFrequencyStart(serviceWayContentEditDTO.getServiceFrequencyStart());
@ -180,9 +165,56 @@ public class ServiceWayContentServiceImpl implements IServiceWayContentService {
serviceFrequency.setUpdateBy(username); serviceFrequency.setUpdateBy(username);
serviceFrequency.setUpdateTime(date); serviceFrequency.setUpdateTime(date);
if (serviceWayContentMapper.updateServiceWayContent(serviceFrequency) <= 0) { if (serviceWayContentMapper.updateServiceWayContent(serviceFrequency) <= 0) {
throw new ServiceException("更新服务频次失败"); throw new ServiceException("修改服务频次失败");
}
} }
// if (ObjectUtils.isNotEmpty(serviceWayContentVO)) {
// // 判断服务频次是否在服务频次表中是否存在
// ServiceFrequencyDTO serviceFrequencyDTO = new ServiceFrequencyDTO();
// BeanUtils.copyProperties(serviceWayContentEditDTO, serviceFrequencyDTO);
// serviceFrequencyDTO.setServiceContentId(serviceWayContentVO.getId());
// // 如果当前服务内容下服务频次已存在
// if (serviceWayContentMapper.countByServiceFrequencyDTO(serviceFrequencyDTO) > 0) {
// throw new ServiceException("当前服务内容下服务频次已存在");
// }
// // 如果当前服务内容下服务频次不存在更新服务频次
// serviceFrequency.setId(serviceWayContentEditDTO.getId());
// serviceFrequency.setServiceContentId(serviceWayContentVO.getId());
// serviceFrequency.setServiceFrequencyType(serviceWayContentEditDTO.getServiceFrequencyType());
// serviceFrequency.setServiceFrequencyText(serviceWayContentEditDTO.getServiceFrequencyText());
// serviceFrequency.setServiceFrequencyStart(serviceWayContentEditDTO.getServiceFrequencyStart());
// serviceFrequency.setServiceFrequencyEnd(serviceWayContentEditDTO.getServiceFrequencyEnd());
// serviceFrequency.setUpdateBy(username);
// serviceFrequency.setUpdateTime(date);
// if (serviceWayContentMapper.updateServiceWayContent(serviceFrequency) <= 0) {
// throw new ServiceException("修改服务频次失败");
// }
// } else {
// // 如果服务内容在服务内容表不存在更新服务内容更新服务频次
// // 修改服务内容
// ServiceWayContent serviceContent = new ServiceWayContent();
// serviceContent.setId(serviceWayContentEditDTO.getServiceContentId());
// serviceContent.setServiceWayId(serviceWayContentEditDTO.getServiceWayId());
// serviceContent.setServiceContent(serviceWayContentEditDTO.getServiceContent());
// serviceContent.setUpdateBy(username);
// serviceContent.setUpdateTime(date);
// if (serviceWayContentMapper.updateServiceWayContent(serviceContent) <= 0) {
// throw new ServiceException("修改服务内容失败");
// }
// // 修改服务频次
// serviceFrequency.setId(serviceWayContentEditDTO.getId());
// serviceFrequency.setServiceContentId(serviceContent.getId());
// serviceFrequency.setServiceFrequencyType(serviceWayContentEditDTO.getServiceFrequencyType());
// serviceFrequency.setServiceFrequencyText(serviceWayContentEditDTO.getServiceFrequencyText());
// serviceFrequency.setServiceFrequencyStart(serviceWayContentEditDTO.getServiceFrequencyStart());
// serviceFrequency.setServiceFrequencyEnd(serviceWayContentEditDTO.getServiceFrequencyEnd());
// serviceFrequency.setUpdateBy(username);
// serviceFrequency.setUpdateTime(date);
// if (serviceWayContentMapper.updateServiceWayContent(serviceFrequency) <= 0) {
// throw new ServiceException("修改服务频次失败");
// }
// }
return 1; return 1;
} }

View File

@ -7,15 +7,12 @@ import com.xinelu.common.utils.SecurityUtils;
import com.xinelu.common.utils.bean.BeanUtils; import com.xinelu.common.utils.bean.BeanUtils;
import com.xinelu.manage.domain.textmessage.TextMessage; import com.xinelu.manage.domain.textmessage.TextMessage;
import com.xinelu.manage.domain.textmessagesuittask.TextMessageSuitTask; import com.xinelu.manage.domain.textmessagesuittask.TextMessageSuitTask;
import com.xinelu.manage.domain.wechattemplatesuittask.WechatTemplateSuitTask;
import com.xinelu.manage.dto.textmessage.TextMessageDTO; import com.xinelu.manage.dto.textmessage.TextMessageDTO;
import com.xinelu.manage.dto.textmessage.TextMessageTaskDTO; import com.xinelu.manage.dto.textmessage.TextMessageTaskDTO;
import com.xinelu.manage.mapper.textmessage.TextMessageMapper; import com.xinelu.manage.mapper.textmessage.TextMessageMapper;
import com.xinelu.manage.service.textmessage.ITextMessageService; import com.xinelu.manage.service.textmessage.ITextMessageService;
import com.xinelu.manage.vo.textmessage.TextMessageTaskVO; import com.xinelu.manage.vo.textmessage.TextMessageTaskVO;
import com.xinelu.manage.vo.textmessage.TextMessageVO; import com.xinelu.manage.vo.textmessage.TextMessageVO;
import com.xinelu.manage.vo.wechattemplate.WechatTemplateTaskVO;
import com.xinelu.manage.vo.wechattemplate.WechatTemplateVO;
import com.xinelu.system.mapper.SysDictDataMapper; import com.xinelu.system.mapper.SysDictDataMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -161,8 +158,9 @@ public class TextMessageServiceImpl implements ITextMessageService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int updateTextMessage(TextMessageTaskDTO textMessageTaskDTO) { public int updateTextMessage(TextMessageTaskDTO textMessageTaskDTO) {
// 检查短信模板名称是否已存在 // 检查除当前记录之外是否存在同名的短信模板名称
if (textMessageMapper.countByTextMessageTaskDTO(textMessageTaskDTO) > 0) { if (!textMessageTaskDTO.getTextMessageName().equals(textMessageMapper.selectTextMessageById(textMessageTaskDTO.getId())) &&
textMessageMapper.countByTextMessageNameExcludingId(textMessageTaskDTO.getId(), textMessageTaskDTO.getDepartmentId(), textMessageTaskDTO.getTextMessageName()) > 0) {
throw new ServiceException("短信模板名称已存在"); throw new ServiceException("短信模板名称已存在");
} }

View File

@ -147,11 +147,11 @@ public class WechatTemplateServiceImpl implements IWechatTemplateService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int updateWechatTemplate(WechatTemplateTaskDTO wechatTemplateTaskDTO) { public int updateWechatTemplate(WechatTemplateTaskDTO wechatTemplateTaskDTO) {
// 检查微信模板名称是否已存在 // 检查除当前记录之外是否存在同名的微信模板名称
if (wechatTemplateMapper.countByWechatTemplateTaskDTO(wechatTemplateTaskDTO) > 0) { if (!wechatTemplateTaskDTO.getWechatTemplateName().equals(wechatTemplateMapper.selectWechatTemplateById(wechatTemplateTaskDTO.getId())) &&
wechatTemplateMapper.countByWechatTemplateNameExcludingId(wechatTemplateTaskDTO.getId(), wechatTemplateTaskDTO.getDepartmentId(), wechatTemplateTaskDTO.getWechatTemplateName()) > 0) {
throw new ServiceException("微信模板名称已存在"); throw new ServiceException("微信模板名称已存在");
} }
// 设置修改者和修改时间 // 设置修改者和修改时间
String editUsername = SecurityUtils.getUsername(); String editUsername = SecurityUtils.getUsername();
Date editTime = DateUtils.getNowDate(); Date editTime = DateUtils.getNowDate();

View File

@ -32,6 +32,13 @@ public class ServiceWayContentVO {
@Excel(name = "服务内容") @Excel(name = "服务内容")
private String serviceContent; private String serviceContent;
/**
* 所属服务方式id
*/
@ApiModelProperty(value = "所属服务方式id")
@Excel(name = "所属服务方式id")
private String serviceWayId;
/** /**
* 服务频次列表 * 服务频次列表
*/ */

View File

@ -87,15 +87,14 @@
and operation_name = #{operationName} and operation_name = #{operationName}
</select> </select>
<select id="countByDepartmentIdAndOperationInfo" resultType="java.lang.Integer"> <select id="countByOperationNameExcludingId" resultType="java.lang.Integer">
select count(*) select count(1)
from operation_info from operation_info
where department_id = #{departmentId} where department_id = #{departmentId}
and operation_name = #{operationName} and operation_name = #{operationName}
and operation_info = #{operationInfo} and id != #{id}
</select> </select>
<insert id="insertOperationInfo" parameterType="OperationInfo" useGeneratedKeys="true" <insert id="insertOperationInfo" parameterType="OperationInfo" useGeneratedKeys="true"
keyProperty="id"> keyProperty="id">
insert into operation_info insert into operation_info

View File

@ -196,8 +196,7 @@
</if> </if>
<if test="packageVersion != null and packageVersion != ''"> <if test="packageVersion != null and packageVersion != ''">
and package_version like concat('%', and package_version like concat('%',
#{packageVersion} #{packageVersion},
},
'%' '%'
) )
</if> </if>
@ -237,6 +236,14 @@
and package_name = #{packageName} and package_name = #{packageName}
</select> </select>
<select id="countByPackageNameExcludingId" resultType="java.lang.Integer">
select count(1)
from service_package
where department_id = #{departmentId}
and package_name = #{packageName}
and id != #{id}
</select>
<insert id="insertServicePackage" parameterType="ServicePackage" useGeneratedKeys="true" <insert id="insertServicePackage" parameterType="ServicePackage" useGeneratedKeys="true"
keyProperty="id"> keyProperty="id">
insert into service_package insert into service_package

View File

@ -27,6 +27,7 @@
<resultMap id="ServiceContentAndFrequencyVOMap" type="com.xinelu.manage.vo.servicewaycontent.ServiceWayContentVO"> <resultMap id="ServiceContentAndFrequencyVOMap" type="com.xinelu.manage.vo.servicewaycontent.ServiceWayContentVO">
<id property="id" column="id"/> <id property="id" column="id"/>
<result column="service_content" property="serviceContent"/> <result column="service_content" property="serviceContent"/>
<result column="service_way_id" property="serviceWayId"/>
<collection property="serviceWayFrequencyList" <collection property="serviceWayFrequencyList"
ofType="com.xinelu.manage.vo.servicefrequency.ServiceFrequencyVO"> ofType="com.xinelu.manage.vo.servicefrequency.ServiceFrequencyVO">
<id column="serviceFrequencyId" property="id"/> <id column="serviceFrequencyId" property="id"/>
@ -149,13 +150,14 @@
<select id="selectServiceWayContentListV1" <select id="selectServiceWayContentListV1"
resultMap="ServiceContentAndFrequencyVOMap"> resultMap="ServiceContentAndFrequencyVOMap">
SELECT swc1.id,swc1.service_content, SELECT swc1.id,swc1.service_content,
swc1.service_way_id,
swc2.id AS serviceFrequencyId, swc2.id AS serviceFrequencyId,
swc2.service_frequency_type, swc2.service_frequency_type,
swc2.service_frequency_text, swc2.service_frequency_text,
swc2.service_frequency_start, swc2.service_frequency_start,
swc2.service_frequency_end swc2.service_frequency_end
FROM service_way_content swc1 FROM service_way_content swc1
LEFT JOIN service_way_content swc2 on swc1.id = swc2.service_content_id JOIN service_way_content swc2 on swc1.id = swc2.service_content_id
<where> <where>
swc1.service_type = 'SERVICE_CONTENT' swc1.service_type = 'SERVICE_CONTENT'
and swc2.service_type = 'SERVICE_FREQUENCY' and swc2.service_type = 'SERVICE_FREQUENCY'
@ -191,7 +193,7 @@
</select> </select>
<select id="countByServiceName" resultType="java.lang.Integer" parameterType="java.lang.String"> <select id="countByServiceName" resultType="java.lang.Integer" parameterType="java.lang.String">
select count(*) select count(1)
from service_way_content swc from service_way_content swc
where swc.service_way_name = #{serviceWayName} where swc.service_way_name = #{serviceWayName}
and swc.service_type = 'SERVICE_WRY' and swc.service_type = 'SERVICE_WRY'
@ -313,6 +315,40 @@
</where> </where>
</select> </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 =#{serviceContentId}
and id != #{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>
<insert id="insertServiceWayContent" parameterType="ServiceWayContent" useGeneratedKeys="true" <insert id="insertServiceWayContent" parameterType="ServiceWayContent" useGeneratedKeys="true"
keyProperty="id"> keyProperty="id">
insert into service_way_content insert into service_way_content

View File

@ -139,6 +139,7 @@
</where> </where>
order by tm.create_time DESC ,tmst.create_time DESC order by tm.create_time DESC ,tmst.create_time DESC
</select> </select>
<select id="countByTextMessageTaskDTO" resultType="java.lang.Integer" <select id="countByTextMessageTaskDTO" resultType="java.lang.Integer"
parameterType="com.xinelu.manage.dto.textmessage.TextMessageTaskDTO"> parameterType="com.xinelu.manage.dto.textmessage.TextMessageTaskDTO">
select count(*) select count(*)
@ -146,11 +147,13 @@
where department_id = #{departmentId} where department_id = #{departmentId}
and text_message_name = #{textMessageName} and text_message_name = #{textMessageName}
</select> </select>
<select id="selectTextMessageSuitTask"
resultType="com.xinelu.manage.domain.textmessagesuittask.TextMessageSuitTask"> <select id="countByTextMessageNameExcludingId" resultType="java.lang.Integer">
select * select count(1)
from text_message_suit_task from text_message
where text_message_id = #{textMessageId} where department_id = #{departmentId}
and text_message_name = #{textMessageName}
and id != #{id}
</select> </select>

View File

@ -183,6 +183,14 @@
and wechat_template_name = #{wechatTemplateName} and wechat_template_name = #{wechatTemplateName}
</select> </select>
<select id="countByWechatTemplateNameExcludingId" resultType="java.lang.Integer">
select count(1)
from wechat_template
where department_id = #{departmentId}
and wechat_template_name = #{wechatTemplateName}
and id != #{id}
</select>
<insert id="insertWechatTemplate" parameterType="WechatTemplate" useGeneratedKeys="true" <insert id="insertWechatTemplate" parameterType="WechatTemplate" useGeneratedKeys="true"
keyProperty="id"> keyProperty="id">
insert into wechat_template insert into wechat_template