Commit e3a61cc8 authored by fangxinjiang's avatar fangxinjiang

银行卡号校验接口实现

parent 50fe8278
......@@ -110,7 +110,7 @@ public class TEmpWorkRecordingServiceImpl extends ServiceImpl<TEmpWorkRecordingM
if (Common.isEmpty(res)){
return R.ok(this.updateById(recording));
}else {
return R.failed(checkRepeat(recording));
return R.failed(res);
}
}
......@@ -121,7 +121,7 @@ public class TEmpWorkRecordingServiceImpl extends ServiceImpl<TEmpWorkRecordingM
this.save(recording);
return R.ok();
}else {
return R.failed(checkRepeat(recording));
return R.failed(res);
}
}
......@@ -139,6 +139,9 @@ public class TEmpWorkRecordingServiceImpl extends ServiceImpl<TEmpWorkRecordingM
if (StrUtil.isNotBlank(recording.getWorkJob())){
wrapper.eq(TEmpWorkRecording::getWorkJob,recording.getWorkJob());
}
if (StrUtil.isNotBlank(recording.getId())){
wrapper.ne(TEmpWorkRecording::getId,recording.getId());
}
wrapper.eq(TEmpWorkRecording::getDeleteFlag,CommonConstants.ZERO_STRING);
wrapper.last(CommonConstants.LAST_ONE_SQL);
if (Common.isNotNull(baseMapper.selectOne(wrapper))){
......
package com.yifu.cloud.plus.v1.check.constant;
/**
* @Author fxj
* @Date 2022/6/21
* @Description
* @Version 1.0
*/
public interface ChecksConstants {
String NACOS_CHECK_CONFIG_ERROR="nacos中checks.yaml的配置canCheck未开启!";
String CODE="code";
}
......@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.check.utils;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.yifu.cloud.plus.v1.check.constant.ChecksConstants;
import com.yifu.cloud.plus.v1.check.entity.TCheckBankNo;
import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
import com.yifu.cloud.plus.v1.check.entity.TCheckMobile;
......@@ -39,7 +40,7 @@ public class ChecksUtil {
checkIdCardMethod(checkIdCard);
} else {
checkIdCard.setIsTrue(0);
checkIdCard.setReason("nacos中checks.yaml的配置canCheck未开启!");
checkIdCard.setReason(ChecksConstants.NACOS_CHECK_CONFIG_ERROR);
}
}
/**
......@@ -54,7 +55,7 @@ public class ChecksUtil {
// 1.调用身份信息校验api
return checkMobileMethod(mobiles,checkMobiles);
} else {
return R.failed("nacos中checks.yaml的配置canCheck未开启!");
return R.failed(ChecksConstants.NACOS_CHECK_CONFIG_ERROR);
}
}
/**
......@@ -72,7 +73,7 @@ public class ChecksUtil {
// 1.调用身份信息校验api
return checkBankNoMethod(name,idNum,cardNo,mobile,checkBankNo);
} else {
return R.failed("nacos中checks.yaml的配置canCheck未开启!");
return R.failed(ChecksConstants.NACOS_CHECK_CONFIG_ERROR);
}
}
......@@ -85,7 +86,7 @@ public class ChecksUtil {
// 2.处理返回结果
if (jsonObject != null) {
//响应code码。200000:成功,其他失败
String code = jsonObject.get("code").getAsString();
String code = jsonObject.get(ChecksConstants.CODE).getAsString();
if ("200000".equals(code) && jsonObject.get("data") != null) {
// 调用身份信息校验成功
// 解析结果数据,进行业务处理
......@@ -126,7 +127,7 @@ public class ChecksUtil {
// 2.处理返回结果
if (jsonObject != null) {
//响应code码。200000:成功,其他失败
String code = jsonObject.get("code").getAsString();
String code = jsonObject.get(ChecksConstants.CODE).getAsString();
if ("200000".equals(code) && jsonObject.get("data") != null) {
// 调用身份信息校验成功
// 解析结果数据,进行业务处理
......@@ -164,7 +165,7 @@ public class ChecksUtil {
// 2.处理返回结果
if (jsonObject != null) {
//响应code码。200000:成功,其他失败
String code = jsonObject.get("code").getAsString();
String code = jsonObject.get(ChecksConstants.CODE).getAsString();
if ("200000".equals(code) && jsonObject.get("data") != null) {
// 调用身份信息校验成功
// 解析结果数据,进行业务处理
......
......@@ -256,14 +256,7 @@ public class DictController {
@SysLog("删除字典项")
@DeleteMapping("/item/{id:\\d+}")
public R removeDictItemById(@PathVariable Long id) {
SysDictItem item = sysDictItemService.getOne(Wrappers.<SysDictItem>query().lambda()
.eq(SysDictItem::getParentId,id)
.eq(SysDictItem::getDelFlag,CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(item)){
return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_DICT_ITEM_DELETE_EXIST_CHILD));
}
return R.ok(sysDictItemService.removeDictItem(id));
return sysDictItemService.removeDictItemDiy(id);
}
@SysLog("清除字典缓存")
......
......@@ -31,6 +31,16 @@ import org.apache.ibatis.annotations.Param;
*/
@Mapper
public interface SysDictMapper extends BaseMapper<SysDict> {
/**
* @Author fxj
* @Description 获取字典类型及字典项值的父级字典项名称
* @Date 10:22 2022/6/21
**/
String getParentDicLabelById(@Param("type")String type,@Param("value")String value);
/**
* @Author fxj
* @Description 获取type 对应的子字典项数目
* @Date 10:21 2022/6/21
**/
int selectChildDictItemCount(@Param("parentItemType")String parentItemType);
}
......@@ -20,6 +20,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDictItem;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import java.util.List;
......@@ -54,4 +55,6 @@ public interface SysDictItemService extends IService<SysDictItem> {
List<Tree<Long>> treeMenu(boolean lazy, Long parentId);
IPage<SysDictItem> pageItem(Page page, SysDictItem sysDictItem);
R<Boolean> removeDictItemDiy(Long id);
}
......@@ -50,4 +50,6 @@ public interface SysDictService extends IService<SysDict> {
IPage<SysDict> pageAsso(Page page, SysDict sysDict);
String getParentDicLabelById(String type, String value);
int selectChildDictItemCount(String parentItemType);
}
......@@ -36,6 +36,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.enums.DictTypeEnum;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import lombok.RequiredArgsConstructor;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service;
......@@ -135,6 +136,15 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
return dictItemIPage;
}
@Override
public R<Boolean> removeDictItemDiy(Long id) {
SysDictItem entity = baseMapper.selectById(id);
if (Common.isNotNull(entity) && Common.isNotNull(dictService.selectChildDictItemCount(entity.getType()))){
return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_DICT_ITEM_DELETE_EXIST_CHILD));
}
return R.ok(baseMapper.deleteById(id) > 0);
}
/**
* 构建查询的 wrapper
* @param sysDictItem 查询条件
......
......@@ -98,11 +98,24 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
public IPage<SysDict> pageAsso(Page page, SysDict sysDict) {
return this.page(page,buildQueryWrapper(sysDict));
}
/**
* @Author fxj
* @Description 获取字典类型及字典项值的父级字典项名称
* @Date 10:22 2022/6/21
**/
@Override
public String getParentDicLabelById(String type, String value) {
return baseMapper.getParentDicLabelById(type,value);
}
/**
* @Author fxj
* @Description 获取type 对应的子字典项数目
* @Date 10:21 2022/6/21
**/
@Override
public int selectChildDictItemCount(String parentItemType) {
return baseMapper.selectChildDictItemCount(parentItemType);
}
/**
* 构建查询的 wrapper
......
......@@ -51,4 +51,22 @@
AND i.`value` = a.parent_id
AND a.`value` = #{value}
</select>
<select id="selectChildDictItemCount" resultType="java.lang.Integer">
SELECT
count(1)
FROM
sys_dict_item t
WHERE
t.type IN (
SELECT
a.type
FROM
sys_dict_item a
LEFT JOIN sys_dict c ON c.type = a.type
WHERE
c.parent_item_type = #{parentItemType}
)
</select>
</mapper>
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