|
@@ -16,6 +16,7 @@ import com.zhongshu.card.client.service.school.CardInfoService;
|
|
|
import com.zhongshu.card.client.type.CardCancelState;
|
|
import com.zhongshu.card.client.type.CardCancelState;
|
|
|
import com.zhongshu.card.client.type.CardOperationType;
|
|
import com.zhongshu.card.client.type.CardOperationType;
|
|
|
import com.zhongshu.card.client.type.school.CardState;
|
|
import com.zhongshu.card.client.type.school.CardState;
|
|
|
|
|
+import com.zhongshu.card.client.utils.DateUtils;
|
|
|
import com.zhongshu.card.server.core.dao.org.OrganizationDao;
|
|
import com.zhongshu.card.server.core.dao.org.OrganizationDao;
|
|
|
import com.zhongshu.card.server.core.dao.org.OrganizationUserDao;
|
|
import com.zhongshu.card.server.core.dao.org.OrganizationUserDao;
|
|
|
import com.zhongshu.card.server.core.dao.org.UserCountDao;
|
|
import com.zhongshu.card.server.core.dao.org.UserCountDao;
|
|
@@ -182,7 +183,7 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
if (ObjectUtils.isEmpty(list)) {
|
|
if (ObjectUtils.isEmpty(list)) {
|
|
|
return ResultContent.buildFail("用户未加入结构,不能绑定卡片");
|
|
return ResultContent.buildFail("用户未加入结构,不能绑定卡片");
|
|
|
}
|
|
}
|
|
|
- return bindCardFromPoolByOrgId(poolId, list.get(0).getId());
|
|
|
|
|
|
|
+ return bindCardFromPoolByOrgId(poolId, list.get(0).getId(), "");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -192,7 +193,7 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
*/
|
|
*/
|
|
|
@Transactional
|
|
@Transactional
|
|
|
@Override
|
|
@Override
|
|
|
- public ResultContent bindCardFromPoolByOrgId(String poolId, String id) {
|
|
|
|
|
|
|
+ public ResultContent bindCardFromPoolByOrgId(String poolId, String id, String remark) {
|
|
|
if (StringUtils.isEmpty(id)) {
|
|
if (StringUtils.isEmpty(id)) {
|
|
|
return ResultContent.buildFail("id不能为空");
|
|
return ResultContent.buildFail("id不能为空");
|
|
|
}
|
|
}
|
|
@@ -252,6 +253,7 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
cardInfo.setUserId(userId);
|
|
cardInfo.setUserId(userId);
|
|
|
cardInfo.setUserName(account.getName());
|
|
cardInfo.setUserName(account.getName());
|
|
|
cardInfo.setPhone(account.getPhone());
|
|
cardInfo.setPhone(account.getPhone());
|
|
|
|
|
+ cardInfo.setRemark(remark);
|
|
|
cardInfoDao.save(cardInfo);
|
|
cardInfoDao.save(cardInfo);
|
|
|
|
|
|
|
|
// 标记卡池这张卡已使用
|
|
// 标记卡池这张卡已使用
|
|
@@ -281,6 +283,8 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
CardInfoPool cardInfoPool = cardInfoPoolDao.findTopByCode(cardInfo.getCode());
|
|
CardInfoPool cardInfoPool = cardInfoPoolDao.findTopByCode(cardInfo.getCode());
|
|
|
if (ObjectUtils.isNotEmpty(cardInfoPool)) {
|
|
if (ObjectUtils.isNotEmpty(cardInfoPool)) {
|
|
|
cardInfoPool.setIsUsed(Boolean.FALSE);
|
|
cardInfoPool.setIsUsed(Boolean.FALSE);
|
|
|
|
|
+ cardInfoPool.setUseUserId(null);
|
|
|
|
|
+ cardInfoPool.setUseTime(null);
|
|
|
cardInfoPoolDao.save(cardInfoPool);
|
|
cardInfoPoolDao.save(cardInfoPool);
|
|
|
}
|
|
}
|
|
|
return ResultContent.buildSuccess();
|
|
return ResultContent.buildSuccess();
|
|
@@ -400,28 +404,36 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public ResultContent cardLossByIccId(CardLossParam param) {
|
|
public ResultContent cardLossByIccId(CardLossParam param) {
|
|
|
- Assert.hasText(param.getPassWord(), "密码不能为空");
|
|
|
|
|
Assert.hasText(param.getCode(), "code不能为空");
|
|
Assert.hasText(param.getCode(), "code不能为空");
|
|
|
- Assert.hasText(param.getPhone(), "phone不能为空");
|
|
|
|
|
-
|
|
|
|
|
String userId = getCurrentUserId();
|
|
String userId = getCurrentUserId();
|
|
|
UserAccount userAccount = userCountDao.findTopByUserId(userId);
|
|
UserAccount userAccount = userCountDao.findTopByUserId(userId);
|
|
|
|
|
|
|
|
- com.github.microservice.auth.client.content.ResultContent<Void> resultContent = userService.checkLoginPassword(userId, param.getPassWord());
|
|
|
|
|
- if (resultContent.getState() != ResultState.Success) {
|
|
|
|
|
- return ResultContent.buildFail("密码错误");
|
|
|
|
|
|
|
+ boolean isVerify = false;
|
|
|
|
|
+ // 是否验证密码
|
|
|
|
|
+ if (param.getVerifyPassword() != null && param.getVerifyPassword()) {
|
|
|
|
|
+ isVerify = true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (isVerify) {
|
|
|
|
|
+ Assert.hasText(param.getPhone(), "phone不能为空");
|
|
|
|
|
+ Assert.hasText(param.getPassWord(), "密码不能为空");
|
|
|
|
|
+ com.github.microservice.auth.client.content.ResultContent<Void> resultContent = userService.checkLoginPassword(userId, param.getPassWord());
|
|
|
|
|
+ if (resultContent.getState() != ResultState.Success) {
|
|
|
|
|
+ return ResultContent.buildFail("密码错误");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
CardInfo cardInfo = cardInfoDao.findByCode(param.getCode());
|
|
CardInfo cardInfo = cardInfoDao.findByCode(param.getCode());
|
|
|
if (ObjectUtils.isEmpty(cardInfo)) {
|
|
if (ObjectUtils.isEmpty(cardInfo)) {
|
|
|
return ResultContent.buildFail(String.format("卡片不存在:%s", param.getCode()));
|
|
return ResultContent.buildFail(String.format("卡片不存在:%s", param.getCode()));
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
// 判断卡片人的信息
|
|
// 判断卡片人的信息
|
|
|
String cardUserId = cardInfo.getUserId();
|
|
String cardUserId = cardInfo.getUserId();
|
|
|
UserAccount cardUserAccount = userCountDao.findTopByUserId(cardUserId);
|
|
UserAccount cardUserAccount = userCountDao.findTopByUserId(cardUserId);
|
|
|
- if (!cardUserAccount.getPhone().equals(param.getPhone())) {
|
|
|
|
|
- return ResultContent.buildFail("持卡人信息和卡号不一致");
|
|
|
|
|
|
|
+ if (isVerify) {
|
|
|
|
|
+ if (!cardUserAccount.getPhone().equals(param.getPhone())) {
|
|
|
|
|
+ return ResultContent.buildFail("持卡人信息和卡号不一致");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (cardInfo.getCardState() == CardState.Loss) {
|
|
if (cardInfo.getCardState() == CardState.Loss) {
|
|
@@ -440,7 +452,6 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
cardInfoLossRecord.setCardUserAccount(cardUserAccount);
|
|
cardInfoLossRecord.setCardUserAccount(cardUserAccount);
|
|
|
cardInfoLossRecord.setOperationType(CardOperationType.Loss);
|
|
cardInfoLossRecord.setOperationType(CardOperationType.Loss);
|
|
|
cardInfoLossRecordDao.save(cardInfoLossRecord);
|
|
cardInfoLossRecordDao.save(cardInfoLossRecord);
|
|
|
-
|
|
|
|
|
return ResultContent.buildSuccess();
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -487,17 +498,24 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public ResultContent cardEnableByIccId(CardLossParam param) {
|
|
public ResultContent cardEnableByIccId(CardLossParam param) {
|
|
|
- Assert.hasText(param.getPassWord(), "密码不能为空");
|
|
|
|
|
Assert.hasText(param.getCode(), "code不能为空");
|
|
Assert.hasText(param.getCode(), "code不能为空");
|
|
|
- Assert.hasText(param.getPhone(), "phone不能为空");
|
|
|
|
|
-
|
|
|
|
|
String userId = getCurrentUserId();
|
|
String userId = getCurrentUserId();
|
|
|
UserAccount userAccount = userCountDao.findTopByUserId(userId);
|
|
UserAccount userAccount = userCountDao.findTopByUserId(userId);
|
|
|
|
|
|
|
|
- com.github.microservice.auth.client.content.ResultContent<Void> resultContent = userService.checkLoginPassword(userId, param.getPassWord());
|
|
|
|
|
- if (resultContent.getState() != ResultState.Success) {
|
|
|
|
|
- return ResultContent.buildFail("密码错误");
|
|
|
|
|
|
|
+ boolean isVerify = false;
|
|
|
|
|
+ if (param.getVerifyPassword() != null && param.getVerifyPassword()) {
|
|
|
|
|
+ isVerify = true;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if (isVerify) {
|
|
|
|
|
+ Assert.hasText(param.getPhone(), "phone不能为空");
|
|
|
|
|
+ Assert.hasText(param.getPassWord(), "密码不能为空");
|
|
|
|
|
+ com.github.microservice.auth.client.content.ResultContent<Void> resultContent = userService.checkLoginPassword(userId, param.getPassWord());
|
|
|
|
|
+ if (resultContent.getState() != ResultState.Success) {
|
|
|
|
|
+ return ResultContent.buildFail("密码错误");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
CardInfo cardInfo = cardInfoDao.findByCode(param.getCode());
|
|
CardInfo cardInfo = cardInfoDao.findByCode(param.getCode());
|
|
|
if (ObjectUtils.isEmpty(cardInfo)) {
|
|
if (ObjectUtils.isEmpty(cardInfo)) {
|
|
|
return ResultContent.buildFail(String.format("code不存在:%s", param.getCode()));
|
|
return ResultContent.buildFail(String.format("code不存在:%s", param.getCode()));
|
|
@@ -506,8 +524,11 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
// 判断卡片人的信息
|
|
// 判断卡片人的信息
|
|
|
String cardUserId = cardInfo.getUserId();
|
|
String cardUserId = cardInfo.getUserId();
|
|
|
UserAccount cardUserAccount = userCountDao.findTopByUserId(cardUserId);
|
|
UserAccount cardUserAccount = userCountDao.findTopByUserId(cardUserId);
|
|
|
- if (!cardUserAccount.getPhone().equals(param.getPhone())) {
|
|
|
|
|
- return ResultContent.buildFail("持卡人信息和卡号不一致");
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (isVerify) {
|
|
|
|
|
+ if (!cardUserAccount.getPhone().equals(param.getPhone())) {
|
|
|
|
|
+ return ResultContent.buildFail("持卡人信息和卡号不一致");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (cardInfo.getCardState() == CardState.Enable) {
|
|
if (cardInfo.getCardState() == CardState.Enable) {
|
|
@@ -701,7 +722,7 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
ImportParams params = new ImportParams();
|
|
ImportParams params = new ImportParams();
|
|
|
params.setHeadRows(1);
|
|
params.setHeadRows(1);
|
|
|
params.setTitleRows(1);
|
|
params.setTitleRows(1);
|
|
|
- List<CardInfoBindImportParam> list = ExcelImportUtil.importExcel(file.getInputStream(), CardInfoPoolImportParam.class, params);
|
|
|
|
|
|
|
+ List<CardInfoBindImportParam> list = ExcelImportUtil.importExcel(file.getInputStream(), CardInfoBindImportParam.class, params);
|
|
|
model.setTotal(list.size());
|
|
model.setTotal(list.size());
|
|
|
|
|
|
|
|
HashMap<String, String> codeMap = new HashMap<>();
|
|
HashMap<String, String> codeMap = new HashMap<>();
|
|
@@ -768,7 +789,7 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
}
|
|
}
|
|
|
if (ObjectUtils.isNotEmpty(cardInfoPools)) {
|
|
if (ObjectUtils.isNotEmpty(cardInfoPools)) {
|
|
|
for (CardInfoPoolBind2OrgUserParam bind2OrgUserParam : cardInfoPools) {
|
|
for (CardInfoPoolBind2OrgUserParam bind2OrgUserParam : cardInfoPools) {
|
|
|
- bindCardFromPoolByOrgId(bind2OrgUserParam.getPoolId(), bind2OrgUserParam.getId());
|
|
|
|
|
|
|
+ bindCardFromPoolByOrgId(bind2OrgUserParam.getPoolId(), bind2OrgUserParam.getId(), bind2OrgUserParam.getRemark());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
model.setSuccess(cardInfoPools.size());
|
|
model.setSuccess(cardInfoPools.size());
|
|
@@ -810,6 +831,51 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
orgUser = tempList.get(0);
|
|
orgUser = tempList.get(0);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(orgUser)) {
|
|
|
|
|
+ String userCode = "";
|
|
|
|
|
+ String userName = "";
|
|
|
|
|
+ String userSex = "";
|
|
|
|
|
+ userCode = orgUser.getCode();
|
|
|
|
|
+ UserAccount userAccount = orgUser.getUser();
|
|
|
|
|
+ if (userAccount != null) {
|
|
|
|
|
+ map.put("phone", userAccount.getPhone());
|
|
|
|
|
+ if (userAccount.getSex() != null) {
|
|
|
|
|
+ userSex = userAccount.getSex().getRemark();
|
|
|
|
|
+ }
|
|
|
|
|
+ userName = userAccount.getName();
|
|
|
|
|
+ }
|
|
|
|
|
+ map.put("userCode", userCode);
|
|
|
|
|
+ map.put("userName", userName);
|
|
|
|
|
+ map.put("userSex", userSex);
|
|
|
|
|
+
|
|
|
|
|
+ String orgName = "";
|
|
|
|
|
+ Organization organization1 = it.getOrganization();
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(organization1)) {
|
|
|
|
|
+ orgName = organization1.getName();
|
|
|
|
|
+ }
|
|
|
|
|
+ map.put("orgName", orgName);
|
|
|
|
|
+ String departmentName = "";
|
|
|
|
|
+ if (orgUser.getDepartment() != null) {
|
|
|
|
|
+ departmentName = orgUser.getDepartment().getName();
|
|
|
|
|
+ }
|
|
|
|
|
+ map.put("departmentName", departmentName);
|
|
|
|
|
+ String roleNames = "";
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(orgUser.getRoles())) {
|
|
|
|
|
+ roleNames = orgUser.getRoles().stream().map(it1 -> it1.getName()).collect(Collectors.joining("、"));
|
|
|
|
|
+ }
|
|
|
|
|
+ map.put("roleNames", roleNames);
|
|
|
|
|
+ }
|
|
|
|
|
+ String cancelStr = "未作废";
|
|
|
|
|
+ if (it.getIsCanceled() != null && it.getIsCanceled()) {
|
|
|
|
|
+ cancelStr = "已作废";
|
|
|
|
|
+ }
|
|
|
|
|
+ map.put("cancelStr", cancelStr);
|
|
|
|
|
+ String cardState = it.getCardState().getRemark();
|
|
|
|
|
+ map.put("cardState", cardState);
|
|
|
|
|
+
|
|
|
|
|
+ map.put("createTime", DateUtils.paresTime(it.getCreateTime(), DateUtils.FORMAT_LONG));
|
|
|
|
|
+ map.put("updateTime", DateUtils.paresTime(it.getUpdateTime(), DateUtils.FORMAT_LONG));
|
|
|
return map;
|
|
return map;
|
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
|
}
|
|
}
|
|
@@ -822,19 +888,19 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
List<CommonExeclTd> tds = new ArrayList<>();
|
|
List<CommonExeclTd> tds = new ArrayList<>();
|
|
|
tds.add(CommonExeclTd.build("卡片ID", "code"));
|
|
tds.add(CommonExeclTd.build("卡片ID", "code"));
|
|
|
tds.add(CommonExeclTd.build("卡片类型", "cardStr"));
|
|
tds.add(CommonExeclTd.build("卡片类型", "cardStr"));
|
|
|
- tds.add(CommonExeclTd.build("人员编号", "useStr"));
|
|
|
|
|
- tds.add(CommonExeclTd.build("姓名", "cancelStr"));
|
|
|
|
|
- tds.add(CommonExeclTd.build("性别", "cancelStr"));
|
|
|
|
|
- tds.add(CommonExeclTd.build("机构", "cancelStr"));
|
|
|
|
|
- tds.add(CommonExeclTd.build("部门", "cancelStr"));
|
|
|
|
|
- tds.add(CommonExeclTd.build("人员类型", "cancelStr"));
|
|
|
|
|
- tds.add(CommonExeclTd.build("手机号", "cancelStr"));
|
|
|
|
|
|
|
+ tds.add(CommonExeclTd.build("人员编号", "userCode"));
|
|
|
|
|
+ tds.add(CommonExeclTd.build("姓名", "userName"));
|
|
|
|
|
+ tds.add(CommonExeclTd.build("性别", "userSex"));
|
|
|
|
|
+ tds.add(CommonExeclTd.build("机构", "orgName"));
|
|
|
|
|
+ tds.add(CommonExeclTd.build("部门", "departmentName"));
|
|
|
|
|
+ tds.add(CommonExeclTd.build("人员类型", "roleNames"));
|
|
|
|
|
+ tds.add(CommonExeclTd.build("手机号", "phone"));
|
|
|
tds.add(CommonExeclTd.build("作废状态", "cancelStr"));
|
|
tds.add(CommonExeclTd.build("作废状态", "cancelStr"));
|
|
|
- tds.add(CommonExeclTd.build("挂失状态", "cancelStr"));
|
|
|
|
|
- tds.add(CommonExeclTd.build("创建人员", "cancelStr"));
|
|
|
|
|
- tds.add(CommonExeclTd.build("创建时间", "cancelStr"));
|
|
|
|
|
- tds.add(CommonExeclTd.build("更新人员", "cancelStr"));
|
|
|
|
|
- tds.add(CommonExeclTd.build("更新时间", "cancelStr"));
|
|
|
|
|
|
|
+ tds.add(CommonExeclTd.build("挂失状态", "cardState"));
|
|
|
|
|
+ tds.add(CommonExeclTd.build("创建人员", "createUserName"));
|
|
|
|
|
+ tds.add(CommonExeclTd.build("创建时间", "createTime"));
|
|
|
|
|
+ tds.add(CommonExeclTd.build("更新人员", "updateUserName"));
|
|
|
|
|
+ tds.add(CommonExeclTd.build("更新时间", "updateTime"));
|
|
|
|
|
|
|
|
execlParam.setTds(tds);
|
|
execlParam.setTds(tds);
|
|
|
ExcelUtils.commonExecuteExcel(request, response, execlParam);
|
|
ExcelUtils.commonExecuteExcel(request, response, execlParam);
|
|
@@ -858,11 +924,17 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
model = new CardInfoModel();
|
|
model = new CardInfoModel();
|
|
|
BeanUtils.copyProperties(entity, model);
|
|
BeanUtils.copyProperties(entity, model);
|
|
|
|
|
|
|
|
- // 机构用户信息
|
|
|
|
|
- List<OrganizationUser> list = organizationUserService.getUserOrgList(entity.getUserId(), entity.getProjectOid());
|
|
|
|
|
OrganizationUserModel orgUserInfo = null;
|
|
OrganizationUserModel orgUserInfo = null;
|
|
|
- if (ObjectUtils.isEmpty(list)) {
|
|
|
|
|
- orgUserInfo = userAccountService.toOrgUserModel(list.get(0));
|
|
|
|
|
|
|
+ OrganizationUser organizationUser = entity.getOrganizationUser();
|
|
|
|
|
+ if (ObjectUtils.isEmpty(organizationUser)) {
|
|
|
|
|
+ // 机构用户信息
|
|
|
|
|
+ List<OrganizationUser> list = organizationUserService.getUserOrgList(entity.getUserId(), entity.getProjectOid());
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(list)) {
|
|
|
|
|
+ organizationUser = list.get(0);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(organizationUser)) {
|
|
|
|
|
+ orgUserInfo = userAccountService.toOrgUserModel(organizationUser);
|
|
|
}
|
|
}
|
|
|
model.setOrganizationUser(orgUserInfo);
|
|
model.setOrganizationUser(orgUserInfo);
|
|
|
}
|
|
}
|