花名册模板接口内部8个完成

钱智金融
Chengliang 1 month ago
parent c54bcc26c8
commit ad5400dfaf

@ -110,7 +110,41 @@ public class HrmCustomTemplateAction {
try {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
getService(user).updateCustomTemplateFields(map);
getService(user).updateCustomTemplateFields(map);
data.put("api_status", true);
} catch (Exception e) {
data.put("api_status", false);
data.put("msg", "catch exception : " + e.getMessage());
}
return JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect);
}
@GET
@Path("/customTemplateTable")
@Produces(MediaType.TEXT_PLAIN)
public String customTemplateTable(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> data = new HashMap<>(8);
try {
User user = HrmUserVarify.getUser(request, response);
data.put("result",getService(user).customTemplateTable());
data.put("api_status", true);
} catch (Exception e) {
data.put("api_status", false);
data.put("msg", "catch exception : " + e.getMessage());
}
return JSONObject.toJSONString(data, SerializerFeature.DisableCircularReferenceDetect);
}
@POST
@Path("/saveCustomTemplateTable")
@Produces(MediaType.TEXT_PLAIN)
public String saveCustomTemplateTable(@Context HttpServletRequest request, @Context HttpServletResponse response){
Map<String, Object> data = new HashMap<>(8);
try {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
getService(user).saveCustomTemplateTable(map);
data.put("api_status", true);
} catch (Exception e) {
data.put("api_status", false);

@ -28,4 +28,6 @@ public class CustomTemplateVo {
private Integer belongto;
private String modedatacreatedate;
}

@ -0,0 +1,30 @@
package com.engine.qz.entity;
import com.api.hrm.util.FieldType;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author Apple
* @Date 2025/3/13 09:40
* @Description:
* @Version 1.0
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class EditTableColumn {
private String fieldName;
private String fieldNameDesc;
private FieldType fieldType;
private Integer viewAttr;
}

@ -60,4 +60,21 @@ public interface HrmCustomTemplateService {
* @return: java.util.Map<java.lang.String,java.lang.Object>
*/
LinkedList<String> getTemplateSelectKeys(String templateId);
/**
* @Description:
* @Author: Apple
* @Date: 2025/3/11 13:49
* @return: java.util.Map<java.lang.String,java.lang.Object>
*/
Map<String, Object> customTemplateTable();
/**
* @Description:
* @Author: Apple
* @Date: 2025/3/11 13:49
*/
void saveCustomTemplateTable(Map<String, Object> params);
}

@ -1,16 +1,24 @@
package com.engine.qz.service.impl;
import com.api.hrm.bean.FieldItem;
import com.api.hrm.util.FieldType;
import com.engine.core.impl.Service;
import com.engine.qz.entity.CustomTemplateVo;
import com.engine.qz.entity.CustomTranscerDataVo;
import com.engine.qz.entity.EditTableColumn;
import com.engine.qz.entity.TemplateFieldsPo;
import com.engine.qz.service.HrmCustomTemplateService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.conn.RecordSet;
import java.util.*;
import java.util.stream.Collectors;
import static weaver.general.Util.getIntValue;
/**
@ -53,7 +61,7 @@ public class HrmCustomTemplateServiceImpl extends Service implements HrmCustomTe
RecordSet rs = new RecordSet();
LinkedList<CustomTemplateVo> customTemplateVos = new LinkedList<>();
rs.executeQuery("select id,templateName,templateFields,isused,belongto from uf_custom_template \n" +
rs.executeQuery("select id,templateName,templateFields,isused,belongto,modedatacreatedate from uf_custom_template \n" +
"where belongto = ? order by id asc",user.getUID());
while (rs.next()) {
@ -63,6 +71,7 @@ public class HrmCustomTemplateServiceImpl extends Service implements HrmCustomTe
.templateFields(Util.null2String(rs.getString("templateFields")))
.isused(Util.getIntValue(rs.getString("isused")))
.belongto(Util.getIntValue(rs.getString("belongto")))
.modedatacreatedate(Util.null2String(rs.getString("modedatacreatedate")))
.build());
}
@ -128,6 +137,87 @@ public class HrmCustomTemplateServiceImpl extends Service implements HrmCustomTe
return new LinkedList<>(Arrays.asList(customTemplate.getTemplateFields().split(",")));
}
@Override
public Map<String, Object> customTemplateTable() {
Map<String, Object> result = new HashMap<>(4);
List<EditTableColumn> columns = new ArrayList<>();
columns.add(EditTableColumn.builder().viewAttr(3).fieldName("templateName").fieldNameDesc("模板名称").fieldType(FieldType.INPUT).build());
columns.add(EditTableColumn.builder().viewAttr(1).fieldName("modedatacreatedate").fieldNameDesc("创建日期").fieldType(FieldType.INPUT).build());
List<Map<String, Object>> lsCol = new ArrayList<>();
Map<String, Object> col;
int width = 100 / columns.size();
for (EditTableColumn editTableColumn : columns) {
String tmpkey = editTableColumn.getFieldName();
col = new HashMap<>(8);
col.put("title", editTableColumn.getFieldNameDesc());
col.put("key", tmpkey);
col.put("dataIndex", tmpkey);
col.put("com", getFieldDetailInfo(editTableColumn,width));
col.put("width", width + "%");
lsCol.add(col);
}
result.put("columns",lsCol);
LinkedList<CustomTemplateVo> templateVos = getCustomTemplate();
List<Map<String, Object>> collect = templateVos.stream().map(item -> {
Map<String, Object> resultMap = new HashMap<>(8);
resultMap.put("id", item.getKey());
resultMap.put("templateName", item.getShowname());
resultMap.put("modedatacreatedate", item.getModedatacreatedate());
return resultMap;
}).collect(Collectors.toList());
result.put("datas", collect);
return result;
}
@Override
public void saveCustomTemplateTable(Map<String, Object> params) {
LinkedList<CustomTemplateVo> customTemplateList = getCustomTemplate();
LinkedList<String> keyList = customTemplateList.stream()
.map(CustomTemplateVo::getKey)
.collect(Collectors.toCollection(LinkedList::new));
int rowNum = getIntValue((String) params.get("rownum"));
RecordSet rs = new RecordSet();
for (int i = 0; i < rowNum; i++) {
String recordIndex = "_" + i;
String id = Util.null2String(params.get("id" + recordIndex));
String templateName = Util.null2String(params.get("templateName" + recordIndex));
rs.executeUpdate("update uf_custom_template set templateName = ? where id = ?",templateName,id);
keyList.remove(id);
}
if (CollectionUtils.isNotEmpty(keyList)) {
String value = StringUtils.join(keyList,",");
rs.executeUpdate("delete from uf_custom_template where id in ("+value+")");
}
}
private List<FieldItem> getFieldDetailInfo(EditTableColumn column,int width) {
List<FieldItem> ls = new ArrayList<>();
FieldItem fieldItem = new FieldItem();
fieldItem.setType(column.getFieldType());
fieldItem.setKey(column.getFieldName());
fieldItem.setViewAttr(column.getViewAttr());
switch (fieldItem.getType()) {
case INPUT:
Map<String, Object> otherParams = new HashMap<>(2);
otherParams.put("inputType","multilang");
fieldItem.setOtherParams(otherParams);
break;
default:
break;
}
fieldItem.setWidth(width + "%");
ls.add(fieldItem);
return ls;
}
private LinkedList<TemplateFieldsPo> rosterList() {

Loading…
Cancel
Save