ソースを参照

Merge remote-tracking branch 'origin/test' into test

785834757 2 年 前
コミット
dcdb976b8f
43 ファイル変更1113 行追加490 行削除
  1. 24 0
      src/main/java/com/ydtech/constants/SysConstants.java
  2. 4 159
      src/main/java/com/ydtech/modules/admin/controller/SysUserController.java
  3. 10 11
      src/main/java/com/ydtech/modules/admin/model/SysUser.java
  4. 2 1
      src/main/java/com/ydtech/modules/admin/model/SysUserInfo.java
  5. 0 2
      src/main/java/com/ydtech/modules/admin/model/vo/SysUser2Vo.java
  6. 18 17
      src/main/java/com/ydtech/modules/admin/service/SysUserService.java
  7. 13 14
      src/main/java/com/ydtech/modules/admin/service/impl/SysUserServiceImpl.java
  8. 8 0
      src/main/java/com/ydtech/modules/inv/controller/InvAccountController.java
  9. 21 1
      src/main/java/com/ydtech/modules/inv/controller/InvAccountIncoiceController.java
  10. 27 0
      src/main/java/com/ydtech/modules/inv/controller/InvAccountOperateController.java
  11. 21 0
      src/main/java/com/ydtech/modules/inv/controller/invAccountExcelController.java
  12. 69 0
      src/main/java/com/ydtech/modules/inv/controller/invAccountProfitController.java
  13. 1 0
      src/main/java/com/ydtech/modules/inv/dao/InvAccountMapper.java
  14. 36 0
      src/main/java/com/ydtech/modules/inv/dao/InvAccountOpMapper.java
  15. 5 0
      src/main/java/com/ydtech/modules/inv/dao/InvAccountOperateMapper.java
  16. 11 0
      src/main/java/com/ydtech/modules/inv/dao/invAccountProfitMapper.java
  17. 1 1
      src/main/java/com/ydtech/modules/inv/model/InvAccount.java
  18. 0 41
      src/main/java/com/ydtech/modules/inv/model/InvAccountCard.java
  19. 21 7
      src/main/java/com/ydtech/modules/inv/model/InvAccountExcel.java
  20. 29 8
      src/main/java/com/ydtech/modules/inv/model/InvAccountIncoice.java
  21. 34 0
      src/main/java/com/ydtech/modules/inv/model/InvAccountOp.java
  22. 55 1
      src/main/java/com/ydtech/modules/inv/model/InvAccountOperate.java
  23. 29 0
      src/main/java/com/ydtech/modules/inv/model/InvAccountProfit.java
  24. 37 0
      src/main/java/com/ydtech/modules/inv/model/excel/AccountExcel.java
  25. 3 0
      src/main/java/com/ydtech/modules/inv/model/vo/InvAccountIncoiceQueryVo.java
  26. 15 0
      src/main/java/com/ydtech/modules/inv/service/InvAccountOpService.java
  27. 3 1
      src/main/java/com/ydtech/modules/inv/service/InvAccountOperateService.java
  28. 11 0
      src/main/java/com/ydtech/modules/inv/service/InvAccountProfitService.java
  29. 1 0
      src/main/java/com/ydtech/modules/inv/service/InvAccountService.java
  30. 0 19
      src/main/java/com/ydtech/modules/inv/service/impl/InvAccountCardServiceImpl.java
  31. 48 6
      src/main/java/com/ydtech/modules/inv/service/impl/InvAccountExcelServiceImpl.java
  32. 145 33
      src/main/java/com/ydtech/modules/inv/service/impl/InvAccountIncoiceServiceImpl.java
  33. 19 0
      src/main/java/com/ydtech/modules/inv/service/impl/InvAccountOpServiceImpl.java
  34. 63 21
      src/main/java/com/ydtech/modules/inv/service/impl/InvAccountOperateServiceImpl.java
  35. 43 9
      src/main/java/com/ydtech/modules/inv/service/impl/InvAccountServiceImpl.java
  36. 18 0
      src/main/java/com/ydtech/modules/inv/service/impl/invAccountProfitServiceImpl.java
  37. 64 2
      src/main/java/com/ydtech/modules/inv/utils/EasyExcelUtils.java
  38. 59 74
      src/main/java/com/ydtech/modules/inv/utils/TransferUtils.java
  39. 34 0
      src/main/resources/mapper/modules/InvAccountOpDao.xml
  40. 32 30
      src/main/resources/mapper/modules/inv/InvAccountExcelMapper.xml
  41. 9 1
      src/main/resources/mapper/modules/inv/InvAccountIncoiceMapper.xml
  42. 0 14
      src/main/resources/mapper/modules/inv/InvAccountMapper.xml
  43. 70 17
      src/main/resources/mapper/modules/inv/InvAccountOperateMapper.xml

+ 24 - 0
src/main/java/com/ydtech/constants/SysConstants.java

@@ -1,7 +1,9 @@
 package com.ydtech.constants;
 
 
+import com.ydtech.exception.SystemException;
 import com.ydtech.utils.MacUtils;
+import com.ydtech.utils.StringUtils;
 
 /**
  * 常量管理
@@ -11,6 +13,11 @@ import com.ydtech.utils.MacUtils;
  */
 public class SysConstants {
 
+
+    private SysConstants() {
+        throw new IllegalStateException("Utility class");
+    }
+
     /**
      * 系统管理员用户名
      */
@@ -46,10 +53,27 @@ public class SysConstants {
      */
     public static final String C = "C";
 
+    /**
+     * 五级机构 门店标志
+     */
+    public static final String M = "M";
+
+    /**
+     * 部门标志
+     */
+    public static final String D = "D";
 
     /**
      * 车险保单目录  add lig 2023-09-21
      */
     public static String CAR_INS_POLICY = "carInsPolicy";
 
+
+    public static boolean isAdministration(String userId) {
+        if (StringUtils.isEmpty(userId)) {
+            throw new SystemException("用户id不能为空");
+        }
+        return !userId.contains(M) && userId.contains(D);
+    }
+
 }

+ 4 - 159
src/main/java/com/ydtech/modules/admin/controller/SysUserController.java

@@ -150,17 +150,13 @@ public class SysUserController extends BaseController {
     @Transactional
     public HttpResult saveUserRole(@RequestParam String userId, @RequestParam String roleId) {
         SysUserRole userRole = new SysUserRole();
-//        List<SysUserRole> list = sysUserRoleService.selectList(" where user_id=?", new Object[]{userId});
-
         sysUserRoleService.deleteByUserId(userId);
-
         userRole = new SysUserRole();
         userRole.setUserId(userId);
         userRole.setRoleId(Long.parseLong(roleId));
         userRole.setCreateBy(getUserName());
         userRole.setCreateTime(new Date());
         sysUserRoleService.save(userRole);
-
         return HttpResult.ok();
     }
 
@@ -184,12 +180,9 @@ public class SysUserController extends BaseController {
     @PostMapping(value = "/findPageUsed")
     @Deprecated
     public HttpResult findPageUsed(@RequestBody PageRequest pageRequest) {
-        //return HttpResult.ok(sysUserService.findPage(pageRequest));
-
         int pageNum = pageRequest.getPageNum();
         int pageSize = pageRequest.getPageSize();
         String name = pageRequest.getColumnFilterValue(pageRequest, "name");
-//		String email = pageRequest.getColumnFilterValue(pageRequest, "email");
         //需要处理传入的部门
         PageResult pageResult = sysUserService.selectPagingCustom(pageNum, pageSize, name, "");
         sysUserService.findSysUseresmUserInternalVORoles(pageResult);
@@ -213,7 +206,6 @@ public class SysUserController extends BaseController {
             return HttpResult.error("ID不存在");
         }
         //密码加密
-        String salt = PasswordUtils.getSalt();
         String pwd = PasswordUtils.encode(password, sysUser.getSalt());
         sysUser.setPassword(pwd);
         sysUserService.updateById(sysUser);
@@ -242,8 +234,7 @@ public class SysUserController extends BaseController {
         lqw.eq(SysUser::getMobile, mobile);
 
         List<SysUser> users = sysUserService.list(lqw);
-//        List<SysUser> users = sysUserService.selectList(" where id != ? and mobile=?", new Object[]{id, mobile});
-        if (users != null && users.size() > 0) {
+        if (users != null && !users.isEmpty()) {
             return HttpResult.error("手机号已存在");
         }
 
@@ -260,11 +251,7 @@ public class SysUserController extends BaseController {
      */
     @GetMapping(value = "/findById")
     public HttpResult findByUserId(@RequestParam String id) {
-        SysUser sysUser = sysUserService.getById(id);
-        SysUserVO sysUserVO = new SysUserVO();
-
-        sysUserVO = sysUserService.gainUserInternal(id);
-//        SysUserVO sysUserVO = sysUserService.selectById(id);
+        SysUserVO sysUserVO = sysUserService.gainUserInternal(id);
         if (sysUserVO != null) {
             return HttpResult.ok(sysUserVO);
         }
@@ -280,7 +267,6 @@ public class SysUserController extends BaseController {
     @GetMapping(value = "/selectByDeptId")
     public HttpResult selectByDeptId(String deptId) {
         return HttpResult.ok(sysUserService.gainUserInternalByDeptId(deptId));
-//        return HttpResult.ok(sysUserService.selectByDeptId(deptId));
     }
 
     /**
@@ -292,31 +278,6 @@ public class SysUserController extends BaseController {
     }
 
 
-//    /**
-//     * 审批
-//     *
-//     * @param userId
-//     * @param status 审批
-//     * @return
-//     */
-//    @ApiOperation(value = "审批")
-//    @ApiImplicitParams({
-//            @ApiImplicitParam(name = "userId", value = "用户ID")
-//            , @ApiImplicitParam(name = "status", value = "审批状态")
-//    })
-//    @GetMapping(value = "/approval")
-//    public HttpResult approval(@RequestParam String userId, @RequestParam String status) {
-//
-//        LambdaUpdateWrapper<SysUser> luw = new LambdaUpdateWrapper();
-//        luw.eq(SysUser::getId, userId);
-//        luw.set(SysUser::getApprovalStatus, status);
-//
-//        return HttpResult.ok(sysUserService.update(luw));
-//
-//    }
-
-
-    //======================== 重构新接口
 
     /**
      * @author: lig
@@ -344,16 +305,14 @@ public class SysUserController extends BaseController {
         }
 
         sysUserService.saveUser(sysUser);
-
         return HttpResult.ok(sysUser);
 
-
     }
 
     @ApiOperation(value = "(重构)逻辑删除")
     @PostMapping(value = "/logicDeleteBatch")
     public HttpResult logicDeleteBatch(@RequestBody List<String> userIds) {
-        if (null != userIds && userIds.size() > 0) {
+        if (null != userIds && !userIds.isEmpty()) {
             LambdaUpdateWrapper<SysUser> luw = new LambdaUpdateWrapper<>();
             luw.set(SysUser::getStatus, "0");
             luw.in(SysUser::getId, userIds);
@@ -362,7 +321,6 @@ public class SysUserController extends BaseController {
         }
         return HttpResult.error("请正确选择参数");
 
-
     }
 
 
@@ -627,114 +585,6 @@ public class SysUserController extends BaseController {
         return HttpResult.ok("保存成功", sysUser.getId());
     }
 
-    @PostMapping(value = "/newUserImport")
-    @ApiOperation(value = "新用户导入")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "file", value = "excel文件", required = true, dataType = "__file"),
-            @ApiImplicitParam(name = "deptId", value = "机构部门ID", required = true, dataType = "String", paramType = "formData")
-    })
-    @Transactional
-    public HttpResult newUserImport(@RequestPart MultipartFile file, @RequestParam String deptId) {
-
-        SysDept sd = sysDeptService.getById(deptId);
-        if (null == sd) return HttpResult.error("机构部门不存在");
-
-        try {
-            List<SysUser> userList = ExcelEasypoiUtils.importExcel(file, SysUser.class, 0, 1, 1);
-            userList = userList.stream().filter(l -> StringUtils.isNotEmpty(l.getMobile())).collect(Collectors.toList());
-
-            userList.stream().forEach(a -> {
-
-                if (StringUtils.isNullOrEmpty(a.getMobile())) throw new SystemException("手机不能为空");
-                //处理密码
-                if (StringUtils.isNotEmpty(a.getPassword())) {
-                    String salt = PasswordUtils.getSalt();
-                    String pwd = PasswordUtils.encode(a.getPassword(), salt);
-                    a.setPassword(pwd);
-                    a.setSalt(salt);
-                }
-                a.setDeptId(sd.getId());
-                a.setDeptName(sd.getName());
-
-                //获取角色
-                LambdaQueryWrapper<SysRole> lqwRole = new LambdaQueryWrapper<>();
-                lqwRole.like(SysRole::getName, a.getRoleName());
-                SysRole sr = sysRoleService.getOne(lqwRole);
-                a.setRoleId(sr.getId().toString());
-                a.setRoleName(sr.getName());
-
-                //状态
-                if (a.getExcelStatus().equals("正常")) {
-                    a.setStatus(1);
-                }
-                if (a.getExcelStatus().equals("新注册")) {
-                    a.setStatus(2);
-                }
-
-//                //性别
-//                if (a.getSex().equals("未知")) {
-//                    a.setSex("U");
-//                }
-//                if (a.getSex().equals("男")) {
-//                    a.setSex("M");
-//                }
-//                if (a.getSex().equals("女")) {
-//                    a.setSex("W");
-//                }
-
-
-                if (StringUtils.isNullOrEmpty(a.getDeptId())) throw new SystemException("机构ID不能为空");
-                //by gws 21	团队长 20	代理人 必须归属团队
-                // 22	后线人员 必须归属部门
-                if (StringUtils.isNullOrEmpty(a.getRoleId())) throw new SystemException("角色ID不能为空");
-                if ("21".equals(a.getRoleId()) || "20".equals(a.getRoleId())) {//21	团队长 20	代理人
-                    boolean teamflag = false;
-                    char[] deptids = a.getDeptId().toCharArray();
-                    char ch1 = 'D';
-                    char ch2 = 'M';
-                    if (deptids.length > 6) {
-                        teamflag = deptids[deptids.length - 3] == ch1 && deptids[deptids.length - 6] == ch2;
-                    }
-                    if (!teamflag) {
-                        throw new SystemException("团队长和代理人只能归属团队中");
-                    }
-                } else if ("22".equals(a.getRoleId())) {//22	后线人员
-                    boolean deptflag = false;
-                    char[] deptids = a.getDeptId().toCharArray();
-                    char ch1 = 'D';
-                    char ch2 = 'M';
-                    if (deptids.length > 6) {
-                        deptflag = deptids[deptids.length - 3] == ch1 && deptids[deptids.length - 6] != ch2;
-                    } else if (deptids.length <= 6 && deptids.length > 3) {
-                        deptflag = deptids[deptids.length - 3] == ch1;
-                    }
-                    if (!deptflag) {
-                        throw new SystemException("后线人员只能归属业务部门中");
-                    }
-                } else {
-                    throw new SystemException("角色id有误");
-                }
-                sysUserService.saveUser(a);
-
-            });
-
-        } catch (IOException e) {
-            throw new SystemException(e.getMessage());
-        }
-
-
-        return HttpResult.ok("导入成功");
-    }
-
-
-//    @ApiOperation(value = "保存或更新用户信息")
-//    @PostMapping(value = "/saveOrUpdateInfo")
-//    public HttpResult saveOrUpdateInfo(@RequestBody SysUserInfo sysUserInfo) {
-//        if (StringUtils.isNullOrEmpty(sysUserInfo.getId())) return HttpResult.error("用户ID不能为空");
-//        return HttpResult.ok(sysUserInfoService.saveOrUpdate(sysUserInfo));
-//
-//    }
-
 
     @GetMapping(value = "/findUserInfo/{userId}")
     @ApiOperation(value = "获取用户信息")
@@ -771,12 +621,7 @@ public class SysUserController extends BaseController {
                 if (deptLevel != 6) {
                     throw new SystemException("团队长、代理人、出单员只能归属团队中");
                 }
-            } else if (RoleConstants.R22.getCode().equals(sysUser.getRoleId())) {//22	后线人员
-
-                if (deptLevel != 5) {
-                    throw new SystemException("后线人员只能归属业务部门中");
-                }
-            } else if (RoleConstants.R18.getCode().equals(sysUser.getRoleId())) { // 42 门店长
+            }else if (RoleConstants.R18.getCode().equals(sysUser.getRoleId())) { // 42 门店长
                 if (deptLevel != 5) {
                     throw new SystemException("机构管理员只能归属机构中");
                 }

+ 10 - 11
src/main/java/com/ydtech/modules/admin/model/SysUser.java

@@ -2,19 +2,15 @@ package com.ydtech.modules.admin.model;
 
 
 import cn.afterturn.easypoi.excel.annotation.Excel;
-import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ydtech.core.page.HttpResult;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.base.model.BaseEntity;
-import com.ydtech.security.utils.PasswordUtils;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
-import org.apache.ibatis.annotations.Select;
 import springfox.documentation.annotations.ApiIgnore;
 
 import javax.validation.constraints.NotBlank;
@@ -69,7 +65,6 @@ public class SysUser extends BaseEntity {
     private String salt;
 
 
-
     /**
      * 手机号
      */
@@ -94,8 +89,6 @@ public class SysUser extends BaseEntity {
     @TableField(value = "dept_id")
     private String deptId;
 
-
-
     /**
      * 微信id
      */
@@ -113,7 +106,6 @@ public class SysUser extends BaseEntity {
     @TableField(value = "identity")
     private String identity;
 
-
     //------------------
 
     /**
@@ -139,7 +131,6 @@ public class SysUser extends BaseEntity {
     private String deptName;
 
 
-
     @TableField(exist = false)
     @Excel(name = "状态")
     private String excelStatus;
@@ -161,14 +152,22 @@ public class SysUser extends BaseEntity {
     @Excel(name = "推荐人名称")
     private String referrerName;
 
+    @TableField(value = "position_id")
+    @ApiModelProperty("岗位id")
+    private String positionId;
+
+    @TableField(value = "position_name")
+    @ApiModelProperty("岗位名称")
+    private String positionName;
+
     /**
-     *  验证用户
+     * 验证用户
      *
      * @author: lig
      * @date: 2023年07月03日 0003
      */
     @ApiIgnore
-    public static void verifyUser(SysUser user){
+    public static void verifyUser(SysUser user) {
         // 账号不存在、密码错误
         if (user == null) {
             throw new SystemException("账号不存在");

+ 2 - 1
src/main/java/com/ydtech/modules/admin/model/SysUserInfo.java

@@ -11,6 +11,7 @@ import lombok.Data;
 
 import javax.validation.constraints.NotBlank;
 import java.io.Serializable;
+import java.time.LocalDate;
 import java.util.Date;
 
 /**
@@ -65,7 +66,7 @@ public class SysUserInfo implements Serializable {
 
     @ApiModelProperty(value = "出生日期")
     @TableField(value = "birthday")
-    private Date birthday;
+    private LocalDate birthday;
 
     @ApiModelProperty(value = "婚姻状况")
     @TableField(value = "marital_status")

+ 0 - 2
src/main/java/com/ydtech/modules/admin/model/vo/SysUser2Vo.java

@@ -22,8 +22,6 @@ public class SysUser2Vo {
     @ApiModelProperty("用户详情信息")
     private SysUserInfo sysUserInfo;
 
-//    @ApiModelProperty("用户详细信息")
-//    private EsmUserInternal userInternal;
 
     @ApiModelProperty("影像信息")
     private List<EsmUserImageVo> esmUserImageVo;

+ 18 - 17
src/main/java/com/ydtech/modules/admin/service/SysUserService.java

@@ -5,14 +5,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ydtech.core.page.HttpResult;
+import com.ydtech.core.page.PageResult;
 import com.ydtech.modules.admin.model.QuTeamNum;
 import com.ydtech.modules.admin.model.SysUser;
 import com.ydtech.modules.admin.model.SysUserRole;
-import com.ydtech.core.page.PageResult;
 import com.ydtech.modules.admin.model.dto.QuTeamNumDto;
 import com.ydtech.modules.admin.model.dto.SysUserDto;
-import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
 import com.ydtech.modules.admin.model.vo.SysUser2Vo;
+import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
 import com.ydtech.modules.admin.model.vo.SysUserInternalVO;
 import com.ydtech.modules.admin.model.vo.SysUserVO;
 import com.ydtech.modules.base.model.dto.PageDto;
@@ -43,20 +43,21 @@ public interface SysUserService extends IService<SysUser> {
      */
     List<SysUserRole> findUserRoles(Long userId);
 
-    public PageResult selectPagingCustom(int pageNumber, int pageSize, String name, String deptCode);
+    PageResult selectPagingCustom(int pageNumber, int pageSize, String name, String deptCode);
 
     /**
      * 获取用户列表
-     * @param page 分页信息
-     * @param sysUser 查询条件
+     *
+     * @param page            分页信息
+     * @param sysUser         查询条件
      * @param containsSubDept 是否汉堡下级机构
      * @return
      */
-    public IPage<SysUser> selectUserPage(Page page, SysUser sysUser,String containsSubDept);
+    IPage<SysUser> selectUserPage(Page page, SysUser sysUser, String containsSubDept);
 
-    public void findSysUseresmUserInternalVORoles(PageResult pageResult);
+    void findSysUseresmUserInternalVORoles(PageResult pageResult);
 
-    public Integer deleteFlag(List<SysUser> lsSysUser);
+    Integer deleteFlag(List<SysUser> lsSysUser);
 
     SysUser findById(String handlercode);
 
@@ -67,12 +68,13 @@ public interface SysUserService extends IService<SysUser> {
     SysUserVO gainUserInternalByDeptId(String deptId);
 
     List<SysUserVO> findByReferrerId(String deptId);
+
     PageVo<SysUserBaseVO> gainUserPage(PageDto<SysUserDto> pageDto);
 
-//    PageVo gainUserPage(PageDto pageDto);
 
     /**
      * 根据角色查询用户列表
+     *
      * @param pageDto
      * @return
      */
@@ -95,32 +97,31 @@ public interface SysUserService extends IService<SysUser> {
     String findMaxId(String deptId);
 
     //审批
-    public boolean check(String userId,Integer approvalStatus,String approvalOpinion);
-
+    boolean check(String userId, Integer approvalStatus, String approvalOpinion);
 
 
     SysUserBaseVO selectUserById(String userId);
 
 
-
     boolean saveUser(SysUser sysUser);
 
-    HttpResult   saveUserInfo( SysUser2Vo sysUserVo);
+    HttpResult saveUserInfo(SysUser2Vo sysUserVo);
 
     HttpResult updateUserInfo(String userId, SysUser2Vo sysUserVo);
 
-    public List<SysUser> getAllUsers(String userId);
+    List<SysUser> getAllUsers(String userId);
 
-    public List<SysUser> findAllAgentRoleUser(String userId,String roleId);
+    List<SysUser> findAllAgentRoleUser(String userId, String roleId);
 
-    public int getDeptLevel(SysUser2Vo sysUser2Vo);
+    int getDeptLevel(SysUser2Vo sysUser2Vo);
 
     /**
      * 根据机构代码,查询所有人员
+     *
      * @param deptId
      * @return
      */
-    public List<SysUser> findUserList(String deptId);
+    List<SysUser> findUserList(String deptId);
 }
 
 

+ 13 - 14
src/main/java/com/ydtech/modules/admin/service/impl/SysUserServiceImpl.java

@@ -7,10 +7,12 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.constants.SysConstants;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.PageRequest;
 import com.ydtech.core.page.PageResult;
 import com.ydtech.exception.SystemException;
+import com.ydtech.modules.admin.constants.RoleConstants;
 import com.ydtech.modules.admin.dao.SysUserMapper;
 import com.ydtech.modules.admin.model.*;
 import com.ydtech.modules.admin.model.dto.QuTeamNumDto;
@@ -499,6 +501,13 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
             return checkChuDanUser(sysUser);
         }
         String userId = gainNextUserId(sysUser.getDeptId());
+
+        if (RoleConstants.R22.getCode().equals(sysUser.getRoleId())) {//22	后线人员
+            if (!SysConstants.isAdministration(userId)) {
+                throw new SystemException("后线人员只能公司部门中");
+            }
+        }
+
         sysUser.setId(userId);
         save(sysUser);
 
@@ -573,15 +582,17 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     @Transactional
     public HttpResult updateUserInfo(String userId, SysUser2Vo sysUserVo) {
         SysUser sysUser = sysUserVo.getSysUser();
+
         //修改用户不能修改密码
-        /*if (StringUtils.isNotEmpty(sysUser.getPassword())) {
+        if (StringUtils.isNotEmpty(sysUser.getPassword())) {
             String salt = PasswordUtils.getSalt();
             String pwd = PasswordUtils.encode(sysUser.getPassword(), salt);
             sysUser.setPassword(pwd);
             sysUser.setSalt(salt);
         } else {
             return HttpResult.error("密码不能为空");
-        }*/
+        }
+
         //删除状态必须有离司时间
         if (StringUtils.isNotEmpty(sysUser.getStatus().toString())) {
             if (sysUser.getStatus() == 0 && sysUser.getLogoutTime() == null && !sysUser.getRoleId().equals("19")) {
@@ -598,7 +609,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
         }
         updateById(sysUser);
 
-
         //角色配置
         SysUserRole sysUserRole = sysUserRoleService.selectByUserId(userId);
         sysUserRole.setRoleId(StringUtils.toLong(sysUser.getRoleId()));
@@ -610,17 +620,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
             //推荐人
             esmUserReferrerService.addReferrer(sysUser.getReferrerId(), userId);
         }
-//        EsmUserReferrer referrer = esmUserReferrerService.getById(userId);
-//        EsmUserReferrer eur = new EsmUserReferrer();
-//        eur.setId(userId);
-//        eur.setReferrerName(sysUser.getReferrerName());
-//        eur.setReferrerId(sysUser.getReferrerId());
-//        if (null != referrer) {
-//            eur.setLevel(referrer.getLevel() + 1);
-//        } else {
-//            eur.setLevel(1);
-//        }
-//        esmUserReferrerService.updateById(eur);
 
         //用户详情信息
         SysUserInfo sysUserInfo = sysUserVo.getSysUserInfo();

+ 8 - 0
src/main/java/com/ydtech/modules/inv/controller/InvAccountController.java

@@ -30,6 +30,14 @@ public class InvAccountController {
     @Autowired
     private InvAccountCardService invAccountCardService;
 
+    @PostMapping("excel")
+    @ApiOperation("导出账户信息")
+    public HttpResult selectAccountExcel(@RequestBody InvAccountQueryVo invAccountQueryVo) {
+        return invAccountService.selectAccountExcel(invAccountQueryVo);
+    }
+
+
+
     @ApiOperation("获取账户列表")
     @PostMapping("getAccount")
     public HttpResult<IPage<InvAccount>> getInsAccountList(@RequestBody InvAccountQueryVo invAccountQueryVo) {

+ 21 - 1
src/main/java/com/ydtech/modules/inv/controller/InvAccountIncoiceController.java

@@ -1,10 +1,12 @@
 package com.ydtech.modules.inv.controller;
 
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.PageRequest;
+import com.ydtech.exception.SystemException;
 import com.ydtech.modules.inv.model.InvAccountIncoice;
 import com.ydtech.modules.inv.model.InvAccountIncoiceResult;
 import com.ydtech.modules.inv.model.vo.InvAccountIncoiceQueryVo;
@@ -19,6 +21,7 @@ import javax.annotation.Resource;
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.DoubleStream;
 
 /**
@@ -65,7 +68,8 @@ public class InvAccountIncoiceController {
                 .eq(InvAccountIncoice::getDelFlag, "0")
                 .eq(!StringUtils.isEmpty(invAccountIncoice.getInvoiceType()), InvAccountIncoice::getInvoiceType,
                         invAccountIncoice.getInvoiceType())
-                .like(!StringUtils.isEmpty(invAccountIncoice.getOtherUnit()), InvAccountIncoice::getOtherUnit,invAccountIncoice.getOtherUnit());
+                .like(!StringUtils.isEmpty(invAccountIncoice.getOtherUnit()), InvAccountIncoice::getOtherUnit,invAccountIncoice.getOtherUnit())
+                .like(!StringUtils.isEmpty(invAccountIncoice.getClearFlag()), InvAccountIncoice::getClearFlag,invAccountIncoice.getClearFlag());
 
 
         if (!ObjectUtils.isEmpty(invAccountIncoice.getInvoiceTime())) {
@@ -130,6 +134,22 @@ public class InvAccountIncoiceController {
     @PostMapping("update")
     @ApiOperation("新增收入")
     public HttpResult updateIncome(@RequestBody InvAccountIncoice invAccountIncoice) {
+        JSONObject outProfit = invAccountIncoice.getOutProfit();
+        JSONObject entProfit = invAccountIncoice.getEntProfit();
+        BigDecimal outAmount = new BigDecimal(0);
+        BigDecimal entAmount = new BigDecimal(0);
+        for (Map.Entry<String, Object> entry:outProfit.entrySet()){
+            outAmount = outAmount.add(new BigDecimal(entry.getValue().toString()));
+        }
+        for (Map.Entry<String, Object> entry:entProfit.entrySet()){
+            entAmount = entAmount.add(new BigDecimal(entry.getValue().toString()));
+        }
+        if (!String.valueOf(outAmount).equals("100")){
+            throw new SystemException("金额未完全分配");
+        }
+        if (!String.valueOf(entAmount).equals("100")){
+            throw new SystemException("金额未完全分配");
+        }
         return this.invAccountIncoiceService.updateInvAccountIncoice(invAccountIncoice);
     }
 

+ 27 - 0
src/main/java/com/ydtech/modules/inv/controller/InvAccountOperateController.java

@@ -1,7 +1,9 @@
 package com.ydtech.modules.inv.controller;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.ydtech.core.page.HttpResult;
+import com.ydtech.exception.SystemException;
 import com.ydtech.modules.inv.model.InvAccountOperate;
 import com.ydtech.modules.inv.service.InvAccountOperateService;
 import io.swagger.annotations.Api;
@@ -9,6 +11,9 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.math.BigDecimal;
+import java.util.Map;
+
 
 /**
  * @author jianlong
@@ -22,6 +27,12 @@ public class InvAccountOperateController {
     @Autowired
     private InvAccountOperateService invAccountOperateService;
 
+    @PostMapping("excel")
+    @ApiOperation("导出excel")
+    public HttpResult excelAccount(@RequestBody InvAccountOperate accountOperate) {
+        return invAccountOperateService.excelAccount(accountOperate);
+    }
+
 
     @PostMapping("getAccountOperate")
     @ApiOperation("获取账户操作")
@@ -40,6 +51,22 @@ public class InvAccountOperateController {
     @PostMapping("insertAccountOperate")
     @ApiOperation("新增外部收入")
     public HttpResult insertAccountOperate(@RequestBody InvAccountOperate accountOperate) {
+        JSONObject outProfit = accountOperate.getOutProfit();
+        JSONObject entProfit = accountOperate.getEntProfit();
+        BigDecimal outAmount = new BigDecimal(0);
+        BigDecimal entAmount = new BigDecimal(0);
+        for (Map.Entry<String, Object> entry:outProfit.entrySet()){
+            outAmount = outAmount.add(new BigDecimal(String.valueOf(entry.getValue())));
+        }
+        for (Map.Entry<String, Object> entry:entProfit.entrySet()){
+            entAmount = entAmount.add(new BigDecimal(String.valueOf(entry.getValue())));
+        }
+        if (!String.valueOf(outAmount).equals("100")){
+            throw new SystemException("金额未完全分配");
+        }
+        if (!String.valueOf(entAmount).equals("100")){
+            throw new SystemException("金额未完全分配");
+        }
         return invAccountOperateService.insert(accountOperate);
     }
 }

+ 21 - 0
src/main/java/com/ydtech/modules/inv/controller/invAccountExcelController.java

@@ -1,5 +1,6 @@
 package com.ydtech.modules.inv.controller;
 
+import com.alibaba.fastjson.JSONObject;
 import com.ydtech.constants.enums.inv.InvPayMethodEnum;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.exception.SystemException;
@@ -15,8 +16,10 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author jianlong
@@ -43,6 +46,24 @@ public class invAccountExcelController {
         invAccountExcel.setCreateBy(baseController.getUserName());
         invAccountExcel.setCreateTime(date);
 
+        JSONObject outProfit = invAccountExcel.getOutProfit();
+        JSONObject entProfit = invAccountExcel.getEntProfit();
+        BigDecimal outAmount = new BigDecimal(0);
+        BigDecimal entAmount = new BigDecimal(0);
+        for (Map.Entry<String, Object> entry:outProfit.entrySet()){
+            outAmount = outAmount.add(new BigDecimal(entry.getValue().toString()));
+        }
+        for (Map.Entry<String, Object> entry:entProfit.entrySet()){
+            entAmount = entAmount.add(new BigDecimal(entry.getValue().toString()));
+        }
+        if (String.valueOf(outAmount).equals("1000")){
+            throw new SystemException("金额未完全分配");
+        }
+        if (String.valueOf(entAmount).equals("1000")){
+            throw new SystemException("金额未完全分配");
+        }
+
+
         if (invAccountExcel.getOutCardNum() == null && invAccountExcel.getEnterCardNum() == null) {
             throw new SystemException("请先选择账户");
         }

+ 69 - 0
src/main/java/com/ydtech/modules/inv/controller/invAccountProfitController.java

@@ -0,0 +1,69 @@
+package com.ydtech.modules.inv.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.core.page.PageRequest;
+import com.ydtech.modules.inv.model.InvAccountProfit;
+import com.ydtech.modules.inv.service.InvAccountProfitService;
+import com.ydtech.utils.StringUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author jianlong
+ * @date 2024-01-29 16:07
+ */
+@Api(tags = "利润管理", value = "利润管理")
+@RequestMapping("/invAccountProfit")
+@RestController
+public class invAccountProfitController {
+
+    @Autowired
+    InvAccountProfitService invAccountProfitService;
+
+
+    @PostMapping("insert")
+    @ApiOperation("增加")
+    public HttpResult insertInsAccountExpenses(@RequestBody InvAccountProfit invAccountProfit) {
+
+        return HttpResult.ok("",invAccountProfitService.save(invAccountProfit));
+    }
+
+    @PostMapping("update")
+    @ApiOperation("修改")
+    public HttpResult updateInsAccountExpenses(@RequestBody InvAccountProfit invAccountProfit) {
+        return HttpResult.ok("",invAccountProfitService.updateById(invAccountProfit));
+    }
+
+    @DeleteMapping("delete")
+    @ApiOperation("删除")
+    public HttpResult deleteInsAccountExpenses(@RequestParam("id") String id) {
+        return HttpResult.ok("",invAccountProfitService.removeById(id));
+    }
+
+    @PostMapping("getPageList")
+    @ApiOperation("获取分页列表")
+    public HttpResult getInsAccountExpensesPageList(@RequestBody InvAccountProfit invAccountProfit) {
+        LambdaQueryWrapper<InvAccountProfit> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.like(StringUtils.isNotEmpty(invAccountProfit.getProfitName()),InvAccountProfit::getProfitName,invAccountProfit.getProfitName());
+        PageRequest pageRequest = new PageRequest();
+        pageRequest.setPageNum(invAccountProfit.getPageNo());
+        pageRequest.setPageSize(invAccountProfit.getPageSize());
+        Page<InvAccountProfit> page = PageRequest.buildPageRequest(pageRequest);
+        Page<InvAccountProfit> page1 = invAccountProfitService.page(page, queryWrapper);
+        return HttpResult.ok("",page1);
+    }
+
+    @GetMapping("getList")
+    @ApiOperation("获取列表")
+    public HttpResult getInsAccountExpensesList(){
+        List<InvAccountProfit> list = invAccountProfitService.list();
+        return HttpResult.ok(list);
+    }
+}

+ 1 - 0
src/main/java/com/ydtech/modules/inv/dao/InvAccountMapper.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ydtech.modules.inv.model.InvAccount;
+import com.ydtech.modules.inv.model.excel.AccountExcel;
 import com.ydtech.modules.inv.model.vo.InvAccountQueryVo;
 import org.apache.ibatis.annotations.Param;
 

+ 36 - 0
src/main/java/com/ydtech/modules/inv/dao/InvAccountOpMapper.java

@@ -0,0 +1,36 @@
+package com.ydtech.modules.inv.dao;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.inv.model.InvAccountOp;
+import org.apache.ibatis.annotations.Param;
+
+
+/**
+ * (InvAccountOp)表数据库访问层
+ *
+ * @author makejava
+ * @since 2024-01-30 16:00:03
+ */
+public interface InvAccountOpMapper extends BaseMapper<InvAccountOp> {
+
+/**
+* 批量新增数据(MyBatis原生foreach方法)
+*
+* @param entities List<InvAccountOp> 实例对象列表
+* @return 影响行数
+*/
+int insertBatch(@Param("entities") List<InvAccountOp> entities);
+
+/**
+* 批量新增或按主键更新数据(MyBatis原生foreach方法)
+*
+* @param entities List<InvAccountOp> 实例对象列表
+* @return 影响行数
+* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
+*/
+int insertOrUpdateBatch(@Param("entities") List<InvAccountOp> entities);
+
+}
+

+ 5 - 0
src/main/java/com/ydtech/modules/inv/dao/InvAccountOperateMapper.java

@@ -6,6 +6,8 @@ import com.ydtech.modules.inv.model.InvAccountOperate;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 /**
 * @author Administrator
 * @description 针对表【ins_account_operate(账户操作记录表)】的数据库操作Mapper
@@ -15,6 +17,9 @@ import org.apache.ibatis.annotations.Param;
 public interface InvAccountOperateMapper extends BaseMapper<InvAccountOperate> {
 
     IPage<InvAccountOperate> selectInsAccountOperate(Page page, @Param("insAccountOperate") InvAccountOperate insAccountOperate);
+    List<InvAccountOperate> selectInsAccountOperateList(@Param("insAccountOperate") InvAccountOperate insAccountOperate);
+
+    List<InvAccountOperate> selectOperateList(List<String> cardNumList);
 
 }
 

+ 11 - 0
src/main/java/com/ydtech/modules/inv/dao/invAccountProfitMapper.java

@@ -0,0 +1,11 @@
+package com.ydtech.modules.inv.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.inv.model.InvAccountProfit;
+
+/**
+ * @author jianlong
+ * @date 2024-01-29 16:01
+ */
+public interface invAccountProfitMapper extends BaseMapper<InvAccountProfit> {
+}

+ 1 - 1
src/main/java/com/ydtech/modules/inv/model/InvAccount.java

@@ -37,7 +37,7 @@ public class InvAccount implements Serializable {
     /**
      * 营业性质
      */
-    @ApiModelProperty(value = "营业性质 (0一般纳税 1小规模 2个体户)")
+    @ApiModelProperty(value = "营业性质(3一般纳税 2小规模 1个体户)")
     private String businessQuality;
 
     /**

+ 0 - 41
src/main/java/com/ydtech/modules/inv/model/InvAccountCard.java

@@ -114,47 +114,6 @@ public class InvAccountCard {
     @ApiModelProperty(value = "对私年剩余额度")
     private String priYearExcess;
 
-    /**
-     * 财税公司利润
-     */
-    @ApiModelProperty(value = "财务公司利润")
-    private String fiscalProfit;
-
-    /**
-     * 保险公司回款
-     */
-    @ApiModelProperty(value = "保险公司利润")
-    private String insuranceProfit;
-
-    /**
-     * 结算卡
-     */
-    @ApiModelProperty(value = "结算卡")
-    private String clearingProfit;
-
-    /**
-     * 外部过账金额
-     */
-    @ApiModelProperty(value = "外部过账金额")
-    private String exteriorProfit;
-
-    /**
-     * 园区利润
-     */
-    @ApiModelProperty(value = "园区利润")
-    private String parkProfit;
-
-    /**
-     * 天勤利润
-     */
-    @ApiModelProperty(value = "天勤利润")
-    private String tianqinProfit;
-
-    /**
-     * 其他利润
-     */
-    @ApiModelProperty(value = "其他利润")
-    private String otherProfit;
 
     /**
      * 证书有效期结束

+ 21 - 7
src/main/java/com/ydtech/modules/inv/model/InvAccountExcel.java

@@ -5,12 +5,14 @@ import com.alibaba.excel.annotation.write.style.ContentStyle;
 import com.alibaba.excel.enums.poi.BorderStyleEnum;
 import com.alibaba.excel.enums.poi.HorizontalAlignmentEnum;
 import com.alibaba.excel.enums.poi.VerticalAlignmentEnum;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import java.io.Serializable;
 import java.util.Date;
 
+import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -21,12 +23,13 @@ import javax.validation.constraints.NotBlank;
  * 资金申请单表
  * @TableName ins_account_excel
  */
-@TableName(value ="inv_account_excel")
+
 @Data
 @ContentStyle(borderBottom = BorderStyleEnum.THIN, borderTop = BorderStyleEnum.THIN, borderLeft = BorderStyleEnum.THIN, borderRight = BorderStyleEnum.THIN,
 horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER
 )
 @ExcelIgnoreUnannotated
+@TableName(value = "inv_account_excel", autoResultMap = true)
 public class InvAccountExcel implements Serializable {
     /**
      * 资金申请表id
@@ -93,12 +96,6 @@ public class InvAccountExcel implements Serializable {
     private String fundUse;
 
 
-    /**
-     * 备注
-     */
-    @ApiModelProperty(value = "备注")
-    @NotBlank
-    private String remark;
 
     /**
      * 申请金额
@@ -192,6 +189,23 @@ public class InvAccountExcel implements Serializable {
     @NotBlank
     private String payMethod;
 
+    @ApiModelProperty("支出方利润归属")
+    @TableField(value = "out_profit", typeHandler = FastjsonTypeHandler.class)
+    private JSONObject outProfit;
+
+    @ApiModelProperty("收入方利润归属")
+    @TableField(value = "ent_profit", typeHandler = FastjsonTypeHandler.class)
+    private JSONObject entProfit;
+
+    @ApiModelProperty("资金用途分项")
+    private String fundFen;
+
+
+    @ApiModelProperty("备注")
+    private String remark;
+
+
+
     @TableField(exist = false)
     private int pageNo;
 

+ 29 - 8
src/main/java/com/ydtech/modules/inv/model/InvAccountIncoice.java

@@ -3,15 +3,14 @@ package com.ydtech.modules.inv.model;
 
 import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
 import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
-import lombok.EqualsAndHashCode;
-
 import java.io.Serializable;
 import java.time.LocalDate;
 import java.util.Date;
@@ -22,7 +21,7 @@ import java.util.Date;
  * @author makejava
  * @since 2024-01-18 16:01:27
  */
-@TableName(value ="inv_account_incoice")
+@TableName(value ="inv_account_incoice",autoResultMap = true)
 @Data
 @ExcelIgnoreUnannotated
 public class InvAccountIncoice implements Serializable{
@@ -106,11 +105,11 @@ public class InvAccountIncoice implements Serializable{
     @TableField(exist = false)
     private String payoutDate;
 
-    @ApiModelProperty(value = "卡号")
-    private String bankCardNum;
+    @ApiModelProperty(value = "进账卡号")
+    private String revBankCardNum;
 
-    @ApiModelProperty(value = "备注")
-    private String remark;
+    @ApiModelProperty(value = "支出卡号")
+    private String outBankCardNum;
 
 
     //进账金额
@@ -127,6 +126,25 @@ public class InvAccountIncoice implements Serializable{
     @ApiModelProperty(value = "撤销标志(0正常 1撤销)")
     private String delFlag;
 
+    @ApiModelProperty(value = "已转清(0未清,1已清)")
+    private String clearFlag;
+
+
+
+
+    @ApiModelProperty("支出方利润归属")
+    @TableField(value = "out_profit", typeHandler = FastjsonTypeHandler.class)
+    private JSONObject outProfit;
+
+    @ApiModelProperty("收入方利润归属")
+    @TableField(value = "ent_profit", typeHandler = FastjsonTypeHandler.class)
+    private JSONObject entProfit;
+
+
+
+    @ApiModelProperty("备注")
+    @ExcelProperty("备注")
+    private String remark;
 
 
     /**
@@ -165,6 +183,9 @@ public class InvAccountIncoice implements Serializable{
     @TableField(exist = false)
     private String fundUse;
 
+    @ApiModelProperty("资金用途分项")
+    private String fundFen;
+
 
 
     @TableField(exist = false)

+ 34 - 0
src/main/java/com/ydtech/modules/inv/model/InvAccountOp.java

@@ -0,0 +1,34 @@
+package com.ydtech.modules.inv.model;
+
+
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * (InvAccountOp)表实体类
+ *
+ * @author makejava
+ * @since 2024-01-30 16:00:03
+ */
+@SuppressWarnings("serial")
+@Data
+public class InvAccountOp extends Model<InvAccountOp> {
+    //编号
+    private Long id;
+    //公司名称
+    private String accountName;
+    //公司id
+    private String accountId;
+    //开户行名称
+    private String cardName;
+    //卡号
+    private String cardNum;
+    //归属
+    private String profit;
+    //金额
+    private String money;
+
+}
+

+ 55 - 1
src/main/java/com/ydtech/modules/inv/model/InvAccountOperate.java

@@ -1,11 +1,21 @@
 package com.ydtech.modules.inv.model;
 
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ContentStyle;
+import com.alibaba.excel.enums.poi.BorderStyleEnum;
+import com.alibaba.excel.enums.poi.HorizontalAlignmentEnum;
+import com.alibaba.excel.enums.poi.VerticalAlignmentEnum;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import java.io.Serializable;
+import java.time.LocalDateTime;
 import java.util.Date;
 
+import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -14,8 +24,12 @@ import lombok.Data;
  * 账户操作记录表
  * @TableName ins_account_operate
  */
-@TableName(value ="inv_account_operate")
+@TableName(value ="inv_account_operate",autoResultMap = true)
 @Data
+@ContentStyle(borderBottom = BorderStyleEnum.THIN, borderTop = BorderStyleEnum.THIN, borderLeft = BorderStyleEnum.THIN, borderRight = BorderStyleEnum.THIN,
+        horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER
+)
+@ExcelIgnoreUnannotated
 public class InvAccountOperate implements Serializable {
     /**
      * 账户操作id
@@ -24,6 +38,13 @@ public class InvAccountOperate implements Serializable {
     @ApiModelProperty(value = "账户操作id")
     private String accountOperateId;
 
+
+    @ApiModelProperty(value = "创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @ExcelProperty("支出时间")
+    @TableField(value = "create_time",fill = FieldFill.INSERT_UPDATE)
+    private LocalDateTime createTime;
+
     /**
      * 申请人
      */
@@ -34,8 +55,14 @@ public class InvAccountOperate implements Serializable {
      * 申请部门
      */
     @ApiModelProperty(value = "申请部门")
+    @ExcelProperty("部门")
     private String applySector;
 
+
+    @ApiModelProperty("无需传递")
+    @ExcelProperty("板块")
+    private String plate;
+
     /**
      * 申请时间
      */
@@ -53,18 +80,35 @@ public class InvAccountOperate implements Serializable {
      * 资金流向
      */
     @ApiModelProperty(value = "资金流向")
+    @ExcelProperty("资金流向")
     private String fundFlow;
 
+    /**
+     * 进账id
+     */
+    private String enterCardNum;
+
+    /**
+     * 支出id
+     */
+    private String outCardNum;
+
     /**
      * 资金用途
      */
     @ApiModelProperty(value = "资金用途")
+    @ExcelProperty("支出项目")
     private String fundUse;
 
+    @ApiModelProperty("资金用途分项")
+    @ExcelProperty("分项")
+    private String fundFen;
+
     /**
      * 申请金额
      */
     @ApiModelProperty(value = "申请金额")
+    @ExcelProperty("支出金额")
     private String applyAmount;
 
     /**
@@ -108,6 +152,16 @@ public class InvAccountOperate implements Serializable {
     private String enterCardId;
 
 
+    @ApiModelProperty("支出方利润归属")
+    @TableField(value = "out_profit", typeHandler = FastjsonTypeHandler.class)
+    private JSONObject outProfit;
+
+    @ApiModelProperty("收入方利润归属")
+    @TableField(value = "ent_profit", typeHandler = FastjsonTypeHandler.class)
+    private JSONObject entProfit;
+
+
+
     @TableField(exist = false)
     private int pageNo;
 

+ 29 - 0
src/main/java/com/ydtech/modules/inv/model/InvAccountProfit.java

@@ -0,0 +1,29 @@
+package com.ydtech.modules.inv.model;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author jianlong
+ * @date 2024-01-29 15:58
+ */
+@Data
+@TableName(value ="inv_account_profit")
+public class InvAccountProfit implements Serializable {
+
+    @TableId
+    private String profitId;
+
+    private String profitName;
+
+    private String profitEng;
+
+    @TableField(exist = false)
+    private int pageNo;
+    @TableField(exist = false)
+    private int pageSize;
+}

+ 37 - 0
src/main/java/com/ydtech/modules/inv/model/excel/AccountExcel.java

@@ -0,0 +1,37 @@
+package com.ydtech.modules.inv.model.excel;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ContentStyle;
+import com.alibaba.excel.enums.poi.BorderStyleEnum;
+import com.alibaba.excel.enums.poi.HorizontalAlignmentEnum;
+import com.alibaba.excel.enums.poi.VerticalAlignmentEnum;
+import com.google.gson.JsonObject;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author jianlong
+ * @date 2024-01-29 16:48
+ */
+@Data
+public class AccountExcel implements Serializable {
+
+
+    private String accountId;
+
+    /**
+     * 开户行名称
+     */
+    private String bankName;
+
+    /**
+     * 余额
+     */
+    private String balance;
+
+    private String money;
+
+    private JsonObject profitName;
+}

+ 3 - 0
src/main/java/com/ydtech/modules/inv/model/vo/InvAccountIncoiceQueryVo.java

@@ -32,6 +32,9 @@ public class InvAccountIncoiceQueryVo implements Serializable {
     @ExcelProperty("发票类型")
     private String invoiceType;
 
+    @ApiModelProperty(value = "已转清(0未清,1已清)")
+    private String clearFlag;
+
     private int pageNo;
 
     private int pageSize;

+ 15 - 0
src/main/java/com/ydtech/modules/inv/service/InvAccountOpService.java

@@ -0,0 +1,15 @@
+package com.ydtech.modules.inv.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.inv.model.InvAccountOp;
+
+/**
+ * (InvAccountOp)表服务接口
+ *
+ * @author makejava
+ * @since 2024-01-30 16:00:03
+ */
+public interface InvAccountOpService extends IService<InvAccountOp> {
+
+}
+

+ 3 - 1
src/main/java/com/ydtech/modules/inv/service/InvAccountOperateService.java

@@ -17,5 +17,7 @@ public interface InvAccountOperateService extends IService<InvAccountOperate> {
     HttpResult insert(InvAccountOperate invAccountOperate);
 
 
-    HttpResult insertIncoice(InvAccountOperate invAccountOperate,String bankCardNum);
+
+
+    HttpResult excelAccount(InvAccountOperate accountOperate);
 }

+ 11 - 0
src/main/java/com/ydtech/modules/inv/service/InvAccountProfitService.java

@@ -0,0 +1,11 @@
+package com.ydtech.modules.inv.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.inv.model.InvAccountProfit;
+
+/**
+ * @author jianlong
+ * @date 2024-01-29 16:00
+ */
+public interface InvAccountProfitService extends IService<InvAccountProfit> {
+}

+ 1 - 0
src/main/java/com/ydtech/modules/inv/service/InvAccountService.java

@@ -22,4 +22,5 @@ public interface InvAccountService extends IService<InvAccount> {
 
     HttpResult selectByAccountName();
 
+    HttpResult selectAccountExcel(InvAccountQueryVo invAccountQueryVo);
 }

+ 0 - 19
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountCardServiceImpl.java

@@ -36,7 +36,6 @@ public class InvAccountCardServiceImpl extends ServiceImpl<InvAccountCardMapper,
 
     @Override
     public int insertInsAccountCard(InvAccountCard insAccountCard) {
-        InvAccount byId = invAccountService.getById(insAccountCard.getAccountId());
 
             //插入剩余额度以及笔数
         insAccountCard.setPubYearExcess(insAccountCard.getPubYearLines());
@@ -47,17 +46,6 @@ public class InvAccountCardServiceImpl extends ServiceImpl<InvAccountCardMapper,
         insAccountCard.setPubSingleLines(insAccountCard.getPubSingleLines());
         insAccountCard.setPriSingleLines(insAccountCard.getPriSingleLines());
 
-
-            //计算余额
-            BigDecimal count = new BigDecimal(insAccountCard.getFiscalProfit())
-                    .add(new BigDecimal(insAccountCard.getInsuranceProfit())) //财税公司利润
-                    .add(new BigDecimal(insAccountCard.getInsuranceProfit())) //保险公司回款
-                    .add(new BigDecimal(insAccountCard.getExteriorProfit()))//外部过账金额
-                    .add(new BigDecimal(insAccountCard.getParkProfit()))//园区利润
-                    .add(new BigDecimal(insAccountCard.getTianqinProfit()))//天勤利润
-                    .add(new BigDecimal(insAccountCard.getOtherProfit()))//其他利润
-                    .add(new BigDecimal(insAccountCard.getClearingProfit()));//结算卡
-        insAccountCard.setBalance(String.valueOf(count));
         return invAccountCardMapper.insert(insAccountCard);
     }
 
@@ -78,13 +66,6 @@ public class InvAccountCardServiceImpl extends ServiceImpl<InvAccountCardMapper,
         invAccountCard.setPubYearExcess(null);
         invAccountCard.setPriDayLinesExcess(null);
         invAccountCard.setPriYearExcess(null);
-        invAccountCard.setOtherProfit(null);
-        invAccountCard.setTianqinProfit(null);
-        invAccountCard.setParkProfit(null);
-        invAccountCard.setExteriorProfit(null);
-        invAccountCard.setClearingProfit(null);
-        invAccountCard.setInsuranceProfit(null);
-        invAccountCard.setFiscalProfit(null);
         invAccountCard.setSpend(null);
 
         InvAccountCard oldInvAccountCard = invAccountCardMapper.selectById(invAccountCard.getBankCardNum());

+ 48 - 6
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountExcelServiceImpl.java

@@ -1,9 +1,13 @@
 package com.ydtech.modules.inv.service.impl;
 
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
 import com.ydtech.constants.enums.inv.InvPayMethodEnum;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.PageRequest;
@@ -21,9 +25,10 @@ import com.ydtech.modules.inv.utils.EasyExcelUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.*;
 
 import static com.ydtech.modules.inv.utils.TransferUtils.*;
 
@@ -111,24 +116,61 @@ public class InvAccountExcelServiceImpl extends ServiceImpl<InvAccountExcelMappe
 
             //内部转账操作
             List<InvAccountOperate> list = new ArrayList<>();
+            JSONObject outProfit = invAccountExcel.getOutProfit();
+            JSONObject entProfit = invAccountExcel.getEntProfit();
+            InvAccountExcel out = outJsonUtil(invAccountExcel, outProfit);
+            InvAccountExcel ent = entJsonUtil(invAccountExcel, entProfit);
+
+
             //支出信息
-            list.add(insertOutAccountOperate(invAccountExcel));
+            list.add(insertOutAccountOperate(out));
             //收入信息
-            list.add(insertRevenueAccountOperate(invAccountExcel));
+            list.add(insertRevenueAccountOperate(ent));
+
             if (!insAccountOperateService.saveBatch(list)){
                 throw new RuntimeException("添加转账信息失败");
             }
+            //重新将值赋值回去方便编辑
+            invAccountExcel.setOutProfit(outProfit);
+            invAccountExcel.setEntProfit(entProfit);
         } else {
             //内转外部转账
             List<InvAccountCard> invAccounts = enterDeTransfer(outAccountCard, enterAccountCard, invAccountExcel);
             if (!invAccountCardService.saveBatch(invAccounts)){
                 throw new RuntimeException("添加转账信息失败");
             }
-            insAccountOperateService.save(insertOutAccountOperate(invAccountExcel));
+            JSONObject outProfit = invAccountExcel.getOutProfit();
+            InvAccountExcel out = outJsonUtil(invAccountExcel, outProfit);
+            insAccountOperateService.save(insertOutAccountOperate(out));
+
+            //重新将值赋值回去方便编辑
+            invAccountExcel.setOutProfit(outProfit);
         }
+
+
         return HttpResult.ok("", insAccountExcelMapper.updateById(invAccountExcel));
     }
 
+    private InvAccountExcel outJsonUtil(InvAccountExcel invAccountExcel, JSONObject outProfit) {
+        JSONObject jsonObject = new JSONObject();
+        for (Map.Entry<String, Object> entry : outProfit.entrySet()){
+            BigDecimal multiply = new BigDecimal(String.valueOf(entry.getValue())).multiply(new BigDecimal(invAccountExcel.getApplyAmount())).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP);
+            String string = multiply.negate().toString();
+            jsonObject.put(entry.getKey(), string);
+        }
+        invAccountExcel.setOutProfit(jsonObject);
+        return invAccountExcel;
+    }
+    private InvAccountExcel entJsonUtil(InvAccountExcel invAccountExcel, JSONObject outProfit) {
+        JSONObject jsonObject = new JSONObject();
+        for (Map.Entry<String, Object> entry : outProfit.entrySet()){
+            BigDecimal multiply = new BigDecimal(String.valueOf(entry.getValue())).multiply(new BigDecimal(invAccountExcel.getApplyAmount())).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP);
+            jsonObject.put(entry.getKey(), multiply);
+        }
+        invAccountExcel.setOutProfit(jsonObject);
+        return invAccountExcel;
+    }
+
 
 }
 

+ 145 - 33
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountIncoiceServiceImpl.java

@@ -1,20 +1,18 @@
 package com.ydtech.modules.inv.service.impl;
 
 
-
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
 import com.ydtech.constants.enums.inv.InvoiceTypeEnum;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.inv.dao.InvAccountIncoiceMapper;
-import com.ydtech.modules.inv.model.InvAccountCard;
-import com.ydtech.modules.inv.model.InvAccountIncoice;
-import com.ydtech.modules.inv.model.InvAccountOperate;
+import com.ydtech.modules.inv.model.*;
 import com.ydtech.modules.inv.model.vo.InvAccountIncoiceQueryVo;
-import com.ydtech.modules.inv.service.InvAccountCardService;
-import com.ydtech.modules.inv.service.InvAccountIncoiceService;
-import com.ydtech.modules.inv.service.InvAccountOperateService;
+import com.ydtech.modules.inv.service.*;
 import com.ydtech.modules.inv.utils.EasyExcelUtils;
 import com.ydtech.utils.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -24,7 +22,9 @@ import org.springframework.util.ObjectUtils;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 import static com.ydtech.modules.inv.utils.TransferUtils.*;
 
@@ -43,6 +43,11 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
     private InvAccountCardService invAccountCardService;
     @Autowired
     private InvAccountOperateService invAccountOperateService;
+    @Autowired
+    private InvAccountService invAccountService;
+
+    @Autowired
+    private InvAccountOpService invAccountOpService;
 
     @Value("${upload.file.path}")
     String uploadFilePath;
@@ -51,7 +56,7 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
     public HttpResult insertInvAccountIncoice(InvAccountIncoice invAccountIncoice) {
         BigDecimal tax = getBigDecimal(invAccountIncoice);
         //不含税金额
-        BigDecimal noHasTax  = new BigDecimal(invAccountIncoice.getInvoiceMoney()).subtract(tax);
+        BigDecimal noHasTax = new BigDecimal(invAccountIncoice.getInvoiceMoney()).subtract(tax);
         invAccountIncoice.setNotPayoutMoney(invAccountIncoice.getInvoiceMoney());
 
         //税额
@@ -59,11 +64,12 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
         //不含税金额
         invAccountIncoice.setNoHasTax(tax.toString());
 
-        return  HttpResult.ok(invAccountIncoiceMapper.insert(invAccountIncoice));
+        return HttpResult.ok(invAccountIncoiceMapper.insert(invAccountIncoice));
     }
 
     /**
      * 新增收入
+     *
      * @param invAccountIncoice
      * @return
      */
@@ -71,56 +77,155 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
     public HttpResult updateInvAccountIncoice(InvAccountIncoice invAccountIncoice) {
         InvAccountIncoice invAccountIncoice1 = invAccountIncoiceMapper.selectById(invAccountIncoice.getInvoiceId());
 
-        if(new BigDecimal(invAccountIncoice1.getInvoiceMoney()).subtract(new BigDecimal(invAccountIncoice1.getPayoutMoney()).add(new BigDecimal(invAccountIncoice.getPayoutMoney()))).compareTo(new BigDecimal("0")) < 0){
+        if (new BigDecimal(invAccountIncoice1.getInvoiceMoney()).subtract(new BigDecimal(invAccountIncoice1.getPayoutMoney()).add(new BigDecimal(invAccountIncoice.getPayoutMoney()))).compareTo(new BigDecimal("0")) < 0) {
             throw new SystemException("进账金额大于开票金额");
         }
 
         //进账卡号
-        String bankCardNum = invAccountIncoice1.getBankCardNum();
+        String bankCardNum = invAccountIncoice1.getRevBankCardNum();
         //进账金额
-        String payoutMoney = new BigDecimal(invAccountIncoice.getPayoutMoney()).add(new BigDecimal(invAccountIncoice1.getPayoutMoney())).toString();
-        invAccountIncoice1.setPayoutMoney(payoutMoney);
+        String payoutMoney = new BigDecimal(invAccountIncoice.getPayoutMoney()).toString();
+        invAccountIncoice1.setPayoutMoney(new BigDecimal(invAccountIncoice1.getPayoutMoney()).add(new BigDecimal(payoutMoney)).toString());
         invAccountIncoice1.setNotPayoutMoney(new BigDecimal(invAccountIncoice1.getInvoiceMoney()).subtract(new BigDecimal(payoutMoney)).toString());
         invAccountIncoice1.setPayoutTime(invAccountIncoice.getPayoutTime());
 
+        if (invAccountIncoice1.getNotPayoutMoney().equals("0")) {
+            invAccountIncoice1.setClearFlag("1");
+        }
+
 
         //修改发票增加卡的收入
         InvAccountOperate invAccountOperate = new InvAccountOperate();
         invAccountOperate.setEnterCardId(bankCardNum);
         invAccountOperate.setApplyAmount(payoutMoney);
-        invAccountOperate.setRemark(invAccountIncoice1.getRemark());
         invAccountOperate.setRevenueOutlay("0");
         invAccountOperate.setFundFlow(invAccountIncoice.getFundFlow());
         invAccountOperate.setPayMethod(invAccountIncoice.getPayMethod());
         invAccountOperate.setCompany(invAccountIncoice1.getOtherUnit());
         invAccountOperate.setFundUse(invAccountIncoice.getFundUse());
+        invAccountOperate.setRemark(invAccountIncoice.getRemark());
+        invAccountOperate.setFundFen(invAccountIncoice.getFundFen());
         invAccountOperate.setInvoiceId(invAccountIncoice1.getInvoiceId());
+        //计算收入百分比
+        JSONObject entProfit = invAccountIncoice.getEntProfit();
+        JSONObject jsonObject = new JSONObject();
+        for (Map.Entry<String, Object> entry : entProfit.entrySet()) {
+            BigDecimal multiply = new BigDecimal(String.valueOf(entry.getValue())).multiply(new BigDecimal(invAccountIncoice.getPayoutMoney())).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP);
+            jsonObject.put(entry.getKey(), multiply);
+        }
+        invAccountOperate.setOutProfit(jsonObject);
+        invAccountOperate.setEnterCardId(invAccountIncoice.getRevBankCardNum());
+
+        InvAccount account = invAccountService.getById(invAccountIncoice1.getAccountId());
+        InvAccountCard entCard = invAccountCardService.getById(invAccountIncoice1.getRevBankCardNum());
+        InvAccountCard outCard = invAccountCardService.getById(invAccountIncoice1.getOutBankCardNum());
+
+
+        List<InvAccountOp> list = new ArrayList<>();
+        for (Map.Entry<String, Object> entry:invAccountOperate.getOutProfit().entrySet()){
+            InvAccountOp invAccountOp = new InvAccountOp();
+            invAccountOp.setAccountId(invAccountIncoice1.getAccountId());
+            invAccountOp.setAccountName(account.getAccountName());
+            invAccountOp.setCardNum(entCard.getBankCardNum());
+            invAccountOp.setCardName(entCard.getBankName());
+            invAccountOp.setProfit(entry.getKey());
+            invAccountOp.setMoney(entry.getValue().toString());
+            list.add(invAccountOp);
+        }
 
-        invAccountIncoiceMapper.updateById(invAccountIncoice1);
 
 
-        return  invAccountOperateService.insertIncoice(invAccountOperate,invAccountIncoice1.getBankCardNum());
-    }
+        //支出操作
+        InvAccountOperate outInvAccountOperate = new InvAccountOperate();
+        outInvAccountOperate.setEnterCardId(invAccountIncoice1.getOutBankCardNum());
+        outInvAccountOperate.setApplyAmount(payoutMoney);
+        outInvAccountOperate.setRevenueOutlay("1");
+        outInvAccountOperate.setFundFlow(invAccountIncoice.getFundFlow());
+        outInvAccountOperate.setPayMethod(invAccountIncoice.getPayMethod());
+        outInvAccountOperate.setCompany(invAccountIncoice1.getOtherUnit());
+        outInvAccountOperate.setFundUse(invAccountIncoice.getFundUse());
+        outInvAccountOperate.setFundFen(invAccountIncoice.getFundFen());
+        outInvAccountOperate.setRemark(invAccountIncoice.getRemark());
+        outInvAccountOperate.setInvoiceId(invAccountIncoice1.getInvoiceId());
+        //计算支出百分比
+        JSONObject outProfit = invAccountIncoice.getOutProfit();
+        JSONObject outJsonObject = new JSONObject();
+        for (Map.Entry<String, Object> entry : outProfit.entrySet()) {
+            BigDecimal multiply = new BigDecimal(String.valueOf(entry.getValue())).multiply(new BigDecimal(invAccountIncoice.getPayoutMoney())).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP);
+            outJsonObject.put(entry.getKey(), multiply.negate());
+        }
+        outInvAccountOperate.setOutProfit(outJsonObject);
+        invAccountOperate.setEnterCardId(invAccountIncoice.getOutBankCardNum());
+
+        List<InvAccountOperate> invAccountOperateList = new ArrayList<>();
+        invAccountOperateList.add(outInvAccountOperate);
+        invAccountOperateList.add(invAccountOperate);
+
+
+        for (Map.Entry<String, Object> entry:outInvAccountOperate.getOutProfit().entrySet()){
+            InvAccountOp invAccountOp = new InvAccountOp();
+            invAccountOp.setAccountId(invAccountIncoice1.getAccountId());
+            invAccountOp.setAccountName(account.getAccountName());
+            invAccountOp.setCardNum(outCard.getBankCardNum());
+            invAccountOp.setCardName(outCard.getBankName());
+            invAccountOp.setProfit(entry.getKey());
+            invAccountOp.setMoney(entry.getValue().toString());
+            list.add(invAccountOp);
+        }
 
 
+        invAccountOpService.saveBatch(list);
+
+
+        //支出卡号
+        String outBankCardNum = invAccountIncoice1.getOutBankCardNum();
+        //支出账户
+        InvAccountCard outInvAccountCard = invAccountCardService.getById(outBankCardNum);
+        //收入账户
+        InvAccountCard revInvAccountCard = invAccountCardService.getById(bankCardNum);
+        if (outInvAccountCard == null || revInvAccountCard == null) {
+            throw new SystemException("支出账户或收入账户为空");
+        }
+        //判断收款方是内部还是外部
+        InvAccount revInvAccount = invAccountService.getById(revInvAccountCard.getAccountId());
+
+        //转账
+        if (revInvAccount.getOuterFlag().equals("0")) {
+            InvAccountExcel invAccountExcel = new InvAccountExcel();
+            invAccountExcel.setApplyAmount(invAccountIncoice.getPayoutMoney());
+            List<InvAccountCard> invAccountCards = insideTransfer(outInvAccountCard, revInvAccountCard, invAccountExcel);
+            invAccountCardService.updateBatchById(invAccountCards);
+            invAccountOperateService.saveBatch(invAccountOperateList);
+
+        } else {
+            InvAccountExcel invAccountExcel = new InvAccountExcel();
+            invAccountExcel.setOutAccountQuality(revInvAccount.getOuterFlag());
+            invAccountExcel.setApplyAmount(invAccountIncoice.getPayoutMoney());
+            List<InvAccountCard> invAccountCards = enterDeTransfer(outInvAccountCard, revInvAccountCard, invAccountExcel);
+            invAccountCardService.updateBatchById(invAccountCards);
+            invAccountOperateService.saveBatch(invAccountOperateList);
+        }
+
+
+        return HttpResult.ok(invAccountIncoiceMapper.updateById(invAccountIncoice1));
+    }
 
 
     private static BigDecimal getBigDecimal(InvAccountIncoice invAccountIncoice) {
-        if (invAccountIncoice.getRate().isEmpty()){
+        if (invAccountIncoice.getRate().isEmpty()) {
             throw new SystemException("请填写税率");
         }
 
-        if (invAccountIncoice.getInvoiceMoney().isEmpty()){
+        if (invAccountIncoice.getInvoiceMoney().isEmpty()) {
             throw new SystemException("请填写开票金额");
         }
-        if (invAccountIncoice.getPayoutMoney().isEmpty()){
+        if (invAccountIncoice.getPayoutMoney().isEmpty()) {
             throw new SystemException("请填写进账金额");
         }
         //税率百分数转为小数
         BigDecimal divide = new BigDecimal(invAccountIncoice.getRate()).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP);
         //税额
-        BigDecimal tax = new BigDecimal(invAccountIncoice.getInvoiceMoney()).divide((divide.add(new BigDecimal("1"))), 2, RoundingMode.HALF_UP);
-        return tax;
+        return new BigDecimal(invAccountIncoice.getInvoiceMoney()).divide((divide.add(new BigDecimal("1"))), 2, RoundingMode.HALF_UP);
     }
 
     @Override
@@ -128,23 +233,30 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
         //发票信息
         InvAccountIncoice enInvAccountIncoice = invAccountIncoiceMapper.selectById(invAccountIncoice.getInvoiceId());
         //回滚收入
-        InvAccountCard enterAccount = invAccountCardService.getById(enInvAccountIncoice.getBankCardNum());
+        InvAccountCard enterAccount = invAccountCardService.getById(enInvAccountIncoice.getRevBankCardNum());
+        InvAccountCard outAccount = invAccountCardService.getById(enInvAccountIncoice.getOutBankCardNum());
 
         //新增收入回滚操作
-        InvAccountCard invAccount = quashOutsideTransfer(enterAccount, enInvAccountIncoice);
+        List<InvAccountCard> invAccount = quashOutsideTransfer(outAccount, enterAccount, enInvAccountIncoice);
         InvAccountOperate invAccountOperate = new InvAccountOperate();
         invAccountOperate.setRevenueOutlay("1");
         invAccountOperate.setApplyAmount("发票撤销 收入撤销");
         invAccountOperate.setCompany(enInvAccountIncoice.getInvoiceBy());
 
         LambdaQueryWrapper<InvAccountOperate> lambdaQuery = new LambdaQueryWrapper<>();
+
         lambdaQuery.eq(InvAccountOperate::getInvoiceId, invAccountIncoice.getInvoiceId());
 
+        LambdaQueryWrapper<InvAccountOperate> lambdaQuery1 = new LambdaQueryWrapper<>();
+
+        lambdaQuery1.eq(InvAccountOperate::getInvoiceId, invAccountIncoice.getInvoiceId());
+
         try {
             invAccountIncoiceMapper.updateById(invAccountIncoice);
-            invAccountCardService.updateById(invAccount);
+            invAccountCardService.updateBatchById(invAccount);
             invAccountOperateService.remove(lambdaQuery);
-        }catch (Exception e){
+            invAccountOperateService.remove(lambdaQuery1);
+        } catch (Exception e) {
             return HttpResult.error("撤销失败");
         }
 
@@ -161,7 +273,7 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
                 .eq(InvAccountIncoice::getDelFlag, "0")
                 .eq(!StringUtils.isEmpty(invAccountIncoiceQueryVo.getInvoiceType()), InvAccountIncoice::getInvoiceType,
                         invAccountIncoiceQueryVo.getInvoiceType())
-                .like(!StringUtils.isEmpty(invAccountIncoiceQueryVo.getOtherUnit()), InvAccountIncoice::getOtherUnit,invAccountIncoiceQueryVo.getOtherUnit());
+                .like(!StringUtils.isEmpty(invAccountIncoiceQueryVo.getOtherUnit()), InvAccountIncoice::getOtherUnit, invAccountIncoiceQueryVo.getOtherUnit());
 
 
         if (!ObjectUtils.isEmpty(invAccountIncoiceQueryVo.getInvoiceTime())) {
@@ -171,20 +283,20 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
 
         //解决时间格式报错问题
         invAccountIncoices.forEach(invAccountIncoice -> {
-            if (invAccountIncoice.getPayoutTime() != null){
+            if (invAccountIncoice.getPayoutTime() != null) {
                 invAccountIncoice.setPayoutDate(invAccountIncoice.getPayoutTime().toString());
             }
-            if (invAccountIncoice.getInvoiceTime() != null){
+            if (invAccountIncoice.getInvoiceTime() != null) {
                 invAccountIncoice.setInvoiceDate(invAccountIncoice.getInvoiceTime().toString());
             }
-            if (invAccountIncoice.getInvoiceType() != null){
+            if (invAccountIncoice.getInvoiceType() != null) {
                 invAccountIncoice.setInvoiceType(InvoiceTypeEnum.getNameByCode(invAccountIncoice.getInvoiceType()));
             }
-            if (invAccountIncoice.getRate() != null){
-                invAccountIncoice.setRate(invAccountIncoice.getRate()+"%");
+            if (invAccountIncoice.getRate() != null) {
+                invAccountIncoice.setRate(invAccountIncoice.getRate() + "%");
             }
         });
-        return EasyExcelUtils.downExcel(uploadFilePath,InvAccountIncoice.class,invAccountIncoices);
+        return EasyExcelUtils.downExcel(uploadFilePath, InvAccountIncoice.class, invAccountIncoices);
     }
 
 }

+ 19 - 0
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountOpServiceImpl.java

@@ -0,0 +1,19 @@
+package com.ydtech.modules.inv.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.inv.dao.InvAccountOpMapper;
+import com.ydtech.modules.inv.model.InvAccountOp;
+import com.ydtech.modules.inv.service.InvAccountOpService;
+import org.springframework.stereotype.Service;
+
+/**
+ * (InvAccountOp)表服务实现类
+ *
+ * @author makejava
+ * @since 2024-01-30 16:00:03
+ */
+@Service("invAccountOpService")
+public class InvAccountOpServiceImpl extends ServiceImpl<InvAccountOpMapper, InvAccountOp> implements InvAccountOpService {
+
+}
+

+ 63 - 21
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountOperateServiceImpl.java

@@ -7,18 +7,19 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.constants.enums.inv.InvPayMethodEnum;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.PageRequest;
-import com.ydtech.modules.inv.model.InvAccount;
-import com.ydtech.modules.inv.model.InvAccountCard;
-import com.ydtech.modules.inv.model.InvAccountExcel;
-import com.ydtech.modules.inv.model.InvAccountOperate;
-import com.ydtech.modules.inv.service.InvAccountCardService;
-import com.ydtech.modules.inv.service.InvAccountOperateService;
+import com.ydtech.modules.inv.model.*;
+import com.ydtech.modules.inv.service.*;
 import com.ydtech.modules.inv.dao.InvAccountOperateMapper;
-import com.ydtech.modules.inv.service.InvAccountService;
+import com.ydtech.modules.inv.utils.EasyExcelUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 import static com.ydtech.modules.inv.utils.TransferUtils.outsideTransfer;
 
@@ -35,11 +36,21 @@ public class InvAccountOperateServiceImpl extends ServiceImpl<InvAccountOperateM
     private InvAccountOperateMapper insAccountOperateMapper;
 
     @Autowired
-    private InvAccountService insAccountService;
+    private InvAccountOpService invAccountOpService;
 
     @Autowired
     private InvAccountCardService invAccountCardService;
 
+    @Autowired
+    private InvAccountService invAccountService;
+
+    @Autowired
+    private InvAccountProfitService invAccountProfitService;
+
+
+    @Value("${upload.file.path}")
+    String uploadFilePath;
+
     /**
      * 查询操作列表
      *
@@ -77,32 +88,63 @@ public class InvAccountOperateServiceImpl extends ServiceImpl<InvAccountOperateM
     public HttpResult insert(InvAccountOperate invAccountOperate) {
         InvAccountCard enterAccount = invAccountCardService.getById(invAccountOperate.getEnterCardId());
         InvAccountCard invAccount = outsideTransfer(enterAccount, invAccountOperate);
+        InvAccount account = invAccountService.getById(invAccount.getAccountId());
 
         if (!invAccountCardService.updateById(invAccount)){
 
             return HttpResult.error("新增收入失败");
         }
+        invAccountOperate.setCreateTime(LocalDateTime.now());
         insAccountOperateMapper.insert(invAccountOperate);
+        List<InvAccountOp> list = new ArrayList<>();
+        for (Map.Entry<String, Object> entry:invAccountOperate.getOutProfit().entrySet()){
+            InvAccountOp invAccountOp = new InvAccountOp();
+            invAccountOp.setAccountId(enterAccount.getAccountId());
+            invAccountOp.setAccountName(account.getAccountName());
+            invAccountOp.setCardNum(invAccount.getBankCardNum());
+            invAccountOp.setCardName(invAccount.getBankName());
+            invAccountOp.setProfit(entry.getKey());
+            invAccountOp.setMoney(entry.getValue().toString());
+            list.add(invAccountOp);
+        }
+        invAccountOpService.saveBatch(list);
         return HttpResult.ok("新增收入成功");
     }
 
-    /**
-     * 外部转内部
-     * @param invAccountOperate
-     * @return
-     */
     @Override
-    public HttpResult insertIncoice(InvAccountOperate invAccountOperate,String bankCardNum) {
-        InvAccountCard enterAccount = invAccountCardService.getById(invAccountOperate.getEnterCardId());
-        InvAccountCard invAccount = outsideTransfer(enterAccount, invAccountOperate);
+    public HttpResult excelAccount(InvAccountOperate accountOperate) {
+        List<InvAccountOperate> invAccountOperates = insAccountOperateMapper.selectInsAccountOperateList(accountOperate);
+        List<InvAccountProfit> list = invAccountProfitService.list();
 
-        if (!invAccountCardService.updateById(invAccount)){
 
-            return HttpResult.error("新增收入失败");
+
+
+
+        for (InvAccountOperate record:invAccountOperates){
+            StringBuilder a = new StringBuilder();
+            if (record.getPayMethod() != null){
+                String[] split = record.getPayMethod().split(",");
+                for (String i : split) {
+                    a.append(InvPayMethodEnum.getNameByCode(i)).append(",");
+                }
+                record.setPayMethod(a.toString());
+            }
+            if (record.getOutProfit()!=null) {
+                StringBuffer buffer = new StringBuffer();
+                for (Map.Entry<String, Object> entry : record.getOutProfit().entrySet()){
+
+                    list.forEach(invAccountProfit -> {
+                        if (invAccountProfit.getProfitEng().equals(entry.getKey())) {
+                            buffer.append(invAccountProfit.getProfitName()).append(" ");
+                        }
+                    });
+
+                }
+                record.setPlate(buffer.toString());
+            }
         }
-        invAccount.setBankCardNum(bankCardNum);
-        insAccountOperateMapper.insert(invAccountOperate);
-        return HttpResult.ok("新增收入成功");
+
+        return HttpResult.ok("", EasyExcelUtils.downExcel(uploadFilePath, InvAccountOperate.class, invAccountOperates));
     }
 
 }

+ 43 - 9
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountServiceImpl.java

@@ -6,17 +6,25 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.PageRequest;
 import com.ydtech.modules.inv.dao.InvAccountMapper;
-import com.ydtech.modules.inv.model.InvAccount;
+import com.ydtech.modules.inv.dao.InvAccountOperateMapper;
+import com.ydtech.modules.inv.model.*;
+import com.ydtech.modules.inv.model.excel.AccountExcel;
 import com.ydtech.modules.inv.model.vo.InvAccountQueryVo;
+import com.ydtech.modules.inv.service.InvAccountCardService;
+import com.ydtech.modules.inv.service.InvAccountOpService;
+import com.ydtech.modules.inv.service.InvAccountProfitService;
 import com.ydtech.modules.inv.service.InvAccountService;
+import com.ydtech.modules.inv.utils.EasyExcelUtils;
 import com.ydtech.modules.inv.utils.LocalDateTimeUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.temporal.TemporalAdjusters;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
 import java.util.stream.Collectors;
@@ -33,6 +41,15 @@ public class InvAccountServiceImpl extends ServiceImpl<InvAccountMapper, InvAcco
     @Autowired
     private InvAccountMapper insAccountMapper;
 
+    @Autowired
+    private InvAccountProfitService invAccountProfitService;
+
+    @Autowired
+    private InvAccountOpService invAccountOpService;
+
+    @Value("${upload.file.path}")
+    String uploadFilePath;
+
     /**
      * 分页查询
      *
@@ -62,10 +79,13 @@ public class InvAccountServiceImpl extends ServiceImpl<InvAccountMapper, InvAcco
                         .filter(ord -> Objects.equals(rel.getAccountId(), ord.getAccountId()))
                         .findFirst()
                         .map(ord -> {
-                            if (ord.getInvoicingAmountExcess() != null){
+                            if (ord.getInvoicingAmountExcess() != null) {
+
                                 rel.setQuarterAmountExcess(new BigDecimal("300000").subtract(new BigDecimal("5000000").subtract(new BigDecimal(ord.getInvoicingAmountExcess()))).toString());
-                            }else{
-                                rel.setQuarterAmountExcess("300000");
+                            } else {
+                                if (!rel.getBusinessQuality().equals("0")) {
+                                    rel.setQuarterAmountExcess("300000");
+                                }
                             }
                             return rel;
                         }).orElse(null)
@@ -79,7 +99,9 @@ public class InvAccountServiceImpl extends ServiceImpl<InvAccountMapper, InvAcco
                         .findFirst()
                         .map(ord -> {
                             if (ord.getSumInvoicingAmount() != null) {
+
                                 rel.setSumInvoicingAmount(new BigDecimal(ord.getSumInvoicingAmount()).add(new BigDecimal(ord.getSumInvoicingAmount())).toString());
+
                             }
                             return rel;
                         }).orElse(null)
@@ -87,17 +109,22 @@ public class InvAccountServiceImpl extends ServiceImpl<InvAccountMapper, InvAcco
 
 
         collect1.forEach(invAccount -> {
-            if (invAccount != null){
+            if (invAccount != null) {
                 if (invAccount.getInvAccountCardList().size() < 2) {
                     if (invAccount.getInvAccountCardList().get(0).getBankCardNum() == null) {
                         invAccount.setInvAccountCardList(null);
                     }
                 }
+                if (invAccount.getBusinessQuality().equals("3")) {
+                    invAccount.setQuarterAmountExcess(null);
+                    invAccount.setSumInvoicingAmount(null);
+                    invAccount.setInvoicingAmountExcess(null);
+                }
             }
         });
         IPage ipage = PageRequest.buildPageRequest(pageRequest);
-        ipage.setRecords(collect1.stream().skip((invAccountQueryVo.getPageNo()-1)*invAccountQueryVo.getPageSize()).limit(invAccountQueryVo.getPageSize()).
-                        collect(Collectors.toList()));
+        ipage.setRecords(collect1.stream().skip((invAccountQueryVo.getPageNo() - 1) * invAccountQueryVo.getPageSize()).limit(invAccountQueryVo.getPageSize()).
+                collect(Collectors.toList()));
         ipage.setTotal(collect1.size());
 
 
@@ -105,8 +132,6 @@ public class InvAccountServiceImpl extends ServiceImpl<InvAccountMapper, InvAcco
     }
 
 
-
-
     /**
      * 根据户名分类
      *
@@ -131,6 +156,15 @@ public class InvAccountServiceImpl extends ServiceImpl<InvAccountMapper, InvAcco
         return HttpResult.error("查询错误");
     }
 
+    @Override
+    public HttpResult selectAccountExcel(InvAccountQueryVo invAccountQueryVo) {
+        List<InvAccount> insAccounts = insAccountMapper.selectAccountsList(invAccountQueryVo);
+        List<InvAccountProfit> invAccountProfitList = invAccountProfitService.list();
+        List<InvAccountOp> list = invAccountOpService.list();
+        String s = EasyExcelUtils.noModelWrite(uploadFilePath, invAccountProfitList, insAccounts, list);
+        return HttpResult.ok("",s);
+    }
+
 }
 
 

+ 18 - 0
src/main/java/com/ydtech/modules/inv/service/impl/invAccountProfitServiceImpl.java

@@ -0,0 +1,18 @@
+package com.ydtech.modules.inv.service.impl;
+
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.inv.dao.invAccountProfitMapper;
+import com.ydtech.modules.inv.model.InvAccountProfit;
+import com.ydtech.modules.inv.service.InvAccountProfitService;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * @author jianlong
+ * @date 2024-01-29 16:00
+ */
+@Service
+public class invAccountProfitServiceImpl extends ServiceImpl<invAccountProfitMapper, InvAccountProfit>
+        implements InvAccountProfitService {
+}

+ 64 - 2
src/main/java/com/ydtech/modules/inv/utils/EasyExcelUtils.java

@@ -1,9 +1,10 @@
 package com.ydtech.modules.inv.utils;
 
 import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.util.ListUtils;
 import com.alibaba.excel.write.builder.ExcelWriterBuilder;
 import com.ydtech.constants.enums.inv.InvPayMethodEnum;
-import com.ydtech.modules.inv.model.InvAccountExcel;
+import com.ydtech.modules.inv.model.*;
 import com.ydtech.modules.inv.model.excel.InvSettlementSourceExcel;
 import com.ydtech.modules.inv.model.excel.InvSourceExcel;
 import com.ydtech.modules.inv.service.InvAccountExcelService;
@@ -12,6 +13,7 @@ import com.ydtech.modules.inv.utils.excel.InvSourceDataListener;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
@@ -34,6 +36,67 @@ public class EasyExcelUtils {
         return file;
     }
 
+    /**
+     * 不创建对象的写
+     */
+    public static String noModelWrite(String uploadFilePath, List<InvAccountProfit> invAccountProfitList, List<InvAccount> invAccounts, List<InvAccountOp> invAccountOpList) {
+        // 写法1
+        String file = System.currentTimeMillis() + ".xlsx";
+        String fileName = uploadFilePath + file;
+        // 这里 需要指定写用哪个class去写,然后写到第一个sheet,名字为模板 然后文件流会自动关闭
+        EasyExcel.write(fileName).head(head(invAccountProfitList)).sheet("1").doWrite(dataList(invAccounts, invAccountOpList, invAccountProfitList));
+        return file;
+    }
+
+    private static List<List<String>> head(List<InvAccountProfit> invAccountProfitList) {
+        List<List<String>> list = new ArrayList<>(3 + invAccountProfitList.size());
+        List<String> head1 = ListUtils.newArrayList();
+        head1.add("户名");
+        List<String> head2 = ListUtils.newArrayList();
+        head2.add("开户银行");
+        List<String> head3 = ListUtils.newArrayList();
+        head3.add("银行卡余额");
+        list.add(0, head1);
+        list.add(1, head2);
+        list.add(2, head3);
+        invAccountProfitList.forEach(invAccountProfit -> {
+            List<String> head0 = ListUtils.newArrayList();
+            head0.add(invAccountProfit.getProfitName());
+            list.add(head0);
+        });
+
+
+        return list;
+    }
+
+    private static List<List<Object>> dataList(List<InvAccount> invAccounts, List<InvAccountOp> invAccountOpList, List<InvAccountProfit> invAccountProfitList) {
+        List<List<Object>> list = ListUtils.newArrayList();
+        invAccounts.forEach(invAccount -> {
+            List<Object> data = ListUtils.newArrayList();
+            invAccount.getInvAccountCardList().forEach(invAccountCard -> {
+                if (invAccountCard.getBankCardNum() != null) {
+                    data.add(invAccount.getAccountName());
+                    data.add(invAccountCard.getBankName());
+                    data.add(invAccountCard.getBalance());
+
+                    invAccountProfitList.forEach(invAccountProfitList1 -> {
+                        String a = "0";
+                        for (InvAccountOp invAccountProfit :  invAccountOpList){
+                            if (invAccountProfitList1.getProfitEng().equals(invAccountProfit.getProfit())&&invAccountCard.getBankCardNum().equals(invAccountProfit.getCardNum())) {
+                                a = new BigDecimal(a).add(new BigDecimal(invAccountProfit.getMoney())).toString();
+                            }
+                        }
+                        data.add(a);
+                    });
+                    list.add(data);
+                }
+            });
+
+        });
+        return list;
+    }
+
+
     public static String downExcel(String uploadFilePath, String fileName, Class clz, List<?> list) {
 
         String file = fileName + System.currentTimeMillis() + ".xlsx";
@@ -79,7 +142,6 @@ public class EasyExcelUtils {
                 String file = date.getTime() + ".xlsx";
                 String fileName = uploadFilePath + file;
                 excel.setExcelApplyTime(new SimpleDateFormat("yyyy-MM-dd").format(excel.getApplyTime()));
-                excel.setRemark(excel.getRemark());
                 String payMethod = excel.getPayMethod();
                 String[] split = payMethod.split(",");
                 StringBuilder a = new StringBuilder();

+ 59 - 74
src/main/java/com/ydtech/modules/inv/utils/TransferUtils.java

@@ -1,11 +1,15 @@
 package com.ydtech.modules.inv.utils;
 
+import com.alibaba.fastjson.JSONObject;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.inv.model.*;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 转账工具类
@@ -20,9 +24,17 @@ public class TransferUtils {
     public static InvAccountOperate insertOutAccountOperate(InvAccountExcel insAccountExcel) {
         //支出公司
         InvAccountOperate insAccountOperate = new InvAccountOperate();
-        operate(insAccountExcel, insAccountOperate);
-        insAccountOperate.setRevenueOutlay("1");
-        return insAccountOperate;
+        InvAccountOperate operate = operate(insAccountExcel, insAccountOperate);
+        operate.setRevenueOutlay("1");
+        JSONObject outProfit = insAccountExcel.getOutProfit();
+        for (Map.Entry<String, Object> entry : outProfit.entrySet()){
+            outProfit.put(entry.getKey(), new BigDecimal(String.valueOf(entry.getValue())).negate().toString());
+        }
+        operate.setOutProfit(outProfit);
+        operate.setCreateTime(LocalDateTime.now());
+        operate.setRemark(insAccountExcel.getRemark());
+        operate.setOutCardNum(insAccountExcel.getOutCardNum());
+        return operate;
     }
 
     /**
@@ -31,12 +43,16 @@ public class TransferUtils {
     public static InvAccountOperate insertRevenueAccountOperate(InvAccountExcel insAccountExcel) {
         //支出公司
         InvAccountOperate insAccountOperate = new InvAccountOperate();
-        operate(insAccountExcel, insAccountOperate);
-        insAccountOperate.setRevenueOutlay("0");
-        return insAccountOperate;
+        InvAccountOperate operate = operate(insAccountExcel, insAccountOperate);
+        operate.setRevenueOutlay("0");
+        operate.setEntProfit(insAccountExcel.getEntProfit());
+        operate.setCreateTime(LocalDateTime.now());
+        operate.setRemark(insAccountExcel.getRemark());
+        operate.setEnterCardNum(insAccountExcel.getEnterCardNum());
+        return operate;
     }
 
-    private static void operate(InvAccountExcel invAccountExcel, InvAccountOperate invAccountOperate) {
+    private static InvAccountOperate operate(InvAccountExcel invAccountExcel, InvAccountOperate invAccountOperate) {
         invAccountOperate.setApplicant(invAccountExcel.getApplicant());
         invAccountOperate.setApplySector(invAccountExcel.getApplySector());
         invAccountOperate.setApplyTime(invAccountExcel.getApplyTime());
@@ -44,10 +60,11 @@ public class TransferUtils {
         invAccountOperate.setFundFlow(invAccountExcel.getFundFlow());
         invAccountOperate.setFundUse(invAccountExcel.getFundUse());
         invAccountOperate.setPayMethod(invAccountExcel.getPayMethod());
-        invAccountOperate.setRemark(invAccountExcel.getRemark());
         invAccountOperate.setCompany(invAccountExcel.getCompany());
         invAccountOperate.setApplyAmount(invAccountExcel.getApplyAmount());
         invAccountOperate.setBigApplyAmount(invAccountExcel.getBigApplyAmount());
+        invAccountOperate.setFundFen(invAccountExcel.getFundFen());
+        return invAccountOperate;
     }
 
     /**
@@ -75,23 +92,30 @@ public class TransferUtils {
             //转出账户现支出金额
             BigDecimal outAccountSpend = new BigDecimal(outAccountCard.getSpend());
 
+            BigDecimal outAccountBalance = new BigDecimal(outAccountCard.getBalance());
+
+            if (outAccountBalance.compareTo(insAccountExcelApplyAmount) < 0) {
+                //转出账户余额不足
+                throw new SystemException("转出账户余额不足");
+            }
+
+
             if (enterAccountCard.getAccountQuality().equals("0")) {
                 //公户操作
                 if (pubSingleLines.compareTo(insAccountExcelApplyAmount) > 0){
                     //收入方增加余额
-                    String remark = invAccountExcel.getRemark();
 
                     list.add(pubAccountUtils(dayStrokeNumExcess,pubDayLinesExcess,pubYearExcess,insAccountExcelApplyAmount,outAccountCard,outAccountSpend));
-                    list.add(enterAccountUtils(remark, enterAccountCard, insAccountExcelApplyAmount));
+                    list.add(enterAccountUtils( enterAccountCard, insAccountExcelApplyAmount));
                     return list;
                 }
                 throw new SystemException("公户转账金额超出单笔限额");
             } else {
                 if(priSingleLines.compareTo(insAccountExcelApplyAmount) > 0){
                     //私户操作
-                    String remark = invAccountExcel.getRemark();
+
                     list.add(priAccountUtils(dayStrokeNumExcess,priDayLinesExcess,insAccountExcelApplyAmount, priYearExcess,outAccountSpend,outAccountCard));
-                    list.add(enterAccountUtils(remark, enterAccountCard, insAccountExcelApplyAmount));
+                    list.add(enterAccountUtils( enterAccountCard, insAccountExcelApplyAmount));
 
                     return list;
                 }
@@ -106,27 +130,30 @@ public class TransferUtils {
      * 外部转内部方法
      */
     public static InvAccountCard outsideTransfer(InvAccountCard enterAccountCard, InvAccountOperate invAccountOperate) {
-        if (enterAccountCard == null && invAccountOperate == null) {
+        if (enterAccountCard == null || invAccountOperate == null) {
             throw new SystemException("收入账户为空");
         }
-        String remark = invAccountOperate.getRemark();
+
         BigDecimal applyAmount = new BigDecimal(invAccountOperate.getApplyAmount());
 
-        return enterAccountUtils(remark, enterAccountCard, applyAmount);
+        return enterAccountUtils(enterAccountCard, applyAmount);
     }
 
 
     /**
      * 撤销发票方法
      */
-    public static InvAccountCard quashOutsideTransfer(InvAccountCard enterAccountCard, InvAccountIncoice invAccountIncoice) {
-        if (enterAccountCard == null && invAccountIncoice == null) {
+    public static List<InvAccountCard> quashOutsideTransfer(InvAccountCard outAccountCard,InvAccountCard enterAccountCard, InvAccountIncoice invAccountIncoice) {
+        if (enterAccountCard == null || invAccountIncoice == null) {
             throw new SystemException("账户为空");
         }
-        String remark = invAccountIncoice.getRemark();
-        BigDecimal applyAmount = new BigDecimal(invAccountIncoice.getInvoiceMoney());
 
-        return enterAccountBreakUtils(remark, enterAccountCard, applyAmount);
+
+        BigDecimal applyAmount = new BigDecimal(invAccountIncoice.getInvoiceMoney());
+        List<InvAccountCard> list = new ArrayList<>();
+        list.add(enterAccountBreakUtils(enterAccountCard, applyAmount));
+        list.add(outAccountBreakUtils(outAccountCard, applyAmount));
+        return list;
     }
 
     /**
@@ -170,36 +197,7 @@ public class TransferUtils {
      *
      * @return
      */
-    private static InvAccountCard enterAccountUtils(String remark, InvAccountCard enterAccountCard, BigDecimal invAccountExcelApplyAmount) {
-        if (remark.isEmpty()){
-            throw new SystemException("备注不能为空");
-        }
-        if (enterAccountCard == null){
-            throw new SystemException("收入账户为空");
-        }
-        switch (remark) {
-            case "0":
-                enterAccountCard.setInsuranceProfit(new BigDecimal(enterAccountCard.getInsuranceProfit()).add(invAccountExcelApplyAmount).toString());
-                break;
-            case "1":
-                enterAccountCard.setClearingProfit(new BigDecimal(enterAccountCard.getClearingProfit()).add(invAccountExcelApplyAmount).toString());
-                break;
-            case "2":
-                enterAccountCard.setTianqinProfit(new BigDecimal(enterAccountCard.getTianqinProfit()).add(invAccountExcelApplyAmount).toString());
-                break;
-            case "3":
-                enterAccountCard.setParkProfit(new BigDecimal(enterAccountCard.getParkProfit()).add(invAccountExcelApplyAmount).toString());
-                break;
-            case "4":
-                enterAccountCard.setOtherProfit(new BigDecimal(enterAccountCard.getOtherProfit()).add(invAccountExcelApplyAmount).toString());
-                break;
-            case "5":
-                enterAccountCard.setFiscalProfit(new BigDecimal(enterAccountCard.getFiscalProfit()).add(invAccountExcelApplyAmount).toString());
-                break;
-            case "6":
-                enterAccountCard.setExteriorProfit(new BigDecimal(enterAccountCard.getExteriorProfit()).add(invAccountExcelApplyAmount).toString());
-                break;
-        }
+    private static InvAccountCard enterAccountUtils(InvAccountCard enterAccountCard, BigDecimal invAccountExcelApplyAmount) {
         enterAccountCard.setBalance(new BigDecimal(enterAccountCard.getBalance()).add(invAccountExcelApplyAmount).toString());
         return enterAccountCard;
     }
@@ -211,34 +209,21 @@ public class TransferUtils {
      *
      * @return
      */
-    private static InvAccountCard enterAccountBreakUtils(String remark, InvAccountCard enterAccountCard, BigDecimal invAccountExcelApplyAmount) {
-        switch (remark) {
-            case "0":
-                enterAccountCard.setInsuranceProfit(new BigDecimal(enterAccountCard.getInsuranceProfit()).subtract(invAccountExcelApplyAmount).toString());
-                break;
-            case "1":
-                enterAccountCard.setClearingProfit(new BigDecimal(enterAccountCard.getClearingProfit()).subtract(invAccountExcelApplyAmount).toString());
-                break;
-            case "2":
-                enterAccountCard.setTianqinProfit(new BigDecimal(enterAccountCard.getTianqinProfit()).subtract(invAccountExcelApplyAmount).toString());
-                break;
-            case "3":
-                enterAccountCard.setParkProfit(new BigDecimal(enterAccountCard.getParkProfit()).subtract(invAccountExcelApplyAmount).toString());
-                break;
-            case "4":
-                enterAccountCard.setOtherProfit(new BigDecimal(enterAccountCard.getOtherProfit()).subtract(invAccountExcelApplyAmount).toString());
-                break;
-            case "5":
-                enterAccountCard.setFiscalProfit(new BigDecimal(enterAccountCard.getFiscalProfit()).subtract(invAccountExcelApplyAmount).toString());
-                break;
-            case "6":
-                enterAccountCard.setExteriorProfit(new BigDecimal(enterAccountCard.getExteriorProfit()).subtract(invAccountExcelApplyAmount).toString());
-                break;
-        }
+    private static InvAccountCard enterAccountBreakUtils(InvAccountCard enterAccountCard, BigDecimal invAccountExcelApplyAmount) {
         enterAccountCard.setBalance(new BigDecimal(enterAccountCard.getBalance()).subtract(invAccountExcelApplyAmount).toString());
         return enterAccountCard;
     }
 
+    /**
+     * 支出方回滚利润方法
+     *
+     * @return
+     */
+    private static InvAccountCard outAccountBreakUtils(InvAccountCard enterAccountCard, BigDecimal invAccountExcelApplyAmount) {
+        enterAccountCard.setBalance(new BigDecimal(enterAccountCard.getBalance()).add(invAccountExcelApplyAmount).toString());
+        return enterAccountCard;
+    }
+
     /**
      * 公户扣除余额方法
      */

+ 34 - 0
src/main/resources/mapper/modules/InvAccountOpDao.xml

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ydtech.modules.inv.dao.InvAccountOpMapper">
+
+    <resultMap type="com.ydtech.modules.inv.model.InvAccountOp" id="InvAccountOpMap">
+        <result property="id" column="id" jdbcType="INTEGER"/>
+        <result property="accountName" column="account_name" jdbcType="VARCHAR"/>
+        <result property="accountId" column="account_id" jdbcType="VARCHAR"/>
+        <result property="cardName" column="card_name" jdbcType="VARCHAR"/>
+        <result property="cardNum" column="card_num" jdbcType="VARCHAR"/>
+        <result property="profit" column="profit" jdbcType="VARCHAR"/>
+        <result property="money" column="money" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <!-- 批量插入 -->
+    <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
+        insert into zgdd.inv_account_op(account_nameaccount_idcard_namecard_numprofitmoney)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+        (#{entity.accountName}#{entity.accountId}#{entity.cardName}#{entity.cardNum}#{entity.profit}#{entity.money})
+        </foreach>
+    </insert>
+    <!-- 批量插入或按主键更新 -->
+    <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
+        insert into zgdd.inv_account_op(account_nameaccount_idcard_namecard_numprofitmoney)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+            (#{entity.accountName}#{entity.accountId}#{entity.cardName}#{entity.cardNum}#{entity.profit}#{entity.money})
+        </foreach>
+        on duplicate key update
+account_name = values(account_name) account_id = values(account_id) card_name = values(card_name) card_num = values(card_num) profit = values(profit) money = values(money)     </insert>
+
+</mapper>
+

+ 32 - 30
src/main/resources/mapper/modules/inv/InvAccountExcelMapper.xml

@@ -5,46 +5,51 @@
 <mapper namespace="com.ydtech.modules.inv.dao.InvAccountExcelMapper">
 
     <resultMap id="BaseResultMap" type="com.ydtech.modules.inv.model.InvAccountExcel">
-            <id property="excelAccountOperateId" column="excel_account_operate_id" jdbcType="VARCHAR"/>
-            <result property="company" column="company" jdbcType="VARCHAR"/>
-            <result property="applicant" column="applicant" jdbcType="VARCHAR"/>
-            <result property="applyTime" column="apply_time" jdbcType="TIMESTAMP"/>
-            <result property="applySector" column="apply_sector" jdbcType="VARCHAR"/>
-            <result property="collectionMessage" column="collection_message" jdbcType="VARCHAR"/>
-            <result property="fundFlow" column="fund_flow" jdbcType="VARCHAR"/>
-            <result property="fundUse" column="fund_use" jdbcType="VARCHAR"/>
-            <result property="remark" column="remark" jdbcType="VARCHAR"/>
-            <result property="applyAmount" column="apply_amount" jdbcType="VARCHAR"/>
-            <result property="bigApplyAmount" column="big_apply_amount" jdbcType="VARCHAR"/>
-            <result property="uplodePath" column="uplode_path" jdbcType="VARCHAR"/>
-            <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
-            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
-            <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
-            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
-            <result property="enterCardNum" column="enter_card_num" jdbcType="VARCHAR"/>
-            <result property="outCardNum" column="out_card_num" jdbcType="VARCHAR"/>
-            <result property="transferFlag" column="transfer_flag" jdbcType="CHAR"/>
-            <result property="outFlag" column="out_flag" jdbcType="CHAR"/>
-            <result property="outAccountQuality" column="out_account_quality" jdbcType="CHAR"/>
-            <result property="delFlag" column="del_flag" jdbcType="CHAR"/>
+        <id property="excelAccountOperateId" column="excel_account_operate_id" jdbcType="VARCHAR"/>
+        <result property="company" column="company" jdbcType="VARCHAR"/>
+        <result property="applicant" column="applicant" jdbcType="VARCHAR"/>
+        <result property="applyTime" column="apply_time" jdbcType="TIMESTAMP"/>
+        <result property="applySector" column="apply_sector" jdbcType="VARCHAR"/>
+        <result property="collectionMessage" column="collection_message" jdbcType="VARCHAR"/>
+        <result property="fundFlow" column="fund_flow" jdbcType="VARCHAR"/>
+        <result property="fundUse" column="fund_use" jdbcType="VARCHAR"/>
+        <result property="applyAmount" column="apply_amount" jdbcType="VARCHAR"/>
+        <result property="bigApplyAmount" column="big_apply_amount" jdbcType="VARCHAR"/>
+        <result property="uplodePath" column="uplode_path" jdbcType="VARCHAR"/>
+        <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
+        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+        <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+        <result property="enterCardNum" column="enter_card_num" jdbcType="VARCHAR"/>
+        <result property="outCardNum" column="out_card_num" jdbcType="VARCHAR"/>
+        <result property="transferFlag" column="transfer_flag" jdbcType="CHAR"/>
+        <result property="outFlag" column="out_flag" jdbcType="CHAR"/>
+        <result property="outAccountQuality" column="out_account_quality" jdbcType="CHAR"/>
+        <result property="delFlag" column="del_flag" jdbcType="CHAR"/>
         <result property="payMethod" column="pay_method" jdbcType="VARCHAR"/>
+        <result property="outProfit" column="out_profit" javaType="com.alibaba.fastjson.JSONObject"
+                typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/>
+        <result property="entProfit" column="ent_profit" javaType="com.alibaba.fastjson.JSONObject"
+                typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/>
+        <result property="fundFen" column="fund_fen" jdbcType="VARCHAR"/>
+        <result property="remark" column="remark" jdbcType="VARCHAR"/>
     </resultMap>
 
     <sql id="Base_Column_List">
         excel_account_operate_id,company,applicant,
         apply_time,apply_sector,collection_message,
-        fund_flow,fund_use,remark,
+        fund_flow,fund_use,
         apply_amount,big_apply_amount,uplode_path,
         update_by,update_time,create_by,
         create_time,enter_card_num,out_card_num,
-        del_flag,out_flag,out_account_quality,transfer_flag,pay_method
+        del_flag,out_flag,out_account_quality,transfer_flag,pay_method,out_profit,ent_profit,fund_fen,remark
     </sql>
-    <select id="selectExcelAccount" resultType="com.ydtech.modules.inv.model.InvAccountExcel">
+    <select id="selectExcelAccount" resultMap="BaseResultMap">
         select
-            <include refid="Base_Column_List"/>
+        <include refid="Base_Column_List"/>
         from inv_account_excel
         where
-            del_flag = '0'
+        del_flag = '0'
         <if test="insAccountExcel.excelAccountOperateId!= null and insAccountExcel.excelAccountOperateId!= ''">
             and excel_account_operate_id = #{insAccountExcel.excelAccountOperateId}
         </if>
@@ -72,9 +77,6 @@
         <if test="insAccountExcel.fundUse!= null and insAccountExcel.fundUse!= ''">
             and fund_use = #{insAccountExcel.fundUse}
         </if>
-        <if test="insAccountExcel.remark!= null and insAccountExcel.remark!= ''">
-            and remark = #{insAccountExcel.remark}
-        </if>
         <if test="insAccountExcel.applyAmount!= null and insAccountExcel.applyAmount!= ''">
             and apply_amount = #{insAccountExcel.applyAmount}
         </if>

+ 9 - 1
src/main/resources/mapper/modules/inv/InvAccountIncoiceMapper.xml

@@ -19,7 +19,15 @@
         <result property="payoutMoney" column="payout_money" jdbcType="VARCHAR"/>
         <result property="notPayoutMoney" column="not_payout_money" jdbcType="VARCHAR"/>
         <result property="delFlag" column="del_flag" jdbcType="VARCHAR"/>
-        <result property="bankCardNum" column="bank_card_num" jdbcType="VARCHAR"/>
+        <result property="revBankCardNum" column="rev_bank_card_num" jdbcType="VARCHAR"/>
+        <result property="outBankCardNum" column="out_bank_card_num" jdbcType="VARCHAR"/>
+        <result property="clearFlag" column="clear_flag" jdbcType="VARCHAR"/>
+        <result property="outProfit" column="out_profit" javaType="com.alibaba.fastjson.JSONObject"
+                typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
+        <result property="entProfit" column="ent_profit" javaType="com.alibaba.fastjson.JSONObject"
+                typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
+        <result property="fundFen" column="fund_fen" jdbcType="VARCHAR"/>
+        <result property="remark" column="remark" jdbcType="VARCHAR"/>
     </resultMap>
 
     <!-- 批量插入 -->

+ 0 - 14
src/main/resources/mapper/modules/inv/InvAccountMapper.xml

@@ -42,13 +42,6 @@
         <result property="priDayLines" column="pri_day_lines" jdbcType="VARCHAR"/>
         <result property="pubYearExcess" column="pub_year_excess" jdbcType="VARCHAR"/>
         <result property="priYearExcess" column="pri_year_excess" jdbcType="VARCHAR"/>
-        <result property="fiscalProfit" column="fiscal_profit" jdbcType="VARCHAR"/>
-        <result property="insuranceProfit" column="insurance_profit" jdbcType="VARCHAR"/>
-        <result property="clearingProfit" column="clearing_profit" jdbcType="VARCHAR"/>
-        <result property="exteriorProfit" column="exterior_profit" jdbcType="VARCHAR"/>
-        <result property="parkProfit" column="park_profit" jdbcType="VARCHAR"/>
-        <result property="tianqinProfit" column="tianqin_profit" jdbcType="VARCHAR"/>
-        <result property="otherProfit" column="other_profit" jdbcType="VARCHAR"/>
         <result property="endCertExpirationDate" column="end_cert_expiration_date" jdbcType="TIMESTAMP"/>
         <result property="balance" column="balance" jdbcType="VARCHAR"/>
         <result property="dayStrokeNumExcess" column="day_stroke_num_excess" jdbcType="VARCHAR"/>
@@ -92,13 +85,6 @@
         b.pri_day_lines,
         b.pub_year_excess,
         b.pri_year_excess,
-        b.fiscal_profit,
-        b.insurance_profit,
-        b.clearing_profit,
-        b.exterior_profit,
-        b.park_profit,
-        b.tianqin_profit,
-        b.other_profit,
         b.balance,
         b.day_stroke_num_excess,
         b.pub_day_lines_excess,

+ 70 - 17
src/main/resources/mapper/modules/inv/InvAccountOperateMapper.xml

@@ -5,20 +5,28 @@
 <mapper namespace="com.ydtech.modules.inv.dao.InvAccountOperateMapper">
 
     <resultMap id="BaseResultMap" type="com.ydtech.modules.inv.model.InvAccountOperate">
-            <id property="accountOperateId" column="account_operate_id" jdbcType="VARCHAR"/>
-            <result property="applicant" column="applicant" jdbcType="VARCHAR"/>
-            <result property="applySector" column="apply_sector" jdbcType="VARCHAR"/>
-            <result property="applyTime" column="apply_time" jdbcType="TIMESTAMP"/>
-            <result property="collectionMessage" column="collection_message" jdbcType="VARCHAR"/>
-            <result property="fundFlow" column="fund_flow" jdbcType="VARCHAR"/>
-            <result property="fundUse" column="fund_use" jdbcType="VARCHAR"/>
-            <result property="applyAmount" column="apply_amount" jdbcType="VARCHAR"/>
-            <result property="payMethod" column="pay_method" jdbcType="VARCHAR"/>
-            <result property="remark" column="remark" jdbcType="VARCHAR"/>
-            <result property="company" column="company" jdbcType="VARCHAR"/>
-            <result property="bigApplyAmount" column="big_apply_amount" jdbcType="VARCHAR"/>
-            <result property="revenueOutlay" column="revenue_outlay" jdbcType="CHAR"/>
-            <result property="invoiceId" column="invoice_id" jdbcType="VARCHAR"/>
+        <id property="accountOperateId" column="account_operate_id" jdbcType="VARCHAR"/>
+        <result property="applicant" column="applicant" jdbcType="VARCHAR"/>
+        <result property="applySector" column="apply_sector" jdbcType="VARCHAR"/>
+        <result property="applyTime" column="apply_time" jdbcType="TIMESTAMP"/>
+        <result property="collectionMessage" column="collection_message" jdbcType="VARCHAR"/>
+        <result property="fundFlow" column="fund_flow" jdbcType="VARCHAR"/>
+        <result property="fundUse" column="fund_use" jdbcType="VARCHAR"/>
+        <result property="applyAmount" column="apply_amount" jdbcType="VARCHAR"/>
+        <result property="payMethod" column="pay_method" jdbcType="VARCHAR"/>
+        <result property="remark" column="remark" jdbcType="VARCHAR"/>
+        <result property="company" column="company" jdbcType="VARCHAR"/>
+        <result property="bigApplyAmount" column="big_apply_amount" jdbcType="VARCHAR"/>
+        <result property="revenueOutlay" column="revenue_outlay" jdbcType="CHAR"/>
+        <result property="invoiceId" column="invoice_id" jdbcType="VARCHAR"/>
+        <result property="outProfit" column="out_profit" javaType="com.alibaba.fastjson.JSONObject"
+                typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
+        <result property="entProfit" column="ent_profit" javaType="com.alibaba.fastjson.JSONObject"
+                typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
+        <result property="fundFen" column="fund_fen" jdbcType="VARCHAR"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+        <result property="enterCardNum" column="enter_card_num" jdbcType="VARCHAR"/>
+        <result property="outCardNum" column="out_card_num" jdbcType="VARCHAR"/>
     </resultMap>
 
     <sql id="Base_Column_List">
@@ -26,12 +34,12 @@
         apply_time,collection_message,fund_flow,
         fund_use,apply_amount,pay_method,
         remark,company,big_apply_amount,
-        revenue_outlay,invoice_id
+        revenue_outlay,invoice_id,out_profit,ent_profit,fund_fen,create_time,enter_card_num,out_card_num
     </sql>
     <select id="selectInsAccountOperate" resultMap="BaseResultMap">
         select
-            <include refid="Base_Column_List"/>
-            from inv_account_operate
+        <include refid="Base_Column_List"/>
+        from inv_account_operate
         where 1=1
         <if test="insAccountOperate.accountOperateId != null and insAccountOperate.accountOperateId != ''">
             and account_operate_id like concat('%',#{insAccountOperate.accountOperateId},'%')
@@ -55,4 +63,49 @@
             and invoice_id like concat('%',#{insAccountOperate.invoiceId},'%')
         </if>
     </select>
+    <select id="selectInsAccountOperateList" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from inv_account_operate
+        where 1=1
+        <if test="insAccountOperate.accountOperateId != null and insAccountOperate.accountOperateId != ''">
+            and account_operate_id like concat('%',#{insAccountOperate.accountOperateId},'%')
+        </if>
+        <if test="insAccountOperate.applicant != null and insAccountOperate.applicant != ''">
+            and applicant like concat('%',#{insAccountOperate.applicant},'%')
+        </if>
+        <if test="insAccountOperate.company != null and insAccountOperate.company != ''">
+            and company like concat('%',#{insAccountOperate.company},'%')
+        </if>
+        <if test="insAccountOperate.fundUse != null and insAccountOperate.fundUse != ''">
+            and fund_use like concat('%',#{insAccountOperate.fundUse},'%')
+        </if>
+        <if test="insAccountOperate.fundFlow != null and insAccountOperate.fundFlow != ''">
+            and fund_flow like concat('%',#{insAccountOperate.fundFlow},'%')
+        </if>
+        <if test="insAccountOperate.revenueOutlay != null and insAccountOperate.revenueOutlay != ''">
+            and revenue_outlay like concat('%',#{insAccountOperate.revenueOutlay},'%')
+        </if>
+        <if test="insAccountOperate.invoiceId != null and insAccountOperate.invoiceId != ''">
+            and invoice_id like concat('%',#{insAccountOperate.invoiceId},'%')
+        </if>
+    </select>
+    <select id="selectOperateList"  resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from inv_account_operate
+        where 1=1
+        and (
+        enter_card_num in
+        <foreach item="item" index="index" collection="list"
+                 open="(" separator="," close=")">
+            #{item}
+        </foreach>
+        or out_card_num in
+        <foreach item="item" index="index" collection="list"
+                 open="(" separator="," close=")">
+            #{item}
+        </foreach>
+        )
+    </select>
 </mapper>