mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 07:46:40 +08:00
完善
This commit is contained in:
@@ -51,6 +51,11 @@ public class EmpSalaryItemController {
|
||||
return R.success(this.service.genScript(Ctx.currentUser().getOrganizationId()));
|
||||
}
|
||||
|
||||
@PostMapping("/genScriptWithCompileResult")
|
||||
public Object genScriptWithCompileResult() {
|
||||
return R.success(this.service.genScriptWithCompileResult(Ctx.currentUser().getOrganizationId()));
|
||||
}
|
||||
|
||||
@PostMapping("/init")
|
||||
public Object init() {
|
||||
this.service.initOrg(Ctx.currentUser().getOrganizationId());
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cn.lihongjie.coal.empSalaryItem.service;
|
||||
|
||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||
import cn.lihongjie.coal.base.service.BaseService;
|
||||
@@ -657,6 +658,28 @@ public class EmpSalaryItemService
|
||||
repository.save(item3);
|
||||
}
|
||||
|
||||
public Object genScriptWithCompileResult(String organizationId) {
|
||||
|
||||
String script = genScript(organizationId);
|
||||
|
||||
Exception exception = null;
|
||||
try {
|
||||
|
||||
groovyScriptManager.compile(script);
|
||||
} catch (Exception e) {
|
||||
|
||||
exception = e;
|
||||
}
|
||||
|
||||
return Map.of(
|
||||
"script",
|
||||
script,
|
||||
"error",
|
||||
exception != null,
|
||||
"exception",
|
||||
exception == null ? "" : ExceptionUtil.stacktraceToString(exception));
|
||||
}
|
||||
|
||||
public String genScript(String organizationId) {
|
||||
|
||||
List<EmpSalaryItemEntity> items =
|
||||
|
||||
@@ -28,7 +28,7 @@ INSERT INTO t_emp_salary_sys_item (id, create_time, create_user_id, file_ids, up
|
||||
scale = scale ?: 2
|
||||
mode = mode ?: 0
|
||||
|
||||
def d = BigDecimal.valueOf(Double.valueOf(val + "").doubleValue()).stripTrailingZeros() on conflict (id) do nothing;
|
||||
def d = BigDecimal.valueOf(Double.valueOf(val + "").doubleValue()).stripTrailingZeros();
|
||||
if (d.scale() <= scale) {
|
||||
return d
|
||||
}
|
||||
@@ -262,7 +262,7 @@ INSERT INTO t_emp_salary_sys_item (id, create_time, create_user_id, file_ids, up
|
||||
|
||||
|
||||
|
||||
for (int i = 0 on conflict (id) do nothing; i < y.size() on conflict (id) do nothing; i += 2) {
|
||||
for (int i = 0 ; i < y.size() ; i += 2) {
|
||||
if (x == y[i]) {
|
||||
return y[i + 1]
|
||||
}
|
||||
@@ -298,7 +298,7 @@ INSERT INTO t_emp_salary_sys_item (id, create_time, create_user_id, file_ids, up
|
||||
def TABLE(def... y){
|
||||
|
||||
|
||||
for (int i = 0 on conflict (id) do nothing; i < y.size() on conflict (id) do nothing; i += 2) {
|
||||
for (int i = 0 ; i < y.size() ; i += 2) {
|
||||
if (y[i]) {
|
||||
return y[i + 1]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user