| | |
| | | import com.stylefeng.guns.modular.system.dao.DriverTrainMapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.EmailUtil; |
| | | import com.stylefeng.guns.modular.system.util.HttpRequestUtil; |
| | | import com.stylefeng.guns.modular.system.util.PushMinistryOfTransportUtil; |
| | | import com.stylefeng.guns.modular.system.util.PushURL; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import org.apache.poi.ss.usermodel.Cell; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
| | | import org.jsoup.nodes.Element; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | |
| | | private ITLineService itLineService; |
| | | |
| | | @Autowired |
| | | private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; |
| | | |
| | | @Autowired |
| | | private ITDriverTeamService itDriverTeamService; |
| | | |
| | | @Resource |
| | |
| | | @Resource |
| | | private DriverPunishMapper driverPunishMapper; |
| | | |
| | | @Value("${pushMinistryOfTransport}") |
| | | private boolean pushMinistryOfTransport; |
| | | @Value("${spring.mail.template-path}") |
| | | private String templatePath; |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | List<DriverTrain> driverTrains = driverTrainMapper.queryAllTrain(driverId); |
| | | for(DriverTrain driverTrain : driverTrains){ |
| | | boolean b = true; |
| | | for(String s : split){ |
| | | String[] s1 = s.split("_"); |
| | | if(ToolUtil.isNotEmpty(s1[0]) && driverTrain.getId() == Integer.valueOf(s1[0])){ |
| | | b = false; |
| | | break; |
| | | } |
| | | } |
| | | if(b){ |
| | | driverTrainMapper.deleteById(driverTrain.getId()); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.baseInfoDriverEducate(driverTrain.getId(), 3); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | } |
| | | if(update.size() > 0){ |
| | | for(DriverTrain driverTrain : update){ |
| | | driverTrainMapper.updateById(driverTrain); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.baseInfoDriverEducate(driverTrain.getId(), 2); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | } |
| | | if(add.size() > 0){ |
| | | for(DriverTrain driverTrain : add){ |
| | | driverTrainMapper.insert(driverTrain); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.baseInfoDriverEducate(driverTrain.getId(), 1); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | } |
| | | |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | if(update.size() > 0){ |
| | | for(DriverPunish driverTrain : update){ |
| | | driverPunishMapper.updateById(driverTrain); |
| | | } |
| | | } |
| | | if(add.size() > 0){ |
| | | for(DriverPunish driverTrain : add){ |
| | | driverPunishMapper.insert(driverTrain); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.ratedDriverPunish(driverTrain.getId()); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | } |
| | | |
| | |
| | | type = 5; |
| | | tDriver.setAuthState(2); |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.baseInfoCompanyStat(); |
| | | pushMinistryOfTransportUtil.baseInfoDriver(id); |
| | | pushMinistryOfTransportUtil.baseInfoDriverApp(id); |
| | | } |
| | | } |
| | | }).start(); |
| | | |
| | | |
| | | if(tDriver.getUid()!=null && tDriver.getuType()!=null && tDriver.getuType() == 2){ |
| | | TDriver driver = tDriverService.selectById(tDriver.getUid()); |
| | |
| | | tDriver.setAuthState(4); |
| | | } |
| | | |
| | | Map<String,String> map = new HashMap<>(); |
| | | map.put("uid", String.valueOf(tDriver.getId())); |
| | | map.put("type", String.valueOf(type)); |
| | | String result = HttpRequestUtil.postRequest(PushURL.driver_auth_url, map); |
| | | System.out.println("司机注册审核发送短信 :【driverId="+tDriver.getId().toString()+"】,调用接口:"+result); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | String path = templatePath + "driver/index.html"; |
| | | Document document = Jsoup.parse(new File(path), "UTF-8"); |
| | | document.getElementById("chinese").attr("style", "display: none;"); |
| | | document.getElementById("french").attr("style", "display: none;"); |
| | | document.getElementById("invite1").attr("style", "display: none;"); |
| | | document.getElementById("user1").attr("style", "display: none;"); |
| | | document.getElementById("settle1").attr("style", "display: none;"); |
| | | document.getElementById("pass1").attr("style", "display: none;"); |
| | | document.getElementById("email1").attr("style", "display: none;"); |
| | | document.getElementById("bill1").attr("style", "display: none;"); |
| | | document.getElementById("reward1").attr("style", "display: none;"); |
| | | document.getElementById("rewardToday1").attr("style", "display: none;"); |
| | | document.getElementById("carAudit1").attr("style", "display: none;"); |
| | | |
| | | Element driver_audit1_user = document.getElementById("driver_audit1_user"); |
| | | driver_audit1_user.text("Hello " + tDriver.getName() + ","); |
| | | Element driver_audit1_content = document.getElementById("driver_audit1_content"); |
| | | if(1 == authState){ |
| | | driver_audit1_content.text("You application has been approved."); |
| | | }else{ |
| | | driver_audit1_content.text("I'm sorry, your application was rejected. Reason for rejection: Incomplete filling in personal information."); |
| | | } |
| | | EmailUtil.send(tDriver.getEmail(), "Notice of driver registration application", document.html()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }).start(); |
| | | |
| | | tDriverService.updateById(tDriver); |
| | | } |
| | |
| | | TDriver tDriver = tDriverService.selectById(driverId); |
| | | if (1 == optType){ //解冻 |
| | | tDriver.setAuthState(2); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.baseInfoCompanyStat(); |
| | | pushMinistryOfTransportUtil.baseInfoDriver(driverId); |
| | | } |
| | | } |
| | | }).start(); |
| | | }else if (2 == optType){ //冻结 |
| | | tDriver.setAuthState(3); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.baseInfoCompanyStat(); |
| | | pushMinistryOfTransportUtil.baseInfoDriver(driverId); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | tDriver.setRemark(remark); |
| | | tDriverService.updateById(tDriver); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){//上传数据 |
| | | pushMinistryOfTransportUtil.baseInfoDriver(tDriver.getId()); |
| | | } |
| | | } |
| | | }).start(); |
| | | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |