Commit 98dd9597 by jinxin

企业微信接口开发

parent 2d5cae22
...@@ -23,7 +23,7 @@ public interface LicenceOrderApiService { ...@@ -23,7 +23,7 @@ public interface LicenceOrderApiService {
* @param orderId 订单id * @param orderId 订单id
* @return LicenceOrderDTO * @return LicenceOrderDTO
*/ */
ServiceResponse<LicenceOrderDTO> getLicenceOrderDetail(Long orderId); ServiceResponse<LicenceOrderDTO> getLicenceOrderDetail(Long orderId,Integer type);
/** /**
* 删除订单 * 删除订单
...@@ -75,5 +75,13 @@ public interface LicenceOrderApiService { ...@@ -75,5 +75,13 @@ public interface LicenceOrderApiService {
*/ */
ServiceResponse<Boolean> payLicenceOrder(Long orderId); ServiceResponse<Boolean> payLicenceOrder(Long orderId);
/**
* 查询企业是否存在订单未支付接口
*
* @param wxEnterpriseId 企业微信id
* @return
*/
ServiceResponse<Boolean> isPayLicenceOrder(String wxEnterpriseId);
} }
...@@ -50,4 +50,11 @@ public interface TabHaobanLicenceOrderMapper { ...@@ -50,4 +50,11 @@ public interface TabHaobanLicenceOrderMapper {
*/ */
Integer uploadLicenceOrderVoucher(@Param("orderId")Long orderId, @Param("voucher")String voucher); 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 { ...@@ -22,7 +22,7 @@ public interface TabHaobanLicenceOrderProgressMapper {
*/ */
Integer insert(TabHaobanLicenceOrderProgress tabHaobanLicenceOrderProgress); 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); Integer deleteByOrderId(@Param("orderId") Long orderId);
......
...@@ -16,7 +16,7 @@ public interface LicenceOrderProgressService { ...@@ -16,7 +16,7 @@ public interface LicenceOrderProgressService {
Integer insert(TabHaobanLicenceOrderProgress tabHaobanLicenceOrderProgress); Integer insert(TabHaobanLicenceOrderProgress tabHaobanLicenceOrderProgress);
List<TabHaobanLicenceOrderProgress> getListByOrderId(Long orderId); List<TabHaobanLicenceOrderProgress> getListByOrderId(Long orderId,Integer type);
Integer deleteByOrderId(Long orderId); Integer deleteByOrderId(Long orderId);
......
package com.gic.haoban.manage.service.service.licence; 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.api.dto.qdto.licence.LicenceOrderQDTO;
import com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrder; import com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrder;
...@@ -50,6 +51,14 @@ public interface LicenceOrderService { ...@@ -50,6 +51,14 @@ public interface LicenceOrderService {
*/ */
Boolean uploadLicenceOrderVoucher(Long orderId, String voucher); Boolean uploadLicenceOrderVoucher(Long orderId, String voucher);
/**
* 查询企业是否存在订单未支付接口
*
* @param wxEnterpriseId 企业微信id
* @return
*/
String isPayLicenceOrder(String wxEnterpriseId);
} }
...@@ -24,8 +24,8 @@ public class LicenceOrderProgressServiceImpl implements LicenceOrderProgressServ ...@@ -24,8 +24,8 @@ public class LicenceOrderProgressServiceImpl implements LicenceOrderProgressServ
} }
@Override @Override
public List<TabHaobanLicenceOrderProgress> getListByOrderId(Long orderId) { public List<TabHaobanLicenceOrderProgress> getListByOrderId(Long orderId,Integer type) {
List<TabHaobanLicenceOrderProgress> list = tabHaobanLicenceOrderProgressMapper.getListByOrderId(orderId); List<TabHaobanLicenceOrderProgress> list = tabHaobanLicenceOrderProgressMapper.getListByOrderId(orderId,type);
return list; return list;
} }
......
package com.gic.haoban.manage.service.service.licence.impl; package com.gic.haoban.manage.service.service.licence.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.commons.util.DateUtil; import com.gic.commons.util.DateUtil;
import com.gic.commons.util.UniqueIdUtils; import com.gic.commons.util.UniqueIdUtils;
...@@ -53,6 +54,9 @@ public class LicenceOrderServiceImpl implements LicenceOrderService { ...@@ -53,6 +54,9 @@ public class LicenceOrderServiceImpl implements LicenceOrderService {
if(order.getPayType()==1){ if(order.getPayType()==1){
expireTime = DateUtil.addNumForMinute(now, 30); expireTime = DateUtil.addNumForMinute(now, 30);
}else { }else {
//生成订单编号
String num = "ZH"+UniqueIdUtils.uniqueLong();
order.setTransactionId(num);
expireTime = DateUtil.addDay(now, 3); expireTime = DateUtil.addDay(now, 3);
} }
order.setExpireTime(expireTime); order.setExpireTime(expireTime);
...@@ -83,4 +87,13 @@ public class LicenceOrderServiceImpl implements LicenceOrderService { ...@@ -83,4 +87,13 @@ public class LicenceOrderServiceImpl implements LicenceOrderService {
public Boolean uploadLicenceOrderVoucher(Long orderId, String voucher) { public Boolean uploadLicenceOrderVoucher(Long orderId, String voucher) {
return null; 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; package com.gic.haoban.manage.service.service.out.impl.licence;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
...@@ -48,12 +49,12 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService { ...@@ -48,12 +49,12 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
private WxEnterpriseApiService wxEnterpriseApiService; private WxEnterpriseApiService wxEnterpriseApiService;
@Override @Override
public ServiceResponse<LicenceOrderDTO> getLicenceOrderDetail(Long orderId) { public ServiceResponse<LicenceOrderDTO> getLicenceOrderDetail(Long orderId,Integer type) {
TabHaobanLicenceOrder licenceOrderDetail = licenceOrderService.getLicenceOrderDetail(orderId); TabHaobanLicenceOrder licenceOrderDetail = licenceOrderService.getLicenceOrderDetail(orderId);
if (licenceOrderDetail != null){ if (licenceOrderDetail != null){
//查询订单进度表 //查询订单进度表
LicenceOrderDTO licenceOrderDTO = JSONObject.parseObject(JSONObject.toJSONString(licenceOrderDetail), LicenceOrderDTO.class); 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)); licenceOrderDTO.setOrderProgressList(EntityUtil.changeEntityListByJSON(LicenceOrderProgressDTO.class, list));
//查询gic品牌名称 //查询gic品牌名称
EnterpriseDTO enterpriseDTO = enterpriseService.getEnterpriseById(licenceOrderDTO.getEnterpriseId()); EnterpriseDTO enterpriseDTO = enterpriseService.getEnterpriseById(licenceOrderDTO.getEnterpriseId());
...@@ -91,13 +92,14 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService { ...@@ -91,13 +92,14 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
@Override @Override
public ServiceResponse<Boolean> updateLicenceOrderType(Long orderId, Integer type) { public ServiceResponse<Boolean> updateLicenceOrderType(Long orderId, Integer type) {
return null; licenceOrderService.updateLicenceOrderType(orderId,type);
return ServiceResponse.success(true);
} }
@Override @Override
public ServiceResponse<Boolean> uploadLicenceOrderVoucher(Long orderId, String voucher) { public ServiceResponse<Boolean> uploadLicenceOrderVoucher(Long orderId, String voucher) {
licenceOrderService.uploadLicenceOrderVoucher(orderId,voucher);
return null; return ServiceResponse.success(true);
} }
@Override @Override
...@@ -105,4 +107,13 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService { ...@@ -105,4 +107,13 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
return null; 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 @@ ...@@ -177,12 +177,22 @@
<update id="updateLicenceOrderType"> <update id="updateLicenceOrderType">
UPDATE tab_haoban_licence_order_progress UPDATE tab_haoban_licence_order_progress
SET order_type = #{type} SET order_type = #{type}
WHERE order_id = #{orderId} and delete_flag = 0 WHERE order_id = #{orderId}
and delete_flag = 0
</update> </update>
<update id="uploadLicenceOrderVoucher"> <update id="uploadLicenceOrderVoucher">
UPDATE tab_haoban_licence_order_progress UPDATE tab_haoban_licence_order_progress
SET voucher = #{voucher} SET voucher = #{voucher}
WHERE order_id = #{orderId} and delete_flag = 0 WHERE order_id = #{orderId}
and delete_flag = 0
</update> </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> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.licence.TabHaobanLicenceOrderProgressMapper"> <mapper namespace="com.gic.haoban.manage.service.dao.mapper.licence.TabHaobanLicenceOrderProgressMapper">
<resultMap type="com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrderProgress" id="BaseResultMap"> <resultMap type="com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrderProgress" id="BaseResultMap">
<result column="id" property="id"/> <result column="id" property="id"/>
<result column="enterprise_id" property="enterpriseId"/> <result column="enterprise_id" property="enterpriseId"/>
<result column="wx_enterprise_id" property="wxEnterpriseId"/> <result column="wx_enterprise_id" property="wxEnterpriseId"/>
<result column="order_id" property="orderId"/> <result column="order_id" property="orderId"/>
<result column="order_status" property="orderStatus"/> <result column="order_status" property="orderStatus"/>
<result column="type" property="type"/> <result column="type" property="type"/>
<result column="voucher" property="voucher"/> <result column="voucher" property="voucher"/>
<result column="reason" property="reason"/> <result column="reason" property="reason"/>
<result column="delete_flag" property="deleteFlag"/> <result column="delete_flag" property="deleteFlag"/>
<result column="create_time" property="createTime"/> <result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/> <result column="update_time" property="updateTime"/>
<result column="creator_name" property="creatorName"/> <result column="creator_name" property="creatorName"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
enterprise_id, enterprise_id
,
wx_enterprise_id, wx_enterprise_id,
order_id, order_id,
order_status, order_status,
...@@ -27,74 +28,85 @@ ...@@ -27,74 +28,85 @@
create_time, create_time,
update_time, update_time,
creator_name creator_name
</sql> </sql>
<!-- ===================== 新增 ======================== --> <!-- ===================== 新增 ======================== -->
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrderProgress" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrderProgress"
INSERT INTO tab_haoban_licence_order_progress( useGeneratedKeys="true" keyProperty="id">
id, INSERT INTO tab_haoban_licence_order_progress(id,
enterprise_id, enterprise_id,
wx_enterprise_id, wx_enterprise_id,
order_id, order_id,
order_status, order_status,
type, type,
voucher, voucher,
reason, reason,
delete_flag, delete_flag,
create_time, create_time,
update_time, update_time,
creator_name creator_name)
)VALUES( VALUES (#{id,jdbcType=BIGINT},
#{id,jdbcType=BIGINT}, #{enterpriseId,jdbcType=VARCHAR},
#{enterpriseId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR},
#{wxEnterpriseId,jdbcType=VARCHAR}, #{orderId,jdbcType=BIGINT},
#{orderId,jdbcType=BIGINT}, #{orderStatus,jdbcType=VARCHAR},
#{orderStatus,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER},
#{type,jdbcType=INTEGER}, #{voucher,jdbcType=VARCHAR},
#{voucher,jdbcType=VARCHAR}, #{reason,jdbcType=VARCHAR},
#{reason,jdbcType=VARCHAR}, 0,
0, now(),
now(), now(),
now(), #{creatorName,jdbcType=VARCHAR})
#{creatorName,jdbcType=VARCHAR} </insert>
)
</insert> <!-- =====================删除==================== -->
<update id="deleteByPrimaryKey" parameterType="long">
<!-- =====================删除==================== --> UPDATE tab_haoban_licence_order_progress
<update id="deleteByPrimaryKey" parameterType="long"> SET delete_flag = 1
UPDATE tab_haoban_licence_order_progress SET delete_flag = 1 WHERE id = #{id} WHERE id = #{id}
</update> </update>
<!-- ==================更新 ========== --> <!-- ==================更新 ========== -->
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrderProgress"> <update id="updateByPrimaryKey"
UPDATE tab_haoban_licence_order_progress SET parameterType="com.gic.haoban.manage.service.entity.licence.TabHaobanLicenceOrderProgress">
id=#{id,jdbcType=BIGINT}, UPDATE tab_haoban_licence_order_progress
enterprise_id=#{enterpriseId,jdbcType=VARCHAR}, SET id=#{id,jdbcType=BIGINT},
wx_enterprise_id=#{wxEnterpriseId,jdbcType=VARCHAR}, enterprise_id=#{enterpriseId,jdbcType=VARCHAR},
order_id=#{orderId,jdbcType=BIGINT}, wx_enterprise_id=#{wxEnterpriseId,jdbcType=VARCHAR},
order_status=#{orderStatus,jdbcType=VARCHAR}, order_id=#{orderId,jdbcType=BIGINT},
type=#{type,jdbcType=INTEGER}, order_status=#{orderStatus,jdbcType=VARCHAR},
voucher=#{voucher,jdbcType=VARCHAR}, type=#{type,jdbcType=INTEGER},
reason=#{reason,jdbcType=VARCHAR}, voucher=#{voucher,jdbcType=VARCHAR},
delete_flag=#{deleteFlag,jdbcType=INTEGER}, reason=#{reason,jdbcType=VARCHAR},
create_time=#{createTime,jdbcType=TIMESTAMP}, delete_flag=#{deleteFlag,jdbcType=INTEGER},
update_time=#{updateTime,jdbcType=TIMESTAMP}, create_time=#{createTime,jdbcType=TIMESTAMP},
creator_name=#{creatorName,jdbcType=VARCHAR} update_time=#{updateTime,jdbcType=TIMESTAMP},
where id = #{id} creator_name=#{creatorName,jdbcType=VARCHAR}
</update> where id = #{id}
</update>
<!-- ============ 查询=============-->
<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 id="selectById" parameterType="long" resultMap="BaseResultMap">
</select> 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 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> </select>
<update id="deleteByOrderId" parameterType="long"> <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> </update>
</mapper> </mapper>
\ No newline at end of file
...@@ -63,7 +63,7 @@ public class LicenceOrderController { ...@@ -63,7 +63,7 @@ public class LicenceOrderController {
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())){ if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())){
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()),HaoBanErrCode.ERR_4.getMsg()); 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); LicenceOrderVO licenceOrderVO = JSONObject.parseObject(JSONObject.toJSONString(licenceOrderDetail.getResult()), LicenceOrderVO.class);
return RestResponse.successResult(licenceOrderVO); return RestResponse.successResult(licenceOrderVO);
} }
...@@ -176,6 +176,18 @@ public class LicenceOrderController { ...@@ -176,6 +176,18 @@ public class LicenceOrderController {
} }
return RestResponse.successResult(result); 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