申报表的分权
This commit is contained in:
parent
be88b90f56
commit
6646a2e481
|
|
@ -1,101 +0,0 @@
|
|||
package com.engine.salary.cmd.taxDeclaration;
|
||||
|
||||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
import com.engine.common.biz.AbstractCommonCommand;
|
||||
import com.engine.common.entity.BizLogContext;
|
||||
import com.engine.core.interceptor.CommandContext;
|
||||
import com.engine.salary.component.SalaryWeaTable;
|
||||
import com.engine.salary.entity.salaryarchive.po.TaxAgentPO;
|
||||
import com.engine.salary.entity.taxdeclaration.TaxDeclaration;
|
||||
import com.engine.salary.entity.taxrate.vo.TaxAgentTableVO;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.db.DBType;
|
||||
import com.fapiao.neon.model.in.Page;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class TaxDeclarationListCmd extends AbstractCommonCommand<Map<String, Object>> {
|
||||
|
||||
public TaxDeclarationListCmd(Map<String, Object> params, User user) {
|
||||
this.user = user;
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizLogContext getLogContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> execute(CommandContext commandContext) {
|
||||
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>(16);
|
||||
//查询个税申报表
|
||||
SalaryWeaTable<TaxDeclaration> table = new SalaryWeaTable<TaxDeclaration>(user, TaxDeclaration.class);
|
||||
//sql条件
|
||||
String sqlWhere = makeSqlWhere(params,user);
|
||||
table.setSqlwhere(sqlWhere);
|
||||
|
||||
WeaResultMsg result = new WeaResultMsg(false);
|
||||
result.putAll(table.makeDataResult());
|
||||
|
||||
result.success();
|
||||
//人员list
|
||||
List<Object> list = table.makeDataResult().values().stream().collect(Collectors.toList());
|
||||
//SalaryWeaTable<SimpleEmployee> simpleEmployees = new SalaryWeaTable<SimpleEmployee>(user, SimpleEmployee.class);
|
||||
//查询个税扣缴义务人
|
||||
|
||||
SalaryWeaTable<TaxAgentTableVO> taxAgentPOS = new SalaryWeaTable<TaxAgentTableVO>(user, TaxAgentTableVO.class);
|
||||
List employeeIds = new ArrayList();
|
||||
|
||||
if(!table.makeDataResult().isEmpty()){
|
||||
//查询人员
|
||||
|
||||
//查询个税扣缴义务人
|
||||
|
||||
}
|
||||
return result.getResultMap();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* sql条件
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
private String makeSqlWhere(Map<String, Object> params,User user) {
|
||||
DBType dbType = DBType.get(new RecordSet().getDBType());
|
||||
//租户key
|
||||
String userId = user.getLoginid();
|
||||
String sqlWhere = "where delete_Type = 0 and tenantKey = userId";
|
||||
//区间查询
|
||||
String FromSalaryMonth = (String) params.get("FromSalaryMonth");
|
||||
String EndSalaryMonth = (String) params.get("EndSalaryMonth");
|
||||
if (SalaryEntityUtil.isNotNullOrEmpty(FromSalaryMonth)&&SalaryEntityUtil.isNotNullOrEmpty(EndSalaryMonth)) {
|
||||
sqlWhere += "AND salary_month between to_date(FromSalaryMonth,'yyyy-mm') and to_date(EndSalaryMonth,'yyyy-mm')";
|
||||
}
|
||||
return sqlWhere;
|
||||
}
|
||||
|
||||
/**
|
||||
* sql条件
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
private String makeSqlWhereAgent(Map<String, Object> params) {
|
||||
DBType dbType = DBType.get(new RecordSet().getDBType());
|
||||
String sqlWhere = "where delete_Type = 0";
|
||||
//模糊查询
|
||||
String name = (String) params.get("name");
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
sqlWhere += " AND name " + dbType.like(name);
|
||||
}
|
||||
return sqlWhere;
|
||||
}
|
||||
}
|
||||
|
|
@ -6,15 +6,17 @@ import lombok.Builder;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @description: 个税申报记录
|
||||
* @author: xiajun
|
||||
* @modified By: xiajun
|
||||
* @date: Created in 12/14/21 6:57 PM
|
||||
* @version:v1.0
|
||||
*/
|
||||
* 个税申报记录
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
|
|
@ -73,4 +75,8 @@ public class TaxDeclarationPO {
|
|||
|
||||
//税款所属期
|
||||
LocalDateRange salaryMonths;
|
||||
|
||||
|
||||
|
||||
private Collection<Long> taxAgentIds;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,12 @@
|
|||
<if test="salaryMonths != null and salaryMonths.endDate != null">
|
||||
AND salary_month <![CDATA[ <= ]]> #{salaryMonths.endDate}
|
||||
</if>
|
||||
<if test="taxAgentIds != null and taxAgentIds.size()>0">
|
||||
AND tax_agent_id IN
|
||||
<foreach collection="taxAgentIds" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
<insert id="batchInsert">
|
||||
|
|
|
|||
|
|
@ -14,11 +14,6 @@ import java.util.Map;
|
|||
|
||||
public interface TaxDeclarationService {
|
||||
|
||||
/**
|
||||
* 分页列表
|
||||
*/
|
||||
Map<String, Object> listPage(Map<String, Object> params);
|
||||
|
||||
PageInfo<TaxDeclarationPO> listPageByParam(TaxDeclarationListQueryParam queryParam);
|
||||
|
||||
List<TaxAgent> countByTaxDeclarationId(Collection<Long> taxAgentIds);
|
||||
|
|
|
|||
|
|
@ -2,8 +2,12 @@ package com.engine.salary.service.impl;
|
|||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.cmd.taxDeclaration.*;
|
||||
import com.engine.salary.cmd.taxDeclaration.TaxDeclarationDeleteCmd;
|
||||
import com.engine.salary.cmd.taxDeclaration.TaxDeclarationGetFormCmd;
|
||||
import com.engine.salary.cmd.taxDeclaration.TaxDeclarationGetTaxDeclarationInfoCmd;
|
||||
import com.engine.salary.cmd.taxDeclaration.TaxDeclarationUpdateCmd;
|
||||
import com.engine.salary.common.LocalDateRange;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
||||
import com.engine.salary.entity.taxdeclaration.TaxDeclaration;
|
||||
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam;
|
||||
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam;
|
||||
|
|
@ -14,6 +18,7 @@ import com.engine.salary.exception.SalaryRunTimeException;
|
|||
import com.engine.salary.mapper.TaxAgentMapper;
|
||||
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationMapper;
|
||||
import com.engine.salary.service.AddUpSituationService;
|
||||
import com.engine.salary.service.TaxAgentService;
|
||||
import com.engine.salary.service.TaxDeclarationDetailService;
|
||||
import com.engine.salary.service.TaxDeclarationService;
|
||||
import com.engine.salary.util.SalaryDateUtil;
|
||||
|
|
@ -37,23 +42,24 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration
|
|||
}
|
||||
|
||||
private TaxDeclarationDetailService getTaxDeclarationDetailService(User user) {
|
||||
return (TaxDeclarationDetailService) ServiceUtil.getService(TaxDeclarationDetailServiceImpl.class, user);
|
||||
return ServiceUtil.getService(TaxDeclarationDetailServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private AddUpSituationService getAddUpSituationService(User user) {
|
||||
return (AddUpSituationService) ServiceUtil.getService(AddUpSituationServiceImpl.class, user);
|
||||
return ServiceUtil.getService(AddUpSituationServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> listPage(Map<String, Object> params) {
|
||||
return commandExecutor.execute(new TaxDeclarationListCmd(params, user));
|
||||
private TaxAgentService getTaxAgentService(User user) {
|
||||
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PageInfo<TaxDeclarationPO> listPageByParam(TaxDeclarationListQueryParam queryParam) {
|
||||
long currentEmployeeId = user.getUID();
|
||||
|
||||
// 分页参数
|
||||
TaxDeclarationPO po = TaxDeclarationPO.builder().build();
|
||||
PageInfo<TaxDeclarationPO> page = new PageInfo<>();
|
||||
LocalDateRange localDateRange = new LocalDateRange();
|
||||
if (Objects.nonNull(queryParam.getFromSalaryMonth())) {
|
||||
localDateRange.setFromDate(SalaryDateUtil.localDateToDate(queryParam.getFromSalaryMonth().atDay(1)));
|
||||
|
|
@ -62,12 +68,25 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration
|
|||
localDateRange.setEndDate(SalaryDateUtil.localDateToDate(queryParam.getEndSalaryMonth().atEndOfMonth()));
|
||||
}
|
||||
po.setSalaryMonths(localDateRange);
|
||||
|
||||
|
||||
// 分权
|
||||
Boolean openDevolution = getTaxAgentService(user).isNeedAuth(currentEmployeeId);
|
||||
if (openDevolution) {
|
||||
// 查询负责管理的个税扣缴义务人
|
||||
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgents(currentEmployeeId);
|
||||
if (CollectionUtils.isEmpty(taxAgentPOS)) {
|
||||
return new PageInfo<>(new ArrayList<>());
|
||||
}
|
||||
Set<Long> taxAgentIds = SalaryEntityUtil.properties(taxAgentPOS, TaxAgentPO::getId);
|
||||
po.setTaxAgentIds(taxAgentIds);
|
||||
}
|
||||
|
||||
// 查询个税申报表
|
||||
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
|
||||
List<TaxDeclarationPO> taxDeclarationPOS = getTaxDeclarationMapper().listSome(po);
|
||||
page.setList(taxDeclarationPOS);
|
||||
return new PageInfo<>(taxDeclarationPOS,TaxDeclarationPO.class);
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
//根据id查询taxAgents
|
||||
|
|
|
|||
|
|
@ -1,31 +1,22 @@
|
|||
package com.engine.salary.wrapper;
|
||||
|
||||
import com.cloudstore.eccom.pc.table.WeaTable;
|
||||
import com.cloudstore.eccom.pc.table.WeaTableColumn;
|
||||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.component.SalaryWeaTable;
|
||||
import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO;
|
||||
import com.engine.salary.entity.taxdeclaration.TaxDeclaration;
|
||||
import com.engine.salary.entity.taxdeclaration.bo.TaxDeclarationDetailListColumn;
|
||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationDetailListDTO;
|
||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationLaborListDTO;
|
||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationWageListDTO;
|
||||
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationDetailListQueryParam;
|
||||
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
|
||||
import com.engine.salary.service.TaxDeclarationDetailService;
|
||||
import com.engine.salary.service.TaxDeclarationExcelService;
|
||||
import com.engine.salary.service.TaxDeclarationService;
|
||||
import com.engine.salary.service.impl.TaxDeclarationDetailServiceImpl;
|
||||
import com.engine.salary.service.impl.TaxDeclarationExcelServiceImpl;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
|
|
@ -37,7 +28,6 @@ import java.util.stream.Collectors;
|
|||
|
||||
|
||||
@Slf4j
|
||||
|
||||
public class TaxDeclarationDetailWrapper extends Service {
|
||||
|
||||
private TaxDeclarationDetailService getTaxDeclarationDetailService(User user) {
|
||||
|
|
|
|||
|
|
@ -44,18 +44,15 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @description: 个税申报表
|
||||
* @author: xiajun
|
||||
* @modified By: xiajun
|
||||
* @date: Created in 1/23/22 5:50 PM
|
||||
* @version:v1.0
|
||||
*/
|
||||
|
||||
* 个税申报表
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
public class TaxDeclarationWrapper extends Service {
|
||||
|
||||
public TaxDeclarationWrapper() {
|
||||
}
|
||||
|
||||
private TaxDeclarationService getTaxDeclarationService(User user) {
|
||||
return ServiceUtil.getService(TaxDeclarationServiceImpl.class, user);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue