package com.reptileclient.jlifeapp.web;

import com.reptileclient.jlifeapp.service.HmSalesOrderService;
import com.reptileclient.jlifeapp.service.JzShopService;
import com.reptileclient.jlifeapp.util.email.MailSend;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import java.util.ArrayList;
import java.util.List;

import javax.mail.internet.AddressException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(value = "盒马门店数据", description = "盒马门店数据")
public class JzShopController {

	private static final Logger logger = LoggerFactory.getLogger(JzShopController.class);

	@Autowired
	JzShopService jzShopService;

	/**
	 * 测抓数据
	 * 
	 * @return
	 */
	@ApiOperation(value = "盒马门店数据", notes = "盒马门店数据")
	@GetMapping("runTesJzShop")
	public String runTes() {

		new Thread() {
			public void run() {
				jzShopService.getHmShop();
			};
		}.start();

		return "ok";
	}
	
	@ApiOperation(value = "测试发送邮件", notes = "测试发送邮件")
	@GetMapping("testPostEmail")
	public String testPostEmail(String ss) {
		 try {
			 MailSend.sendMail("documents@lifejingzhi.com", "JZSHjzsh123456", "smtp.qiye.aliyun.com", "25", "test",
				        ss, "documents@lifejingzhi.com", null, "lurunzhen@lifejingzhi.com");
			} catch (AddressException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		 return "ok";
	}

}