jz.kai 3 jaren geleden
bovenliggende
commit
fc2d2c9452

+ 2 - 0
common/src/main/java/com/jpsoft/order/modules/base/dao/OrderFormDAO.java

@@ -15,4 +15,6 @@ public interface OrderFormDAO {
 	int delete(String id);
 	List<OrderForm> list();
 	List<OrderForm> search(Map<String,Object> searchParams,List<Sort> sortList);
+	List<OrderForm> findByEmail(String clientEmail);
+	OrderForm getDetail(String clientEmail, String feilihuaOrderNumber);
 }

+ 2 - 0
common/src/main/java/com/jpsoft/order/modules/base/service/OrderFormService.java

@@ -14,4 +14,6 @@ public interface OrderFormService {
 	int delete(String id);
 	List<OrderForm> list();
 	Page<OrderForm> pageSearch(Map<String, Object> searchParams,int pageNum,int pageSize,boolean count,List<Sort> sortList);
+	List<OrderForm> findByEmail(String clientEmail);
+	OrderForm getDetail(String clientEmail, String feilihuaOrderNumber);
 }

+ 12 - 0
common/src/main/java/com/jpsoft/order/modules/base/service/impl/OrderFormServiceImpl.java

@@ -67,4 +67,16 @@ public class OrderFormServiceImpl implements OrderFormService {
         
         return page;
 	}
+
+	@Override
+	public List<OrderForm> findByEmail(String clientEmail) {
+		// TODO Auto-generated method stub
+		return orderFormDAO.findByEmail(clientEmail);
+	}
+
+	@Override
+	public OrderForm getDetail(String clientEmail, String feilihuaOrderNumber) {
+		// TODO Auto-generated method stub
+		return orderFormDAO.getDetail(clientEmail, feilihuaOrderNumber);
+	}
 }

+ 12 - 0
common/src/main/resources/mapper/base/OrderForm.xml

@@ -161,4 +161,16 @@ id_,client_email,client_name,client_order_number,feilihua_order_number,product_n
 	        ${sort.name} ${sort.order}
 	 	</foreach>
 	</select>
+	<select id="findByEmail" parameterType="string" resultMap="OrderFormMap">
+		select * from base_order_form
+		where del_flag = 0
+		and client_email = #{clientEmail}
+	</select>
+	<select id="getDetail" parameterType="string" resultMap="OrderFormMap">
+		select * from base_order_form
+		where del_flag = 0
+		and client_email = #{clientEmail}
+		and feilihua_order_number = #{feilihuaOrderNumber}
+		limit 1
+	</select>
 </mapper>

+ 2 - 1
web/src/main/java/com/jpsoft/order/config/WebMvcConfig.java

@@ -55,7 +55,8 @@ public class WebMvcConfig implements WebMvcConfigurer {
 //				.excludePathPatterns("/mobile/personInfoApi/findByOpenId")
 //				.excludePathPatterns("/mobile/personInfoApi/register")
 //				.excludePathPatterns("/mobile/personInfoApi/login")
-				.excludePathPatterns("/open/**")
+				.excludePathPatterns("/open/orderForm/login")
+				.excludePathPatterns("/open/orderForm/sendRQCode")
 		;
 	}
 }

+ 274 - 136
web/src/main/java/com/jpsoft/order/modules/base/controller/OrderFormController.java

@@ -276,182 +276,320 @@ public class OrderFormController {
                     String strExpiryTime = poiUtils.getCellValue(0,rowIndex,13).toString();
 
                     //订单信息
-                    OrderForm orderForm = new OrderForm();
-                    orderForm.setId(UUID.randomUUID().toString());
-                    orderForm.setDelFlag(false);
-                    orderForm.setCreateBy(subject);
-                    orderForm.setCreateTime(new Date());
-
-                    if(StringUtils.isNotEmpty(strClientEmail)){
-                        orderForm.setClientEmail(strClientEmail);
-                    }
-                    else{
-                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写客户邮箱!");
-                        failCount++;
-                        continue;
-                    }
+                    OrderForm orderForm = orderFormService.getDetail(strClientEmail,strFeilihuaOrderNumber);
+                    if(orderForm != null) {
+                        orderForm.setUpdateBy(subject);
+                        orderForm.setUpdateTime(new Date());
+
+                        if (StringUtils.isNotEmpty(strClientEmail)) {
+                            orderForm.setClientEmail(strClientEmail);
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写客户邮箱!");
+                            failCount++;
+                            continue;
+                        }
 
-                    if(StringUtils.isNotEmpty(strClientName)){
-                        orderForm.setClientName(strClientName);
-                    }
-                    else{
-                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写客户名称!");
-                        failCount++;
-                        continue;
-                    }
+                        if (StringUtils.isNotEmpty(strClientName)) {
+                            orderForm.setClientName(strClientName);
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写客户名称!");
+                            failCount++;
+                            continue;
+                        }
 
-                    if(StringUtils.isNotEmpty(strClientOrderNumber)){
-                        orderForm.setClientOrderNumber(strClientOrderNumber);
-                    }
-                    else{
-                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写客户订单号!");
-                        failCount++;
-                        continue;
-                    }
+                        if (StringUtils.isNotEmpty(strClientOrderNumber)) {
+                            orderForm.setClientOrderNumber(strClientOrderNumber);
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写客户订单号!");
+                            failCount++;
+                            continue;
+                        }
 
-                    if(StringUtils.isNotEmpty(strFeilihuaOrderNumber)){
-                        orderForm.setFeilihuaOrderNumber(strFeilihuaOrderNumber);
-                    }
-                    else{
-                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写菲利华订单号!");
-                        failCount++;
-                        continue;
-                    }
+                        if (StringUtils.isNotEmpty(strFeilihuaOrderNumber)) {
+                            orderForm.setFeilihuaOrderNumber(strFeilihuaOrderNumber);
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写菲利华订单号!");
+                            failCount++;
+                            continue;
+                        }
 
-                    if(StringUtils.isNotEmpty(strProductName)){
-                        orderForm.setProductName(strProductName);
-                    }
-                    else{
-                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写产品名称!");
-                        failCount++;
-                        continue;
-                    }
+                        if (StringUtils.isNotEmpty(strProductName)) {
+                            orderForm.setProductName(strProductName);
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写产品名称!");
+                            failCount++;
+                            continue;
+                        }
 
-                    if(StringUtils.isNotEmpty(strTrademark)){
-                        orderForm.setTrademark(strTrademark);
-                    }
-                    else{
-                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写牌号!");
-                        failCount++;
-                        continue;
-                    }
+                        if (StringUtils.isNotEmpty(strTrademark)) {
+                            orderForm.setTrademark(strTrademark);
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写牌号!");
+                            failCount++;
+                            continue;
+                        }
 
-                    if(StringUtils.isNotEmpty(strProductSpecification)){
-                        orderForm.setProductSpecification(strProductSpecification);
-                    }
-                    else{
-                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写产品规格!");
-                        failCount++;
-                        continue;
-                    }
+                        if (StringUtils.isNotEmpty(strProductSpecification)) {
+                            orderForm.setProductSpecification(strProductSpecification);
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写产品规格!");
+                            failCount++;
+                            continue;
+                        }
 
-                    if(StringUtils.isNotEmpty(strOrderQuantity)){
-                        try {
-                            orderForm.setOrderQuantity(Integer.parseInt(strOrderQuantity));
+                        if (StringUtils.isNotEmpty(strOrderQuantity)) {
+                            try {
+                                orderForm.setOrderQuantity(Integer.parseInt(strOrderQuantity));
+                            } catch (Exception ex) {
+                                sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("订单数量数据错误!");
+                                failCount++;
+                                continue;
+                            }
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写订单数量!");
+                            failCount++;
+                            continue;
                         }
-                        catch (Exception ex){
-                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("订单数量数据错误!");
+
+                        if (StringUtils.isNotEmpty(strUnit)) {
+                            orderForm.setUnit(strUnit);
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写单位!");
                             failCount++;
                             continue;
                         }
-                    }
-                    else{
-                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写订单数量!");
-                        failCount++;
-                        continue;
-                    }
 
-                    if(StringUtils.isNotEmpty(strUnit)){
-                        orderForm.setUnit(strUnit);
-                    }
-                    else{
-                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写单位!");
-                        failCount++;
-                        continue;
-                    }
+                        if (StringUtils.isNotEmpty(strRequiredDeliveryTime)) {
+                            try {
+                                orderForm.setRequiredDeliveryTime(sdf.parse(strRequiredDeliveryTime));
+                            } catch (Exception ex) {
+                                sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("要求交期数据错误!");
+                                failCount++;
+                                continue;
+                            }
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写要求交期!");
+                            failCount++;
+                            continue;
+                        }
 
-                    if(StringUtils.isNotEmpty(strRequiredDeliveryTime)){
-                        try {
-                            orderForm.setRequiredDeliveryTime(sdf.parse(strRequiredDeliveryTime));
+                        if (StringUtils.isNotEmpty(strReviewDeliveryTime)) {
+                            try {
+                                orderForm.setReviewDeliveryTime(sdf.parse(strReviewDeliveryTime));
+                            } catch (Exception ex) {
+                                sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("评审交期数据错误!");
+                                failCount++;
+                                continue;
+                            }
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写评审交期!");
+                            failCount++;
+                            continue;
                         }
-                        catch (Exception ex){
-                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("要求交期数据错误!");
+
+                        if (StringUtils.isNotEmpty(strStockQuantity)) {
+                            try {
+                                orderForm.setStockQuantity(Integer.parseInt(strStockQuantity));
+                            } catch (Exception ex) {
+                                sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("库存数量数据错误!");
+                                failCount++;
+                                continue;
+                            }
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写库存数量!");
                             failCount++;
                             continue;
                         }
-                    }
-                    else{
-                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写要求交期!");
-                        failCount++;
-                        continue;
-                    }
 
-                    if(StringUtils.isNotEmpty(strReviewDeliveryTime)){
-                        try {
-                            orderForm.setReviewDeliveryTime(sdf.parse(strReviewDeliveryTime));
+                        if (StringUtils.isNotEmpty(strProductionQuantity)) {
+                            try {
+                                orderForm.setProductionQuantity(Integer.parseInt(strProductionQuantity));
+                            } catch (Exception ex) {
+                                sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("还需生产数量数据错误!");
+                                failCount++;
+                                continue;
+                            }
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写还需生产数量!");
+                            failCount++;
+                            continue;
                         }
-                        catch (Exception ex){
-                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("评审交期数据错误!");
+
+                        if (StringUtils.isNotEmpty(strExpiryTime)) {
+                            try {
+                                orderForm.setExpiryTime(sdf.parse(strExpiryTime));
+                            } catch (Exception ex) {
+                                sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("过期时间数据错误!");
+                                failCount++;
+                                continue;
+                            }
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写过期时间!");
                             failCount++;
                             continue;
                         }
+
+                        orderFormService.update(orderForm);
+
                     }
-                    else{
-                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写评审交期!");
-                        failCount++;
-                        continue;
-                    }
+                    else {
+                        orderForm = new OrderForm();
+                        orderForm.setId(UUID.randomUUID().toString());
+                        orderForm.setDelFlag(false);
+                        orderForm.setCreateBy(subject);
+                        orderForm.setCreateTime(new Date());
+
+                        if (StringUtils.isNotEmpty(strClientEmail)) {
+                            orderForm.setClientEmail(strClientEmail);
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写客户邮箱!");
+                            failCount++;
+                            continue;
+                        }
 
-                    if(StringUtils.isNotEmpty(strStockQuantity)){
-                        try {
-                            orderForm.setStockQuantity(Integer.parseInt(strStockQuantity));
+                        if (StringUtils.isNotEmpty(strClientName)) {
+                            orderForm.setClientName(strClientName);
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写客户名称!");
+                            failCount++;
+                            continue;
                         }
-                        catch (Exception ex){
-                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("库存数量数据错误!");
+
+                        if (StringUtils.isNotEmpty(strClientOrderNumber)) {
+                            orderForm.setClientOrderNumber(strClientOrderNumber);
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写客户订单号!");
                             failCount++;
                             continue;
                         }
-                    }
-                    else{
-                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写库存数量!");
-                        failCount++;
-                        continue;
-                    }
 
-                    if(StringUtils.isNotEmpty(strProductionQuantity)){
-                        try {
-                            orderForm.setProductionQuantity(Integer.parseInt(strProductionQuantity));
+                        if (StringUtils.isNotEmpty(strFeilihuaOrderNumber)) {
+                            orderForm.setFeilihuaOrderNumber(strFeilihuaOrderNumber);
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写菲利华订单号!");
+                            failCount++;
+                            continue;
                         }
-                        catch (Exception ex){
-                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("还需生产数量数据错误!");
+
+                        if (StringUtils.isNotEmpty(strProductName)) {
+                            orderForm.setProductName(strProductName);
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写产品名称!");
                             failCount++;
                             continue;
                         }
-                    }
-                    else{
-                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写还需生产数量!");
-                        failCount++;
-                        continue;
-                    }
 
-                    if(StringUtils.isNotEmpty(strExpiryTime)){
-                        try {
-                            orderForm.setExpiryTime(sdf.parse(strExpiryTime));
+                        if (StringUtils.isNotEmpty(strTrademark)) {
+                            orderForm.setTrademark(strTrademark);
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写牌号!");
+                            failCount++;
+                            continue;
                         }
-                        catch (Exception ex){
-                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("过期时间数据错误!");
+
+                        if (StringUtils.isNotEmpty(strProductSpecification)) {
+                            orderForm.setProductSpecification(strProductSpecification);
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写产品规格!");
                             failCount++;
                             continue;
                         }
-                    }
-                    else{
-                        sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写过期时间!");
-                        failCount++;
-                        continue;
-                    }
 
-                    orderFormService.insert(orderForm);
+                        if (StringUtils.isNotEmpty(strOrderQuantity)) {
+                            try {
+                                orderForm.setOrderQuantity(Integer.parseInt(strOrderQuantity));
+                            } catch (Exception ex) {
+                                sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("订单数量数据错误!");
+                                failCount++;
+                                continue;
+                            }
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写订单数量!");
+                            failCount++;
+                            continue;
+                        }
 
+                        if (StringUtils.isNotEmpty(strUnit)) {
+                            orderForm.setUnit(strUnit);
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写单位!");
+                            failCount++;
+                            continue;
+                        }
+
+                        if (StringUtils.isNotEmpty(strRequiredDeliveryTime)) {
+                            try {
+                                orderForm.setRequiredDeliveryTime(sdf.parse(strRequiredDeliveryTime));
+                            } catch (Exception ex) {
+                                sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("要求交期数据错误!");
+                                failCount++;
+                                continue;
+                            }
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写要求交期!");
+                            failCount++;
+                            continue;
+                        }
+
+                        if (StringUtils.isNotEmpty(strReviewDeliveryTime)) {
+                            try {
+                                orderForm.setReviewDeliveryTime(sdf.parse(strReviewDeliveryTime));
+                            } catch (Exception ex) {
+                                sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("评审交期数据错误!");
+                                failCount++;
+                                continue;
+                            }
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写评审交期!");
+                            failCount++;
+                            continue;
+                        }
+
+                        if (StringUtils.isNotEmpty(strStockQuantity)) {
+                            try {
+                                orderForm.setStockQuantity(Integer.parseInt(strStockQuantity));
+                            } catch (Exception ex) {
+                                sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("库存数量数据错误!");
+                                failCount++;
+                                continue;
+                            }
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写库存数量!");
+                            failCount++;
+                            continue;
+                        }
+
+                        if (StringUtils.isNotEmpty(strProductionQuantity)) {
+                            try {
+                                orderForm.setProductionQuantity(Integer.parseInt(strProductionQuantity));
+                            } catch (Exception ex) {
+                                sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("还需生产数量数据错误!");
+                                failCount++;
+                                continue;
+                            }
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写还需生产数量!");
+                            failCount++;
+                            continue;
+                        }
+
+                        if (StringUtils.isNotEmpty(strExpiryTime)) {
+                            try {
+                                orderForm.setExpiryTime(sdf.parse(strExpiryTime));
+                            } catch (Exception ex) {
+                                sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("过期时间数据错误!");
+                                failCount++;
+                                continue;
+                            }
+                        } else {
+                            sheet1.getRow(rowIndex).createCell(validateColIndex).setCellValue("请填写过期时间!");
+                            failCount++;
+                            continue;
+                        }
+
+                        orderFormService.insert(orderForm);
+
+                    }
                     affectCount++;
                 }
                 catch(Exception innerEx){

+ 44 - 7
web/src/main/java/com/jpsoft/order/modules/open/OrderFormApi.java

@@ -6,20 +6,25 @@ import com.jpsoft.order.modules.base.entity.OrderForm;
 import com.jpsoft.order.modules.base.service.OrderFormService;
 import com.jpsoft.order.modules.common.dto.MessageResult;
 import com.jpsoft.order.modules.common.dto.Sort;
-import com.jpsoft.order.modules.common.utils.OSSUtil;
-import com.jpsoft.order.modules.common.utils.POIUtils;
-import com.jpsoft.order.modules.common.utils.PojoUtils;
+import com.jpsoft.order.modules.common.utils.*;
+import com.jpsoft.order.modules.sys.entity.User;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
+import org.joda.time.DateTime;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
+import springfox.documentation.annotations.ApiIgnore;
 
+import javax.servlet.http.HttpSession;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.text.SimpleDateFormat;
@@ -33,19 +38,21 @@ import static com.jpsoft.order.modules.common.controller.sendEmailController.sen
 public class OrderFormApi {
     private Logger logger = LoggerFactory.getLogger(getClass());
 
+    @Value("${jwt.secret}")
+    private String jwtSecret;
     @Autowired
     private OrderFormService orderFormService;
 
     @ApiOperation(value="列表")
     @RequestMapping(value = "list",method = RequestMethod.POST)
-    public MessageResult<List> list(String clientEmail, String clientOrderNumber){
+    public MessageResult<List> list(String clientOrderNumber, @RequestAttribute String subject){
         MessageResult<List> msgResult = new MessageResult<>();
 
         List<Sort> sortList = new ArrayList<>();
         sortList.add(new Sort("feilihua_order_number", "asc"));
 
         Map<String,Object> searchParams = new HashMap<>();
-        searchParams.put("clientEmail", clientEmail);
+        searchParams.put("clientEmail", subject);
         if (StringUtils.isNotEmpty(clientOrderNumber)) {
             searchParams.put("clientOrderNumber","%"+clientOrderNumber+"%");
         }
@@ -90,8 +97,8 @@ public class OrderFormApi {
         MessageResult msgResult = new MessageResult<>();
 
         try{
-            String eMailTitle = "验证码";
-            String eMailContent = "验证码:" + sCode;
+            String eMailTitle = "验证码 / Verification Code";
+            String eMailContent = "您好,您正在进行菲利华订单查询登录验证,本次操作的验证码:" + sCode + ",请在5分钟内完成验证。<br>Hello, you are in the process of Philips order query login verification. The verification code for this operation is: " + sCode + ", please complete the verification within 5 minutes.";
             MessageResult messageResult = sendEmail(eMail,eMailTitle,eMailContent);
             if(messageResult.isResult()){
                 msgResult.setResult(true);
@@ -108,4 +115,34 @@ public class OrderFormApi {
 
         return msgResult;
     }
+
+    @PostMapping("login")
+    @ApiOperation(value="登录获取token,在swagger ui中获取token时将写入session,调用其它接口时不用再设置header")
+    public MessageResult<String> login(String eMail, @ApiIgnore HttpSession session){
+        MessageResult<String> messageResult = new MessageResult<>();
+
+        try {
+            List<OrderForm> orderFormList = orderFormService.findByEmail(eMail);
+
+            if(orderFormList.size() > 0){
+                //生成token
+                String token = JwtUtil.createToken(jwtSecret, eMail, DateTime.now().plusHours(6).toDate());
+
+                session.setAttribute("token",token);
+
+                messageResult.setResult(true);
+                messageResult.setData(token);
+            }
+            else{
+                messageResult.setResult(false);
+                messageResult.setMessage("用户不存在或密码错误!");
+            }
+        }
+        catch(Exception ex){
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
 }