@@ -0,0 +1,51 @@ | |||
package cn.com.yskj.zfdm.entity.dict; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
/*** | |||
* <p> | |||
* 加油券业务类型枚举 | |||
* </p> | |||
* @author hou yi | |||
* @date 2022/10/17 16:33 | |||
**/ | |||
public enum ZfdServiceApplyDetailBusinessTypeEnum { | |||
/*** | |||
* 描述 | |||
*/ | |||
ZSH(1, "中石化加油券"), | |||
ZSY(2, "中石油加油券"); | |||
private final Integer code; | |||
private final String type; | |||
ZfdServiceApplyDetailBusinessTypeEnum(Integer code, String type) { | |||
this.code = code; | |||
this.type = type; | |||
} | |||
/** | |||
* 根据编码查找枚举 | |||
* | |||
* @param code 编码 | |||
* @return {@link ZfdServiceApplyDetailBusinessTypeEnum } 实例 | |||
**/ | |||
public static ZfdServiceApplyDetailBusinessTypeEnum find(Integer code) throws ManagerException { | |||
for (ZfdServiceApplyDetailBusinessTypeEnum instance : ZfdServiceApplyDetailBusinessTypeEnum.values()) { | |||
if (instance.getCode().equals(code)) { | |||
return instance; | |||
} | |||
} | |||
throw new ManagerException("加油券业务类型不存在!"+code); | |||
} | |||
public Integer getCode() { | |||
return code; | |||
} | |||
public String getType() { | |||
return type; | |||
} | |||
} |
@@ -0,0 +1,53 @@ | |||
package cn.com.yskj.zfdm.entity.dict; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
/*** | |||
* <p> | |||
* 加油券业务类型枚举 | |||
* </p> | |||
* @author hou yi | |||
* @date 2022/10/17 16:33 | |||
**/ | |||
public enum ZfdServiceApplyDetailCouTypeEnum { | |||
/*** | |||
* 描述 | |||
*/ | |||
CURRENCY(1, "通用"), | |||
GASOLINE(2, "汽油"), | |||
DIESEL(3, "柴油") | |||
; | |||
private final Integer code; | |||
private final String type; | |||
ZfdServiceApplyDetailCouTypeEnum(Integer code, String type) { | |||
this.code = code; | |||
this.type = type; | |||
} | |||
/** | |||
* 根据编码查找枚举 | |||
* | |||
* @param code 编码 | |||
* @return {@link ZfdServiceApplyDetailCouTypeEnum } 实例 | |||
**/ | |||
public static ZfdServiceApplyDetailCouTypeEnum find(Integer code) throws ManagerException { | |||
for (ZfdServiceApplyDetailCouTypeEnum instance : ZfdServiceApplyDetailCouTypeEnum.values()) { | |||
if (instance.getCode().equals(code)) { | |||
return instance; | |||
} | |||
} | |||
throw new ManagerException("加油券类型不存在!" + code); | |||
} | |||
public Integer getCode() { | |||
return code; | |||
} | |||
public String getType() { | |||
return type; | |||
} | |||
} |
@@ -1,9 +1,16 @@ | |||
package cn.com.yskj.zfdm.entity.zfd; | |||
import javax.persistence.*; | |||
import java.time.LocalDateTime; | |||
import javax.persistence.Column; | |||
import javax.persistence.Entity; | |||
import javax.persistence.EnumType; | |||
import javax.persistence.Enumerated; | |||
import javax.persistence.Table; | |||
import cn.com.taiji.common.entity.StringUUIDEntity; | |||
import cn.com.yskj.zfdm.entity.dict.CouponStatusType; | |||
import cn.com.yskj.zfdm.entity.dict.fuelingApplyType; | |||
/** | |||
@@ -61,7 +68,7 @@ public class ZfdGasCoupons extends StringUUIDEntity{ | |||
DRIVER_APPLY:驾驶员申请 | |||
ADMIN_ADD:管理员后台分配 | |||
*/ | |||
private String fuelingApplyType; | |||
private fuelingApplyType fuelingApplyType; | |||
/** | |||
* 备注 | |||
*/ | |||
@@ -205,12 +212,14 @@ public class ZfdGasCoupons extends StringUUIDEntity{ | |||
} | |||
/** 申请方式 */ | |||
@Enumerated(EnumType.STRING) | |||
@Column(name ="FUELING_APPLY_TYPE") | |||
public String getFuelingApplyType(){ | |||
public fuelingApplyType getFuelingApplyType(){ | |||
return this.fuelingApplyType; | |||
} | |||
/** 申请方式 */ | |||
public void setFuelingApplyType(String fuelingApplyType){ | |||
this.fuelingApplyType=fuelingApplyType; | |||
} | |||
public void setFuelingApplyType(fuelingApplyType fuelingApplyType) { | |||
this.fuelingApplyType = fuelingApplyType; | |||
} | |||
} |
@@ -9,6 +9,8 @@ import javax.persistence.Enumerated; | |||
import javax.persistence.Table; | |||
import cn.com.taiji.common.entity.StringUUIDEntity; | |||
import cn.com.yskj.zfdm.entity.dict.ZfdServiceApplyDetailBusinessTypeEnum; | |||
import cn.com.yskj.zfdm.entity.dict.ZfdServiceApplyDetailCouTypeEnum; | |||
import cn.com.yskj.zfdm.entity.dict.ZfdServiceApplyDetailStatusEnum; | |||
/*** | |||
@@ -54,8 +56,42 @@ public class ZfdServiceApplyDetail extends StringUUIDEntity { | |||
private String validType; | |||
/*** 券状态*/ | |||
private ZfdServiceApplyDetailStatusEnum status; | |||
/*** 加油劵类型*/ | |||
private ZfdServiceApplyDetailCouTypeEnum couType; | |||
/*** 业务类型*/ | |||
private ZfdServiceApplyDetailBusinessTypeEnum businessType; | |||
@Column(name="UPDATE_TIME") | |||
@Column(name="BUSINESS_TYPE") | |||
@Enumerated(EnumType.STRING) | |||
public ZfdServiceApplyDetailBusinessTypeEnum getBusinessType() { | |||
return businessType; | |||
} | |||
public void setBusinessType(ZfdServiceApplyDetailBusinessTypeEnum businessType) { | |||
this.businessType = businessType; | |||
} | |||
/** | |||
* 更新时间 | |||
*/ | |||
private LocalDateTime updateTime = LocalDateTime.now(); | |||
/** | |||
* 插入时间 | |||
*/ | |||
private LocalDateTime insertTime = LocalDateTime.now(); | |||
@Column(name="COU_TYPE") | |||
@Enumerated(EnumType.STRING) | |||
public ZfdServiceApplyDetailCouTypeEnum getCouType() { | |||
return couType; | |||
} | |||
public void setCouType(ZfdServiceApplyDetailCouTypeEnum couType) { | |||
this.couType = couType; | |||
} | |||
@Column(name="UPDATE_TIME") | |||
public LocalDateTime getUpdateTime() { | |||
return updateTime; | |||
} | |||
@@ -73,15 +109,6 @@ public class ZfdServiceApplyDetail extends StringUUIDEntity { | |||
this.insertTime = insertTime; | |||
} | |||
/** | |||
* 更新时间 | |||
*/ | |||
private LocalDateTime updateTime = LocalDateTime.now(); | |||
/** | |||
* 插入时间 | |||
*/ | |||
private LocalDateTime insertTime = LocalDateTime.now(); | |||
public ZfdServiceApplyDetail() { | |||
} | |||
@@ -4,7 +4,7 @@ import cn.com.taiji.common.pub.StringTools; | |||
import cn.com.taiji.common.pub.dao.HqlBuilder; | |||
import cn.com.taiji.common.repo.request.jpa.JpaPageableDataRequest; | |||
import cn.com.taiji.common.validation.MyViolationException; | |||
import cn.com.yskj.zfdm.entity.zfd.ZfdGasCoupons; | |||
import cn.com.yskj.zfdm.entity.zfd.ZfdServiceApply; | |||
/** | |||
* @ClassName: GasCouponPageRequest | |||
@@ -12,16 +12,16 @@ import cn.com.yskj.zfdm.entity.zfd.ZfdGasCoupons; | |||
* @author meiyu | |||
* @date 2022年9月23日 | |||
*/ | |||
public class GasCouponPageRequest extends JpaPageableDataRequest<ZfdGasCoupons>{ | |||
public class GasCouponPageRequest extends JpaPageableDataRequest<ZfdServiceApply>{ | |||
/** | |||
* 劵金额 | |||
* 面值金额 | |||
*/ | |||
private Integer couponValue; | |||
private String fee; | |||
/** | |||
* 使用人 | |||
*/ | |||
private String couponApplicantId; | |||
private String applicantId; | |||
/** | |||
* 手机号 | |||
*/ | |||
@@ -34,37 +34,31 @@ public class GasCouponPageRequest extends JpaPageableDataRequest<ZfdGasCoupons>{ | |||
* 备注 | |||
*/ | |||
private String remarks; | |||
@Override | |||
public HqlBuilder toSelectHql() { | |||
HqlBuilder hql = new HqlBuilder(" from ZfdGasCoupons where 1=1 "); | |||
hql.append(" and couponValue = :couponValue",couponValue); | |||
hql.append(" and couponApplicantId = :couponApplicantId",couponApplicantId); | |||
hql.append(" and mobile = :mobile",mobile); | |||
HqlBuilder hql = new HqlBuilder(" from ZfdServiceApply where 1=1 "); | |||
hql.append(" and fee = :fee",fee); | |||
hql.append(" and applicantId = :applicantId",applicantId); | |||
hql.append(" and vehicleId = :vehicleId",vehicleId); | |||
hql.append(" and remarks = :remarks",remarks); | |||
hql.append(" order by insertTime desc"); | |||
return hql; | |||
} | |||
public Integer getCouponValue() { | |||
return couponValue; | |||
} | |||
public void setCouponValue(Integer couponValue) { | |||
this.couponValue = couponValue; | |||
public String getApplicantId() { | |||
return applicantId; | |||
} | |||
public String getCouponApplicantId() { | |||
return couponApplicantId; | |||
} | |||
public void setCouponApplicantId(String couponApplicantId) { | |||
this.couponApplicantId = couponApplicantId; | |||
public void setApplicantId(String applicantId) { | |||
this.applicantId = applicantId; | |||
} | |||
public String getMobile() { | |||
return mobile; | |||
} | |||
@@ -92,6 +86,16 @@ public class GasCouponPageRequest extends JpaPageableDataRequest<ZfdGasCoupons>{ | |||
this.remarks = remarks; | |||
} | |||
public String getFee() { | |||
return fee; | |||
} | |||
public void setFee(String fee) { | |||
this.fee = fee; | |||
} | |||
/** | |||
* | |||
* @Title: valid | |||
@@ -99,10 +103,9 @@ public class GasCouponPageRequest extends JpaPageableDataRequest<ZfdGasCoupons>{ | |||
*/ | |||
public void valid(){ | |||
MyViolationException mve = new MyViolationException(); | |||
if(!StringTools.hasText(couponApplicantId)) mve.addViolation("couponApplicantId","使用人不能为空"); | |||
if(!StringTools.hasText(fee)) mve.addViolation("fee","请选择券类型_金额"); | |||
if(!StringTools.hasText(applicantId)) mve.addViolation("applicantId","使用人不能为空"); | |||
if(!StringTools.hasText(vehicleId)) mve.addViolation("vehicleId","车辆不能为空"); | |||
if(null == couponValue) mve.addViolation("couponValue", "金额不能为空"); | |||
if(mve.hasViolation()) throw mve; | |||
} | |||
} |
@@ -1,5 +1,9 @@ | |||
package cn.com.yskj.zfdm.repo.zfd; | |||
import java.util.List; | |||
import org.springframework.data.jpa.repository.Query; | |||
import cn.com.taiji.common.repo.jpa.AbstractJpaRepo; | |||
import cn.com.yskj.zfdm.entity.zfd.ZfdGasCoupons; | |||
@@ -10,4 +14,10 @@ import cn.com.yskj.zfdm.entity.zfd.ZfdGasCoupons; | |||
* @date 2022/09/19 | |||
*/ | |||
public interface ZfdGasCouponsRepo extends AbstractJpaRepo<ZfdGasCoupons, String> { | |||
/*** | |||
* 根据申请ID获取申请详情 | |||
*/ | |||
@Query("from ZfdGasCoupons where serviceApplyId=?1") | |||
List<ZfdGasCoupons> findByServiceApplyId(String serviceApplyId); | |||
} |
@@ -2,6 +2,8 @@ package cn.com.yskj.zfdm.repo.zfd; | |||
import java.util.List; | |||
import org.springframework.data.jpa.repository.Query; | |||
import cn.com.taiji.common.repo.jpa.AbstractJpaRepo; | |||
import cn.com.yskj.zfdm.entity.zfd.ZfdServiceApplyDetail; | |||
@@ -19,6 +21,13 @@ public interface ZfdServiceApplyDetailRepo extends AbstractJpaRepo<ZfdServiceApp | |||
* @param applyId 申请ID | |||
* @return 、 | |||
*/ | |||
@Query("from ZfdServiceApplyDetail where applyId=?1") | |||
List<ZfdServiceApplyDetail> findByApplyId(String applyId); | |||
/** | |||
* 根据申请id获取表数据 | |||
*/ | |||
@Query("from ZfdServiceApplyDetail where applyId=?1") | |||
public ZfdServiceApplyDetail findByApplyIds(String applyId); | |||
} |
@@ -23,5 +23,6 @@ public interface ZfdServiceApplyRepo extends AbstractJpaRepo<ZfdServiceApply, St | |||
@Query(nativeQuery=true,value="select * from zfd_service_apply where AUDIT_TIME<=?1 and STATUS ='PASSED'") | |||
public List<ZfdServiceApply> listByApplyAuditTime(LocalDateTime auditTime); | |||
@Query(nativeQuery=true,value="select * from zfd_service_apply where VEHICLE_ID=?1") | |||
public ZfdServiceApply findByVehicleId(String vehicleId); | |||
} |
@@ -0,0 +1,31 @@ | |||
package cn.com.yskj.zfdm.manager.comm.handler.hlt.request; | |||
import com.hlt.gov.zfd.manager.model.protocol.hlt.enums.HltServicesTypeEnum; | |||
/*** | |||
* <p> | |||
* 获取加油券商品列表接口 V2(含油类型) | |||
* </p> | |||
* @author hou yi | |||
* @date 2022/10/17 15:40 | |||
**/ | |||
public class HltCouponsListRequest extends AbstractHltRequest { | |||
/*** 服务类型*/ | |||
private HltServicesTypeEnum serviceType; | |||
public HltCouponsListRequest() { | |||
} | |||
public HltCouponsListRequest(HltServicesTypeEnum serviceType) { | |||
this.serviceType = serviceType; | |||
} | |||
public HltServicesTypeEnum getServiceType() { | |||
return serviceType; | |||
} | |||
public void setServiceType(HltServicesTypeEnum serviceType) { | |||
this.serviceType = serviceType; | |||
} | |||
} |
@@ -0,0 +1,92 @@ | |||
package cn.com.yskj.zfdm.manager.comm.handler.hlt.response; | |||
/*** | |||
* <p> | |||
* 获取加油券商品列表接口 V2(含油类型) 响应工具类 | |||
* </p> | |||
* @author hou yi | |||
* @date 2022/10/17 15:34 | |||
**/ | |||
public class HltCouponsListResponse { | |||
/*** 券类型名称*/ | |||
private String couTypeTitle; | |||
/*** 券图片路径*/ | |||
private String picUrl; | |||
/*** 面值金额*/ | |||
private String couFaceValue; | |||
/*** 0-不需要激活 1-需要激活*/ | |||
private Integer couNeedActive; | |||
/*** 业务类型。1_中石化加油券,2_中石油加油券*/ | |||
private Integer bussinessType; | |||
/*** 加油券类型。1_通用,2_汽油,3_柴油*/ | |||
private Integer couType; | |||
/*** 券类型编号*/ | |||
private String couTypeCode; | |||
/*** 产品描述*/ | |||
private String couTypeSubTitle; | |||
public String getCouTypeTitle() { | |||
return couTypeTitle; | |||
} | |||
public void setCouTypeTitle(String couTypeTitle) { | |||
this.couTypeTitle = couTypeTitle; | |||
} | |||
public String getPicUrl() { | |||
return picUrl; | |||
} | |||
public void setPicUrl(String picUrl) { | |||
this.picUrl = picUrl; | |||
} | |||
public String getCouFaceValue() { | |||
return couFaceValue; | |||
} | |||
public void setCouFaceValue(String couFaceValue) { | |||
this.couFaceValue = couFaceValue; | |||
} | |||
public Integer getCouNeedActive() { | |||
return couNeedActive; | |||
} | |||
public void setCouNeedActive(Integer couNeedActive) { | |||
this.couNeedActive = couNeedActive; | |||
} | |||
public Integer getBussinessType() { | |||
return bussinessType; | |||
} | |||
public void setBussinessType(Integer bussinessType) { | |||
this.bussinessType = bussinessType; | |||
} | |||
public Integer getCouType() { | |||
return couType; | |||
} | |||
public void setCouType(Integer couType) { | |||
this.couType = couType; | |||
} | |||
public String getCouTypeCode() { | |||
return couTypeCode; | |||
} | |||
public void setCouTypeCode(String couTypeCode) { | |||
this.couTypeCode = couTypeCode; | |||
} | |||
public String getCouTypeSubTitle() { | |||
return couTypeSubTitle; | |||
} | |||
public void setCouTypeSubTitle(String couTypeSubTitle) { | |||
this.couTypeSubTitle = couTypeSubTitle; | |||
} | |||
} |
@@ -3,8 +3,6 @@ package cn.com.yskj.zfdm.manager.comm.handler.hlt.service; | |||
import java.util.Base64; | |||
import java.util.Map; | |||
import javax.annotation.Resource; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
@@ -64,6 +62,8 @@ public abstract class AbstractHltService { | |||
@Value("#{commonProperties.gascouponChannelCode}") | |||
protected String gascouponChannelCode; | |||
// @Value("#{commonProperties.gasDistributorId}") | |||
// protected String gasDistributorId; | |||
/*** | |||
* 执行请求汇联通 接口 |
@@ -0,0 +1,45 @@ | |||
package cn.com.yskj.zfdm.manager.comm.handler.hlt.service; | |||
import java.util.Map; | |||
import org.springframework.stereotype.Service; | |||
import com.hlt.gov.zfd.manager.model.protocol.hlt.enums.HtlMethodEnum; | |||
import com.google.common.collect.Maps; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.request.AbstractHltRequest; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.request.HltCouponsListRequest; | |||
import cn.com.yskj.zfdm.model.comm.protocol.ZfdServiceError; | |||
/*** | |||
* <p> | |||
* 获取加油券商品列表接口 V2 | |||
* </p> | |||
* @author hou yi | |||
* @date 2022/10/17 15:47 | |||
**/ | |||
@Service("hltCoupListService") | |||
public class HltCoupListServiceImpl extends AbstractHltService { | |||
@Override | |||
protected Map<String, String> buildModelParam(AbstractHltRequest request) throws ServiceHandleException { | |||
HltCouponsListRequest couponsListRequest = (HltCouponsListRequest) request; | |||
// | |||
if (null == couponsListRequest.getServiceType()) { | |||
throw ZfdServiceError.BUSINESS_VALIDATE_ERR.toHandleException("服务类型为空."); | |||
} | |||
final Map<String, String> map = Maps.newHashMap(); | |||
map.put("serviceType", couponsListRequest.getServiceType().getType()); | |||
map.put("distributorId", gascouponDistributorId); | |||
return map; | |||
} | |||
@Override | |||
protected HtlMethodEnum getHtlMethodEnum() { | |||
return HtlMethodEnum.HLT_FUEL_COUP_LIST_V2; | |||
} | |||
} |
@@ -3,11 +3,13 @@ package cn.com.yskj.zfdm.manager.comm.handler.hlt.service; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.HltResponse; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.HltSingleResponse; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.request.HltCouponsListRequest; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.request.HltFuelCoupListRequest; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.request.PayOrderByCouNoRequest; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.request.RechargeOrderRequest; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.request.RechargePayOrderByIdRequest; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.request.RechargeRequest; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.response.HltCouponsListResponse; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.response.HltFuelCoupListResponse; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.response.HltPayOrderByCouNoResponse; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.response.HltRechargeOrderResponse; | |||
@@ -31,6 +33,13 @@ public interface HltService { | |||
*/ | |||
HltResponse<HltFuelCoupListResponse> getHltFuelCoupList(HltFuelCoupListRequest request) throws ServiceHandleException; | |||
/*** | |||
* 获取加油券商品列表 V2 (含加油券类型) | |||
* @param request 参数工具类 | |||
* @return 、 | |||
* @throws ServiceHandleException \ | |||
*/ | |||
HltResponse<HltCouponsListResponse> getHltCouponsList(HltCouponsListRequest request) throws ServiceHandleException; | |||
/*** | |||
* 查询核销状态 |
@@ -12,11 +12,13 @@ import com.alibaba.fastjson2.TypeReference; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.HltResponse; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.HltSingleResponse; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.request.HltCouponsListRequest; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.request.HltFuelCoupListRequest; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.request.PayOrderByCouNoRequest; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.request.RechargeOrderRequest; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.request.RechargePayOrderByIdRequest; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.request.RechargeRequest; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.response.HltCouponsListResponse; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.response.HltFuelCoupListResponse; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.response.HltPayOrderByCouNoResponse; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.response.HltRechargeOrderResponse; | |||
@@ -46,6 +48,8 @@ public class HltServiceImpl implements HltService { | |||
private AbstractHltService hltRechargePayOrderByIdService; | |||
@Resource(name="hltRechargeService") | |||
private AbstractHltService hltRechargeService; | |||
@Resource(name="hltCoupListService") | |||
private AbstractHltService hltCoupListService; | |||
// @Resource(name="hltSmsService") | |||
// private AbstractHltService hltSmsService; | |||
@@ -104,4 +108,16 @@ public class HltServiceImpl implements HltService { | |||
return response; | |||
} | |||
@Override | |||
public HltResponse<HltCouponsListResponse> getHltCouponsList(HltCouponsListRequest request) | |||
throws ServiceHandleException { | |||
final String execute = hltCoupListService.execute(request); | |||
final HltResponse<HltCouponsListResponse> response = JSON.parseObject(execute, new TypeReference<HltResponse<HltCouponsListResponse>>() { | |||
}); | |||
if (!"0000".equals(response.getRespCode())) { | |||
throw ZfdServiceError.BUSINESS_VALIDATE_ERR.toHandleException("获取加油券商品列表(V2)失败..." + response.getMsg()); | |||
} | |||
return response; | |||
} | |||
} |
@@ -1,16 +1,12 @@ | |||
package cn.com.yskj.zfdm.manager.gas.coupon; | |||
import java.util.List; | |||
import javax.validation.Valid; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.common.model.BaseModel; | |||
import cn.com.taiji.common.model.LabelIdPair; | |||
import cn.com.taiji.common.model.dao.Pagination; | |||
import cn.com.yskj.zfdm.entity.User; | |||
import cn.com.yskj.zfdm.model.gas.coupon.GasCouponModel; | |||
import cn.com.yskj.zfdm.entity.zfd.ZfdGasCoupons; | |||
import cn.com.yskj.zfdm.entity.zfd.ZfdServiceApply; | |||
import cn.com.yskj.zfdm.repo.request.gas.coupon.GasCouponPageRequest; | |||
import cn.com.yskj.zfdm.repo.request.service.application.ServiceApplicationSubmitRequest; | |||
/** | |||
* @ClassName: GasCouponManager | |||
@@ -27,26 +23,13 @@ public interface GasCouponManager { | |||
*/ | |||
Pagination queryPage(GasCouponPageRequest queryModel); | |||
/** | |||
* 根据名称查询车辆,此为模糊查询 | |||
* @param name | |||
* @return | |||
*/ | |||
List<LabelIdPair> queryVehicle(String name); | |||
/** | |||
* 根据名称查询使用人,此为模糊查询 | |||
* @param name | |||
* @return | |||
*/ | |||
List<LabelIdPair> queryAuditorName(String name); | |||
/** | |||
* 加油劵发放提交 | |||
* @param queryModel | |||
* @param loginUser | |||
*/ | |||
boolean submit(GasCouponPageRequest queryModel) throws Exception; | |||
void submit(GasCouponPageRequest queryModel,User user) throws ManagerException ; | |||
/** | |||
* 根据使用人名称查询手机号 | |||
@@ -55,7 +38,6 @@ public interface GasCouponManager { | |||
*/ | |||
BaseModel getMobileByMemberId(String memberId); | |||
public ZfdServiceApply findById(String id); | |||
} |
@@ -1,27 +1,47 @@ | |||
package cn.com.yskj.zfdm.manager.gas.coupon; | |||
import java.text.SimpleDateFormat; | |||
import java.time.LocalDateTime; | |||
import java.time.format.DateTimeFormatter; | |||
import java.util.Date; | |||
import java.util.List; | |||
import java.util.UUID; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.util.StringUtils; | |||
import com.google.common.collect.Lists; | |||
import com.hlt.gov.zfd.manager.model.protocol.hlt.enums.HltServicesTypeEnum; | |||
import cn.com.taiji.common.manager.AbstractManager; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.com.taiji.common.model.BaseModel; | |||
import cn.com.taiji.common.model.LabelIdPair; | |||
import cn.com.taiji.common.model.dao.Pagination; | |||
import cn.com.yskj.zfdm.entity.dict.CouponStatusType; | |||
import cn.com.yskj.zfdm.entity.zfd.ZfdGasCouponVerify; | |||
import cn.com.yskj.zfdm.entity.zfd.ZfdGasCoupons; | |||
import cn.com.yskj.zfdm.entity.zfd.ZfdOrgMember; | |||
import cn.com.yskj.zfdm.entity.User; | |||
import cn.com.yskj.zfdm.entity.dict.ApprovalType; | |||
import cn.com.yskj.zfdm.entity.dict.ServiceApplicationManagementStatus; | |||
import cn.com.yskj.zfdm.entity.dict.ZfdServiceApplyDetailBusinessTypeEnum; | |||
import cn.com.yskj.zfdm.entity.dict.ZfdServiceApplyDetailCouTypeEnum; | |||
import cn.com.yskj.zfdm.entity.dict.ZfdServiceApplyDetailStatusEnum; | |||
import cn.com.yskj.zfdm.entity.zfd.ZfdServiceApply; | |||
import cn.com.yskj.zfdm.entity.zfd.ZfdServiceApplyDetail; | |||
import cn.com.yskj.zfdm.entity.zfd.ZfdVehicleinfo; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.HltResponse; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.HltSingleResponse; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.request.HltCouponsListRequest; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.request.RechargeOrderRequest; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.request.RechargePayOrderByIdRequest; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.request.RechargeRequest; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.response.HltCouponsListResponse; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.response.HltRechargeOrderResponse; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.response.HltRechargePayOrderByIdResponse; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.response.HltRechargeResponse; | |||
import cn.com.yskj.zfdm.manager.comm.handler.hlt.service.HltService; | |||
import cn.com.yskj.zfdm.model.service.application.ServiceApplicationMobileAjaxResponse; | |||
import cn.com.yskj.zfdm.repo.request.gas.coupon.GasCouponPageRequest; | |||
import cn.com.yskj.zfdm.repo.zfd.ZfdGasCouponVerifyRepo; | |||
import cn.com.yskj.zfdm.repo.zfd.ZfdGasCouponsRepo; | |||
import cn.com.yskj.zfdm.repo.zfd.ZfdOrgMemberRepo; | |||
import cn.com.yskj.zfdm.repo.zfd.ZfdServiceApplyDetailRepo; | |||
import cn.com.yskj.zfdm.repo.zfd.ZfdServiceApplyRepo; | |||
import cn.com.yskj.zfdm.repo.zfd.ZfdVehicleinfoRepo; | |||
@@ -34,100 +54,291 @@ import cn.com.yskj.zfdm.repo.zfd.ZfdVehicleinfoRepo; | |||
@Service | |||
public class GasCouponManagerImpl extends AbstractManager implements GasCouponManager{ | |||
@Autowired | |||
ZfdGasCouponsRepo zfdGasCouponsRepo ; | |||
@Autowired | |||
ZfdVehicleinfoRepo zfdVehicleinfoRepo; | |||
@Autowired | |||
ZfdOrgMemberRepo zfdOrgMemberRepo; | |||
@Autowired | |||
ZfdGasCouponVerifyRepo zfdGasCouponVerifyRepo; | |||
@Autowired | |||
ZfdServiceApplyRepo zfdServiceApplyRepo; | |||
@Autowired | |||
private HltService hltService; | |||
@Autowired | |||
ZfdServiceApplyDetailRepo zfdServiceApplyDetailRepo; | |||
@Override | |||
public Pagination queryPage(GasCouponPageRequest queryModel) { | |||
return zfdGasCouponsRepo.page(queryModel); | |||
return zfdServiceApplyRepo.page(queryModel); | |||
} | |||
@Override | |||
public List<LabelIdPair> queryVehicle(String name) { | |||
List<ZfdVehicleinfo> vehicleIdList=zfdVehicleinfoRepo.queryVehicleLike(name); | |||
List<LabelIdPair> list = Lists.newArrayList(); | |||
for (ZfdVehicleinfo zfdVehicleinfo : vehicleIdList) { | |||
LabelIdPair labelIdPair = new LabelIdPair(); | |||
labelIdPair.setId(zfdVehicleinfo.getId()); | |||
// labelIdPair.setLabel(zfdVehicleinfo.getVehicleId()); | |||
list.add(labelIdPair); | |||
} | |||
return list; | |||
} | |||
@Override | |||
public List<LabelIdPair> queryAuditorName(String name) { | |||
List<ZfdOrgMember> auditorNameList=zfdOrgMemberRepo.queryAuditorNameLike(name); | |||
List<LabelIdPair> list = Lists.newArrayList(); | |||
for (ZfdOrgMember zfdOrgMember : auditorNameList) { | |||
LabelIdPair labelIdPair = new LabelIdPair(); | |||
labelIdPair.setId(zfdOrgMember.getId()); | |||
labelIdPair.setLabel(zfdOrgMember.getName()); | |||
list.add(labelIdPair); | |||
} | |||
return list; | |||
public BaseModel getMobileByMemberId(String memberId) { | |||
ServiceApplicationMobileAjaxResponse response = new ServiceApplicationMobileAjaxResponse(); | |||
response.setMobile(zfdOrgMemberRepo.getMobileByMemberId(memberId)); | |||
return response; | |||
} | |||
/** | |||
* 加油券发放提交 | |||
*/ | |||
@Override | |||
public boolean submit(GasCouponPageRequest queryModel) throws Exception { | |||
// validate | |||
public void submit(GasCouponPageRequest queryModel,User user) throws ManagerException { | |||
//非空校验 | |||
queryModel.valid(); | |||
// generate data | |||
ZfdServiceApply zfdServiceApply = new ZfdServiceApply(); | |||
String list = queryModel.getFee(); | |||
String[] split =list.split(","); | |||
String couTypeTitle =split[0]; | |||
String couFaceValue =split[1]; | |||
String picUrl =split[2]; | |||
String couType =split[3]; | |||
String couTypeCode =split[4]; | |||
String bussinessType = split[5]; | |||
//设置插入时间 | |||
zfdServiceApply.setInsertTime(LocalDateTime.now()); | |||
//设置更新时间 | |||
zfdServiceApply.setUpdateTime(LocalDateTime.now()); | |||
//设置车辆id | |||
zfdServiceApply.setVehicleId(queryModel.getVehicleId()); | |||
ZfdVehicleinfo zfdVehicleinfo =zfdVehicleinfoRepo.findByVehicle(queryModel.getVehicleId()); | |||
//如果查询数据不为空 | |||
if(zfdVehicleinfo !=null){ | |||
//设置车牌号 | |||
zfdServiceApply.setVehiclePlate(zfdVehicleinfo.getVehiclePalte()); | |||
//设置车牌颜色 | |||
zfdServiceApply.setVehiclePlatecolor(zfdVehicleinfo.getVehiclePlatecolor()); | |||
} | |||
//设置备注 | |||
zfdServiceApply.setRemarks(queryModel.getRemarks()); | |||
//设置申请人id | |||
zfdServiceApply.setApplicantId(queryModel.getApplicantId()); | |||
//设置申请人名称 | |||
zfdServiceApply.setApplicantName(zfdOrgMemberRepo.findById(queryModel.getApplicantId()).get().getName()); | |||
//设置申请时间 | |||
zfdServiceApply.setApplyTime(LocalDateTime.now()); | |||
//设置状态(审批通过) | |||
zfdServiceApply.setStatus(ApprovalType.PASSED); | |||
//设置服务结束时间 | |||
zfdServiceApply.setServiceEndTime(LocalDateTime.now()); | |||
//设置审批人id | |||
zfdServiceApply.setAuditorId(user.getId()); | |||
//设置审批人姓名 | |||
zfdServiceApply.setAuditorName(user.getName()); | |||
//设置审批时间 | |||
zfdServiceApply.setAuditTime(LocalDateTime.now()); | |||
//设置服务类别(加油券) | |||
zfdServiceApply.setServiceType(ServiceApplicationManagementStatus.GAS_COUPON); | |||
//设置金额 | |||
zfdServiceApply.setFee(Integer.valueOf(couFaceValue)*100); | |||
ZfdServiceApplyDetail zfdServiceApplyDetail = new ZfdServiceApplyDetail(); | |||
//向服务详情表中添加数据 | |||
zfdServiceApplyDetail.setInsertTime(LocalDateTime.now()); | |||
zfdServiceApplyDetail.setUpdateTime(LocalDateTime.now()); | |||
zfdServiceApplyDetail.setApplyId(zfdServiceApply.getId()); | |||
zfdServiceApplyDetail.setCouType(StringUtils.isEmpty(couType) ? null : ZfdServiceApplyDetailCouTypeEnum.find(Integer.valueOf(couType))); | |||
zfdServiceApplyDetail.setCouPic(picUrl); | |||
zfdServiceApplyDetail.setCouTypeCode(couTypeCode); | |||
zfdServiceApplyDetail.setDisCouCount(1); | |||
zfdServiceApplyDetail.setBusinessType(StringUtils.isEmpty(bussinessType) ? null : ZfdServiceApplyDetailBusinessTypeEnum.find(Integer.valueOf(bussinessType))); | |||
String orderId = UUID.randomUUID().toString().replace("-", "").substring(0, 24) + | |||
new SimpleDateFormat("yyyyMMdd").format(new Date()); | |||
zfdServiceApplyDetail.setOrderId(orderId); | |||
zfdServiceApplyDetail.setCouTypeTitle(couTypeTitle); | |||
//根据申请人id查找手机号 | |||
String mobile = zfdOrgMemberRepo.findById(queryModel.getApplicantId()).get().getMobile(); | |||
zfdServiceApplyDetail.setPhone(mobile); | |||
System.out.println("手机号"+ mobile); | |||
// 调用 油券购买接口 获取充值订单编号 | |||
String rechargeOrderId = rechargeCommRequest(couTypeCode,mobile, orderId); | |||
zfdServiceApplyDetail.setRechargeOrderId(rechargeOrderId); | |||
// 调用油券激活接口 获取券码号等一系列数据 | |||
List<HltRechargeOrderResponse> hltRechargeOrderResponse = rechargeOrderCommRequest(rechargeOrderId); | |||
zfdServiceApplyDetail.setCouNo(hltRechargeOrderResponse.get(0).getCouNo()); | |||
try { | |||
ZfdGasCoupons coupons = generateGasCoupon(queryModel); | |||
// dboprate | |||
zfdGasCouponsRepo.persist(coupons); | |||
LocalDateTime validEndDate = LocalDateTime.parse(hltRechargeOrderResponse.get(0).getValidEndDate(),DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); | |||
zfdServiceApplyDetail.setValidEndDate(validEndDate); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
throw ManagerException("提交服务申请异常:"+e.getMessage()); | |||
String errorMsg = "汇联通油券平台返回有效期结束时间格式错误:" + hltRechargeOrderResponse.get(0).getValidEndDate(); | |||
logger.info(errorMsg); | |||
throw new ManagerException(errorMsg); | |||
} | |||
return true; | |||
try { | |||
LocalDateTime validStartDate = LocalDateTime.parse(hltRechargeOrderResponse.get(0).getValidStartDate(),DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); | |||
zfdServiceApplyDetail.setValidStartDate(validStartDate); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
String errorMsg = "汇联通油券平台返回有效期起始时间格式错误:" + hltRechargeOrderResponse.get(0).getValidStartDate(); | |||
logger.info(errorMsg); | |||
throw new ManagerException(errorMsg); | |||
} | |||
zfdServiceApplyDetail.setStartDate(hltRechargeOrderResponse.get(0).getStartDate()); | |||
zfdServiceApplyDetail.setEndDate(hltRechargeOrderResponse.get(0).getEndDate()); | |||
String couThresholdAmount = hltRechargeOrderResponse.get(0).getCouThresholdAmount(); | |||
zfdServiceApplyDetail.setCouThresholdAmount(StringUtils.isEmpty(couThresholdAmount) ? null : Integer.valueOf(couThresholdAmount)); | |||
if(hltRechargeOrderResponse.get(0).getValidType() !=null){ | |||
zfdServiceApplyDetail.setValidType(String.valueOf(hltRechargeOrderResponse.get(0).getValidType())); | |||
} | |||
// 调用 获取加油券消费订单详情接口 获取当前加油券状态 | |||
String status = getRechargePayOrderById(rechargeOrderId); | |||
zfdServiceApplyDetail.setStatus(ZfdServiceApplyDetailStatusEnum.find(status)); | |||
//保存数据(服务申请表) | |||
zfdServiceApplyRepo.persist(zfdServiceApply); | |||
//保存数据 | |||
zfdServiceApplyDetailRepo.persist(zfdServiceApplyDetail); | |||
} | |||
private Exception ManagerException(String string) { | |||
// TODO Auto-generated method stub | |||
return null; | |||
/** | |||
* 获取加油券商品列表 V2 (含加油券类型) | |||
*/ | |||
public List<HltCouponsListResponse> getListGasCoupons() | |||
throws ServiceHandleException, ManagerException { | |||
HltCouponsListRequest request = new HltCouponsListRequest(); | |||
request.setServiceType(HltServicesTypeEnum.ALL); | |||
HltResponse<HltCouponsListResponse> hltResponse = hltService.getHltCouponsList(request); | |||
if (hltResponse == null) { | |||
String errorMsg = "调用加油券商品列表接口失败:无响应"; | |||
logger.info(errorMsg); | |||
throw new ManagerException(errorMsg); | |||
} else { | |||
if (hltResponse.getData() == null) { | |||
String errorMsg = "调用加油券商品列表接口失败:无响应数据"; | |||
logger.info(errorMsg); | |||
throw new ManagerException(errorMsg); | |||
} | |||
if ("0000".equals(hltResponse.getRespCode())) { // 调用成功 | |||
} else { | |||
// 调用失败 | |||
String errorMsg = "调用加油券商品列表接口失败:" + hltResponse.getMsg() + ",返回码:" + hltResponse.getRespCode(); | |||
logger.info(errorMsg); | |||
throw new ManagerException(errorMsg); | |||
} | |||
} | |||
return hltResponse.getData(); | |||
} | |||
/** | |||
* 加油劵发放添加数据 | |||
* @param queryModel | |||
* 获取 消费加油券充值订单 | |||
* @param rechargeOrderId | |||
* @return | |||
* @throws ServiceHandleException | |||
* @throws ManagerException | |||
*/ | |||
private ZfdGasCoupons generateGasCoupon(GasCouponPageRequest queryModel) { | |||
ZfdGasCoupons zfdGasCoupons = new ZfdGasCoupons(); | |||
zfdGasCoupons.setCouponApplicantName(zfdOrgMemberRepo.findById(queryModel.getCouponApplicantId()).get().getName()); | |||
zfdGasCoupons.setCouponApplicantId(queryModel.getCouponApplicantId()); | |||
zfdGasCoupons.setCouponValue(queryModel.getCouponValue() * 100); | |||
zfdGasCoupons.setCouponStatus(CouponStatusType.NOT_USE); | |||
zfdGasCoupons.setVehicleId(queryModel.getVehicleId()); | |||
zfdGasCoupons.setRemarks(queryModel.getRemarks()); | |||
ZfdGasCouponVerify zfdGasCouponVerify = zfdGasCouponVerifyRepo.findByCouponApplicantId(queryModel.getCouponApplicantId()); | |||
zfdGasCoupons.setCouponNo(zfdGasCouponVerify.getCouponNo()); | |||
zfdGasCoupons.setCouponEnableTime(zfdGasCouponVerify.getCouponEnableTime()); | |||
zfdGasCoupons.setCouponExpireTime(zfdGasCouponVerify.getCouponExpireTime()); | |||
zfdGasCoupons.setFuelingApplyType(zfdGasCouponVerify.getFuelingApplyType()); | |||
zfdGasCoupons.setServiceApplyId(zfdGasCouponVerify.getServiceApplyId()); | |||
zfdGasCoupons.setInsertTime(LocalDateTime.now()); | |||
zfdGasCoupons.setUpdateTime(LocalDateTime.now()); | |||
return zfdGasCoupons; | |||
private List<HltRechargeOrderResponse> rechargeOrderCommRequest(String rechargeOrderId) | |||
throws ServiceHandleException, ManagerException { | |||
RechargeOrderRequest rechargeOrderRequest = new RechargeOrderRequest(); | |||
rechargeOrderRequest.setRechargeOrderId(rechargeOrderId); | |||
HltResponse<HltRechargeOrderResponse> rechargeOrderResponse = hltService.costRechargeOrder(rechargeOrderRequest); | |||
if(rechargeOrderResponse == null ) { | |||
String errorMsg = "调用汇联通加油券平台油券激活接口失败:无响应"; | |||
logger.info(errorMsg); | |||
throw new ManagerException(errorMsg); | |||
}else{ | |||
if(rechargeOrderResponse.getData() == null ) { | |||
String errorMsg = "调用汇联通加油券平台油券激活接口失败:无响应数据"; | |||
logger.info(errorMsg); | |||
throw new ManagerException(errorMsg); | |||
} | |||
if("0000".equals(rechargeOrderResponse.getRespCode())){ //调用成功 | |||
}else{ | |||
//调用失败 | |||
String errorMsg = "调用汇联通加油券平台油券激活接口失败:" + rechargeOrderResponse.getMsg() + ",返回码:" + rechargeOrderResponse.getRespCode(); | |||
logger.info(errorMsg); | |||
throw new ManagerException(errorMsg); | |||
} | |||
} | |||
return rechargeOrderResponse.getData(); | |||
} | |||
@Override | |||
public BaseModel getMobileByMemberId(String memberId) { | |||
ServiceApplicationMobileAjaxResponse response = new ServiceApplicationMobileAjaxResponse(); | |||
response.setMobile(zfdOrgMemberRepo.getMobileByMemberId(memberId)); | |||
return response; | |||
/** | |||
* 获取 购买加油券充值订单 | |||
* @param request | |||
* @param orderId | |||
* @return | |||
* @throws ServiceHandleException | |||
* @throws ManagerException | |||
*/ | |||
private String rechargeCommRequest(String couTypeCode,String mobile,String orderId) | |||
throws ServiceHandleException, ManagerException { | |||
// 调用油券购买接口 | |||
RechargeRequest rechargeRequest = new RechargeRequest(); | |||
rechargeRequest.setCouTypeCode(couTypeCode); | |||
rechargeRequest.setDistCouCount(1); | |||
rechargeRequest.setOrderNo(orderId); | |||
rechargeRequest.setPhone(mobile); | |||
HltSingleResponse<HltRechargeResponse> rechargeResponse = hltService.recharge(rechargeRequest); | |||
if(rechargeResponse == null ) { | |||
String errorMsg = "调用汇联通加油券平台油券购买接口失败:无响应"; | |||
logger.info(errorMsg); | |||
throw new ManagerException(errorMsg); | |||
}else{ | |||
if(rechargeResponse.getData() == null ) { | |||
String errorMsg = "调用汇联通加油券平台油券购买接口失败:无响应数据"; | |||
logger.info(errorMsg); | |||
throw new ManagerException(errorMsg); | |||
} | |||
if("0000".equals(rechargeResponse.getRespCode())){ //调用成功 | |||
} | |||
else{ | |||
//调用失败 | |||
String errorMsg = "调用汇联通加油券平台油券购买接口失败:" + rechargeResponse.getMsg() + ",返回码:" + rechargeResponse.getRespCode(); | |||
logger.info(errorMsg); | |||
throw new ManagerException(errorMsg); | |||
} | |||
} | |||
return rechargeResponse.getData().getRechargeOrderId(); | |||
} | |||
/** | |||
* 获取加油券消费订单详情接口 | |||
* @param rechargeOrderId | |||
* @return | |||
* @throws ServiceHandleException | |||
* @throws ManagerException | |||
*/ | |||
private String getRechargePayOrderById(String rechargeOrderId) | |||
throws ServiceHandleException, ManagerException { | |||
RechargePayOrderByIdRequest orderByIdRequest = new RechargePayOrderByIdRequest(); | |||
orderByIdRequest.setRechargeId(rechargeOrderId); | |||
HltSingleResponse<HltRechargePayOrderByIdResponse> response = hltService.getRechargePayOrderById(orderByIdRequest); | |||
if(response == null ) { | |||
String errorMsg = "调用汇联通获取加油券消费订单详情接口失败:无响应"; | |||
logger.info(errorMsg); | |||
throw new ManagerException(errorMsg); | |||
}else{ | |||
if(response.getData() == null ) { | |||
String errorMsg = "调用汇联通获取加油券消费订单详情接口失败:无响应数据"; | |||
logger.info(errorMsg); | |||
throw new ManagerException(errorMsg); | |||
} | |||
if("0000".equals(response.getRespCode())){ //调用成功 | |||
}else{ | |||
//调用失败 | |||
String errorMsg = "调用汇联通获取加油券消费订单详情接口失败:" + response.getMsg() + ",返回码:" + response.getRespCode(); | |||
logger.info(errorMsg); | |||
throw new ManagerException(errorMsg); | |||
} | |||
} | |||
return response.getData().getState(); | |||
} | |||
/** | |||
* 查找数据 | |||
*/ | |||
@Override | |||
public ZfdServiceApply findById(String id) { | |||
return zfdServiceApplyRepo.findById(id).orElse(null); | |||
} | |||
} |
@@ -15,10 +15,12 @@ import cn.com.yskj.zfdm.entity.dict.ApprovalType; | |||
import cn.com.yskj.zfdm.entity.dict.ServiceApplicationManagementStatus; | |||
import cn.com.yskj.zfdm.entity.zfd.ZfdOrgMember; | |||
import cn.com.yskj.zfdm.entity.zfd.ZfdServiceApply; | |||
import cn.com.yskj.zfdm.entity.zfd.ZfdServiceApplyDetail; | |||
import cn.com.yskj.zfdm.entity.zfd.ZfdVehicleinfo; | |||
import cn.com.yskj.zfdm.model.service.application.ServiceApplicationMobileAjaxResponse; | |||
import cn.com.yskj.zfdm.repo.request.service.application.ServiceApplicationSubmitRequest; | |||
import cn.com.yskj.zfdm.repo.zfd.ZfdOrgMemberRepo; | |||
import cn.com.yskj.zfdm.repo.zfd.ZfdServiceApplyDetailRepo; | |||
import cn.com.yskj.zfdm.repo.zfd.ZfdServiceApplyRepo; | |||
import cn.com.yskj.zfdm.repo.zfd.ZfdVehicleinfoRepo; | |||
@@ -37,7 +39,9 @@ public class ServiceApplicationManagerImpl extends AbstractManager implements Se | |||
private ZfdVehicleinfoRepo zfdVehicleinfoRepo; | |||
@Autowired | |||
private ZfdOrgMemberRepo zfdOrgMemberRepo; | |||
@Autowired | |||
private ZfdServiceApplyDetailRepo zfdServiceApplyDetailRepo; | |||
/** | |||
* 通过车牌模糊查询 | |||
*/ | |||
@@ -94,13 +98,37 @@ public class ServiceApplicationManagerImpl extends AbstractManager implements Se | |||
if(queryModel.getServiceType().equals("GAS_COUPON")){ | |||
//进行加油券添加操作 | |||
ZfdServiceApply apply =generateApply(queryModel); | |||
//保存提交数据 | |||
//保存数据到ZfdServiceApply表 | |||
zfdServiceApplyRepo.persist(apply); | |||
// ZfdServiceApplyDetail zfdServiceApplyDetail = new ZfdServiceApplyDetail(); | |||
// //设置服务申请id | |||
// zfdServiceApplyDetail.setApplyId(apply.getId()); | |||
// //设置插入时间 | |||
// zfdServiceApplyDetail.setInsertTime(LocalDateTime.now()); | |||
// //设置更新时间 | |||
// zfdServiceApplyDetail.setUpdateTime(LocalDateTime.now()); | |||
// ZfdOrgMember zfdOrgMember = zfdOrgMemberRepo.findById(queryModel.getApplicantId()).get(); | |||
// if(zfdOrgMember!=null){ | |||
// //设置手机号 | |||
// zfdServiceApplyDetail.setPhone(zfdOrgMember.getMobile()); | |||
// } | |||
// //TODO | |||
// //设置订单编号 | |||
// //TODO | |||
// //设置券类型编号 | |||
// //TODO | |||
// //设置派单数量 | |||
// | |||
// //保存数据到zfdServiceApplyDetail表 | |||
// zfdServiceApplyDetailRepo.persist(zfdServiceApplyDetail); | |||
//如果是除加油券外其它添加 | |||
}else { | |||
//进行除加油券外其它添加操作 | |||
ZfdServiceApply applys =generateApplyOther(queryModel); | |||
//保存提交数据 | |||
//保存数据到ZfdServiceApply表 | |||
zfdServiceApplyRepo.persist(applys); | |||
} | |||
} |
@@ -2,6 +2,7 @@ package cn.com.yskj.zfdm.manager.service.application; | |||
import java.time.LocalDateTime; | |||
import java.time.format.DateTimeFormatter; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import javax.validation.Valid; | |||
@@ -278,6 +279,7 @@ public class ServiceRequestInquiryManagerImpl extends AbstractManager implements | |||
LocalDateTime ApplyAuditMinTime=LocalDateTime.now().minusDays(7); | |||
//将时间与审批时间进行对比 | |||
List<ZfdServiceApply> zfdServiceApplyList=zfdServiceApplyRepo.listByApplyAuditTime(ApplyAuditMinTime); | |||
List<ZfdServiceApply> list = new ArrayList<>(); | |||
//循环遍历 | |||
for (ZfdServiceApply zfdServiceApply : zfdServiceApplyList) { | |||
//设置状态为"服务已结束" | |||
@@ -286,9 +288,11 @@ public class ServiceRequestInquiryManagerImpl extends AbstractManager implements | |||
zfdServiceApply.setServiceEndTime(LocalDateTime.now()); | |||
//设置修改时间 | |||
zfdServiceApply.setUpdateTime(LocalDateTime.now()); | |||
//进行数据保存 | |||
zfdServiceApplyRepo.save(zfdServiceApply); | |||
list.add(zfdServiceApply); | |||
} | |||
//进行数据保存 | |||
zfdServiceApplyRepo.persistAll(list); | |||
} | |||
@@ -0,0 +1,53 @@ | |||
package com.hlt.gov.zfd.manager.model.protocol.hlt.enums; | |||
/*** | |||
* <p> | |||
* 汇联通 服务类型 枚举。 | |||
* </p> | |||
* @author hou yi | |||
* @date 2022/9/29 11:12 | |||
**/ | |||
public enum HltServicesTypeEnum { | |||
/** | |||
* 描述 | |||
*/ | |||
COME_ON_STAMPS(0, "01", "获取加油券商品列表接口 V1 接口使用"), | |||
ZSH(1, "01", "获取加油券商品列表接口 V2 接口使用。中石化加油券"), | |||
ZSY(2, "02", "获取加油券商品列表接口 V2 接口使用。中石油加油券"), | |||
ALL(3, "99", "获取加油券商品列表接口 V2 接口使用。所有加油券"), | |||
; | |||
/** | |||
* 状态码 | |||
*/ | |||
private final Integer code; | |||
/** | |||
* 类型 | |||
*/ | |||
private final String type; | |||
/** | |||
* 状态描述 | |||
*/ | |||
private final String description; | |||
HltServicesTypeEnum(Integer code, String type, String description) { | |||
this.code = code; | |||
this.type = type; | |||
this.description = description; | |||
} | |||
public Integer getCode() { | |||
return code; | |||
} | |||
public String getType() { | |||
return type; | |||
} | |||
public String getDescription() { | |||
return description; | |||
} | |||
} | |||
@@ -17,6 +17,7 @@ public enum HtlMethodEnum { | |||
PAY_ORDER_BY_COU_NO(3, "fuelCouponsTest/getPayOrderByCouNo", "fuelCoupons/getPayOrderByCouNo", "查询核销状态"), | |||
RECHARGE_ORDER(4, "fuelCouponsTest/costRechargeOrder", "fuelCoupons/costRechargeOrder", "消费加油券充值订单"), | |||
SEND_SMS(5, "hltsms/submitSms", "hltsms/submitSms", "发送短信"), | |||
HLT_FUEL_COUP_LIST_V2(6, "fuelCouponsTest/getHltCouponsList", "fuelCoupons/getHltCouponsList", "获取加油券商品列表接口V2"), | |||
; | |||
/** |
@@ -11,9 +11,14 @@ import org.springframework.web.bind.annotation.PathVariable; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RequestMethod; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.common.manager.net.http.HttpMimeResponseHelper; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.com.taiji.common.model.dao.Pagination; | |||
import cn.com.yskj.zfdm.entity.dict.LogType; | |||
import cn.com.yskj.zfdm.manager.LoginHelper; | |||
import cn.com.yskj.zfdm.manager.gas.coupon.GasCouponManager; | |||
import cn.com.yskj.zfdm.manager.gas.coupon.GasCouponManagerImpl; | |||
import cn.com.yskj.zfdm.manager.vehicle.management.VehicleManagementManger; | |||
import cn.com.yskj.zfdm.repo.request.gas.coupon.GasCouponPageRequest; | |||
import cn.com.yskj.zfdm.repo.zfd.ZfdOrgMemberRepo; | |||
@@ -36,6 +41,8 @@ public class GasCouponController extends BaseLogController{ | |||
private VehicleManagementManger vehicleManager; | |||
@Autowired | |||
private ZfdOrgMemberRepo memberRepo; | |||
@Autowired | |||
private GasCouponManagerImpl gasCouponManagerImpl; | |||
@RequestMapping(value = "/manage", method = RequestMethod.GET) | |||
public String manageGet(@ModelAttribute("queryModel") GasCouponPageRequest queryModel, Model model) | |||
@@ -57,21 +64,24 @@ public class GasCouponController extends BaseLogController{ | |||
* 获取加油劵发放提交数据 | |||
*/ | |||
@RequestMapping(value = "/coupondistribution", method = RequestMethod.GET) | |||
public String manageCouponDistribution(Model model) | |||
public String manageGetCoupon(Model model)throws ServiceHandleException, ManagerException | |||
{ | |||
model.addAttribute("fees", gasCouponManagerImpl.getListGasCoupons()); | |||
model.addAttribute("vehicles", vehicleManager.findAll()); | |||
model.addAttribute("members", memberRepo.findAll()); | |||
return prefix + "coupondistribution"; | |||
} | |||
/** | |||
* 进行加油劵发放提交操作 | |||
*/ | |||
@RequestMapping(value = "/coupondistribution", method = RequestMethod.POST) | |||
public String manageCouponDistribution(@ModelAttribute("queryModel") GasCouponPageRequest queryModel, Model model, HttpServletRequest request,HttpServletResponse response) throws Exception | |||
public String manageCouponDistribution(@ModelAttribute("pageModel") GasCouponPageRequest queryModel, Model model, HttpServletRequest request,HttpServletResponse response) throws Exception | |||
{ | |||
System.out.println(queryModel.toJson()); | |||
gasCouponManager.submit(queryModel); | |||
gasCouponManager.submit(queryModel,LoginHelper.getLoginUser(request)); | |||
model.addAttribute("model", queryModel); | |||
addSuccess(response, "提交成功"); | |||
addLog(request, LogType.GAS_COUPON, "用户({})提交数据成功", LoginHelper.getLoginUser(request).getName()); | |||
return prefix + "manage"; | |||
} | |||
@@ -11,19 +11,18 @@ | |||
cache : false | |||
}); | |||
$("#submit").click(function() { | |||
$("#myManage").triggerHandler("taijiModalPost", [ $("#myForm"), { | |||
table : "none" | |||
$("#myManage").triggerHandler("taijiModalPost", [ $("#coupondistributionForm"), { | |||
table : "edit" | |||
} ]); | |||
}); | |||
$("#reset").mouseup(function() { | |||
$("#mobile").html(""); | |||
}); | |||
$('.fee_row').hide(); | |||
}); | |||
function updateMobile() { | |||
var data = $("#couponApplicantId").val(); | |||
var url = '${rootUrl}app/service/request/inquiry/coupon/getMobileByMemberId/' | |||
var data = $("#applicantId").val(); | |||
var url = '${rootUrl}app/coupon/coupondistribution/getMobileByMemberId/' | |||
+ data; | |||
$.ajax({ | |||
url : url, | |||
@@ -34,6 +33,15 @@ | |||
} | |||
}); | |||
} | |||
// function changeForm(e){ | |||
// $('#fee option:selected').val(); | |||
// console.log($('#fee option:selected').attr('data-title')); | |||
// console.log($('#fee option:selected').attr('data-url')); | |||
// console.log($('#fee option:selected').attr('data-type')); | |||
// console.log($('#fee option:selected').attr('data-code')); | |||
// } | |||
</script> | |||
</head> | |||
<body> | |||
@@ -41,23 +49,31 @@ | |||
<div class="modal-header"> | |||
<button type="button" class="close" data-dismiss="modal" | |||
aria-hidden="true">×</button> | |||
<h4 class="modal-title">加油劵发放</h4> | |||
<h4 class="modal-title">加油券发放提交</h4> | |||
</div> | |||
<div class="modal-body"> | |||
<form:form modelAttribute="pageModel" id="myForm" name="myForm" | |||
<form:form modelAttribute="pageModel" id="coupondistributionForm" name="coupondistributionForm" | |||
cssClass="form-horizontal" | |||
action="${rootUrl}app/coupon/coupondistribution" method="post"> | |||
<table> | |||
<tr> | |||
<th>劵金额</th> | |||
<td><input style="margin: 5px -2px" id="couponValue" name="couponValue" type="number" maxlength="100" | |||
class="form-control" placeholder="劵金额" /></td> | |||
<th>劵类型_金额</th> | |||
<td><select style="margin: 5px -2px" name="fee" | |||
id="fee" class="form-control" | |||
onchange="changeForm(this.value)"> | |||
<option value="">请选择</option> | |||
<c:forEach items="${fees}" var="m"> | |||
<option | |||
value="${m.couTypeTitle},${m.couFaceValue},${m.picUrl},${m.couType},${m.couTypeCode},${m.bussinessType}"> | |||
${m.couTypeTitle } ${m.couFaceValue }</option> | |||
</c:forEach> | |||
</select></td> | |||
</tr> | |||
<tr> | |||
<th>使用人</th> | |||
<td><select style="margin: 5px -2px" name="couponApplicantId" id="couponApplicantId" | |||
onchange="updateMobile()" class="form-control"> | |||
<td><select style="margin: 5px -2px" name="applicantId" | |||
id="applicantId" onchange="updateMobile()" class="form-control"> | |||
<option value="">请选择</option> | |||
<c:forEach items="${members}" var="m"> | |||
<option value="${m.id}">${m.name }</option> | |||
@@ -70,18 +86,19 @@ | |||
</tr> | |||
<tr> | |||
<th>车辆</th> | |||
<td><select style="margin: 5px -2px" name="vehicleId" id="vehicleId" | |||
class="form-control"> | |||
<td><select style="margin: 5px -2px" name="vehicleId" | |||
id="vehicleId" class="form-control"> | |||
<option value="">请选择</option> | |||
<c:forEach items="${vehicles}" var="v"> | |||
<option value="${v.vehicleId}">${v.vehiclePalte }_${v.vehiclePlatecolor }</option> | |||
<option value="${v.vehicleId}">${v.vehiclePalte }_${v.vehiclePlatecolor.value }</option> | |||
</c:forEach> | |||
</select></td> | |||
</tr> | |||
<tr> | |||
<th>备注</th> | |||
<td><input style="margin: 5px -2px; height: 100px" id="remarks" name="remarks" maxlength="100" | |||
class="form-control" placeholder="备注" /></td> | |||
<td><input style="margin: 5px -2px; height: 100px" | |||
id="remarks" name="remarks" maxlength="100" class="form-control" | |||
placeholder="备注" /></td> | |||
</tr> | |||
<tr> | |||
<td><a href="#" style="margin-left: 10px; margin-top: 20px;" | |||
@@ -92,7 +109,6 @@ | |||
</tr> | |||
</table> | |||
</form:form> | |||
</div> | |||
</body> | |||
</html> |
@@ -6,23 +6,47 @@ | |||
<!--<![endif]--> | |||
<head> | |||
<%@ include file="/WEB-INF/jsp/assets.jsp"%> | |||
<script src="${rootUrl }plugins/datepicker/4.8/WdatePicker.js" | |||
type="text/javascript"></script> | |||
<link href="${rootUrl }plugins/treetable/jquery.treetable.css" | |||
rel="stylesheet" /> | |||
<script src="${rootUrl }plugins/treetable/jquery.treetable.js"></script> | |||
<link | |||
href="${rootUrl }plugins/bootstrap-editable/css/bootstrap-editable.css" | |||
rel="stylesheet" /> | |||
<script | |||
src="${rootUrl }plugins/bootstrap-editable/js/bootstrap-editable.min.js" | |||
type="text/javascript"></script> | |||
<script type="text/javascript"> | |||
$(function() { | |||
$("#myManage").taiji({ | |||
enableAclCheck : true | |||
}).on("taijiSearchSuccess", function() { | |||
$("#my-table").treetable({ | |||
expandable : true, | |||
initialState : "expanded", | |||
indent : 20 | |||
}, true); | |||
}).on("taijiOperateSuccess", function() { | |||
$("#listForm").submit(); | |||
}); | |||
$(function(){ | |||
$("#myManage").taiji({ | |||
enableAclCheck:true | |||
}).editable({ | |||
selector:".editable",//元素选择器,对目标元素启用编辑 | |||
url:"editGrid",//编辑提交的url | |||
success: editGridSuccess//服务器返回成功的回调方法 | |||
}).on("taijiSearchSuccess",function(event,result){ | |||
}).on("editGridSuccess",function(event,result){ | |||
}).on("taijiEditSuccess",function(){ | |||
$("#listForm").submit(); | |||
});; | |||
$("#addBtn").click(function(){ | |||
$(this).showModal({size:"modal-lg",backdrop:false,data:{loginName:"sample"}}); | |||
return false; | |||
}); | |||
function editGridSuccess(response, newValue) { | |||
if($.isPlainObject(response)&&response.success===true){ | |||
$.Taiji.showNote(response.msg); | |||
}else{ | |||
var result=$.parseJSON($(response).find("#taiji_note").text()); | |||
if(result&&result.success===false){ | |||
return $.Taiji.base64.decode(result.msg); | |||
} | |||
} | |||
} | |||
}); | |||
</script> | |||
<style type="text/css"> | |||
@@ -84,20 +108,23 @@ table.treetable tr.collapsed span.indenter a::before { | |||
<div class="panel-body"> | |||
<a href="${rootUrl }app/coupon/coupondistribution" | |||
class="taiji_modal taiji_acl btn btn-success m-r-10"><i | |||
class="fa fa-plus m-r-5"></i>加油券发放添加</a> | |||
class="fa fa-plus m-r-5"></i>添加</a> | |||
<form:form modelAttribute="queryModel" | |||
cssClass="taiji_search_form form-inline m-t-5 " id="listForm" | |||
name="listForm" action="${rootUrl}app/coupon/manage" | |||
method="post"> | |||
</form:form> | |||
</div> | |||
<div class="taiji_search_result table-responsive"> | |||
<table id="my-table" class="table table-bordered table-hover"> | |||
<thead> | |||
<tr> | |||
<th>序号</th> | |||
<th>劵金额</th> | |||
<th>使用人</th> | |||
<th>选择车辆</th> | |||
<th>时间</th> | |||
<th>备注</th> | |||
</tr> | |||
</thead> |
@@ -3,13 +3,19 @@ | |||
<tr> | |||
<td> | |||
${fn:escapeXml(vo.couponValue)} | |||
${fn:escapeXml(voStatus.count)} | |||
</td> | |||
<td> | |||
${fn:escapeXml(vo.couponApplicantId)} | |||
${fn:escapeXml(vo.fee)} | |||
</td> | |||
<td> | |||
${fn:escapeXml(vo.vehicleId)} | |||
${fn:escapeXml(vo.applicantName)} | |||
</td> | |||
<td> | |||
${fn:escapeXml(vo.vehiclePlate) }_${fn:escapeXml(vo.vehiclePlatecolor.value) } | |||
</td> | |||
<td> | |||
<javatime:format value="${vo.insertTime}" pattern="yyyy-MM-dd HH:mm:ss" /> | |||
</td> | |||
<td> | |||
${fn:escapeXml(vo.remarks)} |
@@ -2,7 +2,7 @@ | |||
<%@ include file="/WEB-INF/jsp/include.jsp"%> | |||
<tr> | |||
<td> | |||
${fn:escapeXml(vo.id)} | |||
${fn:escapeXml(voStatus.count)} | |||
</td> | |||
<td> | |||
${fn:escapeXml(vo.serviceType.value)} |