Просмотр исходного кода

Merge branch 'develop' of https://git.youlane.cn/server/formallProject into develop

release_toaliyun_real
Burce 6 лет назад
Родитель
Сommit
4b933744bc
3 измененных файлов: 102 добавлений и 7 удалений
  1. +95
    -0
      mallinkAdmin/src/test/java/com/iformall/service/test/Test.java
  2. +6
    -6
      mallinkService/src/main/resources/mapper/WxBillSettleMapper.xml
  3. +1
    -1
      mallinkService/src/main/resources/mapper/WxBillSettleRecordMapper.xml

+ 95
- 0
mallinkAdmin/src/test/java/com/iformall/service/test/Test.java Просмотреть файл

@@ -0,0 +1,95 @@
package com.iformall.service.test;

import com.alibaba.fastjson.JSON;
import com.iformall.domain.po.*;
import com.iformall.service.WxBillSettleService;
import com.iformall.service.WxCouponSendService;
import com.iformall.service.WxLevelConfigService;
import com.iformall.service.WxScoreRulesService;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.util.ThreadContext;
import org.apache.shiro.web.subject.WebSubject;
import org.junit.Before;
import org.junit.FixMethodOrder;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockHttpSession;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;

import javax.annotation.Resource;

@Slf4j
@AutoConfigureMockMvc
@FixMethodOrder(MethodSorters.JVM)
@ActiveProfiles("dev")
@RunWith(SpringRunner.class)
@SpringBootTest
public class Test {

private static final String TENANT_ID = "456";

@Resource
private org.apache.shiro.mgt.SecurityManager securityManager;
@Resource
private WebApplicationContext webApplicationContext;
private MockHttpServletRequest mockHttpServletRequest;
private MockHttpServletResponse mockHttpServletResponse;

@Autowired
WxLevelConfigService levelConfigService;

@Autowired
WxCouponSendService wxCouponSendService;

@Autowired
WxScoreRulesService wxScoreRulesService ;

private MockMvc mockMvc;


@Autowired
private WxBillSettleService wxBillSettleService;


@Before
public void setUp() {
mockHttpServletRequest = new MockHttpServletRequest(webApplicationContext.getServletContext());
mockHttpServletResponse = new MockHttpServletResponse();
MockHttpSession mockHttpSession = new MockHttpSession(webApplicationContext.getServletContext());
mockHttpServletRequest.setSession(mockHttpSession);
SecurityUtils.setSecurityManager(securityManager);
mockMvc = MockMvcBuilders
.webAppContextSetup(webApplicationContext)
.build();
login("yftest", "123456zz");
}

private void login(String username, String password) {
Subject subject = new WebSubject.Builder(mockHttpServletRequest, mockHttpServletResponse)
.buildWebSubject();
UsernamePasswordToken token = new UsernamePasswordToken(username, password, true);
subject.login(token);
ThreadContext.bind(subject);
}

@org.junit.Test
public void levelList() {
WxBillSettle settle = wxBillSettleService.getById(328411851323572224l);
log.debug("data:{}", JSON.toJSONString(settle));
}



}

+ 6
- 6
mallinkService/src/main/resources/mapper/WxBillSettleMapper.xml Просмотреть файл

@@ -26,16 +26,16 @@
where 1=1
<if test=" null != id ">and s.`id` = #{id}</if>
<if test=" null != tenantId ">and s.`tenant_id` = #{tenantId}</if>
<if test=" null != merchantName ">and m.name like concat('%', #{merchantName},'%')</if>
<if test="startTime != null">
<if test=" null != merchantName and merchantName !='' ">and m.name like concat('%', #{merchantName},'%')</if>
<if test="startTime != null and startTime !=''">
and createtime &gt;= #{startTime}
</if>
<if test="endTime != null">
<if test="endTime != null and endTime !=''">
and createtime &lt;= #{endTime}
</if>
<if test=" null != settleNumber ">and s.`settle_number` = #{settleNumber}</if>
<if test=" null != status ">and s.`status` = #{status}</if>
<if test=" null != applyStatus ">and s.`apply_status` = #{applyStatus}</if>
<if test=" null != settleNumber and settleNumber !='' ">and s.`settle_number` = #{settleNumber}</if>
<if test=" null != status and status !=''">and s.`status` = #{status}</if>
<if test=" null != applyStatus and applyStatus !=''">and s.`apply_status` = #{applyStatus}</if>

<if test=" null != sortColumns">order by ${sortColumns}</if>
</sql>


+ 1
- 1
mallinkService/src/main/resources/mapper/WxBillSettleRecordMapper.xml Просмотреть файл

@@ -46,7 +46,7 @@
</select>

<select id="getSumMoneyBySettleId" parameterType="com.iformall.domain.po.WxBillSettle" resultType="long">
select sum(settle_money) from wx_bill_settle_record where settle_id = #{id}
select IFNULL(sum(settle_money),0) from wx_bill_settle_record where settle_id = #{id}
</select>




Загрузка…
Отмена
Сохранить