Commit 0c92a388ae07c910332098111823ebb31669bdc3
1 parent
21ed093b
车辆充电量:excel导入异常报错提示;枪和桩分开字段;添加批次号;去掉一次不能正常充电记录;添加修改;保存导入文件并提供下载;导入的分钟数做2分钟内误差校验。
Showing
11 changed files
with
439 additions
and
106 deletions
src/main/java/com/bsth/controller/oil/JdlController.java
| ... | ... | @@ -5,17 +5,15 @@ import java.util.HashMap; |
| 5 | 5 | import java.util.List; |
| 6 | 6 | import java.util.Map; |
| 7 | 7 | |
| 8 | +import javax.servlet.http.HttpServletResponse; | |
| 9 | + | |
| 8 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 11 | import org.springframework.web.bind.annotation.RequestMapping; |
| 10 | 12 | import org.springframework.web.bind.annotation.RequestMethod; |
| 11 | 13 | import org.springframework.web.bind.annotation.RequestParam; |
| 12 | 14 | import org.springframework.web.bind.annotation.RestController; |
| 13 | 15 | import org.springframework.web.multipart.MultipartFile; |
| 14 | -import org.springframework.web.servlet.ModelAndView; | |
| 15 | 16 | |
| 16 | -import com.alibaba.fastjson.JSON; | |
| 17 | -import com.alibaba.fastjson.JSONArray; | |
| 18 | -import com.alibaba.fastjson.JSONObject; | |
| 19 | 17 | import com.bsth.controller.BaseController; |
| 20 | 18 | import com.bsth.entity.oil.Jdl; |
| 21 | 19 | import com.bsth.entity.oil.JdlReception; |
| ... | ... | @@ -90,4 +88,14 @@ public class JdlController extends BaseController<Jdl, Integer> { |
| 90 | 88 | return jdlService.deleteJdlReceptionBatch(map); |
| 91 | 89 | } |
| 92 | 90 | |
| 91 | + @RequestMapping(value = "/updateJdlReceptionBatch",method = RequestMethod.POST) | |
| 92 | + public Map<String, Object> updateJdlReceptionBatch(@RequestParam Map<String, Object> map) throws Exception{ | |
| 93 | + return jdlService.updateJdlReceptionBatch(map); | |
| 94 | + } | |
| 95 | + | |
| 96 | + @RequestMapping(value = "/downloadJdlReceptionImportFile",method = RequestMethod.GET) | |
| 97 | + public void downloadJdlReceptionImportFile(@RequestParam Map<String, Object> map, HttpServletResponse response) throws Exception{ | |
| 98 | + jdlService.downloadJdlReceptionImportFile(map, response); | |
| 99 | + } | |
| 100 | + | |
| 93 | 101 | } | ... | ... |
src/main/java/com/bsth/entity/oil/JdlReception.java
| ... | ... | @@ -31,6 +31,7 @@ import org.springframework.format.annotation.DateTimeFormat; |
| 31 | 31 | `date_str` varchar(255) DEFAULT NULL COMMENT '营运日期', |
| 32 | 32 | `origin` int(2) NOT NULL DEFAULT '0' COMMENT '数据源(0:接口获取;1:导入)', |
| 33 | 33 | `sum_time` bigint(11) DEFAULT NULL COMMENT '总计充电时间(分钟)', |
| 34 | + `pile_id` varchar(255) DEFAULT NULL COMMENT '桩号', | |
| 34 | 35 | `create_by` varchar(255) DEFAULT NULL COMMENT '创建人', |
| 35 | 36 | `create_date` datetime DEFAULT NULL COMMENT '创建时间', |
| 36 | 37 | `update_by` varchar(255) DEFAULT NULL COMMENT '修改人', |
| ... | ... | @@ -60,6 +61,8 @@ public class JdlReception { |
| 60 | 61 | private String dateStr; |
| 61 | 62 | private Integer origin; |
| 62 | 63 | private Integer sumTime; |
| 64 | + private String batchNo; | |
| 65 | + private String pileId; | |
| 63 | 66 | private String createBy; |
| 64 | 67 | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| 65 | 68 | private Date createDate; |
| ... | ... | @@ -182,6 +185,18 @@ public class JdlReception { |
| 182 | 185 | public void setSumTime(Integer sumTime) { |
| 183 | 186 | this.sumTime = sumTime; |
| 184 | 187 | } |
| 188 | + public String getBatchNo() { | |
| 189 | + return batchNo; | |
| 190 | + } | |
| 191 | + public void setBatchNo(String batchNo) { | |
| 192 | + this.batchNo = batchNo; | |
| 193 | + } | |
| 194 | + public String getPileId() { | |
| 195 | + return pileId; | |
| 196 | + } | |
| 197 | + public void setPileId(String pileId) { | |
| 198 | + this.pileId = pileId; | |
| 199 | + } | |
| 185 | 200 | public String getCreateBy() { |
| 186 | 201 | return createBy; |
| 187 | 202 | } | ... | ... |
src/main/java/com/bsth/repository/oil/JdlReceptionRepository.java
| 1 | 1 | package com.bsth.repository.oil; |
| 2 | 2 | |
| 3 | -import java.util.Date; | |
| 4 | 3 | import java.util.List; |
| 5 | 4 | |
| 6 | 5 | import org.springframework.data.jpa.repository.Modifying; |
| ... | ... | @@ -20,7 +19,7 @@ public interface JdlReceptionRepository extends BaseRepository<JdlReception, Int |
| 20 | 19 | @Query(value="SELECT * FROM bsth_c_jdl_reception where date_str = ?1 and car_code like %?2% " ,nativeQuery=true) |
| 21 | 20 | List<JdlReception> query(String rq, String nbbm); |
| 22 | 21 | |
| 23 | - @Query(value="SELECT create_by, DATE_FORMAT(create_date, '%Y-%m-%d %H:%i:%s') create_date FROM bsth_c_jdl_reception where DATE_FORMAT(create_date, '%Y-%m-%d') = ?1 and origin = 1 group by create_by, create_date order by create_date" ,nativeQuery=true) | |
| 22 | + @Query(value="SELECT batch_no, create_by, DATE_FORMAT(create_date, '%Y-%m-%d %H:%i:%s') create_date FROM bsth_c_jdl_reception where DATE_FORMAT(create_date, '%Y-%m-%d') = ?1 and origin = 1 group by batch_no, create_by, create_date order by batch_no" ,nativeQuery=true) | |
| 24 | 23 | List<Object[]> queryBatch(String rq); |
| 25 | 24 | |
| 26 | 25 | @Query(value="SELECT * FROM bsth_c_jdl_reception where create_by = ?1 and DATE_FORMAT(create_date, '%Y-%m-%d %H:%i:%s') = ?2 and origin = 1 " ,nativeQuery=true) |
| ... | ... | @@ -31,4 +30,20 @@ public interface JdlReceptionRepository extends BaseRepository<JdlReception, Int |
| 31 | 30 | @Query(value = "delete JdlReception j where createBy = ?1 and DATE_FORMAT(createDate, '%Y-%m-%d %H:%i:%s') = ?2 and origin = 1") |
| 32 | 31 | void deleteBatch(String createBy, String createDate); |
| 33 | 32 | |
| 33 | + @Transactional | |
| 34 | + @Modifying | |
| 35 | + @Query(value="UPDATE bsth_c_jdl_reception SET " + | |
| 36 | + " date_str = ?2," + | |
| 37 | + " pile_id = ?3," + | |
| 38 | + " car_code = ?4," + | |
| 39 | + " start_time = ?5," + | |
| 40 | + " end_time = ?6," + | |
| 41 | + " sum_time = ?7," + | |
| 42 | + " start_soc = ?8," + | |
| 43 | + " end_soc = ?9," + | |
| 44 | + " charge_capacity = ?10," + | |
| 45 | + " stop_reason = ?11" + | |
| 46 | + " WHERE id = ?1", nativeQuery=true) | |
| 47 | + public void update(Long id, String dateStr, String pileId, String carCode, String startTime, String endTime, Integer sumTime, Double startSoc, Double endSoc, Double chargeCapacity, String stopReason); | |
| 48 | + | |
| 34 | 49 | } | ... | ... |
src/main/java/com/bsth/repository/oil/NylogRepository.java
| 1 | 1 | package com.bsth.repository.oil; |
| 2 | 2 | |
| 3 | +import java.util.List; | |
| 3 | 4 | |
| 4 | - | |
| 5 | +import org.springframework.data.jpa.repository.Query; | |
| 5 | 6 | import org.springframework.stereotype.Repository; |
| 7 | + | |
| 6 | 8 | import com.bsth.entity.oil.Nylog; |
| 7 | 9 | import com.bsth.repository.BaseRepository; |
| 8 | 10 | |
| 9 | 11 | @Repository |
| 10 | 12 | public interface NylogRepository extends BaseRepository<Nylog, Integer>{ |
| 13 | + | |
| 14 | + @Query(value="select n from Nylog n where nylx = ?1 and czmc = ?2 and cxtj = ?3 order by createdate desc ") | |
| 15 | + List<Nylog> selectByCxtj(String nylx, String czmc, String cxtj); | |
| 16 | + | |
| 11 | 17 | } | ... | ... |
src/main/java/com/bsth/service/oil/JdlService.java
| 1 | 1 | package com.bsth.service.oil; |
| 2 | 2 | |
| 3 | 3 | import java.io.File; |
| 4 | +import java.io.IOException; | |
| 4 | 5 | import java.util.List; |
| 5 | 6 | import java.util.Map; |
| 6 | 7 | |
| 8 | +import javax.servlet.http.HttpServletResponse; | |
| 9 | + | |
| 7 | 10 | import com.bsth.entity.oil.Jdl; |
| 8 | 11 | import com.bsth.entity.oil.JdlReception; |
| 9 | 12 | import com.bsth.service.BaseService; |
| ... | ... | @@ -27,6 +30,10 @@ public interface JdlService extends BaseService<Jdl, Integer> { |
| 27 | 30 | |
| 28 | 31 | public Map<String, Object> deleteJdlReceptionBatch(Map<String, Object> map); |
| 29 | 32 | |
| 33 | + public Map<String, Object> updateJdlReceptionBatch(Map<String, Object> map); | |
| 34 | + | |
| 35 | + public void downloadJdlReceptionImportFile(Map<String, Object> map, HttpServletResponse response) throws IOException; | |
| 36 | + | |
| 30 | 37 | /** |
| 31 | 38 | * 查询车辆充电量,以jdl表格式返回 |
| 32 | 39 | * @param rq 营运日期 | ... | ... |
src/main/java/com/bsth/service/oil/impl/JdlServiceImpl.java
| 1 | 1 | package com.bsth.service.oil.impl; |
| 2 | 2 | |
| 3 | +import java.io.BufferedInputStream; | |
| 4 | +import java.io.BufferedOutputStream; | |
| 3 | 5 | import java.io.File; |
| 4 | 6 | import java.io.FileInputStream; |
| 7 | +import java.io.IOException; | |
| 8 | +import java.io.InputStream; | |
| 9 | +import java.io.OutputStream; | |
| 5 | 10 | import java.text.DecimalFormat; |
| 6 | -import java.text.ParseException; | |
| 7 | 11 | import java.text.SimpleDateFormat; |
| 8 | 12 | import java.util.ArrayList; |
| 9 | 13 | import java.util.Date; |
| ... | ... | @@ -12,24 +16,31 @@ import java.util.Iterator; |
| 12 | 16 | import java.util.List; |
| 13 | 17 | import java.util.Map; |
| 14 | 18 | |
| 19 | +import javax.servlet.http.HttpServletResponse; | |
| 20 | + | |
| 15 | 21 | import org.apache.poi.hssf.usermodel.HSSFCell; |
| 22 | +import org.apache.poi.hssf.usermodel.HSSFDateUtil; | |
| 16 | 23 | import org.apache.poi.hssf.usermodel.HSSFRow; |
| 17 | 24 | import org.apache.poi.hssf.usermodel.HSSFSheet; |
| 18 | 25 | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| 19 | 26 | import org.apache.poi.poifs.filesystem.POIFSFileSystem; |
| 20 | 27 | import org.springframework.beans.factory.annotation.Autowired; |
| 28 | +import org.springframework.beans.factory.annotation.Value; | |
| 21 | 29 | import org.springframework.stereotype.Service; |
| 22 | 30 | |
| 23 | 31 | import com.bsth.common.ResponseCode; |
| 24 | 32 | import com.bsth.entity.oil.Jdl; |
| 25 | 33 | import com.bsth.entity.oil.JdlReception; |
| 34 | +import com.bsth.entity.oil.Nylog; | |
| 26 | 35 | import com.bsth.entity.sys.SysUser; |
| 27 | 36 | import com.bsth.repository.oil.JdlReceptionRepository; |
| 28 | 37 | import com.bsth.repository.oil.JdlRepository; |
| 38 | +import com.bsth.repository.oil.NylogRepository; | |
| 29 | 39 | import com.bsth.security.util.SecurityUtils; |
| 30 | 40 | import com.bsth.service.impl.BaseServiceImpl; |
| 31 | 41 | import com.bsth.service.oil.JdlService; |
| 32 | 42 | import com.bsth.util.ReportUtils; |
| 43 | +import com.google.common.io.Files; | |
| 33 | 44 | |
| 34 | 45 | @Service |
| 35 | 46 | public class JdlServiceImpl extends BaseServiceImpl<Jdl, Integer> implements JdlService { |
| ... | ... | @@ -39,6 +50,12 @@ public class JdlServiceImpl extends BaseServiceImpl<Jdl, Integer> implements Jdl |
| 39 | 50 | |
| 40 | 51 | @Autowired |
| 41 | 52 | JdlReceptionRepository jdlReceptionRepository; |
| 53 | + | |
| 54 | + @Autowired | |
| 55 | + NylogRepository nylogRepository; | |
| 56 | + | |
| 57 | + @Value("${electricity.importFile.path}") | |
| 58 | + private String elecImportFilePath; | |
| 42 | 59 | |
| 43 | 60 | @Override |
| 44 | 61 | public String importExcel(File file, String gsbm, String gsName, String fgsbm, String fgsName) { |
| ... | ... | @@ -168,13 +185,17 @@ public class JdlServiceImpl extends BaseServiceImpl<Jdl, Integer> implements Jdl |
| 168 | 185 | |
| 169 | 186 | @Override |
| 170 | 187 | public String importExcel_2412(File file, String gsbm, String gsName, String fgsbm, String fgsName) { |
| 188 | + SimpleDateFormat yearMonthFormat = new SimpleDateFormat("yyyy-MM"); | |
| 171 | 189 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| 172 | 190 | SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| 191 | + SimpleDateFormat SSSformat = new SimpleDateFormat("yyMMddHHmmssSS"); | |
| 173 | 192 | SimpleDateFormat ddFormat = new SimpleDateFormat("dd"); |
| 174 | 193 | DecimalFormat df = new DecimalFormat("######0.00"); |
| 175 | 194 | SysUser user = SecurityUtils.getCurrentUser(); |
| 176 | 195 | Date currDate = new Date(); |
| 177 | 196 | List<String> textList = new ArrayList<String>(); |
| 197 | + String batchNo = user.getUserName() + SSSformat.format(currDate); | |
| 198 | + String msg = ""; | |
| 178 | 199 | try { |
| 179 | 200 | POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file)); |
| 180 | 201 | HSSFWorkbook wb = new HSSFWorkbook(fs); |
| ... | ... | @@ -197,7 +218,12 @@ public class JdlServiceImpl extends BaseServiceImpl<Jdl, Integer> implements Jdl |
| 197 | 218 | text += ","; |
| 198 | 219 | continue; |
| 199 | 220 | } |
| 221 | + if(cell.getCellType() == HSSFCell.CELL_TYPE_NUMERIC && HSSFDateUtil.isCellDateFormatted(cell)){ | |
| 222 | + Date dateCellValue = cell.getDateCellValue(); | |
| 223 | + text += sd.format(dateCellValue) + ","; | |
| 224 | + } else { | |
| 200 | 225 | text += String.valueOf(cell) + ","; |
| 226 | + } | |
| 201 | 227 | } |
| 202 | 228 | String[] split = (text+";").split(","); |
| 203 | 229 | String str = ""; |
| ... | ... | @@ -208,54 +234,102 @@ public class JdlServiceImpl extends BaseServiceImpl<Jdl, Integer> implements Jdl |
| 208 | 234 | continue; |
| 209 | 235 | textList.add(text + ";"); |
| 210 | 236 | } |
| 237 | + String str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
| 211 | 238 | List<JdlReception> list = new ArrayList<JdlReception>(); |
| 212 | 239 | for(int i = 0; i < textList.size(); i++){ |
| 213 | 240 | String text = textList.get(i); |
| 214 | 241 | String[] split = text.split(","); |
| 215 | - if(split[1] != null && split[1].trim().length() > 0){ | |
| 216 | - Integer dd = Integer.valueOf(split[1].trim().split("\\.")[0]); // 日期 | |
| 217 | - String zh = split[2].trim(); // 桩号 | |
| 218 | - String nbbm = split[3].trim(); // 车号 | |
| 219 | - String startTime = split[4].trim(); // 开始时间 | |
| 220 | - String endTime = split[5].trim(); // 结束时间 | |
| 221 | - String sumTime = split[6].trim(); // 总计(分钟) | |
| 222 | - String startSoc = split[7].trim(); // 起始电量SOC% | |
| 223 | - String endSoc = split[8].trim(); // 结束电量SOC% | |
| 224 | - String jdl = split[9].trim(); // 充电度数 | |
| 225 | - String lc = split[10].trim(); // 里程度数 | |
| 226 | - String stopReason = split[11].trim(); // 一次不能正常充电记录 | |
| 227 | - JdlReception jdlRe = new JdlReception(); | |
| 228 | - Date date = sd.parse(startTime); | |
| 229 | - if(!(dd == Integer.valueOf(ddFormat.format(date)))){ | |
| 230 | - date.setTime(date.getTime() - 1l*1000*60*60*24); | |
| 242 | + if(split.length > 4 && split[1] != null && split[1].trim().length() > 0 && | |
| 243 | + split[3] != null && split[3].trim().length() > 0){ | |
| 244 | + int lie = 1; | |
| 245 | + try { | |
| 246 | + Integer dd = Integer.valueOf(split[lie++].trim().split("\\.")[0]); // 日期 | |
| 247 | + String zh = split[lie++].trim(); // 桩号 | |
| 248 | + String nbbm = split[lie++].trim(); // 车号 | |
| 249 | + String startTime = split[lie++].trim(); // 开始时间 | |
| 250 | + String endTime = split[lie++].trim(); // 结束时间 | |
| 251 | + String sumTime = split[lie++].trim(); // 总计(分钟) | |
| 252 | + String startSoc = split[lie++].trim(); // 起始电量SOC% | |
| 253 | + String endSoc = split[lie++].trim(); // 结束电量SOC% | |
| 254 | + String jdl = split[lie++].trim(); // 充电度数 | |
| 255 | + String lc = split[lie++].trim(); // 里程度数 | |
| 256 | + String stopReason = split[lie++].trim(); // 一次不能正常充电记录 | |
| 257 | + | |
| 258 | + sumTime = sumTime.split("\\.")[0]; | |
| 259 | + | |
| 260 | + Date parseStartTime = sd.parse(startTime); | |
| 261 | + Date parseEndTime = sd.parse(endTime); | |
| 262 | + long sub = ((parseEndTime.getTime() - parseStartTime.getTime()) / (1l*1000*60)) - Long.valueOf(sumTime); | |
| 263 | + if(sub > 2 || sub < -2){ | |
| 264 | + msg += System.lineSeparator() + "文档第"+(i + 4)+"行,充电时间总计分钟数("+sumTime+")误差超过2分钟;"; | |
| 265 | + } | |
| 266 | + | |
| 267 | + JdlReception jdlRe = new JdlReception(); | |
| 268 | + Date date = sd.parse(startTime); | |
| 269 | + if(!(dd == Integer.valueOf(ddFormat.format(date)))){ | |
| 270 | + date.setTime(date.getTime() - 1l*1000*60*60*24); | |
| 271 | + } | |
| 272 | + jdlRe.setBatchNo(batchNo); | |
| 273 | + jdlRe.setDateStr(sdf.format(date)); | |
| 274 | + jdlRe.setPileId(zh); | |
| 275 | + jdlRe.setCarCode(nbbm); | |
| 276 | + jdlRe.setStartTime(startTime); | |
| 277 | + jdlRe.setEndTime(endTime); | |
| 278 | + jdlRe.setSumTime(Integer.valueOf(sumTime)); | |
| 279 | + jdlRe.setStartSoc(Double.valueOf(startSoc)); | |
| 280 | + jdlRe.setEndSoc(Double.valueOf(endSoc)); | |
| 281 | + jdlRe.setChargeCapacity(Double.valueOf(jdl)); | |
| 282 | + jdlRe.setStopReason(stopReason); | |
| 283 | + jdlRe.setCreateBy(user.getUserName()); | |
| 284 | + jdlRe.setCreateDate(currDate); | |
| 285 | + jdlRe.setOrigin(1); | |
| 286 | + list.add(jdlRe); | |
| 287 | + } catch (Exception e) { | |
| 288 | + // TODO: handle exception | |
| 289 | + e.printStackTrace(); | |
| 290 | + msg += System.lineSeparator() + "文档第"+(i + 4)+"行第"+str.charAt(lie)+"列,格式错误或无法识别;"; | |
| 231 | 291 | } |
| 232 | - jdlRe.setDateStr(sdf.format(date)); | |
| 233 | - jdlRe.setConnectorId(zh); | |
| 234 | - jdlRe.setCarCode(nbbm); | |
| 235 | - jdlRe.setStartTime(startTime); | |
| 236 | - jdlRe.setEndTime(endTime); | |
| 237 | - jdlRe.setSumTime(Integer.valueOf(sumTime.split("\\.")[0])); | |
| 238 | - jdlRe.setStartSoc(Double.valueOf(startSoc)); | |
| 239 | - jdlRe.setEndSoc(Double.valueOf(endSoc)); | |
| 240 | - jdlRe.setChargeCapacity(Double.valueOf(jdl)); | |
| 241 | - jdlRe.setStopReason(stopReason); | |
| 242 | - jdlRe.setCreateBy(user.getUserName()); | |
| 243 | - jdlRe.setCreateDate(currDate); | |
| 244 | - jdlRe.setOrigin(1); | |
| 245 | - list.add(jdlRe); | |
| 246 | 292 | } |
| 247 | 293 | } |
| 248 | - jdlReceptionRepository.saveAll(list); | |
| 249 | 294 | wb.close(); |
| 250 | 295 | fs.close(); |
| 296 | + if(msg.length() > 0){ | |
| 297 | + return "文件导入失败" + msg; | |
| 298 | + } else { | |
| 299 | + jdlReceptionRepository.saveAll(list); | |
| 300 | + return "文件导入成功," + "导入了" + list.size() + "条充电量。"; | |
| 301 | + } | |
| 251 | 302 | } catch (Exception e) { |
| 252 | 303 | // TODO Auto-generated catch block |
| 253 | 304 | e.printStackTrace(); |
| 254 | 305 | return "文件导入失败"; |
| 255 | 306 | } finally { |
| 256 | - file.delete(); | |
| 307 | +// file.delete(); | |
| 308 | + try { | |
| 309 | + String yearMonthPath = yearMonthFormat.format(currDate); | |
| 310 | + File elecImportFile = new File(elecImportFilePath + File.separator + yearMonthPath); | |
| 311 | + if(!elecImportFile.exists()){ | |
| 312 | + elecImportFile.mkdirs(); | |
| 313 | + } | |
| 314 | + String path = file.getPath(); | |
| 315 | + System.out.println(path); | |
| 316 | + String[] split = file.getName().split("\\."); | |
| 317 | + String suffix = split[split.length - 1]; | |
| 318 | + Files.move(file, new File(elecImportFilePath + File.separator + yearMonthPath + File.separator + batchNo + "." + suffix)); | |
| 319 | + Nylog nylog=new Nylog(); | |
| 320 | + nylog.setCreatedate(currDate); | |
| 321 | + nylog.setNylx("电"); | |
| 322 | + nylog.setCzmc("导入"); | |
| 323 | + nylog.setUserid(user.getUserName()); | |
| 324 | + nylog.setUsername(user.getName()); | |
| 325 | + nylog.setCxtj(batchNo); | |
| 326 | + nylog.setFwdz(yearMonthPath + File.separator + batchNo + "." + suffix); | |
| 327 | + nylogRepository.save(nylog); | |
| 328 | + } catch (IOException e) { | |
| 329 | + // TODO Auto-generated catch block | |
| 330 | + e.printStackTrace(); | |
| 331 | + } | |
| 257 | 332 | } |
| 258 | - return "文件导入成功"; | |
| 259 | 333 | } |
| 260 | 334 | |
| 261 | 335 | @Override |
| ... | ... | @@ -341,8 +415,9 @@ public class JdlServiceImpl extends BaseServiceImpl<Jdl, Integer> implements Jdl |
| 341 | 415 | try { |
| 342 | 416 | for(Object[] j : queryBatch){ |
| 343 | 417 | Map<String, Object> m = new HashMap<String, Object>(); |
| 344 | - m.put("createBy", j[0]); | |
| 345 | - m.put("createDate", j[1]); | |
| 418 | + m.put("batchNo", j[0]); | |
| 419 | + m.put("createBy", j[1]); | |
| 420 | + m.put("createDate", j[2]); | |
| 346 | 421 | query.add(m); |
| 347 | 422 | } |
| 348 | 423 | } catch (Exception e) { |
| ... | ... | @@ -381,6 +456,88 @@ public class JdlServiceImpl extends BaseServiceImpl<Jdl, Integer> implements Jdl |
| 381 | 456 | } |
| 382 | 457 | |
| 383 | 458 | @Override |
| 459 | + public Map<String, Object> updateJdlReceptionBatch(Map<String, Object> map) { | |
| 460 | + Map<String, Object> resMap = new HashMap<>(); | |
| 461 | + try{ | |
| 462 | + String[] ids = map.get("ids").toString().length()>0?map.get("ids").toString().split(","):new String[]{}; | |
| 463 | + String[] dateStr = map.get("dateStr").toString().length()>0?map.get("dateStr").toString().split(","):new String[]{}; | |
| 464 | + String[] pileId = map.get("pileId").toString().length()>0?map.get("pileId").toString().split(","):new String[]{}; | |
| 465 | + String[] carCode = map.get("carCode").toString().length()>0?map.get("carCode").toString().split(","):new String[]{}; | |
| 466 | + String[] startTime = map.get("startTime").toString().length()>0?map.get("startTime").toString().split(","):new String[]{}; | |
| 467 | + String[] endTime = map.get("endTime").toString().length()>0?map.get("endTime").toString().split(","):new String[]{}; | |
| 468 | + String[] sumTime = map.get("sumTime").toString().length()>0?map.get("sumTime").toString().split(","):new String[]{}; | |
| 469 | + String[] startSoc = map.get("startSoc").toString().length()>0?map.get("startSoc").toString().split(","):new String[]{}; | |
| 470 | + String[] endSoc = map.get("endSoc").toString().length()>0?map.get("endSoc").toString().split(","):new String[]{}; | |
| 471 | + String[] chargeCapacity = map.get("chargeCapacity").toString().length()>0?map.get("chargeCapacity").toString().split(","):new String[]{}; | |
| 472 | + String[] stopReason = map.get("stopReason").toString().length()>0?map.get("stopReason").toString().split(","):new String[]{}; | |
| 473 | + List<JdlReception> list = new ArrayList<JdlReception>(); | |
| 474 | + for(int i = 0; i < ids.length; i++){ | |
| 475 | + if(ids[i].length() != 0){ | |
| 476 | + JdlReception jdlRe = new JdlReception(); | |
| 477 | + jdlRe.setId(Long.valueOf(ids[i])); | |
| 478 | + if(dateStr.length > i) | |
| 479 | + jdlRe.setDateStr(dateStr[i]); | |
| 480 | + if(pileId.length > i) | |
| 481 | + jdlRe.setPileId(pileId[i]); | |
| 482 | + if(carCode.length > i) | |
| 483 | + jdlRe.setCarCode(carCode[i]); | |
| 484 | + if(startTime.length > i) | |
| 485 | + jdlRe.setStartTime(startTime[i]); | |
| 486 | + if(endTime.length > i) | |
| 487 | + jdlRe.setEndTime(endTime[i]); | |
| 488 | + if(sumTime.length > i) | |
| 489 | + jdlRe.setSumTime(Integer.valueOf(sumTime[i])); | |
| 490 | + if(startSoc.length > i) | |
| 491 | + jdlRe.setStartSoc(Double.valueOf(startSoc[i])); | |
| 492 | + if(endSoc.length > i) | |
| 493 | + jdlRe.setEndSoc(Double.valueOf(endSoc[i])); | |
| 494 | + if(chargeCapacity.length > i) | |
| 495 | + jdlRe.setChargeCapacity(Double.valueOf(chargeCapacity[i])); | |
| 496 | + if(stopReason.length > i) | |
| 497 | + jdlRe.setStopReason(stopReason[i]); | |
| 498 | + | |
| 499 | + list.add(jdlRe); | |
| 500 | + } | |
| 501 | + } | |
| 502 | + for(JdlReception jdlRe : list){ | |
| 503 | + jdlReceptionRepository.update(jdlRe.getId(), jdlRe.getDateStr(), jdlRe.getPileId(), jdlRe.getCarCode(), | |
| 504 | + jdlRe.getStartTime(), jdlRe.getEndTime(), jdlRe.getSumTime(), jdlRe.getStartSoc(), jdlRe.getEndSoc(), | |
| 505 | + jdlRe.getChargeCapacity(), jdlRe.getStopReason()); | |
| 506 | + } | |
| 507 | + resMap.put("status", ResponseCode.SUCCESS); | |
| 508 | + }catch (Exception e){ | |
| 509 | + resMap.put("status", ResponseCode.ERROR); | |
| 510 | + resMap.put("msg", e.getMessage()); | |
| 511 | + } | |
| 512 | + return resMap; | |
| 513 | + } | |
| 514 | + | |
| 515 | + @Override | |
| 516 | + public void downloadJdlReceptionImportFile(Map<String, Object> map, HttpServletResponse response) throws IOException { | |
| 517 | + String batchNo = map.get("batchNo").toString(); | |
| 518 | + List<Nylog> list = nylogRepository.selectByCxtj("电", "导入", batchNo); | |
| 519 | + if(list.size() > 0){ | |
| 520 | + Nylog nylog = list.get(0); | |
| 521 | + String path = elecImportFilePath + File.separator + nylog.getFwdz(); | |
| 522 | + String[] split = nylog.getFwdz().split("\\."); | |
| 523 | + String fileName = batchNo + "." + split[split.length - 1]; | |
| 524 | + File file = new File(path); | |
| 525 | + InputStream fis = new BufferedInputStream(new FileInputStream(path)); | |
| 526 | + byte[] buffer = new byte[fis.available()]; | |
| 527 | + fis.read(buffer); | |
| 528 | + fis.close(); | |
| 529 | + response.reset(); | |
| 530 | + response.addHeader("Content-Disposition", "attachment;filename=" + new String(fileName.replaceAll(" ", "").getBytes("utf-8"),"iso8859-1")); | |
| 531 | + response.addHeader("Content-Length", "" + file.length()); | |
| 532 | + OutputStream os = new BufferedOutputStream(response.getOutputStream()); | |
| 533 | + response.setContentType("application/octet-stream"); | |
| 534 | + os.write(buffer);// 输出文件 | |
| 535 | + os.flush(); | |
| 536 | + os.close(); | |
| 537 | + } | |
| 538 | + } | |
| 539 | + | |
| 540 | + @Override | |
| 384 | 541 | public List<Jdl> queryJdlByJdlReception(String rq, String nbbm) { |
| 385 | 542 | List<Jdl> list = new ArrayList<Jdl>(); |
| 386 | 543 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ... | ... |
src/main/resources/application-prod.properties
| 1 | -server.port=9088 | |
| 2 | - | |
| 3 | -# dubbo\uFFFD\uFFFD\uFFFD\uFFFD\u02B9\uFFFD\u00FF\uFFFD\uFFFD\uFFFDflag | |
| 4 | -dubbo.use=false | |
| 5 | - | |
| 6 | -#JPA | |
| 7 | -spring.jpa.hibernate.ddl-auto= none | |
| 8 | -spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl | |
| 9 | -spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy | |
| 10 | -spring.jpa.database= MYSQL | |
| 11 | -spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true | |
| 12 | -spring.jpa.show-sql= false | |
| 13 | -spring.jpa.properties.hibernate.dialect= org.hibernate.spatial.dialect.mysql.MySQL56InnoDBSpatialDialect | |
| 14 | - | |
| 15 | -#DATABASE | |
| 16 | -spring.datasource.driver-class-name= com.mysql.jdbc.Driver | |
| 17 | -spring.datasource.url= jdbc:mysql://10.10.150.103:3306/control?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai | |
| 18 | -spring.datasource.username= root | |
| 19 | -spring.datasource.password= fsodlgjiuigAQF2$9fs9 | |
| 20 | -spring.datasource.type= com.zaxxer.hikari.HikariDataSource | |
| 21 | - | |
| 22 | -#DATASOURCE SETTING | |
| 23 | -spring.datasource.hikari.minimum-idle= 8 | |
| 24 | -spring.datasource.hikari.maximum-pool-size= 100 | |
| 25 | -#spring.datasource.hikari.auto-commit= true | |
| 26 | -spring.datasource.hikari.idle-timeout= 60000 | |
| 27 | -#spring.datasource.hikari.pool-name= HikariPool | |
| 28 | -spring.datasource.hikari.max-lifetime= 1800000 | |
| 29 | -spring.datasource.hikari.connection-timeout= 3000 | |
| 30 | -spring.datasource.hikari.connection-test-query= SELECT 1 | |
| 31 | -spring.datasource.hikari.validation-timeout= 3000 | |
| 32 | -spring.datasource.hikari.register-mbeans=true | |
| 33 | - | |
| 34 | -sso.enabled= true | |
| 35 | -sso.systemcode = SYSUS023 | |
| 36 | -sso.http.url.login= http://10.10.200.142:9112/login?redirect=%2Findex | |
| 37 | -sso.http.url.logout= http://10.10.200.142:9112/login?redirect=%2Findex | |
| 38 | -sso.http.url.auth= http://10.10.200.142:9112/prod-api/system/utilitySystem/checkToken | |
| 39 | - | |
| 40 | -dc.imgurl= /home/control/klimg | |
| 41 | -dc.profile= profile | |
| 1 | +server.port=9088 | |
| 2 | + | |
| 3 | +# dubbo\uFFFD\uFFFD\uFFFD\uFFFD\u02B9\uFFFD\u00FF\uFFFD\uFFFD\uFFFDflag | |
| 4 | +dubbo.use=false | |
| 5 | + | |
| 6 | +#JPA | |
| 7 | +spring.jpa.hibernate.ddl-auto= none | |
| 8 | +spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl | |
| 9 | +spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy | |
| 10 | +spring.jpa.database= MYSQL | |
| 11 | +spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true | |
| 12 | +spring.jpa.show-sql= false | |
| 13 | +spring.jpa.properties.hibernate.dialect= org.hibernate.spatial.dialect.mysql.MySQL56InnoDBSpatialDialect | |
| 14 | + | |
| 15 | +#DATABASE | |
| 16 | +spring.datasource.driver-class-name= com.mysql.jdbc.Driver | |
| 17 | +spring.datasource.url= jdbc:mysql://10.10.150.103:3306/control?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai | |
| 18 | +spring.datasource.username= root | |
| 19 | +spring.datasource.password= fsodlgjiuigAQF2$9fs9 | |
| 20 | +spring.datasource.type= com.zaxxer.hikari.HikariDataSource | |
| 21 | + | |
| 22 | +#DATASOURCE SETTING | |
| 23 | +spring.datasource.hikari.minimum-idle= 8 | |
| 24 | +spring.datasource.hikari.maximum-pool-size= 100 | |
| 25 | +#spring.datasource.hikari.auto-commit= true | |
| 26 | +spring.datasource.hikari.idle-timeout= 60000 | |
| 27 | +#spring.datasource.hikari.pool-name= HikariPool | |
| 28 | +spring.datasource.hikari.max-lifetime= 1800000 | |
| 29 | +spring.datasource.hikari.connection-timeout= 3000 | |
| 30 | +spring.datasource.hikari.connection-test-query= SELECT 1 | |
| 31 | +spring.datasource.hikari.validation-timeout= 3000 | |
| 32 | +spring.datasource.hikari.register-mbeans=true | |
| 33 | + | |
| 34 | +sso.enabled= true | |
| 35 | +sso.systemcode = SYSUS023 | |
| 36 | +sso.http.url.login= http://10.10.200.142:9112/login?redirect=%2Findex | |
| 37 | +sso.http.url.logout= http://10.10.200.142:9112/login?redirect=%2Findex | |
| 38 | +sso.http.url.auth= http://10.10.200.142:9112/prod-api/system/utilitySystem/checkToken | |
| 39 | + | |
| 40 | +dc.imgurl= /home/control/klimg | |
| 41 | +dc.profile= profile | |
| 42 | + | |
| 43 | +electricity.importFile.path= /home/control/elecImportFile | ... | ... |
src/main/resources/static/pages/electricity/jdl/jdlReception.html
| ... | ... | @@ -30,7 +30,9 @@ |
| 30 | 30 | <table class="table table-bordered table-hover table-checkable" id="forms_2"> |
| 31 | 31 | <thead> |
| 32 | 32 | <tr> |
| 33 | - <td style="min-width: 170px">桩号、枪号</td> | |
| 33 | + <td style="min-width: 170px">批次号</td> | |
| 34 | + <td style="min-width: 80px">桩号</td> | |
| 35 | + <td style="min-width: 170px">枪号</td> | |
| 34 | 36 | <td>车号</td> |
| 35 | 37 | <td>开始时间</td> |
| 36 | 38 | <td>结束时间</td> |
| ... | ... | @@ -38,7 +40,6 @@ |
| 38 | 40 | <td>起始电量SOC(%)</td> |
| 39 | 41 | <td>结束电量SOC(%)</td> |
| 40 | 42 | <td>充电度数</td> |
| 41 | - <td>一次不能正常充电记录</td> | |
| 42 | 43 | <td>来源</td> |
| 43 | 44 | </tr> |
| 44 | 45 | </thead> |
| ... | ... | @@ -98,6 +99,8 @@ |
| 98 | 99 | <script type="text/html" id="jdlReception_tbody"> |
| 99 | 100 | {{each list as obj i}} |
| 100 | 101 | <tr> |
| 102 | + <td>{{obj.batchNo}}</td> | |
| 103 | + <td>{{obj.pileId}}</td> | |
| 101 | 104 | <td>{{obj.connectorId}}</td> |
| 102 | 105 | <td>{{obj.carCode}}</td> |
| 103 | 106 | <td>{{obj.startTime}}</td> |
| ... | ... | @@ -106,7 +109,6 @@ |
| 106 | 109 | <td>{{obj.startSoc}}</td> |
| 107 | 110 | <td>{{obj.endSoc}}</td> |
| 108 | 111 | <td>{{obj.chargeCapacity}}</td> |
| 109 | - <td>{{obj.stopReason}}</td> | |
| 110 | 112 | <td>{{obj.originName}}</td> |
| 111 | 113 | </tr> |
| 112 | 114 | {{/each}} | ... | ... |
src/main/resources/static/pages/electricity/jdl/jdlReceptionBatch.html
| ... | ... | @@ -55,7 +55,8 @@ |
| 55 | 55 | <tr role="row" class="heading"> |
| 56 | 56 | <th>#</th> |
| 57 | 57 | <th>导入时间</th> |
| 58 | - <th colspan="2">处理人</th> | |
| 58 | + <th colspan="">处理人</th> | |
| 59 | + <th colspan="">批次号</th> | |
| 59 | 60 | <td colspan="2">操作</td> |
| 60 | 61 | </tr> |
| 61 | 62 | </thead> |
| ... | ... | @@ -185,17 +186,20 @@ |
| 185 | 186 | startOptJzylLink($('#jdlReceptionBatch_list .in_carpark_jzyl')); |
| 186 | 187 | |
| 187 | 188 | $('.btn-ReceptionBatch').on('click', openReceptionBatchData); |
| 188 | - $('.btn-ReceptionBatch-del').on('click', openReceptionBatchDataDel); | |
| 189 | + $('.btn-ReceptionBatch-upd').on('click', openReceptionBatchDataUpd); | |
| 190 | + $('.btn-ReceptionBatch-del').on('click', openReceptionBatchDataDel); | |
| 191 | + $('.btn-ReceptionBatch-export').on('click', openReceptionBatchDataExport); | |
| 189 | 192 | }); |
| 190 | 193 | } |
| 191 | 194 | |
| 192 | 195 | function openReceptionBatchData(){ |
| 193 | 196 | var id = $(this).data('date'); |
| 194 | 197 | id += ","+$(this).data('by'); |
| 198 | + id += ",view"; | |
| 195 | 199 | $.get('/pages/electricity/jdl/jdlReceptionBatchData.html', function (content) { |
| 196 | 200 | layer.open({ |
| 197 | 201 | type: 1, |
| 198 | - area: ['1200px', '600px'], | |
| 202 | + area: ['1200px', '630px'], | |
| 199 | 203 | content: content, |
| 200 | 204 | title: '充电量详细', |
| 201 | 205 | shift: 5, |
| ... | ... | @@ -207,6 +211,71 @@ |
| 207 | 211 | }); |
| 208 | 212 | } |
| 209 | 213 | |
| 214 | + function openReceptionBatchDataUpd(){ | |
| 215 | + var id = $(this).data('date'); | |
| 216 | + id += ","+$(this).data('by'); | |
| 217 | + id += ",upd"; | |
| 218 | + $.get('/pages/electricity/jdl/jdlReceptionBatchData.html', function (content) { | |
| 219 | + layer.open({ | |
| 220 | + type: 1, | |
| 221 | + area: ['1200px', '660px'], | |
| 222 | + content: content, | |
| 223 | + title: '充电量详细修改', | |
| 224 | + shift: 5, | |
| 225 | + scrollbar: false, | |
| 226 | + success: function () { | |
| 227 | + $('#jdlReceptionBatchData').trigger('init', id); | |
| 228 | + }, | |
| 229 | + btn:["保存", "取消"], | |
| 230 | + btn1: function(index, layero){ | |
| 231 | + layer.msg('操作中...', {icon: 16, shade: 0.31}); | |
| 232 | +// console.log("jdlReceptionBatchData_tbody", $('#jdlReceptionBatchData_tbody').html()); | |
| 233 | +// var data = $('#jdlReceptionBatchData_tbody').serializeArray(); | |
| 234 | +// console.log(data); | |
| 235 | + var ids = "", dateStr = "", pileId = "", carCode = "", startTime = "", endTime = "", sumTime = "", | |
| 236 | + startSoc = "", endSoc = "", chargeCapacity = "", stopReason = ""; | |
| 237 | + $('#jdlReceptionBatchData_tbody input').each(function(i, e){ | |
| 238 | + var obj = $(e); | |
| 239 | + if("id" == obj.attr("name")){ | |
| 240 | + ids += obj.val() + ","; | |
| 241 | + } else if("dateStr" == obj.attr("name")){ | |
| 242 | + dateStr += obj.val() + ","; | |
| 243 | + } else if("pileId" == obj.attr("name")){ | |
| 244 | + pileId += obj.val() + ","; | |
| 245 | + } else if("carCode" == obj.attr("name")){ | |
| 246 | + carCode += obj.val() + ","; | |
| 247 | + } else if("startTime" == obj.attr("name")){ | |
| 248 | + startTime += obj.val() + ","; | |
| 249 | + } else if("endTime" == obj.attr("name")){ | |
| 250 | + endTime += obj.val() + ","; | |
| 251 | + } else if("sumTime" == obj.attr("name")){ | |
| 252 | + sumTime += obj.val() + ","; | |
| 253 | + } else if("startSoc" == obj.attr("name")){ | |
| 254 | + startSoc += obj.val() + ","; | |
| 255 | + } else if("endSoc" == obj.attr("name")){ | |
| 256 | + endSoc += obj.val() + ","; | |
| 257 | + } else if("chargeCapacity" == obj.attr("name")){ | |
| 258 | + chargeCapacity += obj.val() + ","; | |
| 259 | + } else if("stopReason" == obj.attr("name")){ | |
| 260 | + stopReason += obj.val() + ","; | |
| 261 | + } | |
| 262 | + }); | |
| 263 | + $post('/jdl/updateJdlReceptionBatch', {ids:ids,dateStr:dateStr,pileId:pileId,carCode:carCode, | |
| 264 | + startTime:startTime,endTime:endTime,sumTime:sumTime, | |
| 265 | + startSoc:startSoc,endSoc:endSoc,chargeCapacity:chargeCapacity,stopReason:stopReason}, function (rs) { | |
| 266 | + console.log(rs); | |
| 267 | + if(rs.status && rs.status == "SUCCESS"){ | |
| 268 | + layer.msg('修改成功。'); | |
| 269 | + layer.close(index); | |
| 270 | + } else { | |
| 271 | + layer.msg('操作失败,请检查内容是否有误。'); | |
| 272 | + } | |
| 273 | + }); | |
| 274 | + } | |
| 275 | + }); | |
| 276 | + }); | |
| 277 | + } | |
| 278 | + | |
| 210 | 279 | function openReceptionBatchDataDel(){ |
| 211 | 280 | var createDate = $(this).data('date'); |
| 212 | 281 | var createBy = $(this).data('by'); |
| ... | ... | @@ -219,6 +288,11 @@ |
| 219 | 288 | $('.filter-submit.margin-bottom').trigger('click'); |
| 220 | 289 | }); |
| 221 | 290 | }); |
| 291 | + } | |
| 292 | + | |
| 293 | + function openReceptionBatchDataExport(){ | |
| 294 | + var batchNo = $(this).data('batch'); | |
| 295 | + window.open("/jdl/downloadJdlReceptionImportFile?batchNo=" + batchNo); | |
| 222 | 296 | } |
| 223 | 297 | |
| 224 | 298 | //改变状态 |
| ... | ... | @@ -356,13 +430,21 @@ |
| 356 | 430 | {{i + 1}} |
| 357 | 431 | </td> |
| 358 | 432 | <td>{{obj.createDate}}</td> |
| 359 | - <td colspan="2">{{obj.createBy}}</td> | |
| 433 | + <td colspan="">{{obj.createBy}}</td> | |
| 434 | + <td colspan="">{{obj.batchNo}}</td> | |
| 360 | 435 | <td colspan="2"> |
| 361 | 436 | <button class="btn btn-info btn-sm btn-ReceptionBatch" data-date="{{obj.createDate}}" data-by="{{obj.createBy}}"> |
| 362 | 437 | <i class="fa fa-search"></i> 查看 |
| 363 | 438 | </button> |
| 439 | + <button class="btn blue-madison btn-sm btn-ReceptionBatch-upd" data-date="{{obj.createDate}}" data-by="{{obj.createBy}}"> | |
| 440 | + <i class="fa fa-pencil"></i> 修改 | |
| 441 | + </button> | |
| 364 | 442 | <button class="btn btn-danger btn-sm red btn-ReceptionBatch-del" data-date="{{obj.createDate}}" data-by="{{obj.createBy}}"> |
| 365 | 443 | <i class="fa fa-times"></i> 删除 |
| 444 | + </button> | |
| 445 | + | |
| 446 | + <button class="btn btn-circle btn-sm blue btn-ReceptionBatch-export" data-batch="{{obj.batchNo}}"> | |
| 447 | + <i class="fa fa-file-excel-o"></i> 下载导入文件 | |
| 366 | 448 | </button> |
| 367 | 449 | </td> |
| 368 | 450 | </tr> | ... | ... |
src/main/resources/static/pages/electricity/jdl/jdlReceptionBatchData.html
| ... | ... | @@ -16,16 +16,17 @@ |
| 16 | 16 | border-top: 1px solid; } |
| 17 | 17 | </style> |
| 18 | 18 | |
| 19 | -<div class="row" id="jdlReceptionBatchData"> | |
| 19 | +<div id="jdlReceptionBatchData"> | |
| 20 | 20 | <div class="col-md-12"> |
| 21 | - <div class="portlet light porttlet-fit bordered"> | |
| 21 | +<!-- <div class="portlet light porttlet-fit bordered"> --> | |
| 22 | 22 | <div class="portlet-body"> |
| 23 | - <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 600px"> | |
| 23 | + <div class="table-container" style="margin-top: 10px;width: 1180px;height: 550px;overflow:auto;"> | |
| 24 | 24 | <table class="table table-bordered table-hover table-checkable" id="forms_2"> |
| 25 | 25 | <thead> |
| 26 | 26 | <tr> |
| 27 | + <td style="min-width: 170px">批次号</td> | |
| 27 | 28 | <td style="min-width: 90px">营运日期</td> |
| 28 | - <td style="min-width: 60px">桩号、枪号</td> | |
| 29 | + <td style="min-width: 80px">桩号</td> | |
| 29 | 30 | <td>车号</td> |
| 30 | 31 | <td>开始时间</td> |
| 31 | 32 | <td>结束时间</td> |
| ... | ... | @@ -33,18 +34,17 @@ |
| 33 | 34 | <td>起始电量SOC(%)</td> |
| 34 | 35 | <td>结束电量SOC(%)</td> |
| 35 | 36 | <td>充电度数</td> |
| 36 | - <td>一次不能正常充电记录</td> | |
| 37 | - <td>来源</td> | |
| 37 | +<!-- <td>一次不能正常充电记录</td> --> | |
| 38 | 38 | </tr> |
| 39 | 39 | </thead> |
| 40 | - | |
| 41 | - <tbody> | |
| 40 | + | |
| 41 | + <tbody id="jdlReceptionBatchData_tbody"> | |
| 42 | 42 | |
| 43 | 43 | </tbody> |
| 44 | 44 | </table> |
| 45 | 45 | </div> |
| 46 | 46 | </div> |
| 47 | - </div> | |
| 47 | +<!-- </div> --> | |
| 48 | 48 | </div> |
| 49 | 49 | </div> |
| 50 | 50 | <script src="/pages/mforms/singledatas/jquery.table2excel.min.js"></script> |
| ... | ... | @@ -58,6 +58,7 @@ |
| 58 | 58 | $("#jdlReceptionBatchData").on('init', function (e, id) { |
| 59 | 59 | date = id.split(",")[0]; |
| 60 | 60 | by = id.split(",")[1]; |
| 61 | + type = id.split(",")[2]; | |
| 61 | 62 | var i = layer.load(2); |
| 62 | 63 | $get('/jdl/queryJdlReceptionBatchData',{createDate:date,createBy:by,type:'query'},function(result){ |
| 63 | 64 | layer.close(i); |
| ... | ... | @@ -69,8 +70,17 @@ |
| 69 | 70 | e.originName = "接口"; |
| 70 | 71 | } |
| 71 | 72 | }); |
| 72 | - var jdlReceptionBatchData = template('jdlReceptionBatchData_tbody',{list:result}); | |
| 73 | - $('#forms_2 tbody').html(jdlReceptionBatchData); | |
| 73 | + if(type == "upd"){ | |
| 74 | + var jdlReceptionBatchDataUpd = template('jdlReceptionBatchData_tbody_upd',{list:result}); | |
| 75 | + $('#forms_2 tbody').html(jdlReceptionBatchDataUpd); | |
| 76 | + $("input[name=dateStr]").datetimepicker({ | |
| 77 | + format: 'YYYY-MM-DD', | |
| 78 | + locale: 'zh-cn' | |
| 79 | + }); | |
| 80 | + } else { | |
| 81 | + var jdlReceptionBatchData = template('jdlReceptionBatchData_tbody',{list:result}); | |
| 82 | + $('#forms_2 tbody').html(jdlReceptionBatchData); | |
| 83 | + } | |
| 74 | 84 | }); |
| 75 | 85 | }) |
| 76 | 86 | |
| ... | ... | @@ -79,8 +89,9 @@ |
| 79 | 89 | <script type="text/html" id="jdlReceptionBatchData_tbody"> |
| 80 | 90 | {{each list as obj i}} |
| 81 | 91 | <tr> |
| 92 | + <td>{{obj.batchNo}}</td> | |
| 82 | 93 | <td>{{obj.dateStr}}</td> |
| 83 | - <td>{{obj.connectorId}}</td> | |
| 94 | + <td>{{obj.pileId}}</td> | |
| 84 | 95 | <td>{{obj.carCode}}</td> |
| 85 | 96 | <td>{{obj.startTime}}</td> |
| 86 | 97 | <td>{{obj.endTime}}</td> |
| ... | ... | @@ -88,8 +99,29 @@ |
| 88 | 99 | <td>{{obj.startSoc}}</td> |
| 89 | 100 | <td>{{obj.endSoc}}</td> |
| 90 | 101 | <td>{{obj.chargeCapacity}}</td> |
| 91 | - <td>{{obj.stopReason}}</td> | |
| 92 | - <td>{{obj.originName}}</td> | |
| 102 | + <!-- <td>{{obj.stopReason}}</td> --> | |
| 103 | + </tr> | |
| 104 | + {{/each}} | |
| 105 | + {{if list.length == 0}} | |
| 106 | + <tr> | |
| 107 | + <td colspan="11"><h6 class="muted">没有找到相关数据</h6></td> | |
| 108 | + </tr> | |
| 109 | + {{/if}} | |
| 110 | +</script> | |
| 111 | +<script type="text/html" id="jdlReceptionBatchData_tbody_upd"> | |
| 112 | + {{each list as obj i}} | |
| 113 | + <tr> | |
| 114 | + <td>{{obj.batchNo}}<input type="hidden" name="id" value="{{obj.id}}"/></td> | |
| 115 | + <td><input type="text" name="dateStr" value="{{obj.dateStr}}"/></td> | |
| 116 | + <td><input type="text" name="pileId" value="{{obj.pileId}}"/></td> | |
| 117 | + <td><input type="text" name="carCode" value="{{obj.carCode}}"/></td> | |
| 118 | + <td><input type="text" name="startTime" value="{{obj.startTime}}"/></td> | |
| 119 | + <td><input type="text" name="endTime" value="{{obj.endTime}}"/></td> | |
| 120 | + <td><input type="text" name="sumTime" value="{{obj.sumTime}}"/></td> | |
| 121 | + <td><input type="text" name="startSoc" value="{{obj.startSoc}}"/></td> | |
| 122 | + <td><input type="text" name="endSoc" value="{{obj.endSoc}}"/></td> | |
| 123 | + <td><input type="text" name="chargeCapacity" value="{{obj.chargeCapacity}}"/></td> | |
| 124 | + <!-- <td><input type="text" name="stopReason" value="{{obj.stopReason}}"/></td> --> | |
| 93 | 125 | </tr> |
| 94 | 126 | {{/each}} |
| 95 | 127 | {{if list.length == 0}} | ... | ... |
src/main/resources/static/pages/electricity/jdl/upload_2412.html
| ... | ... | @@ -81,7 +81,14 @@ |
| 81 | 81 | }, |
| 82 | 82 | error : function(data, status, e) { |
| 83 | 83 | layer.close(j); |
| 84 | - alert("文件导入失败"); | |
| 84 | +// alert("文件导入失败"); | |
| 85 | + var resText = data.responseText; | |
| 86 | + if(data.responseText && data.responseText != ""){ | |
| 87 | + resText = resText.slice(resText.indexOf('"result":"') + 10, resText.indexOf('"}')); | |
| 88 | + alert(resText); | |
| 89 | + } else { | |
| 90 | + alert("文件导入失败"); | |
| 91 | + } | |
| 85 | 92 | } |
| 86 | 93 | }) |
| 87 | 94 | }); | ... | ... |