Commit e5473f4a by huluobin

unit test

parent 64fbbfdb
...@@ -32,7 +32,6 @@ public class JwtUtil { ...@@ -32,7 +32,6 @@ public class JwtUtil {
* 功能描述: 解密Bailun Sso Token * 功能描述: 解密Bailun Sso Token
* *
* @param token jwtToken * @param token jwtToken
* @return 当前登陆用户oaUserId
*/ */
public static void validateToken(String token) { public static void validateToken(String token) {
try { try {
...@@ -42,7 +41,6 @@ public class JwtUtil { ...@@ -42,7 +41,6 @@ public class JwtUtil {
JwtClaims claims = consumer.processToClaims(token.replaceAll(TOKEN_PREFIX, "")); JwtClaims claims = consumer.processToClaims(token.replaceAll(TOKEN_PREFIX, ""));
if (claims != null) { if (claims != null) {
System.out.println("认证通过!"); System.out.println("认证通过!");
} }
} catch (JoseException e) { } catch (JoseException e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -5,6 +5,7 @@ import com.bailuntec.cost.api.response.CostResult; ...@@ -5,6 +5,7 @@ import com.bailuntec.cost.api.response.CostResult;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.blt.other.module.auth.dto.request.CompanyReviewerListReq; import com.blt.other.module.auth.dto.request.CompanyReviewerListReq;
import com.blt.other.module.auth.dto.request.DepartmentReviewerListReq; import com.blt.other.module.auth.dto.request.DepartmentReviewerListReq;
import com.blt.other.module.auth.dto.response.DepartmentReviewerListItem;
import com.blt.other.module.auth.model.OaDepartment; import com.blt.other.module.auth.model.OaDepartment;
import com.blt.other.module.auth.service.IOaDepartmentService; import com.blt.other.module.auth.service.IOaDepartmentService;
import com.blt.other.module.cost.service.CostCompanyService; import com.blt.other.module.cost.service.CostCompanyService;
...@@ -42,8 +43,8 @@ public class CostReviewerController { ...@@ -42,8 +43,8 @@ public class CostReviewerController {
@ApiOperation("获取部门审核人配置列表") @ApiOperation("获取部门审核人配置列表")
@GetMapping("/departmentReviewerList") @GetMapping("/departmentReviewerList")
public CostResult<IPage<OaDepartment>> departmentReviewerList(DepartmentReviewerListReq req) { public CostResult<IPage<DepartmentReviewerListItem>> departmentReviewerList(DepartmentReviewerListReq req) {
IPage<OaDepartment> oaDepartmentIPage = oaDepartmentService.reviewerList(req); IPage<DepartmentReviewerListItem> oaDepartmentIPage = oaDepartmentService.reviewerList(req);
return CostResult.success(oaDepartmentIPage); return CostResult.success(oaDepartmentIPage);
} }
......
...@@ -3,6 +3,7 @@ package com.blt.other.module.auth.dao; ...@@ -3,6 +3,7 @@ package com.blt.other.module.auth.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.blt.other.module.auth.dto.request.DepartmentReviewerListReq; import com.blt.other.module.auth.dto.request.DepartmentReviewerListReq;
import com.blt.other.module.auth.dto.response.DepartmentReviewerListItem;
import com.blt.other.module.auth.model.OaDepartment; import com.blt.other.module.auth.model.OaDepartment;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -23,7 +24,8 @@ public interface OaDepartmentMapper extends BaseMapper<OaDepartment> { ...@@ -23,7 +24,8 @@ public interface OaDepartmentMapper extends BaseMapper<OaDepartment> {
* *
* @return 部门审核人列表 * @return 部门审核人列表
*/ */
IPage<OaDepartment> reviewerList(@Param("page") IPage<OaDepartment> page, @Param("req") DepartmentReviewerListReq req); IPage<DepartmentReviewerListItem> reviewerList(@Param("page") IPage<DepartmentReviewerListItem> page,
@Param("req") DepartmentReviewerListReq req);
OaDepartment selectByDepartmentId(Integer oaDepartmentId); OaDepartment selectByDepartmentId(Integer oaDepartmentId);
} }
package com.blt.other.module.auth.dto.response;
import com.baomidou.mybatisplus.annotation.TableField;
import com.blt.other.module.auth.model.CostReviewer;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/12/21 9:38 上午
*/
@Data
public class DepartmentReviewerListItem {
private Integer id;
@ApiModelProperty(value = "oa部门id")
private Integer departmentId;
@ApiModelProperty(value = "oa部门编码")
private String code;
@ApiModelProperty(value = "oa公司主体id")
private Integer companyId;
@TableField(exist = false)
private String companyName;
private String manageUser1;
private String manageUser2;
private Integer parentId;
@ApiModelProperty(value = "部门名称")
private String name;
@ApiModelProperty(value = "排序")
private Integer sort;
private BigDecimal departmentMinimumReviewAmount;
@ApiModelProperty(value = "创建人id")
private Integer createUserId;
@ApiModelProperty(value = "创建人姓名")
private String createUserName;
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
private LocalDateTime createTime;
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
private LocalDateTime lastUpdateTime;
@ApiModelProperty("更新用户id")
private Integer updateUserId;
@ApiModelProperty("更新用户姓名")
private String updateUserName;
@TableField(exist = false)
private List<CostReviewer> costReviewerList;
}
...@@ -3,6 +3,7 @@ package com.blt.other.module.auth.service; ...@@ -3,6 +3,7 @@ package com.blt.other.module.auth.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.blt.other.module.auth.dto.request.DepartmentReviewerListReq; import com.blt.other.module.auth.dto.request.DepartmentReviewerListReq;
import com.blt.other.module.auth.dto.response.DepartmentReviewerListItem;
import com.blt.other.module.auth.model.OaDepartment; import com.blt.other.module.auth.model.OaDepartment;
import org.springframework.lang.NonNull; import org.springframework.lang.NonNull;
...@@ -38,7 +39,7 @@ public interface IOaDepartmentService extends IService<OaDepartment> { ...@@ -38,7 +39,7 @@ public interface IOaDepartmentService extends IService<OaDepartment> {
* *
* @return 部门审核人列表 * @return 部门审核人列表
*/ */
IPage<OaDepartment> reviewerList(DepartmentReviewerListReq req); IPage<DepartmentReviewerListItem> reviewerList(DepartmentReviewerListReq req);
/** /**
* <p> * <p>
......
...@@ -9,6 +9,7 @@ import com.blt.other.module.auth.dao.CostReviewerMapper; ...@@ -9,6 +9,7 @@ import com.blt.other.module.auth.dao.CostReviewerMapper;
import com.blt.other.module.auth.dao.OaDepartmentMapper; import com.blt.other.module.auth.dao.OaDepartmentMapper;
import com.blt.other.module.auth.dao.OaUserMapper; import com.blt.other.module.auth.dao.OaUserMapper;
import com.blt.other.module.auth.dto.request.DepartmentReviewerListReq; import com.blt.other.module.auth.dto.request.DepartmentReviewerListReq;
import com.blt.other.module.auth.dto.response.DepartmentReviewerListItem;
import com.blt.other.module.auth.model.CostReviewer; import com.blt.other.module.auth.model.CostReviewer;
import com.blt.other.module.auth.model.OaDepartment; import com.blt.other.module.auth.model.OaDepartment;
import com.blt.other.module.auth.model.OaUser; import com.blt.other.module.auth.model.OaUser;
...@@ -46,13 +47,13 @@ public class OaDepartmentServiceImpl extends ServiceImpl<OaDepartmentMapper, OaD ...@@ -46,13 +47,13 @@ public class OaDepartmentServiceImpl extends ServiceImpl<OaDepartmentMapper, OaD
} }
@Override @Override
public IPage<OaDepartment> reviewerList(DepartmentReviewerListReq req) { public IPage<DepartmentReviewerListItem> reviewerList(DepartmentReviewerListReq req) {
IPage<OaDepartment> page = new Page<>(req.getPageNum(), req.getPageSize()); IPage<DepartmentReviewerListItem> page = new Page<>(req.getPageNum(), req.getPageSize());
page = baseMapper.reviewerList(page, req); page = baseMapper.reviewerList(page, req);
if (ListUtil.isNotEmpty(page.getRecords())) { if (ListUtil.isNotEmpty(page.getRecords())) {
List<Integer> oaDepartmentIds = page.getRecords().stream().map(OaDepartment::getDepartmentId).collect(Collectors.toList()); List<Integer> oaDepartmentIds = page.getRecords().stream().map(DepartmentReviewerListItem::getDepartmentId).collect(Collectors.toList());
List<CostReviewer> costReviewerList = costReviewerMapper.selectList(new LambdaQueryWrapper<CostReviewer>() List<CostReviewer> costReviewerList = costReviewerMapper.selectList(new LambdaQueryWrapper<CostReviewer>()
.in(CostReviewer::getReferId, oaDepartmentIds) .in(CostReviewer::getReferId, oaDepartmentIds)
.eq(CostReviewer::getType, CostReviewer.departmentReviewer)); .eq(CostReviewer::getType, CostReviewer.departmentReviewer));
......
...@@ -2,8 +2,8 @@ spring: ...@@ -2,8 +2,8 @@ spring:
# 数据源配置 # 数据源配置
datasource: datasource:
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
# url: jdbc:mysql://gz-cdb-lnrmt5zh.sql.tencentcdb.com:61369/bailun_other?useUnicode=true&characterEncoding=UTF-8&useSSL=false url: jdbc:mysql://gz-cdb-lnrmt5zh.sql.tencentcdb.com:61369/bailun_other?useUnicode=true&characterEncoding=UTF-8&useSSL=false
url: jdbc:mysql://10.0.8.2:3306/bailun_other?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true # url: jdbc:mysql://10.0.8.2:3306/bailun_other?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true
username: root username: root
password: "#7kfnymAM$Y9-Ntf" password: "#7kfnymAM$Y9-Ntf"
hikari: hikari:
......
...@@ -2,11 +2,12 @@ ...@@ -2,11 +2,12 @@
<!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.blt.other.module.auth.dao.OaDepartmentMapper"> <mapper namespace="com.blt.other.module.auth.dao.OaDepartmentMapper">
<select id="reviewerList" resultType="com.blt.other.module.auth.model.OaDepartment"> <select id="reviewerList" resultType="com.blt.other.module.auth.dto.response.DepartmentReviewerListItem">
SELECT distinct t1.*, SELECT distinct t1.*,
t2.`name` company_name t2.`name` company_name
from oa_department t1 from oa_department t1
left join oa_company t2 on t1.company_id = t2.oa_company_id left join oa_department s2 on t1.department_id = s2.parent_id
left join oa_company t2 on s2.company_id = t2.oa_company_id
left join cost_reviewer t3 on t1.department_id = t3.refer_id and (t3.type = 1) left join cost_reviewer t3 on t1.department_id = t3.refer_id and (t3.type = 1)
where t1.parent_id = 0 where t1.parent_id = 0
/*审核人*/ /*审核人*/
...@@ -30,6 +31,7 @@ ...@@ -30,6 +31,7 @@
and t1.department_id = #{req.oaPrimaryDepartmentId} and t1.department_id = #{req.oaPrimaryDepartmentId}
</if> </if>
</select> </select>
<select id="selectByDepartmentId" resultType="com.blt.other.module.auth.model.OaDepartment"> <select id="selectByDepartmentId" resultType="com.blt.other.module.auth.model.OaDepartment">
select * select *
from oa_department from oa_department
......
package com.blt.other.module.cost.service.impl.cost; package com.blt.other.module.cost.service.impl.cost;
import com.bailuntec.api.bailuntec.cw.request.ApplyMoneyDetail;
import com.bailuntec.api.bailuntec.cw.request.PostApplyReq;
import com.bailuntec.common.JsonUtilByFsJson; import com.bailuntec.common.JsonUtilByFsJson;
import com.blt.other.module.cost.service.CostService; import com.blt.other.common.config.property.CostUrlProperties;
import com.blt.other.module.cost.dao.CostCompanyDao;
import com.blt.other.module.cost.dao.CostDao;
import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.cost.vo.CashierCallbackUrlDataDataVo; import com.blt.other.module.cost.vo.CashierCallbackUrlDataDataVo;
import com.blt.other.module.cost.vo.CashierCallbackUrlDataVo; import com.blt.other.module.cost.vo.CashierCallbackUrlDataVo;
import com.blt.other.module.cost.vo.CashierCallbackUrlVo; import com.blt.other.module.cost.vo.CashierCallbackUrlVo;
import com.blt.other.module.cost.vo.Paydetail; import com.blt.other.module.cost.vo.Paydetail;
import com.blt.other.module.database.model.CostCompanyDomain;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
...@@ -13,6 +19,11 @@ import org.springframework.boot.test.context.SpringBootTest; ...@@ -13,6 +19,11 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/** /**
* <p> * <p>
* *
...@@ -24,11 +35,92 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; ...@@ -24,11 +35,92 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@Slf4j @Slf4j
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest @SpringBootTest
@ActiveProfiles("prod") @ActiveProfiles("test")
class AbstractCostServiceTest { class AbstractCostServiceTest {
@Resource
CostCompanyDao costCompanyDao;
@Resource
CostUrlProperties costUrlProperties;
@Resource
CostDao costDao;
PostApplyReq buildPostApplyReq(CostDomain cost) {
CostCompanyDomain companyByCompanyNo = costCompanyDao.selectByNo(cost.getCompanyNo());
PostApplyReq req = new PostApplyReq();
// 公司主体(CompanyMainName)不可为空;
req.setCompanyMainName(cost.getCompanyName());
req.setTitle(cost.getCostNo());
// 币种编号(UnitCode)不可为空;
req.setUnitCode(cost.getDic());
// 币种名称(UnitName)不可为空;
req.setUnitName(cost.getDic());
// 交易对象(TradeObjectID/TradeObjectName)不可为空;
req.setTradeObjectID(companyByCompanyNo.getValue() + "");
req.setTradeObjectName(cost.getBankCompany() + "");
// 交易对象账户(BankNameto/BankCardto/BankCardUserto)资料不完整;
req.setBankCardto(cost.getBankCard());
req.setBankCardUserto(cost.getBankCardUser());
req.setBankNameto(cost.getBankName());
// newOtherPurchase申请来源(SourceCode/SourceTypeCode)不可为空;
req.setSourceCode("newCost");
req.setSourceTypeCode("newCostType");
// 账期 0 PayDay
req.setPayDay(0);
// 预计付款时间 ExpectPayTime
req.setExpectPayTime(new Date());
// 申请人(UserAcctID/UserAcctName)不存在;
req.setUserAcctID("" + cost.getCreateUserid());
req.setUserAcctName("" + cost.getCreateUsername());
private CostService costService; // 设置 detailKey
String detailKey = cost.getDetailKey();
if (null == detailKey || !detailKey.contains("F")) {
detailKey = cost.getCostNo();
}
// 回调必要的key参数(DetailKey)不能为空;
req.setDetailKey(detailKey);
req.setTypeName(cost.getTypeName());
return req;
}
@Test
void toFinancial() {
CostDomain costDomain = costDao.selectByCostNo("F030246");
PostApplyReq req = this.buildPostApplyReq(costDomain);
// 审核回调地址(ApplyCallbackUrl)不可为空;
req.setApplyCallbackUrl(costUrlProperties.costApplyCallbackUrlPost);
// 出纳回调地址(CashierCallbackUrl)不可为空;
req.setCashierCallbackUrl(costUrlProperties.costCashierCallbackUrlPost);
req.setApplyType("" + 1);
List<ApplyMoneyDetail> applyMoneyDetailList = new ArrayList<>();
ApplyMoneyDetail applyMoneyDetail = new ApplyMoneyDetail();
applyMoneyDetail.setName("借支单付款");
applyMoneyDetail.setMoney(costDomain.getAmount());
//todo
applyMoneyDetail.setMoneyRmb(costDomain.getAmount());
applyMoneyDetail.setRemark("");
applyMoneyDetailList.add(applyMoneyDetail);
// 出纳申请金额明细(MoneyDetail)不可为空;
req.setMoneyDetail(applyMoneyDetailList);
log.info(JsonUtilByFsJson.beanToJson(req));
}
@Test @Test
void applyCallback() { void applyCallback() {
......
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