|
|
@@ -9,6 +9,7 @@ import com.yc.ship.framework.common.lang.Asserts;
|
|
|
import com.yc.ship.framework.common.pojo.CommonResult;
|
|
|
import com.yc.ship.framework.common.pojo.PageResult;
|
|
|
import com.yc.ship.framework.common.util.object.BeanUtils;
|
|
|
+import com.yc.ship.framework.tenant.core.aop.TenantIgnore;
|
|
|
import com.yc.ship.framework.tenant.core.context.TenantContextHolder;
|
|
|
import com.yc.ship.module.infra.api.config.ConfigApi;
|
|
|
import com.yc.ship.module.trade.api.contract.dto.*;
|
|
|
@@ -28,6 +29,7 @@ import com.yc.ship.module.trade.utils.CommonUUCodeUtils;
|
|
|
import com.yc.ship.module.trade.utils.SecurityUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.jetbrains.annotations.NotNull;
|
|
|
import org.redisson.api.RLock;
|
|
|
import org.redisson.api.RedissonClient;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -79,6 +81,9 @@ public class ContractServiceImpl implements ContractService {
|
|
|
String erpContractId = CommonUUCodeUtils.createERPContractId();
|
|
|
contractRequest.setERPContractId(erpContractId);
|
|
|
contractRequest.setTemplateId(requestDTO.getTemplateId());
|
|
|
+ contractRequest.setContractNum("贰");
|
|
|
+ contractRequest.setHoldNum("壹");
|
|
|
+ contractRequest.setSupplementaryClause("本合同约定的旅游费用总额,仅包含《旅游行程单》中明确列明的游览项目、交通、住宿及餐饮等服务。行程中可能存在的、由第三方经营的娱乐、游览、交通等另行付费项目,其费用不包含在本合同总价内,旅游者是否参加,基于自身意愿及经济条件自主决定。");
|
|
|
//旅行社
|
|
|
TravelAgency travelAgency = new TravelAgency();
|
|
|
travelAgency.setTransactorName(configApi.getConfigValueByKey("contract.transactorName"));
|
|
|
@@ -87,18 +92,57 @@ public class ContractServiceImpl implements ContractService {
|
|
|
travelAgency.setTravelAgencyLicenseNumber(configApi.getConfigValueByKey("contract.travelAgencyLicenseNumber"));
|
|
|
travelAgency.setBusinessLicenseNumber(configApi.getConfigValueByKey("contract.businessLicenseNumber"));
|
|
|
travelAgency.setServicePhone(configApi.getConfigValueByKey("contract.servicePhone"));
|
|
|
+ travelAgency.setComplaintPhone("12515");
|
|
|
contractRequest.setTravelAgency(travelAgency);
|
|
|
//行程
|
|
|
Itinerary itinerary = new Itinerary();
|
|
|
+ if ("D00001".equals(requestDTO.getTemplateId())) {
|
|
|
+ itinerary.setOneDayItineraryType(1);
|
|
|
+ }
|
|
|
itinerary.setInputType(1);
|
|
|
+// itinerary.setOneDayItineraryType(1);
|
|
|
Route route = new Route();
|
|
|
route.setDescription(requestDTO.getTripDescription());
|
|
|
+ Transport transport = new Transport();
|
|
|
+ transport.setHasAC(true);
|
|
|
+ route.setTransport(transport);
|
|
|
+ ArrayList<Meal> meals = new ArrayList<>();
|
|
|
+ Meal breakfast = new Meal();
|
|
|
+ breakfast.setType("早餐");
|
|
|
+ breakfast.setPlace("宜昌市");
|
|
|
+ breakfast.setStandard("自助餐");
|
|
|
+ meals.add(breakfast);
|
|
|
+ Meal lunch = new Meal();
|
|
|
+ lunch.setType("午餐");
|
|
|
+ lunch.setPlace("宜昌市");
|
|
|
+ lunch.setStandard("自助餐");
|
|
|
+ meals.add(lunch);
|
|
|
+ Meal dinner = new Meal();
|
|
|
+ dinner.setType("晚餐");
|
|
|
+ dinner.setPlace("宜昌市");
|
|
|
+ dinner.setStandard("自助餐");
|
|
|
+ meals.add(dinner);
|
|
|
ArrayList<Route> routes = new ArrayList<>();
|
|
|
+ route.setMeals(meals);
|
|
|
routes.add(route);
|
|
|
+ Arrival arrival = new Arrival();
|
|
|
+ arrival.setCountry("中华人民共和国");
|
|
|
+ arrival.setState("湖北省");
|
|
|
+ arrival.setCity("宜昌市");
|
|
|
+ itinerary.setArrivalCity(arrival);
|
|
|
+ Departure departure = new Departure();
|
|
|
+ departure.setCountry("中华人民共和国");
|
|
|
+ departure.setState("湖北省");
|
|
|
+ departure.setCity("宜昌市");
|
|
|
+ itinerary.setDepartureCity(departure);
|
|
|
itinerary.setRoutes(routes);
|
|
|
itinerary.setRouteName(requestDTO.getRouteName());
|
|
|
- itinerary.setRouteName(requestDTO.getTripDescription());
|
|
|
+ itinerary.setDescription(requestDTO.getTripDescription());
|
|
|
itinerary.setStartDate(requestDTO.getTravelDate());
|
|
|
+ itinerary.setEndDate(requestDTO.getEndDate());
|
|
|
+ itinerary.setDays(requestDTO.getDays());
|
|
|
+ itinerary.setNights(requestDTO.getNights());
|
|
|
+ itinerary.setGroupId(requestDTO.getGroupId());
|
|
|
//itinerary.setDescription(requestDTO.getTripDescription());
|
|
|
contractRequest.setItinerary(itinerary);
|
|
|
//游客名单
|
|
|
@@ -109,15 +153,15 @@ public class ContractServiceImpl implements ContractService {
|
|
|
int number = 0;
|
|
|
for (ContractTouristDTO touristDTO : requestDTO.getContractTouristList()) {
|
|
|
Tourist tourist = new Tourist();
|
|
|
- tourist.setIsSigner(number == 0 ? true : false);
|
|
|
+ tourist.setIsSigner(number == 0);
|
|
|
tourist.setNumber(number);
|
|
|
tourist.setName(touristDTO.getName());
|
|
|
tourist.setGender(touristDTO.getGender());
|
|
|
tourist.setPhone(touristDTO.getMobile());
|
|
|
IdCard touristIdCard = new IdCard();
|
|
|
- if(touristDTO.getIdCardType().equals("0")){
|
|
|
+ if ("0".equals(touristDTO.getIdCardType())) {
|
|
|
touristIdCard.setIDType("1");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
touristIdCard.setIDType("8");
|
|
|
}
|
|
|
touristIdCard.setIDNumber(touristDTO.getIdCardNo());
|
|
|
@@ -132,9 +176,9 @@ public class ContractServiceImpl implements ContractService {
|
|
|
Signatory signatory = new Signatory();
|
|
|
signatory.setName(requestDTO.getTravelerName());
|
|
|
IdCard signatoryIdCard = new IdCard();
|
|
|
- if(requestDTO.getTravelerIdCardType().equals("0")){
|
|
|
+ if ("0".equals(requestDTO.getTravelerIdCardType())) {
|
|
|
signatoryIdCard.setIDType("1");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
signatoryIdCard.setIDType("8");
|
|
|
}
|
|
|
signatoryIdCard.setIDNumber(requestDTO.getTravelerIdCardNo());
|
|
|
@@ -146,24 +190,43 @@ public class ContractServiceImpl implements ContractService {
|
|
|
contractRequest.setSignatory(signatory);
|
|
|
//费用
|
|
|
Cost cost = new Cost();
|
|
|
+ cost.setAdultCost(requestDTO.getAdultCost());
|
|
|
cost.setTotalCost(requestDTO.getOrderAmount());
|
|
|
cost.setPaymentTime(new Date());
|
|
|
- //cost.setGuideServiceCost(10);
|
|
|
+ cost.setGuideServiceCost(10);
|
|
|
cost.setPaymentMethod(requestDTO.getPayType());
|
|
|
+ cost.setPaymentDescription("行程内餐饮标准具体见合同上文【餐饮安排】表格内容;如有冲突,以【餐饮安排】表格内约定为准");
|
|
|
contractRequest.setCost(cost);
|
|
|
+ //导游
|
|
|
+ ArrayList<TourGuides> tourGuides = new ArrayList<>();
|
|
|
+ TourGuides tourGuide = new TourGuides();
|
|
|
+ tourGuide.setName("待定");
|
|
|
+ tourGuide.setPhone("待定");
|
|
|
+ tourGuide.setTourGuideID("待定");
|
|
|
+ tourGuides.add(tourGuide);
|
|
|
+ contractRequest.setTourGuides(tourGuides);
|
|
|
//争议解决部分
|
|
|
- //允许值:1:提交仲裁委员会仲裁,2:向人民法院提起诉讼
|
|
|
+ //允许值:1:向人民法院提起诉讼
|
|
|
+ //2:提交仲裁委员会仲裁
|
|
|
//固定传1
|
|
|
Dispute dispute = new Dispute();
|
|
|
- dispute.setResolution(1);
|
|
|
+ dispute.setResolution(2);
|
|
|
dispute.setTribunalName(configApi.getConfigValueByKey("contract.tribunalName"));
|
|
|
contractRequest.setDispute(dispute);
|
|
|
//自费项目
|
|
|
contractRequest.setActivities(Collections.EMPTY_LIST);
|
|
|
//购物部分
|
|
|
- contractRequest.setHasShopping(false);
|
|
|
+// contractRequest.setHasShopping(false);
|
|
|
+ //监督投诉部分
|
|
|
+ Complaint complaint = new Complaint();
|
|
|
+ complaint.setComplaintProvince("湖北省");
|
|
|
+ complaint.setComplaintCity("宜昌市");
|
|
|
+ complaint.setComplaintAreaCode("0717");
|
|
|
+ complaint.setComplaintEMail("1034268909@qq.com");
|
|
|
+ complaint.setComplaintAddress("宜昌市伍家岗区沿江大道142号");
|
|
|
+ contractRequest.setComplaint(complaint);
|
|
|
//保存合同信息
|
|
|
- ContractDO contractBo = this.convertContract(requestDTO, orderId,orderNo, erpContractId);
|
|
|
+ ContractDO contractBo = this.convertContract(requestDTO, orderId, orderNo, erpContractId);
|
|
|
String key = "order_contract_" + orderId;
|
|
|
RLock lock = redissonClient.getLock(key);
|
|
|
try {
|
|
|
@@ -173,7 +236,7 @@ public class ContractServiceImpl implements ContractService {
|
|
|
//调用第三方合同服务
|
|
|
QueryContractResponse resp = contractCommonService.applyContract(contractRequest);
|
|
|
Asserts.isTrue(resp != null, "合同申请失败");
|
|
|
- if (resp!=null && null != resp.getData()) {
|
|
|
+ if (resp != null && null != resp.getData()) {
|
|
|
contractBo.setContractNo(resp.getData().getContractNumber());
|
|
|
contractBo.setContractUrl(resp.getData().getFileURL());
|
|
|
contractBo.setViewUrl(resp.getData().getViewURL());
|
|
|
@@ -187,7 +250,7 @@ public class ContractServiceImpl implements ContractService {
|
|
|
contractBo.setResMsg(resp.getError().getMessage());
|
|
|
contractMapper.updateById(contractBo);
|
|
|
}
|
|
|
- return error(resp.getError().getCode(),resp.getError().getMessage());
|
|
|
+ return error(resp.getError().getCode(), resp.getError().getMessage());
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
@@ -207,7 +270,8 @@ public class ContractServiceImpl implements ContractService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private ContractDO convertContract(ContractApplyReqDTO requestDTO, Long orderId,String orderNo, String erpContractId) {
|
|
|
+ @NotNull
|
|
|
+ private ContractDO convertContract(ContractApplyReqDTO requestDTO, Long orderId, String orderNo, String erpContractId) {
|
|
|
ContractDO contractBo = new ContractDO();
|
|
|
contractBo.setOrderId(orderId);
|
|
|
contractBo.setOrderNo(orderNo);
|
|
|
@@ -298,8 +362,26 @@ public class ContractServiceImpl implements ContractService {
|
|
|
@Override
|
|
|
public QueryContractRespDTO queryContract(Long contractId) {
|
|
|
ContractDO contractDO = this.getContract(contractId);
|
|
|
- QueryContractRespDTO response = contractCommonService.queryContract(contractDO.getContractNo());
|
|
|
- return response;
|
|
|
+ return contractCommonService.queryContract(contractDO.getContractNo());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void queryContractAll() {
|
|
|
+ List<ContractDO> list = contractMapper.selectContractListAll();
|
|
|
+ log.error("合同查询条数:" + list.size());
|
|
|
+ for (ContractDO contractDO : list) {
|
|
|
+ try {
|
|
|
+ queryContractStatus(contractDO);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("查询合同异常:{};{}", e, contractDO.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Long queryContractById(Long contractId) {
|
|
|
+ ContractDO contractDO = this.getContract(contractId);
|
|
|
+ return contractDO == null ? null : contractDO.getOrderId();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -316,7 +398,19 @@ public class ContractServiceImpl implements ContractService {
|
|
|
return contractState;
|
|
|
}
|
|
|
|
|
|
+ public Integer queryContractStatus(ContractDO contractDO) {
|
|
|
+ Integer contractState = contractCommonService.queryContractStatus(contractDO.getContractNo());
|
|
|
+ if (contractState != null) {
|
|
|
+ ContractStatusEnum statusEnum = ContractStatusEnum.queryStateTransform(contractState);
|
|
|
+ if (statusEnum != null && !Objects.equals(statusEnum.getValue(), contractDO.getStatus())) {
|
|
|
+ this.updateContractStatus(contractDO.getId(), statusEnum.getValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return contractState;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
+ @TenantIgnore
|
|
|
public void updateContractStatus(Long contractId, Integer status) {
|
|
|
LambdaUpdateWrapper<ContractDO> wrapper = new LambdaUpdateWrapper<>();
|
|
|
//已签约
|
|
|
@@ -339,7 +433,7 @@ public class ContractServiceImpl implements ContractService {
|
|
|
String contractNumber = reqObj.getData().getContractNumber();
|
|
|
List<ContractDO> contractDOList = contractMapper.selectContractList(contractNumber);
|
|
|
|
|
|
- if (CollUtil.isEmpty(contractDOList)){
|
|
|
+ if (CollUtil.isEmpty(contractDOList)) {
|
|
|
return ApiConstants.ERROR;
|
|
|
}
|
|
|
TenantContextHolder.setTenantId(contractDOList.get(0).getTenantId());
|