|
|
@@ -4,23 +4,24 @@ import cn.hutool.extra.qrcode.BufferedImageLuminanceSource;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.zxing.*;
|
|
|
import com.google.zxing.common.HybridBinarizer;
|
|
|
+import com.skyversation.xjcy.bean.Lcxm;
|
|
|
import com.skyversation.xjcy.bean.User;
|
|
|
import com.skyversation.xjcy.dms.DMSColumn;
|
|
|
import com.skyversation.xjcy.dms.DMSService;
|
|
|
import com.skyversation.xjcy.service.AlyOCRService;
|
|
|
import com.skyversation.xjcy.service.AuthService;
|
|
|
+import com.skyversation.xjcy.service.MessageService;
|
|
|
import com.skyversation.xjcy.service.WeChatService;
|
|
|
import com.skyversation.xjcy.util.MessageManage;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.imageio.ImageIO;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
import java.awt.image.BufferedImage;
|
|
|
import java.io.File;
|
|
|
import java.io.InputStream;
|
|
|
@@ -38,12 +39,14 @@ public class OtherController {
|
|
|
private final AuthService authService;
|
|
|
private final DMSService dMSService;
|
|
|
private final AlyOCRService alyOCRService;
|
|
|
+ private final MessageService messageService;
|
|
|
|
|
|
- public OtherController(WeChatService weChatService, AuthService authService, DMSService dMSService, AlyOCRService alyOCRService) {
|
|
|
+ public OtherController(WeChatService weChatService, AuthService authService, DMSService dMSService, AlyOCRService alyOCRService, MessageService messageService) {
|
|
|
this.weChatService = weChatService;
|
|
|
this.authService = authService;
|
|
|
this.dMSService = dMSService;
|
|
|
this.alyOCRService = alyOCRService;
|
|
|
+ this.messageService = messageService;
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/wxacode", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
|
|
@@ -124,4 +127,23 @@ public class OtherController {
|
|
|
return MessageManage.error(-1,"解析二维码失败");
|
|
|
}
|
|
|
}
|
|
|
+ @PostMapping(value = "/lcxm")
|
|
|
+ public String lcxm(@RequestParam Map<String,String> map, HttpServletRequest request) {
|
|
|
+ String token = request.getHeader("token");
|
|
|
+ if (!authService.checkToken(token)) {return MessageManage.error(-1,"不可用的token");}
|
|
|
+ boolean success = dMSService.insertToDms(map, token, DMSColumn.LCXM);
|
|
|
+ if (success) {
|
|
|
+ String type = map.get("c_service_type");
|
|
|
+ String[] types = type.split(",");
|
|
|
+ String[] readAbleTypes = new String[types.length];
|
|
|
+ for (int i = 0; i < types.length; i++) {
|
|
|
+ readAbleTypes[i] = Lcxm.ServiceCategory.getById(Integer.parseInt(types[i])).getName();
|
|
|
+ }
|
|
|
+ type = String.join(",", readAbleTypes);
|
|
|
+ messageService.noticeLcxm(type,map.get("c_phone"),map.get("c_name"));
|
|
|
+ return MessageManage.successWithNoData("成功");
|
|
|
+ }else {
|
|
|
+ return MessageManage.error(-1,"未知错误");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|