Commit 146080ca by 彭祥礼

新增学生号清单号验证和所有学生清单验证

hhr_kd_phone清单+一人一码办理号码
智能平台推送信息接收增加判断条件并增加一个发送短信
parent de6e81d3
package com.winsun.controller;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.winsun.auth.core.common.model.ResponseData;
import com.winsun.bean.KdPhone;
import com.winsun.bean.Order;
import com.winsun.bean.Regular;
import com.winsun.bean.XshInventory;
import com.winsun.mapper.KdPhoneMapper;
import com.winsun.mapper.OrderMapper;
import com.winsun.mapper.RegularMapper;
import com.winsun.mapper.XshInventoryMapper;
import com.winsun.smsUtils.SendSmsAndMail;
......@@ -16,6 +22,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
......@@ -31,6 +39,10 @@ public class codeManagerController {
@Autowired
private RegularMapper regularMapper;
@Autowired
private KdPhoneMapper kdPhoneMapper;
@Autowired
private OrderMapper orderMapper;
@Autowired
private XshInventoryMapper xshInventoryMapper;
@Autowired
@Qualifier("redisStringTemplate")
......@@ -39,14 +51,36 @@ public class codeManagerController {
@ResponseBody
@RequestMapping(value = "sendCodes", method = RequestMethod.POST)
public ResponseData<Map<String, Object>> checkStudent(String phone) {
// 生成6位随机数
String s = String.valueOf((int) ((Math.random() * 9 + 1) * 100000));
log.info("验证码:" + s);
//MessageUtil.sent(packageUpgrade.getAccNbr(),"4","您获取的验证码为:"+s+",半小时内有效。");
redisTemplate.opsForValue().set(phone, s, 240, TimeUnit.MINUTES);
String codes = SendSmsAndMail.sendSms(phone,s+"","7");
return ResponseData.success(null, "已发送验证码到手机,验证码:" + s);
Map<String, Object> map = new HashMap<>();
try {
Wrapper<KdPhone> wrapper1 = new EntityWrapper<>();
wrapper1.setSqlSelect("id,phone,tcName");
wrapper1.eq("phone",phone);
List<KdPhone> list = kdPhoneMapper.selectList(wrapper1);
Wrapper<Order> wrapper2 = new EntityWrapper<>();
wrapper2.eq("user_type","0");
wrapper2.eq("order_status","已完成");
wrapper2.eq("business_number",phone);
List<Order> list1 = orderMapper.selectList(wrapper2);
if(list.size()>0 || list1.size()>0){
// 生成6位随机数
String veCode = String.valueOf((int) ((Math.random() * 9 + 1) * 100000));
//MessageUtil.sent(packageUpgrade.getAccNbr(),"4","您获取的验证码为:"+s+",半小时内有效。");
redisTemplate.opsForValue().set(phone, veCode, 240, TimeUnit.MINUTES);
SendSmsAndMail.sendSms(phone,veCode + "","7");
log.info("验证码:" + veCode);
map.put("code",1);
}else{
map.put("code",0);
}
} catch (Exception e) {
log.error("获取验证码异常:", e);
map.put("code",2);
}
return ResponseData.success(map);
}
@ResponseBody
@RequestMapping(value = "checkCodes", method = RequestMethod.POST)
public ResponseData<Map<String, Object>> checkCodes(String phone, String codes) {
......@@ -63,7 +97,16 @@ public class codeManagerController {
return ResponseData.error("验证码已失效,请发送验证码!");
}
if(ver.equals(codes)){
return ResponseData.success();
Map<String,Object> map = new HashMap<>();
Wrapper<KdPhone> kdPhoneWrapper = new EntityWrapper<>();
kdPhoneWrapper.setSqlSelect("id,phone,tcName");
kdPhoneWrapper.eq("phone",phone);
List<KdPhone> list = kdPhoneMapper.selectList(kdPhoneWrapper);
if(list.size()>0){
KdPhone kdPhone = list.get(0);
map.put("tcName",kdPhone.getTcName());
}
return ResponseData.success(map);
}
return ResponseData.error( "验证码错误" );
}
......
package com.winsun.bean;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import lombok.Data;
import java.io.Serializable;
/**
* 〈KdPnone〉
*
* @author Administrator
* @create 2020/4/26 17:49
*/
@TableName("hhr_kd_phone")
@Data
public class KdPhone implements Serializable {
private static final long serialVersionUID = -1391091707829941832L;
/**
*
*/
@TableId(value = "d",type = IdType.AUTO)
private int id;
/**
*
*/
private String phone;
/**
*
*/
@TableField(value = "tcName")
private String tcName;
}
package com.winsun.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.winsun.bean.KdPhone;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
/**
* 〈KdPhoneMapper〉
*
* @author Administrator
* @create 2020/4/26 17:52
*/
@Mapper
@Component
public interface KdPhoneMapper extends BaseMapper<KdPhone> {
}
......@@ -90,6 +90,10 @@ public class SendSmsAndMail {
//【飞young校园】同学您好,经系统核查,您满足升级为每月70G大流量新套餐的条件,请在1月25日24点前点击“广航D人”公众号菜单栏“校园功能”“升级套餐”办理升级。本优惠将于1月25日24点截止,请尽快在公众号登记。
requestData.put("smsTemplateId", "00RqWcH8X1LE");// 短信模板id 创建成功
requestData.put("data", "{\"name\":\"" + preurl + "\"}"); // 数据
}else if(t.equals("14")){
//【飞young校园】同学您好,经系统核查,您满足升级为每月70G大流量新套餐的条件,请在1月25日24点前点击“广航D人”公众号菜单栏“校园功能”“升级套餐”办理升级。本优惠将于1月25日24点截止,请尽快在公众号登记。
requestData.put("smsTemplateId", "00UbC7MEwyGW");// 短信模板id 创建成功
requestData.put("data", "{}"); // 数据
}
requestData.put("requestId", String.valueOf(System.currentTimeMillis())); // 16位请求标识码
......
......@@ -3,9 +3,14 @@ package com.winsun.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.winsun.bean.Order;
import com.winsun.bean.OrderHistory;
import com.winsun.bean.OrderView;
import com.winsun.constant.OrderStatus;
import com.winsun.mapper.OrderHistoryMapper;
import com.winsun.mapper.OrderMapper;
import com.winsun.mapper.OrderViewMapper;
import com.winsun.smsUtils.SendSmsAndMail;
import com.winsun.utils.MyBatisPlusUpdateUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
......@@ -14,9 +19,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
......@@ -30,10 +35,14 @@ import java.util.Map;
public class IntelligentPlatformPushController {
private static OrderViewMapper orderViewMapper;
private static OrderMapper orderMapper;
private static OrderHistoryMapper orderHistoryMapper;
@Autowired
public IntelligentPlatformPushController(OrderViewMapper orderViewMapper) {
public IntelligentPlatformPushController(OrderViewMapper orderViewMapper,OrderMapper orderMapper,
OrderHistoryMapper orderHistoryMapper) {
IntelligentPlatformPushController.orderViewMapper = orderViewMapper;
IntelligentPlatformPushController.orderMapper = orderMapper;
IntelligentPlatformPushController.orderHistoryMapper = orderHistoryMapper;
}
/**
......@@ -65,9 +74,16 @@ public class IntelligentPlatformPushController {
return resultMap;
}
if (signMap.get("orderNum") != null && StringUtils.isNotBlank(signMap.get("orderNum").toString())) {
Wrapper<Object> wrapper = new EntityWrapper<>();
wrapper.eq("order_id", signMap.get("orderNum"));
String orderId = signMap.get("orderNum").toString();
String status = signMap.get("status").toString();
Wrapper<Object> wrapper = new EntityWrapper<>();
wrapper.eq("order_id", orderId);
Wrapper<Order> orderWrappert = new EntityWrapper<>();
orderWrappert.eq("order_id", orderId);
List<Order> list = orderMapper.selectList(orderWrappert);
String orderStatus = null;
try {
orderStatus = OrderStatus.findById(signMap.get("statusId").toString()).getName();
......@@ -77,7 +93,15 @@ public class IntelligentPlatformPushController {
log.error("智能平台推送信息接收异常",e.getMessage(), e);
return resultMap;
}
Integer num = orderViewMapper.IntelligentPlatformPush(wrapper, status, orderStatus);
Wrapper<Order> orderWrapper = new EntityWrapper<>();
Order order = new Order();
order.setOrderId(orderId);
order.setThStatus(status);
order.setOrderStatus(orderStatus);
Integer num = orderMapper.update(order,orderWrapper);
//UPDATE `hhr_order` set th_status = #{status},order_status = #{orderStatus} <where> ${ew.sqlSegment} </where>
//Integer num = orderViewMapper.IntelligentPlatformPush(wrapper, status, orderStatus);
if (num > 0) {
if (type.equals("dkd") || type.equals("rh")) {
Wrapper<OrderView> wrapper1 = new EntityWrapper<>();
......@@ -99,11 +123,23 @@ public class IntelligentPlatformPushController {
resultMap.put("msg", "消息接收成功更新失败");
}
String id = orderViewMapper.selectOrderId(wrapper);
Date date = new Date();
Timestamp createTime = new Timestamp(date.getTime());
String id = orderMapper.selectById(orderId).getId();
//<script>SELECT id FROM `hhr_order` <where> ${ew.sqlSegment} </where> </script>
//String id = orderViewMapper.selectOrderId(wrapper);
try {
orderViewMapper.insertOrderHistory(id, status, createTime);
Wrapper<OrderHistory> historyWrapper = new EntityWrapper<>();
OrderHistory history = new OrderHistory();
history.setOrderId(id);
history.setCreateDate(new Date());
history.setStatus(status);
history.setOperator("智能平台推送");
orderHistoryMapper.insert(history);
//要加一个短信
SendSmsAndMail.sendSms(list.get(0).getContactNumber(),"", "14");
//Date date = new Date();
//Timestamp createTime = new Timestamp(date.getTime());
//insert into`hhr_order_history`(order_id, status, create_date) values(#{id}, #{status}, #{createTime})
//orderViewMapper.insertOrderHistory(id, status, createTime);
} catch (Exception e) {
log.error("智能平台推送信息接口插入异常",e.getMessage(), e);
}
......
......@@ -10,7 +10,9 @@ import com.winsun.auth.core.base.controller.BaseController;
import com.winsun.auth.core.common.model.ResponseData;
import com.winsun.auth.core.shiro.ShiroUser;
import com.winsun.bean.Product;
import com.winsun.bean.Regular;
import com.winsun.mapper.ProductMapper;
import com.winsun.mapper.RegularMapper;
import com.winsun.utils.MyBatisPlusUpdateUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
......@@ -30,13 +32,10 @@ import java.util.*;
@RestController
@RequestMapping("/product")
public class ProductController extends BaseController {
private static ProductMapper productMapper;
@Autowired
public ProductController(ProductMapper productMapper) {
ProductController.productMapper = productMapper;
}
private ProductMapper productMapper;
@Autowired
private RegularMapper regularMapper;
/**
* 宽带添加
......@@ -111,6 +110,10 @@ public class ProductController extends BaseController {
dataMapping.put("product_region", pro.getProductRegion());
dataMapping.put("product_rate", pro.getProductRate());
dataMapping.put("product_state", pro.getProductState());
dataMapping.put("product_introduction", pro.getProductIntroduction());
dataMapping.put("product_set_meal_introduction", pro.getProductSetMealIntroduction());
dataMapping.put("product_rf2", pro.getProductRf2());
dataMapping.put("product_introduction_pic2", pro.getProductIntroductionPic2());
productMapper.updateForSet(MyBatisPlusUpdateUtils.toUpdateSet(dataMapping), wrapper);
return ResponseData.success("修改成功!");
}
......@@ -124,7 +127,7 @@ public class ProductController extends BaseController {
* @return
*/
@Permission(menuname = "查询宽带信息", value = "list", method = RequestMethod.POST)
public ResponseData<Page<Product>> listProduct(@RequestParam(name = "productUniversity", required = false) String productUniversity, @RequestParam(name = "productRegion", required = false) String productRegion,
public ResponseData<Map<String,Object>> listProduct(@RequestParam(name = "productUniversity", required = false) String productUniversity, @RequestParam(name = "productRegion", required = false) String productRegion,
@RequestParam(name = "pageNo") int pageNo, @RequestParam(name = "pageSize") int pageSize) {
ShiroUser user = getShiroUser();
if (!user.getRoleNames().stream().anyMatch(roleName -> StringUtils.equalsAny(roleName, "超级管理员"))) {
......@@ -136,8 +139,15 @@ public class ProductController extends BaseController {
wrapper.eq("product_state", "0");
Page<Product> page = new Page<>(pageNo, pageSize);
List<Product> products = productMapper.selectPage(page, wrapper);
Wrapper<Regular> regularWrapper = new EntityWrapper<>();
regularWrapper.eq("is_show",'1');
List<Regular> regulars = regularMapper.selectList(regularWrapper);
Map<String,Object> map = new HashMap<>();
page.setRecords(products);
return ResponseData.success(page, "查询成功!");
map.put("page",page);
map.put("regulars",regulars);
return ResponseData.success(map, "查询成功!");
}
/**
......
......@@ -52,19 +52,19 @@ public class regularController extends BaseController {
/**
* 正则删除
*
* @param id 需要删除的id
* @param regularId 需要删除的id
* @return
*/
@Permission(menuname = "删除正则信息", value = "delete", method = RequestMethod.POST)
public ResponseData<String> deleteProduct(@RequestParam(name="id", required = false) String id,@RequestParam(name="isShow", required = false) String isShow) {
public ResponseData<String> deleteProduct(@RequestParam(name="regularId", required = false) String regularId,@RequestParam(name="isShow", required = false) String isShow) {
ShiroUser user = getShiroUser();
if (!user.getRoleNames().stream().anyMatch(roleName -> StringUtils.equalsAny(roleName, "超级管理员"))) {
return ResponseData.error("无数据权限");
}
Wrapper wrapper = new EntityWrapper<>();
wrapper.eq("id", id);
wrapper.eq("regular_id", regularId);
Map<String, Object> dataMapping = new HashMap<>();
dataMapping.put("is_Show", isShow);
dataMapping.put("is_show", isShow);
regularMapper.updateForSet(MyBatisPlusUpdateUtils.toUpdateSet(dataMapping), wrapper);
return ResponseData.success("操作成功!");
}
......@@ -83,13 +83,13 @@ public class regularController extends BaseController {
}
Regular pro = JSON.parseObject(regular, Regular.class);
Wrapper wrapper = new EntityWrapper<>();
wrapper.eq("id", pro.getId());
wrapper.eq("regular_id", pro.getRegularId());
Map<String, Object> dataMapping = new HashMap<>();
dataMapping.put("name", pro.getName());
dataMapping.put("regular_name", pro.getRegularName());
dataMapping.put("regular", pro.getRegular());
dataMapping.put("tips", pro.getTips());
dataMapping.put("placeholder", pro.getPlaceholder());
dataMapping.put("is_Show", pro.getIsShow());
dataMapping.put("is_show", pro.getIsShow());
regularMapper.updateForSet(MyBatisPlusUpdateUtils.toUpdateSet(dataMapping), wrapper);
return ResponseData.success("修改成功!");
}
......@@ -97,19 +97,19 @@ public class regularController extends BaseController {
/**
* 正则查詢展示
*
* @param name 正则名称
* @param regularName 正则名称
* @param pageSize
* @return
*/
@Permission(menuname = "查询正则信息", value = "list", method = RequestMethod.POST)
public ResponseData<Page<Regular>> listProduct(@RequestParam(name = "name", required = false) String name,
public ResponseData<Page<Regular>> listProduct(@RequestParam(name = "regularName", required = false) String regularName,
@RequestParam(name = "pageNo") int pageNo, @RequestParam(name = "pageSize") int pageSize) {
ShiroUser user = getShiroUser();
if (!user.getRoleNames().stream().anyMatch(roleName -> StringUtils.equalsAny(roleName, "超级管理员"))) {
return ResponseData.error("无数据权限");
}
Wrapper<Regular> wrapper = new EntityWrapper();
wrapper.like(StringUtils.isNotBlank(name), "name", name, SqlLike.DEFAULT);
wrapper.like(StringUtils.isNotBlank(regularName), "regular_name", regularName, SqlLike.DEFAULT);
Page<Regular> page = new Page<>(pageNo, pageSize);
List<Regular> regulars = regularMapper.selectPage(page, wrapper);
page.setRecords(regulars);
......
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