Commit 545a6cc7 authored by wujipeng's avatar wujipeng
Browse files

用户详情优化

parent dfa973fc
......@@ -22,9 +22,9 @@ public class UserController extends BaseController {
private UserService userService;
@ApiOperation(value = "用户详情")
@GetMapping("/detail")
public Result detail(@RequestParam String userName,@RequestParam int caseId) {
return Result.data(userService.getDetail(userName,caseId));
@PostMapping("/detail")
public Result detail(@RequestBody UserDTO userDTO) {
return Result.data(userService.getDetail(userDTO));
}
@ApiOperation(value = "编辑用户信息")
......
......@@ -24,7 +24,7 @@ public interface ExcelDataMapper extends BaseMapper<ExcelDataEntity> {
List<ExcelDataEntity> queryList(CaseDTO caseDTO);
List<AssociationVO> selectFinancialTransactions(@Param("userName") String userName, @Param("caseId") int caseId);
List<AssociationVO> selectFinancialTransactions(UserDTO userDTO);
List<ExcelDataVO> queryListByPayUserList(@Param("userList") List<String> userList,
@Param("caseId") int caseId);
......@@ -34,7 +34,7 @@ public interface ExcelDataMapper extends BaseMapper<ExcelDataEntity> {
List<ExcelDataEntity> relationPage(@Param("oneselfAccountList") List<String> oneselfAccountList, @Param("otherAccountList") List<String> otherAccountList);
List<ExcelDataEntity> queryInfoList(CaseDTO caseDTO);
List<AssociationVO> queryAccountTemporary(@Param("userName") String userName, @Param("caseId") int caseId);
List<AssociationVO> queryAccountTemporary(UserDTO userDTO);
List<ExcelDataEntity> accountCashFlow(UserDTO userDTO);
List<ExcelDataEntity> queryListByPayeeNameAndPayUserName(@Param("payeeName") String payeeName, @Param("caseId") int caseId);
......
package com.platform.model.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.platform.model.entity.CaseRuleConfigEntity;
import com.platform.model.entity.UserAccountEntity;
import com.platform.model.entity.UserEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
@EqualsAndHashCode(callSuper = true)
......@@ -36,4 +39,18 @@ public class UserDTO extends UserEntity {
private String newName;
private Double minAmount;
private Double maxAmount;
private Integer minTransaction;
private Integer maxTransaction;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date startTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date endTime;
}
......@@ -49,7 +49,7 @@ public interface ExcelDataService extends IService<ExcelDataEntity> {
List<ExcelDataVO> queryListByPayUserList(List<String> userList, int caseId);
List<AssociationVO> selectFinancialTransactions(String userName, int caseId);
List<AssociationVO> selectFinancialTransactions(UserDTO userDTO);
List<ExcelDataEntity> cashFlow(UserDTO userDTO);
......@@ -59,7 +59,7 @@ public interface ExcelDataService extends IService<ExcelDataEntity> {
List<ExcelDataEntity> queryListByPayUserName(ExcelDataDTO excelDataDTO);
List<AssociationVO> queryAccountTemporary(String userName, int caseId);
List<AssociationVO> queryAccountTemporary(UserDTO userDTO);
List<ExcelDataEntity> accountCashFlow(UserDTO userDTO);
List<ExcelDataEntity> queryListByPayeeName(String oldName, int caseId);
......
......@@ -12,7 +12,7 @@ import com.platform.model.vo.UserVO;
import java.util.List;
public interface UserService extends IService<UserEntity> {
UserVO getDetail(String userName,int caseId);
UserVO getDetail(UserDTO userDTO);
boolean updateUser(UserDTO userDTO);
......
......@@ -74,8 +74,8 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData
}
@Override
public List<AssociationVO> selectFinancialTransactions(String userName, int caseId) {
return baseMapper.selectFinancialTransactions(userName, caseId);
public List<AssociationVO> selectFinancialTransactions(UserDTO userDTO) {
return baseMapper.selectFinancialTransactions(userDTO);
}
@Override
......@@ -125,8 +125,8 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData
}
@Override
public List<AssociationVO> queryAccountTemporary(String userName, int caseId) {
return baseMapper.queryAccountTemporary(userName, caseId);
public List<AssociationVO> queryAccountTemporary(UserDTO userDTO) {
return baseMapper.queryAccountTemporary(userDTO);
}
@Override
......
......@@ -44,24 +44,24 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
private ExcelDataService excelDataService;
@Override
public UserVO getDetail(String userName, int caseId) {
public UserVO getDetail(UserDTO userDTO) {
UserEntity userEntity = baseMapper.selectOne(new LambdaQueryWrapper<UserEntity>()
.eq(UserEntity::getUserName, userName).eq(UserEntity::getCaseId, caseId));
.eq(UserEntity::getUserName, userDTO.getUserName()).eq(UserEntity::getCaseId, userDTO.getCaseId()));
if (ObjectUtils.isEmpty(userEntity)) {
return account(userName, caseId);
return account(userDTO);
} else {
return personnel(userName, caseId, userEntity);
return personnel(userDTO, userEntity);
}
}
private UserVO account(String userName, int caseId) {
private UserVO account(UserDTO userDTO) {
UserVO userVO = new UserVO();
userVO.setUserName(userName);
userVO.setCaseId(caseId);
userVO.setUserName(userDTO.getUserName());
userVO.setCaseId(userDTO.getCaseId());
//本人账号数量
HashSet<String> account = Sets.newHashSet();
//查询关联资金
List<AssociationVO> financialTransactions = excelDataService.queryAccountTemporary(userName, caseId);
List<AssociationVO> financialTransactions = excelDataService.queryAccountTemporary(userDTO);
Map<String, List<AssociationVO>> detailsFunds = Maps.newHashMap();
for (AssociationVO financialTransaction : financialTransactions) {
if (financialTransaction.getDirection().equals("出账")) {
......@@ -110,22 +110,22 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
}
@NotNull
private UserVO personnel(String userName, int caseId, UserEntity userEntity) {
private UserVO personnel(UserDTO userDTO, UserEntity userEntity) {
UserVO userVO = DozerUtils.convertBean(userEntity, UserVO.class);
if (userVO != null) {
//查看用户账户列表
List<UserAccountEntity> userAccountEntityList = userAccountService.queryListByUserName(userName);
List<UserAccountEntity> userAccountEntityList = userAccountService.queryListByUserName(userDTO.getUserName());
userVO.setUserAccountList(userAccountEntityList);
}
List<UserRelationEntity> relationShipList = userRelationService.list(new LambdaQueryWrapper<UserRelationEntity>()
.eq(UserRelationEntity::getUserName, userEntity.getUserName()).eq(UserRelationEntity::getCaseId, caseId));
.eq(UserRelationEntity::getUserName, userEntity.getUserName()).eq(UserRelationEntity::getCaseId, userDTO.getCaseId()));
if (!ObjectUtils.isEmpty(relationShipList)) {
userVO.setRelationShipList(relationShipList);
}
//本人账号数量
HashSet<String> account = Sets.newHashSet();
//查询关联资金
List<AssociationVO> financialTransactions = excelDataService.selectFinancialTransactions(userName, caseId);
List<AssociationVO> financialTransactions = excelDataService.selectFinancialTransactions(userDTO);
Map<String, List<AssociationVO>> detailsFunds = Maps.newHashMap();
for (AssociationVO financialTransaction : financialTransactions) {
if (financialTransaction.getDirection().equals("出账")) {
......
......@@ -64,10 +64,29 @@
from excel_data
where case_id = #{caseId}
and pay_user_name = #{userName}
<if test="startTime != null">
and time >= #{startTime}
</if>
<if test="endTime != null">
and time &lt;= #{endTime}
</if>
group by
payee_account,
payment_account,
direction
HAVING 1=1
<if test="minAmount != null">
and sum(amount) >= #{minAmount}
</if>
<if test="maxAmount != null">
and sum(amount) &lt;= #{maxAmount}
</if>
<if test="minTransaction != null">
and count(*) >= #{minTransaction}
</if>
<if test="maxTransaction != null">
and count(*) &lt;= #{maxTransaction}
</if>
</select>
<select id="queryListByPayUserList" resultType="com.platform.model.vo.ExcelDataVO">
......@@ -197,10 +216,29 @@
from excel_data
where case_id = #{caseId}
and payee_name = #{userName}
<if test="startTime != null">
and time >= #{startTime}
</if>
<if test="endTime != null">
and time &lt;= #{endTime}
</if>
group by
payee_account,
payment_account,
direction
HAVING 1=1
<if test="minAmount != null">
and sum(amount) >= #{minAmount}
</if>
<if test="maxAmount != null">
and sum(amount) &lt;= #{maxAmount}
</if>
<if test="minTransaction != null">
and count(*) >= #{minTransaction}
</if>
<if test="maxTransaction != null">
and count(*) &lt;= #{maxTransaction}
</if>
</select>
<select id="accountCashFlow" resultType="com.platform.model.entity.ExcelDataEntity">
select id,
......
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