Browse Source

1、调整到处业务;

2、增加注册手机号码格式校验;
3、调整web端列表查询业务;
master
luyan 1 year ago
parent
commit
028db4ae1e
  1. 89
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/party/service/impl/ReportPartyServiceImpl.java
  2. 10
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/user/controller/EpdcAppUserController.java
  3. 8
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/user/dao/UserDjylDao.java
  4. 6
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/user/service/impl/UserDjylServiceImpl.java
  5. 12
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/UserDjlyDao.xml

89
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/party/service/impl/ReportPartyServiceImpl.java

@ -53,8 +53,6 @@ import java.util.Map;
@Service
public class ReportPartyServiceImpl extends BaseServiceImpl<ReportPartyDao, ReportPartyEntity> implements ReportPartyService {
private static final Long screenDeptId = 1175270520603930625L;
@Resource
private AdminFeignClient adminFeignClient;
@ -109,11 +107,34 @@ public class ReportPartyServiceImpl extends BaseServiceImpl<ReportPartyDao, Repo
if (StringUtils.isNotEmpty(entity.getCouplingCommunity())) {
reportPartyDTOS.forEach(dto -> {
if (dto.getId().equals(entity.getId())) {
//包联社区
dto.setCouplingCommunity(entity.getCouplingCommunity().split(","));
ParentAndAllDeptDTO deptDTO = adminFeignClient.getParentAndAllDept(dto.getCouplingCommunity()[dto.getCouplingCommunity().length - 1]).getData();
dto.setCouplingCommunityName(deptDTO.getParentDeptNames());
//居住社区
if (dto.getShiBei() == 0) {
if (StringUtils.isNotEmpty(entity.getVillageName())) {
String[] names = entity.getVillageName().split("-");
if (names.length == 2) {
dto.setParentDeptNames(names[0]);
dto.setHomeName(names[1]);
}
}
dto.setAllDeptNames(entity.getVillageName());
} else {
if (StringUtils.isNotEmpty(entity.getAllDeptIds())) {
dto.setAllDeptIds(entity.getAllDeptIds().split(","));
if (dto.getAllDeptIds().length == 4) {
deptDTO = adminFeignClient.getParentAndAllDept(dto.getAllDeptIds()[dto.getAllDeptIds().length - 2]).getData();
dto.setParentDeptNames(deptDTO.getAllDeptNames());
} else {
deptDTO = adminFeignClient.getParentAndAllDept(dto.getAllDeptIds()[dto.getAllDeptIds().length - 1]).getData();
dto.setParentDeptNames(deptDTO.getAllDeptNames());
}
}
}
}
dto.setAllDeptNames(entity.getParentDeptNames());
});
}
}
@ -131,17 +152,31 @@ public class ReportPartyServiceImpl extends BaseServiceImpl<ReportPartyDao, Repo
String workUnit = (String) params.get("workUnit");
Long deptId = SecurityUser.getUser().getDeptId();
String deptIds = (String) params.get("deptId");
ParentAndAllDeptDTO deptDTO;
if (StringUtils.isNotEmpty(deptIds)) {
deptIds = screenDeptId + "," + deptIds;
if (StringUtils.isNotEmpty(sel) && sel.equals("1")) {
wrapper.likeRight("COUPLING_COMMUNITY", deptIds);
if (deptIds.split(",").length > 1) {
String[] ids = deptIds.split(",");
if (ids.length == 3) {
deptDTO = adminFeignClient.getParentAndAllDept(ids[ids.length - 2]).getData();
} else {
deptDTO = adminFeignClient.getParentAndAllDept(ids[ids.length - 1]).getData();
}
} else {
wrapper.likeRight("ALL_DEPT_IDS", deptIds);
if (!String.valueOf(deptId).equals(deptIds)) {
deptDTO = adminFeignClient.getParentAndAllDept(String.valueOf(deptId)).getData();
} else {
deptDTO = adminFeignClient.getParentAndAllDept(deptIds).getData();
}
}
} else {
if (null != deptId && !deptId.equals(screenDeptId)) {
wrapper.eq("DEPT_ID", deptId);
deptDTO = adminFeignClient.getParentAndAllDept(String.valueOf(deptId)).getData();
}
//居住社区
String deptIdsStr = deptDTO.getAllDeptIds();
if (StringUtils.isNotEmpty(sel) && sel.equals("0")) {
wrapper.likeRight("ALL_DEPT_IDS", deptIdsStr);
} else {//包联社区
wrapper.likeRight("COUPLING_COMMUNITY", deptIdsStr);
}
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
wrapper.like(StringUtils.isNotBlank(name), FieldConstant.NAME_HUMP, name);
@ -164,11 +199,27 @@ public class ReportPartyServiceImpl extends BaseServiceImpl<ReportPartyDao, Repo
ParentAndAllDeptDTO deptDTO = adminFeignClient.getParentAndAllDept(result.getCouplingCommunity()[result.getCouplingCommunity().length - 1]).getData();
result.setCouplingCommunityName(deptDTO.getParentDeptNames());
}
// if (StringUtils.isNotEmpty(entity.getIdCard())) {
// String idCard = entity.getIdCard();
// String temp = idCard.substring(0, 4) + tempKey + idCard.substring(idCard.length() - 3);
// result.setIdCard(temp);
// }
if (entity.getShiBei() == 0) {
if (StringUtils.isNotEmpty(entity.getVillageName())) {
String[] names = entity.getVillageName().split("-");
if (names.length == 2) {
result.setParentDeptNames(names[0]);
result.setHomeName(names[1]);
}
}
} else {
if (StringUtils.isNotEmpty(entity.getAllDeptIds())) {
ParentAndAllDeptDTO deptDTO;
result.setAllDeptIds(entity.getAllDeptIds().split(","));
if (result.getAllDeptIds().length == 4) {
deptDTO = adminFeignClient.getParentAndAllDept(result.getAllDeptIds()[result.getAllDeptIds().length - 2]).getData();
result.setParentDeptNames(deptDTO.getAllDeptNames());
} else {
deptDTO = adminFeignClient.getParentAndAllDept(result.getAllDeptIds()[result.getAllDeptIds().length - 1]).getData();
result.setParentDeptNames(deptDTO.getAllDeptNames());
}
}
}
return result;
}
@ -229,7 +280,6 @@ public class ReportPartyServiceImpl extends BaseServiceImpl<ReportPartyDao, Repo
}
if (null == entity.getAllDeptIds()) {
entity.setAllDeptIds("");
entity.setDeptId("-1");
}
entity.setStatus(0);
entity.setExamineMsg(null);
@ -268,7 +318,11 @@ public class ReportPartyServiceImpl extends BaseServiceImpl<ReportPartyDao, Repo
ReportPartyEntity entity = ConvertUtils.sourceToTarget(dto, ReportPartyEntity.class);
//市北居住处理居住社区信息
if (null != dto.getAllDeptIds() && dto.getShiBei() == 1) {
if (entity.getCouplingCommunity().length() == 4) {
entity.setDeptId(dto.getCouplingCommunity()[dto.getCouplingCommunity().length - 2]);
} else {
entity.setDeptId(dto.getCouplingCommunity()[dto.getCouplingCommunity().length - 1]);
}
entity.setAllDeptIds(StringUtils.join(dto.getAllDeptIds(), ","));
Result<ParentAndAllDeptDTO> parentResult = adminFeignClient.getParentAndAllDept(String.valueOf(entity.getDeptId()));
if (!parentResult.success() || parentResult.getData() == null) {
@ -281,6 +335,11 @@ public class ReportPartyServiceImpl extends BaseServiceImpl<ReportPartyDao, Repo
}
} else {//不在市北,处理居住信息
if (StringUtils.isNotEmpty(dto.getVillageName())) {
if (entity.getCouplingCommunity().length() == 4) {
entity.setDeptId(dto.getCouplingCommunity()[dto.getCouplingCommunity().length - 2]);
} else {
entity.setDeptId(dto.getCouplingCommunity()[dto.getCouplingCommunity().length - 1]);
}
String[] names = dto.getVillageName().split("-");
if (names.length == 2) {
entity.setHomeName(names[1]);

10
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/user/controller/EpdcAppUserController.java

@ -1,6 +1,7 @@
package com.elink.esua.epdc.user.controller;
import com.elink.esua.epdc.commons.tools.constant.Constant;
import com.elink.esua.epdc.commons.tools.exception.RenException;
import com.elink.esua.epdc.commons.tools.security.user.SecurityUser;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
@ -16,6 +17,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 对移动端开放
@ -122,6 +125,13 @@ public class EpdcAppUserController {
*/
@PostMapping("npmRegister")
public Result npmUserRegister(@RequestBody UserDTO userDto) {
// 中国大陆手机号码正则表达式
String regex = "^((13[0-9])|(14[0,1,4-9])|(15[0-3,5-9])|(16[2,5,6,7])|(17[0-8])|(18[0-9])|(19[0-3,5-9]))\\d{8}$";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(userDto.getMobile());
if(!matcher.matches()){
throw new RenException("请填写正确的手机号码!");
}
return djylService.npmUserRegister(userDto);
}

8
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/user/dao/UserDjylDao.java

@ -38,4 +38,12 @@ public interface UserDjylDao extends BaseDao<UserDjylEntity> {
EpdcUserInfoResultDTO selectOneInfoById(String id);
List<UserDTO> selectByMobileAndIdentityNo(@Param("mobile") String mobile, @Param("identityNo") String identityNo);
/**
* 检查手机号码是否备注册
* @param identityNo
* @param mobile
* @return
*/
int findByIdCardAndMobile(@Param("identityNo") String identityNo, @Param("mobile") String mobile);
}

6
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/user/service/impl/UserDjylServiceImpl.java

@ -86,7 +86,11 @@ public class UserDjylServiceImpl extends BaseServiceImpl<UserDjylDao, UserDjylEn
@Transactional(rollbackFor = Exception.class)
public Result npmUserRegister(UserDTO userDto) {
UserDjylEntity entity = ConvertUtils.sourceToTarget(userDto, UserDjylEntity.class);
if(StringUtils.isNotEmpty(userDto.getNickname())){
Integer flag = baseDao.findByIdCardAndMobile(userDto.getIdentityNo(), userDto.getMobile());
if (flag == 1) {
throw new RenException("手机号码:" + userDto.getMobile() + "已注册,如忘记密码请自行修改密码或联系管理员!");
}
if (StringUtils.isNotEmpty(userDto.getNickname())) {
entity.setNickname(userDto.getNickname());
}
if (StringUtils.isEmpty(userDto.getAllDeptIds())) {

12
esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/UserDjlyDao.xml

@ -143,4 +143,16 @@
</where>
</select>
<select id="findByIdCardAndMobile" resultType="java.lang.Integer">
SELECT count(1) FROM epdc_user_djyl eu
WHERE eu.DEL_FLAG = 0
<if test="null != identityNo and identityNo != ''">
AND eu.IDENTITY_NO = #{identityNo}
</if>
<if test="null != mobile and mobile != ''">
AND eu.MOBILE = #{mobile}
</if>
LIMIT 1
</select>
</mapper>

Loading…
Cancel
Save