Commit a343197f by 罗承锋

预制卡批量导入智能平台下单

parent bd51c616
......@@ -112,6 +112,11 @@ public class Order implements Serializable{
private Date createTime;
/**
* 订单更新状态时间
*/
private Date updateTime;
/**
* 订单完成时间
*/
private Date successTime;
......@@ -320,7 +325,18 @@ public class Order implements Serializable{
private Date rhTime;
/**
* 年级
*/
private String clazz;
/**
* 多媒体账号
*/
private String dmtNumber;
/**
* 签名协议图片路径
*/
private String signImg;
}
......@@ -164,7 +164,8 @@ public class PackageNewClothes {
, @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
, @RequestParam(value = "idCard") String idCard, @RequestParam(value = "userSchool") String userSchool,@RequestParam(value = "isFromRh", required = false) String isFromRh) {
, @RequestParam(value = "idCard") String idCard
,@RequestParam(value = "clazz") String clazz, @RequestParam(value = "userSchool") String userSchool,@RequestParam(value = "isFromRh", required = false) String isFromRh) {
if (contactNumber.length() != 11) {
return ResponseData.error("联系号码有误,请重新输入");
}
......@@ -222,6 +223,7 @@ public class PackageNewClothes {
order.setSite(site);
order.setKapin(kapin);
order.setPackageId(cardId);
order.setClazz(clazz);
order.setCustomerName(customerName);
order.setContactNumber(contactNumber);
order.setStudenCard(PicturesUtil.uploadPictures(studentCard, orderNum,PATHTYPE));
......
......@@ -15,10 +15,11 @@ import com.winsun.auth.core.common.model.ResponseData;
import com.winsun.auth.core.shiro.ShiroUser;
import com.winsun.auth.core.util.IOUtils;
import com.winsun.bean.*;
import com.winsun.constant.FilePath;
import com.winsun.mapper.*;
import com.winsun.rabbitmq.RabbitProducer;
import com.winsun.utils.*;
import com.winsun.utils.Constant;
import com.winsun.utils.*;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
......@@ -39,10 +40,11 @@ import org.apache.http.util.EntityUtils;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.util.CellRangeAddressList;
import org.apache.poi.xssf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.net.ssl.SSLHandshakeException;
......@@ -68,6 +70,8 @@ import java.util.regex.Pattern;
@RequestMapping("/order")
public class OrderController extends BaseController {
private final String GATEWAY = "http://localhost:10001/";
/**
* 导入
*/
......@@ -105,9 +109,6 @@ public class OrderController extends BaseController {
private ExportExcelMapper exportExcelMapper;
protected ThreadPoolTaskExecutor threadPool;
@Autowired
private RabbitProducer taskImport;
......@@ -156,7 +157,6 @@ public class OrderController extends BaseController {
} else {
appMapper.inserOrderHis(id, "审核不通过:" + checkFail, new Date(), user.getName());
}
} else {
return ResponseData.error("审核失败!");
}
......@@ -950,7 +950,7 @@ public class OrderController extends BaseController {
}
int number = 0;
Date successTime = new Date();
Integer integer = null;
Integer integer = 0;
for (int i = 1; i < listMap.size(); i++) {
Map<String, Object> map = listMap.get(i);
String orderNumber = map.get("a").toString();
......@@ -965,16 +965,15 @@ public class OrderController extends BaseController {
map1.put("business_iccid",iccid);
map1.put("send_type", "快递");
map1.put("order_status", "提交中");
threadPool.execute(new Runnable() {
@Override
new Thread(new Runnable() {
public void run() {
String id = map1.get("id").toString();
Map<String, Object> orderMap = orderMapper.selectOrderById(map1.get("id").toString());
String hehuoren_id = orderMap.get("hehuoren_id").toString();
String business_number = orderMap.get("business_number").toString();
String business_iccid = orderMap.get("business_iccid").toString();
Order orderData = orderMapper.selectById(map1.get("id").toString());
String hehuoren_id = orderData.getHehuorenId();
String business_number = orderData.getBusinessNumber();
String business_iccid = orderData.getBusinessIccid();
Map<String, Object> partnerById = orderMapper.findPartnerById(hehuoren_id);
String name = partnerById.get("name").toString();
String name = orderData.getHehuorenName();
Map<String, Object> map1 = new HashMap<>();
int ysm = Integer.parseInt(partnerById.get("ysm").toString());
......@@ -982,23 +981,23 @@ public class OrderController extends BaseController {
map1.put("ysmUser",ysmById.get("user_name"));
map1.put("sign",ysmById.get("sign"));
map1.put("idCardUrl1", orderMap.get("id_cardz"));
map1.put("idCardUrl2", orderMap.get("id_cardf"));
map1.put("idCardUrl3", orderMap.get("id_cardzs"));
map1.put("idCardUrl4", orderMap.get("id_cardzs"));
map1.put("cardType", orderMap.get("kapin"));
map1.put("idCardUrl1", orderData.getIdCardz());
map1.put("idCardUrl2", orderData.getIdCardf());
map1.put("idCardUrl3", orderData.getIdCardzs());
map1.put("idCardUrl4", orderData.getIdCardzs());
map1.put("cardType", orderData.getKapin());
if(orderMap.get("package_id").equals("49")){
map1.put("userName", orderMap.get("parent_name"));
if(orderData.getPackageId().equals("49")){
map1.put("userName", orderData.getParentName());
}else{
map1.put("userName", orderMap.get("customer_name"));
map1.put("userName", orderData.getCustomerName());
}
map1.put("linkPhone", orderMap.get("contact_number"));
map1.put("idCard", orderMap.get("id_card"));
map1.put("linkPhone", orderData.getContactNumber());
map1.put("idCard", orderData.getIdCard());
map1.put("orderPhone", business_number);
map1.put("iccId", business_iccid);
String site = orderMap.get("site").toString();
String site = orderData.getSite();
String[] split = site.split(" ");
......@@ -1006,28 +1005,24 @@ public class OrderController extends BaseController {
map1.put("shi",split[1]);
map1.put("xian",split[2]);
map1.put("address",orderMap.get("address"));
map1.put("address",orderData.getAddress());
String result="";
result = sendOrder(map1);
JSONObject resultDataJson = JSONObject.fromObject(result);
String orderNum = resultDataJson.getString("orderNumber");
Map<String,Object> map3 = new HashMap<>();
Order order = new Order();
order.setId(id);
order.setUpdateTime(new Date());
if (Is.isNoEmpty(orderNum)) {
map3.put("id", id);
map3.put("send_type", "快递");
map3.put("order_status", "审核中");
map3.put("order_id",orderNum);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
map3.put("update_time", sdf.format(new Date()));
order.setSendType("快递");
order.setOrderStatus("审核中");
order.setOrderId(orderNum);
}else{
map3.put("id", id);
map3.put("order_status", "异常单");
order.setOrderStatus("异常单");
String msg = resultDataJson.getString("msg");
map3.put("msg",msg);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
map3.put("update_time", sdf.format(new Date()));
order.setMsg(msg);
try {
orderMapper.inserOrderHis(id,"审核失败",new Date(),"智能平台审核");
} catch (Exception e) {
......@@ -1035,13 +1030,14 @@ public class OrderController extends BaseController {
}
}
try {
// basemapper.update("hhr_order",map3);
Wrapper<Order> wrapper = new EntityWrapper<>();
wrapper.eq("id", order.getId());
orderMapper.update(order, wrapper);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}).start();
int num = 0;
try {
// num = basemapper.update("hhr_order",map1) > 0 ? 1 : 0;
......@@ -1271,7 +1267,7 @@ public class OrderController extends BaseController {
CloseableHttpClient httpclient = HttpClients.custom().setDefaultRequestConfig(defaultRequestConfig).build();
log.info("移动下单前已有参数:" + JSONObject.fromObject(map).toString());
String resultStr = "";
HttpEntity entity = null;
......@@ -1462,6 +1458,9 @@ public class OrderController extends BaseController {
// 将对象装换为json字符串
String productJson = JSONArray.fromObject(productList).toString();
log.info("移动下单产品参数:" + productJson);
try {
builder.addTextBody("productJson", URLEncoder.encode(productJson, "UTF-8"), contentType);// 产品信息,必填
signMap.put("productJson", URLEncoder.encode(productJson, "UTF-8"));
......@@ -1471,13 +1470,13 @@ public class OrderController extends BaseController {
}
//身份证正面,选填
File file1 = new File((String) map.get("imgUrl1"));
File file1 = new File(map.get("imgUrl1").toString().replace("manager/ciop", FilePath.BACKGROUNDIMG.getValue()).replace("\\", "/"));
//身份证背面,选填
File file2 = new File((String) map.get("imgUrl2"));
File file2 = new File(map.get("imgUrl2").toString().replace("manager/ciop", FilePath.BACKGROUNDIMG.getValue()).replace("\\", "/"));
//手持证件,选填
File file3 = new File((String) map.get("imgUrl3"));
File file3 = new File(map.get("imgUrl3").toString().replace("manager/ciop", FilePath.BACKGROUNDIMG.getValue()).replace("\\", "/"));
//手持证件2,选填
File file4 = new File((String) map.get("imgUrl4"));
File file4 = new File(map.get("imgUrl4").toString().replace("manager/ciop", FilePath.BACKGROUNDIMG.getValue()).replace("\\", "/"));
if (file1 != null) {
ContentBody sfzzmFile = new FileBody(file1);
......@@ -1508,10 +1507,11 @@ public class OrderController extends BaseController {
plaintext = plaintext.concat((String) map.get("sign"));
String sign = Md5.encryption(plaintext);// md5加密
builder.addTextBody("sign", sign, contentType);// 签名,必填
log.info("移动智能平台下单参数:" + plaintext);
try {
//httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
......
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