Commit 668ceffa by 伍思炜

导出移动订单清单2.0

parent f5807ce8
......@@ -233,4 +233,5 @@ public class School implements Serializable {
@TableField("app_key")
private String appKey;
}
......@@ -3,6 +3,7 @@ package com.winsun.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.winsun.bean.School;
import com.winsun.bean.Schools;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
......@@ -65,4 +66,6 @@ public interface SchoolMapper extends BaseMapper<School> {
int updateSchoolMap(Map<String,Object> map);
int insertNetworkInfo(Map<String,Object> map);
List<Schools> selectHhrSchool();
}
......@@ -7,6 +7,11 @@
select * from hhr_school where sub_name = #{subName} and school_name = #{schoolName}
</select>
<select id="selectHhrSchool" resultType="com.winsun.bean.Schools">
select hus.user_id userId,hs.* FROM hhr_user_school hus LEFT JOIN hhr_school hs
on hs.id = hus.school_id
</select>
<insert id="insertSchoolMap">
INSERT INTO hhr_school
(sub_name,school_name,status,bandproduct_id,net_id,lzgh,lz_user,network_code,network_name,app_id,app_key)
......
package com.winsun.utils;
public class DesensitizationRulesUtils {
// 1、联系人及用户姓名:以*代替第二个字。
// 2、联系电话:以*号代替各脱敏字段数据的最后4字符。
// 3、日期(包括出生日期等):以*代替月日期,如2018年1月31日,脱敏显示为2018年**月**日。
// 4、证件号码:月日以*号代替。如身份证1101081970****6593。
// 5、地址(包括证件地址、通讯地址、投递地址、装机地址等):以*号代替各脱敏字段数据的最后4字符。如广州天河区茶山路五山花园12栋A****。
// 6、付费账号:用*号代替各脱敏字段数据的最后4字符。
// 7、鉴权信息(客户密码):用*号代替所有字段数据。
// 8、个人生物识别信息:用*号代替所有字段数据。
private static String replaceChar = "*********************************************************************************";
/**
* 脱敏数据,输入脱敏规则
* type :
* name 联系人及用户姓名
* phone 联系电话
* date 日期(包括出生日期等)
* idCard 证件号码
* address 地址(包括证件地址、通讯地址、投递地址、装机地址等)
* account 付费账号
* token 鉴权信息(客户密码),个人生物识别信息
* @param content
* @param type : name联系人及用户姓名
* @return
*/
public static String desensiteData(String content, String type){
if(content == null || content.trim() == ""){
return "";
}
content = content.trim();
switch (type) {
case "name":
// 联系人及用户姓名:以*代替第二个字。
return desensitizationName(content);
case "phone":
// 联系电话:以*号代替各脱敏字段数据的最后4字符。
return desensitizationPhone(content);
case "date":
// 日期(包括出生日期等):以*代替月日期,如2018年1月31日,脱敏显示为2018年**月**日。
return desensitizationDate(content);
case "idCard":
// 证件号码:月日以*号代替。如身份证1101081970****6593。
return desensitizationIdCard(content);
case "address":
// 地址(包括证件地址、通讯地址、投递地址、装机地址等):以*号代替各脱敏字段数据的最后4字符。如广州天河区茶山路五山花园12栋A****。
return desensitizationAddress(content);
case "account":
// 付费账号:用*号代替各脱敏字段数据的最后4字符。
return desensitizationAccount(content);
case "token":
// 鉴权信息(客户密码):用*号代替所有字段数据。
// 个人生物识别信息:用*号代替所有字段数据。
return desensitizationToken(content);
default:
// 没有找到脱敏类型,不脱敏
return content;
}
}
/**
* 1、联系人及用户姓名:以*代替第二个字。
* @param content
* @return
*/
private static String desensitizationName(String content){
int length = content.length();
//过短直接返回
if (length <=1) {
return content;
}
if(length == 2 ){
return content.replace(content.charAt(1), "*".charAt(0));
}
return content.replace(content.substring(1, length - 1), replaceChar.substring(0, length - 2));
}
/**
* 2、联系电话:以*号代替各脱敏字段数据的最后4字符。
* @param phone
* @return
*/
private static String desensitizationPhone(String phone){
//重置(-)符号
phone = phone.replaceAll("-", "");
int length = phone.length();
//参数长度异常,返回空
if(length < 4){
return "";
}
//手机号码
return phone.substring(0,length - 4) + replaceChar.substring(0, 4);
}
/**
* 3、日期(包括出生日期等):以*代替月日期,如2018年1月31日,脱敏显示为2018年**月**日。
* @param date
* @return
*/
public static String desensitizationDate(String date){
int length = date.length();
//时间格式种类较多,需分开处理
// 日期格式为2018年1月31日
if(date.indexOf("年") > -1 && date.indexOf("月") > -1 && date.indexOf("日") > -1){
date = date.substring(0, date.indexOf("年")+1) + "**月**日 " + date.substring(date.indexOf("日")+1);
}else if(date.split("/").length == 3){
// 日期格式为2020/08/01 或者 2020/08/01 12:12:23
String time = date.split(" ").length > 1 ? " " + date.split(" ")[1] : "";
date = date.split("/")[0] + "/**/**" + time;
}else if(date.split("-").length == 3){
// 日期格式为2020-08-01或者2020-08-01 12:12:23
String time = date.split(" ").length > 1 ? " " + date.split(" ")[1] : "";
date = date.split("-")[0] + "-**-**" + time;
}else{
if(date.length() == 8){
// 日期格式为20200402
date = date.substring(0,4)+ "****";
}
}
return "";
}
/**
* 4、证件号码:月日以*号代替。如身份证1101081970****6593。
* @param idCard
* @return
*/
private static String desensitizationIdCard(String idCard) {
int length = idCard.length();
// 15位的身份证号码:
// 1、1~6位为地区代码。
// 2、7~8位为出生年份(2位),9~10位为出生月份,11~12位为出生日期。
// 3、第13~15位为顺序号,并能够判断性别,奇数为男,偶数为女。
if (length == 15) {
return idCard.substring(0, length - 7) + replaceChar.substring(0, 4) + idCard.substring(length - 3, length);
}
// 18位的身份证号码
// 7~14位为出生年月日
if (length == 18) {
return idCard.substring(0, length - 8) + replaceChar.substring(0, 4) + idCard.substring(length - 4, length);
}
// 其余随便打*
if (length > 4)
return idCard.replace(idCard.substring(4), replaceChar.substring(0, length - 4));
// 参数异常
return "";
}
/**
* 5、地址(包括证件地址、通讯地址、投递地址、装机地址等):以*号代替各脱敏字段数据的最后4字符。如广州天河区茶山路五山花园12栋A****。
* @param address
* @return
*/
private static String desensitizationAddress(String address){
int length = address.length();
if(length < 4){
return address.charAt(0)+"**";
}
//处理最后有()备注的情况,过后更新
//地址
return address.substring(0,length - 4) + replaceChar.substring(0, 4);
}
/**
* 6、付费账号:用*号代替各脱敏字段数据的最后4字符。
* @param account
* @return
*/
private static String desensitizationAccount(String account){
int length = account.length();
if(length < 4){
return account.charAt(0)+"**";
}
//手机号码
return account.substring(0,length - 4) + replaceChar.substring(0, 4);
}
/**
* 7、鉴权信息(客户密码):用*号代替所有字段数据。
* 8、个人生物识别信息:用*号代替所有字段数据。
* @param token
* @return
*/
private static String desensitizationToken(String token){
int length = token.length();
return replaceChar.substring(0, length-1);
}
}
package com.winsun.utils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
public class ExportExcel {
private static final Logger logger = LoggerFactory.getLogger(ExportExcel.class);
/**
* 返回输出流
* @param workBook
* @param request
* @param response
* @param FileName
* @throws Exception
*/
public static ResponseEntity<byte[]> toDownLoad(XSSFWorkbook workBook, HttpServletRequest request, HttpServletResponse response, String FileName) throws Exception{
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
workBook.write(os);
} catch (IOException e) {
logger.error(e.getMessage(), e);
// e.printStackTrace();
}
String realFileName = FileName + ".xlsx";
// 浏览器兼容
String agent = request.getHeader("User-Agent");
if (null != agent) {
agent = agent.toLowerCase();
if (agent.indexOf("firefox") != -1) {
realFileName = new String(URLDecoder.decode(realFileName, "UTF-8").getBytes(), "iso-8859-1");
} else {
realFileName = java.net.URLEncoder.encode(realFileName, "UTF-8");
}
}
byte[] content = os.toByteArray();
// 设置返回文件大小
response.addHeader("content-length",os.size() + "");
InputStream is = new ByteArrayInputStream(content);
// 设置response参数,可以打开下载页面
// response.reset();
response.setContentType("application/vnd.ms-excel;charset=utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + realFileName);
ServletOutputStream out = response.getOutputStream();
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
try {
bis = new BufferedInputStream(is);
bos = new BufferedOutputStream(out);
byte[] buff = new byte[2048];
int bytesRead;
// Simple read/write loop.
while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
bos.write(buff, 0, bytesRead);
}
HttpHeaders headers = new HttpHeaders();
// 设置返回文件参数
headers.add("Content-Type","application/vnd.ms-excel;charset=utf-8");
headers.add("Connection", "close");
headers.add("Content-Disposition",
"attachment;filename="+realFileName);
return new ResponseEntity<byte[]>(buff, headers, HttpStatus.OK);
} catch (final IOException e) {
throw e;
} finally {
if (bis != null){
try {
bis.close();
} catch (IOException e2) {
logger.error(e2.getMessage(),e2);
// e2.printStackTrace();
}
}
if (bos != null){
try {
bos.close();
} catch (IOException e2) {
logger.error(e2.getMessage(), e2);
// e2.printStackTrace();
}
}
}
}
}
package com.winsun.utils;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.IndexedColors;
public class TreeNodeData {
private static TreeNode root;
public static TreeNode getRoot() {
return root;
}
private static void setRoot(TreeNode rootNode) {
root = rootNode;
}
/**
* 移动订单表头
* @param actName
* @return
*/
public static TreeNode getMoveOrder(String actName){
TreeNode treeNode0 =new TreeNode(-1,"", null);
TreeNode treeNode =new TreeNode(0, actName, treeNode0);
TreeNode treeNode1 =new TreeNode(1, "客户姓名","customer_name", treeNode);
TreeNode treeNode2 =new TreeNode(2, "办理号码","business_number", treeNode);
TreeNode treeNode3 =new TreeNode(3, "订单状态","order_status", treeNode);
TreeNode treeNode4 =new TreeNode(4, "订单创建时间","create_time", treeNode);
TreeNode treeNode5 =new TreeNode(5, "县分","hehuoren_area", treeNode);
TreeNode treeNode6 =new TreeNode(6, "合伙人学校","hehuoren_school", treeNode);
TreeNode treeNode7 =new TreeNode(7, "合伙人姓名","hehuoren_name", treeNode);
TreeNode treeNode8 =new TreeNode(8, "合伙人手机","hehuoren_phone", treeNode);
TreeNode treeNode9 =new TreeNode(9, "督导","supervisor_name", treeNode);
TreeNode treeNode10 =new TreeNode(10, "订单类型","user_type", treeNode);
TreeNode treeNode11 =new TreeNode(11, "办理套餐","kapin", treeNode);
TreeNode treeNode12 =new TreeNode(12, "升级套餐","business_package", treeNode);
TreeNode treeNode13 =new TreeNode(13, "联系号码","contact_number", treeNode);
TreeNode treeNode14 =new TreeNode(14, "订单编号","order_number", treeNode);
TreeNode treeNode15 =new TreeNode(15, "小白卡单号","xb_order_id", treeNode);
TreeNode treeNode16 =new TreeNode(16, "预制卡单号","order_id", treeNode);
TreeNode treeNode17 =new TreeNode(17, "收货地区","site", treeNode);
TreeNode treeNode18 =new TreeNode(18, "详细地址","address", treeNode);
TreeNode treeNode19 =new TreeNode(19, "配送方式","is_delivery", treeNode);
TreeNode treeNode20 =new TreeNode(20, "快递公司","company", treeNode);
TreeNode treeNode21 =new TreeNode(21, "快递单号","kuaidi_order", treeNode);
TreeNode treeNode22 =new TreeNode(22, "白卡ICCID","business_iccid", treeNode);
TreeNode treeNode23 =new TreeNode(23, "快递寄出时间","kuaidi_time", treeNode);
TreeNode treeNode24 =new TreeNode(24, "订单完成时间","success_time", treeNode);
TreeNode treeNode25 =new TreeNode(25, "用户学校","userSchool", treeNode);
TreeNode treeNode26 =new TreeNode(26, "学生证审核","student_card_check_status", treeNode);
TreeNode treeNode27 =new TreeNode(27, "父母名字","parent_name", treeNode);
TreeNode treeNode28 =new TreeNode(28, "学号","student_number", treeNode);
TreeNode treeNode29 =new TreeNode(29, "班级","class_number", treeNode);
treeNode0.calLeavesAmount(treeNode0);
treeNode0.calNodeLevel(treeNode0);
return treeNode0;
}
}
package com.winsun.utils;
import com.baomidou.mybatisplus.enums.SqlLike;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.winsun.bean.Order;
import org.apache.commons.lang3.StringUtils;
import java.util.Map;
public class WrapperUtil {
public static void wrapperGe(EntityWrapper<Order> wrapper, Map<String, Object> map, String str, String str2){
if (map.containsKey(str) && StringUtils.isNotBlank(map.get(str).toString())){
wrapper.ge(str2, map.get(str).toString());
}
}
public static void wrapperLe(EntityWrapper<Order> wrapper, Map<String, Object> map, String str, String str2){
if (map.containsKey(str) && StringUtils.isNotBlank(map.get(str).toString())){
wrapper.ge(str2, map.get(str).toString());
}
}
public static void wrapperEq(EntityWrapper<Order> wrapper, Map<String, Object> map, String str,String str2){
if (map.containsKey(str) && StringUtils.isNotBlank(map.get(str).toString())){
wrapper.eq(str2, map.get(str).toString());
}
}
public static void wrapperLike(EntityWrapper<Order> wrapper, Map<String, Object> map, String str,String str2){
if (map.containsKey(str) && StringUtils.isNotBlank(map.get(str).toString())){
wrapper.like(str2, map.get(str).toString(), SqlLike.DEFAULT);
}
}
}
......@@ -59,6 +59,12 @@ public class OrderTask {
@Autowired
private RhPhoneMapper rhPhoneMapper;
private static Set<String> schoolSet = new HashSet<>();
{
schoolSet.add("星海音乐学院");
schoolSet.add("广州美术学院");
}
/**
* 定时器更新已送货订单
*/
......@@ -166,11 +172,10 @@ public class OrderTask {
//查询该订单的学校名称
String schoolName = orderViewMapper.selectByKdOrderId(order.getKdOrderId());
if ("星海音乐学院".equals(schoolName) || "广州美术学院".equals(schoolName)){
if (schoolSet.contains(schoolName)){
order.setNetNumber(order.getNetNumber().split("@")[0]);
}
// 下发短信
SendSmsAndMail.sendSms2(order.getContactNumber(),
order.getNetNumber(),
......@@ -210,6 +215,9 @@ public class OrderTask {
Map.get("orderState").toString().equals("8") || Map.get("orderState").toString().equals("22") ||
Map.get("orderState").toString().equals("21") ){
dataMapping.put("order_status", "待处理");
if ("1".equals(order.getIsDelivery())){
dataMapping.put("order_status","待活体");
}
dataMapping.put("update_time", new Date());
appMapper.inserOrderHis(order.getId(), "上传证件受理成功,等待督导处理:"+Map.get("orderState").toString(), new Date(), "定时器查询");
}
......
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