fix 一键清空

This commit is contained in:
Harryxzy 2022-10-28 16:35:51 +08:00
parent 09d85bdab3
commit e046b7e3fe
5 changed files with 59 additions and 14 deletions

View File

@ -23,4 +23,7 @@ public class AddUpDeductionRecordDeleteParam {
// 申报月份
private String declareMonth;
// 个税扣缴义务人
private String taxAgentId;
}

View File

@ -37,6 +37,7 @@ import com.engine.salary.sys.entity.vo.OrderRuleVO;
import com.engine.salary.sys.service.SalarySysConfService;
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.excel.ExcelComment;
@ -578,7 +579,20 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
}catch (Exception e){
throw new SalaryRunTimeException("日期异常");
}
AddUpDeductionQueryParam queryParam = AddUpDeductionQueryParam.builder().declareMonthDate(declareMonthDate).taxAgentIds(taxAgentIds).build();
AddUpDeductionQueryParam queryParam = null;
if(deleteParam.getTaxAgentId() != null && (!deleteParam.getTaxAgentId().equals(""))){
// 设置了个税扣缴义务人
Long taxAgentId = SalaryEntityUtil.string2Long(deleteParam.getTaxAgentId());
boolean canDelete = taxAgentIds.stream().anyMatch(t -> t == taxAgentId);
if(!canDelete){
throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内!");
}
ArrayList<Long> tai = new ArrayList<>();
tai.add(taxAgentId);
queryParam = AddUpDeductionQueryParam.builder().declareMonthDate(declareMonthDate).taxAgentIds(tai).build();
}else {
queryParam = AddUpDeductionQueryParam.builder().declareMonthDate(declareMonthDate).taxAgentIds(taxAgentIds).build();
}
// 获取所有想要删除的数据
List<AddUpDeductionDTO> list = addUpDeductionBiz.list(queryParam);
// 获取已经核算的数据

View File

@ -1058,7 +1058,22 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
ArrayList<Date> dateRange = new ArrayList<>();
dateRange.add(beginDate);
dateRange.add(endDate);
AddUpSituation queryParam = AddUpSituation.builder().taxYearMonthRange(dateRange).taxAgentIds(taxAgentIds).build();
AddUpSituation queryParam = null;
if(deleteParam.getTaxAgentId() != null && (!deleteParam.getTaxAgentId().equals(""))){
// 设置了个税扣缴义务人
Long taxAgentId = SalaryEntityUtil.string2Long(deleteParam.getTaxAgentId());
boolean canDelete = taxAgentIds.stream().anyMatch(t -> t == taxAgentId);
if(!canDelete){
throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内!");
}
ArrayList<Long> tai = new ArrayList<>();
tai.add(taxAgentId);
queryParam = AddUpSituation.builder().taxYearMonthRange(dateRange).taxAgentIds(tai).build();
}else {
queryParam = AddUpSituation.builder().taxYearMonthRange(dateRange).taxAgentIds(taxAgentIds).build();
}
// 获取所有想要删除的数据
List<AddUpSituation> list = biz.listSome(queryParam);
// 获取已经核算的数据

View File

@ -10,10 +10,7 @@ import com.engine.salary.encrypt.datacollection.OtherDeductionRecordDTOEncrypt;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.datacollection.dto.OtherDeductionListDTO;
import com.engine.salary.entity.datacollection.dto.OtherDeductionRecordDTO;
import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam;
import com.engine.salary.entity.datacollection.param.OtherDeductionImportParam;
import com.engine.salary.entity.datacollection.param.OtherDeductionParam;
import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam;
import com.engine.salary.entity.datacollection.param.*;
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
@ -31,6 +28,7 @@ import com.engine.salary.sys.entity.vo.OrderRuleVO;
import com.engine.salary.sys.service.SalarySysConfService;
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.excel.ExcelComment;
@ -734,7 +732,21 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
}catch (Exception e){
throw new SalaryRunTimeException("日期异常");
}
OtherDeductionPO queryParam = OtherDeductionPO.builder().declareMonth(declareMonthDate).taxAgentIds(taxAgentIds).build();
OtherDeductionPO queryParam = null;
if(deleteParam.getTaxAgentId() != null && (!deleteParam.getTaxAgentId().equals(""))){
// 设置了个税扣缴义务人
Long taxAgentId = SalaryEntityUtil.string2Long(deleteParam.getTaxAgentId());
boolean canDelete = taxAgentIds.stream().anyMatch(t -> t == taxAgentId);
if(!canDelete){
throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内!");
}
ArrayList<Long> tai = new ArrayList<>();
tai.add(taxAgentId);
queryParam = OtherDeductionPO.builder().declareMonth(declareMonthDate).taxAgentIds(tai).build();
}else {
queryParam = OtherDeductionPO.builder().declareMonth(declareMonthDate).taxAgentIds(taxAgentIds).build();
}
// 获取所有想要删除的数据
List<OtherDeductionPO> list = otherDeductionBiz.listSome(queryParam);
// 获取已经核算的数据

View File

@ -4,6 +4,7 @@ import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.datacollection.dto.AddUpSituationDTO;
import com.engine.salary.entity.datacollection.dto.AddUpSituationRecordDTO;
import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam;
import com.engine.salary.entity.datacollection.param.AddUpSituationImportParam;
import com.engine.salary.entity.datacollection.param.AddUpSituationParam;
import com.engine.salary.entity.datacollection.param.AddUpSituationQueryParam;
@ -320,13 +321,13 @@ public class AddUpSituationController {
* @author Harryxzy
* @date 2022/10/27 21:10
*/
// @POST
// @Path("/deleteAllAddUpSituation")
// @Produces(MediaType.APPLICATION_JSON)
// public String deleteAllAddUpSituation(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionRecordDeleteParam addUpSituationDeleteParam) {
// User user = HrmUserVarify.getUser(request, response);
// return new ResponseResult<AddUpDeductionRecordDeleteParam, Map<String, Object>>(user).run(getAddUpSituationWrapper(user)::deleteAllAddUpSituation, addUpSituationDeleteParam);
// }
@POST
@Path("/deleteAllAddUpSituation")
@Produces(MediaType.APPLICATION_JSON)
public String deleteAllAddUpSituation(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionRecordDeleteParam addUpSituationDeleteParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<AddUpDeductionRecordDeleteParam, Map<String, Object>>(user).run(getAddUpSituationWrapper(user)::deleteAllAddUpSituation, addUpSituationDeleteParam);
}
@POST
@Path("/preview")