打卡优化
This commit is contained in:
		| @@ -10,6 +10,7 @@ import com.stdiet.custom.mapper.SysNutritionQuestionMapper; | ||||
| import com.stdiet.custom.mapper.SysWxUserInfoMapper; | ||||
| import com.stdiet.custom.mapper.SysWxUserLogMapper; | ||||
| import com.stdiet.custom.service.ISysNutritionQuestionService; | ||||
| import com.stdiet.custom.service.ISysWxUserLogService; | ||||
| import com.stdiet.custom.utils.LuceneIndexUtils; | ||||
| import com.stdiet.framework.web.domain.server.Sys; | ||||
| import org.apache.lucene.document.Document; | ||||
| @@ -37,6 +38,9 @@ public class MyApplicationRunner implements ApplicationRunner { | ||||
|     @Autowired | ||||
|     private ISysNutritionQuestionService sysNutritionQuestionService; | ||||
|  | ||||
|     @Autowired | ||||
|     private ISysWxUserLogService sysWxUserLogService; | ||||
|  | ||||
|     @Override | ||||
|     public void run(ApplicationArguments args) throws Exception { | ||||
|         System.out.println("项目启动调用方法"); | ||||
| @@ -47,7 +51,6 @@ public class MyApplicationRunner implements ApplicationRunner { | ||||
|         sysNutritionQuestion.setKey("猝死"); | ||||
|         sysNutritionQuestionService.insertSysNutritionQuestion(sysNutritionQuestion);*/ | ||||
|  | ||||
|  | ||||
|     } | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -33,6 +33,7 @@ import java.util.*; | ||||
| @RestController | ||||
| @RequestMapping("/custom/wxUserLog") | ||||
| public class SysWxUserLogController extends BaseController { | ||||
|  | ||||
|     @Autowired | ||||
|     private ISysWxUserLogService sysWxUserLogService; | ||||
|  | ||||
|   | ||||
| @@ -132,7 +132,7 @@ public class WechatAppletController extends BaseController { | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             for (WxLogInfo wxLogInfo : list) { | ||||
|             /*for (WxLogInfo wxLogInfo : list) { | ||||
|                 Map<String, List<String>> imageUrlMap = new HashMap<>(); | ||||
|  | ||||
|                 List<String> breakfastImagesUrlList = StringUtils.isNotEmpty(wxLogInfo.getBreakfastImages()) ? Arrays.asList(wxLogInfo.getBreakfastImages().split("\\|")) : new ArrayList<>(); | ||||
| @@ -158,7 +158,7 @@ public class WechatAppletController extends BaseController { | ||||
|                 wxLogInfo.setDinnerImagesUrl(downUrlList.get("dinnerImages")); | ||||
|                 wxLogInfo.setExtraMealImagesUrl(downUrlList.get("extraMealImages")); | ||||
|                 wxLogInfo.setBodyImagesUrl(downUrlList.get("bodyImages")); | ||||
|             } | ||||
|             }*/ | ||||
|  | ||||
|             Collections.reverse(list); | ||||
|             TableDataInfo tableDataInfo = getDataTable(list); | ||||
| @@ -202,6 +202,47 @@ public class WechatAppletController extends BaseController { | ||||
|         return toAjax(sysWxUserLogService.insertSysWxUserLog(sysWxUserLog)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 获取微信用户记录详细信息 | ||||
|      */ | ||||
|     @GetMapping(value = "/getPunchLogDetail/{id}") | ||||
|     public AjaxResult getPunchLogDetail(@PathVariable("id") String id) { | ||||
|         WxLogInfo sysWxUserLog = null; | ||||
|         //根据ID查询 | ||||
|         SysWxUserLog param = new SysWxUserLog(); | ||||
|         param.setId(Long.parseLong(id)); | ||||
|         sysWxUserLog = sysWxUserLogService.getWxLogInfoDetailById(param); | ||||
|         if(sysWxUserLog == null){ | ||||
|             return AjaxResult.error("打卡记录不存在"); | ||||
|         } | ||||
|         Map<String, List<String>> imageUrlMap = new HashMap<>(); | ||||
|         List<String> breakfastImagesUrlList = StringUtils.isNotEmpty(sysWxUserLog.getBreakfastImages()) ? Arrays.asList(sysWxUserLog.getBreakfastImages().split("\\|")) : new ArrayList<>(); | ||||
|         imageUrlMap.put("breakfastImages", breakfastImagesUrlList); | ||||
|  | ||||
|         List<String> lunchImagesUrlList = StringUtils.isNotEmpty(sysWxUserLog.getLunchImages()) ? Arrays.asList(sysWxUserLog.getLunchImages().split("\\|")) : new ArrayList<>(); | ||||
|         imageUrlMap.put("lunchImages", lunchImagesUrlList); | ||||
|  | ||||
|         List<String> dinnerImagesUrlList = StringUtils.isNotEmpty(sysWxUserLog.getDinnerImages()) ? Arrays.asList(sysWxUserLog.getDinnerImages().split("\\|")) : new ArrayList<>(); | ||||
|         imageUrlMap.put("dinnerImages", dinnerImagesUrlList); | ||||
|  | ||||
|         List<String> extraMealImagesUrlList = StringUtils.isNotEmpty(sysWxUserLog.getExtraMealImages()) ? Arrays.asList(sysWxUserLog.getExtraMealImages().split("\\|")) : new ArrayList<>(); | ||||
|         imageUrlMap.put("extraMealImages", extraMealImagesUrlList); | ||||
|  | ||||
|         List<String> bodyImagesUrlList = StringUtils.isNotEmpty(sysWxUserLog.getBodyImages()) ? Arrays.asList(sysWxUserLog.getBodyImages().split("\\|")) : new ArrayList<>(); | ||||
|         imageUrlMap.put("bodyImages", bodyImagesUrlList ); | ||||
|  | ||||
|         //生成预览链接 | ||||
|         Map<String,List<String>> downUrlList = AliyunOSSUtils.generatePresignedUrl(imageUrlMap); | ||||
|  | ||||
|         sysWxUserLog.setBreakfastImagesUrl(downUrlList.get("breakfastImages")); | ||||
|         sysWxUserLog.setLunchImagesUrl(downUrlList.get("lunchImages")); | ||||
|         sysWxUserLog.setDinnerImagesUrl(downUrlList.get("dinnerImages")); | ||||
|         sysWxUserLog.setExtraMealImagesUrl(downUrlList.get("extraMealImages")); | ||||
|         sysWxUserLog.setBodyImagesUrl(downUrlList.get("bodyImages")); | ||||
|  | ||||
|         return AjaxResult.success(sysWxUserLog); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 处理返回值的ID加密 | ||||
|      * @param list | ||||
|   | ||||
		Reference in New Issue
	
	Block a user