Commit e6a09777 by 黄森林

移动端开发提交

parent df3ddfd9
package com.winsun.utils;
import lombok.extern.slf4j.Slf4j;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Base64;
import java.util.Date;
/**
* @Author: chancy
* @Date: 2020/3/12 14:33
*/
@Slf4j
public class PicturesUtil {
/**
* 上传图片
*
* 前端传来图片必须为jpeg格式
*
* @param file 图片字符串
* @param path 图片文件夹名
* @return
*/
public static String uploadPictures(String file,String path) {
Date date = new Date();
SimpleDateFormat yyMM = new SimpleDateFormat("yyMM");
String y = yyMM.format(date.getTime());
SimpleDateFormat yyMMdd = new SimpleDateFormat("yyMMdd");
String h = yyMMdd.format(date.getTime());
String filePath = null;
String[] multipartFiles = new String[]{file};
for (int i = 0; i < multipartFiles.length; i++) {
if (!multipartFiles[i].isEmpty()) {
String base64Data = multipartFiles[i].split(",")[1];
String houzhui = multipartFiles[i].split(",")[0].split("/")[1].split(";")[0];
/**
* 2.解码成字节数组
*/
// filePath = FilePath.IDCARD.getValue() + y + "/" + h + "/" + path + "/" + date.getTime() + "." + houzhui;
filePath = "C:\\Users\\asus\\Desktop\\新建文件夹\\" + date.getTime()+ "." + houzhui;
Base64.Decoder decoder = Base64.getDecoder();
byte[] bytes = decoder.decode(base64Data);
FileOutputStream fos = null;
try {
fos = new FileOutputStream(filePath);
fos.write(bytes);
} catch (IOException e) {
log.info("图片上传异常");
e.printStackTrace();
} finally {
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
log.info("图片上传异常");
e.printStackTrace();
}
}
}
}
}
return filePath;
}
}
......@@ -78,7 +78,7 @@ public class XbkUtil {
public static JSONObject idCardCheckJT0005(String idCard,String customerName) throws Exception {
Map<String, Object> map = new HashMap<>();
map.put("custName", customerName);
map.put("idCardNo", idCard);
map.put("idCard", idCard);
String type = "JT0005";
JSONObject jsonObject = XbkUtil.xbkCreate(map, type);
return jsonObject;
......
......@@ -14,6 +14,7 @@ import com.winsun.constant.OrderStatus;
import com.winsun.constant.UserType;
import com.winsun.mapper.*;
import com.winsun.utils.FileUtil;
import com.winsun.utils.PicturesUtil;
import com.winsun.utils.XbkUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -23,6 +24,8 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -114,7 +117,8 @@ public class PackageNewClothes {
/**
* 新开手机卡 预制卡
*
* @param site 地址
* @param site 省市县
* @param address 详细地址
* @param kapin 套餐名
* @param idCardz 身份证正面地址
* @param idCardf 身份证反面地址
......@@ -131,7 +135,7 @@ public class PackageNewClothes {
*/
@RequestMapping(value = "newMobilePhoneCard", method = RequestMethod.POST)
public ResponseData<String> newMobilePhoneCard(@RequestParam("contactNumber") String contactNumber, @RequestParam("site") String site
, @RequestParam("studentCard") String studentCard, @RequestParam("cardId") String cardId
, @RequestParam("studentCard") String studentCard, @RequestParam("address") String address, @RequestParam("cardId") String cardId
, @RequestParam("customerName") String customerName, @RequestParam("partner") String partner
, @RequestParam(value = "idCardzs") String idCardzs, @RequestParam(value = "idCardz") String idCardz, @RequestParam(value = "idCardf") String idCardf
, @RequestParam(value = "remarks", required = false) String remarks, @RequestParam(value = "kapin") String kapin
......@@ -151,11 +155,8 @@ public class PackageNewClothes {
if (jsonObject == null) {
return ResponseData.error("身份证验证失败。");
}
if ("1".equals(jsonObject.getString("code"))) {
return ResponseData.error("姓名和身份证信息不匹配。");
}
if (!"0".equals(jsonObject.getString("code"))) {
return ResponseData.error("身份证验证失败。");
return ResponseData.error(jsonObject.getString("msg"));
}
Integer i = Integer.parseInt(idCard.substring(6, 10));
DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
......@@ -183,10 +184,12 @@ public class PackageNewClothes {
}
SysUser sysUser = userMapper.selectById(partner);
Order order = new Order();
String id = UUID.randomUUID().toString();
order.setId(id.split("-")[0]+id.split("-")[1]);
String uuid = UUID.randomUUID().toString();
String id=uuid.split("-")[0]+uuid.split("-")[1];
order.setId(id);
order.setIdCard(idCard);
order.setOrderStatus("待处理");
order.setAddress(address);
order.setUserSchool(userSchool);
order.setHehuorenId(partner);
order.setSite(site);
......@@ -194,10 +197,10 @@ public class PackageNewClothes {
order.setPackageId(cardId);
order.setCustomerName(customerName);
order.setContactNumber(contactNumber);
order.setIdCardzs(idCardzs);
order.setIdCardz(idCardz);
order.setIdCardf(idCardf);
order.setStudenCard(studentCard);
order.setStudenCard(PicturesUtil.uploadPictures(studentCard, partner));
order.setIdCardzs(PicturesUtil.uploadPictures(idCardzs, partner));
order.setIdCardz(PicturesUtil.uploadPictures(idCardz, partner));
order.setIdCardf(PicturesUtil.uploadPictures(idCardf, partner));
order.setRemarks(remarks);
Date date = new Date();
order.setCreateTime(date);
......@@ -216,7 +219,7 @@ public class PackageNewClothes {
// MessageUtil.sent(contactNumber,"4","");
if (insert == 1) {
appMapper.inserOrderHis(id, "资料已提交", date,sysUser.getName());
appMapper.inserOrderHis(id, "资料已提交", date, sysUser.getName());
return ResponseData.success(id);
}
return ResponseData.error("开卡失败!");
......@@ -267,11 +270,8 @@ public class PackageNewClothes {
log.info("身份证验证接口调用异常");
return ResponseData.error("身份证验证失败。");
}
if ("1".equals(jsonObject1.getString("code"))) {
return ResponseData.error("姓名和身份证信息不匹配。");
}
if (!"0".equals(jsonObject1.getString("code"))) {
return ResponseData.error("身份证验证失败。");
return ResponseData.error(jsonObject1.getString("msg"));
}
Integer i = Integer.parseInt(idCard.substring(6, 10));
DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
......@@ -299,8 +299,9 @@ public class PackageNewClothes {
}
SysUser sysUser = userMapper.selectById(partner);
Order order = new Order();
String id = UUID.randomUUID().toString();
order.setId(id.split("-")[0]+id.split("-")[1]);
String uuid = UUID.randomUUID().toString();
String id=uuid.split("-")[0]+uuid.split("-")[1];
order.setId(id);
order.setIdCard(idCard);
order.setOrderStatus("待处理");
order.setUserSchool(userSchool);
......@@ -310,9 +311,10 @@ public class PackageNewClothes {
order.setPackageId(cardId);
order.setCustomerName(customerName);
order.setContactNumber(contactNumber);
order.setIdCardzs(idCardzs);
order.setIdCardz(idCardz);
order.setIdCardf(idCardf);
//图片处理
order.setIdCardzs(PicturesUtil.uploadPictures(idCardzs, partner));
order.setIdCardz(PicturesUtil.uploadPictures(idCardz, partner));
order.setIdCardf(PicturesUtil.uploadPictures(idCardf, partner));
order.setRemarks(remarks);
order.setClassNumber(classNumber);
order.setParentName(parentName);
......@@ -332,9 +334,8 @@ public class PackageNewClothes {
order.setHehuorenPhone(sysUser.getPhone());
Integer insert = orderMapper.insert(order);
// MessageUtil.sent(contactNumber,"4","");
if (insert == 1) {
appMapper.inserOrderHis(id, "资料已提交", date,sysUser.getName());
appMapper.inserOrderHis(id, "资料已提交", date, sysUser.getName());
return ResponseData.success(id);
}
return ResponseData.error("开卡失败!");
......@@ -433,8 +434,9 @@ public class PackageNewClothes {
}
SysUser sysUser = userMapper.selectById(partner);
Order order = new Order();
String id = UUID.randomUUID().toString();
order.setId(id.split("-")[0]+id.split("-")[1]);
String uuid = UUID.randomUUID().toString();
String id=uuid.split("-")[0]+uuid.split("-")[1];
order.setId(id);
order.setIdCard(idCard);
order.setXbOrderId(map.get("orderCode").toString());
order.setOrderStatus("待识别");
......@@ -468,29 +470,11 @@ public class PackageNewClothes {
// MessageUtil.sent(contactNumber,"4","");
if (insert == 1) {
appMapper.inserOrderHis(id, "资料提交成功,等待上传证件", date,sysUser.getName());
appMapper.inserOrderHis(id, "资料提交成功,等待上传证件", date, sysUser.getName());
return ResponseData.success(id);
}
return ResponseData.error("开卡失败!");
}
/**
* 上传图片
*
* @param file
* @return
*/
@RequestMapping(value = "uploadPictures/{partner}", method = RequestMethod.POST)
public ResponseData<String> uploadPictures(@RequestParam(value = "file") MultipartFile file, @RequestParam("partner") String partner) {
Date date = new Date();
String originalFilename = file.getOriginalFilename();
String picturesType = originalFilename.substring(originalFilename.indexOf("."), originalFilename.length());
String backgroundpath = FilePath.IDCARD.getValue() + partner;
String fileName = date.getTime() + picturesType;
boolean makefile = FileUtil.makefile(backgroundpath, file, fileName);
if (!makefile) {
return ResponseData.error("上传失败!");
}
return ResponseData.success(backgroundpath + "/" + fileName, "上传成功");
}
}
......@@ -19,6 +19,8 @@ server:
uri-encoding: UTF-8
max-threads: 200
max-connections: 2000
jetty:
max-http-post-size: 1000000
winsun:
app:
version: @project.version@
......
......@@ -17,6 +17,8 @@ server:
uri-encoding: UTF-8
max-threads: 200
max-connections: 2000
jetty:
max-http-post-size: 1000000
winsun:
app:
version: @project.version@
......
......@@ -72,6 +72,9 @@ public class ChooseController {
@RequestMapping(value = "selectUserInfo", method = RequestMethod.POST)
public ResponseData<Map<String, Object>> selectUserInfo(@RequestParam("partner") String partner) {
SysUser sysUser = userMapper.selectById(partner);
if(sysUser==null){
return ResponseData.error("没有查到用户信息!");
}
String schoolId = appMapper.selectSchoolId(partner);
String schoolName = appMapper.selectSchoolById(schoolId);
Map<String, Object> map = new HashMap<>();
......
......@@ -223,8 +223,9 @@ public class PackageUpgradeController extends BaseController {
PackageUpgrade packageUpgrade = appMapper.selectById(servId);
SysUser sysUser = userMapper.selectById(partner);
Order order = new Order();
String id = UUID.randomUUID().toString();
order.setId(id.split("-")[0]+id.split("-")[1]);
String uuid = UUID.randomUUID().toString();
String id=uuid.split("-")[0]+uuid.split("-")[1];
order.setId(id);
order.setIdCard(packageUpgrade.getSocialId());
order.setOrderStatus(OrderStatus.PENDINGACCEPTANCE.getName());
order.setHehuorenId(partner);
......@@ -252,9 +253,10 @@ public class PackageUpgradeController extends BaseController {
appMapper.inserOrderHis(id, "下单成功", date,sysUser.getName());
// MessageUtil.sent(contactNumber,"4","");
if (StringUtils.isNotBlank(mark)) {
String id1 = UUID.randomUUID().toString();
order.setId(id1.split("-")[0]+id1.split("-")[1]);
String uuid1 = UUID.randomUUID().toString();
String id1=uuid1.split("-")[0]+uuid1.split("-")[1];
String s1 = String.valueOf((int) ((Math.random() * 9 + 1) * 1000));
order.setId(id1);
order.setOrderNumber("YRYM" + format + s1);
order.setUserType(UserType.YCTK.getId());
order.setAddress(addRess);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment