薪资项目删除校验

This commit is contained in:
钱涛 2023-02-17 15:58:33 +08:00
parent abeb4d891d
commit dc24b03efd
5 changed files with 59 additions and 1 deletions

View File

@ -9,6 +9,7 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
import java.util.Date;
/**
@ -108,4 +109,11 @@ public class SalarySobBackItemPO{
*/
@JsonIgnore
private Date updateTime;
/**
* 薪资项目id
*/
private Collection<Long> salaryItemIds;
}

View File

@ -122,7 +122,12 @@
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
<if test="salaryItemIds != null and salaryItemIds.size()>0">
AND salary_item_id IN
<foreach collection="salaryItemIds" open="(" item="salaryItemId" separator="," close=")">
#{salaryItemId}
</foreach>
</if>
ORDER BY id DESC
</select>

View File

@ -65,4 +65,5 @@ public interface SalarySobBackItemService {
*/
int deleteBySalarySobIds(Collection<Long> salarySobIds);
List<SalarySobBackItemPO> listBySalaryItemIds(Collection<Long> salaryItemIds);
}

View File

@ -28,6 +28,7 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import weaver.hrm.User;
@ -218,6 +219,14 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
newSalaryItemPO.setSharedType(saveParam.getSharedType());
newSalaryItemPO.setTaxAgentIds(saveParam.getTaxAgentIds());
salaryItemBiz.updateById(newSalaryItemPO);
String oldName = salaryItemPO.getName();
String newName = saveParam.getName();
if (!StringUtils.equals(oldName, newName)) {
}
// 记录日志
// LoggerContext<SalaryItemPO> loggerContext = new LoggerContext<>();
// loggerContext.setTargetId(String.valueOf(newSalaryItemPO.getId()));
@ -325,4 +334,34 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
private List<String> usingCodes;
}
public UsingItem getUsingItem(Long id) {
//薪资项目
SalaryItemPO items = getById(id);
//账套项目
List<SalarySobItemPO> sobItems = getSalarySobItemService(user).listBySalaryItemIds(Collections.singleton(id));
//回算项目
List<SalarySobBackItemPO> backItems = getSalarySobBackItemService(user).listBySalaryItemIds(Collections.singleton(id));
// //账套里的项目项目里的项目
// List<Long> sobItemIds = SalaryEntityUtil.properties(sobItems, SalarySobItemPO::getSalaryItemId, Collectors.toList());
// List<Long> backItemIds = SalaryEntityUtil.properties(backItems, SalarySobBackItemPO::getSalaryItemId, Collectors.toList());
// List<Long> usingItemIds = new ArrayList<>();
// usingItemIds.addAll(sobItemIds);
// usingItemIds.addAll(backItemIds);
//
// //使用中的code
// List<FormulaVar> formulaVars = getSalaryFormulaService(user).listVarByFormulaIds(usingFormulaIds);
// List<String> itemCode = formulaVars.stream().map(FormulaVar::getFieldId).map(v -> v.replaceAll("salaryItem_", "")).collect(Collectors.toList());
return UsingItem.builder().build();
}
}

View File

@ -112,4 +112,9 @@ public class SalarySobBackItemServiceImpl extends Service implements SalarySobBa
return getSalarySobBackItemMapper().deleteBySalarySobIds(salarySobIds);
}
@Override
public List<SalarySobBackItemPO> listBySalaryItemIds(Collection<Long> salaryItemIds) {
return getSalarySobBackItemMapper().listSome(SalarySobBackItemPO.builder().salaryItemIds(salaryItemIds).build());
}
}