|
@@ -8,6 +8,7 @@ import cn.com.ctop.alarm.modules.service.impl.RuleAccountTemplateServiceImpl;
|
|
|
import cn.com.ctop.common.module.entity.SysLog;
|
|
|
import cn.com.ctop.common.module.entity.UserAllocation;
|
|
|
import cn.com.ctop.common.module.mapper.SysLogMapper;
|
|
|
+import cn.com.ctop.common.module.mapper.SysUserMapper;
|
|
|
import cn.com.ctop.common.module.service.impl.UserAllocationServiceImpl;
|
|
|
import cn.com.ctop.common.module.utils.Check;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
@@ -19,9 +20,18 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
+import org.jeecg.common.system.entity.SysUser;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
+import org.jeecg.ctop.finance.policy.entity.CwjsCompanySubject;
|
|
|
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyInfo;
|
|
|
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyProduct;
|
|
|
+import org.jeecg.ctop.finance.policy.mapper.CwjsCompanySubjectMapper;
|
|
|
+import org.jeecg.ctop.finance.policy.mapper.CwjsPolicyInfoMapper;
|
|
|
+import org.jeecg.ctop.finance.policy.mapper.CwjsPolicyProductMapper;
|
|
|
+import org.jeecg.ctop.finance.policy.service.impl.CwjsPolicyProductServiceImpl;
|
|
|
import org.jeecg.ctop.finance.settlement.entity.pojo.CtopCwjsSettlementInfo;
|
|
|
import org.jeecg.ctop.finance.settlement.entity.vo.AccountImportVo;
|
|
|
+import org.jeecg.ctop.finance.settlement.entity.vo.PolicyImportVo;
|
|
|
import org.jeecg.ctop.finance.settlement.mapper.SettlementInfoMapper;
|
|
|
import org.jeecg.ctop.finance.settlement.service.ISettlementInfoService;
|
|
|
import org.jeecg.modules.ctop.entity.ProjectMember;
|
|
@@ -38,6 +48,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
@@ -53,12 +64,10 @@ public class SettlementInfoServiceImpl extends ServiceImpl<SettlementInfoMapper,
|
|
|
|
|
|
|
|
|
/**
|
|
|
- *
|
|
|
- * @description: 查询 财务结算-账户列表
|
|
|
- *
|
|
|
* @param settlementInfo
|
|
|
* @param pageNo
|
|
|
* @param pageSize
|
|
|
+ * @description: 查询 财务结算-账户列表
|
|
|
* @return: org.jeecg.common.api.vo.Result
|
|
|
* @author: zianY
|
|
|
*/
|
|
@@ -73,26 +82,27 @@ public class SettlementInfoServiceImpl extends ServiceImpl<SettlementInfoMapper,
|
|
|
|
|
|
@Autowired
|
|
|
private UserAllocationServiceImpl userAllocationService;
|
|
|
+
|
|
|
/**
|
|
|
- * @description: 财务结算-修改账户状态
|
|
|
* @param id
|
|
|
* @param status 账户状态 0-开 1-关
|
|
|
+ * @description: 财务结算-修改账户状态
|
|
|
* @return: org.jeecg.common.api.vo.Result
|
|
|
* @author: zianY
|
|
|
*/
|
|
|
@Override
|
|
|
public Result updSettlementStatusById(Long id, Integer status) {
|
|
|
// 修改状态
|
|
|
- settlementInfoMapper.updSettlementStatusById(id,status);
|
|
|
+ settlementInfoMapper.updSettlementStatusById(id, status);
|
|
|
|
|
|
//同步 状态
|
|
|
- CtopCwjsSettlementInfo settlementInfo = settlementInfoMapper.selectById(id);
|
|
|
+ CtopCwjsSettlementInfo settlementInfo = settlementInfoMapper.selectById(id);
|
|
|
|
|
|
UserAllocation userAllocation = userAllocationService.getByAccountId(new Long(settlementInfo.getAccountId()));
|
|
|
- if (!Check.isNull(userAllocation)){
|
|
|
+ if (!Check.isNull(userAllocation)) {
|
|
|
userAllocation.setAccountStatus(status);
|
|
|
userAllocationService.editUserAlloCation(userAllocation);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
SysLog sysLog = new SysLog();
|
|
|
sysLog.setLogType(2);
|
|
@@ -155,10 +165,8 @@ public class SettlementInfoServiceImpl extends ServiceImpl<SettlementInfoMapper,
|
|
|
*/
|
|
|
|
|
|
/**
|
|
|
- *
|
|
|
- * @description: 删除
|
|
|
- *
|
|
|
* @param id
|
|
|
+ * @description: 删除
|
|
|
* @return: org.jeecg.common.api.vo.Result
|
|
|
* @author: zianY
|
|
|
*/
|
|
@@ -170,11 +178,9 @@ public class SettlementInfoServiceImpl extends ServiceImpl<SettlementInfoMapper,
|
|
|
|
|
|
|
|
|
/**
|
|
|
- *
|
|
|
- * @description:
|
|
|
- *
|
|
|
* @param settlementInfo
|
|
|
* @param file
|
|
|
+ * @description:
|
|
|
* @return: org.jeecg.common.api.vo.Result
|
|
|
* @author: zianY
|
|
|
* @time: 2021/7/30 16:26
|
|
@@ -182,69 +188,67 @@ public class SettlementInfoServiceImpl extends ServiceImpl<SettlementInfoMapper,
|
|
|
@Override
|
|
|
public Result settlementAccountImport(CtopCwjsSettlementInfo settlementInfo, MultipartFile file) {
|
|
|
|
|
|
- try {
|
|
|
- //LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
- //settlementInfo.setCreateUserId(user.getId());
|
|
|
- //settlementInfo.setCreateUserId("b161b7d9793942f980dbfe8c931cd1b0");
|
|
|
- ImportParams importParams = new ImportParams();
|
|
|
- //表格标题行数
|
|
|
- importParams.setTitleRows(1);
|
|
|
- //表头行数
|
|
|
- importParams.setHeadRows(1);
|
|
|
-
|
|
|
- //校验表头 头条
|
|
|
- if (StringUtils.equals("1",String.valueOf(settlementInfo.getMediaId()))){
|
|
|
- importParams.setImportFields(new String[]{"账户ID","账户名称"});
|
|
|
- //快手
|
|
|
- }else if (StringUtils.equals("2",String.valueOf(settlementInfo.getMediaId()))){
|
|
|
- importParams.setImportFields(new String[]{"快手ID","账户ID","账户名称"});
|
|
|
+ try {
|
|
|
+ //LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+ //settlementInfo.setCreateUserId(user.getId());
|
|
|
+ //settlementInfo.setCreateUserId("b161b7d9793942f980dbfe8c931cd1b0");
|
|
|
+ ImportParams importParams = new ImportParams();
|
|
|
+ //表格标题行数
|
|
|
+ importParams.setTitleRows(1);
|
|
|
+ //表头行数
|
|
|
+ importParams.setHeadRows(1);
|
|
|
+
|
|
|
+ //校验表头 头条
|
|
|
+ if (StringUtils.equals("1", String.valueOf(settlementInfo.getMediaId()))) {
|
|
|
+ importParams.setImportFields(new String[]{"账户ID", "账户名称"});
|
|
|
+ //快手
|
|
|
+ } else if (StringUtils.equals("2", String.valueOf(settlementInfo.getMediaId()))) {
|
|
|
+ importParams.setImportFields(new String[]{"快手ID", "账户ID", "账户名称"});
|
|
|
+ }
|
|
|
+ //校验excel的标题列顺序
|
|
|
+ importParams.setNeedCheckOrder(true);
|
|
|
+ ExcelImportResult<AccountImportVo> importResult = ExcelImportUtil.importExcelMore(file.getInputStream(), AccountImportVo.class, importParams);
|
|
|
+ if (importResult.getList().size() < 1) {
|
|
|
+ return Result.error("读取Excel失败,数据不能为空,请重新检查数据并导入");
|
|
|
+ }
|
|
|
+ for (AccountImportVo importVo : importResult.getList()) {
|
|
|
+ if (Check.isNull(importVo.getAccountId())) {
|
|
|
+ continue;
|
|
|
}
|
|
|
- //校验excel的标题列顺序
|
|
|
- importParams.setNeedCheckOrder(true);
|
|
|
- ExcelImportResult<AccountImportVo> importResult = ExcelImportUtil.importExcelMore(file.getInputStream(), AccountImportVo.class,importParams);
|
|
|
- if (importResult.getList().size() < 1){
|
|
|
- return Result.error("读取Excel失败,数据不能为空,请重新检查数据并导入");
|
|
|
+ //查询 账户 状态
|
|
|
+ UserAllocation userAllocation = userAllocationService.getByAccountId(new Long(importVo.getAccountId()));
|
|
|
+ if (Check.isNull(userAllocation)) {
|
|
|
+ settlementInfo.setStatus(0);
|
|
|
+ } else {
|
|
|
+ settlementInfo.setStatus(userAllocation.getAccountStatus());
|
|
|
}
|
|
|
- for (AccountImportVo importVo : importResult.getList()) {
|
|
|
- if (Check.isNull(importVo.getAccountId())){
|
|
|
- continue;
|
|
|
- }
|
|
|
- //查询 账户 状态
|
|
|
- UserAllocation userAllocation = userAllocationService.getByAccountId(new Long(importVo.getAccountId()));
|
|
|
- if (Check.isNull(userAllocation)){
|
|
|
- settlementInfo.setStatus(0);
|
|
|
- }else {
|
|
|
- settlementInfo.setStatus(userAllocation.getAccountStatus());
|
|
|
- }
|
|
|
- BeanUtils.copyProperties(importVo,settlementInfo);
|
|
|
- //根据账户id 查看
|
|
|
- CtopCwjsSettlementInfo cwjs = settlementInfoMapper.getSettlementByAccountId(importVo.getAccountId());
|
|
|
- if (Check.isNull(cwjs)){
|
|
|
- // BeanUtils.copyProperties(importVo,settlementInfo);
|
|
|
- settlementInfoMapper.insert(settlementInfo);
|
|
|
- }else {
|
|
|
- settlementInfo.setId(cwjs.getId());
|
|
|
- settlementInfoMapper.updateById(settlementInfo);
|
|
|
- }
|
|
|
+ BeanUtils.copyProperties(importVo, settlementInfo);
|
|
|
+ //根据账户id 查看
|
|
|
+ CtopCwjsSettlementInfo cwjs = settlementInfoMapper.getSettlementByAccountId(importVo.getAccountId());
|
|
|
+ if (Check.isNull(cwjs)) {
|
|
|
+ // BeanUtils.copyProperties(importVo,settlementInfo);
|
|
|
+ settlementInfoMapper.insert(settlementInfo);
|
|
|
+ } else {
|
|
|
+ settlementInfo.setId(cwjs.getId());
|
|
|
+ settlementInfoMapper.updateById(settlementInfo);
|
|
|
}
|
|
|
- }catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- return Result.error("账户数据上传失败,请使用正确的模板导入!");
|
|
|
}
|
|
|
- return Result.successMsg("账户数据上传成功",null);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return Result.error("账户数据上传失败,请使用正确的模板导入!");
|
|
|
}
|
|
|
+ return Result.successMsg("账户数据上传成功", null);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
/**
|
|
|
- *
|
|
|
- * @description: 查询多个用户信息
|
|
|
- *
|
|
|
* @param userIds
|
|
|
- * @return: java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
|
|
|
+ * @description: 查询多个用户信息
|
|
|
+ * @return: java.util.List<java.util.Map < java.lang.String, java.lang.Object>>
|
|
|
* @author: zianY
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<Map<String,Object>> getUserByIds(Set userIds) {
|
|
|
+ public List<Map<String, Object>> getUserByIds(Set userIds) {
|
|
|
return settlementInfoMapper.getUserByIds(userIds);
|
|
|
}
|
|
|
|