Commit 0e08d283 by jinxin

运维后台登录人信息处理

parent b8ee2c53
......@@ -78,7 +78,7 @@ public interface LicenceOrderApiService {
* @param orderId 订单id
* @return
*/
ServiceResponse<String> payLicenceOrder(Long orderId, String wxEnterpriseId);
ServiceResponse<String> payLicenceOrder(Long orderId);
/**
* 查询企业是否存在订单未支付接口
......@@ -127,7 +127,7 @@ public interface LicenceOrderApiService {
* @param reason 不通过原因
* @return
*/
ServiceResponse<Boolean> checkLicenceOrder(Long orderId, Integer flag, String reason, String enterpriseId, String wxEnterpriseId, String creatorName);
ServiceResponse<Boolean> checkLicenceOrder(Long orderId, Integer flag, String reason, String creatorName);
/**
* 微信退款
......@@ -142,7 +142,7 @@ public interface LicenceOrderApiService {
/**
* 取消企业微信订单
*/
ServiceResponse<Boolean> cancelQywxOrder(Long orderId,String wxEnterpriseId);
ServiceResponse<Boolean> cancelQywxOrder(Long orderId);
}
......@@ -4,16 +4,15 @@ package com.gic.haoban.manage.web.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.authcenter.commons.dto.AuthcenterUserDetails;
import com.gic.authcenter.commons.util.SessionContextUtil;
import com.gic.commons.util.PageHelperUtils;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO;
import com.gic.haoban.common.utils.AuthWebRequestUtil;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.licence.LicenceOrderDTO;
import com.gic.haoban.manage.api.dto.licence.LicenceOrderPageDTO;
......@@ -24,7 +23,6 @@ import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.licence.LicenceOrderPageQO;
import com.gic.haoban.manage.web.vo.licence.LicenceOrderPageVO;
import com.gic.haoban.manage.web.vo.licence.LicenceOrderVO;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -33,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
......@@ -60,10 +59,6 @@ public class LicenceOrderController {
*/
@RequestMapping("licence-order-detail")
public RestResponse<LicenceOrderVO> getLicenceOrderDetail(@RequestParam Long orderId) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
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, null);
LicenceOrderVO licenceOrderVO = JSONObject.parseObject(JSONObject.toJSONString(licenceOrderDetail.getResult()), LicenceOrderVO.class);
return RestResponse.successResult(licenceOrderVO);
......@@ -74,15 +69,7 @@ public class LicenceOrderController {
*/
@RequestMapping("licence-order-page")
public RestResponse<Page<LicenceOrderPageVO>> getLicenceOrderPage(@RequestBody LicenceOrderPageQO licenceOrderPageQO) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
String wxEnterpriseId = loginUser.getWxEnterpriseId();
String clerkName = loginUser.getClerkName();
LicenceOrderPageQDTO qdto = JSONObject.parseObject(JSONObject.toJSONString(licenceOrderPageQO), LicenceOrderPageQDTO.class);
qdto.setWxEnterpriseId(wxEnterpriseId);
qdto.setCreatorName(clerkName);
ServiceResponse<Page<LicenceOrderPageDTO>> licenceOrderPage = licenceOrderApiService.getLicenceOrderPage(qdto);
Page<LicenceOrderPageVO> result = PageHelperUtils.changePageToCurrentPage(licenceOrderPage.getResult(), LicenceOrderPageVO.class);
if (CollUtil.isNotEmpty(result.getResult())) {
......@@ -106,12 +93,7 @@ public class LicenceOrderController {
*/
@RequestMapping("licence-order-cancel")
public RestResponse<Boolean> cancelLicenceOrder(@RequestParam Long orderId) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
String wxEnterpriseId = loginUser.getWxEnterpriseId();
ServiceResponse<Boolean> response = licenceOrderApiService.cancelQywxOrder(orderId, wxEnterpriseId);
ServiceResponse<Boolean> response = licenceOrderApiService.cancelQywxOrder(orderId);
if (!response.isSuccess()) {
return RestResponse.failure(response.getCode(), response.getMessage());
}
......@@ -123,11 +105,7 @@ public class LicenceOrderController {
*/
@RequestMapping("licence-order-pay")
public RestResponse<String> payLicenceOrder(@RequestParam Long orderId) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
ServiceResponse<String> response = licenceOrderApiService.payLicenceOrder(orderId, loginUser.getWxEnterpriseId());
ServiceResponse<String> response = licenceOrderApiService.payLicenceOrder(orderId);
if (response.isSuccess()) {
return RestResponse.successResult(response.getResult());
}
......@@ -143,17 +121,16 @@ public class LicenceOrderController {
* @return
*/
@RequestMapping("licence-order-check")
public RestResponse<Boolean> checkLicenceOrder(@RequestParam Long orderId, Integer flag, String reason) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())) {
public RestResponse<Boolean> checkLicenceOrder(@RequestParam Long orderId, Integer flag, String reason, HttpServletRequest request) {
AuthcenterUserDetails loginUser = (AuthcenterUserDetails) SessionContextUtil.getUser(request);
if (loginUser == null) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
String enterpriseId = loginUser.getEnterpriseId();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
String clerkName = loginUser.getClerkName();
Boolean result = licenceOrderApiService.checkLicenceOrder(orderId, flag, reason, enterpriseId, wxEnterpriseId, clerkName).getResult();
String clerkName = loginUser.getLoginName();
Boolean result = licenceOrderApiService.checkLicenceOrder(orderId, flag, reason, clerkName).getResult();
return RestResponse.successResult(result);
}
/**
* 订单退款
*
......@@ -161,41 +138,22 @@ public class LicenceOrderController {
* @return
*/
@RequestMapping("licence-order-refund")
public RestResponse<Boolean> refundLicenceOrder(@RequestParam Long orderId) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())) {
public RestResponse<Boolean> refundLicenceOrder(@RequestParam Long orderId, HttpServletRequest request) {
AuthcenterUserDetails loginUser = (AuthcenterUserDetails) SessionContextUtil.getUser(request);
if (loginUser == null) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
String enterpriseId = loginUser.getEnterpriseId();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
String clerkName = loginUser.getClerkName();
Boolean result = licenceOrderApiService.updateLicenceOrderType(orderId, 4, enterpriseId, wxEnterpriseId, clerkName, 0).getResult();
return RestResponse.successResult(result);
}
/**
* 查询企业品牌名称
*/
@RequestMapping("get-enterprise-name")
public RestResponse<HashMap<String, String>> getEnterpriseName() {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
String clerkName = loginUser.getLoginName();
ServiceResponse<LicenceOrderDTO> response = licenceOrderApiService.getLicenceOrderDetail(orderId, null);
if (response.isSuccess() && null != response.getResult()) {
LicenceOrderDTO orderDTO = response.getResult();
String enterpriseId = orderDTO.getEnterpriseId();
String wxEnterpriseId = orderDTO.getWxEnterpriseId();
Boolean result = licenceOrderApiService.updateLicenceOrderType(orderId, 4, enterpriseId, wxEnterpriseId, clerkName, 0).getResult();
return RestResponse.successResult(result);
}
HashMap<String, String> result = new HashMap<>(8);
//查询gic品牌名称
EnterpriseDTO enterpriseDTO = enterpriseService.getEnterpriseById(loginUser.getEnterpriseId());
if (ObjectUtil.isNotNull(enterpriseDTO)) {
logger.info("gic企业查询返回实体:{}", JSON.toJSONString(enterpriseDTO));
result.put("enterpriseName", enterpriseDTO.getEnterpriseName());
}
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseApiService.getOne(loginUser.getWxEnterpriseId());
if (ObjectUtil.isNotNull(wxEnterpriseDTO)) {
logger.info("企业微信查询返回实体:{}", JSON.toJSONString(wxEnterpriseDTO));
result.put("wxEnterpriseName", wxEnterpriseDTO.getCorpName());
}
return RestResponse.successResult(result);
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_5.getCode()), HaoBanErrCode.ERR_5.getMsg());
}
/**
......@@ -207,22 +165,15 @@ public class LicenceOrderController {
*/
@RequestMapping("get-order-id-list")
public RestResponse<List<String>> getOrderIdList(String param, Integer type) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
ServiceResponse<List<String>> orderIdList = licenceOrderApiService.getOrderIdList(param, type, loginUser.getWxEnterpriseId());
ServiceResponse<List<String>> orderIdList = licenceOrderApiService.getOrderIdList(param, type, null);
return RestResponse.successResult(orderIdList.getResult());
}
/**
* 查询开户信息
*/
@RequestMapping("get-account-info")
public RestResponse<HashMap<String, String>> getAccountInfo() {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
if (loginUser == null || StringUtils.isBlank(loginUser.getEnterpriseId())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_4.getCode()), HaoBanErrCode.ERR_4.getMsg());
}
HashMap<String, String> result = licenceOrderApiService.getAccountInfo().getResult();
return RestResponse.successResult(result);
}
......
......@@ -130,7 +130,7 @@ public interface LicenceOrderService {
* @param reason 不通过原因
* @return
*/
Boolean checkLicenceOrder(Long orderId,Integer flag,String reason,String enterpriseId,String wxEnterpriseId,String creatorName);
Boolean checkLicenceOrder(Long orderId,Integer flag,String reason,String creatorName);
/**
* 记录回调时间
......
......@@ -2,6 +2,7 @@ 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.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
......@@ -28,6 +29,8 @@ import com.gic.marketing.api.dto.SmsSendResponseDTO;
import com.gic.marketing.api.service.AccountOverdueSmsSendService;
import com.github.pagehelper.PageHelper;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -42,7 +45,7 @@ import java.util.*;
*/
@Service
public class LicenceOrderServiceImpl implements LicenceOrderService {
private static Logger logger = LogManager.getLogger(LicenceOrderServiceImpl.class);
@Autowired
private TabHaobanLicenceOrderMapper tabHaobanLicenceOrderMapper;
@Autowired
......@@ -263,11 +266,18 @@ public class LicenceOrderServiceImpl implements LicenceOrderService {
}
@Override
public Boolean checkLicenceOrder(Long orderId, Integer flag, String reason, String enterpriseId, String wxEnterpriseId, String creatorName) {
public Boolean checkLicenceOrder(Long orderId, Integer flag, String reason,String creatorName) {
TabHaobanLicenceOrder order = tabHaobanLicenceOrderMapper.selectById(orderId);
if (null ==order){
return false;
}
String enterpriseId = order.getEnterpriseId();
String wxEnterpriseId = order.getWxEnterpriseId();
String wxEnterpriseName = "";
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseApiService.getOne(wxEnterpriseId);
if (ObjectUtil.isNotNull(wxEnterpriseDTO)){
wxEnterpriseName=wxEnterpriseDTO.getCorpName();
}
if (flag == 0){
//更新微信订单状态
tabHaobanLicenceOrderMapper.saveOrderCheckReason(orderId,reason,0);
......@@ -277,10 +287,11 @@ public class LicenceOrderServiceImpl implements LicenceOrderService {
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(order.getCreatorId());
if (clerkDTO!=null){
Map<String, String> params = new HashMap<>();
params.put("1", "企微企业名称");
params.put("2", "订单号");
params.put("1", wxEnterpriseName);
params.put("2", order.getOrderNumber());
SmsSendResponseDTO resp = accountOverdueSmsSendService.smsSend("-1", clerkDTO.getPhoneNumber(),
"86", 106, params);
logger.info("许可账号支付凭证审核不通过短信通知返回信息:{}", JSON.toJSONString(resp));
}
}else {
//更新微信订单状态
......
......@@ -134,12 +134,12 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
}
@Override
public ServiceResponse<String> payLicenceOrder(Long orderId, String wxEnterpriseId) {
public ServiceResponse<String> payLicenceOrder(Long orderId) {
TabHaobanLicenceOrder order = licenceOrderService.getLicenceOrderDetail(orderId);
if (order == null) {
return ServiceResponse.failure("-9999", "参数有误!!");
}
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(wxEnterpriseId);
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(order.getWxEnterpriseId());
if (wxEnterpriseDTO == null) {
return ServiceResponse.failure("-9999", "微信企业不存在!!");
}
......@@ -304,8 +304,8 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
}
@Override
public ServiceResponse<Boolean> checkLicenceOrder(Long orderId, Integer flag, String reason, String enterpriseId, String wxEnterpriseId, String creatorName) {
licenceOrderService.checkLicenceOrder(orderId, flag, reason, enterpriseId, wxEnterpriseId, creatorName);
public ServiceResponse<Boolean> checkLicenceOrder(Long orderId, Integer flag, String reason, String creatorName) {
licenceOrderService.checkLicenceOrder(orderId, flag, reason,creatorName);
return ServiceResponse.success(true);
}
......@@ -346,13 +346,13 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
}
@Override
public ServiceResponse<Boolean> cancelQywxOrder(Long orderId,String wxEnterpriseId) {
public ServiceResponse<Boolean> cancelQywxOrder(Long orderId) {
TabHaobanLicenceOrder order = licenceOrderService.getLicenceOrderDetail(orderId);
if (null == order) {
return ServiceResponse.failure("-9999", "订单id有误!");
}
//企业微信订单取消
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(wxEnterpriseId);
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(order.getWxEnterpriseId());
if (wxEnterpriseDTO == null) {
return ServiceResponse.failure("-9999", "微信企业不存在!!");
}
......@@ -362,7 +362,7 @@ public class LicenceOrderApiServiceImpl implements LicenceOrderApiService {
logger.info("企业微信订单取消返回信息:{}",JSON.toJSONString(response));
if (response.isSuccess()){
//更新企业微信订单状态
updateLicenceOrderType(orderId, 2, order.getEnterpriseId(), wxEnterpriseId, order.getCreatorName(), 1);
updateLicenceOrderType(orderId, 2, order.getEnterpriseId(), order.getWxEnterpriseId(), order.getCreatorName(), 1);
//微信退款
wxRefund(orderId);
return ServiceResponse.success(true);
......
......@@ -285,19 +285,28 @@
<select id="getTransactionIdList" resultMap="BaseResultMap">
SELECT
order_number
FROM tab_haoban_licence_order WHERE order_number like concat (#{orderNumber},'%') and delete_flag=0 and wx_enterprise_id = #{wxEnterpriseId}
FROM tab_haoban_licence_order WHERE order_number like concat (#{orderNumber},'%') and delete_flag=0
<if test="wxEnterpriseId != null and wxEnterpriseId !='' ">
and wx_enterprise_id = #{wxEnterpriseId}
</if>
</select>
<select id="getQywxOrderId" resultMap="BaseResultMap">
SELECT
qywx_order_id
FROM tab_haoban_licence_order WHERE qywx_order_id like concat (#{qywxOrderId},'%') and delete_flag=0 and wx_enterprise_id = #{wxEnterpriseId}
FROM tab_haoban_licence_order WHERE qywx_order_id like concat (#{qywxOrderId},'%') and delete_flag=0
<if test="wxEnterpriseId != null and wxEnterpriseId !='' ">
and wx_enterprise_id = #{wxEnterpriseId}
</if>
</select>
<select id="getWxOrderId" resultMap="BaseResultMap">
SELECT
wx_order_id
FROM tab_haoban_licence_order WHERE wx_order_id like concat (#{wxOrderId},'%') and delete_flag=0 and wx_enterprise_id = #{wxEnterpriseId}
FROM tab_haoban_licence_order WHERE wx_order_id like concat (#{wxOrderId},'%') and delete_flag=0
<if test="wxEnterpriseId != null and wxEnterpriseId !='' ">
and wx_enterprise_id = #{wxEnterpriseId}
</if>
</select>
<update id="saveOrderCheckReason">
......
......@@ -43,7 +43,7 @@ public class LicenceOrderServiceTest {
}
@Test
public void test4(){
ServiceResponse<String> result = licenceOrderApiService.payLicenceOrder(512360219787935783L, "ca66a01b79474c40b3e7c7f93daf1a3b");
ServiceResponse<String> result = licenceOrderApiService.payLicenceOrder(512360219787935783L);
}
@Test
public void test5(){
......
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