package cn.autoform.web.service.formevent;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import cn.autoform.db.entity.CodeMasterEntity;
|
import cn.autoform.db.entity.FormEventEntity;
|
import cn.autoform.db.entity.FormFieldEntity;
|
import cn.autoform.web.mapper.formevent.FormEventMapper;
|
import cn.autoform.web.service.common.CommonService;
|
|
@Service
|
public class FormEventService {
|
|
@Autowired
|
private FormEventMapper formEventMapper = null;
|
|
@Autowired
|
private CommonService commonService = null;
|
|
/**
|
*
|
* @param tenantID
|
* @param formID
|
* @return
|
*/
|
public List<FormEventEntity> getFormEventList(String tenantID,String formID) {
|
return formEventMapper.getFormEventList(tenantID, formID);
|
}
|
|
/**
|
*
|
* @param tenantID
|
* @param formID
|
* @return
|
*/
|
public List<FormFieldEntity> getFieldListwithType(String tenantID,String formID) {
|
List<FormFieldEntity> rsList = new ArrayList<>();
|
|
List<CodeMasterEntity> listCode = commonService.queryCodeAndValue("006", "000");
|
|
|
List<FormFieldEntity> listFieldAll = formEventMapper.getFieldListwithType(tenantID, formID);
|
for(FormFieldEntity formField : listFieldAll) {
|
String fieldType = formField.getFieldtype();
|
for(CodeMasterEntity code : listCode) {
|
if(code.getContent().equalsIgnoreCase(fieldType)) {
|
rsList.add(formField);
|
}
|
}
|
}
|
|
return rsList;
|
}
|
|
/**
|
*
|
* @param formID
|
* @param fieldName
|
* @param tenantID
|
* @param event
|
* @param fieldType
|
* @param eventmethod
|
* @param createUser
|
* @return
|
*/
|
public int createFormEvent(FormEventEntity formEventEntity) {
|
List<FormFieldEntity> listField = formEventMapper.getFieldEventList(formEventEntity.getTenantID(), formEventEntity.getFormID(), formEventEntity.getFieldName());
|
FormFieldEntity formField = listField.get(0);
|
formEventEntity.setFieldName(formField.getFieldKey());
|
formEventEntity.setFieldType(formField.getFieldtype());
|
|
return formEventMapper.createFormEvent(formEventEntity);
|
}
|
|
/**
|
*
|
* @param formID
|
* @param fieldName
|
* @param tenantID
|
* @param event
|
* @return
|
*/
|
public int deleteFormEvent(String formID,String fieldName, String tenantID, String event) {
|
return formEventMapper.deleteFormEvent(formID, fieldName, tenantID, event);
|
}
|
|
/**
|
*
|
* @param tenantID
|
* @param formID
|
* @param columnOrderNum
|
* @return
|
*/
|
public List<CodeMasterEntity> getFieldEventList(String tenantID,String formID,String columnOrderNum) {
|
|
List<FormFieldEntity> listField = formEventMapper.getFieldEventList(tenantID, formID, columnOrderNum);
|
List<CodeMasterEntity> rsList = new ArrayList<>();
|
FormFieldEntity formField = listField.get(0);
|
|
String strType = formField.getFieldtype();
|
|
List<CodeMasterEntity> listCode = commonService.queryCodeAndValue("006", "000");
|
|
for(CodeMasterEntity code : listCode) {
|
if(code.getContent().equalsIgnoreCase(strType)) {
|
rsList = commonService.queryCodeAndValue("007", code.getCode());
|
return rsList;
|
}
|
}
|
return rsList;
|
}
|
|
/**
|
*
|
* @param tenantID
|
* @param formID
|
* @param fieldName
|
* @return
|
*/
|
public List<FormEventEntity> getEventList(String tenantID,String formID, String fieldName) {
|
return formEventMapper.getEventList(tenantID, formID, fieldName);
|
}
|
}
|