Commit ccab97eedb20fa8c4e95881466447c7de1d97735
1 parent
ec705dfa
增加充电枪管理;充电量修改只能改充电度数;同车充电时间重叠提醒;同枪同时间两车重叠提醒;导入枪名关联出枪号、桩号;导入时选择场站;
Showing
14 changed files
with
1034 additions
and
82 deletions
src/main/java/com/bsth/controller/oil/JdlController.java
| ... | ... | @@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile; |
| 16 | 16 | |
| 17 | 17 | import com.bsth.controller.BaseController; |
| 18 | 18 | import com.bsth.entity.oil.Jdl; |
| 19 | +import com.bsth.entity.oil.JdlConnector; | |
| 19 | 20 | import com.bsth.entity.oil.JdlReception; |
| 20 | 21 | import com.bsth.service.oil.JdlService; |
| 21 | 22 | import com.google.common.io.Files; |
| ... | ... | @@ -49,12 +50,13 @@ public class JdlController extends BaseController<Jdl, Integer> { |
| 49 | 50 | /** 24年12月工单更新电量导入 */ |
| 50 | 51 | @RequestMapping(value = "/uploadFile_2412",method = RequestMethod.POST) |
| 51 | 52 | public String uploadFile_2412(MultipartFile file, String gsbm_, String gsName, |
| 52 | - String fgsbm_, String fgsName) throws Exception{ | |
| 53 | + String fgsbm_, String fgsName, String stationName) throws Exception{ | |
| 53 | 54 | File newFile = new File( |
| 54 | 55 | getDataImportClasspath() + File.separator + |
| 55 | 56 | file.getOriginalFilename()); |
| 56 | 57 | Files.write(file.getBytes(), newFile); |
| 57 | - String result = jdlService.importExcel_2412(newFile, gsbm_, gsName, fgsbm_, fgsName); | |
| 58 | + | |
| 59 | + String result = jdlService.importExcel_2412(newFile, gsbm_, gsName, fgsbm_, fgsName, stationName); | |
| 58 | 60 | return "{\"result\":" + "\""+result+"\"}"; |
| 59 | 61 | } |
| 60 | 62 | |
| ... | ... | @@ -98,4 +100,34 @@ public class JdlController extends BaseController<Jdl, Integer> { |
| 98 | 100 | jdlService.downloadJdlReceptionImportFile(map, response); |
| 99 | 101 | } |
| 100 | 102 | |
| 103 | + @RequestMapping(value = "/queryJdlConnector",method = RequestMethod.GET) | |
| 104 | + public List<JdlConnector> queryJdlConnector(@RequestParam Map<String, Object> map) throws Exception{ | |
| 105 | + return jdlService.queryJdlConnector(map); | |
| 106 | + } | |
| 107 | + | |
| 108 | + @RequestMapping(value = "/queryJdlConnectorById",method = RequestMethod.GET) | |
| 109 | + public JdlConnector queryJdlConnectorById(@RequestParam int id) throws Exception{ | |
| 110 | + return jdlService.queryJdlConnectorById(id); | |
| 111 | + } | |
| 112 | + | |
| 113 | + @RequestMapping(value = "/queryJdlStationName",method = RequestMethod.GET) | |
| 114 | + public List<String> queryJdlStationName() throws Exception{ | |
| 115 | + return jdlService.queryJdlStationName(); | |
| 116 | + } | |
| 117 | + | |
| 118 | + @RequestMapping(value = "/addJdlConnector",method = RequestMethod.POST) | |
| 119 | + public Map<String, Object> addJdlConnector(@RequestParam Map<String, Object> map) throws Exception{ | |
| 120 | + return jdlService.addJdlConnector(map); | |
| 121 | + } | |
| 122 | + | |
| 123 | + @RequestMapping(value = "/deleteJdlConnector",method = RequestMethod.POST) | |
| 124 | + public Map<String, Object> deleteJdlConnector(@RequestParam Map<String, Object> map) throws Exception{ | |
| 125 | + return jdlService.deleteJdlConnector(map); | |
| 126 | + } | |
| 127 | + | |
| 128 | + @RequestMapping(value = "/updateJdlConnector",method = RequestMethod.POST) | |
| 129 | + public Map<String, Object> updateJdlConnector(@RequestParam Map<String, Object> map) throws Exception{ | |
| 130 | + return jdlService.updateJdlConnector(map); | |
| 131 | + } | |
| 132 | + | |
| 101 | 133 | } | ... | ... |
src/main/java/com/bsth/entity/oil/JdlConnector.java
0 → 100644
| 1 | +package com.bsth.entity.oil; | |
| 2 | + | |
| 3 | +import java.util.Date; | |
| 4 | + | |
| 5 | +import javax.persistence.Entity; | |
| 6 | +import javax.persistence.GeneratedValue; | |
| 7 | +import javax.persistence.GenerationType; | |
| 8 | +import javax.persistence.Id; | |
| 9 | +import javax.persistence.Table; | |
| 10 | + | |
| 11 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 12 | + | |
| 13 | +/** | |
| 14 | +-------------------------------------------------------- | |
| 15 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID', | |
| 16 | + `connector_name` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '充电枪名称', | |
| 17 | + `connector_id` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '充电枪自编号', | |
| 18 | + `station_name` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '充电站名称', | |
| 19 | + `remark` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注', | |
| 20 | + `create_by` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人', | |
| 21 | + `create_date` datetime DEFAULT NULL COMMENT '创建时间', | |
| 22 | + `update_by` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人', | |
| 23 | + `update_date` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', | |
| 24 | +*/ | |
| 25 | +@Entity | |
| 26 | +@Table(name = "bsth_c_jdl_connector") | |
| 27 | +public class JdlConnector { | |
| 28 | + @Id | |
| 29 | + @GeneratedValue(strategy = GenerationType.IDENTITY) | |
| 30 | + private Integer id; | |
| 31 | + private String connectorName; | |
| 32 | + private String connectorId; | |
| 33 | + private String stationName; | |
| 34 | + private String remark; | |
| 35 | + private String createBy; | |
| 36 | + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |
| 37 | + private Date createDate; | |
| 38 | + private String updateBy; | |
| 39 | + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |
| 40 | + private Date updateDate; | |
| 41 | + | |
| 42 | + | |
| 43 | + public Integer getId() { | |
| 44 | + return id; | |
| 45 | + } | |
| 46 | + public void setId(Integer id) { | |
| 47 | + this.id = id; | |
| 48 | + } | |
| 49 | + public String getConnectorName() { | |
| 50 | + return connectorName; | |
| 51 | + } | |
| 52 | + public void setConnectorName(String connectorName) { | |
| 53 | + this.connectorName = connectorName; | |
| 54 | + } | |
| 55 | + public String getConnectorId() { | |
| 56 | + return connectorId; | |
| 57 | + } | |
| 58 | + public void setConnectorId(String connectorId) { | |
| 59 | + this.connectorId = connectorId; | |
| 60 | + } | |
| 61 | + public String getStationName() { | |
| 62 | + return stationName; | |
| 63 | + } | |
| 64 | + public void setStationName(String stationName) { | |
| 65 | + this.stationName = stationName; | |
| 66 | + } | |
| 67 | + public String getRemark() { | |
| 68 | + return remark; | |
| 69 | + } | |
| 70 | + public void setRemark(String remark) { | |
| 71 | + this.remark = remark; | |
| 72 | + } | |
| 73 | + public String getCreateBy() { | |
| 74 | + return createBy; | |
| 75 | + } | |
| 76 | + public void setCreateBy(String createBy) { | |
| 77 | + this.createBy = createBy; | |
| 78 | + } | |
| 79 | + public Date getCreateDate() { | |
| 80 | + return createDate; | |
| 81 | + } | |
| 82 | + public void setCreateDate(Date createDate) { | |
| 83 | + this.createDate = createDate; | |
| 84 | + } | |
| 85 | + public String getUpdateBy() { | |
| 86 | + return updateBy; | |
| 87 | + } | |
| 88 | + public void setUpdateBy(String updateBy) { | |
| 89 | + this.updateBy = updateBy; | |
| 90 | + } | |
| 91 | + public Date getUpdateDate() { | |
| 92 | + return updateDate; | |
| 93 | + } | |
| 94 | + public void setUpdateDate(Date updateDate) { | |
| 95 | + this.updateDate = updateDate; | |
| 96 | + } | |
| 97 | + | |
| 98 | +} | |
| 0 | 99 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/entity/oil/JdlReception.java
| ... | ... | @@ -15,6 +15,7 @@ import org.springframework.format.annotation.DateTimeFormat; |
| 15 | 15 | `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', |
| 16 | 16 | `station_name` varchar(255) DEFAULT NULL COMMENT '站点名称', |
| 17 | 17 | `connector_id` varchar(255) DEFAULT NULL COMMENT '枪编号', |
| 18 | + `connector_name` varchar(255) DEFAULT NULL COMMENT '充电枪名', | |
| 18 | 19 | `order_no` varchar(255) DEFAULT NULL COMMENT '订单编号', |
| 19 | 20 | `start_time` varchar(255) DEFAULT NULL COMMENT '充电开始时间', |
| 20 | 21 | `end_time` varchar(255) DEFAULT NULL COMMENT '充电结束时间', |
| ... | ... | @@ -45,6 +46,7 @@ public class JdlReception { |
| 45 | 46 | private Long id; |
| 46 | 47 | private String stationName; |
| 47 | 48 | private String connectorId; |
| 49 | + private String connectorName; | |
| 48 | 50 | private String orderNo; |
| 49 | 51 | private String startTime; |
| 50 | 52 | private String endTime; |
| ... | ... | @@ -63,6 +65,7 @@ public class JdlReception { |
| 63 | 65 | private Integer sumTime; |
| 64 | 66 | private String batchNo; |
| 65 | 67 | private String pileId; |
| 68 | + private String remark; | |
| 66 | 69 | private String createBy; |
| 67 | 70 | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| 68 | 71 | private Date createDate; |
| ... | ... | @@ -89,6 +92,12 @@ public class JdlReception { |
| 89 | 92 | public void setConnectorId(String connectorId) { |
| 90 | 93 | this.connectorId = connectorId; |
| 91 | 94 | } |
| 95 | + public String getConnectorName() { | |
| 96 | + return connectorName; | |
| 97 | + } | |
| 98 | + public void setConnectorName(String connectorName) { | |
| 99 | + this.connectorName = connectorName; | |
| 100 | + } | |
| 92 | 101 | public String getOrderNo() { |
| 93 | 102 | return orderNo; |
| 94 | 103 | } |
| ... | ... | @@ -197,6 +206,12 @@ public class JdlReception { |
| 197 | 206 | public void setPileId(String pileId) { |
| 198 | 207 | this.pileId = pileId; |
| 199 | 208 | } |
| 209 | + public String getRemark() { | |
| 210 | + return remark; | |
| 211 | + } | |
| 212 | + public void setRemark(String remark) { | |
| 213 | + this.remark = remark; | |
| 214 | + } | |
| 200 | 215 | public String getCreateBy() { |
| 201 | 216 | return createBy; |
| 202 | 217 | } | ... | ... |
src/main/java/com/bsth/repository/oil/JdlConnectorRepository.java
0 → 100644
| 1 | +package com.bsth.repository.oil; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | + | |
| 5 | +import org.springframework.data.jpa.repository.Modifying; | |
| 6 | +import org.springframework.data.jpa.repository.Query; | |
| 7 | +import org.springframework.stereotype.Repository; | |
| 8 | +import org.springframework.transaction.annotation.Transactional; | |
| 9 | + | |
| 10 | +import com.bsth.entity.oil.JdlConnector; | |
| 11 | +import com.bsth.repository.BaseRepository; | |
| 12 | + | |
| 13 | +@Repository | |
| 14 | +public interface JdlConnectorRepository extends BaseRepository<JdlConnector, Integer>{ | |
| 15 | + | |
| 16 | + @Query(value="SELECT j FROM JdlConnector j WHERE connectorName like %?1% and connectorId like %?2% and stationName like %?3% order by stationName, connectorId ") | |
| 17 | + List<JdlConnector> query(String connectorName, String connectorId, String stationName); | |
| 18 | + | |
| 19 | + @Query(value="SELECT j FROM JdlConnector j WHERE connectorName = ?1 ") | |
| 20 | + List<JdlConnector> queryByGunName(String connectorName); | |
| 21 | + | |
| 22 | + @Query(value="SELECT j FROM JdlConnector j WHERE id = ?1 ") | |
| 23 | + JdlConnector queryById(Integer id); | |
| 24 | + | |
| 25 | + @Query(value="SELECT j.stationName FROM JdlConnector j group by stationName ") | |
| 26 | + List<String> queryStationName(); | |
| 27 | + | |
| 28 | + @Modifying | |
| 29 | + @Transactional | |
| 30 | + @Query(value = "delete JdlConnector j where id = ?1 ") | |
| 31 | + void delete(Integer id); | |
| 32 | + | |
| 33 | + @Transactional | |
| 34 | + @Modifying | |
| 35 | + @Query(value="UPDATE bsth_c_jdl_connector SET " + | |
| 36 | + " connector_name = ?2," + | |
| 37 | + " connector_id = ?3," + | |
| 38 | + " station_name = ?4" + | |
| 39 | + " WHERE id = ?1 ", nativeQuery=true) | |
| 40 | + public void update(Integer id, String connectorName, String connectorId, String stationName); | |
| 41 | + | |
| 42 | +} | ... | ... |
src/main/java/com/bsth/repository/oil/JdlReceptionRepository.java
| ... | ... | @@ -22,9 +22,21 @@ public interface JdlReceptionRepository extends BaseRepository<JdlReception, Int |
| 22 | 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) |
| 23 | 23 | List<Object[]> queryBatch(String rq); |
| 24 | 24 | |
| 25 | + @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 DATE_FORMAT(create_date, '%Y-%m-%d') <= ?2 and create_by like %?3% and origin = 1 group by batch_no, create_by, create_date order by create_date, create_by, batch_no" ,nativeQuery=true) | |
| 26 | + List<Object[]> queryBatchByDates(String rq1, String rq2, String createBy); | |
| 27 | + | |
| 25 | 28 | @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) |
| 26 | 29 | List<JdlReception> queryBatchData(String createBy, String createDate); |
| 27 | 30 | |
| 31 | + @Query(value="SELECT j FROM JdlReception j WHERE id = ?1 ") | |
| 32 | + List<JdlReception> queryById(Long id); | |
| 33 | + | |
| 34 | + @Query(value="SELECT j FROM JdlReception j WHERE endTime >= ?1 and startTime <= ?2 and carCode = ?3 ") | |
| 35 | + List<JdlReception> queryRepeatCar(String startTime, String endTime, String nbbm); | |
| 36 | + | |
| 37 | + @Query(value="SELECT j FROM JdlReception j WHERE endTime >= ?1 and startTime <= ?2 and connectorId = ?3 and carCode != ?4 ") | |
| 38 | + List<JdlReception> queryRepeatConnector(String startTime, String endTime, String connectorId, String nbbm); | |
| 39 | + | |
| 28 | 40 | @Modifying |
| 29 | 41 | @Transactional |
| 30 | 42 | @Query(value = "delete JdlReception j where createBy = ?1 and DATE_FORMAT(createDate, '%Y-%m-%d %H:%i:%s') = ?2 and origin = 1") | ... | ... |
src/main/java/com/bsth/service/oil/JdlService.java
| ... | ... | @@ -8,6 +8,7 @@ import java.util.Map; |
| 8 | 8 | import javax.servlet.http.HttpServletResponse; |
| 9 | 9 | |
| 10 | 10 | import com.bsth.entity.oil.Jdl; |
| 11 | +import com.bsth.entity.oil.JdlConnector; | |
| 11 | 12 | import com.bsth.entity.oil.JdlReception; |
| 12 | 13 | import com.bsth.service.BaseService; |
| 13 | 14 | |
| ... | ... | @@ -16,7 +17,7 @@ public interface JdlService extends BaseService<Jdl, Integer> { |
| 16 | 17 | public String importExcel(File file, String gsbm_, String gsName, String fgsbm, String fgsName); |
| 17 | 18 | |
| 18 | 19 | /** 24年12月工单更新电量导入 */ |
| 19 | - public String importExcel_2412(File file, String gsbm_, String gsName, String fgsbm, String fgsName); | |
| 20 | + public String importExcel_2412(File file, String gsbm_, String gsName, String fgsbm, String fgsName, String stationName); | |
| 20 | 21 | |
| 21 | 22 | public Map<String, Object> query(Map<String, Object> map); |
| 22 | 23 | |
| ... | ... | @@ -42,4 +43,16 @@ public interface JdlService extends BaseService<Jdl, Integer> { |
| 42 | 43 | */ |
| 43 | 44 | public List<Jdl> queryJdlByJdlReception(String rq, String nbbm); |
| 44 | 45 | |
| 46 | + public List<JdlConnector> queryJdlConnector(Map<String, Object> map); | |
| 47 | + | |
| 48 | + public JdlConnector queryJdlConnectorById(Integer id); | |
| 49 | + | |
| 50 | + public List<String> queryJdlStationName(); | |
| 51 | + | |
| 52 | + public Map<String, Object> addJdlConnector(Map<String, Object> map); | |
| 53 | + | |
| 54 | + public Map<String, Object> deleteJdlConnector(Map<String, Object> map); | |
| 55 | + | |
| 56 | + public Map<String, Object> updateJdlConnector(Map<String, Object> map); | |
| 57 | + | |
| 45 | 58 | } | ... | ... |
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
| ... | ... | @@ -117,8 +117,9 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS |
| 117 | 117 | //当天YLXXB信息 |
| 118 | 118 | List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq,1,""); |
| 119 | 119 | //当天加电信息表 |
| 120 | - List<Jdl> jdlList = jdlService.queryJdlByJdlReception(rq, ""); | |
| 121 | - jdlList.addAll(jdlRepository.JdlList(rq)); | |
| 120 | + List<Jdl> jdlList = jdlRepository.JdlList(rq); | |
| 121 | +// List<Jdl> jdlList = jdlService.queryJdlByJdlReception(rq, ""); | |
| 122 | +// jdlList.addAll(jdlRepository.JdlList(rq)); | |
| 122 | 123 | //前一天所有车辆最后进场班次信息 |
| 123 | 124 | // List<Dlb> dlListBe=repository.obtainYlbefore(rq, "", "", "", ""); |
| 124 | 125 | List<Cdl> cdyList=cdlRepository.obtainCdl(); |
| ... | ... | @@ -288,8 +289,9 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS |
| 288 | 289 | } |
| 289 | 290 | } |
| 290 | 291 | |
| 291 | - List<Jdl> jdlList = jdlService.queryJdlByJdlReception(rq, ""); | |
| 292 | - jdlList.addAll(jdlRepository.JdlList(rq)); | |
| 292 | + List<Jdl> jdlList = jdlRepository.JdlList(rq); | |
| 293 | +// List<Jdl> jdlList = jdlService.queryJdlByJdlReception(rq, ""); | |
| 294 | +// jdlList.addAll(jdlRepository.JdlList(rq)); | |
| 293 | 295 | String sxtj=map2.get("sxtj").toString(); |
| 294 | 296 | if(sxtj.equals("0")){ |
| 295 | 297 | listpb=listpbs; |
| ... | ... | @@ -915,18 +917,26 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS |
| 915 | 917 | String fgsdm,String xlbm,String nbbm, |
| 916 | 918 | String px) { |
| 917 | 919 | // TODO Auto-generated method stub |
| 918 | - String sql="SELECT * FROM bsth_c_dlb " | |
| 919 | - + " where rq='"+rq+"' and ssgsdm like '%"+gsdm+"%' " | |
| 920 | - + " and fgsdm like '%"+fgsdm+"%'"; | |
| 920 | + List<String> objList = new ArrayList<String>(); | |
| 921 | + String sql="SELECT * FROM bsth_c_dlb " | |
| 922 | + + " where rq = ? " | |
| 923 | + + " and ssgsdm like ? " | |
| 924 | + + " and fgsdm like ? "; | |
| 925 | + objList.add(rq); | |
| 926 | + objList.add('%' + gsdm + '%'); | |
| 927 | + objList.add('%' + fgsdm + '%'); | |
| 921 | 928 | if(xlbm.equals("")){ |
| 922 | - sql+= " and xlbm like '%"+xlbm+"%' "; | |
| 929 | + sql+= " and xlbm like ? "; | |
| 930 | + objList.add('%' + xlbm + '%'); | |
| 923 | 931 | }else{ |
| 924 | - sql+= " and xlbm = '"+xlbm+"' "; | |
| 932 | + sql+= " and xlbm = ? "; | |
| 933 | + objList.add(xlbm); | |
| 925 | 934 | } |
| 926 | - | |
| 927 | - sql += "and nbbm like '%"+nbbm+"%' order by "+px+" asc "; | |
| 928 | 935 | |
| 929 | - List<Dlb> list = jdbcTemplate.query(sql, new RowMapper<Dlb>() { | |
| 936 | + sql += "and nbbm like ? order by "+px+" asc "; | |
| 937 | + objList.add('%' + nbbm + '%'); | |
| 938 | + | |
| 939 | + List<Dlb> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Dlb>() { | |
| 930 | 940 | @Override |
| 931 | 941 | public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException { |
| 932 | 942 | Dlb y = new Dlb(); |
| ... | ... | @@ -1113,8 +1123,10 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS |
| 1113 | 1123 | shMap.put(cl, Arith.add(sh, dlb.getSh())); |
| 1114 | 1124 | } |
| 1115 | 1125 | } |
| 1116 | - List<Jdl> jdlList = jdlService.queryJdlByJdlReception(date, ""); | |
| 1117 | - jdlList.addAll(jdlRepository.JdlList(date)); | |
| 1126 | + List<Jdl> jdlList = jdlRepository.JdlList(date); | |
| 1127 | +// List<Jdl> jdlList = jdlService.queryJdlByJdlReception(date, ""); | |
| 1128 | +// jdlList.addAll(jdlRepository.JdlList(date)); | |
| 1129 | + | |
| 1118 | 1130 | // List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(date, 0,gsdm); |
| 1119 | 1131 | Map<String, Object> newMap_=new HashMap<String,Object>(); |
| 1120 | 1132 | Map<String, Object> cMap=new HashMap<String, Object>(); | ... | ... |
src/main/java/com/bsth/service/oil/impl/JdlServiceImpl.java
| ... | ... | @@ -7,6 +7,8 @@ import java.io.FileInputStream; |
| 7 | 7 | import java.io.IOException; |
| 8 | 8 | import java.io.InputStream; |
| 9 | 9 | import java.io.OutputStream; |
| 10 | +import java.math.BigDecimal; | |
| 11 | +import java.math.RoundingMode; | |
| 10 | 12 | import java.text.DecimalFormat; |
| 11 | 13 | import java.text.SimpleDateFormat; |
| 12 | 14 | import java.util.ArrayList; |
| ... | ... | @@ -30,9 +32,11 @@ import org.springframework.stereotype.Service; |
| 30 | 32 | |
| 31 | 33 | import com.bsth.common.ResponseCode; |
| 32 | 34 | import com.bsth.entity.oil.Jdl; |
| 35 | +import com.bsth.entity.oil.JdlConnector; | |
| 33 | 36 | import com.bsth.entity.oil.JdlReception; |
| 34 | 37 | import com.bsth.entity.oil.Nylog; |
| 35 | 38 | import com.bsth.entity.sys.SysUser; |
| 39 | +import com.bsth.repository.oil.JdlConnectorRepository; | |
| 36 | 40 | import com.bsth.repository.oil.JdlReceptionRepository; |
| 37 | 41 | import com.bsth.repository.oil.JdlRepository; |
| 38 | 42 | import com.bsth.repository.oil.NylogRepository; |
| ... | ... | @@ -52,6 +56,9 @@ public class JdlServiceImpl extends BaseServiceImpl<Jdl, Integer> implements Jdl |
| 52 | 56 | JdlReceptionRepository jdlReceptionRepository; |
| 53 | 57 | |
| 54 | 58 | @Autowired |
| 59 | + JdlConnectorRepository jdlConnectorRepository; | |
| 60 | + | |
| 61 | + @Autowired | |
| 55 | 62 | NylogRepository nylogRepository; |
| 56 | 63 | |
| 57 | 64 | @Value("${electricity.importFile.path}") |
| ... | ... | @@ -184,13 +191,14 @@ public class JdlServiceImpl extends BaseServiceImpl<Jdl, Integer> implements Jdl |
| 184 | 191 | } |
| 185 | 192 | |
| 186 | 193 | @Override |
| 187 | - public String importExcel_2412(File file, String gsbm, String gsName, String fgsbm, String fgsName) { | |
| 194 | + public String importExcel_2412(File file, String gsbm, String gsName, String fgsbm, String fgsName, String stationName) { | |
| 188 | 195 | SimpleDateFormat yearMonthFormat = new SimpleDateFormat("yyyy-MM"); |
| 189 | 196 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| 190 | 197 | SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| 191 | 198 | SimpleDateFormat SSSformat = new SimpleDateFormat("yyMMddHHmmssSS"); |
| 192 | 199 | SimpleDateFormat ddFormat = new SimpleDateFormat("dd"); |
| 193 | - DecimalFormat df = new DecimalFormat("######0.00"); | |
| 200 | + DecimalFormat df = new DecimalFormat("0.00"); | |
| 201 | + df.setRoundingMode(RoundingMode.HALF_UP); // 设置为四舍五入的进位方式 | |
| 194 | 202 | SysUser user = SecurityUtils.getCurrentUser(); |
| 195 | 203 | Date currDate = new Date(); |
| 196 | 204 | List<String> textList = new ArrayList<String>(); |
| ... | ... | @@ -232,8 +240,21 @@ public class JdlServiceImpl extends BaseServiceImpl<Jdl, Integer> implements Jdl |
| 232 | 240 | } |
| 233 | 241 | if(str.trim().length() == 0) |
| 234 | 242 | continue; |
| 235 | - textList.add(text + ";"); | |
| 243 | + textList.add(text); | |
| 236 | 244 | } |
| 245 | + | |
| 246 | + List<JdlConnector> connectorList = jdlConnectorRepository.query("", "", stationName); | |
| 247 | + Map<String, JdlConnector> connectorNameMap = new HashMap<String, JdlConnector>(); | |
| 248 | + Map<String, JdlConnector> connectorIdMap = new HashMap<String, JdlConnector>(); | |
| 249 | + for(JdlConnector c : connectorList){ | |
| 250 | + connectorNameMap.put(c.getConnectorName(), c); | |
| 251 | + connectorIdMap.put(c.getConnectorId(), c); | |
| 252 | + } | |
| 253 | + | |
| 254 | + // 校验车辆充电时间冲突的临时对象。 | |
| 255 | + Map<String, List<JdlReception>> repeatCarMap = new HashMap<String, List<JdlReception>>(); | |
| 256 | + Map<String, List<JdlReception>> repeatConnectorMap = new HashMap<String, List<JdlReception>>(); | |
| 257 | + | |
| 237 | 258 | String str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; |
| 238 | 259 | List<JdlReception> list = new ArrayList<JdlReception>(); |
| 239 | 260 | for(int i = 0; i < textList.size(); i++){ |
| ... | ... | @@ -243,35 +264,56 @@ public class JdlServiceImpl extends BaseServiceImpl<Jdl, Integer> implements Jdl |
| 243 | 264 | split[3] != null && split[3].trim().length() > 0){ |
| 244 | 265 | int lie = 1; |
| 245 | 266 | 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(); // 一次不能正常充电记录 | |
| 267 | + Integer dd = Integer.valueOf(split[lie].trim().split("\\.")[0]); // 日期 | |
| 268 | + lie++;String gun = split[lie].trim().split("\\.")[0]; // 充电枪 | |
| 269 | + lie++;String nbbm = split[lie].trim(); // 车号 | |
| 270 | + lie++;String startTime = split[lie].trim(); // 开始时间 | |
| 271 | + lie++;String endTime = split[lie].trim(); // 结束时间 | |
| 272 | + lie++;String sumTime = split[lie].trim(); // 总计(分钟) | |
| 273 | + lie++;String startSoc = split[lie].trim(); // 起始电量SOC% | |
| 274 | + lie++;String endSoc = split[lie].trim(); // 结束电量SOC% | |
| 275 | + lie++;String jdl = split[lie].trim(); // 充电度数 | |
| 276 | + String lc = "", stopReason = ""; | |
| 277 | + lie++; | |
| 278 | + if(split.length > lie) | |
| 279 | + lc = split[lie].trim(); // 里程读数 | |
| 280 | + lie++; | |
| 281 | + if(split.length > lie) | |
| 282 | + stopReason = split[lie].trim(); // 一次不能正常充电记录 | |
| 257 | 283 | |
| 258 | 284 | sumTime = sumTime.split("\\.")[0]; |
| 259 | 285 | |
| 260 | 286 | Date parseStartTime = sd.parse(startTime); |
| 261 | 287 | Date parseEndTime = sd.parse(endTime); |
| 288 | + if(parseStartTime.getTime() > parseEndTime.getTime()){ | |
| 289 | + msg += System.lineSeparator() + "文档第"+(i + 4)+"行,充电结束时间小于开始时间;"; | |
| 290 | + continue; | |
| 291 | + } | |
| 262 | 292 | long sub = ((parseEndTime.getTime() - parseStartTime.getTime()) / (1l*1000*60)) - Long.valueOf(sumTime); |
| 263 | 293 | if(sub > 2 || sub < -2){ |
| 264 | 294 | msg += System.lineSeparator() + "文档第"+(i + 4)+"行,充电时间总计分钟数("+sumTime+")误差超过2分钟;"; |
| 265 | 295 | } |
| 266 | 296 | |
| 297 | + if(!connectorNameMap.containsKey(gun) && !connectorIdMap.containsKey(gun)){ | |
| 298 | + msg += System.lineSeparator() + "文档第"+(i + 4)+"行,充电枪无法识别或不在库中;"; | |
| 299 | + | |
| 300 | + } | |
| 301 | + JdlConnector jdlConnector = connectorNameMap.containsKey(gun) ? connectorNameMap.get(gun) | |
| 302 | + : (connectorIdMap.containsKey(gun) ? connectorIdMap.get(gun) : new JdlConnector()); | |
| 303 | + | |
| 267 | 304 | JdlReception jdlRe = new JdlReception(); |
| 268 | 305 | Date date = sd.parse(startTime); |
| 269 | 306 | if(!(dd == Integer.valueOf(ddFormat.format(date)))){ |
| 270 | 307 | date.setTime(date.getTime() - 1l*1000*60*60*24); |
| 271 | 308 | } |
| 309 | + | |
| 310 | + jdl = df.format(new BigDecimal(jdl)); // 用Double或float总有各种格样的问题,这里直接用BigDecimal;也可以直接用BigDecimal做四舍五入 | |
| 311 | + | |
| 272 | 312 | jdlRe.setBatchNo(batchNo); |
| 273 | 313 | jdlRe.setDateStr(sdf.format(date)); |
| 274 | - jdlRe.setPileId(zh); | |
| 314 | + jdlRe.setConnectorName(jdlConnector.getConnectorName()); | |
| 315 | + jdlRe.setConnectorId(jdlConnector.getConnectorId()); | |
| 316 | + jdlRe.setStationName(jdlConnector.getStationName()); | |
| 275 | 317 | jdlRe.setCarCode(nbbm); |
| 276 | 318 | jdlRe.setStartTime(startTime); |
| 277 | 319 | jdlRe.setEndTime(endTime); |
| ... | ... | @@ -279,10 +321,74 @@ public class JdlServiceImpl extends BaseServiceImpl<Jdl, Integer> implements Jdl |
| 279 | 321 | jdlRe.setStartSoc(Double.valueOf(startSoc)); |
| 280 | 322 | jdlRe.setEndSoc(Double.valueOf(endSoc)); |
| 281 | 323 | jdlRe.setChargeCapacity(Double.valueOf(jdl)); |
| 324 | + jdlRe.setRemark(lc); // 里程读数目前用不到,暂时放到备注字段里。 | |
| 282 | 325 | jdlRe.setStopReason(stopReason); |
| 283 | 326 | jdlRe.setCreateBy(user.getUserName()); |
| 284 | 327 | jdlRe.setCreateDate(currDate); |
| 285 | 328 | jdlRe.setOrigin(1); |
| 329 | + | |
| 330 | + List<JdlReception> queryRepeatCar = jdlReceptionRepository.queryRepeatCar(startTime, endTime, nbbm); | |
| 331 | + if(queryRepeatCar.size() > 0){ | |
| 332 | + msg += System.lineSeparator() + "文档第"+(i + 4)+"行,车号("+nbbm+")充电时间与库中同车号存在重叠;"; | |
| 333 | + | |
| 334 | + } else if(repeatCarMap.containsKey(nbbm)){ | |
| 335 | + Long startTimeLong = parseStartTime.getTime(); | |
| 336 | + Long endTimeLong = parseEndTime.getTime(); | |
| 337 | + List<JdlReception> JdlReceptionList = repeatCarMap.get(nbbm); | |
| 338 | + boolean flag = false; | |
| 339 | + for(JdlReception temp : JdlReceptionList){ | |
| 340 | + Long tempStartTime = sd.parse(temp.getStartTime()).getTime(); | |
| 341 | + Long tempEndTime = sd.parse(temp.getEndTime()).getTime(); | |
| 342 | + if(startTimeLong <= tempEndTime && endTimeLong >= tempStartTime){ | |
| 343 | + msg += System.lineSeparator() + "文档第"+(i + 4)+"行,车号("+nbbm+")充电时间与文档中同车号存在重叠;"; | |
| 344 | + flag = true; | |
| 345 | + break; // 判断重叠直接跳过,不需要再查询一次sql | |
| 346 | + } | |
| 347 | + } | |
| 348 | + if(flag){ | |
| 349 | + repeatCarMap.get(nbbm).add(jdlRe); | |
| 350 | + list.add(jdlRe); | |
| 351 | + } | |
| 352 | + } | |
| 353 | + if(!repeatCarMap.containsKey(nbbm)){ | |
| 354 | + repeatCarMap.put(nbbm, new ArrayList<JdlReception>()); | |
| 355 | + } | |
| 356 | + repeatCarMap.get(nbbm).add(jdlRe); | |
| 357 | + | |
| 358 | + | |
| 359 | + String connectorId = jdlConnector.getConnectorId(); | |
| 360 | + if(connectorId != null){ | |
| 361 | + List<JdlReception> queryRepeatConnector = jdlReceptionRepository.queryRepeatConnector(startTime, endTime, connectorId, nbbm); | |
| 362 | + if(queryRepeatConnector.size() > 0){ | |
| 363 | + msg += System.lineSeparator() + "文档第"+(i + 4)+"行,充电枪("+jdlConnector.getConnectorName()+")充电时间与库中其他车辆存在重叠;"; | |
| 364 | + | |
| 365 | + } else if(repeatConnectorMap.containsKey(connectorId)){ | |
| 366 | + Long startTimeLong = parseStartTime.getTime(); | |
| 367 | + Long endTimeLong = parseEndTime.getTime(); | |
| 368 | + List<JdlReception> JdlReceptionList = repeatConnectorMap.get(connectorId); | |
| 369 | + boolean flag = false; | |
| 370 | + for(JdlReception temp : JdlReceptionList){ | |
| 371 | + if(temp.getConnectorId() != null && !connectorId.equals(temp.getConnectorId())){ | |
| 372 | + Long tempStartTime = sd.parse(temp.getStartTime()).getTime(); | |
| 373 | + Long tempEndTime = sd.parse(temp.getEndTime()).getTime(); | |
| 374 | + if(startTimeLong <= tempEndTime && endTimeLong >= tempStartTime){ | |
| 375 | + msg += System.lineSeparator() + "文档第"+(i + 4)+"行,充电枪("+jdlConnector.getConnectorName()+")充电时间与文档中其他车辆存在重叠;"; | |
| 376 | + flag = true; | |
| 377 | + break; // 判断重叠直接跳过,不需要再查询一次sql | |
| 378 | + } | |
| 379 | + } | |
| 380 | + } | |
| 381 | + if(flag){ | |
| 382 | + repeatCarMap.get(nbbm).add(jdlRe); | |
| 383 | + list.add(jdlRe); | |
| 384 | + } | |
| 385 | + } | |
| 386 | + if(!repeatConnectorMap.containsKey(nbbm)){ | |
| 387 | + repeatConnectorMap.put(connectorId, new ArrayList<JdlReception>()); | |
| 388 | + } | |
| 389 | + repeatConnectorMap.get(connectorId).add(jdlRe); | |
| 390 | + } | |
| 391 | + | |
| 286 | 392 | list.add(jdlRe); |
| 287 | 393 | } catch (Exception e) { |
| 288 | 394 | // TODO: handle exception |
| ... | ... | @@ -406,11 +512,13 @@ public class JdlServiceImpl extends BaseServiceImpl<Jdl, Integer> implements Jdl |
| 406 | 512 | public Map<String, Object> queryJdlReceptionBatch(Map<String, Object> map) { |
| 407 | 513 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"); |
| 408 | 514 | Map<String, Object> modelMap = new HashMap<String, Object>(); |
| 409 | - String rq = map.get("rq").toString(); | |
| 515 | + String rq1 = map.get("rq1").toString(); | |
| 516 | + String rq2 = map.get("rq2").toString(); | |
| 517 | + String createBy = map.containsKey("createBy")?map.get("createBy").toString().trim():""; | |
| 410 | 518 | Integer page = Integer.valueOf(map.containsKey("page")?map.get("page").toString():"0"); |
| 411 | 519 | List<Map<String, Object>> query = new ArrayList<Map<String, Object>>(); |
| 412 | 520 | |
| 413 | - List<Object[]> queryBatch = jdlReceptionRepository.queryBatch(rq); | |
| 521 | + List<Object[]> queryBatch = jdlReceptionRepository.queryBatchByDates(rq1, rq2, createBy); | |
| 414 | 522 | |
| 415 | 523 | try { |
| 416 | 524 | for(Object[] j : queryBatch){ |
| ... | ... | @@ -459,22 +567,23 @@ public class JdlServiceImpl extends BaseServiceImpl<Jdl, Integer> implements Jdl |
| 459 | 567 | public Map<String, Object> updateJdlReceptionBatch(Map<String, Object> map) { |
| 460 | 568 | Map<String, Object> resMap = new HashMap<>(); |
| 461 | 569 | 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[]{}; | |
| 570 | + String[] ids = map.get("ids").toString().length()>0?map.get("ids").toString().split(","):new String[0]; | |
| 571 | + String[] dateStr = map.get("dateStr").toString().length()>0?map.get("dateStr").toString().split(","):new String[0]; | |
| 572 | + String[] pileId = map.get("pileId").toString().length()>0?map.get("pileId").toString().split(","):new String[0]; | |
| 573 | + String[] carCode = map.get("carCode").toString().length()>0?map.get("carCode").toString().split(","):new String[0]; | |
| 574 | + String[] startTime = map.get("startTime").toString().length()>0?map.get("startTime").toString().split(","):new String[0]; | |
| 575 | + String[] endTime = map.get("endTime").toString().length()>0?map.get("endTime").toString().split(","):new String[0]; | |
| 576 | + String[] sumTime = map.get("sumTime").toString().length()>0?map.get("sumTime").toString().split(","):new String[0]; | |
| 577 | + String[] startSoc = map.get("startSoc").toString().length()>0?map.get("startSoc").toString().split(","):new String[0]; | |
| 578 | + String[] endSoc = map.get("endSoc").toString().length()>0?map.get("endSoc").toString().split(","):new String[0]; | |
| 579 | + String[] chargeCapacity = map.get("chargeCapacity").toString().length()>0?map.get("chargeCapacity").toString().split(","):new String[0]; | |
| 580 | + String[] stopReason = map.get("stopReason").toString().length()>0?map.get("stopReason").toString().split(","):new String[0]; | |
| 473 | 581 | List<JdlReception> list = new ArrayList<JdlReception>(); |
| 474 | 582 | for(int i = 0; i < ids.length; i++){ |
| 475 | 583 | if(ids[i].length() != 0){ |
| 476 | - JdlReception jdlRe = new JdlReception(); | |
| 477 | - jdlRe.setId(Long.valueOf(ids[i])); | |
| 584 | +// JdlReception jdlRe = new JdlReception(); | |
| 585 | +// jdlRe.setId(Long.valueOf(ids[i])); | |
| 586 | + JdlReception jdlRe = jdlReceptionRepository.queryById(Long.valueOf(ids[i])).get(0); | |
| 478 | 587 | if(dateStr.length > i) |
| 479 | 588 | jdlRe.setDateStr(dateStr[i]); |
| 480 | 589 | if(pileId.length > i) |
| ... | ... | @@ -558,4 +667,98 @@ public class JdlServiceImpl extends BaseServiceImpl<Jdl, Integer> implements Jdl |
| 558 | 667 | return list; |
| 559 | 668 | } |
| 560 | 669 | |
| 670 | + | |
| 671 | + @Override | |
| 672 | + public List<JdlConnector> queryJdlConnector(Map<String, Object> map) { | |
| 673 | + String connectorName = "", connectorId = "", stationName = ""; | |
| 674 | + if(map.containsKey("connectorName")){ | |
| 675 | + connectorName = map.get("connectorName").toString(); | |
| 676 | + } | |
| 677 | + if(map.containsKey("connectorId")){ | |
| 678 | + connectorId = map.get("connectorId").toString(); | |
| 679 | + } | |
| 680 | + if(map.containsKey("stationName")){ | |
| 681 | + stationName = map.get("stationName").toString(); | |
| 682 | + } | |
| 683 | + return jdlConnectorRepository.query(connectorName, connectorId, stationName); | |
| 684 | + } | |
| 685 | + | |
| 686 | + @Override | |
| 687 | + public JdlConnector queryJdlConnectorById(Integer id) { | |
| 688 | + return jdlConnectorRepository.queryById(id); | |
| 689 | + } | |
| 690 | + | |
| 691 | + @Override | |
| 692 | + public List<String> queryJdlStationName() { | |
| 693 | + List<String> queryStationName = jdlConnectorRepository.queryStationName(); | |
| 694 | + return queryStationName; | |
| 695 | + } | |
| 696 | + | |
| 697 | + @Override | |
| 698 | + public Map<String, Object> addJdlConnector(Map<String, Object> map) { | |
| 699 | + Map<String, Object> resMap = new HashMap<>(); | |
| 700 | + try { | |
| 701 | + JdlConnector jdlConnector = new JdlConnector(); | |
| 702 | + if(map.containsKey("connectorName")){ | |
| 703 | + jdlConnector.setConnectorName(map.get("connectorName").toString()); | |
| 704 | + } | |
| 705 | + if(map.containsKey("connectorId")){ | |
| 706 | + jdlConnector.setConnectorId(map.get("connectorId").toString()); | |
| 707 | + } | |
| 708 | + if(map.containsKey("stationName")){ | |
| 709 | + jdlConnector.setStationName(map.get("stationName").toString()); | |
| 710 | + } | |
| 711 | + jdlConnectorRepository.save(jdlConnector); | |
| 712 | + resMap.put("status", ResponseCode.SUCCESS); | |
| 713 | + } catch (Exception e) { | |
| 714 | + // TODO: handle exception | |
| 715 | + e.printStackTrace(); | |
| 716 | + resMap.put("status", ResponseCode.ERROR); | |
| 717 | + resMap.put("msg", "新建失败,可能缺少关键字段"); | |
| 718 | + } | |
| 719 | + return resMap; | |
| 720 | + } | |
| 721 | + | |
| 722 | + @Override | |
| 723 | + public Map<String, Object> deleteJdlConnector(Map<String, Object> map) { | |
| 724 | + Map<String, Object> resMap = new HashMap<>(); | |
| 725 | + try { | |
| 726 | + Integer id = Integer.valueOf(map.get("id").toString()); | |
| 727 | + jdlConnectorRepository.delete(id); | |
| 728 | + resMap.put("status", ResponseCode.SUCCESS); | |
| 729 | + } catch (Exception e) { | |
| 730 | + // TODO: handle exception | |
| 731 | + e.printStackTrace(); | |
| 732 | + resMap.put("status", ResponseCode.ERROR); | |
| 733 | + resMap.put("msg", "删除失败,可能缺少关键字段"); | |
| 734 | + } | |
| 735 | + return resMap; | |
| 736 | + } | |
| 737 | + | |
| 738 | + @Override | |
| 739 | + public Map<String, Object> updateJdlConnector(Map<String, Object> map) { | |
| 740 | + Map<String, Object> resMap = new HashMap<>(); | |
| 741 | + try { | |
| 742 | + Integer id = Integer.valueOf(map.get("id").toString()); | |
| 743 | + JdlConnector jdlConnector = jdlConnectorRepository.queryById(id); | |
| 744 | + if(map.containsKey("connectorName")){ | |
| 745 | + jdlConnector.setConnectorName(map.get("connectorName").toString()); | |
| 746 | + } | |
| 747 | + if(map.containsKey("connectorId")){ | |
| 748 | + jdlConnector.setConnectorId(map.get("connectorId").toString()); | |
| 749 | + } | |
| 750 | + if(map.containsKey("stationName")){ | |
| 751 | + jdlConnector.setStationName(map.get("stationName").toString()); | |
| 752 | + } | |
| 753 | + jdlConnectorRepository.update(id, jdlConnector.getConnectorName(), jdlConnector.getConnectorId(), jdlConnector.getStationName()); | |
| 754 | + resMap.put("status", ResponseCode.SUCCESS); | |
| 755 | + } catch (Exception e) { | |
| 756 | + // TODO: handle exception | |
| 757 | + e.printStackTrace(); | |
| 758 | + resMap.put("status", ResponseCode.ERROR); | |
| 759 | + resMap.put("msg", "修改失败,可能缺少关键字段"); | |
| 760 | + } | |
| 761 | + return resMap; | |
| 762 | + } | |
| 763 | + | |
| 561 | 764 | } | ... | ... |
src/main/resources/static/pages/electricity/connector/edit.html
0 → 100644
| 1 | +<style type="text/css"> | |
| 2 | + .table-bordered { | |
| 3 | + border: 1px solid; } | |
| 4 | + .table-bordered > thead > tr > th, | |
| 5 | + .table-bordered > thead > tr > td, | |
| 6 | + .table-bordered > tbody > tr > th, | |
| 7 | + .table-bordered > tbody > tr > td, | |
| 8 | + .table-bordered > tfoot > tr > th, | |
| 9 | + .table-bordered > tfoot > tr > td { | |
| 10 | + border: 1px solid; } | |
| 11 | + .table-bordered > thead > tr > th, | |
| 12 | + .table-bordered > thead > tr > td { | |
| 13 | + border-bottom-width: 2px; } | |
| 14 | + | |
| 15 | + .table > tbody + tbody { | |
| 16 | + border-top: 1px solid; } | |
| 17 | + | |
| 18 | + .jdlConnectorValueTd { | |
| 19 | + width: 450px; | |
| 20 | + } | |
| 21 | + .jdlConnectorValueInput { | |
| 22 | + width: 320px; | |
| 23 | + } | |
| 24 | +</style> | |
| 25 | + | |
| 26 | +<div id="jdlConnectorEdit"> | |
| 27 | + <div class="col-md-12"> | |
| 28 | +<!-- <div class="portlet light porttlet-fit bordered"> --> | |
| 29 | + <div class="portlet-body"> | |
| 30 | + <div class="table-container" style="margin-top: 10px;width: 620px;height: 280px;overflow:auto;"> | |
| 31 | + <table class="table table-bordered table-hover table-checkable" id="forms_2"> | |
| 32 | + <thead> | |
| 33 | + </thead> | |
| 34 | + | |
| 35 | + <tbody id="jdlConnector_tbody"> | |
| 36 | + | |
| 37 | + </tbody> | |
| 38 | + </table> | |
| 39 | + </div> | |
| 40 | + </div> | |
| 41 | +<!-- </div> --> | |
| 42 | + </div> | |
| 43 | +</div> | |
| 44 | +<script src="/pages/mforms/singledatas/jquery.table2excel.min.js"></script> | |
| 45 | +<script> | |
| 46 | + $(function(){ | |
| 47 | + // 关闭左侧栏 | |
| 48 | + if (!$('body').hasClass('page-sidebar-closed')) | |
| 49 | + $('.menu-toggler.sidebar-toggler').click(); | |
| 50 | + var date = ""; | |
| 51 | + var nbbm = ""; | |
| 52 | + $("#jdlConnectorEdit").on('init', function (e, id) { | |
| 53 | + type = id.split(",")[1]; // 先取type,防止报错 | |
| 54 | + id = id.split(",")[0]; | |
| 55 | + var i = layer.load(2); | |
| 56 | + if(type == "add"){ | |
| 57 | + var jdlConnectorEditAdd = template('jdlConnector_tbody_add',{obj:{}}); | |
| 58 | + $('#forms_2 tbody').html(jdlConnectorEditAdd); | |
| 59 | + layer.close(i); | |
| 60 | + } else if(type == "upd"){ | |
| 61 | + $get('/jdl/queryJdlConnectorById',{id:id,type:'query'},function(result){ | |
| 62 | + layer.close(i); | |
| 63 | + $.each(result, function(i, e){ | |
| 64 | +// console.log(e); | |
| 65 | + if(e.origin == 1){ | |
| 66 | + e.originName = "导入"; | |
| 67 | + } else { | |
| 68 | + e.originName = "接口"; | |
| 69 | + } | |
| 70 | + }); | |
| 71 | + | |
| 72 | + var jdlConnectorEditUpd = template('jdlConnector_tbody_upd',{obj:result}); | |
| 73 | + $('#forms_2 tbody').html(jdlConnectorEditUpd); | |
| 74 | + }); | |
| 75 | + } | |
| 76 | + }) | |
| 77 | + | |
| 78 | + }); | |
| 79 | + | |
| 80 | + function formatInputNumber(e){ | |
| 81 | + // 获取输入值 | |
| 82 | + var value = e.target.value; | |
| 83 | + var v = value.replace(/[^0-9.]/g, ''); | |
| 84 | + if('\.' == v.charAt(0)){ | |
| 85 | + v = '0' + v; | |
| 86 | + } | |
| 87 | + if(v.indexOf('\.') > 0){ | |
| 88 | + var split = v.split('\.'); | |
| 89 | + if(split[1].length > 0){ | |
| 90 | + v = split[0] + '\.' + (split[1].substring(0, 2)); | |
| 91 | + } else { | |
| 92 | + v = split[0] + '\.0'; | |
| 93 | + } | |
| 94 | + } | |
| 95 | + // 更新输入框的值 | |
| 96 | + e.target.value = v; | |
| 97 | + } | |
| 98 | +</script> | |
| 99 | +<script type="text/html" id="jdlConnector_tbody_add"> | |
| 100 | + <tr> | |
| 101 | + <td>充电枪名称:</td> | |
| 102 | + <td><input type="text" class="jdlConnectorValueInput" name="connectorName"/></td> | |
| 103 | + </tr> | |
| 104 | + <tr> | |
| 105 | + <td>充电枪编号:</td> | |
| 106 | + <td><input type="text" class="jdlConnectorValueInput" name="connectorId"/></td> | |
| 107 | + </tr> | |
| 108 | + <tr> | |
| 109 | + <td>站名:</td> | |
| 110 | + <td><input type="text" class="jdlConnectorValueInput" name="stationName"/></td> | |
| 111 | + </tr> | |
| 112 | +</script> | |
| 113 | +<script type="text/html" id="jdlConnector_tbody_upd"> | |
| 114 | + <tr> | |
| 115 | + <td>充电枪名称:<input type="hidden" name="id" value="{{obj.id}}"/></td> | |
| 116 | + <td class="jdlConnectorValueTd"> | |
| 117 | + <input type="text" class="jdlConnectorValueInput" name="connectorName" value="{{obj.connectorName}}"/> | |
| 118 | + </td> | |
| 119 | + </tr> | |
| 120 | + <tr> | |
| 121 | + <td>充电枪编号:</td> | |
| 122 | + <td class="jdlConnectorValueTd"> | |
| 123 | + <input type="text" class="jdlConnectorValueInput" name="connectorId" value="{{obj.connectorId}}"/> | |
| 124 | + </td> | |
| 125 | + </tr> | |
| 126 | + <tr> | |
| 127 | + <td>站名:</td> | |
| 128 | + <td class="jdlConnectorValueTd"> | |
| 129 | + <input type="text" class="jdlConnectorValueInput" name="stationName" value="{{obj.stationName}}"/> | |
| 130 | + </td> | |
| 131 | + </tr> | |
| 132 | +</script> | |
| 0 | 133 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/electricity/connector/list.html
0 → 100644
| 1 | +<style> | |
| 2 | +.blue{ | |
| 3 | + background-color: #87CEFF | |
| 4 | +} | |
| 5 | +</style> | |
| 6 | +<div class="page-head"> | |
| 7 | + <div class="page-title"> | |
| 8 | + <h1>充电枪自编号</h1> | |
| 9 | + </div> | |
| 10 | +</div> | |
| 11 | +<ul class="page-breadcrumb breadcrumb"> | |
| 12 | + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> | |
| 13 | + <li><span class="active">能耗管理</span> <i class="fa fa-circle"></i></li> | |
| 14 | + <li><span class="active">充电枪自编号</span></li> | |
| 15 | +</ul> | |
| 16 | + | |
| 17 | +<div class="row" id="jdlConnector_list"> | |
| 18 | + <div class="col-md-12"> | |
| 19 | + <!-- Begin: life time stats --> | |
| 20 | + <div class="portlet light portlet-fit portlet-datatable bordered"> | |
| 21 | + <div class="portlet-title"> | |
| 22 | + <div class="caption"> | |
| 23 | + <i class="fa fa-fire-extinguisher"></i> <span | |
| 24 | + class="caption-subject font-dark sbold uppercase">充电枪自编号</span> | |
| 25 | + </div> | |
| 26 | + <div class="actions"> | |
| 27 | + <div class="btn-group btn-group-devided btn-Connector-add" data-toggle="buttons"> | |
| 28 | + <a class="btn btn-circle blue"><i class="fa fa-plus"></i> 新建充电枪</a> | |
| 29 | + </div> | |
| 30 | + </div> | |
| 31 | + </div> | |
| 32 | + <div class="portlet-body"> | |
| 33 | + <div class="table-container" style="margin-top: 0px"> | |
| 34 | + <table | |
| 35 | + class="table table-striped table-bordered table-hover table-checkable" | |
| 36 | + id="datatable_dlb"> | |
| 37 | + <thead> | |
| 38 | + <tr role="row" class="filter"> | |
| 39 | + <td colspan="1">充电枪名称:</td> | |
| 40 | + <td colspan="2"> | |
| 41 | + <input type="text" style="width: 160px" name="connectorName" id="connectorName"/> | |
| 42 | + </td> | |
| 43 | + <td colspan="1">充电枪编号:</td> | |
| 44 | + <td colspan="1"> | |
| 45 | + <input type="text" style="width: 160px" name="connectorId" id="connectorId"/> | |
| 46 | + </td> | |
| 47 | + <td colspan="1">充电站:</td> | |
| 48 | + <td colspan="1"> | |
| 49 | + <input type="text" style="width: 160px" name="stationName" id="stationName"/> | |
| 50 | + </td> | |
| 51 | + <td width="16%"> | |
| 52 | + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right:0px"> | |
| 53 | + <i class="fa fa-search"></i> 搜索 | |
| 54 | + </button> | |
| 55 | + <button class="btn btn-sm red btn-outline filter-cancel" style="margin-right:0px"> | |
| 56 | + <i class="fa fa-times"></i> 重置 | |
| 57 | + </button> | |
| 58 | + </td> | |
| 59 | + </tr> | |
| 60 | + <tr role="row" class="heading"> | |
| 61 | + <th>#</th> | |
| 62 | + <th colspan="2">充电枪名称</th> | |
| 63 | + <th colspan="2">充电枪编号</th> | |
| 64 | + <th colspan="2">充电站</th> | |
| 65 | + <td colspan="1">操作</td> | |
| 66 | + </tr> | |
| 67 | + </thead> | |
| 68 | + <tbody></tbody> | |
| 69 | + </table> | |
| 70 | + <div style="text-align: right;"> | |
| 71 | + <ul id="pagination" class="pagination"></ul> | |
| 72 | + </div> | |
| 73 | + </div> | |
| 74 | + </div> | |
| 75 | + <div class="portlet-body"> | |
| 76 | + <div id="modules_tree"></div> | |
| 77 | + </div> | |
| 78 | + </div> | |
| 79 | + </div> | |
| 80 | +</div> | |
| 81 | + | |
| 82 | + | |
| 83 | +<script src="/assets/js/ajaxfileupload/ajaxfileupload.js"></script> | |
| 84 | +<script> | |
| 85 | + $(function () { | |
| 86 | + | |
| 87 | + // 关闭左侧栏 | |
| 88 | + if (!$('body').hasClass('page-sidebar-closed')) | |
| 89 | + $('.menu-toggler.sidebar-toggler').click(); | |
| 90 | + | |
| 91 | + $("#rq").datetimepicker({ | |
| 92 | + format: 'YYYY-MM-DD', | |
| 93 | + locale: 'zh-cn' | |
| 94 | + }); | |
| 95 | + var d = new Date(); | |
| 96 | +// d.setTime(d.getTime() - 1*1000*60*60*24); | |
| 97 | + d.setTime(d.getTime()); | |
| 98 | + var year = d.getFullYear(); | |
| 99 | + var month = d.getMonth() + 1; | |
| 100 | + var day = d.getDate(); | |
| 101 | + if(month < 10) | |
| 102 | + month = "0" + month; | |
| 103 | + if(day < 10) | |
| 104 | + day = "0" + day; | |
| 105 | + $("#rq").val(year + "-" + month + "-" + day); | |
| 106 | + | |
| 107 | + var page = 0, initPagination; | |
| 108 | + var icheckOptions = { | |
| 109 | + radioClass: 'iradio_square-blue icheck', | |
| 110 | + increaseArea: '20%' | |
| 111 | + } | |
| 112 | + | |
| 113 | + //重置 | |
| 114 | + $('tr.filter .filter-cancel').on('click', function () { | |
| 115 | + $('tr.filter input, select').val('').change(); | |
| 116 | + }); | |
| 117 | + | |
| 118 | + //提交 | |
| 119 | + $('tr.filter .filter-submit').on('click', function () { | |
| 120 | + | |
| 121 | + var params = getParams(); | |
| 122 | + | |
| 123 | + page = 0; | |
| 124 | + jsDoQuery(params, true); | |
| 125 | + }); | |
| 126 | + | |
| 127 | + | |
| 128 | + $.get('/user/companyData', function(result){ | |
| 129 | + obj = result; | |
| 130 | + var options=""; | |
| 131 | +// = '<option value="">请选择</option>'; | |
| 132 | + for(var i = 0; i < obj.length; i++){ | |
| 133 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | |
| 134 | +// setFgsqx(obj[i].companyCode); | |
| 135 | + } | |
| 136 | + $('#gsbm').html(options); | |
| 137 | + updateCompany(); | |
| 138 | + }); | |
| 139 | + | |
| 140 | + $("#gsbm").on("change",updateCompany); | |
| 141 | + function updateCompany(){ | |
| 142 | + var company = $('#gsbm').val(); | |
| 143 | + var options =""; | |
| 144 | +// = '<option value="">请选择</option>'; | |
| 145 | + for(var i = 0; i < obj.length; i++){ | |
| 146 | + if(obj[i].companyCode == company){ | |
| 147 | + var children = obj[i].children; | |
| 148 | + for(var j = 0; j < children.length; j++){ | |
| 149 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | |
| 150 | + } | |
| 151 | + } | |
| 152 | + } | |
| 153 | + $('#fgsbm').html(options); | |
| 154 | + } | |
| 155 | + /* | |
| 156 | + * 获取数据 p: 要提交的参数, pagination: 是否重新分页 | |
| 157 | + */ | |
| 158 | + function jsDoQuery(p, pagination) { | |
| 159 | + var params = {}; | |
| 160 | + if (p) | |
| 161 | + params = p; | |
| 162 | + params['page'] = page; | |
| 163 | + params['connectorName'] = $("#connectorName").val(); | |
| 164 | + params['connectorId'] = $("#connectorId").val(); | |
| 165 | + params['stationName'] = $("#stationName").val(); | |
| 166 | + | |
| 167 | + var j = layer.load(2); | |
| 168 | + $get('/jdl/queryJdlConnector', params, function (data) { | |
| 169 | + var bodyHtml = template('jdlConnectorList', {list:data}); | |
| 170 | + $('#datatable_dlb tbody').html(bodyHtml); | |
| 171 | + | |
| 172 | + layer.close(j); | |
| 173 | + | |
| 174 | + $('.btn-Connector-upd').on('click', openConnectoraUpd); | |
| 175 | + $('.btn-Connector-del').on('click', openReceptionBatchDataDel); | |
| 176 | + }); | |
| 177 | + } | |
| 178 | + | |
| 179 | + $('.btn-Connector-add').on('click', function(){ | |
| 180 | + $.get('/pages/electricity/connector/edit.html', function (content) { | |
| 181 | + layer.open({ | |
| 182 | + type: 1, | |
| 183 | + area: ['650px', '400px'], | |
| 184 | + content: content, | |
| 185 | + title: '新建充电枪', | |
| 186 | + shift: 5, | |
| 187 | + scrollbar: false, | |
| 188 | + success: function () { | |
| 189 | + $('#jdlConnectorEdit').trigger('init', "0,add"); | |
| 190 | + }, | |
| 191 | + btn:["保存", "取消"], | |
| 192 | + btn1: function(index, layero){ | |
| 193 | + layer.msg('操作中...', {icon: 16, shade: 0.31}); | |
| 194 | + var connectorName = "", connectorId = "", stationName = ""; | |
| 195 | + $('#jdlConnector_tbody input').each(function(i, e){ | |
| 196 | + var obj = $(e); | |
| 197 | + if("connectorName" == obj.attr("name")){ | |
| 198 | + connectorName = obj.val(); | |
| 199 | + } else if("connectorId" == obj.attr("name")){ | |
| 200 | + connectorId = obj.val(); | |
| 201 | + } else if("stationName" == obj.attr("name")){ | |
| 202 | + stationName = obj.val(); | |
| 203 | + } | |
| 204 | + }); | |
| 205 | + if(connectorName == null || connectorName.trim().length == 0 | |
| 206 | + || connectorId == null || connectorId.trim().length == 0 | |
| 207 | + || stationName == null || stationName.trim().length == 0){ | |
| 208 | + layer.msg("请填写充电枪名称、编号、充电站信息"); | |
| 209 | + return; | |
| 210 | + } | |
| 211 | + $get('/jdl/queryJdlConnector',{connectorId:connectorId,type:'query'},function(result){ | |
| 212 | + if(result.length > 0){ | |
| 213 | + layer.msg("充电枪编号已被使用,请重新输入编号"); | |
| 214 | + } else { | |
| 215 | + $post('/jdl/addJdlConnector', {connectorName:connectorName,connectorId:connectorId,stationName:stationName}, function (rs) { | |
| 216 | + if(rs.status && rs.status == "SUCCESS"){ | |
| 217 | + layer.msg('新建成功。'); | |
| 218 | + $('.filter-submit.margin-bottom').trigger('click'); | |
| 219 | + layer.close(index); | |
| 220 | + } else { | |
| 221 | + layer.msg(rs.msg); | |
| 222 | + } | |
| 223 | + }); | |
| 224 | + } | |
| 225 | + }); | |
| 226 | + | |
| 227 | + } | |
| 228 | + }); | |
| 229 | + }); | |
| 230 | + }); | |
| 231 | + | |
| 232 | + function openConnectoraUpd(){ | |
| 233 | + var id = $(this).data('id'); | |
| 234 | + id += ",upd"; | |
| 235 | + $.get('/pages/electricity/connector/edit.html', function (content) { | |
| 236 | + layer.open({ | |
| 237 | + type: 1, | |
| 238 | + area: ['650px', '400px'], | |
| 239 | + content: content, | |
| 240 | + title: '充电枪修改', | |
| 241 | + shift: 5, | |
| 242 | + scrollbar: false, | |
| 243 | + success: function () { | |
| 244 | + $('#jdlConnectorEdit').trigger('init', id); | |
| 245 | + }, | |
| 246 | + btn:["保存", "取消"], | |
| 247 | + btn1: function(index, layero){ | |
| 248 | + layer.msg('操作中...', {icon: 16, shade: 0.31}); | |
| 249 | + var id = "", connectorName = "", connectorId = "", stationName = ""; | |
| 250 | + $('#jdlConnector_tbody input').each(function(i, e){ | |
| 251 | + var obj = $(e); | |
| 252 | + if("id" == obj.attr("name")){ | |
| 253 | + id = obj.val(); | |
| 254 | + } else if("connectorName" == obj.attr("name")){ | |
| 255 | + connectorName = obj.val(); | |
| 256 | + } else if("connectorId" == obj.attr("name")){ | |
| 257 | + connectorId = obj.val(); | |
| 258 | + } else if("stationName" == obj.attr("name")){ | |
| 259 | + stationName = obj.val(); | |
| 260 | + } | |
| 261 | + }); | |
| 262 | + if(connectorName == null || connectorName.trim().length == 0 | |
| 263 | + || connectorId == null || connectorId.trim().length == 0 | |
| 264 | + || stationName == null || stationName.trim().length == 0){ | |
| 265 | + layer.msg("请填写充电枪名称、编号、充电站信息"); | |
| 266 | + return; | |
| 267 | + } | |
| 268 | + $get('/jdl/queryJdlConnector',{connectorId:connectorId,type:'query'},function(result){ | |
| 269 | + if(result.length > 0){ | |
| 270 | + layer.msg("充电枪编号已被使用,请重新输入编号"); | |
| 271 | + } else { | |
| 272 | + $post('/jdl/updateJdlConnector', {id:id,connectorName:connectorName,connectorId:connectorId,stationName:stationName}, function (rs) { | |
| 273 | + if(rs.status && rs.status == "SUCCESS"){ | |
| 274 | + layer.msg('修改成功。'); | |
| 275 | + $('.filter-submit.margin-bottom').trigger('click'); | |
| 276 | + layer.close(index); | |
| 277 | + } else { | |
| 278 | + layer.msg(rs.msg); | |
| 279 | + } | |
| 280 | + }); | |
| 281 | + } | |
| 282 | + }); | |
| 283 | + | |
| 284 | + } | |
| 285 | + }); | |
| 286 | + }); | |
| 287 | + } | |
| 288 | + | |
| 289 | + function openReceptionBatchDataDel(){ | |
| 290 | + var id = $(this).data('id'); | |
| 291 | + layer.confirm('你确定要删除充电量吗?', { | |
| 292 | + btn: ['确定删除','取消'] //按钮 | |
| 293 | + }, function(){ | |
| 294 | + layer.msg('操作中...', {icon: 16,shade: 0.01}); | |
| 295 | + $post('/jdl/deleteJdlConnector', {id:id}, function (rs) { | |
| 296 | + layer.msg('删除成功!'); | |
| 297 | + $('.filter-submit.margin-bottom').trigger('click'); | |
| 298 | + }); | |
| 299 | + }); | |
| 300 | + } | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + function getParams(){ | |
| 305 | + var cells = $('tr.filter')[0].cells | |
| 306 | + , params = {} | |
| 307 | + , name; | |
| 308 | + $.each(cells, function (i, cell) { | |
| 309 | + var items = $('input,select', cell); | |
| 310 | + for (var j = 0, item; item = items[j++];) { | |
| 311 | + name = $(item).attr('name'); | |
| 312 | + if (name) { | |
| 313 | + params[name] = $(item).val(); | |
| 314 | + } | |
| 315 | + } | |
| 316 | + }); | |
| 317 | + return params; | |
| 318 | + }; | |
| 319 | + | |
| 320 | + }); | |
| 321 | + | |
| 322 | +</script> | |
| 323 | + | |
| 324 | +<script id="jdlConnectorList" type="text/html"> | |
| 325 | + {{each list as obj i}} | |
| 326 | + <tr> | |
| 327 | + <td style="vertical-align: middle;"> | |
| 328 | + {{i + 1}} | |
| 329 | + </td> | |
| 330 | + <td colspan="2">{{obj.connectorName}}</td> | |
| 331 | + <td colspan="2">{{obj.connectorId}}</td> | |
| 332 | + <td colspan="2">{{obj.stationName}}</td> | |
| 333 | + <td colspan="1"> | |
| 334 | + <button class="btn blue-madison btn-sm btn-Connector-upd" data-id="{{obj.id}}"> | |
| 335 | + <i class="fa fa-pencil"></i> 修改 | |
| 336 | + </button> | |
| 337 | + <button class="btn btn-danger btn-sm red btn-Connector-del" data-id="{{obj.id}}"> | |
| 338 | + <i class="fa fa-times"></i> 删除 | |
| 339 | + </button> | |
| 340 | + </td> | |
| 341 | + </tr> | |
| 342 | + {{/each}} | |
| 343 | + {{if list.length == 0}} | |
| 344 | + <tr> | |
| 345 | + <td colspan=8><h6 class="muted">没有找到相关数据</h6></td> | |
| 346 | + </tr> | |
| 347 | + {{/if}} | |
| 348 | +</script> | |
| 0 | 349 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/electricity/jdl/jdlReception.html
| ... | ... | @@ -31,7 +31,6 @@ |
| 31 | 31 | <thead> |
| 32 | 32 | <tr> |
| 33 | 33 | <td style="min-width: 170px">批次号</td> |
| 34 | - <td style="min-width: 80px">桩号</td> | |
| 35 | 34 | <td style="min-width: 170px">枪号</td> |
| 36 | 35 | <td>车号</td> |
| 37 | 36 | <td>开始时间</td> |
| ... | ... | @@ -100,7 +99,6 @@ |
| 100 | 99 | {{each list as obj i}} |
| 101 | 100 | <tr> |
| 102 | 101 | <td>{{obj.batchNo}}</td> |
| 103 | - <td>{{obj.pileId}}</td> | |
| 104 | 102 | <td>{{obj.connectorId}}</td> |
| 105 | 103 | <td>{{obj.carCode}}</td> |
| 106 | 104 | <td>{{obj.startTime}}</td> | ... | ... |
src/main/resources/static/pages/electricity/jdl/jdlReceptionBatch.html
| ... | ... | @@ -21,7 +21,7 @@ |
| 21 | 21 | <div class="portlet-title"> |
| 22 | 22 | <div class="caption"> |
| 23 | 23 | <i class="fa fa-fire-extinguisher"></i> <span |
| 24 | - class="caption-subject font-dark sbold uppercase">车辆充电量</span> | |
| 24 | + class="caption-subject font-dark sbold uppercase">充电量导入批次</span> | |
| 25 | 25 | </div> |
| 26 | 26 | <!-- <div class="actions"> --> |
| 27 | 27 | <!-- <button type="button" class="btn btn-circle blue" id="upload"><i class="fa fa-file-excel-o"></i> --> |
| ... | ... | @@ -39,9 +39,13 @@ |
| 39 | 39 | id="datatable_dlb"> |
| 40 | 40 | <thead> |
| 41 | 41 | <tr role="row" class="filter"> |
| 42 | - <td colspan="2">日期:</td> | |
| 43 | - <td colspan="2" width="120px"> | |
| 44 | - <input type="text" style="width: 100px" name="rq" id="rq"/> | |
| 42 | + <td colspan="2">日期区间: | |
| 43 | + <input type="text" style="width: 100px" name="rq1" id="rq1"/> | |
| 44 | + - | |
| 45 | + <input type="text" style="width: 100px" name="rq2" id="rq2"/> | |
| 46 | + </td> | |
| 47 | + <td colspan="2" width="120px">处理人: | |
| 48 | + <input type="text" style="width: 100px" name="createBy" id="createBy"/> | |
| 45 | 49 | </td> |
| 46 | 50 | <td width="24%"> |
| 47 | 51 | <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right:0px"> |
| ... | ... | @@ -83,10 +87,14 @@ |
| 83 | 87 | if (!$('body').hasClass('page-sidebar-closed')) |
| 84 | 88 | $('.menu-toggler.sidebar-toggler').click(); |
| 85 | 89 | |
| 86 | - $("#rq").datetimepicker({ | |
| 90 | + $("#rq1").datetimepicker({ | |
| 87 | 91 | format: 'YYYY-MM-DD', |
| 88 | 92 | locale: 'zh-cn' |
| 89 | 93 | }); |
| 94 | + $("#rq2").datetimepicker({ | |
| 95 | + format: 'YYYY-MM-DD', | |
| 96 | + locale: 'zh-cn' | |
| 97 | + }); | |
| 90 | 98 | var d = new Date(); |
| 91 | 99 | // d.setTime(d.getTime() - 1*1000*60*60*24); |
| 92 | 100 | d.setTime(d.getTime()); |
| ... | ... | @@ -97,7 +105,8 @@ |
| 97 | 105 | month = "0" + month; |
| 98 | 106 | if(day < 10) |
| 99 | 107 | day = "0" + day; |
| 100 | - $("#rq").val(year + "-" + month + "-" + day); | |
| 108 | + $("#rq1").val(year + "-" + month + "-" + day); | |
| 109 | + $("#rq2").val(year + "-" + month + "-" + day); | |
| 101 | 110 | |
| 102 | 111 | var page = 0, initPagination; |
| 103 | 112 | var icheckOptions = { |
| ... | ... | @@ -112,7 +121,8 @@ |
| 112 | 121 | |
| 113 | 122 | //提交 |
| 114 | 123 | $('tr.filter .filter-submit').on('click', function () { |
| 115 | - if ($("#rq").val() == "" || $("#rq").val() ==null){ | |
| 124 | + if ($("#rq1").val() == "" || $("#rq1").val() ==null | |
| 125 | + || $("#rq2").val() == "" || $("#rq2").val() ==null){ | |
| 116 | 126 | layer.msg('请选择日期.'); |
| 117 | 127 | }else { |
| 118 | 128 | |
| ... | ... | @@ -160,7 +170,8 @@ |
| 160 | 170 | params = p; |
| 161 | 171 | params['order'] = 'nbbm'; |
| 162 | 172 | params['page'] = page; |
| 163 | - params['rq'] = $("#rq").val(); | |
| 173 | + params['rq1'] = $("#rq1").val(); | |
| 174 | + params['rq2'] = $("#rq2").val(); | |
| 164 | 175 | |
| 165 | 176 | var j = layer.load(2); |
| 166 | 177 | $get('/jdl/queryJdlReceptionBatch', params, function (data) { |
| ... | ... | @@ -229,9 +240,6 @@ |
| 229 | 240 | btn:["保存", "取消"], |
| 230 | 241 | btn1: function(index, layero){ |
| 231 | 242 | 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 | 243 | var ids = "", dateStr = "", pileId = "", carCode = "", startTime = "", endTime = "", sumTime = "", |
| 236 | 244 | startSoc = "", endSoc = "", chargeCapacity = "", stopReason = ""; |
| 237 | 245 | $('#jdlReceptionBatchData_tbody input').each(function(i, e){ | ... | ... |
src/main/resources/static/pages/electricity/jdl/jdlReceptionBatchData.html
| ... | ... | @@ -26,7 +26,9 @@ |
| 26 | 26 | <tr> |
| 27 | 27 | <td style="min-width: 170px">批次号</td> |
| 28 | 28 | <td style="min-width: 90px">营运日期</td> |
| 29 | - <td style="min-width: 80px">桩号</td> | |
| 29 | + <td style="min-width: 80px">枪名</td> | |
| 30 | + <td style="min-width: 80px">枪号</td> | |
| 31 | + <td style="min-width: 80px">充电站</td> | |
| 30 | 32 | <td>车号</td> |
| 31 | 33 | <td>开始时间</td> |
| 32 | 34 | <td>结束时间</td> |
| ... | ... | @@ -73,25 +75,46 @@ |
| 73 | 75 | if(type == "upd"){ |
| 74 | 76 | var jdlReceptionBatchDataUpd = template('jdlReceptionBatchData_tbody_upd',{list:result}); |
| 75 | 77 | $('#forms_2 tbody').html(jdlReceptionBatchDataUpd); |
| 76 | - $("input[name=dateStr]").datetimepicker({ | |
| 77 | - format: 'YYYY-MM-DD', | |
| 78 | - locale: 'zh-cn' | |
| 79 | - }); | |
| 78 | +// $("input[name=dateStr]").datetimepicker({ | |
| 79 | +// format: 'YYYY-MM-DD', | |
| 80 | +// locale: 'zh-cn' | |
| 81 | +// }); | |
| 80 | 82 | } else { |
| 81 | - var jdlReceptionBatchData = template('jdlReceptionBatchData_tbody',{list:result}); | |
| 82 | - $('#forms_2 tbody').html(jdlReceptionBatchData); | |
| 83 | + var jdlReceptionBatchDataView = template('jdlReceptionBatchData_tbody_view',{list:result}); | |
| 84 | + $('#forms_2 tbody').html(jdlReceptionBatchDataView); | |
| 83 | 85 | } |
| 84 | 86 | }); |
| 85 | 87 | }) |
| 86 | 88 | |
| 87 | 89 | }); |
| 90 | + | |
| 91 | + function formatInputNumber(e){ | |
| 92 | + // 获取输入值 | |
| 93 | + var value = e.target.value; | |
| 94 | + var v = value.replace(/[^0-9.]/g, ''); | |
| 95 | + if('\.' == v.charAt(0)){ | |
| 96 | + v = '0' + v; | |
| 97 | + } | |
| 98 | + if(v.indexOf('\.') > 0){ | |
| 99 | + var split = v.split('\.'); | |
| 100 | + if(split[1].length > 0){ | |
| 101 | + v = split[0] + '\.' + (split[1].substring(0, 2)); | |
| 102 | + } else { | |
| 103 | + v = split[0] + '\.0'; | |
| 104 | + } | |
| 105 | + } | |
| 106 | + // 更新输入框的值 | |
| 107 | + e.target.value = v; | |
| 108 | + } | |
| 88 | 109 | </script> |
| 89 | -<script type="text/html" id="jdlReceptionBatchData_tbody"> | |
| 110 | +<script type="text/html" id="jdlReceptionBatchData_tbody_view"> | |
| 90 | 111 | {{each list as obj i}} |
| 91 | 112 | <tr> |
| 92 | 113 | <td>{{obj.batchNo}}</td> |
| 93 | 114 | <td>{{obj.dateStr}}</td> |
| 94 | - <td>{{obj.pileId}}</td> | |
| 115 | + <td>{{obj.connectorName}}</td> | |
| 116 | + <td>{{obj.connectorId}}</td> | |
| 117 | + <td>{{obj.stationName}}</td> | |
| 95 | 118 | <td>{{obj.carCode}}</td> |
| 96 | 119 | <td>{{obj.startTime}}</td> |
| 97 | 120 | <td>{{obj.endTime}}</td> |
| ... | ... | @@ -99,12 +122,11 @@ |
| 99 | 122 | <td>{{obj.startSoc}}</td> |
| 100 | 123 | <td>{{obj.endSoc}}</td> |
| 101 | 124 | <td>{{obj.chargeCapacity}}</td> |
| 102 | - <!-- <td>{{obj.stopReason}}</td> --> | |
| 103 | 125 | </tr> |
| 104 | 126 | {{/each}} |
| 105 | 127 | {{if list.length == 0}} |
| 106 | 128 | <tr> |
| 107 | - <td colspan="11"><h6 class="muted">没有找到相关数据</h6></td> | |
| 129 | + <td colspan="12"><h6 class="muted">没有找到相关数据</h6></td> | |
| 108 | 130 | </tr> |
| 109 | 131 | {{/if}} |
| 110 | 132 | </script> |
| ... | ... | @@ -112,21 +134,22 @@ |
| 112 | 134 | {{each list as obj i}} |
| 113 | 135 | <tr> |
| 114 | 136 | <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> --> | |
| 137 | + <td>{{obj.dateStr}}</td> | |
| 138 | + <td>{{obj.connectorName}}</td> | |
| 139 | + <td>{{obj.connectorId}}</td> | |
| 140 | + <td>{{obj.stationName}}</td> | |
| 141 | + <td>{{obj.carCode}}</td> | |
| 142 | + <td>{{obj.startTime}}</td> | |
| 143 | + <td>{{obj.endTime}}</td> | |
| 144 | + <td>{{obj.sumTime}}</td> | |
| 145 | + <td>{{obj.startSoc}}</td> | |
| 146 | + <td>{{obj.endSoc}}</td> | |
| 147 | + <td><input type="text" name="chargeCapacity" value="{{obj.chargeCapacity}}" oninput="formatInputNumber(event)"/></td> | |
| 125 | 148 | </tr> |
| 126 | 149 | {{/each}} |
| 127 | 150 | {{if list.length == 0}} |
| 128 | 151 | <tr> |
| 129 | - <td colspan="11"><h6 class="muted">没有找到相关数据</h6></td> | |
| 152 | + <td colspan="12"><h6 class="muted">没有找到相关数据</h6></td> | |
| 130 | 153 | </tr> |
| 131 | 154 | {{/if}} |
| 132 | 155 | </script> |
| 133 | 156 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/electricity/jdl/upload_2412.html
| ... | ... | @@ -17,6 +17,12 @@ |
| 17 | 17 | </div> |
| 18 | 18 | <div class="form-body"> |
| 19 | 19 | <div class="form-group"> |
| 20 | + <div class="col-md-12"> | |
| 21 | + <label class="col-md-3 control-label">充电站:</label> | |
| 22 | + <select name="stationName" id="stationName_"> | |
| 23 | + </select> | |
| 24 | + </div> | |
| 25 | + <div style="margin-top: 50px;width: 100%;height: 1px;"></div> | |
| 20 | 26 | <label class="col-md-3 control-label">选择文件</label> |
| 21 | 27 | <div class="col-md-9"> |
| 22 | 28 | <input type="file" name="file" id="file" |
| ... | ... | @@ -53,6 +59,14 @@ |
| 53 | 59 | $('#fgsbm_').val('-1'); |
| 54 | 60 | $('#fgsName').val('全部车队'); |
| 55 | 61 | |
| 62 | + $get('/jdl/queryJdlStationName', {}, function(array){ | |
| 63 | + var text = ''; | |
| 64 | + $.each(array, function(i, e){ | |
| 65 | + text += '<option value="'+e+'">'+e+'</option>'; | |
| 66 | + }); | |
| 67 | + $('#stationName_').html(text); | |
| 68 | + }); | |
| 69 | + | |
| 56 | 70 | //modal 显示事件 |
| 57 | 71 | $('#uploadFile').on('show.bs.modal', function(){ |
| 58 | 72 | }) |
| ... | ... | @@ -66,6 +80,8 @@ |
| 66 | 80 | param["gsName"] = $('#gsName').val(); |
| 67 | 81 | param["fgsbm_"] = $('#fgsbm_').val(); |
| 68 | 82 | param["fgsName"] = $('#fgsName').val(); |
| 83 | + var stationName = $('#stationName_').val(); | |
| 84 | + param["stationName"] = stationName; | |
| 69 | 85 | $.ajaxFileUpload({ |
| 70 | 86 | url : '/jdl/uploadFile_2412', |
| 71 | 87 | secureuri : false, | ... | ... |