Skip to content

Instantly share code, notes, and snippets.

@houyanan
houyanan / FiveDisabledPersoServiceImpl.java
Created September 29, 2014 07:06
新增时新增类型可以多选,且每个类型下面还有小类
修改时显示:
@Override
public FiveDisabledPerson get(Long id) {
FiveDisabledPerson person = fiveDisabledPersonDao.get(id);
String str = person.getDisabTypesStr();
String[] arr = str.split(",");
person.setDisabTypes(arr);
Map<Long, Long> disabTypeMap = new HashMap<Long, Long>();
for (String type_level : arr) {
if (StringUtil.isStringAvaliable(type_level)) {
@houyanan
houyanan / maintain.jsp
Last active August 29, 2015 14:07
ftl页面遍历list
<div class="grid_4 lable-right">
<label class="form-lbl">所在线路:</label>
</div>
<div class="grid_7">
<select name="fiveDisabledPerson.attentionLine.id" id="attentionLine" class='form-txt'>
<option value="">请选择</option>
<@s.iterator value="attentionLineList" var="attentionLine">
<option value="${(attentionLine.id)!}" <@s.if test="#attentionLine.id == fiveDisabledPerson.attentionLine.id">selected="true"</@s.if>>
${(attentionLine.name)!}
</option>
@houyanan
houyanan / calculateDistance
Last active August 29, 2015 14:05
获取距离基准点最近的坐标点
private double calculateDistance(Double x1, Double y1, Double x2, Double y2) {
double x = x1 - x2;
double y = y1 - y2;
return Math.sqrt(x * x + y * y);
}
@houyanan
houyanan / list页面
Created June 10, 2014 08:07
在线预览pdf文档
if(urlLastName=="pdf"){
pdfOnlineView(fn.id);
return;
}
function pdfOnlineView(attachmentId){
var fileActualUrl = getFileActualUrl(attachmentId); //得到在附件地址
@houyanan
houyanan / BusinessTrainingServiceImpl
Last active August 29, 2015 14:02
在线预览excle文档
if (lastName.equals("xls") || lastName.equals("xlsx")) {
InputStream inputStream = new FileInputStream(new File(FileUtil.getWebRoot()
+ File.separator + urlString));
XSSFWorkbook wb = new XSSFWorkbook(inputStream);
businessTrainingAttachments.setOnlineActualContent(POIReadExcelToHtml07.getExcelInfo(wb));
}
// 保存的时候用club字段保存tonlineActualContent
@houyanan
houyanan / BaseService.java
Last active January 3, 2016 02:29
Spring job
/product/src/java/com/tianque/service/BaseService.java
package com.tianque.service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.tianque.util.ThreadVariable;
@houyanan
houyanan / JugeIsEqualTag.java
Created January 13, 2014 06:06
自定义标签
/product/src/java/com/tianque/web/tag/JugeIsEqualTag.java
package com.tianque.web.tag;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.jsp.tagext.Tag;
import javax.servlet.jsp.tagext.TagSupport;
@Autowired
private ImportBasicExceService importBasicExceService;
public String dispath(){
if (DialogMode.ADD_MODE.equalsIgnoreCase(getMode())) {
importBasicExceService.addExcel();
dispachAddMode();
}
}