commit
This commit is contained in:
+53
-48
@@ -36,56 +36,61 @@ public class CultureScanHandle implements ScanHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object handle(Map<String, Object> params) {
|
public Object handle(Map<String, Object> params) {
|
||||||
// 获取参数
|
|
||||||
String userId = params.get("userId").toString();
|
|
||||||
boolean handle = (Boolean) params.get("handle");
|
|
||||||
String activityId = "f1452dba7a8b47d897849ebf2ca9c266";
|
|
||||||
|
|
||||||
View_user user = dao.fetch(View_user.class, Cnd.where("id", "=", userId));
|
try {
|
||||||
|
// 获取参数
|
||||||
|
String userId = params.get("userId").toString();
|
||||||
|
boolean handle = (Boolean) params.get("handle");
|
||||||
|
String activityId = "f1452dba7a8b47d897849ebf2ca9c266";
|
||||||
|
|
||||||
// 查询活动
|
View_user user = dao.fetch(View_user.class, Cnd.where("id", "=", userId));
|
||||||
ActivityTissue tissue = dao.fetch(ActivityTissue.class, activityId);
|
|
||||||
if (tissue == null || tissue.getGroupId() == null) {
|
// 查询活动
|
||||||
return Result.error(99, user.getUsername() + "不在活动范围内");
|
ActivityTissue tissue = dao.fetch(ActivityTissue.class, activityId);
|
||||||
|
if (tissue == null || tissue.getGroupId() == null) {
|
||||||
|
return Result.error(99, user.getUsername() + "不在活动范围内");
|
||||||
|
}
|
||||||
|
|
||||||
|
int scopeCount = dao.count(ActivityUserScope.class, Cnd.where("groupId", "=", tissue.getGroupId()).and("userId", "=", userId));
|
||||||
|
if (scopeCount == 0) {
|
||||||
|
return Result.error(99, user.getUsername() + "不在活动范围内");
|
||||||
|
}
|
||||||
|
|
||||||
|
ActivityTissuePerson tissuePerson = dao.fetch(ActivityTissuePerson.class, Cnd.where("tissueId", "=", activityId).and("userId", "=", userId));
|
||||||
|
if (tissuePerson != null) {
|
||||||
|
return Result.error(99, user.getUsername() + "已入场<br/>入场时间:" + tissuePerson.getApplyDateTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 插入报名表
|
||||||
|
if(handle) {
|
||||||
|
ActivityTissuePerson person = new ActivityTissuePerson();
|
||||||
|
person.setTissueId(activityId);
|
||||||
|
person.setUserId(userId);
|
||||||
|
person.setApplyUserId(SecurityUtil.getUserId());
|
||||||
|
person.setApplyUserUserName(SecurityUtil.getUserUsername());
|
||||||
|
person.setUserName(user.getUsername());
|
||||||
|
person.setLoginName(user.getLoginname());
|
||||||
|
person.setSex(user.getSex());
|
||||||
|
person.setMobile(user.getMobile());
|
||||||
|
person.setUnitName(user.getUnitName());
|
||||||
|
person.setUnionName(user.getUnionName());
|
||||||
|
person.setSign(false);
|
||||||
|
person.setApplyDateTime(DateUtil.now());
|
||||||
|
person.setUnitId(user.getUnitId());
|
||||||
|
person.setUnionId(user.getUnionId());
|
||||||
|
|
||||||
|
dao.insert(person);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
String msg = "姓名:" + user.getUsername() + "<br/>";
|
||||||
|
msg += "工号:" + user.getLoginname() + "<br/>";
|
||||||
|
msg += "所属单位:" + user.getUnitName() + "<br/>";
|
||||||
|
msg += "所属工会:" + user.getUnionName() + "<br/>";
|
||||||
|
msg += "身份证号:" + StrUtil.blankToDefault(user.getIdCard(), "暂无") + "<br/>";
|
||||||
|
return Result.success(msg);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return Result.error("请使用智慧工会系统身份二维码");
|
||||||
}
|
}
|
||||||
|
|
||||||
int scopeCount = dao.count(ActivityUserScope.class, Cnd.where("groupId", "=", tissue.getGroupId()).and("userId", "=", userId));
|
|
||||||
if (scopeCount == 0) {
|
|
||||||
return Result.error(99, user.getUsername() + "不在活动范围内");
|
|
||||||
}
|
|
||||||
|
|
||||||
ActivityTissuePerson tissuePerson = dao.fetch(ActivityTissuePerson.class, Cnd.where("tissueId", "=", activityId).and("userId", "=", userId));
|
|
||||||
if (tissuePerson != null) {
|
|
||||||
return Result.error(99, user.getUsername() + "已入场<br/>入场时间:" + tissuePerson.getApplyDateTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 插入报名表
|
|
||||||
if(handle) {
|
|
||||||
ActivityTissuePerson person = new ActivityTissuePerson();
|
|
||||||
person.setTissueId(activityId);
|
|
||||||
person.setUserId(userId);
|
|
||||||
person.setApplyUserId(SecurityUtil.getUserId());
|
|
||||||
person.setApplyUserUserName(SecurityUtil.getUserUsername());
|
|
||||||
person.setUserName(user.getUsername());
|
|
||||||
person.setLoginName(user.getLoginname());
|
|
||||||
person.setSex(user.getSex());
|
|
||||||
person.setMobile(user.getMobile());
|
|
||||||
person.setUnitName(user.getUnitName());
|
|
||||||
person.setUnionName(user.getUnionName());
|
|
||||||
person.setSign(false);
|
|
||||||
person.setApplyDateTime(DateUtil.now());
|
|
||||||
person.setUnitId(user.getUnitId());
|
|
||||||
person.setUnionId(user.getUnionId());
|
|
||||||
|
|
||||||
dao.insert(person);
|
|
||||||
return Result.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
String msg = "姓名:" + user.getUsername() + "<br/>";
|
|
||||||
msg += "工号:" + user.getLoginname() + "<br/>";
|
|
||||||
msg += "所属单位:" + user.getUnitName() + "<br/>";
|
|
||||||
msg += "所属工会:" + user.getUnionName() + "<br/>";
|
|
||||||
msg += "身份证号:" + StrUtil.blankToDefault(user.getIdCard(), "暂无") + "<br/>";
|
|
||||||
return Result.success(msg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class ScanController {
|
|||||||
@SaCheckLogin
|
@SaCheckLogin
|
||||||
public Object handle(@Param("bizType") String bizType, @Param("params") String params) {
|
public Object handle(@Param("bizType") String bizType, @Param("params") String params) {
|
||||||
if(StrUtil.isBlank(bizType)) {
|
if(StrUtil.isBlank(bizType)) {
|
||||||
return Result.error("请使用智慧工会系统二维码");
|
return Result.error("请使用智慧工会系统身份二维码");
|
||||||
}
|
}
|
||||||
Map<String, Object> paramsMap = Json.fromJson(Map.class, params);
|
Map<String, Object> paramsMap = Json.fromJson(Map.class, params);
|
||||||
return dispatcher.dispatch(bizType, paramsMap);
|
return dispatcher.dispatch(bizType, paramsMap);
|
||||||
|
|||||||
Reference in New Issue
Block a user