|
|
|
@ -1,6 +1,7 @@ |
|
|
|
package apelet.association.controller; |
|
|
|
package apelet.association.controller; |
|
|
|
|
|
|
|
|
|
|
|
import apelet.association.utils.DataTransformationUtil; |
|
|
|
import apelet.association.utils.DataTransformationUtil; |
|
|
|
|
|
|
|
import apelet.common.core.annotation.NoAuthInterface; |
|
|
|
import apelet.common.core.object.ObjectCollection; |
|
|
|
import apelet.common.core.object.ObjectCollection; |
|
|
|
import apelet.common.core.object.ObjectValue; |
|
|
|
import apelet.common.core.object.ObjectValue; |
|
|
|
import apelet.common.core.object.ResponseResult; |
|
|
|
import apelet.common.core.object.ResponseResult; |
|
|
|
@ -8,16 +9,14 @@ import apelet.common.generator.utils.OrmGenDataSourceUtil; |
|
|
|
import apelet.common.orm.impl.Filter; |
|
|
|
import apelet.common.orm.impl.Filter; |
|
|
|
import apelet.common.orm.impl.FilterItem; |
|
|
|
import apelet.common.orm.impl.FilterItem; |
|
|
|
import apelet.common.orm.impl.Selector; |
|
|
|
import apelet.common.orm.impl.Selector; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RestController |
|
|
|
@RestController |
|
|
|
@RequestMapping("/tenantadmin/activity") |
|
|
|
@RequestMapping("/tenantadmin/activity") |
|
|
|
@ -52,33 +51,14 @@ public class AssociationActivitiesController { |
|
|
|
if (StringUtils.isEmpty(signInUnit)) { |
|
|
|
if (StringUtils.isEmpty(signInUnit)) { |
|
|
|
return ResponseResult.error("500", "签到单位为空!!!"); |
|
|
|
return ResponseResult.error("500", "签到单位为空!!!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("333333333333333333333333333333333333333333333333"); |
|
|
|
Integer type = jsonObject.getInteger("type"); |
|
|
|
Integer type = jsonObject.getInteger("type"); |
|
|
|
|
|
|
|
|
|
|
|
// Filter filter = new Filter();
|
|
|
|
Filter filter = new Filter(); |
|
|
|
// filter.add(new FilterItem("unit_name", FilterItem.equals, signInUnit));
|
|
|
|
filter.add(new FilterItem("unit_name", FilterItem.equals, signInUnit)); |
|
|
|
// ObjectCollection collection = ormGenDataSourceUtil.query("membership_apply", filter, new Selector());
|
|
|
|
ObjectCollection collection = ormGenDataSourceUtil.query("membership_apply", filter, new Selector()); |
|
|
|
//
|
|
|
|
|
|
|
|
// if (collection == null || collection.isEmpty()) {
|
|
|
|
|
|
|
|
// return ResponseResult.error("500", "签到单位不存在, 请检查签到单位!!!");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// ObjectCollection managerCollection = ormGenDataSourceUtil.query("membership_manager", new Filter(), new Selector());
|
|
|
|
|
|
|
|
// List<Map<String, Object>> managerList = DataTransformationUtil.objectCollectionToList(managerCollection);
|
|
|
|
|
|
|
|
// Map<String, Map<String, Object>> mapMap = managerList.stream().collect(Collectors.toMap(map -> String.valueOf(map.get("id")), map -> map, (oldValue, newValue) -> oldValue));
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// ObjectValue member = null;
|
|
|
|
|
|
|
|
// for (int i = 0; i < collection.size(); i++) {
|
|
|
|
|
|
|
|
// ObjectValue object = collection.getObject(i);
|
|
|
|
|
|
|
|
// ObjectValue manger = object.getObjectValue("membership_manger_id");
|
|
|
|
|
|
|
|
// Map<String, Object> map = mapMap.get(manger != null && manger.get("id") != null ? manger.get("id") : "");
|
|
|
|
|
|
|
|
// Object phone = map.get("phone");
|
|
|
|
|
|
|
|
// if (ObjectUtil.equal(phone, phoneNumber)) {
|
|
|
|
|
|
|
|
// member = object;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (member == null) {
|
|
|
|
|
|
|
|
// return ResponseResult.error("500", signInUnit + " 签到单位下签到人不存在!!!");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
if (type == 1) { |
|
|
|
if (type == 1) { |
|
|
|
//签到
|
|
|
|
//签到
|
|
|
|
ObjectValue value = new ObjectValue("check_in_out"); |
|
|
|
ObjectValue value = new ObjectValue("check_in_out"); |
|
|
|
@ -86,7 +66,6 @@ public class AssociationActivitiesController { |
|
|
|
value.put("phone", phoneNumber); |
|
|
|
value.put("phone", phoneNumber); |
|
|
|
// value.put("membership_id", member);
|
|
|
|
// value.put("membership_id", member);
|
|
|
|
value.put("create_time", new Date()); |
|
|
|
value.put("create_time", new Date()); |
|
|
|
value.put("create_time", new Date()); |
|
|
|
|
|
|
|
value.put("parent_id", activityId); |
|
|
|
value.put("parent_id", activityId); |
|
|
|
value.put("check_in", 1); |
|
|
|
value.put("check_in", 1); |
|
|
|
ormGenDataSourceUtil.addNew(value.getTableName(), value); |
|
|
|
ormGenDataSourceUtil.addNew(value.getTableName(), value); |
|
|
|
@ -94,15 +73,16 @@ public class AssociationActivitiesController { |
|
|
|
|
|
|
|
|
|
|
|
if (type == 2) { |
|
|
|
if (type == 2) { |
|
|
|
//签退
|
|
|
|
//签退
|
|
|
|
Filter filter = new Filter(); |
|
|
|
filter = new Filter(); |
|
|
|
// filter.add(new FilterItem("membership_id", FilterItem.equals, member.get("id")));
|
|
|
|
filter.add(new FilterItem("name", FilterItem.equals, signInPerson)); |
|
|
|
|
|
|
|
filter.add(new FilterItem("phone", FilterItem.equals, phoneNumber)); |
|
|
|
filter.add(new FilterItem("parent_id", FilterItem.equals, activityId)); |
|
|
|
filter.add(new FilterItem("parent_id", FilterItem.equals, activityId)); |
|
|
|
filter.add(new FilterItem("check_in", FilterItem.equals, 1)); |
|
|
|
filter.add(new FilterItem("check_in", FilterItem.equals, 1)); |
|
|
|
ObjectCollection collection = ormGenDataSourceUtil.query("check_in_out", filter, new Selector()); |
|
|
|
collection = ormGenDataSourceUtil.query("check_in_out", filter, new Selector()); |
|
|
|
if (collection != null && !collection.isEmpty()) { |
|
|
|
if (collection != null && !collection.isEmpty()) { |
|
|
|
ObjectValue object = collection.getObject(0); |
|
|
|
ObjectValue object = collection.getObject(0); |
|
|
|
object.put("check_out", 1); |
|
|
|
object.put("check_out", 1); |
|
|
|
ormGenDataSourceUtil.update("check_in_out", object, new Selector()); |
|
|
|
ormGenDataSourceUtil.update("check_in_out", object, null); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return ResponseResult.success("签到成功!!!"); |
|
|
|
return ResponseResult.success("签到成功!!!"); |
|
|
|
|