Commit 9426826ab9bec37e515fb90269716a781b74a0f8

Authored by 徐烜
1 parent 911b7a21

iss更新1

添加车辆同步接口web服务
Showing 21 changed files with 931 additions and 2 deletions
@@ -360,6 +360,16 @@ @@ -360,6 +360,16 @@
360 <version>1.7.7</version> 360 <version>1.7.7</version>
361 </dependency> 361 </dependency>
362 362
  363 + <!-- web服务依赖 -->
  364 + <dependency>
  365 + <groupId>org.springframework.boot</groupId>
  366 + <artifactId>spring-boot-starter-ws</artifactId>
  367 + </dependency>
  368 + <dependency>
  369 + <groupId>wsdl4j</groupId>
  370 + <artifactId>wsdl4j</artifactId>
  371 + </dependency>
  372 +
363 </dependencies> 373 </dependencies>
364 374
365 <dependencyManagement> 375 <dependencyManagement>
@@ -396,6 +406,25 @@ @@ -396,6 +406,25 @@
396 <groupId>org.springframework.boot</groupId> 406 <groupId>org.springframework.boot</groupId>
397 <artifactId>spring-boot-maven-plugin</artifactId> 407 <artifactId>spring-boot-maven-plugin</artifactId>
398 </plugin> 408 </plugin>
  409 + <plugin>
  410 + <groupId>org.codehaus.mojo</groupId>
  411 + <artifactId>jaxb2-maven-plugin</artifactId>
  412 + <version>1.6</version>
  413 + <executions>
  414 + <execution>
  415 + <id>xjc</id>
  416 + <goals>
  417 + <goal>xjc</goal>
  418 + </goals>
  419 + </execution>
  420 + </executions>
  421 + <configuration>
  422 + <schemaDirectory>${project.basedir}/src/main/resources/xsd/</schemaDirectory>
  423 + <outputDirectory>${project.basedir}/src/main/java</outputDirectory>
  424 + <clearOutputDir>false</clearOutputDir>
  425 + <encoding>utf-8</encoding>
  426 + </configuration>
  427 + </plugin>
399 </plugins> 428 </plugins>
400 <resources> 429 <resources>
401 <resource> 430 <resource>
src/main/java/com/bsth/common/Constants.java
@@ -23,6 +23,8 @@ public class Constants { @@ -23,6 +23,8 @@ public class Constants {
23 23
24 // springboot manage health的检测url 24 // springboot manage health的检测url
25 public static final String ACTUATOR_MANAGEMENT_HEALTH = "/manage/health"; 25 public static final String ACTUATOR_MANAGEMENT_HEALTH = "/manage/health";
  26 + // web服务url
  27 + public static final String WEBSERVICE_URL = "/ws/**";
26 28
27 //对外的营运数据接口 29 //对外的营运数据接口
28 public static final String SERVICE_INTERFACE = "/companyService/**"; 30 public static final String SERVICE_INTERFACE = "/companyService/**";
src/main/java/com/bsth/entity/schedule/batch/VehicleDataSync.java 0 → 100644
  1 +package com.bsth.entity.schedule.batch;
  2 +
  3 +import javax.persistence.*;
  4 +import java.io.Serializable;
  5 +import java.util.Date;
  6 +
  7 +/**
  8 + * 车辆数据同步数据。
  9 + */
  10 +@Entity
  11 +@Table(name = "bsth_c_cars_sync")
  12 +public class VehicleDataSync implements Serializable {
  13 + /** 主健Id */
  14 + @Id
  15 + @GeneratedValue
  16 + private Long id;
  17 +
  18 + //--------------- 标识车辆的数据(自编号和车牌号) ---------------//
  19 + /** 自编号/内部编号 */
  20 + private String idenZbh;
  21 + /** 车牌号 */
  22 + private String idenCph;
  23 +
  24 + //--------------- 更新的数据 ------------//
  25 + /** 更新 公司代码 */
  26 + private String updateGsdm;
  27 + /** 更新 公司名称 */
  28 + private String updateGsmc;
  29 + /** 更新 分公司代码 */
  30 + private String updateFgsdm;
  31 + /** 更新 分公司名称 */
  32 + private String updateFgsmc;
  33 + /** 是否报废 */
  34 + private Boolean updateSfbf;
  35 + /** 报废日期 */
  36 + private Date updateBfd;
  37 +
  38 + // TODO:后续再添加
  39 +
  40 + //--------------- 时间,状态数据 ------------//
  41 + /** 创建时间 */
  42 + @Column(nullable = false)
  43 + private Date createDate;
  44 + /** 更新时间 */
  45 + @Column(nullable = false)
  46 + private Date updateDate;
  47 + /** 同步状态 */
  48 + @Column(nullable = false)
  49 + @Convert(converter = VehicleDataSyncStatusEnumConverter.class)
  50 + private VehicleDataSyncStatusEnum status;
  51 +
  52 + public Long getId() {
  53 + return id;
  54 + }
  55 +
  56 + public void setId(Long id) {
  57 + this.id = id;
  58 + }
  59 +
  60 + public String getIdenZbh() {
  61 + return idenZbh;
  62 + }
  63 +
  64 + public void setIdenZbh(String idenZbh) {
  65 + this.idenZbh = idenZbh;
  66 + }
  67 +
  68 + public String getIdenCph() {
  69 + return idenCph;
  70 + }
  71 +
  72 + public void setIdenCph(String idenCph) {
  73 + this.idenCph = idenCph;
  74 + }
  75 +
  76 + public String getUpdateGsdm() {
  77 + return updateGsdm;
  78 + }
  79 +
  80 + public void setUpdateGsdm(String updateGsdm) {
  81 + this.updateGsdm = updateGsdm;
  82 + }
  83 +
  84 + public String getUpdateGsmc() {
  85 + return updateGsmc;
  86 + }
  87 +
  88 + public void setUpdateGsmc(String updateGsmc) {
  89 + this.updateGsmc = updateGsmc;
  90 + }
  91 +
  92 + public Date getCreateDate() {
  93 + return createDate;
  94 + }
  95 +
  96 + public void setCreateDate(Date createDate) {
  97 + this.createDate = createDate;
  98 + }
  99 +
  100 + public Date getUpdateDate() {
  101 + return updateDate;
  102 + }
  103 +
  104 + public void setUpdateDate(Date updateDate) {
  105 + this.updateDate = updateDate;
  106 + }
  107 +
  108 + public VehicleDataSyncStatusEnum getStatus() {
  109 + return status;
  110 + }
  111 +
  112 + public void setStatus(VehicleDataSyncStatusEnum status) {
  113 + this.status = status;
  114 + }
  115 +
  116 + public Boolean getUpdateSfbf() {
  117 + return updateSfbf;
  118 + }
  119 +
  120 + public void setUpdateSfbf(Boolean updateSfbf) {
  121 + this.updateSfbf = updateSfbf;
  122 + }
  123 +
  124 + public Date getUpdateBfd() {
  125 + return updateBfd;
  126 + }
  127 +
  128 + public void setUpdateBfd(Date updateBfd) {
  129 + this.updateBfd = updateBfd;
  130 + }
  131 +
  132 + public String getUpdateFgsdm() {
  133 + return updateFgsdm;
  134 + }
  135 +
  136 + public void setUpdateFgsdm(String updateFgsdm) {
  137 + this.updateFgsdm = updateFgsdm;
  138 + }
  139 +
  140 + public String getUpdateFgsmc() {
  141 + return updateFgsmc;
  142 + }
  143 +
  144 + public void setUpdateFgsmc(String updateFgsmc) {
  145 + this.updateFgsmc = updateFgsmc;
  146 + }
  147 +}
0 \ No newline at end of file 148 \ No newline at end of file
src/main/java/com/bsth/entity/schedule/batch/VehicleDataSyncStat.java 0 → 100644
  1 +package com.bsth.entity.schedule.batch;
  2 +
  3 +import javax.persistence.*;
  4 +import java.io.Serializable;
  5 +import java.util.Date;
  6 +
  7 +/**
  8 + * 车辆数据同步数据统计。
  9 + */
  10 +@Entity
  11 +@Table(name = "bsth_c_cars_sync_stat")
  12 +public class VehicleDataSyncStat implements Serializable {
  13 + /** 主健Id */
  14 + @Id
  15 + @GeneratedValue
  16 + private Long id;
  17 +
  18 + /** job实例Id */
  19 + @Column(nullable = false)
  20 + private Long jobId;
  21 + /** job名字 */
  22 + @Column(nullable = false)
  23 + private String jobName;
  24 + /** job执行Id */
  25 + @Column(nullable = false, unique = true)
  26 + private Long jobExecutionId;
  27 +
  28 + /** 待同步的车辆数据ids(同步状态=SYNCING) */
  29 + @Column(length = 2000)
  30 + private String syncDataPrepareIds;
  31 + /** 待同步的车辆数据自编号s(同步状态=SYNCING) */
  32 + @Column(length = 2000)
  33 + private String syncDataPrepareZbhs;
  34 +
  35 + /** 待同步的车辆count */
  36 + private Integer syncDataPrepareCount;
  37 + /** 同步成功的车辆count */
  38 + private Integer syncDataSuccessCount;
  39 +
  40 + /** 退出step执行Id */
  41 + private Long exitStepExecutionId;
  42 + /** 退出异常stack信息 */
  43 + @Column(length = 2500)
  44 + private String exitStackTrace;
  45 +
  46 + /** 同步状态 */
  47 + @Column(nullable = false)
  48 + @Convert(converter = VehicleDataSyncStatusEnumConverter.class)
  49 + private VehicleDataSyncStatusEnum status;
  50 +
  51 + /** job执行开始时间 */
  52 + @Column(nullable = false)
  53 + private Date startDate;
  54 + /** job执行结束时间 */
  55 + private Date endDate;
  56 +
  57 + public Long getId() {
  58 + return id;
  59 + }
  60 +
  61 + public void setId(Long id) {
  62 + this.id = id;
  63 + }
  64 +
  65 + public Long getJobId() {
  66 + return jobId;
  67 + }
  68 +
  69 + public void setJobId(Long jobId) {
  70 + this.jobId = jobId;
  71 + }
  72 +
  73 + public String getJobName() {
  74 + return jobName;
  75 + }
  76 +
  77 + public void setJobName(String jobName) {
  78 + this.jobName = jobName;
  79 + }
  80 +
  81 + public Long getJobExecutionId() {
  82 + return jobExecutionId;
  83 + }
  84 +
  85 + public void setJobExecutionId(Long jobExecutionId) {
  86 + this.jobExecutionId = jobExecutionId;
  87 + }
  88 +
  89 + public String getSyncDataPrepareIds() {
  90 + return syncDataPrepareIds;
  91 + }
  92 +
  93 + public void setSyncDataPrepareIds(String syncDataPrepareIds) {
  94 + this.syncDataPrepareIds = syncDataPrepareIds;
  95 + }
  96 +
  97 + public String getSyncDataPrepareZbhs() {
  98 + return syncDataPrepareZbhs;
  99 + }
  100 +
  101 + public void setSyncDataPrepareZbhs(String syncDataPrepareZbhs) {
  102 + this.syncDataPrepareZbhs = syncDataPrepareZbhs;
  103 + }
  104 +
  105 + public Integer getSyncDataPrepareCount() {
  106 + return syncDataPrepareCount;
  107 + }
  108 +
  109 + public void setSyncDataPrepareCount(Integer syncDataPrepareCount) {
  110 + this.syncDataPrepareCount = syncDataPrepareCount;
  111 + }
  112 +
  113 + public Integer getSyncDataSuccessCount() {
  114 + return syncDataSuccessCount;
  115 + }
  116 +
  117 + public void setSyncDataSuccessCount(Integer syncDataSuccessCount) {
  118 + this.syncDataSuccessCount = syncDataSuccessCount;
  119 + }
  120 +
  121 + public Long getExitStepExecutionId() {
  122 + return exitStepExecutionId;
  123 + }
  124 +
  125 + public void setExitStepExecutionId(Long exitStepExecutionId) {
  126 + this.exitStepExecutionId = exitStepExecutionId;
  127 + }
  128 +
  129 + public String getExitStackTrace() {
  130 + return exitStackTrace;
  131 + }
  132 +
  133 + public void setExitStackTrace(String exitStackTrace) {
  134 + this.exitStackTrace = exitStackTrace;
  135 + }
  136 +
  137 + public VehicleDataSyncStatusEnum getStatus() {
  138 + return status;
  139 + }
  140 +
  141 + public void setStatus(VehicleDataSyncStatusEnum status) {
  142 + this.status = status;
  143 + }
  144 +
  145 + public Date getStartDate() {
  146 + return startDate;
  147 + }
  148 +
  149 + public void setStartDate(Date startDate) {
  150 + this.startDate = startDate;
  151 + }
  152 +
  153 + public Date getEndDate() {
  154 + return endDate;
  155 + }
  156 +
  157 + public void setEndDate(Date endDate) {
  158 + this.endDate = endDate;
  159 + }
  160 +}
src/main/java/com/bsth/entity/schedule/batch/VehicleDataSyncStatusEnum.java 0 → 100644
  1 +package com.bsth.entity.schedule.batch;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonCreator;
  4 +import com.fasterxml.jackson.annotation.JsonValue;
  5 +import org.springframework.util.StringUtils;
  6 +
  7 +import java.util.HashMap;
  8 +import java.util.Map;
  9 +
  10 +/**
  11 + * 车辆数据同步状态enum。
  12 + */
  13 +public enum VehicleDataSyncStatusEnum {
  14 + PREPARE("准备"),
  15 + SYNCING("同步中"),
  16 + SUCCESS("成功"),
  17 + FAILURE("失败");
  18 +
  19 + public static Map<String, VehicleDataSyncStatusEnum> enumMap =
  20 + new HashMap<String, VehicleDataSyncStatusEnum>() {{
  21 + put("准备", PREPARE);
  22 + put("同步中", SYNCING);
  23 + put("成功", SUCCESS);
  24 + put("失败", FAILURE);
  25 + }};
  26 +
  27 + /** 字典描述(对应数据库的字典) */
  28 + private String dicDesc;
  29 +
  30 + @JsonCreator
  31 + VehicleDataSyncStatusEnum(String dicDesc) {
  32 + this.dicDesc = dicDesc;
  33 + }
  34 +
  35 + public static VehicleDataSyncStatusEnum fromDicDesc(String dicDesc) {
  36 + if (StringUtils.isEmpty(dicDesc)) {
  37 + throw new RuntimeException("车辆数据同步状态描述不能为空!");
  38 + } else if (enumMap.get(dicDesc) == null) {
  39 + throw new RuntimeException("车辆数据同步状态未定义:" + dicDesc);
  40 + }
  41 + return enumMap.get(dicDesc);
  42 + }
  43 +
  44 + @JsonValue
  45 + public String getDicDesc() {
  46 + return dicDesc;
  47 + }
  48 +
  49 + public void setDicDesc(String dicDesc) {
  50 + this.dicDesc = dicDesc;
  51 + }
  52 +
  53 + @Override
  54 + public String toString() {
  55 + return dicDesc;
  56 + }
  57 +}
src/main/java/com/bsth/entity/schedule/batch/VehicleDataSyncStatusEnumConverter.java 0 → 100644
  1 +package com.bsth.entity.schedule.batch;
  2 +
  3 +import javax.persistence.AttributeConverter;
  4 +import javax.persistence.Convert;
  5 +
  6 +@Convert
  7 +public class VehicleDataSyncStatusEnumConverter implements AttributeConverter<VehicleDataSyncStatusEnum, String> {
  8 + @Override
  9 + public String convertToDatabaseColumn(VehicleDataSyncStatusEnum vehicleDataSyncStatusEnum) {
  10 + return vehicleDataSyncStatusEnum.getDicDesc();
  11 + }
  12 +
  13 + @Override
  14 + public VehicleDataSyncStatusEnum convertToEntityAttribute(String s) {
  15 + return VehicleDataSyncStatusEnum.fromDicDesc(s);
  16 + }
  17 +}
src/main/java/com/bsth/filter/BaseFilter.java
@@ -17,7 +17,7 @@ public abstract class BaseFilter implements Filter { @@ -17,7 +17,7 @@ public abstract class BaseFilter implements Filter {
17 * 白名单 17 * 白名单
18 */ 18 */
19 private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.SERVICE_INTERFACE, 19 private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.SERVICE_INTERFACE,
20 - Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS, Constants.UP_RFID_URL, Constants.STATION_AND_SECTION_COUNT, Constants.ACTUATOR_MANAGEMENT_HEALTH }; 20 + Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS, Constants.UP_RFID_URL, Constants.STATION_AND_SECTION_COUNT, Constants.ACTUATOR_MANAGEMENT_HEALTH, Constants.WEBSERVICE_URL };
21 21
22 @Override 22 @Override
23 public void destroy() { 23 public void destroy() {
src/main/java/com/bsth/repository/schedule/batch/VehicleDataSyncRepo.java 0 → 100644
  1 +package com.bsth.repository.schedule.batch;
  2 +
  3 +import com.bsth.entity.schedule.batch.VehicleDataSync;
  4 +import com.bsth.repository.BaseRepository;
  5 +import org.springframework.stereotype.Repository;
  6 +
  7 +@Repository
  8 +public interface VehicleDataSyncRepo extends BaseRepository<VehicleDataSync, Long> {
  9 +}
src/main/java/com/bsth/repository/schedule/batch/VehicleDataSyncStatRepo.java 0 → 100644
  1 +package com.bsth.repository.schedule.batch;
  2 +
  3 +import com.bsth.entity.schedule.batch.VehicleDataSyncStat;
  4 +import com.bsth.repository.BaseRepository;
  5 +import org.springframework.stereotype.Repository;
  6 +
  7 +@Repository
  8 +public interface VehicleDataSyncStatRepo extends BaseRepository<VehicleDataSyncStat, Long> {
  9 +
  10 +}
src/main/java/com/bsth/security/filter/LoginInterceptor.java
@@ -33,7 +33,7 @@ public class LoginInterceptor implements Filter { @@ -33,7 +33,7 @@ public class LoginInterceptor implements Filter {
33 * 相比于 BaseFilter,此处对线调GPS请求进行了拦截验证 33 * 相比于 BaseFilter,此处对线调GPS请求进行了拦截验证
34 */ 34 */
35 private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.SERVICE_INTERFACE, 35 private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.SERVICE_INTERFACE,
36 - Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.UP_RFID_URL,Constants.STATION_AND_SECTION_COUNT }; 36 + Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.UP_RFID_URL,Constants.STATION_AND_SECTION_COUNT, Constants.WEBSERVICE_URL };
37 37
38 38
39 @Override 39 @Override
src/main/java/com/bsth/service/schedule/batch/VehicleDataSyncService.java 0 → 100644
  1 +package com.bsth.service.schedule.batch;
  2 +
  3 +import com.bsth.entity.schedule.batch.VehicleDataSync;
  4 +import com.bsth.service.schedule.BService;
  5 +
  6 +public interface VehicleDataSyncService extends BService<VehicleDataSync, Long> {
  7 +}
src/main/java/com/bsth/service/schedule/batch/VehicleDataSyncServiceImpl.java 0 → 100644
  1 +package com.bsth.service.schedule.batch;
  2 +
  3 +import com.bsth.control_v2.plan_module.common.exception.PlanModuleException;
  4 +import com.bsth.entity.schedule.batch.VehicleDataSync;
  5 +import com.bsth.service.schedule.impl.BServiceImpl;
  6 +import org.springframework.stereotype.Service;
  7 +
  8 +@Service
  9 +public class VehicleDataSyncServiceImpl extends BServiceImpl<VehicleDataSync, Long> implements VehicleDataSyncService {
  10 + @Override
  11 + public void delete(Long aLong) {
  12 + throw new PlanModuleException("不支持delete方法!");
  13 + }
  14 +}
src/main/java/com/bsth/service/schedule/batch/VehicleDataSyncStatService.java 0 → 100644
  1 +package com.bsth.service.schedule.batch;
  2 +
  3 +import com.bsth.entity.schedule.batch.VehicleDataSyncStat;
  4 +import com.bsth.service.schedule.BService;
  5 +
  6 +public interface VehicleDataSyncStatService extends BService<VehicleDataSyncStat, Long> {
  7 +}
src/main/java/com/bsth/service/schedule/batch/VehicleDataSyncStatServiceImpl.java 0 → 100644
  1 +package com.bsth.service.schedule.batch;
  2 +
  3 +import com.bsth.control_v2.plan_module.common.exception.PlanModuleException;
  4 +import com.bsth.entity.schedule.batch.VehicleDataSyncStat;
  5 +import com.bsth.service.schedule.impl.BServiceImpl;
  6 +import org.springframework.stereotype.Service;
  7 +
  8 +@Service
  9 +public class VehicleDataSyncStatServiceImpl extends BServiceImpl<VehicleDataSyncStat, Long> implements VehicleDataSyncStatService {
  10 + @Override
  11 + public VehicleDataSyncStat save(VehicleDataSyncStat vehicleDataSyncStat) {
  12 + throw new PlanModuleException("不支持save方法!");
  13 + }
  14 +
  15 + @Override
  16 + public void delete(Long aLong) {
  17 + throw new PlanModuleException("不支持delete方法!");
  18 + }
  19 +}
src/main/java/com/bsth/service/schedule/batch/webservice/VehicleSyncEndpoint.java 0 → 100644
  1 +package com.bsth.service.schedule.batch.webservice;
  2 +
  3 +import com.bsth.entity.schedule.batch.VehicleDataSync;
  4 +import com.bsth.entity.schedule.batch.VehicleDataSyncStatusEnum;
  5 +import com.bsth.service.schedule.batch.VehicleDataSyncService;
  6 +import com.bsth.service.schedule.batch.webservice.vehiclesync.AddVehicleDataSyncRequest;
  7 +import com.bsth.service.schedule.batch.webservice.vehiclesync.AddVehicleDataSyncResponse;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.ws.server.endpoint.annotation.Endpoint;
  10 +import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
  11 +import org.springframework.ws.server.endpoint.annotation.RequestPayload;
  12 +import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
  13 +
  14 +import java.util.Date;
  15 +
  16 +@Endpoint
  17 +public class VehicleSyncEndpoint {
  18 + /** 名字空间uri */
  19 + private static final String NAMESPACE_URI = "http://bsth.com/service/schedule/batch/webservice/vehicleSync";
  20 +
  21 + @Autowired
  22 + private VehicleDataSyncService vehicleDataSyncService;
  23 + @PayloadRoot(namespace = NAMESPACE_URI, localPart = "addVehicleDataSyncRequest")
  24 + @ResponsePayload
  25 + public AddVehicleDataSyncResponse addVehicleDataSync(
  26 + @RequestPayload AddVehicleDataSyncRequest addVehicleDataSyncRequest) {
  27 + AddVehicleDataSyncResponse addVehicleDataSyncResponse = new AddVehicleDataSyncResponse();
  28 + try {
  29 + // 创建车辆同步数据
  30 + VehicleDataSync vehicleDataSync = new VehicleDataSync();
  31 + vehicleDataSync.setIdenZbh(addVehicleDataSyncRequest.getIdenZbh());
  32 + vehicleDataSync.setIdenCph(addVehicleDataSyncRequest.getIdenCph());
  33 + vehicleDataSync.setUpdateGsmc(addVehicleDataSyncRequest.getUpdateGsmc());
  34 + vehicleDataSync.setUpdateFgsmc(addVehicleDataSyncRequest.getUpdateFgsmc());
  35 + vehicleDataSync.setUpdateSfbf(addVehicleDataSyncRequest.isUpdateSfbf());
  36 +
  37 + vehicleDataSync.setStatus(VehicleDataSyncStatusEnum.PREPARE);
  38 + vehicleDataSync.setCreateDate(new Date());
  39 + vehicleDataSync.setUpdateDate(new Date());
  40 + vehicleDataSyncService.save(vehicleDataSync);
  41 +
  42 + addVehicleDataSyncResponse.setSuccess(true);
  43 + addVehicleDataSyncResponse.setMessage("OK!");
  44 + } catch (Exception exp) {
  45 + exp.printStackTrace();
  46 + addVehicleDataSyncResponse.setSuccess(false);
  47 + addVehicleDataSyncResponse.setMessage(exp.getMessage());
  48 + }
  49 +
  50 + return addVehicleDataSyncResponse;
  51 + }
  52 +}
src/main/java/com/bsth/service/schedule/batch/webservice/WebServiceConfig.java 0 → 100644
  1 +package com.bsth.service.schedule.batch.webservice;
  2 +
  3 +import org.springframework.boot.context.embedded.ServletRegistrationBean;
  4 +import org.springframework.context.ApplicationContext;
  5 +import org.springframework.context.annotation.Bean;
  6 +import org.springframework.context.annotation.Configuration;
  7 +import org.springframework.core.io.ClassPathResource;
  8 +import org.springframework.ws.config.annotation.EnableWs;
  9 +import org.springframework.ws.config.annotation.WsConfigurerAdapter;
  10 +import org.springframework.ws.transport.http.MessageDispatcherServlet;
  11 +import org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition;
  12 +import org.springframework.xml.xsd.SimpleXsdSchema;
  13 +import org.springframework.xml.xsd.XsdSchema;
  14 +
  15 +@EnableWs
  16 +@Configuration
  17 +public class WebServiceConfig extends WsConfigurerAdapter {
  18 + @Bean
  19 + public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
  20 + MessageDispatcherServlet servlet = new MessageDispatcherServlet();
  21 + servlet.setApplicationContext(applicationContext);
  22 + servlet.setTransformWsdlLocations(true);
  23 + return new ServletRegistrationBean(servlet, "/ws/*");
  24 + }
  25 +
  26 + @Bean(name="vehicleSync")
  27 + public DefaultWsdl11Definition vehicleSyncWsdl11Definition(XsdSchema vehicleSyncSchema) {
  28 + DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
  29 + wsdl11Definition.setPortTypeName("vehicleSyncPort");
  30 + wsdl11Definition.setLocationUri("/ws");
  31 + wsdl11Definition.setTargetNamespace("http://bsth.com/service/schedule/batch/webservice/vehicleSync");
  32 + wsdl11Definition.setSchema(vehicleSyncSchema);
  33 + return wsdl11Definition;
  34 + }
  35 +
  36 + @Bean
  37 + public XsdSchema vehicleSyncSchema() {
  38 + return new SimpleXsdSchema(new ClassPathResource("/xsd/vehicleSync.xsd"));
  39 + }
  40 +
  41 +
  42 +}
src/main/java/com/bsth/service/schedule/batch/webservice/vehiclesync/AddVehicleDataSyncRequest.java 0 → 100644
  1 +//
  2 +// 此文件是由 JavaTM Architecture for XML Binding (JAXB) 引用实现 v2.2.7 生成的
  3 +// 请访问 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
  4 +// 在重新编译源模式时, 对此文件的所有修改都将丢失。
  5 +// 生成时间: 2020.06.23 时间 03:15:37 PM CST
  6 +//
  7 +
  8 +
  9 +package com.bsth.service.schedule.batch.webservice.vehiclesync;
  10 +
  11 +import javax.xml.bind.annotation.XmlAccessType;
  12 +import javax.xml.bind.annotation.XmlAccessorType;
  13 +import javax.xml.bind.annotation.XmlElement;
  14 +import javax.xml.bind.annotation.XmlRootElement;
  15 +import javax.xml.bind.annotation.XmlType;
  16 +
  17 +
  18 +/**
  19 + * <p>anonymous complex type的 Java 类。
  20 + *
  21 + * <p>以下模式片段指定包含在此类中的预期内容。
  22 + *
  23 + * <pre>
  24 + * &lt;complexType>
  25 + * &lt;complexContent>
  26 + * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
  27 + * &lt;sequence>
  28 + * &lt;element name="idenZbh" type="{http://www.w3.org/2001/XMLSchema}string"/>
  29 + * &lt;element name="idenCph" type="{http://www.w3.org/2001/XMLSchema}string"/>
  30 + * &lt;element name="updateGsmc" type="{http://www.w3.org/2001/XMLSchema}string"/>
  31 + * &lt;element name="updateFgsmc" type="{http://www.w3.org/2001/XMLSchema}string"/>
  32 + * &lt;element name="updateSfbf" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
  33 + * &lt;/sequence>
  34 + * &lt;/restriction>
  35 + * &lt;/complexContent>
  36 + * &lt;/complexType>
  37 + * </pre>
  38 + *
  39 + *
  40 + */
  41 +@XmlAccessorType(XmlAccessType.FIELD)
  42 +@XmlType(name = "", propOrder = {
  43 + "idenZbh",
  44 + "idenCph",
  45 + "updateGsmc",
  46 + "updateFgsmc",
  47 + "updateSfbf"
  48 +})
  49 +@XmlRootElement(name = "addVehicleDataSyncRequest")
  50 +public class AddVehicleDataSyncRequest {
  51 +
  52 + @XmlElement(required = true)
  53 + protected String idenZbh;
  54 + @XmlElement(required = true)
  55 + protected String idenCph;
  56 + @XmlElement(required = true)
  57 + protected String updateGsmc;
  58 + @XmlElement(required = true)
  59 + protected String updateFgsmc;
  60 + protected boolean updateSfbf;
  61 +
  62 + /**
  63 + * 获取idenZbh属性的值。
  64 + *
  65 + * @return
  66 + * possible object is
  67 + * {@link String }
  68 + *
  69 + */
  70 + public String getIdenZbh() {
  71 + return idenZbh;
  72 + }
  73 +
  74 + /**
  75 + * 设置idenZbh属性的值。
  76 + *
  77 + * @param value
  78 + * allowed object is
  79 + * {@link String }
  80 + *
  81 + */
  82 + public void setIdenZbh(String value) {
  83 + this.idenZbh = value;
  84 + }
  85 +
  86 + /**
  87 + * 获取idenCph属性的值。
  88 + *
  89 + * @return
  90 + * possible object is
  91 + * {@link String }
  92 + *
  93 + */
  94 + public String getIdenCph() {
  95 + return idenCph;
  96 + }
  97 +
  98 + /**
  99 + * 设置idenCph属性的值。
  100 + *
  101 + * @param value
  102 + * allowed object is
  103 + * {@link String }
  104 + *
  105 + */
  106 + public void setIdenCph(String value) {
  107 + this.idenCph = value;
  108 + }
  109 +
  110 + /**
  111 + * 获取updateGsmc属性的值。
  112 + *
  113 + * @return
  114 + * possible object is
  115 + * {@link String }
  116 + *
  117 + */
  118 + public String getUpdateGsmc() {
  119 + return updateGsmc;
  120 + }
  121 +
  122 + /**
  123 + * 设置updateGsmc属性的值。
  124 + *
  125 + * @param value
  126 + * allowed object is
  127 + * {@link String }
  128 + *
  129 + */
  130 + public void setUpdateGsmc(String value) {
  131 + this.updateGsmc = value;
  132 + }
  133 +
  134 + /**
  135 + * 获取updateFgsmc属性的值。
  136 + *
  137 + * @return
  138 + * possible object is
  139 + * {@link String }
  140 + *
  141 + */
  142 + public String getUpdateFgsmc() {
  143 + return updateFgsmc;
  144 + }
  145 +
  146 + /**
  147 + * 设置updateFgsmc属性的值。
  148 + *
  149 + * @param value
  150 + * allowed object is
  151 + * {@link String }
  152 + *
  153 + */
  154 + public void setUpdateFgsmc(String value) {
  155 + this.updateFgsmc = value;
  156 + }
  157 +
  158 + /**
  159 + * 获取updateSfbf属性的值。
  160 + *
  161 + */
  162 + public boolean isUpdateSfbf() {
  163 + return updateSfbf;
  164 + }
  165 +
  166 + /**
  167 + * 设置updateSfbf属性的值。
  168 + *
  169 + */
  170 + public void setUpdateSfbf(boolean value) {
  171 + this.updateSfbf = value;
  172 + }
  173 +
  174 +}
src/main/java/com/bsth/service/schedule/batch/webservice/vehiclesync/AddVehicleDataSyncResponse.java 0 → 100644
  1 +//
  2 +// 此文件是由 JavaTM Architecture for XML Binding (JAXB) 引用实现 v2.2.7 生成的
  3 +// 请访问 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
  4 +// 在重新编译源模式时, 对此文件的所有修改都将丢失。
  5 +// 生成时间: 2020.06.23 时间 03:15:37 PM CST
  6 +//
  7 +
  8 +
  9 +package com.bsth.service.schedule.batch.webservice.vehiclesync;
  10 +
  11 +import javax.xml.bind.annotation.XmlAccessType;
  12 +import javax.xml.bind.annotation.XmlAccessorType;
  13 +import javax.xml.bind.annotation.XmlElement;
  14 +import javax.xml.bind.annotation.XmlRootElement;
  15 +import javax.xml.bind.annotation.XmlType;
  16 +
  17 +
  18 +/**
  19 + * <p>anonymous complex type的 Java 类。
  20 + *
  21 + * <p>以下模式片段指定包含在此类中的预期内容。
  22 + *
  23 + * <pre>
  24 + * &lt;complexType>
  25 + * &lt;complexContent>
  26 + * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
  27 + * &lt;sequence>
  28 + * &lt;element name="success" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
  29 + * &lt;element name="message" type="{http://www.w3.org/2001/XMLSchema}string"/>
  30 + * &lt;/sequence>
  31 + * &lt;/restriction>
  32 + * &lt;/complexContent>
  33 + * &lt;/complexType>
  34 + * </pre>
  35 + *
  36 + *
  37 + */
  38 +@XmlAccessorType(XmlAccessType.FIELD)
  39 +@XmlType(name = "", propOrder = {
  40 + "success",
  41 + "message"
  42 +})
  43 +@XmlRootElement(name = "addVehicleDataSyncResponse")
  44 +public class AddVehicleDataSyncResponse {
  45 +
  46 + protected boolean success;
  47 + @XmlElement(required = true)
  48 + protected String message;
  49 +
  50 + /**
  51 + * 获取success属性的值。
  52 + *
  53 + */
  54 + public boolean isSuccess() {
  55 + return success;
  56 + }
  57 +
  58 + /**
  59 + * 设置success属性的值。
  60 + *
  61 + */
  62 + public void setSuccess(boolean value) {
  63 + this.success = value;
  64 + }
  65 +
  66 + /**
  67 + * 获取message属性的值。
  68 + *
  69 + * @return
  70 + * possible object is
  71 + * {@link String }
  72 + *
  73 + */
  74 + public String getMessage() {
  75 + return message;
  76 + }
  77 +
  78 + /**
  79 + * 设置message属性的值。
  80 + *
  81 + * @param value
  82 + * allowed object is
  83 + * {@link String }
  84 + *
  85 + */
  86 + public void setMessage(String value) {
  87 + this.message = value;
  88 + }
  89 +
  90 +}
src/main/java/com/bsth/service/schedule/batch/webservice/vehiclesync/ObjectFactory.java 0 → 100644
  1 +//
  2 +// 此文件是由 JavaTM Architecture for XML Binding (JAXB) 引用实现 v2.2.7 生成的
  3 +// 请访问 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
  4 +// 在重新编译源模式时, 对此文件的所有修改都将丢失。
  5 +// 生成时间: 2020.06.23 时间 03:15:37 PM CST
  6 +//
  7 +
  8 +
  9 +package com.bsth.service.schedule.batch.webservice.vehiclesync;
  10 +
  11 +import javax.xml.bind.annotation.XmlRegistry;
  12 +
  13 +
  14 +/**
  15 + * This object contains factory methods for each
  16 + * Java content interface and Java element interface
  17 + * generated in the com.bsth.service.schedule.batch.webservice.vehiclesync package.
  18 + * <p>An ObjectFactory allows you to programatically
  19 + * construct new instances of the Java representation
  20 + * for XML content. The Java representation of XML
  21 + * content can consist of schema derived interfaces
  22 + * and classes representing the binding of schema
  23 + * type definitions, element declarations and model
  24 + * groups. Factory methods for each of these are
  25 + * provided in this class.
  26 + *
  27 + */
  28 +@XmlRegistry
  29 +public class ObjectFactory {
  30 +
  31 +
  32 + /**
  33 + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.bsth.service.schedule.batch.webservice.vehiclesync
  34 + *
  35 + */
  36 + public ObjectFactory() {
  37 + }
  38 +
  39 + /**
  40 + * Create an instance of {@link AddVehicleDataSyncResponse }
  41 + *
  42 + */
  43 + public AddVehicleDataSyncResponse createAddVehicleDataSyncResponse() {
  44 + return new AddVehicleDataSyncResponse();
  45 + }
  46 +
  47 + /**
  48 + * Create an instance of {@link AddVehicleDataSyncRequest }
  49 + *
  50 + */
  51 + public AddVehicleDataSyncRequest createAddVehicleDataSyncRequest() {
  52 + return new AddVehicleDataSyncRequest();
  53 + }
  54 +
  55 +}
src/main/java/com/bsth/service/schedule/batch/webservice/vehiclesync/package-info.java 0 → 100644
  1 +//
  2 +// 此文件是由 JavaTM Architecture for XML Binding (JAXB) 引用实现 v2.2.7 生成的
  3 +// 请访问 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
  4 +// 在重新编译源模式时, 对此文件的所有修改都将丢失。
  5 +// 生成时间: 2020.06.23 时间 03:15:37 PM CST
  6 +//
  7 +
  8 +@javax.xml.bind.annotation.XmlSchema(namespace = "http://bsth.com/service/schedule/batch/webservice/vehicleSync", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
  9 +package com.bsth.service.schedule.batch.webservice.vehiclesync;
src/main/resources/xsd/vehicleSync.xsd 0 → 100644
  1 +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  2 + xmlns:tns="http://bsth.com/service/schedule/batch/webservice/vehicleSync"
  3 + targetNamespace="http://bsth.com/service/schedule/batch/webservice/vehicleSync"
  4 + elementFormDefault="qualified">
  5 +
  6 + <!-- 车辆信息更新请求类型 -->
  7 + <xs:element name="addVehicleDataSyncRequest">
  8 + <xs:complexType>
  9 + <xs:sequence>
  10 + <xs:element name="idenZbh" type="xs:string" />
  11 + <xs:element name="idenCph" type="xs:string" />
  12 + <xs:element name="updateGsmc" type="xs:string" />
  13 + <xs:element name="updateFgsmc" type="xs:string" />
  14 + <xs:element name="updateSfbf" type="xs:boolean" />
  15 + </xs:sequence>
  16 + </xs:complexType>
  17 + </xs:element>
  18 +
  19 + <!-- 车辆信息更新返回类型 -->
  20 + <xs:element name="addVehicleDataSyncResponse">
  21 + <xs:complexType>
  22 + <xs:sequence>
  23 + <xs:element name="success" type="xs:boolean"/>
  24 + <xs:element name="message" type="xs:string"/>
  25 + </xs:sequence>
  26 + </xs:complexType>
  27 + </xs:element>
  28 +
  29 +</xs:schema>
0 \ No newline at end of file 30 \ No newline at end of file