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

用户详情优化

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