Commit 98dd9597 by jinxin

企业微信接口开发

parent 2d5cae22
......@@ -23,7 +23,7 @@ public interface LicenceOrderApiService {
* @param orderId 订单id
* @return LicenceOrderDTO
*/
ServiceResponse<LicenceOrderDTO> getLicenceOrderDetail(Long orderId);
ServiceResponse<LicenceOrderDTO> getLicenceOrderDetail(Long orderId,Integer type);
/**
* 删除订单
......@@ -75,5 +75,13 @@ public interface LicenceOrderApiService {
*/
ServiceResponse<Boolean> payLicenceOrder(Long orderId);
/**
* 查询企业是否存在订单未支付接口
*
* @param wxEnterpriseId 企业微信id
* @return
*/
ServiceResponse<Boolean> isPayLicenceOrder(String wxEnterpriseId);
}
......@@ -50,4 +50,11 @@ public interface TabHaobanLicenceOrderMapper {
*/
Integer uploadLicenceOrderVoucher(@Param("orderId")Long orderId, @Param("voucher")String voucher);
/**
* 根据wxEnterpriseId查询企业是否存在未支付订单
* @param wxEnterpriseId
* @return order_id
*/
String selectByWxEnterpriseId(@Param("wxEnterpriseId")String wxEnterpriseId);
}
......@@ -22,7 +22,7 @@ public interface TabHaobanLicenceOrderProgressMapper {
*/
Integer insert(TabHaobanLicenceOrderProgress tabHaobanLicenceOrderProgress);
List<TabHaobanLicenceOrderProgress> getListByOrderId(@Param("orderId") Long orderId);
List<TabHaobanLicenceOrderProgress> getListByOrderId(@Param("orderId") Long orderId,@Param("type") Integer type);
Integer deleteByOrderId(@Param("orderId") Long orderId);
......
......@@ -16,7 +16,7 @@ public interface LicenceOrderProgressService {
Integer insert(TabHaobanLicenceOrderProgress tabHaobanLicenceOrderProgress);
List<TabHaobanLicenceOrderProgress> getListByOrderId(Long orderId);
List<TabHaobanLicenceOrderProgress> getListByOrderId(Long orderId,Integer type);
Integer deleteByOrderId(Long orderId);
......
package com.gic.haoban.manage.service.service.licence;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderQDTO;
import com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrder;
......@@ -50,6 +51,14 @@ public interface LicenceOrderService {
*/
Boolean uploadLicenceOrderVoucher(Long orderId, String voucher);
/**
* 查询企业是否存在订单未支付接口
*
* @param wxEnterpriseId 企业微信id
* @return
*/
String isPayLicenceOrder(String wxEnterpriseId);
}
......@@ -24,8 +24,8 @@ public class LicenceOrderProgressServiceImpl implements LicenceOrderProgressServ
}
@Override
public List<TabHaobanLicenceOrderProgress> getListByOrderId(Long orderId) {
List<TabHaobanLicenceOrderProgress> list = tabHaobanLicenceOrderProgressMapper.getListByOrderId(orderId);
public List<TabHaobanLicenceOrderProgress> getListByOrderId(Long orderId,Integer type) {
List<TabHaobanLicenceOrderProgress> list = tabHaobanLicenceOrderProgressMapper.getListByOrderId(orderId,type);
return list;
}
......
package com.gic.haoban.manage.service.service.licence.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.UniqueIdUtils;
......@@ -53,6 +54,9 @@ public class LicenceOrderServiceImpl implements LicenceOrderService {
if(order.getPayType()==1){
expireTime = DateUtil.addNumForMinute(now, 30);
}else {
//生成订单编号
String num = "ZH"+UniqueIdUtils.uniqueLong();
order.setTransactionId(num);
expireTime = DateUtil.addDay(now, 3);
}
order.setExpireTime(expireTime);
......@@ -83,4 +87,13 @@ public class LicenceOrderServiceImpl implements LicenceOrderService {
public Boolean uploadLicenceOrderVoucher(Long orderId, String voucher) {
return null;
}
@Override
public String isPayLicenceOrder(String wxEnterpriseId) {
String orderId = tabHaobanLicenceOrderMapper.selectByWxEnterpriseId(wxEnterpriseId);
if (StrUtil.isNotBlank(orderId)){
return orderId;
}
return null;
}
}
package com.gic.haoban.manage.service.service.out.impl.licence;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
......@@ -48,12 +49,12 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
private WxEnterpriseApiService wxEnterpriseApiService;
@Override
public ServiceResponse<LicenceOrderDTO> getLicenceOrderDetail(Long orderId) {
public ServiceResponse<LicenceOrderDTO> getLicenceOrderDetail(Long orderId,Integer type) {
TabHaobanLicenceOrder licenceOrderDetail = licenceOrderService.getLicenceOrderDetail(orderId);
if (licenceOrderDetail != null){
//查询订单进度表
LicenceOrderDTO licenceOrderDTO = JSONObject.parseObject(JSONObject.toJSONString(licenceOrderDetail), LicenceOrderDTO.class);
List<TabHaobanLicenceOrderProgress> list = licenceOrderProgressService.getListByOrderId(orderId);
List<TabHaobanLicenceOrderProgress> list = licenceOrderProgressService.getListByOrderId(orderId,type);
licenceOrderDTO.setOrderProgressList(EntityUtil.changeEntityListByJSON(LicenceOrderProgressDTO.class, list));
//查询gic品牌名称
EnterpriseDTO enterpriseDTO = enterpriseService.getEnterpriseById(licenceOrderDTO.getEnterpriseId());
......@@ -91,13 +92,14 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
@Override
public ServiceResponse<Boolean> updateLicenceOrderType(Long orderId, Integer type) {
return null;
licenceOrderService.updateLicenceOrderType(orderId,type);
return ServiceResponse.success(true);
}
@Override
public ServiceResponse<Boolean> uploadLicenceOrderVoucher(Long orderId, String voucher) {
return null;
licenceOrderService.uploadLicenceOrderVoucher(orderId,voucher);
return ServiceResponse.success(true);
}
@Override
......@@ -105,4 +107,13 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
return null;
}
@Override
public ServiceResponse<Boolean> isPayLicenceOrder(String wxEnterpriseId) {
String order = licenceOrderService.isPayLicenceOrder(wxEnterpriseId);
if (StrUtil.isNotBlank(order)){
return ServiceResponse.success(true);
}
return ServiceResponse.success(false);
}
}
......@@ -177,12 +177,22 @@
<update id="updateLicenceOrderType">
UPDATE tab_haoban_licence_order_progress
SET order_type = #{type}
WHERE order_id = #{orderId} and delete_flag = 0
WHERE order_id = #{orderId}
and delete_flag = 0
</update>
<update id="uploadLicenceOrderVoucher">
UPDATE tab_haoban_licence_order_progress
SET voucher = #{voucher}
WHERE order_id = #{orderId} and delete_flag = 0
WHERE order_id = #{orderId}
and delete_flag = 0
</update>
<select id="selectByWxEnterpriseId" resultType="java.lang.String">
SELECT order_id
FROM tab_haoban_licence_order
WHERE wx_enterprise_id = #{wxEnterpriseId}
and delete_flag = 0
and order_status = 0 limit 1
</select>
</mapper>
\ No newline at end of file
......@@ -16,7 +16,8 @@
<result column="creator_name" property="creatorName"/>
</resultMap>
<sql id="Base_Column_List">
enterprise_id,
enterprise_id
,
wx_enterprise_id,
order_id,
order_status,
......@@ -29,9 +30,9 @@
creator_name
</sql>
<!-- ===================== 新增 ======================== -->
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrderProgress" useGeneratedKeys="true" keyProperty="id">
INSERT INTO tab_haoban_licence_order_progress(
id,
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrderProgress"
useGeneratedKeys="true" keyProperty="id">
INSERT INTO tab_haoban_licence_order_progress(id,
enterprise_id,
wx_enterprise_id,
order_id,
......@@ -42,9 +43,8 @@
delete_flag,
create_time,
update_time,
creator_name
)VALUES(
#{id,jdbcType=BIGINT},
creator_name)
VALUES (#{id,jdbcType=BIGINT},
#{enterpriseId,jdbcType=VARCHAR},
#{wxEnterpriseId,jdbcType=VARCHAR},
#{orderId,jdbcType=BIGINT},
......@@ -55,20 +55,22 @@
0,
now(),
now(),
#{creatorName,jdbcType=VARCHAR}
)
#{creatorName,jdbcType=VARCHAR})
</insert>
<!-- =====================删除==================== -->
<update id="deleteByPrimaryKey" parameterType="long">
UPDATE tab_haoban_licence_order_progress SET delete_flag = 1 WHERE id = #{id}
UPDATE tab_haoban_licence_order_progress
SET delete_flag = 1
WHERE id = #{id}
</update>
<!-- ==================更新 ========== -->
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrderProgress">
UPDATE tab_haoban_licence_order_progress SET
id=#{id,jdbcType=BIGINT},
<update id="updateByPrimaryKey"
parameterType="com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrderProgress">
UPDATE tab_haoban_licence_order_progress
SET id=#{id,jdbcType=BIGINT},
enterprise_id=#{enterpriseId,jdbcType=VARCHAR},
wx_enterprise_id=#{wxEnterpriseId,jdbcType=VARCHAR},
order_id=#{orderId,jdbcType=BIGINT},
......@@ -85,16 +87,26 @@
<!-- ============ 查询=============-->
<select id="selectById" parameterType="long" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" /> FROM tab_haoban_licence_order_progress WHERE id = #{id} and delete_flag=0
SELECT
<include refid="Base_Column_List"/>
FROM tab_haoban_licence_order_progress WHERE id = #{id} and delete_flag=0
</select>
<select id="getListByOrderId" parameterType="long" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" /> FROM tab_haoban_licence_order_progress WHERE order_id = #{orderId} and delete_flag=0 order by create_time asc
SELECT
<include refid="Base_Column_List"/>
FROM tab_haoban_licence_order_progress WHERE order_id = #{orderId}
<if test="type != null">
and type=#{type}
</if>
and delete_flag=0 order by create_time asc
</select>
<update id="deleteByOrderId" parameterType="long">
UPDATE tab_haoban_licence_order_progress SET delete_flag = 1 WHERE order_id = #{orderId}
UPDATE tab_haoban_licence_order_progress
SET delete_flag = 1
WHERE order_id = #{orderId}
</update>
</mapper>
\ No newline at end of file
......@@ -63,7 +63,7 @@ public class LicenceOrderController {
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())){
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()),HaoBanErrCode.ERR_4.getMsg());
}
ServiceResponse<LicenceOrderDTO> licenceOrderDetail = licenceOrderApiService.getLicenceOrderDetail(orderId);
ServiceResponse<LicenceOrderDTO> licenceOrderDetail = licenceOrderApiService.getLicenceOrderDetail(orderId,1);
LicenceOrderVO licenceOrderVO = JSONObject.parseObject(JSONObject.toJSONString(licenceOrderDetail.getResult()), LicenceOrderVO.class);
return RestResponse.successResult(licenceOrderVO);
}
......@@ -176,6 +176,18 @@ public class LicenceOrderController {
}
return RestResponse.successResult(result);
}
/**
* 查询企业是否存在未支付订单
*/
@RequestMapping("licence-order-isPay")
public RestResponse<Boolean> isPayLicenceOrder() {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())){
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()),HaoBanErrCode.ERR_4.getMsg());
}
Boolean result = licenceOrderApiService.isPayLicenceOrder(loginUser.getWxEnterpriseId()).getResult();
return RestResponse.successResult(result);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment