Commit 84c72702 authored by hongguangwu's avatar hongguangwu

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

parent a4b7790d
...@@ -132,20 +132,35 @@ public class TSalaryStandardOriginalController { ...@@ -132,20 +132,35 @@ public class TSalaryStandardOriginalController {
@Transactional @Transactional
public R<Boolean> updateById(@RequestBody TSalaryStandardOriginal tSalaryStandardOriginal) { public R<Boolean> updateById(@RequestBody TSalaryStandardOriginal tSalaryStandardOriginal) {
List<TSalaryStandardOriginalDetail> detailList = tSalaryStandardOriginal.getDetailList(); if (Common.isNotNull(tSalaryStandardOriginal.getId())
if (detailList == null || detailList.isEmpty()) { && Common.isNotNull(tSalaryStandardOriginal.getDeptId())
return R.failed("请传配置表头list"); && Common.isNotNull(tSalaryStandardOriginal.getSetName())){
} List<TSalaryStandardOriginalDetail> detailList = tSalaryStandardOriginal.getDetailList();
// 先删除关系 if (detailList == null || detailList.isEmpty()) {
tSalaryStandardOriginalDetailService.deleteByOrgId(tSalaryStandardOriginal.getId()); return R.failed("请传配置表头list");
for (TSalaryStandardOriginalDetail detail : detailList) { }
detail.setOriginalId(tSalaryStandardOriginal.getId()); // 判重
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 { ...@@ -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: 获取表头等信息 * @Description: 获取表头等信息
* @Author: hgw * @Author: hgw
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
<sql id="TSalaryStandardOriginal_where"> <sql id="TSalaryStandardOriginal_where">
<if test="tSalaryStandardOriginal != null"> <if test="tSalaryStandardOriginal != null">
<if test="tSalaryStandardOriginal.id != null and tSalaryStandardOriginal.id.trim() != ''"> <if test="tSalaryStandardOriginal.id != null and tSalaryStandardOriginal.id.trim() != ''">
AND a.ID = #{tSalaryStandardOriginal.id} AND a.ID != #{tSalaryStandardOriginal.id}
</if> </if>
<if test="tSalaryStandardOriginal.deptId != null and tSalaryStandardOriginal.deptId.trim() != ''"> <if test="tSalaryStandardOriginal.deptId != null and tSalaryStandardOriginal.deptId.trim() != ''">
AND a.DEPT_ID = #{tSalaryStandardOriginal.deptId} 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