Compare commits

...

2 Commits

Author SHA1 Message Date
youhong.ai a6b7892dd6 Merge branch 'dev' of https://gitea.yeyaguitu.cn/ecology/ebu_ecology_dev1 into dev
合并修改
2023-07-05 23:31:58 +08:00
youhong.ai 96aa323751 修改 2023-07-05 23:31:54 +08:00
6 changed files with 227 additions and 0 deletions

View File

@ -0,0 +1,68 @@
(function runJs() {
let currentYear = new Date().getFullYear();
let currentMonth = new Date().getMonth() + 1;
let currentDate = new Date().getDate();
let month = prompt("请输入月份1-12", currentMonth);
let day = prompt("请输入日期1-31", currentDate);
let dateInput = new Date(currentYear, month - 1, day);
let year = dateInput.getFullYear();
let formattedMonth = ("0" + (dateInput.getMonth() + 1)).slice(-2);
let formattedDay = ("0" + dateInput.getDate()).slice(-2);
let date = year + "-" + formattedMonth + "-" + formattedDay;
let todate = date + " 23:00";
let fromDate = date + " 08:00";
let wf = WeFormSDK.getWeFormInstance();
wf.changeFieldValue("100003720000000607", {value: fromDate});
wf.changeFieldValue("100003720000000609", {value: todate});
wf.changeFieldValue("100003720000030038", {value: '0'});
wf.changeFieldValue("100003720000000611", {value: "外出技术支持"});
wf.changeFieldValue("100003720000008715", {value: '2'});
wf.changeFieldValue("877132351682273302", {value: '1'});
let workflowTitleObj = document.querySelector('input[weid="3rdcst_oxa9w7_i8bbvp_vc1wev_kc1m3l_r1vh81_snhw9p_3r9w93_g28s4n_abfe5k_a9abii"');
let workflowTitle = workflowTitleObj.value;
workflowTitleObj.value = workflowTitle.substring(0, workflowTitle.length - 5) + formattedMonth + "-" + formattedDay;
const container = document.getElementById("widget_100003720000000664");
const svgIcon = container.querySelector(".associative-search-icon svg");
if (svgIcon) {
svgIcon.dispatchEvent(new MouseEvent('click', {
bubbles: true,
cancelable: true,
view: window
}));
}
let closeTab = window.close;
window.close = () => {
window.open('/sp/workflow/flowpage/fullCreate/100003460000000746?workflowId=100003460000000746&isCreate=1', "_blank");
closeTab()
}
})()
(function runJs() {
let currentYear = new Date().getFullYear();
let currentMonth = new Date().getMonth() + 1;
let currentDate = new Date().getDate();
let month = prompt("请输入月份1-12", currentMonth);
let day = prompt("请输入日期1-31", currentDate);
let dateInput = new Date(currentYear, month - 1, day);
let year = dateInput.getFullYear();
let formattedMonth = ("0" + (dateInput.getMonth() + 1)).slice(-2);
let formattedDay = ("0" + dateInput.getDate()).slice(-2);
let date = year + "-" + formattedMonth + "-" + formattedDay;
let todate = date + " 23:00";
let fromDate = date + " 08:00";
let wf = WeFormSDK.getWeFormInstance();
wf.changeFieldValue("100003720000000607", {value: fromDate});
wf.changeFieldValue("100003720000000609", {value: todate});
wf.changeFieldValue("100003720000030038", {value: '0'});
wf.changeFieldValue("100003720000000611", {value: "外出技术支持"});
wf.changeFieldValue("100003720000008715", {value: '4'});
wf.changeFieldValue("877132351682273302", {value: '1'});
let workflowTitleObj = document.querySelector('input[weid="3rdcst_oxa9w7_i8bbvp_vc1wev_kc1m3l_r1vh81_snhw9p_3r9w93_g28s4n_abfe5k_a9abii"');
let workflowTitle = workflowTitleObj.value;
workflowTitleObj.value = workflowTitle.substring(0, workflowTitle.length - 5) + formattedMonth + "-" + formattedDay;
})()

View File

@ -0,0 +1,45 @@
package com.api.youhong.ai.pcn.examcontrol.controller;
import aiyh.utils.ApiResult;
import aiyh.utils.Util;
import com.api.youhong.ai.pcn.examcontrol.service.ExamBtnControlService;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.apache.log4j.Logger;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Map;
/**
* <h1></h1>
*
* <p>create: 2023/7/5 16:33</p>
*
* @author youHong.ai
*/
@Path("/aiyh/exam-btn/control")
public class ExamBtnControlController {
private final Logger log = Util.getLogger();
private final ExamBtnControlService service = new ExamBtnControlService();
@Path("/is-read")
@POST
@Produces(MediaType.APPLICATION_JSON)
public String isReadDoc(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody Map<String,Object> params) {
try {
User user = HrmUserVarify.getUser(request, response);
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

@ -0,0 +1,43 @@
package com.api.youhong.ai.pcn.examcontrol.mapper;
import aiyh.utils.annotation.recordset.ParamMapper;
import aiyh.utils.annotation.recordset.Select;
import aiyh.utils.annotation.recordset.SqlMapper;
import java.util.List;
/**
* <h1></h1>
*
* <p>create: 2023/7/5 16:59</p>
*
* @author youHong.ai
*/
@SqlMapper
public interface ExamBtnControlMapper {
/**
* <h2>id</h2>
*
* @param tableName
* @param docIdField id
* @param whereSql
* @return id
*/
@Select("select $t{docIdField} from $t{tableName} $t{whereSql}")
List<String> selectDocIds(@ParamMapper("tableName") String tableName,
@ParamMapper("docIdField") String docIdField,
@ParamMapper("whereSql") String whereSql);
/**
* <h2></h2>
*
* @param userId ID
* @param docIds ID
* @return
*/
@Select("select id from docreadtag where userid = #{userId} and docid in ($t{docIds})")
List<Integer> selectReadTag(@ParamMapper("userId") int userId,
@ParamMapper("docIds") String docIds);
}

View File

@ -0,0 +1,61 @@
package com.api.youhong.ai.pcn.examcontrol.service;
import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException;
import aiyh.utils.recordset.MapperBuilderSql;
import aiyh.utils.tool.cn.hutool.core.collection.CollectionUtil;
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
import com.api.youhong.ai.pcn.examcontrol.mapper.ExamBtnControlMapper;
import org.apache.log4j.Logger;
import weaver.hrm.User;
import java.util.List;
import java.util.Map;
/**
* <h1></h1>
*
* <p>create: 2023/7/5 16:39</p>
*
* @author youHong.ai
*/
public class ExamBtnControlService {
private final Logger log = Util.getLogger();
private final ExamBtnControlMapper mapper = Util.getMapper(ExamBtnControlMapper.class);
public boolean isReadDoc(User user, Map<String, Object> params) {
// 系统管理员可以直接考试
if (user.isAdmin()) {
return true;
}
// 没有参数不给考试
if (CollectionUtil.isEmpty(params)) {
return false;
}
// 获取表名称
String tableName = Util.null2String(params.get("tableName"));
String docIdField = Util.null2String(params.get("docIdField"));
Map<String, Object> conditions = (Map<String, Object>) params.get("conditions");
if (CollectionUtil.isEmpty(conditions)) {
return false;
}
String where = MapperBuilderSql.builderNoWhereAndEn(conditions, true);
if (StrUtil.isBlank(where)) {
log.error("没有生成where条件");
return false;
}
List<String> docIdList = mapper.selectDocIds(tableName, docIdField, where);
if (CollectionUtil.isEmpty(docIdList)) {
throw new CustomerException("没有查询到对应的文件ID信息请检查sql");
}
List<Integer> readIdList = mapper.selectReadTag(user.getUID(), Util.join(docIdList, ","));
if (CollectionUtil.isEmpty(readIdList)) {
return false;
}
return readIdList.size() == docIdList.size();
}
}

View File

@ -6,6 +6,7 @@ import aiyh.utils.tool.org.apache.commons.jexl3.*;
import basetest.BaseTest; import basetest.BaseTest;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.api.youhong.ai.jitu.hrmlogintip.service.HrmLoinTipService; import com.api.youhong.ai.jitu.hrmlogintip.service.HrmLoinTipService;
import com.weaver.formmodel.util.EncryptHelper;
import ebu7common.youhong.ai.bean.Builder; import ebu7common.youhong.ai.bean.Builder;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.junit.Test; import org.junit.Test;
@ -44,6 +45,13 @@ import static java.lang.System.out;
public class UtilTest extends BaseTest { public class UtilTest extends BaseTest {
@Test
public void testpass() {
out.println(EncryptHelper.encodeMd5("123").toUpperCase());
}
@Test @Test
public void test() { public void test() {

View File

@ -32,6 +32,8 @@ public class ParseTest extends BaseTest {
public void test() { public void test() {
MainTable baseData = getBaseData(); MainTable baseData = getBaseData();
Map<String, Object> resultData = getResultData(); Map<String, Object> resultData = getResultData();
System.out.println(JSON.toJSONString(baseData));
System.out.println(JSON.toJSONString(resultData));
List<DetailTableAlias> aliasesList = baseData.getAliasesList(); List<DetailTableAlias> aliasesList = baseData.getAliasesList();
Map<String, Object> resultParas = new HashMap<>(); Map<String, Object> resultParas = new HashMap<>();
Map<String, Object> dateMap = new HashMap<>(resultData); Map<String, Object> dateMap = new HashMap<>(resultData);