fix: 一键累计添加日期
This commit is contained in:
parent
07f9976d63
commit
bf75c3831f
|
|
@ -0,0 +1,17 @@
|
|||
package com.engine.salary.entity.datacollection.param;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @description 数据采集-专项附加扣除一键累计参数
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AddDeductionAutoAddParam {
|
||||
String yearMonth = "";
|
||||
}
|
||||
|
|
@ -154,5 +154,5 @@ public interface AddUpDeductionService {
|
|||
* @return void
|
||||
* @author lfc
|
||||
*/
|
||||
void autoAddAll(Date operateTime);
|
||||
void autoAddAll(Date yearMonth);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -641,7 +641,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
|
|||
}
|
||||
|
||||
@Override
|
||||
public void autoAddAll(Date operateTime) {
|
||||
public void autoAddAll(Date yearMonth) {
|
||||
int uid = user.getUID();
|
||||
Boolean isChief = getTaxAgentService(user).isChief((long) uid);
|
||||
Collection<TaxAgentPO> taxAgents;
|
||||
|
|
@ -677,7 +677,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
|
|||
|
||||
addUpDeduction.setEmployeeId(employeeId);
|
||||
addUpDeduction.setTaxAgentId(taxAgent.getId());
|
||||
addUpDeduction.setDeclareMonth(DateUtil.beginOfMonth(operateTime));
|
||||
addUpDeduction.setDeclareMonth(DateUtil.beginOfMonth(yearMonth));
|
||||
addUpDeduction.setCreator((long) user.getUID());
|
||||
addUpDeduction.setTenantKey(DEFAULT_TENANT_KEY);
|
||||
|
||||
|
|
@ -686,13 +686,13 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
|
|||
.flatMap(c -> c.stream().findFirst())
|
||||
.orElse(null);
|
||||
if (oldInfo == null) {
|
||||
addUpDeduction.setCreateTime(operateTime);
|
||||
addUpDeduction.setUpdateTime(operateTime);
|
||||
addUpDeduction.setCreateTime(yearMonth);
|
||||
addUpDeduction.setUpdateTime(yearMonth);
|
||||
insertList.add(AddUpDeductionEncrypt.encryptAddUpDeduction(addUpDeduction));
|
||||
} else {
|
||||
addUpDeduction.setId(oldInfo.getId());
|
||||
addUpDeduction.setCreateTime(oldInfo.getCreateTime());
|
||||
addUpDeduction.setUpdateTime(operateTime);
|
||||
addUpDeduction.setUpdateTime(yearMonth);
|
||||
updateList.add(AddUpDeductionEncrypt.encryptAddUpDeduction(addUpDeduction));
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
package com.engine.salary.web;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO;
|
||||
import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpDeductionImportParam;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordDeleteParam;
|
||||
import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordParam;
|
||||
import com.engine.salary.entity.datacollection.param.*;
|
||||
import com.engine.salary.util.ResponseResult;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.wrapper.AddUpDeductionWrapper;
|
||||
|
|
@ -347,8 +347,19 @@ public class AddUpDeductionController {
|
|||
@POST
|
||||
@Path("/autoAddAll")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String autoAddAll(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
public String autoAddAll(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||
@RequestBody AddDeductionAutoAddParam param) {
|
||||
DateTime date = null;
|
||||
if (StrUtil.isNotEmpty(param.getYearMonth())) {
|
||||
try {
|
||||
date = DateUtil.parse(param.getYearMonth(), "yyyy-MM");
|
||||
} catch (Exception e) {
|
||||
//ignore 放在service中处理,这里处理了页面上收不到
|
||||
}
|
||||
} else {
|
||||
date = DateUtil.beginOfMonth(new Date());
|
||||
}
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<User, Void>(user).run(getAddUpDeductionWrapper(user)::autoAddAll, user);
|
||||
return new ResponseResult<Date, Void>(user).run(getAddUpDeductionWrapper(user)::autoAddAll, date);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|||
import weaver.general.BaseBean;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -171,10 +170,13 @@ public class AddUpDeductionWrapper extends Service {
|
|||
return getAddUpDeductionService(user).getAddUpDeduction(param);
|
||||
}
|
||||
|
||||
public void autoAddAll(User opt) {
|
||||
public void autoAddAll(Date yearMonth) {
|
||||
if (isLog) {
|
||||
log.info("一键累计, 操作人 「{}」", opt.getUsername());
|
||||
log.info("一键累计, 操作人 「{}」", user.getUsername());
|
||||
}
|
||||
getAddUpDeductionService(user).autoAddAll(new Date());
|
||||
if (yearMonth == null) {
|
||||
throw new SalaryRunTimeException("一键累计传入日期格式错误");
|
||||
}
|
||||
getAddUpDeductionService(user).autoAddAll(yearMonth);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue