1.添加任务模板参数功能
Showing
8 changed files
with
196 additions
and
51 deletions
... | @@ -49,7 +49,7 @@ public class DataSyncMsg implements Serializable { | ... | @@ -49,7 +49,7 @@ public class DataSyncMsg implements Serializable { |
49 | private Long activityId; | 49 | private Long activityId; |
50 | private Long mediaId; | 50 | private Long mediaId; |
51 | private Long itemId; | 51 | private Long itemId; |
52 | 52 | private String param; | |
53 | 53 | ||
54 | } | 54 | } |
55 | 55 | ... | ... |
... | @@ -11,14 +11,17 @@ import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo; | ... | @@ -11,14 +11,17 @@ import com.topdraw.business.module.member.relatedinfo.domain.MemberRelatedInfo; |
11 | import com.topdraw.business.module.member.relatedinfo.service.MemberRelatedInfoService; | 11 | import com.topdraw.business.module.member.relatedinfo.service.MemberRelatedInfoService; |
12 | import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoQueryCriteria; | 12 | import com.topdraw.business.module.member.relatedinfo.service.dto.MemberRelatedInfoQueryCriteria; |
13 | import com.topdraw.exception.BadRequestException; | 13 | import com.topdraw.exception.BadRequestException; |
14 | import com.topdraw.util.Base64Util; | ||
14 | import lombok.extern.slf4j.Slf4j; | 15 | import lombok.extern.slf4j.Slf4j; |
15 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
16 | import org.springframework.data.domain.Pageable; | 17 | import org.springframework.data.domain.Pageable; |
17 | import org.springframework.util.Assert; | 18 | import org.springframework.util.Assert; |
19 | import org.springframework.util.StringUtils; | ||
18 | import org.springframework.validation.annotation.Validated; | 20 | import org.springframework.validation.annotation.Validated; |
19 | import org.springframework.web.bind.annotation.*; | 21 | import org.springframework.web.bind.annotation.*; |
20 | import io.swagger.annotations.*; | 22 | import io.swagger.annotations.*; |
21 | 23 | ||
24 | import java.util.Base64; | ||
22 | import java.util.Objects; | 25 | import java.util.Objects; |
23 | 26 | ||
24 | /** | 27 | /** |
... | @@ -57,6 +60,15 @@ public class MemberRelatedInfoController { | ... | @@ -57,6 +60,15 @@ public class MemberRelatedInfoController { |
57 | @ApiOperation("修改MemberRelatedInfo") | 60 | @ApiOperation("修改MemberRelatedInfo") |
58 | @AnonymousAccess | 61 | @AnonymousAccess |
59 | public ResultInfo update(@Validated(value = {UpdateGroup.class}) @RequestBody MemberRelatedInfo resources) { | 62 | public ResultInfo update(@Validated(value = {UpdateGroup.class}) @RequestBody MemberRelatedInfo resources) { |
63 | |||
64 | log.info("Param ===> resources ===> [{}]",resources); | ||
65 | |||
66 | String name = resources.getName(); | ||
67 | if (StringUtils.hasText(name)) { | ||
68 | String nickNameEncode = Base64Util.encode(name); | ||
69 | resources.setName(nickNameEncode); | ||
70 | } | ||
71 | |||
60 | Long id = resources.getId(); | 72 | Long id = resources.getId(); |
61 | MemberRelatedInfoDTO memberRelatedInfoDTO = this.MemberRelatedInfoService.findById(id); | 73 | MemberRelatedInfoDTO memberRelatedInfoDTO = this.MemberRelatedInfoService.findById(id); |
62 | if (memberRelatedInfoDTO.getId() != null) { | 74 | if (memberRelatedInfoDTO.getId() != null) { | ... | ... |
member-service-impl/src/main/java/com/topdraw/business/process/domian/TempCustomPointBean.java
0 → 100644
1 | package com.topdraw.business.process.domian; | ||
2 | |||
3 | import lombok.AllArgsConstructor; | ||
4 | import lombok.Data; | ||
5 | import lombok.NoArgsConstructor; | ||
6 | |||
7 | import javax.persistence.Transient; | ||
8 | import javax.validation.constraints.NotNull; | ||
9 | |||
10 | @Data | ||
11 | @AllArgsConstructor | ||
12 | @NoArgsConstructor | ||
13 | public class TempCustomPointBean extends TempIptvUser { | ||
14 | |||
15 | /** 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) */ | ||
16 | @Transient | ||
17 | @NotNull(message = "设备类型不得为空") | ||
18 | protected Integer deviceType; | ||
19 | |||
20 | /** 订单id */ | ||
21 | @Transient | ||
22 | protected Long orderId; | ||
23 | |||
24 | /** 节目id(针对观影操作) */ | ||
25 | @Transient | ||
26 | protected Long mediaId; | ||
27 | |||
28 | /** 活动id(针对参与活动) */ | ||
29 | @Transient | ||
30 | protected Long activityId; | ||
31 | |||
32 | /** 商品id */ | ||
33 | @Transient | ||
34 | protected Long itemId; | ||
35 | |||
36 | /** 行为事件类型 1:登录;2:观影;3:参与活动;4:订购;10:跨屏绑定;11:积分转移;98:系统操作;99:其他 */ | ||
37 | @Transient | ||
38 | protected Integer evtType; | ||
39 | |||
40 | } |
... | @@ -12,7 +12,7 @@ import com.topdraw.business.module.user.iptv.service.UserTvService; | ... | @@ -12,7 +12,7 @@ import com.topdraw.business.module.user.iptv.service.UserTvService; |
12 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; | 12 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; |
13 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; | 13 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; |
14 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | 14 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; |
15 | import com.topdraw.business.process.domian.TempIptvUser; | 15 | import com.topdraw.business.process.domian.TempCustomPointBean; |
16 | import com.topdraw.business.process.domian.TempPoints; | 16 | import com.topdraw.business.process.domian.TempPoints; |
17 | import com.topdraw.business.process.domian.result.CustomPointsResult; | 17 | import com.topdraw.business.process.domian.result.CustomPointsResult; |
18 | import com.topdraw.business.process.service.PointsOperationService; | 18 | import com.topdraw.business.process.service.PointsOperationService; |
... | @@ -38,7 +38,7 @@ import java.util.Objects; | ... | @@ -38,7 +38,7 @@ import java.util.Objects; |
38 | */ | 38 | */ |
39 | @Api(tags = "PointsOperation管理") | 39 | @Api(tags = "PointsOperation管理") |
40 | @RestController | 40 | @RestController |
41 | @RequestMapping("/api/pointsOperation") | 41 | @RequestMapping("/ucEngine/api/pointsOperation") |
42 | public class PointsOperationController { | 42 | public class PointsOperationController { |
43 | 43 | ||
44 | private static final Logger LOG = LoggerFactory.getLogger(PointsOperationController.class); | 44 | private static final Logger LOG = LoggerFactory.getLogger(PointsOperationController.class); |
... | @@ -108,9 +108,15 @@ public class PointsOperationController { | ... | @@ -108,9 +108,15 @@ public class PointsOperationController { |
108 | @Log | 108 | @Log |
109 | @PostMapping(value = "/customPointsByUserTvPlatformAccount") | 109 | @PostMapping(value = "/customPointsByUserTvPlatformAccount") |
110 | @ApiOperation("通过大屏账户积分消耗") | 110 | @ApiOperation("通过大屏账户积分消耗") |
111 | public ResultInfo customPointsByUserTvPlatformAccount(@Validated @RequestBody TempIptvUser tempIptvUser) { | 111 | public ResultInfo customPointsByUserTvPlatformAccount(@Validated @RequestBody TempCustomPointBean tempIptvUser) { |
112 | String platformAccount = tempIptvUser.getPlatformAccount(); | 112 | String platformAccount = tempIptvUser.getPlatformAccount(); |
113 | Long points = tempIptvUser.getPoints(); | 113 | Long points = tempIptvUser.getPoints(); |
114 | Long activityId = tempIptvUser.getActivityId(); | ||
115 | Integer evtType = tempIptvUser.getEvtType(); | ||
116 | Long mediaId = tempIptvUser.getMediaId(); | ||
117 | Long orderId = tempIptvUser.getOrderId(); | ||
118 | Integer deviceType = tempIptvUser.getDeviceType(); | ||
119 | |||
114 | 120 | ||
115 | TempPoints tempPoints = new TempPoints(); | 121 | TempPoints tempPoints = new TempPoints(); |
116 | UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); | 122 | UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); |
... | @@ -124,9 +130,12 @@ public class PointsOperationController { | ... | @@ -124,9 +130,12 @@ public class PointsOperationController { |
124 | tempPoints.setMemberId(memberId); | 130 | tempPoints.setMemberId(memberId); |
125 | } | 131 | } |
126 | tempPoints.setPoints(points); | 132 | tempPoints.setPoints(points); |
127 | tempPoints.setDeviceType(LocalConstants.DEVICE_VIS); | 133 | tempPoints.setDeviceType(deviceType); |
128 | tempPoints.setAppCode(LocalConstants.APP_CODE_CHONGQING_CHONGSHU_VIS); | 134 | tempPoints.setAppCode(LocalConstants.APP_CODE_CHONGQING_CHONGSHU_VIS); |
129 | tempPoints.setEvtType(LocalConstants.EVT_TYPE_ACTIVITY); | 135 | tempPoints.setEvtType(evtType); |
136 | tempPoints.setActivityId(activityId); | ||
137 | tempPoints.setMediaId(mediaId); | ||
138 | tempPoints.setOrderId(orderId); | ||
130 | return this.customPoints(tempPoints); | 139 | return this.customPoints(tempPoints); |
131 | } | 140 | } |
132 | 141 | ... | ... |
1 | package com.topdraw.business.process.rest; | 1 | package com.topdraw.business.process.rest; |
2 | 2 | ||
3 | import com.topdraw.annotation.AnonymousAccess; | ||
3 | import com.topdraw.annotation.Log; | 4 | import com.topdraw.annotation.Log; |
4 | import com.topdraw.business.process.domian.TempIptvUser; | 5 | import com.topdraw.business.process.domian.TempIptvUser; |
5 | import com.topdraw.business.process.service.TaskOperationService; | 6 | import com.topdraw.business.process.service.TaskOperationService; |
... | @@ -14,7 +15,7 @@ import java.util.Arrays; | ... | @@ -14,7 +15,7 @@ import java.util.Arrays; |
14 | 15 | ||
15 | @Api("任务处理") | 16 | @Api("任务处理") |
16 | @RestController | 17 | @RestController |
17 | @RequestMapping(value = "/api/TaskOperation") | 18 | @RequestMapping(value = "/ucEngine/api/taskOperation") |
18 | public class TaskOperationController { | 19 | public class TaskOperationController { |
19 | 20 | ||
20 | @Autowired | 21 | @Autowired |
... | @@ -28,6 +29,7 @@ public class TaskOperationController { | ... | @@ -28,6 +29,7 @@ public class TaskOperationController { |
28 | @Log | 29 | @Log |
29 | @PostMapping(value = "/dealTask") | 30 | @PostMapping(value = "/dealTask") |
30 | @ApiOperation("事件处理") | 31 | @ApiOperation("事件处理") |
32 | @AnonymousAccess | ||
31 | public void dealTask(@RequestBody @Validated TaskOperationQueryCriteria criteria) { | 33 | public void dealTask(@RequestBody @Validated TaskOperationQueryCriteria criteria) { |
32 | // 任务处理 | 34 | // 任务处理 |
33 | this.taskOperationService.dealTask(criteria.getContent()); | 35 | this.taskOperationService.dealTask(criteria.getContent()); | ... | ... |
1 | package com.topdraw.business.process.service.impl; | 1 | package com.topdraw.business.process.service.impl; |
2 | 2 | ||
3 | import com.alibaba.fastjson.JSONArray; | ||
3 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
4 | import com.topdraw.business.module.coupon.service.CouponService; | 5 | import com.topdraw.business.module.coupon.service.CouponService; |
5 | import com.topdraw.business.module.coupon.service.dto.CouponDTO; | 6 | import com.topdraw.business.module.coupon.service.dto.CouponDTO; |
... | @@ -91,7 +92,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -91,7 +92,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
91 | @Override | 92 | @Override |
92 | public ResultInfo dealTask(String content) { | 93 | public ResultInfo dealTask(String content) { |
93 | 94 | ||
94 | DataSyncMsg dataSyncMsg = JSONUtil.parseMsg2Object(content, DataSyncMsg.class); | 95 | DataSyncMsg dataSyncMsg = JSONUtil.parseMsg2Object(content, DataSyncMsg.class); |
95 | DataSyncMsg.MsgData msgData = dataSyncMsg.getMsg(); | 96 | DataSyncMsg.MsgData msgData = dataSyncMsg.getMsg(); |
96 | Integer event = msgData.getEvent(); | 97 | Integer event = msgData.getEvent(); |
97 | Long memberId = msgData.getMemberId(); | 98 | Long memberId = msgData.getMemberId(); |
... | @@ -107,16 +108,15 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -107,16 +108,15 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
107 | // 2.通过任务模板获取对应的任务列表 | 108 | // 2.通过任务模板获取对应的任务列表 |
108 | List<Task> taskList = this.loadListTaskByTaskTemplate(taskTemplate,dataSyncMsg); | 109 | List<Task> taskList = this.loadListTaskByTaskTemplate(taskTemplate,dataSyncMsg); |
109 | // 4.判断当前用户是否满足任务完成条件 | 110 | // 4.判断当前用户是否满足任务完成条件 |
110 | boolean checkResult = this.checkTaskCompletion(memberId,taskList); | 111 | /*boolean checkResult = this.checkTaskCompletion(memberId,taskList); |
111 | if (checkResult) { | 112 | if (checkResult) { |
112 | |||
113 | // 5.权益区分(积分、权益、成长值) | 113 | // 5.权益区分(积分、权益、成长值) |
114 | Map<RightType,Object> tempRightsMap = this.distinguishRight(memberId,taskList,msgData); | 114 | Map<RightType,Object> tempRightsMap = this.distinguishRight(memberId,taskList,msgData); |
115 | // 6.权益发放 | 115 | // 6.权益发放 |
116 | this.grantRight(tempRightsMap); | 116 | this.grantRight(tempRightsMap); |
117 | 117 | ||
118 | } | 118 | }*/ |
119 | 119 | System.out.println(taskList); | |
120 | return ResultInfo.success(); | 120 | return ResultInfo.success(); |
121 | 121 | ||
122 | } | 122 | } |
... | @@ -772,16 +772,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -772,16 +772,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
772 | List<Task> taskList = this.taskService.findByTemplateId(taskTemplateId); | 772 | List<Task> taskList = this.taskService.findByTemplateId(taskTemplateId); |
773 | 773 | ||
774 | Integer type = taskTemplate.getType(); | 774 | Integer type = taskTemplate.getType(); |
775 | switch (type) { | 775 | taskList = this.pickUpTask(taskList,dataSyncMsg,type); |
776 | // 订购 | ||
777 | case TaskTemplateType.TYPE_4: | ||
778 | taskList = this.pickUpTask(taskList,dataSyncMsg); | ||
779 | break; | ||
780 | |||
781 | default: | ||
782 | break; | ||
783 | } | ||
784 | |||
785 | return taskList; | 776 | return taskList; |
786 | 777 | ||
787 | } | 778 | } |
... | @@ -795,29 +786,57 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -795,29 +786,57 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
795 | * @param dataSyncMsg | 786 | * @param dataSyncMsg |
796 | * @return | 787 | * @return |
797 | */ | 788 | */ |
798 | private List<Task> pickUpTask(List<Task> taskList,DataSyncMsg dataSyncMsg) { | 789 | private List<Task> pickUpTask(List<Task> taskList,DataSyncMsg dataSyncMsg,Integer type) { |
799 | 790 | ||
800 | List<Task> taskList1 = new ArrayList<>(); | 791 | List<Task> taskList1 = new ArrayList<>(); |
801 | 792 | ||
802 | DataSyncMsg.TaskTemplateParam param = dataSyncMsg.getParam(); | 793 | DataSyncMsg.MsgData msgData = dataSyncMsg.getMsg(); |
794 | |||
795 | if (Objects.nonNull(msgData)) { | ||
803 | 796 | ||
804 | if (Objects.nonNull(param)) { | 797 | String param = msgData.getParam(); |
798 | Map<String,String> jsonObjectMap = JSONObject.parseObject(param,Map.class); | ||
799 | Collection<String> values = jsonObjectMap.values(); | ||
805 | 800 | ||
806 | String code = param.getCode(); | ||
807 | for (Task task : taskList) { | 801 | for (Task task : taskList) { |
802 | |||
808 | Long taskId = task.getId(); | 803 | Long taskId = task.getId(); |
809 | TaskAttrDTO taskAttrDTO = this.findTaskAttrByTaskId(taskId); | 804 | TaskAttrDTO taskAttrDTO = this.findTaskAttrByTaskId(taskId); |
805 | if (Objects.isNull(taskAttrDTO.getId())) | ||
806 | continue; | ||
807 | |||
810 | String attrStr = taskAttrDTO.getAttrStr(); | 808 | String attrStr = taskAttrDTO.getAttrStr(); |
811 | if (StringUtils.hasText(attrStr)) { | 809 | if (StringUtils.hasText(attrStr)) { |
812 | DataSyncMsg.TaskTemplateParam taskTemplateParam = JSONObject.parseObject(attrStr, DataSyncMsg.TaskTemplateParam.class); | 810 | JSONObject jsonObject = JSONObject.parseObject(attrStr); |
813 | if (Objects.nonNull(taskTemplateParam)) { | 811 | JSONArray values_0 = jsonObject.getJSONArray("value"); |
814 | String code1 = taskTemplateParam.getCode(); | 812 | |
815 | if (StringUtils.hasText(code1) && code.equalsIgnoreCase(code1)) { | 813 | switch (type) { |
816 | taskList1.add(task); | 814 | // 登录 |
817 | } | 815 | case TaskTemplateType.TYPE_1: |
816 | |||
817 | Integer o1 = (Integer)values_0.get(0); | ||
818 | Integer o2 = (Integer)values_0.get(1); | ||
819 | List<Integer> list = Arrays.asList(o1, o2); | ||
820 | String s = values.toArray()[0].toString(); | ||
821 | Integer i = Integer.valueOf(s); | ||
822 | boolean b = UcListUtils.compareIntegerList(i, list); | ||
823 | if (b) | ||
824 | taskList1.add(task); | ||
825 | break; | ||
826 | |||
827 | // 订购 | ||
828 | case TaskTemplateType.TYPE_4: | ||
829 | if (values_0.containsAll(values)) | ||
830 | taskList1.add(task); | ||
831 | break; | ||
832 | |||
833 | default: | ||
834 | break; | ||
818 | } | 835 | } |
819 | 836 | ||
837 | |||
820 | } | 838 | } |
839 | |||
821 | } | 840 | } |
822 | 841 | ||
823 | } else { | 842 | } else { |
... | @@ -855,11 +874,11 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -855,11 +874,11 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
855 | * @return TaskTemplate 任务模板 | 874 | * @return TaskTemplate 任务模板 |
856 | */ | 875 | */ |
857 | private TaskTemplate getTaskTemplate(Integer event,DataSyncMsg msgData) { | 876 | private TaskTemplate getTaskTemplate(Integer event,DataSyncMsg msgData) { |
858 | DataSyncMsg.TaskTemplateParam taskTemplateParam = msgData.getParam(); | 877 | DataSyncMsg.MsgData msg = msgData.getMsg(); |
859 | 878 | ||
860 | if (Objects.nonNull(taskTemplateParam)) { | 879 | if (Objects.nonNull(msg)) { |
861 | 880 | ||
862 | return this.findByTypeAndParam(event,taskTemplateParam); | 881 | return this.findByTypeAndParam(event,msg); |
863 | 882 | ||
864 | } else { | 883 | } else { |
865 | 884 | ||
... | @@ -878,28 +897,31 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -878,28 +897,31 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
878 | } | 897 | } |
879 | } | 898 | } |
880 | 899 | ||
881 | private TaskTemplate findByTypeAndParam(Integer event, DataSyncMsg.TaskTemplateParam taskTemplateParam) { | 900 | private TaskTemplate findByTypeAndParam(Integer event, DataSyncMsg.MsgData taskTemplateParam) { |
882 | String category = taskTemplateParam.getCategory(); | 901 | String param = taskTemplateParam.getParam(); |
883 | 902 | if (StringUtils.hasText(param)) { | |
884 | List<TaskTemplate> taskTemplateList = this.taskTemplateService.findByType(event); | ||
885 | if (!CollectionUtils.isEmpty(taskTemplateList)) { | ||
886 | 903 | ||
887 | for (TaskTemplate taskTemplate : taskTemplateList) { | 904 | Map<String,String> jsonObject = JSONObject.parseObject(param,Map.class); |
888 | 905 | ||
889 | String params = taskTemplate.getParams(); | 906 | List<TaskTemplate> taskTemplateList = this.taskTemplateService.findByType(event); |
890 | if(!StringUtils.isEmpty(params)) { | 907 | if (!CollectionUtils.isEmpty(taskTemplateList)) { |
891 | 908 | ||
892 | DataSyncMsg.TaskTemplateParam taskTemplateParam1 = JSONObject.parseObject(params,DataSyncMsg.TaskTemplateParam.class); | 909 | for (TaskTemplate taskTemplate : taskTemplateList) { |
893 | String category1 = taskTemplateParam1.getCategory(); | ||
894 | if (!StringUtils.isEmpty(category1) && category1.equalsIgnoreCase(category)) | ||
895 | return taskTemplate; | ||
896 | 910 | ||
897 | } | 911 | String templateParams = taskTemplate.getParams(); |
912 | if(StringUtils.hasText(templateParams)) { | ||
913 | String templateParamsUpperCase = templateParams.toUpperCase(); | ||
914 | boolean b = jsonObject.containsKey(templateParamsUpperCase); | ||
915 | if (b) | ||
916 | return taskTemplate; | ||
917 | } | ||
918 | } | ||
898 | 919 | ||
899 | } | 920 | } |
900 | 921 | ||
901 | } | 922 | } |
902 | 923 | ||
924 | |||
903 | return null; | 925 | return null; |
904 | } | 926 | } |
905 | 927 | ... | ... |
1 | package com.topdraw.util; | ||
2 | |||
3 | import com.alibaba.fastjson.JSONArray; | ||
4 | import com.alibaba.fastjson.JSONObject; | ||
5 | |||
6 | import java.util.Arrays; | ||
7 | import java.util.Collection; | ||
8 | import java.util.List; | ||
9 | import java.util.Map; | ||
10 | |||
11 | public class UcListUtils { | ||
12 | |||
13 | public static boolean compareIntegerList(Integer obj , List<Integer> originList){ | ||
14 | Integer o = originList.get(0); | ||
15 | Integer o1 = originList.get(1); | ||
16 | |||
17 | if (o >= 0 && o1 > o && obj >= o && obj <= o1) | ||
18 | return true; | ||
19 | |||
20 | if (o > 0 && o1 < 0 && obj >= o) | ||
21 | return true; | ||
22 | |||
23 | return false; | ||
24 | } | ||
25 | |||
26 | public static void main(String[] args) { | ||
27 | String param = "{CONTINUE_LOGIN:30}"; | ||
28 | Map<String,String> jsonObjectMap = JSONObject.parseObject(param,Map.class); | ||
29 | Collection<String> values = jsonObjectMap.values(); | ||
30 | Object o = values.toArray()[0]; | ||
31 | |||
32 | String attrStr = "{\"value\":[31,-99]}"; | ||
33 | JSONObject jsonObject = JSONObject.parseObject(attrStr); | ||
34 | JSONArray values_0 = jsonObject.getJSONArray("value"); | ||
35 | Integer o1 = (Integer)values_0.get(0); | ||
36 | Integer o2 = (Integer)values_0.get(1); | ||
37 | List<Integer> list = Arrays.asList(o1, o2); | ||
38 | Integer i = (Integer) o; | ||
39 | boolean b = compareIntegerList(i, list); | ||
40 | System.out.println(b); | ||
41 | } | ||
42 | |||
43 | } |
... | @@ -10,6 +10,9 @@ import org.springframework.boot.test.context.SpringBootTest; | ... | @@ -10,6 +10,9 @@ import org.springframework.boot.test.context.SpringBootTest; |
10 | import org.springframework.test.context.junit4.SpringRunner; | 10 | import org.springframework.test.context.junit4.SpringRunner; |
11 | 11 | ||
12 | import java.sql.Timestamp; | 12 | import java.sql.Timestamp; |
13 | import java.util.Collection; | ||
14 | import java.util.HashMap; | ||
15 | import java.util.Map; | ||
13 | 16 | ||
14 | @SpringBootTest(classes= MemberServiceApplication.class) | 17 | @SpringBootTest(classes= MemberServiceApplication.class) |
15 | @RunWith(SpringRunner.class) | 18 | @RunWith(SpringRunner.class) |
... | @@ -26,9 +29,23 @@ public class BaseTest { | ... | @@ -26,9 +29,23 @@ public class BaseTest { |
26 | } | 29 | } |
27 | 30 | ||
28 | public static void main(String[] args) { | 31 | public static void main(String[] args) { |
29 | String param = "{\"category\":\"common_member\"}"; | 32 | /* Map<String,Integer> map = new HashMap<>(); |
30 | DataSyncMsg.TaskTemplateParam taskTemplateParam = JSONObject.parseObject(param, DataSyncMsg.TaskTemplateParam.class); | 33 | map.put("1",1); |
31 | System.out.println(taskTemplateParam); | 34 | map.put("2",15); |
35 | |||
36 | int i = 5; | ||
37 | |||
38 | Object[] objects = map.values().toArray(); | ||
39 | Integer object0 = (Integer) objects[0]; | ||
40 | Integer object1 = (Integer) objects[1]; | ||
41 | |||
42 | if (i > object0 && i < object1) | ||
43 | System.out.println(true);*/ | ||
44 | |||
45 | |||
46 | String param = "{\"GOODS\":\"aabbccddeeff\"}"; | ||
47 | Map<String,String> jsonObject = JSONObject.parseObject(param,Map.class); | ||
48 | System.out.println(jsonObject); | ||
32 | } | 49 | } |
33 | 50 | ||
34 | 51 | ... | ... |
-
Please register or sign in to post a comment