14291 创建用户时没有输入定位卡,提示定位卡已经存在,无法正常用户

pull/4/head^2
dearlin 2024-02-26 15:38:06 +08:00
parent 918037d593
commit 465e8dc397
8 changed files with 60 additions and 6 deletions

View File

@ -4,9 +4,11 @@ import com.alibaba.fastjson.JSONObject;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.service.system.UsersService;
import com.zcloud.util.Jurisdiction;
import com.zcloud.util.PLSUtil;
import com.zcloud.util.ReturnMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@ -22,6 +24,10 @@ import java.util.List;
@RequestMapping("/deploy/card")
public class UserCardController extends BaseController {
@Autowired
private UsersService usersService;
/**
* @Description:
* @Author: dearLin
@ -61,6 +67,8 @@ public class UserCardController extends BaseController {
JSONObject body = PLSUtil.GeneralPut("/deploy/card", pageData, Jurisdiction.getCORPINFO_ID());
if (body != null) {
returnMap.putAll(body);
if (!"200".equals(body.getString("code"))) return ReturnMap.error(body.getString("msg"));
usersService.editUserCardNoByPid(pageData);
}
return returnMap;
}
@ -117,6 +125,8 @@ public class UserCardController extends BaseController {
ReturnMap returnMap = new ReturnMap();
JSONObject body = PLSUtil.GeneralDelete("/deploy/card/", pageData.getString("DATA_IDS"), Jurisdiction.getCORPINFO_ID());
if (body != null) {
if (!"200".equals(body.getString("code"))) return ReturnMap.error(body.getString("msg"));
returnMap.putAll(body);
}
return returnMap;
@ -138,6 +148,11 @@ public class UserCardController extends BaseController {
if (body != null) {
if (!"200".equals(body.getString("code"))) return ReturnMap.error(body.getString("msg"));
returnMap.putAll(body);
// 人员表里给 对应卡号得人 得 卡移除掉
String[] dataIds = pageData.getString("DATA_IDS").split(",");
pageData.put("USER_IDS", dataIds);
pageData.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
usersService.removeCardNoUser(pageData);
}
return returnMap;
}

View File

@ -1400,7 +1400,7 @@ public class UsersController extends BaseController {
for (PageData lpd : listPd) {
number++;
for (int i = 0; i < 7; i++) {
if (i == 1 || i == 6) {
if (i == 1 || i == 5 || i == 6) {
continue;
}
if (Tools.isEmpty(lpd.get("var" + i))) {
@ -1418,10 +1418,13 @@ public class UsersController extends BaseController {
Pattern patternPhone = Pattern.compile(RegexPatterns.PHONE_REGEX);
Pattern patternRardNo = Pattern.compile(RegexPatterns.VERIFY_CARDNO_REGEX);
Matcher matcher = patternPhone.matcher(lpd.getString("var2"));
Matcher matcherRardNo = patternRardNo.matcher(lpd.getString("var5"));
Matcher matcherRardNo = patternRardNo.matcher(CardNo);
if (Tools.notEmpty(CardNo)) {
// 现在卡号可以为空 不为空得话进入正则
if (!matcherRardNo.matches()) {
errorStr.append("第" + number + "行,");
errorStr.append("定位卡号" + CardNo + "格式不正确,请重新确认数据;\n");
errorStr.append("定位卡号" + CardNo + "格式不正确(非负正整数),请重新确认数据;\n");
}
}
if (!matcher.matches()) {
errorStr.append("第" + number + "行,");

View File

@ -259,4 +259,8 @@ public interface UsersMapper {
List<PageData> selectUserListByUserIds(PageData pd);
PageData getUserByCardNo(PageData pageData);
void removeCardNoUser(PageData pageData);
void editUserCardNoByPid(PageData pageData);
}

View File

@ -305,4 +305,7 @@ public interface UsersService {
*/
PageData getUserByCardNo(PageData pageData);
void removeCardNoUser(PageData pageData);
void editUserCardNoByPid(PageData pageData);
}

View File

@ -284,7 +284,15 @@ public class UsersServiceImpl implements UsersService {
return usersMapper.getUserByCardNo(pageData);
}
@Override
public void removeCardNoUser(PageData pageData) {
usersMapper.removeCardNoUser(pageData);
}
@Override
public void editUserCardNoByPid(PageData pageData) {
usersMapper.editUserCardNoByPid(pageData);
}
@Override
@ -358,6 +366,7 @@ public class UsersServiceImpl implements UsersService {
PageData response = PLSUtil.saveUser(pd);
if ("200".equals(response.getString("code"))) {
pd.put("PLS_ID", response.getString("data"));
if (Tools.isEmpty(pd.getString("CARDNO"))) pd.put("CARDNO",null);
usersMapper.saveUser(pd);
FHLOG.save(Jurisdiction.getUsername(), "新增用户:" + pd.getString("USERNAME"));
return ReturnMap.ok();

View File

@ -470,6 +470,7 @@ public class PLSUtil {
* @Return: void
*/
public static boolean hasCardNumber(PageData user) throws Exception {
if (Tools.isEmpty(user.getString("CARDNO"))) {return true;}
// 根据 定位卡号获取对应的人
String url = BAKEADDR.get(Jurisdiction.getCORPINFO_ID()) + "/deploy/card/peopleDisplay/" + user.getString("CARDNO");
PageData response = sendGetHttpRequest(url, null, getToken(Jurisdiction.getCORPINFO_ID()));

View File

@ -23,7 +23,7 @@ public class RegexPatterns {
* , 6
*/
public static final String VERIFY_CODE_REGEX = "^[a-zA-Z\\d]{6}$";
public static final String VERIFY_CARDNO_REGEX = "^[0-9]{5}$";
public static final String VERIFY_CARDNO_REGEX = "^[1-9][0-9]*$";
/**
* , 1518
*/

View File

@ -1280,6 +1280,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and
CORPINFO_ID = #{CORPINFO_ID}
</update>
<update id="removeCardNoUser">
update
<include refid="tableName"></include>
set
CARDNO = null
where
CORPINFO_ID = #{CORPINFO_ID} and
CARDNO in <foreach item="item" collection="USER_IDS" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</update>
<update id="editUserCardNoByPid">
update
<include refid="tableName"></include>
set
CARDNO = #{cardNo}
where
PLS_ID = #{psnId}
</update>
<!-- 查询用户名称及部门名称 -->
<select id="findUserDept" parameterType="pd" resultType="pd" >