修改getliuge中 从数据库查询笔画的方法,现在selectKxHanziByhanziandtype根据汉字和它是姓还是名查询。
This commit is contained in:
parent
28654a1ce7
commit
7991fb716e
@ -132,12 +132,15 @@ public class ApiController extends BaseController {
|
||||
public AjaxResult login(@RequestBody XmLoginDto xmLoginDto) throws Exception {
|
||||
// 生成令牌
|
||||
System.out.println("登录者手机"+xmLoginDto.getPhone());
|
||||
|
||||
//---------------------------20241026 先注释掉短信验证------------------------------------
|
||||
String sms = redisCache.getCacheObject("SMSCODE:" + xmLoginDto.getPhone());
|
||||
System.out.println("SMSCODE:" + xmLoginDto.getPhone());
|
||||
System.out.println("验证码"+sms);
|
||||
if (!sms.equals(xmLoginDto.getSmsCode())) {
|
||||
return AjaxResult.error("短信验证码错误");
|
||||
}
|
||||
//-------------------------------end 验证码--------------------------------
|
||||
SysUser sysUser = sysUserService.selectUserByUserName(xmLoginDto.getPhone());
|
||||
System.out.println(sysUser);
|
||||
if (sysUser == null) {
|
||||
|
||||
@ -104,8 +104,27 @@ public class CalculateController extends BaseController {
|
||||
return AjaxResult.error(500,"请输入正确姓氏");
|
||||
}
|
||||
List<String> nameList = XMUtil.splitChineseCharacters(xmDto.getName());
|
||||
|
||||
|
||||
|
||||
//-------------------------------------20241026修改--------------------------------------------
|
||||
// 获取姓是单还是双, 根据字的属于姓还是M返回不同的笔画
|
||||
String type = nameMap.get("TYPE");
|
||||
String xm = type.substring(0, 1);
|
||||
String t;
|
||||
if(xm.equals("D")){
|
||||
t = "M";
|
||||
}
|
||||
else {
|
||||
t = "X";
|
||||
}
|
||||
|
||||
// 新的笔画列表
|
||||
List<Integer> newbiHuaList = hanziService.selectKxHanziByhanziandtype(oldBihuaList, nameList, t);
|
||||
|
||||
//查找康熙字典的笔画
|
||||
List<Integer> newbiHuaList = hanziService.selectKxHanziByhanzi(oldBihuaList, nameList);
|
||||
// List<Integer> newbiHuaList = hanziService.selectKxHanziByhanzi(oldBihuaList, nameList);
|
||||
//---------------------------------end 20241026修改-----------------------------------------------
|
||||
|
||||
// 获取六格
|
||||
liugeVo = XMUtil.getliuge(newbiHuaList, nameMap);
|
||||
@ -146,8 +165,13 @@ public class CalculateController extends BaseController {
|
||||
|
||||
List<String> nameList = XMUtil.splitChineseCharacters(xmDto.getName());
|
||||
|
||||
List<Integer> newbiHuaList = hanziService.selectKxHanziByhanzi(oldBihuaList, nameList);
|
||||
//-------------------------------------20241026修改--------------------------------------------
|
||||
// 获取姓是单还是双, 根据字的属于姓还是M返回不同的笔画
|
||||
// 新的笔画列表,由于一定是复姓,所以这里 第二个字一定是 X
|
||||
List<Integer> newbiHuaList = hanziService.selectKxHanziByhanziandtype(oldBihuaList, nameList, "X");
|
||||
|
||||
// List<Integer> newbiHuaList = hanziService.selectKxHanziByhanzi(oldBihuaList, nameList);
|
||||
//----------------------------------end 20241026修改------------------------------------
|
||||
int size = oldBihuaList.size();
|
||||
if (size == 3) {
|
||||
nameMap.put("X",xmDto.getName().substring(0,2));
|
||||
|
||||
@ -61,4 +61,6 @@ public interface KxHanziMapper
|
||||
public int deleteKxHanziByIds(Long[] ids);
|
||||
|
||||
KxHanzi selectKxHanziByhanzi(@Param("hanzi") String hanzi);
|
||||
|
||||
KxHanzi selectKxHanziByhanziandtype(@Param("hanzi") String hanzi,@Param("type") String type);
|
||||
}
|
||||
|
||||
@ -60,4 +60,6 @@ public interface IHanziService
|
||||
public int deleteHanziById(Integer id);
|
||||
|
||||
List<Integer> selectKxHanziByhanzi(List<Integer> oldbihuaList,List<String> nameList);
|
||||
|
||||
List<Integer> selectKxHanziByhanziandtype(List<Integer> oldbihuaList,List<String> nameList,String type);
|
||||
}
|
||||
|
||||
@ -106,6 +106,66 @@ public class HanziServiceImpl implements IHanziService {
|
||||
// 优先按照燕氏姓名学查找
|
||||
// System.out.println("查找名字:" + nameList.get(i) );
|
||||
KxHanzi kxHanzi = kxHanziMapper.selectKxHanziByhanzi(nameList.get(i));
|
||||
// System.out.println("yanshi表查到名字:" + nameList.get(i) + "数据库中的笔画:"+kxHanzi.getKxBihua());
|
||||
if (kxHanzi == null || kxHanzi.getKxBihua() == null) {
|
||||
// 普通数据查找笔画
|
||||
Hanzi hanziEntity = hanziMapper.selectKxHanziByhanzi(nameList.get(i));
|
||||
if (hanziEntity != null) {
|
||||
if (hanziEntity.getKxBihua() != 0) {
|
||||
biHuaList.add(hanziEntity.getKxBihua());
|
||||
// System.out.println("查到名字:" + nameList.get(i) + "数据库中的笔画:" + hanziEntity.getKxBihua());
|
||||
} else if (hanziEntity.getFtZongbihua() != 0) {
|
||||
biHuaList.add(hanziEntity.getFtZongbihua());
|
||||
// System.out.println("查到名字:" + nameList.get(i) + "数据库中的笔画:" + hanziEntity.getFtZongbihua());
|
||||
} else if (hanziEntity.getJtZongbihua() != 0) {
|
||||
biHuaList.add(hanziEntity.getJtZongbihua());
|
||||
// System.out.println("查到名字:" + nameList.get(i) + "数据库中的笔画:" + hanziEntity.getJtZongbihua());
|
||||
}
|
||||
} else if (oldbihuaList.get(i) != null) {
|
||||
biHuaList.add(oldbihuaList.get(i));
|
||||
// System.out.println("查到名字:" + nameList.get(i) + "后端数据库无数据,使用前端给出的笔画:" + oldbihuaList.get(i));
|
||||
} else {
|
||||
biHuaList.add(0);
|
||||
}
|
||||
} else {
|
||||
biHuaList.add(kxHanzi.getKxBihua());
|
||||
}
|
||||
}
|
||||
}
|
||||
return biHuaList;
|
||||
}
|
||||
/*
|
||||
* 根据字和他属于X/M返回不同的笔画
|
||||
* */
|
||||
@Override
|
||||
public List<Integer> selectKxHanziByhanziandtype(List<Integer> oldbihuaList, List<String> nameList, String type) {
|
||||
List<Integer> biHuaList = new ArrayList<>();
|
||||
if (nameList != null && nameList.size() > 0) {
|
||||
for (int i = 0; i < nameList.size(); i++) {
|
||||
// 输出前端笔画
|
||||
oldbihuaList.forEach(qianduan_bihua -> {
|
||||
System.out.println(qianduan_bihua);
|
||||
});
|
||||
|
||||
KxHanzi kxHanzi;
|
||||
|
||||
if(i==0){
|
||||
kxHanzi = kxHanziMapper.selectKxHanziByhanziandtype(nameList.get(i), "X");
|
||||
}
|
||||
else if(i==1){
|
||||
kxHanzi = kxHanziMapper.selectKxHanziByhanziandtype(nameList.get(i), type);
|
||||
}
|
||||
else{
|
||||
kxHanzi = kxHanziMapper.selectKxHanziByhanziandtype(nameList.get(i), "M");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 先后端判断查找燕氏姓名学kx_hanzi表,若无相应的笔画,则查找普通汉字表,若若无相应的笔画,则使用前端给出的笔画
|
||||
*/
|
||||
// 优先按照燕氏姓名学查找
|
||||
// System.out.println("查找名字:" + nameList.get(i) );
|
||||
// KxHanzi kxHanzi = kxHanziMapper.selectKxHanziByhanzi(nameList.get(i));
|
||||
// System.out.println("yanshi表查到名字:" + nameList.get(i) + "数据库中的笔画:"+kxHanzi.getKxBihua());
|
||||
if (kxHanzi == null || kxHanzi.getKxBihua() == null) {
|
||||
// 普通数据查找笔画
|
||||
|
||||
@ -34,6 +34,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectKxHanziByhanziandtype" resultMap="KxHanziResult">
|
||||
<include refid="selectKxHanziVo"/>
|
||||
where hanzi = #{hanzi} and type = #{type}
|
||||
-- limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertKxHanzi" parameterType="KxHanzi" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into kx_hanzi
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user