|
|
|
@ -151,116 +151,44 @@ public class BaseServiceImpl implements BaseService { |
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public void insertDefaultLabelSetting(DefaultLabelSettingData inData) { |
|
|
|
//公共参数 |
|
|
|
String labelNo = inData.getLabelNo(); |
|
|
|
String labelType = inData.getLabelType(); |
|
|
|
String subLabelFlag = inData.getSubLabelFlag(); |
|
|
|
String parentLabelNo = inData.getParentLabelNo(); |
|
|
|
String checkFlag = inData.getCheckFlag(); |
|
|
|
//调用存储过程 判断是否可以新增 |
|
|
|
Map<String, Object> checkMap = this.checkInsertDefaultLabelSetting(labelNo, labelType, subLabelFlag, parentLabelNo, checkFlag); |
|
|
|
//判断是否检验成功 |
|
|
|
String resultCode = String.valueOf(checkMap.get("resultCode")); |
|
|
|
if (!"200".equalsIgnoreCase(resultCode)) { |
|
|
|
String msg = String.valueOf(checkMap.get("resultMsg")); |
|
|
|
String objectId = String.valueOf(checkMap.get("objectId")); |
|
|
|
throw new XJException(msg, Integer.parseInt(resultCode), objectId); |
|
|
|
// 统一规范输入数据 |
|
|
|
normalizeDefaultLabelSettingData(inData); |
|
|
|
// 业务校验 |
|
|
|
validateDefaultLabelSettingData(inData); |
|
|
|
// 防重复新增 |
|
|
|
if (baseMapper.countDefaultLabelSetting(inData) > 0) { |
|
|
|
throw new XJException("默认标签配置已存在,不能重复新增!"); |
|
|
|
} |
|
|
|
//首先校验当前的信息是否可以插入 |
|
|
|
baseMapper.insertDefaultLabelSetting(inData); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @description: 检查是否可以插入当前的默认标签配置数据 |
|
|
|
* @author LR |
|
|
|
* @date 2023/1/4 11:53 |
|
|
|
* @version 1.0 |
|
|
|
*/ |
|
|
|
public Map<String, Object> checkInsertDefaultLabelSetting(String labelNo, String labelType, String subLabelFlag, String parentLabelNo, String checkFlag) { |
|
|
|
List<Object> params = new ArrayList<>(); |
|
|
|
params.add(labelNo); |
|
|
|
params.add(labelType); |
|
|
|
params.add(subLabelFlag); |
|
|
|
params.add(parentLabelNo); |
|
|
|
params.add(checkFlag); |
|
|
|
//存储过程 调用存储过程 创建分卷 |
|
|
|
List<Map<String, Object>> resultList = procedureMapper.getProcedureData("checkInsertDefaultLabelSetting", params); |
|
|
|
//返回结果 |
|
|
|
return resultList.get(0); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public void updateDefaultLabelSetting(DefaultLabelSettingData inData) { |
|
|
|
//公共参数 |
|
|
|
String labelNo = inData.getLabelNo(); |
|
|
|
String labelType = inData.getLabelType(); |
|
|
|
String subLabelFlag = inData.getSubLabelFlag(); |
|
|
|
String parentLabelNo = inData.getParentLabelNo(); |
|
|
|
String checkFlag = inData.getCheckFlag(); |
|
|
|
//调用存储过程 判断是否可以新增 |
|
|
|
Map<String, Object> checkMap = this.checkUpdateDefaultLabelSetting(labelNo, labelType, subLabelFlag, parentLabelNo, checkFlag); |
|
|
|
//判断是否检验成功 |
|
|
|
String resultCode = String.valueOf(checkMap.get("resultCode")); |
|
|
|
if (!"200".equalsIgnoreCase(resultCode)) { |
|
|
|
String msg = String.valueOf(checkMap.get("resultMsg")); |
|
|
|
String objectId = String.valueOf(checkMap.get("objectId")); |
|
|
|
throw new XJException(msg, Integer.parseInt(resultCode), objectId); |
|
|
|
// 统一规范输入数据 |
|
|
|
normalizeDefaultLabelSettingData(inData); |
|
|
|
// 业务校验 |
|
|
|
validateDefaultLabelSettingData(inData); |
|
|
|
// 执行更新并校验是否更新成功 |
|
|
|
int effectRows = baseMapper.updateDefaultLabelSetting(inData); |
|
|
|
if (effectRows <= 0) { |
|
|
|
throw new XJException("未找到可修改的默认标签配置,请刷新后重试!"); |
|
|
|
} |
|
|
|
baseMapper.updateDefaultLabelSetting(inData); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @description: 调用存储过程 判断是否可以修改默认标签配置信息 |
|
|
|
* @author LR |
|
|
|
* @date 2023/1/4 13:03 |
|
|
|
* @version 1.0 |
|
|
|
*/ |
|
|
|
public Map<String, Object> checkUpdateDefaultLabelSetting(String labelNo, String labelType, String subLabelFlag, String parentLabelNo, String checkFlag) { |
|
|
|
List<Object> params = new ArrayList<>(); |
|
|
|
params.add(labelNo); |
|
|
|
params.add(labelType); |
|
|
|
params.add(subLabelFlag); |
|
|
|
params.add(parentLabelNo); |
|
|
|
params.add(checkFlag); |
|
|
|
//存储过程 调用存储过程 创建分卷 |
|
|
|
List<Map<String, Object>> resultList = procedureMapper.getProcedureData("checkUpdateDefaultLabelSetting", params); |
|
|
|
//返回结果 |
|
|
|
return resultList.get(0); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public void deleteDefaultLabelSetting(DefaultLabelSettingData inData) { |
|
|
|
//公共参数 |
|
|
|
String labelNo = inData.getLabelNo(); |
|
|
|
String subLabelFlag = inData.getSubLabelFlag(); |
|
|
|
//调用存储过程 判断是否可以新增 |
|
|
|
Map<String, Object> checkMap = this.checkDeleteDefaultLabelSetting(labelNo, subLabelFlag); |
|
|
|
//判断是否检验成功 |
|
|
|
String resultCode = String.valueOf(checkMap.get("resultCode")); |
|
|
|
if (!"200".equalsIgnoreCase(resultCode)) { |
|
|
|
String msg = String.valueOf(checkMap.get("resultMsg")); |
|
|
|
String objectId = String.valueOf(checkMap.get("objectId")); |
|
|
|
throw new XJException(msg, Integer.parseInt(resultCode), objectId); |
|
|
|
// 统一规范输入数据 |
|
|
|
normalizeDefaultLabelSettingData(inData); |
|
|
|
if (isBlank(inData.getLabelNo())) { |
|
|
|
throw new XJException("标签编号不能为空!"); |
|
|
|
} |
|
|
|
baseMapper.deleteDefaultLabelSetting(inData); |
|
|
|
// 执行删除并校验是否删除成功 |
|
|
|
int effectRows = baseMapper.deleteDefaultLabelSetting(inData); |
|
|
|
if (effectRows <= 0) { |
|
|
|
throw new XJException("未找到可删除的默认标签配置,请刷新后重试!"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @description: 调用存储过程 判断是否可以删除 |
|
|
|
* @author LR |
|
|
|
* @date 2023/1/4 13:05 |
|
|
|
* @version 1.0 |
|
|
|
*/ |
|
|
|
public Map<String, Object> checkDeleteDefaultLabelSetting(String labelNo, String subLabelFlag) { |
|
|
|
List<Object> params = new ArrayList<>(); |
|
|
|
params.add(labelNo); |
|
|
|
params.add(subLabelFlag); |
|
|
|
//存储过程 调用存储过程 创建分卷 |
|
|
|
List<Map<String, Object>> resultList = procedureMapper.getProcedureData("checkDeleteDefaultLabelSetting", params); |
|
|
|
//返回结果 |
|
|
|
return resultList.get(0); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@ -278,132 +206,170 @@ public class BaseServiceImpl implements BaseService { |
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public void insertCustomerLabelSetting(CustomerLabelSettingData inData) { |
|
|
|
//公共参数 |
|
|
|
String site = inData.getSite(); |
|
|
|
String userId = inData.getUsername(); |
|
|
|
String customerId = inData.getCustomerId(); |
|
|
|
String labelNo = inData.getLabelNo(); |
|
|
|
String labelType = inData.getLabelType(); |
|
|
|
String subLabelFlag = inData.getSubLabelFlag(); |
|
|
|
String parentLabelNo = inData.getParentLabelNo(); |
|
|
|
String checkFlag = inData.getCheckFlag(); |
|
|
|
//调用存储过程 判断是否可以新增 |
|
|
|
Map<String, Object> checkMap = this.checkInsertCustomerLabelSetting(site, userId, customerId, labelNo, labelType, subLabelFlag, parentLabelNo, checkFlag); |
|
|
|
//判断是否检验成功 |
|
|
|
String resultCode = String.valueOf(checkMap.get("resultCode")); |
|
|
|
if (!"200".equalsIgnoreCase(resultCode)) { |
|
|
|
String msg = String.valueOf(checkMap.get("resultMsg")); |
|
|
|
String objectId = String.valueOf(checkMap.get("objectId")); |
|
|
|
throw new XJException(msg, Integer.parseInt(resultCode), objectId); |
|
|
|
// 统一规范输入数据 |
|
|
|
normalizeCustomerLabelSettingData(inData); |
|
|
|
// 业务校验 |
|
|
|
validateCustomerLabelSettingData(inData); |
|
|
|
// 防重复新增 |
|
|
|
if (baseMapper.countCustomerLabelSetting(inData) > 0) { |
|
|
|
throw new XJException("客户标签配置已存在,不能重复新增!"); |
|
|
|
} |
|
|
|
baseMapper.insertCustomerLabelSetting(inData); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @description: 调用存储过程 执行查询是否可以插入客制化标签的配置信息 |
|
|
|
* @author LR |
|
|
|
* @date 2023/1/5 11:45 |
|
|
|
* @version 1.0 |
|
|
|
*/ |
|
|
|
public Map<String, Object> checkInsertCustomerLabelSetting(String site, String userId, String customerId, String labelNo, String labelType, |
|
|
|
String subLabelFlag, String parentLabelNo, String checkFlag) { |
|
|
|
List<Object> params = new ArrayList<>(); |
|
|
|
params.add(site); |
|
|
|
params.add(userId); |
|
|
|
params.add(customerId); |
|
|
|
params.add(labelNo); |
|
|
|
params.add(labelType); |
|
|
|
params.add(subLabelFlag); |
|
|
|
params.add(parentLabelNo); |
|
|
|
params.add(checkFlag); |
|
|
|
//存储过程 调用存储过程 创建分卷 |
|
|
|
List<Map<String, Object>> resultList = procedureMapper.getProcedureData("checkInsertCustomerLabelSetting", params); |
|
|
|
//返回结果 |
|
|
|
return resultList.get(0); |
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public void updateCustomerLabelSetting(CustomerLabelSettingData inData) { |
|
|
|
// 统一规范输入数据 |
|
|
|
normalizeCustomerLabelSettingData(inData); |
|
|
|
// 业务校验 |
|
|
|
validateCustomerLabelSettingData(inData); |
|
|
|
// 执行更新并校验是否更新成功 |
|
|
|
int effectRows = baseMapper.updateCustomerLabelSetting(inData); |
|
|
|
if (effectRows <= 0) { |
|
|
|
throw new XJException("未找到可修改的客户标签配置,请刷新后重试!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public void updateCustomerLabelSetting(CustomerLabelSettingData inData) { |
|
|
|
//公共参数 |
|
|
|
String site = inData.getSite(); |
|
|
|
String customerId = inData.getCustomerId(); |
|
|
|
String labelNo = inData.getLabelNo(); |
|
|
|
String labelType = inData.getLabelType(); |
|
|
|
String subLabelFlag = inData.getSubLabelFlag(); |
|
|
|
String parentLabelNo = inData.getParentLabelNo(); |
|
|
|
String checkFlag = inData.getCheckFlag(); |
|
|
|
//调用存储过程 判断是否可以新增 |
|
|
|
Map<String, Object> checkMap = this.checkUpdateCustomerLabelSetting(site, customerId, labelNo, labelType, subLabelFlag, parentLabelNo, checkFlag); |
|
|
|
//判断是否检验成功 |
|
|
|
String resultCode = String.valueOf(checkMap.get("resultCode")); |
|
|
|
if (!"200".equalsIgnoreCase(resultCode)) { |
|
|
|
String msg = String.valueOf(checkMap.get("resultMsg")); |
|
|
|
String objectId = String.valueOf(checkMap.get("objectId")); |
|
|
|
throw new XJException(msg, Integer.parseInt(resultCode), objectId); |
|
|
|
public void deleteCustomerLabelSetting(CustomerLabelSettingData inData) { |
|
|
|
// 统一规范输入数据 |
|
|
|
normalizeCustomerLabelSettingData(inData); |
|
|
|
if (isBlank(inData.getSite())) { |
|
|
|
throw new XJException("工厂不能为空!"); |
|
|
|
} |
|
|
|
if (isBlank(inData.getCustomerId())) { |
|
|
|
throw new XJException("客户编码不能为空!"); |
|
|
|
} |
|
|
|
if (isBlank(inData.getAddressNo())) { |
|
|
|
throw new XJException("地址编码不能为空!"); |
|
|
|
} |
|
|
|
if (isBlank(inData.getLabelNo())) { |
|
|
|
throw new XJException("标签编号不能为空!"); |
|
|
|
} |
|
|
|
// 执行删除并校验是否删除成功 |
|
|
|
int effectRows = baseMapper.deleteCustomerLabelSetting(inData); |
|
|
|
if (effectRows <= 0) { |
|
|
|
throw new XJException("未找到可删除的客户标签配置,请刷新后重试!"); |
|
|
|
} |
|
|
|
baseMapper.updateCustomerLabelSetting(inData); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @description: 调用存储过程 校验是否可以修改客制化标签的配置信息 |
|
|
|
* @author LR |
|
|
|
* @date 2023/1/5 11:51 |
|
|
|
* @version 1.0 |
|
|
|
* 规范默认标签配置数据 |
|
|
|
*/ |
|
|
|
public Map<String, Object> checkUpdateCustomerLabelSetting(String site, String customerId, String labelNo, String labelType, |
|
|
|
String subLabelFlag, String parentLabelNo, String checkFlag) { |
|
|
|
List<Object> params = new ArrayList<>(); |
|
|
|
params.add(site); |
|
|
|
params.add(customerId); |
|
|
|
params.add(labelNo); |
|
|
|
params.add(labelType); |
|
|
|
params.add(subLabelFlag); |
|
|
|
params.add(parentLabelNo); |
|
|
|
params.add(checkFlag); |
|
|
|
//存储过程 调用存储过程 创建分卷 |
|
|
|
List<Map<String, Object>> resultList = procedureMapper.getProcedureData("checkUpdateCustomerLabelSetting", params); |
|
|
|
//返回结果 |
|
|
|
return resultList.get(0); |
|
|
|
private void normalizeDefaultLabelSettingData(DefaultLabelSettingData inData) { |
|
|
|
inData.setLabelNo(trimUpper(inData.getLabelNo())); |
|
|
|
inData.setLabelType(trimToEmpty(inData.getLabelType())); |
|
|
|
inData.setRemark(trimToEmpty(inData.getRemark())); |
|
|
|
String subLabelFlag = "Y".equalsIgnoreCase(trimToEmpty(inData.getSubLabelFlag())) ? "Y" : "N"; |
|
|
|
inData.setSubLabelFlag(subLabelFlag); |
|
|
|
String parentLabelNo = trimUpper(inData.getParentLabelNo()); |
|
|
|
inData.setParentLabelNo("Y".equals(subLabelFlag) ? parentLabelNo : "*"); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public void deleteCustomerLabelSetting(CustomerLabelSettingData inData) { |
|
|
|
//公共参数 |
|
|
|
String site = inData.getSite(); |
|
|
|
String customerId = inData.getCustomerId(); |
|
|
|
String labelNo = inData.getLabelNo(); |
|
|
|
String subLabelFlag = inData.getSubLabelFlag(); |
|
|
|
/** |
|
|
|
* 校验默认标签配置数据 |
|
|
|
*/ |
|
|
|
private void validateDefaultLabelSettingData(DefaultLabelSettingData inData) { |
|
|
|
if (isBlank(inData.getLabelNo())) { |
|
|
|
throw new XJException("标签编号不能为空!"); |
|
|
|
} |
|
|
|
LabelSettingData labelSetting = baseMapper.getLabelSettingByLabelNo(inData.getLabelNo()); |
|
|
|
if (labelSetting == null) { |
|
|
|
throw new XJException(sysMsgService.getLanguageMsg(SysMsgConstant.OBJECT_ID_200077)); |
|
|
|
} |
|
|
|
if (!isBlank(labelSetting.getLabelType())) { |
|
|
|
inData.setLabelType(trimToEmpty(labelSetting.getLabelType())); |
|
|
|
} |
|
|
|
if (isBlank(inData.getLabelType())) { |
|
|
|
throw new XJException("标签类型不能为空!"); |
|
|
|
} |
|
|
|
if ("Y".equals(inData.getSubLabelFlag())) { |
|
|
|
if (isBlank(inData.getParentLabelNo()) || "*".equals(inData.getParentLabelNo())) { |
|
|
|
throw new XJException("子报表必须维护上级标签编号!"); |
|
|
|
} |
|
|
|
if (inData.getLabelNo().equalsIgnoreCase(inData.getParentLabelNo())) { |
|
|
|
throw new XJException("上级标签编号不能与当前标签编号相同!"); |
|
|
|
} |
|
|
|
LabelSettingData parentLabel = baseMapper.getLabelSettingByLabelNo(inData.getParentLabelNo()); |
|
|
|
if (parentLabel == null) { |
|
|
|
throw new XJException("上级标签编号不存在!"); |
|
|
|
} |
|
|
|
} else { |
|
|
|
inData.setParentLabelNo("*"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//调用存储过程 判断是否可以新增 |
|
|
|
/* Map<String, Object> checkMap = this.checkDeleteCustomerLabelSetting(site, customerId, labelNo, subLabelFlag); |
|
|
|
//判断是否检验成功 |
|
|
|
String resultCode = String.valueOf(checkMap.get("resultCode")); |
|
|
|
if (!"200".equalsIgnoreCase(resultCode)) { |
|
|
|
String msg = String.valueOf(checkMap.get("resultMsg")); |
|
|
|
String objectId = String.valueOf(checkMap.get("objectId")); |
|
|
|
throw new XJException(msg, Integer.parseInt(resultCode), objectId); |
|
|
|
}*/ |
|
|
|
baseMapper.deleteCustomerLabelSetting(inData); |
|
|
|
/** |
|
|
|
* 规范客户标签配置数据 |
|
|
|
*/ |
|
|
|
private void normalizeCustomerLabelSettingData(CustomerLabelSettingData inData) { |
|
|
|
inData.setSite(trimToEmpty(inData.getSite())); |
|
|
|
inData.setUsername(trimToEmpty(inData.getUsername())); |
|
|
|
inData.setCustomerId(trimUpper(inData.getCustomerId())); |
|
|
|
inData.setAddressNo(trimUpper(inData.getAddressNo())); |
|
|
|
inData.setLabelNo(trimUpper(inData.getLabelNo())); |
|
|
|
inData.setLabelType(trimToEmpty(inData.getLabelType())); |
|
|
|
inData.setRemark(trimToEmpty(inData.getRemark())); |
|
|
|
String subLabelFlag = "Y".equalsIgnoreCase(trimToEmpty(inData.getSubLabelFlag())) ? "Y" : "N"; |
|
|
|
inData.setSubLabelFlag(subLabelFlag); |
|
|
|
String parentLabelNo = trimUpper(inData.getParentLabelNo()); |
|
|
|
inData.setParentLabelNo("Y".equals(subLabelFlag) ? parentLabelNo : "*"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @description: 调用存储过程 检验是否可以删除客制化标签的配置信息 |
|
|
|
* @author LR |
|
|
|
* @date 2023/1/5 13:29 |
|
|
|
* @version 1.0 |
|
|
|
* 校验客户标签配置数据 |
|
|
|
*/ |
|
|
|
public Map<String, Object> checkDeleteCustomerLabelSetting(String site, String customerId, String labelNo, String subLabelFlag) { |
|
|
|
List<Object> params = new ArrayList<>(); |
|
|
|
params.add(site); |
|
|
|
params.add(customerId); |
|
|
|
params.add(labelNo); |
|
|
|
params.add(subLabelFlag); |
|
|
|
//存储过程 调用存储过程 创建分卷 |
|
|
|
List<Map<String, Object>> resultList = procedureMapper.getProcedureData("checkDeleteCustomerLabelSetting", params); |
|
|
|
//返回结果 |
|
|
|
return resultList.get(0); |
|
|
|
private void validateCustomerLabelSettingData(CustomerLabelSettingData inData) { |
|
|
|
if (isBlank(inData.getSite())) { |
|
|
|
throw new XJException("工厂不能为空!"); |
|
|
|
} |
|
|
|
if (isBlank(inData.getCustomerId())) { |
|
|
|
throw new XJException("客户编码不能为空!"); |
|
|
|
} |
|
|
|
if (isBlank(inData.getAddressNo())) { |
|
|
|
throw new XJException("地址编码不能为空!"); |
|
|
|
} |
|
|
|
if (isBlank(inData.getLabelNo())) { |
|
|
|
throw new XJException("标签编号不能为空!"); |
|
|
|
} |
|
|
|
LabelSettingData labelSetting = baseMapper.getLabelSettingByLabelNo(inData.getLabelNo()); |
|
|
|
if (labelSetting == null) { |
|
|
|
throw new XJException(sysMsgService.getLanguageMsg(SysMsgConstant.OBJECT_ID_200077)); |
|
|
|
} |
|
|
|
if (!isBlank(labelSetting.getLabelType())) { |
|
|
|
inData.setLabelType(trimToEmpty(labelSetting.getLabelType())); |
|
|
|
} |
|
|
|
if (isBlank(inData.getLabelType())) { |
|
|
|
throw new XJException("标签类型不能为空!"); |
|
|
|
} |
|
|
|
if ("Y".equals(inData.getSubLabelFlag())) { |
|
|
|
if (isBlank(inData.getParentLabelNo()) || "*".equals(inData.getParentLabelNo())) { |
|
|
|
throw new XJException("子报表必须维护上级标签编号!"); |
|
|
|
} |
|
|
|
if (inData.getLabelNo().equalsIgnoreCase(inData.getParentLabelNo())) { |
|
|
|
throw new XJException("上级标签编号不能与当前标签编号相同!"); |
|
|
|
} |
|
|
|
LabelSettingData parentLabel = baseMapper.getLabelSettingByLabelNo(inData.getParentLabelNo()); |
|
|
|
if (parentLabel == null) { |
|
|
|
throw new XJException("上级标签编号不存在!"); |
|
|
|
} |
|
|
|
} else { |
|
|
|
inData.setParentLabelNo("*"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private String trimToEmpty(String value) { |
|
|
|
return value == null ? "" : value.trim(); |
|
|
|
} |
|
|
|
|
|
|
|
private String trimUpper(String value) { |
|
|
|
return trimToEmpty(value).toUpperCase(); |
|
|
|
} |
|
|
|
|
|
|
|
private boolean isBlank(String value) { |
|
|
|
return value == null || value.trim().isEmpty(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
|