处理冲突
dev
ic_excellent 2023-07-06 11:15:53 +08:00
commit 6fe6171532
8 changed files with 106 additions and 17 deletions

View File

@ -916,8 +916,15 @@ $(() => {
$(() => {
let config = {
conditions: {},
tableName: "",
// 条件
conditions: {
lx: '',
bxxx: ''
},
// 表名
tableName: "uf_hgpxtz",
// 文档字段
docIdField: 'clwd'
}
function pxlx() {
@ -925,12 +932,70 @@ $(() => {
if (datas && datas.length >= 1) {
let obj = datas[0];
let value = obj.lx
console.log(obj)
Object.keys(config.conditions).forEach(key => {
config.conditions[key] = obj[key]
})
api({
url: "/api/aiyh/exam-btn/control/is-read",
type: "POST",
data: JSON.stringify(config),
contentType: "application/json"
}).then(res => {
if (res && res.code == 200) {
if (res.data) {
let url = "/spa/workflow/index_form.jsp#/main/workflow/req?iscreate=1&workflowid=306&field24498=" + value;
window.open(url);
} else {
ModeList.showMessage("需要查看所有考试相关文档后方可考试,请先查看考试材料!", 1, 2);
}
} else {
ModeList.showMessage("系统错误,请稍后尝试!", 2, 1.5);
}
})
}
}
window.pxlx = pxlx
/**
* @author youhong.ai
* @desc 发起请求
*/
function api(requestOptions = {
url: "",
type: "GET",
data: "",
isAsync: true,
success: () => {
},
error: () => {
},
complete: () => {
},
contentType: 'application/json',
beforeSend: () => {
}
}) {
let options = Object.assign({
url: "",
type: "GET",
data: "",
isAsync: true,
success: () => {
},
error: () => {
},
complete: () => {
},
contentType: 'application/json',
beforeSend: () => {
}
}, requestOptions)
return $.ajax(options)
}
})
/* ******************* youhong.ai 限制考试按钮点击 end ******************* */

View File

@ -128,7 +128,6 @@ public class MapperBuilderSql {
}
sb.append(entry.getKey()).append("}").append(" and ");
}
sb.deleteCharAt(sb.length() - 5);
return sb.toString();
return sb.substring(0, sb.length() - 5);
}
}

View File

@ -38,7 +38,7 @@ public class RsThreadLocalManager {
* @author youHong.ai ******************************************
*/
private void startMonitor() {
executor.scheduleAtFixedRate(this::checkExpireRs, 0, 10, TimeUnit.MINUTES);
executor.scheduleAtFixedRate(this::checkExpireRs, 0, 5, TimeUnit.MINUTES);
}
/**
@ -111,7 +111,7 @@ public class RsThreadLocalManager {
* @author youHong.ai ******************************************
*/
public Long getExpireTime() {
return System.currentTimeMillis() + 1000L * 60 * 10;
return System.currentTimeMillis() + 1000L * 60 * 5;
}
@ -159,9 +159,16 @@ public class RsThreadLocalManager {
public boolean commit(String className) {
RecordSetTrans recordSetTrans = getRecordSetTrans(className);
removeRsOrTrans();
setRecordSetTrans(className);
return recordSetTrans.commit();
}
public void removeRsOrTrans() {
rsMap.remove(Thread.currentThread().getId());
}
private RecordSetTrans getRecordSetTrans(String className) {
Map<String, RsThreadLocalMap> map = rsMap.get(Thread.currentThread().getId());
if (Objects.isNull(map)) {
@ -172,13 +179,14 @@ public class RsThreadLocalManager {
throw new CustomerException("can not find RecordSetTrans instance! please Contact the developer of RecordsetUtil.java");
}
rsThreadLocalMap.setExpireTime(getExpireTime());
RecordSetTrans recordSetTrans = rsThreadLocalMap.getRecordSetTrans();
return recordSetTrans;
return rsThreadLocalMap.getRecordSetTrans();
}
public boolean rollback(String className) {
RecordSetTrans recordSetTrans = getRecordSetTrans(className);
removeRsOrTrans();
setRecordSetTrans(className);
return recordSetTrans.rollback();
}

View File

@ -10,7 +10,10 @@ import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.*;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Map;
@ -32,11 +35,12 @@ public class ExamBtnControlController {
@Path("/is-read")
@POST
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public String isReadDoc(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody Map<String,Object> params) {
@RequestBody Map<String, Object> params) {
try {
User user = HrmUserVarify.getUser(request, response);
return ApiResult.success(service.isReadDoc(user,params));
return ApiResult.success(service.isReadDoc(user, params));
} catch (Exception e) {
log.error("is read doc error!\n" + Util.getErrString(e));
return ApiResult.error("system error!");

View File

@ -5,6 +5,7 @@ import aiyh.utils.annotation.recordset.Select;
import aiyh.utils.annotation.recordset.SqlMapper;
import java.util.List;
import java.util.Map;
/**
* <h1></h1>
@ -28,7 +29,8 @@ public interface ExamBtnControlMapper {
@Select("select $t{docIdField} from $t{tableName} $t{whereSql}")
List<String> selectDocIds(@ParamMapper("tableName") String tableName,
@ParamMapper("docIdField") String docIdField,
@ParamMapper("whereSql") String whereSql);
@ParamMapper("whereSql") String whereSql,
@ParamMapper("where") Map<String, Object> conditions);
/**
* <h2></h2>

View File

@ -43,12 +43,12 @@ public class ExamBtnControlService {
if (CollectionUtil.isEmpty(conditions)) {
return false;
}
String where = MapperBuilderSql.builderNoWhereAndEn(conditions, true);
String where = MapperBuilderSql.builderWhereAnd(conditions, "where", true);
if (StrUtil.isBlank(where)) {
log.error("没有生成where条件");
return false;
}
List<String> docIdList = mapper.selectDocIds(tableName, docIdField, where);
List<String> docIdList = mapper.selectDocIds(tableName, docIdField, where, conditions);
if (CollectionUtil.isEmpty(docIdList)) {
throw new CustomerException("没有查询到对应的文件ID信息请检查sql");
}

View File

@ -69,6 +69,7 @@ public class BuilderPackageEcology extends Application {
clearSelections();
updateTreeView();
showSuccessAlert("升级包制作成功!");
System.out.println("压缩包位置: " + outputFile.getPath());
} catch (IOException e) {
throw new RuntimeException(e);
}

View File

@ -2,6 +2,7 @@ package youhong.ai.pcn;
import aiyh.utils.GenerateFileUtil;
import aiyh.utils.Util;
import aiyh.utils.recordset.MapperBuilderSql;
import aiyh.utils.tool.org.apache.commons.jexl3.*;
import basetest.BaseTest;
import com.alibaba.fastjson.JSON;
@ -308,4 +309,13 @@ public class UtilTest extends BaseTest {
public void testSS() {
out.println(Util.getTime("yyyyMMddHHmmssSSSS"));
}
@Test
public void testssfss() {
Map<String, Object> map = new HashMap<>();
map.put("lx", "2");
map.put("dxxx", "2");
out.println(MapperBuilderSql.builderWhereAnd(map, "where", true));
}
}