Browse Source

派遣结案webservice接口v2

dev
尹作梅 6 years ago
parent
commit
a8eaafd887
  1. 4
      esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/enums/InterfaceLogBusinessTypeEnum.java
  2. 4
      esua-epdc/epdc-module/epdc-webservice/src/main/java/com/elink/esua/epdc/constant/ItemPlatFormConstant.java
  3. 2
      esua-epdc/epdc-module/epdc-webservice/src/main/java/com/elink/esua/epdc/dto/result/DataReturnDTO.java
  4. 30
      esua-epdc/epdc-module/epdc-webservice/src/main/java/com/elink/esua/epdc/entity/GridPlatformHandleLogEntity.java
  5. 124
      esua-epdc/epdc-module/epdc-webservice/src/main/java/com/elink/esua/epdc/service/impl/CityGridInterfaceServiceWebServiceImpl.java
  6. 5
      esua-epdc/epdc-module/epdc-webservice/src/main/resources/mapper/ItemHandleProcessDao.xml

4
esua-epdc/epdc-commons/epdc-commons-tools/src/main/java/com/elink/esua/epdc/commons/tools/enums/InterfaceLogBusinessTypeEnum.java

@ -8,8 +8,8 @@ package com.elink.esua.epdc.commons.tools.enums;
public enum InterfaceLogBusinessTypeEnum {
REPORT_ITEM("1", "项目上报网格化平台"),
PULL_ITEM_HANDLE_PROCESS("2", "查询网格化平台处理情况"),
SYNC_TASK_DISPATCH("3","派遣信息");
SYNC_TASK_DISPATCH("3","派遣"),
SYNC_TASK_END("4","结案");
private String value;
private String name;

4
esua-epdc/epdc-module/epdc-webservice/src/main/java/com/elink/esua/epdc/constant/ItemPlatFormConstant.java

@ -9,10 +9,10 @@ public class ItemPlatFormConstant {
/**
* 派遣信息
*/
public static final String SyncTaskDispatch = "api/paltform/item/report/SyncTaskDispatch";
public static final String SyncTaskDispatch = "/webservice/services/CityGridInterfaceServiceWebService/SyncTaskDispatch";
/**
* 结案信息
*/
public static final String SyncTaskEnd = "api/paltform/item/report/syncTaskEnd";
public static final String SyncTaskEnd = "/webservice/services/CityGridInterfaceServiceWebService/SyncTaskEnd";
}

2
esua-epdc/epdc-module/epdc-webservice/src/main/java/com/elink/esua/epdc/dto/result/DataReturnDTO.java

@ -6,7 +6,7 @@ import javax.xml.bind.annotation.*;
import java.io.Serializable;
/**
* @Description TODO
* @Description 接口统一返参
* @Author yinzuomei
* @Date 2019/12/30 12:47
*/

30
esua-epdc/epdc-module/epdc-webservice/src/main/java/com/elink/esua/epdc/entity/GridPlatformHandleLogEntity.java

@ -73,74 +73,76 @@ public class GridPlatformHandleLogEntity extends BaseEpdcEntity {
*/
private Date handlingTime;
//派遣新增
/**
* 派遣时间格式yyyy-MM-dd HH24:mm:ss
*/
private String dispatchtime;
private String dispatchTime;
/**
* 派遣部门编号
*/
private String deptcode;
private String deptCode;
/**
* 派遣部门名称
*/
private String deptname;
private String deptName;
/**
* 主责部门编号
*/
private String execdeptcode;
private String execDeptCode;
/**
* 主责部门名称
*/
private String execdeptname;
private String execDeptName;
/**
* 到场时间要求分钟数
*/
private Integer carrivetime;
private Integer carriveTime;
/**
* 处置时间要求分钟数
*/
private Integer csolvingtime;
private Integer csolvingTime;
/**
* 到场截止时间格式yyyy-MM-dd HH24:mm:ss
*/
private String arrivetime;
private String arriveTime;
/**
* 处置截止时间格式yyyy-MM-dd HH24:mm:ss
*/
private String solvingtime;
private String solvingTime;
/**
* 派遣意见最终主责单位处理完成意见
*/
private String solvingnote;
private String solvingNote;
/**
* 结案时间格式yyyy-MM-dd HH24:mm:ss
*/
private String endtime;
private String endTime;
/**
* 最终处理时间格式yyyy-MM-dd HH24:mm:ss
*/
private String lastsolvingtime;
private String lastSolvingTime;
/**
* 结案意见
*/
private String endnote;
private String endNote;
/**
* 结案评判实际解决解释说明等
*/
private String banliresult;
private String banliResult;
}

124
esua-epdc/epdc-module/epdc-webservice/src/main/java/com/elink/esua/epdc/service/impl/CityGridInterfaceServiceWebServiceImpl.java

@ -2,6 +2,7 @@ package com.elink.esua.epdc.service.impl;
import com.elink.esua.epdc.commons.tools.constant.NumConstant;
import com.elink.esua.epdc.commons.tools.enums.InterfaceLogBusinessTypeEnum;
import com.elink.esua.epdc.commons.tools.enums.YesOrNoEnum;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.constant.ItemPlatFormConstant;
import com.elink.esua.epdc.dao.GridPlatformHandleLogDao;
@ -10,6 +11,7 @@ import com.elink.esua.epdc.dao.ItemGridPlatformDao;
import com.elink.esua.epdc.dao.ItemHandleProcessDao;
import com.elink.esua.epdc.dto.ItemHandleProcessDTO;
import com.elink.esua.epdc.dto.form.ItemPlatformSyncTaskDispatchFormDTO;
import com.elink.esua.epdc.dto.form.ItemPlatformSyncTaskEndFormDTO;
import com.elink.esua.epdc.dto.form.TestDTO;
import com.elink.esua.epdc.dto.result.DataReturnDTO;
import com.elink.esua.epdc.entity.GridPlatformHandleLogEntity;
@ -18,11 +20,11 @@ import com.elink.esua.epdc.entity.ItemGridPlatformEntity;
import com.elink.esua.epdc.enums.ItemGridPlatformHandleStatusEnum;
import com.elink.esua.epdc.service.CityGridInterfaceServiceWebService;
import com.elink.esua.epdc.utils.JaxbUtil;
import io.seata.spring.annotation.GlobalTransactional;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.jws.WebService;
import java.text.ParseException;
@ -42,6 +44,9 @@ import java.util.UUID;
public class CityGridInterfaceServiceWebServiceImpl implements CityGridInterfaceServiceWebService {
private Logger logger = LogManager.getLogger(CityGridInterfaceServiceWebServiceImpl.class);
private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@Autowired
private ItemGridPlatformDao itemGridPlatformDao;
@ -64,15 +69,11 @@ public class CityGridInterfaceServiceWebServiceImpl implements CityGridInterface
public String test(String requestXML) {
logger.info("requestXML=" + requestXML);
TestDTO testDTO = JaxbUtil.converyToJavaBean(requestXML, TestDTO.class);
logger.info("formDto[]:"+testDTO.toString()+"!!!");
String xmlStr = JaxbUtil.convertToXml(testDTO);
return "调用成功" + xmlStr;
}
/**
* @param requestXML
* @return java.lang.String
@ -85,7 +86,7 @@ public class CityGridInterfaceServiceWebServiceImpl implements CityGridInterface
DataReturnDTO dataReturnDTO = new DataReturnDTO();
//1、requestXML转化成Dto异常返回异常
logger.info("requestXML=" + requestXML);
String successFlag = "1";
String successFlag = YesOrNoEnum.YES.value();
ItemGridPlatformEntity itemGridPlatformEntity = null;
try {
//1、requestXML转化成Dto异常返回异常
@ -96,20 +97,25 @@ public class CityGridInterfaceServiceWebServiceImpl implements CityGridInterface
throw new Exception("根据任务号没有找到项目信息");
}
itemGridPlatformEntity.setStatus(ItemGridPlatformHandleStatusEnum.HANDLE_PQ.getValue());
ItemHandleProcessDTO itemHandleProcessDTO = constructItemHandleProcessDTO(itemGridPlatformEntity.getReferenceId(), formDto);
GridPlatformHandleLogEntity gridPlatformHandleLogEntity = constructGridPlatformHandleLogEntity(itemGridPlatformEntity, itemHandleProcessDTO, formDto);
Date nowDate = new Date();
ItemHandleProcessDTO itemHandleProcessDTO = constructItemHandleProcessDTO(itemGridPlatformEntity.getReferenceId(), formDto, nowDate);
GridPlatformHandleLogEntity gridPlatformHandleLogEntity = constructGridPlatformHandleLogEntity(itemGridPlatformEntity, itemHandleProcessDTO, formDto, nowDate);
//3、统一进行数据库操作
itemGridPlatformDao.updateById(itemGridPlatformEntity);//网格化平台项目关系表修改状态
itemHandleProcessDao.insertItemHandleProcess(itemHandleProcessDTO);//项目处理流程表新增一条处理记录
gridPlatformHandleLogDao.insertGridPlatformHandleLog(gridPlatformHandleLogEntity);//网格化平台处理日志表新增一条处理记录
} catch (Exception e) {
e.printStackTrace();
successFlag = "0";
successFlag = YesOrNoEnum.NO.value();
dataReturnDTO.setReturnCode(NumConstant.ONE_STR);
dataReturnDTO.setReturnDescription("失败" + e.getMessage());
throw new Exception("接口异常" + e.getMessage());
} finally {
insertInterfaceLog(itemGridPlatformEntity, requestXML, successFlag);//接口日志表新增一条处理记录
insertInterfaceLog(itemGridPlatformEntity, requestXML,
JaxbUtil.convertToXml(dataReturnDTO),
successFlag,
InterfaceLogBusinessTypeEnum.SYNC_TASK_DISPATCH.getValue(),
ItemPlatFormConstant.SyncTaskDispatch);//接口日志表新增一条处理记录
return JaxbUtil.convertToXml(dataReturnDTO);
}
}
@ -136,8 +142,8 @@ public class CityGridInterfaceServiceWebServiceImpl implements CityGridInterface
**/
private GridPlatformHandleLogEntity constructGridPlatformHandleLogEntity(ItemGridPlatformEntity itemGridPlatformEntity,
ItemHandleProcessDTO itemHandleProcessDTO,
ItemPlatformSyncTaskDispatchFormDTO formDto) throws ParseException {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
ItemPlatformSyncTaskDispatchFormDTO formDto,
Date nowDate) throws ParseException {
GridPlatformHandleLogEntity entity = ConvertUtils.sourceToTarget(formDto, GridPlatformHandleLogEntity.class);
entity.setItemGridPlatformId(itemGridPlatformEntity.getId());
entity.setStatus(ItemGridPlatformHandleStatusEnum.HANDLE_PQ.getValue());
@ -146,9 +152,8 @@ public class CityGridInterfaceServiceWebServiceImpl implements CityGridInterface
entity.setHandlingDept(formDto.getDeptName());
String dispatchTime = formDto.getDispatchTime();
entity.setHandlingTime(format.parse(dispatchTime));
Date currentDate = new Date();
entity.setCreatedTime(currentDate);
entity.setUpdatedTime(currentDate);
entity.setCreatedTime(nowDate);
entity.setUpdatedTime(nowDate);
return entity;
}
@ -160,7 +165,7 @@ public class CityGridInterfaceServiceWebServiceImpl implements CityGridInterface
* @Description 构造 项目处理流程表对象
* @Date 2019/12/29 13:59
**/
public ItemHandleProcessDTO constructItemHandleProcessDTO(String itemId, ItemPlatformSyncTaskDispatchFormDTO formDto) {
public ItemHandleProcessDTO constructItemHandleProcessDTO(String itemId, ItemPlatformSyncTaskDispatchFormDTO formDto, Date nowDate) {
ItemHandleProcessDTO itemHandleProcessDTO = new ItemHandleProcessDTO();
String id = UUID.randomUUID().toString().replaceAll("-", "");
itemHandleProcessDTO.setId(id);
@ -170,9 +175,8 @@ public class CityGridInterfaceServiceWebServiceImpl implements CityGridInterface
itemHandleProcessDTO.setOutHandleAdvice(formDto.getSolvingNote());
itemHandleProcessDTO.setHandlerDeptId(Long.valueOf(formDto.getDeptCode()));// 存储平台部门id有必要吗?????
itemHandleProcessDTO.setHandlerDept(formDto.getDeptName());
Date now=new Date();
itemHandleProcessDTO.setCreatedTime(now);//测试事务回滚可以注释掉此行代码
itemHandleProcessDTO.setUpdatedTime(now);
itemHandleProcessDTO.setCreatedTime(nowDate);//测试事务回滚可以注释掉此行代码
itemHandleProcessDTO.setUpdatedTime(nowDate);
return itemHandleProcessDTO;
}
@ -185,19 +189,26 @@ public class CityGridInterfaceServiceWebServiceImpl implements CityGridInterface
* @Description 保存接口日志记录
* @Date 2019/12/29 14:35
**/
public void insertInterfaceLog(ItemGridPlatformEntity itemGridPlatformEntity, String requestXML, String successFlag) {
public void insertInterfaceLog(ItemGridPlatformEntity itemGridPlatformEntity,
String requestXML,
String returnMsgBody,
String successFlag,
String businessType,
String interfaceName) {
InterfaceLogEntity interfaceLogEntity = new InterfaceLogEntity();
if (null != itemGridPlatformEntity) {
interfaceLogEntity.setReferenceId(itemGridPlatformEntity.getReferenceId());
} else {
interfaceLogEntity.setReferenceId(NumConstant.ZERO_STR);//默认0
}
interfaceLogEntity.setBusinessType(InterfaceLogBusinessTypeEnum.SYNC_TASK_DISPATCH.getValue());
interfaceLogEntity.setInterfaceName(ItemPlatFormConstant.SyncTaskDispatch);
interfaceLogEntity.setBusinessType(businessType);
interfaceLogEntity.setInterfaceName(interfaceName);
interfaceLogEntity.setSuccessFlag(successFlag);
interfaceLogEntity.setCallMsgBody(requestXML);
interfaceLogEntity.setReturnMsgBody(returnMsgBody);
interfaceLogDao.insert(interfaceLogEntity);
}
/**
* @param requestXML
* @return java.lang.String
@ -207,6 +218,73 @@ public class CityGridInterfaceServiceWebServiceImpl implements CityGridInterface
**/
@Override
public String SyncTaskEnd(String requestXML) {
return null;
DataReturnDTO dataReturnDTO = new DataReturnDTO();
//1、requestXML转化成Dto异常返回异常
logger.info("requestXML=" + requestXML);
String successFlag = YesOrNoEnum.YES.value();
ItemGridPlatformEntity itemGridPlatformEntity = null;
try {
//1、requestXML转化成Dto异常返回异常
ItemPlatformSyncTaskEndFormDTO syncTaskEndFormDTO = JaxbUtil.converyToJavaBean(requestXML, ItemPlatformSyncTaskEndFormDTO.class);
//2、构造数据处理对象
itemGridPlatformEntity = getItemGridPlatformEntity(syncTaskEndFormDTO.getTaskNum());
if (null == itemGridPlatformEntity) {
throw new Exception("根据任务号没有找到项目信息");
}
itemGridPlatformEntity.setStatus(ItemGridPlatformHandleStatusEnum.HANDLE_JA.getValue());
Date nowDate = new Date();
ItemHandleProcessDTO itemHandleProcessDTO = getItemHandleProcessDTO(itemGridPlatformEntity.getReferenceId(), syncTaskEndFormDTO, nowDate);
GridPlatformHandleLogEntity gridPlatformHandleLogEntity = getGridPlatformHandleLogEntity(itemGridPlatformEntity, itemHandleProcessDTO, syncTaskEndFormDTO, nowDate);
//3、统一进行数据库操作
itemGridPlatformDao.updateById(itemGridPlatformEntity);//网格化平台项目关系表修改状态
itemHandleProcessDao.insertItemHandleProcess(itemHandleProcessDTO);//项目处理流程表新增一条处理记录
gridPlatformHandleLogDao.insertGridPlatformHandleLog(gridPlatformHandleLogEntity);//网格化平台处理日志表新增一条处理记录
} catch (Exception e) {
e.printStackTrace();
successFlag = YesOrNoEnum.NO.value();
dataReturnDTO.setReturnCode(NumConstant.ONE_STR);
dataReturnDTO.setReturnDescription("失败" + e.getMessage());
throw new Exception("接口异常" + e.getMessage());
} finally {
insertInterfaceLog(itemGridPlatformEntity, requestXML,
JaxbUtil.convertToXml(dataReturnDTO),
successFlag,
InterfaceLogBusinessTypeEnum.SYNC_TASK_END.getValue(),
ItemPlatFormConstant.SyncTaskEnd);//接口日志表新增一条处理记录
return JaxbUtil.convertToXml(dataReturnDTO);
}
}
private GridPlatformHandleLogEntity getGridPlatformHandleLogEntity(ItemGridPlatformEntity itemGridPlatformEntity,
ItemHandleProcessDTO itemHandleProcessDTO,
ItemPlatformSyncTaskEndFormDTO syncTaskEndFormDTO,
Date nowDate) throws ParseException {
GridPlatformHandleLogEntity entity = ConvertUtils.sourceToTarget(syncTaskEndFormDTO, GridPlatformHandleLogEntity.class);
entity.setItemGridPlatformId(itemGridPlatformEntity.getId());
entity.setStatus(ItemGridPlatformHandleStatusEnum.HANDLE_JA.getValue());
entity.setItemHandleProcessId(itemHandleProcessDTO.getId());
entity.setHandlingOpinions(syncTaskEndFormDTO.getEndNote());
entity.setHandlingDept(syncTaskEndFormDTO.getDeptName());
String dispatchTime = syncTaskEndFormDTO.getEndTime();
entity.setHandlingTime(format.parse(dispatchTime));
entity.setCreatedTime(nowDate);
entity.setUpdatedTime(nowDate);
return entity;
}
private ItemHandleProcessDTO getItemHandleProcessDTO(String itemId,
ItemPlatformSyncTaskEndFormDTO syncTaskEndFormDTO,
Date nowDate) {
ItemHandleProcessDTO itemHandleProcessDTO = new ItemHandleProcessDTO();
String id = UUID.randomUUID().toString().replaceAll("-", "");
itemHandleProcessDTO.setId(id);
itemHandleProcessDTO.setItemId(itemId);
itemHandleProcessDTO.setState(ItemGridPlatformHandleStatusEnum.HANDLE_JA.getValue());
itemHandleProcessDTO.setHandleAdvice(syncTaskEndFormDTO.getEndNote());
itemHandleProcessDTO.setOutHandleAdvice(syncTaskEndFormDTO.getEndNote());
itemHandleProcessDTO.setHandlerDept(syncTaskEndFormDTO.getDeptName());
itemHandleProcessDTO.setCreatedTime(nowDate);//测试事务回滚可以注释掉此行代码
itemHandleProcessDTO.setUpdatedTime(nowDate);
return itemHandleProcessDTO;
}
}

5
esua-epdc/epdc-module/epdc-webservice/src/main/resources/mapper/ItemHandleProcessDao.xml

@ -4,7 +4,8 @@
<mapper namespace="com.elink.esua.epdc.dao.ItemHandleProcessDao">
<insert id="insertItemHandleProcess">
INSERT INTO epdc_item_handle_process ( ID, ITEM_ID, STATE, HANDLE_ADVICE, OUT_HANDLE_ADVICE, HANDLER_DEPT, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, DEL_FLAG )
VALUES (#{id}, #{itemId}, #{state}, #{handleAdvice}, #{outHandleAdvice}, #{handlerDept}, 0, '网格化平台', #{createdTime}, '网格化平台', #{updatedTime}, '0')
INSERT INTO epdc_item_handle_process ( `ID`, `ITEM_ID`, `STATE`, `HANDLE_ADVICE`, `OUT_HANDLE_ADVICE`, `HANDLER_DEPT_ID`,
`HANDLER_DEPT`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`, `DEL_FLAG`)
VALUES (#{id}, #{itemId}, #{state}, #{handleAdvice}, #{outHandleAdvice}, #{handlerDeptId},#{handlerDept}, '0', '网格化平台', #{createdTime}, '网格化平台', #{updatedTime}, '0')
</insert>
</mapper>

Loading…
Cancel
Save