Commit 84c72702 authored by hongguangwu's avatar hongguangwu

MVP1.6.2-工资原表识别-主逻辑提交

parent a4b7790d
......@@ -132,20 +132,35 @@ public class TSalaryStandardOriginalController {
@Transactional
public R<Boolean> updateById(@RequestBody TSalaryStandardOriginal tSalaryStandardOriginal) {
List<TSalaryStandardOriginalDetail> detailList = tSalaryStandardOriginal.getDetailList();
if (detailList == null || detailList.isEmpty()) {
return R.failed("请传配置表头list");
}
// 先删除关系
tSalaryStandardOriginalDetailService.deleteByOrgId(tSalaryStandardOriginal.getId());
for (TSalaryStandardOriginalDetail detail : detailList) {
detail.setOriginalId(tSalaryStandardOriginal.getId());
if (Common.isNotNull(tSalaryStandardOriginal.getId())
&& Common.isNotNull(tSalaryStandardOriginal.getDeptId())
&& Common.isNotNull(tSalaryStandardOriginal.getSetName())){
List<TSalaryStandardOriginalDetail> detailList = tSalaryStandardOriginal.getDetailList();
if (detailList == null || detailList.isEmpty()) {
return R.failed("请传配置表头list");
}
// 判重
TSalaryStandardOriginal isCur = new TSalaryStandardOriginal();
isCur.setId(tSalaryStandardOriginal.getId());
isCur.setDeptId(tSalaryStandardOriginal.getDeptId());
isCur.setSetName(tSalaryStandardOriginal.getSetName());
List<TSalaryStandardOriginal> curList = tSalaryStandardOriginalService.getTSalaryStandardOriginalList(isCur);
if (curList != null && !curList.isEmpty()) {
return R.failed("该项目下已存在此原表类型,请修改!");
}
// 先删除关系
tSalaryStandardOriginalDetailService.deleteByOrgId(tSalaryStandardOriginal.getId());
for (TSalaryStandardOriginalDetail detail : detailList) {
detail.setOriginalId(tSalaryStandardOriginal.getId());
}
// 再新增权限
tSalaryStandardOriginalDetailService.saveBatch(detailList);
// 再保存
tSalaryStandardOriginalService.updateById(tSalaryStandardOriginal);
return R.ok(true);
} else {
return R.failed("请传参!");
}
// 再新增权限
tSalaryStandardOriginalDetailService.saveBatch(detailList);
// 再保存
tSalaryStandardOriginalService.updateById(tSalaryStandardOriginal);
return R.ok(true);
}
/**
......@@ -231,17 +246,6 @@ public class TSalaryStandardOriginalController {
}
}
public static MultipartFile convert(String data, String filename, String contentType) throws Exception {
byte[] bytes = data.getBytes();
InputStream inputStream = new ByteArrayInputStream(bytes);
FileItem fileItem = new DiskFileItem("file", contentType, false, filename, bytes.length, new File("/originalTmp"));
fileItem.getOutputStream().write(bytes);
return new CommonsMultipartFile(fileItem);
}
/**
* @Description: 获取表头等信息
* @Author: hgw
......
......@@ -64,7 +64,7 @@
<sql id="TSalaryStandardOriginal_where">
<if test="tSalaryStandardOriginal != null">
<if test="tSalaryStandardOriginal.id != null and tSalaryStandardOriginal.id.trim() != ''">
AND a.ID = #{tSalaryStandardOriginal.id}
AND a.ID != #{tSalaryStandardOriginal.id}
</if>
<if test="tSalaryStandardOriginal.deptId != null and tSalaryStandardOriginal.deptId.trim() != ''">
AND a.DEPT_ID = #{tSalaryStandardOriginal.deptId}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment