Commit 1c34f2f7e1ea7f4cded09b81164995caa5a5b472
1 parent
878dd614
Update
Showing
8 changed files
with
53 additions
and
146 deletions
Too many changes to show.
To preserve performance only 8 of 11 files are displayed.
src/main/java/com/bsth/controller/schedule/RerunController.java deleted
100644 → 0
| 1 | -package com.bsth.controller.schedule; | |
| 2 | - | |
| 3 | -import com.bsth.controller.BaseController; | |
| 4 | -import com.bsth.entity.schedule.rule.RerunRule; | |
| 5 | -import com.bsth.repository.schedule.RerunRuleRepository; | |
| 6 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | -import org.springframework.web.bind.annotation.*; | |
| 8 | - | |
| 9 | -import java.util.Map; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * Created by xu on 16/10/20. | |
| 13 | - */ | |
| 14 | -@RestController | |
| 15 | -@RequestMapping("rms") | |
| 16 | -public class RerunController extends BaseController<RerunRule, Long> { | |
| 17 | - | |
| 18 | - @Autowired | |
| 19 | - private RerunRuleRepository rerunRuleRepository; | |
| 20 | - | |
| 21 | - @Override | |
| 22 | - public RerunRule findById(@PathVariable("id") Long aLong) { | |
| 23 | - return rerunRuleRepository.findOneExtend(aLong); | |
| 24 | - } | |
| 25 | - | |
| 26 | - /** | |
| 27 | - * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody | |
| 28 | - * @Title: save | |
| 29 | - * @Description: TODO(持久化对象) | |
| 30 | - * @param @param t | |
| 31 | - * @param @return 设定文件 | |
| 32 | - * @return Map<String,Object> {status: 1(成功),-1(失败)} | |
| 33 | - * @throws | |
| 34 | - */ | |
| 35 | - @RequestMapping(method = RequestMethod.POST) | |
| 36 | - public Map<String, Object> save(@RequestBody RerunRule t){ | |
| 37 | - return baseService.save(t); | |
| 38 | - } | |
| 39 | - | |
| 40 | - | |
| 41 | -} |
src/main/java/com/bsth/controller/schedule/TTInfoDetailController.java
| ... | ... | @@ -113,6 +113,9 @@ public class TTInfoDetailController extends BaseController2<TTInfoDetail, Long> |
| 113 | 113 | p1.put("stationName_eq", cell_con.trim()); |
| 114 | 114 | p1.put("stationMark_eq", "B"); |
| 115 | 115 | |
| 116 | + | |
| 117 | + // TODO:这里要修改(起点站有启用撤销的标志的) | |
| 118 | + | |
| 116 | 119 | List<StationRoute> stationRouteList = (List<StationRoute>) stationRouteService.list(p1); |
| 117 | 120 | if (CollectionUtils.isEmpty(stationRouteList)) { |
| 118 | 121 | rtn.put("status", ResponseCode.ERROR); | ... | ... |
src/main/java/com/bsth/controller/schedule/core/RerunController.java
0 → 100644
| 1 | +package com.bsth.controller.schedule.core; | |
| 2 | + | |
| 3 | +import com.bsth.controller.schedule.BController; | |
| 4 | +import com.bsth.entity.schedule.rule.RerunRule; | |
| 5 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 6 | +import org.springframework.web.bind.annotation.RestController; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * Created by xu on 16/10/20. | |
| 10 | + */ | |
| 11 | +@RestController | |
| 12 | +@RequestMapping("rms") | |
| 13 | +public class RerunController extends BController<RerunRule, Long> { | |
| 14 | + | |
| 15 | + | |
| 16 | +} | ... | ... |
src/main/java/com/bsth/entity/schedule/rule/RerunRule.java
| 1 | 1 | package com.bsth.entity.schedule.rule; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.Line; |
| 4 | -import com.bsth.entity.schedule.CarConfigInfo; | |
| 5 | -import com.bsth.entity.schedule.EmployeeConfigInfo; | |
| 6 | -import com.bsth.entity.schedule.GuideboardInfo; | |
| 7 | -import com.bsth.entity.schedule.TTInfo; | |
| 8 | -import com.bsth.entity.sys.SysUser; | |
| 4 | +import com.bsth.entity.schedule.*; | |
| 9 | 5 | |
| 10 | 6 | import javax.persistence.*; |
| 11 | -import java.util.Date; | |
| 12 | 7 | |
| 13 | 8 | /** |
| 14 | 9 | * 套跑规则。 |
| ... | ... | @@ -41,7 +36,7 @@ import java.util.Date; |
| 41 | 36 | }) |
| 42 | 37 | |
| 43 | 38 | |
| 44 | -public class RerunRule { | |
| 39 | +public class RerunRule extends BEntity { | |
| 45 | 40 | /** 主键Id */ |
| 46 | 41 | @Id |
| 47 | 42 | @GeneratedValue |
| ... | ... | @@ -84,19 +79,6 @@ public class RerunRule { |
| 84 | 79 | @Column(nullable = false) |
| 85 | 80 | private Boolean isCancel = false; |
| 86 | 81 | |
| 87 | - /** 创建人 */ | |
| 88 | - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY) | |
| 89 | - private SysUser createBy; | |
| 90 | - /** 修改人 */ | |
| 91 | - @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY) | |
| 92 | - private SysUser updateBy; | |
| 93 | - /** 创建日期 */ | |
| 94 | - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | |
| 95 | - private Date createDate; | |
| 96 | - /** 修改日期 */ | |
| 97 | - @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | |
| 98 | - private Date updateDate; | |
| 99 | - | |
| 100 | 82 | public Long getId() { |
| 101 | 83 | return id; |
| 102 | 84 | } |
| ... | ... | @@ -177,34 +159,6 @@ public class RerunRule { |
| 177 | 159 | this.useEmployeeConfig = useEmployeeConfig; |
| 178 | 160 | } |
| 179 | 161 | |
| 180 | - public SysUser getCreateBy() { | |
| 181 | - return createBy; | |
| 182 | - } | |
| 183 | - | |
| 184 | - public void setCreateBy(SysUser createBy) { | |
| 185 | - this.createBy = createBy; | |
| 186 | - } | |
| 187 | - | |
| 188 | - public SysUser getUpdateBy() { | |
| 189 | - return updateBy; | |
| 190 | - } | |
| 191 | - | |
| 192 | - public void setUpdateBy(SysUser updateBy) { | |
| 193 | - this.updateBy = updateBy; | |
| 194 | - } | |
| 195 | - | |
| 196 | - public Date getCreateDate() { | |
| 197 | - return createDate; | |
| 198 | - } | |
| 199 | - | |
| 200 | - public void setCreateDate(Date createDate) { | |
| 201 | - this.createDate = createDate; | |
| 202 | - } | |
| 203 | - | |
| 204 | - public Date getUpdateDate() { | |
| 205 | - return updateDate; | |
| 206 | - } | |
| 207 | - | |
| 208 | 162 | public Boolean getIsCancel() { |
| 209 | 163 | return isCancel; |
| 210 | 164 | } |
| ... | ... | @@ -213,7 +167,4 @@ public class RerunRule { |
| 213 | 167 | this.isCancel = isCancel; |
| 214 | 168 | } |
| 215 | 169 | |
| 216 | - public void setUpdateDate(Date updateDate) { | |
| 217 | - this.updateDate = updateDate; | |
| 218 | - } | |
| 219 | 170 | } | ... | ... |
src/main/java/com/bsth/service/schedule/RerunService.java
| 1 | 1 | package com.bsth.service.schedule; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.schedule.rule.RerunRule; |
| 4 | -import com.bsth.service.BaseService; | |
| 5 | 4 | |
| 6 | 5 | /** |
| 7 | 6 | * Created by xu on 16/10/20. |
| 8 | 7 | */ |
| 9 | -public interface RerunService extends BaseService<RerunRule, Long> { | |
| 8 | +public interface RerunService extends BService<RerunRule, Long> { | |
| 10 | 9 | } | ... | ... |
src/main/java/com/bsth/service/schedule/RerunServiceImpl.java deleted
100644 → 0
| 1 | -package com.bsth.service.schedule; | |
| 2 | - | |
| 3 | -import com.bsth.common.ResponseCode; | |
| 4 | -import com.bsth.entity.schedule.rule.RerunRule; | |
| 5 | -import com.bsth.repository.schedule.RerunRuleRepository; | |
| 6 | -import com.bsth.service.impl.BaseServiceImpl; | |
| 7 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 8 | -import org.springframework.stereotype.Service; | |
| 9 | - | |
| 10 | -import javax.transaction.Transactional; | |
| 11 | -import java.util.HashMap; | |
| 12 | -import java.util.Map; | |
| 13 | - | |
| 14 | -/** | |
| 15 | - * Created by xu on 16/10/20. | |
| 16 | - */ | |
| 17 | -@Service | |
| 18 | -public class RerunServiceImpl extends BaseServiceImpl<RerunRule, Long> implements RerunService { | |
| 19 | - | |
| 20 | - @Autowired | |
| 21 | - private RerunRuleRepository rerunRuleRepository; | |
| 22 | - | |
| 23 | - @Override | |
| 24 | - @Transactional | |
| 25 | - public Map<String, Object> delete(Long aLong) { | |
| 26 | - // 获取带作废的数据 | |
| 27 | - RerunRule rerunRule = rerunRuleRepository.findOne(aLong); | |
| 28 | - | |
| 29 | - toogleIsCancel(rerunRule); | |
| 30 | - | |
| 31 | - Map<String, Object> map = new HashMap<>(); | |
| 32 | - map.put("status", ResponseCode.SUCCESS); | |
| 33 | - | |
| 34 | - return map; | |
| 35 | - | |
| 36 | - } | |
| 37 | - | |
| 38 | - /** | |
| 39 | - * 撤销/作废切换。 | |
| 40 | - * @param rerunRule | |
| 41 | - */ | |
| 42 | - private void toogleIsCancel(RerunRule rerunRule) { | |
| 43 | - boolean isCancel = rerunRule.getIsCancel(); | |
| 44 | - if (isCancel) { | |
| 45 | - rerunRule.setIsCancel(false); | |
| 46 | - } else { | |
| 47 | - rerunRule.setIsCancel(true); | |
| 48 | - } | |
| 49 | - } | |
| 50 | -} |
src/main/java/com/bsth/service/schedule/impl/RerunServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.schedule.impl; | |
| 2 | + | |
| 3 | +import com.bsth.entity.schedule.rule.RerunRule; | |
| 4 | +import com.bsth.service.schedule.RerunService; | |
| 5 | +import com.bsth.service.schedule.ScheduleException; | |
| 6 | +import org.springframework.stereotype.Service; | |
| 7 | +import org.springframework.transaction.annotation.Transactional; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * Created by xu on 16/10/20. | |
| 11 | + */ | |
| 12 | +@Service | |
| 13 | +public class RerunServiceImpl extends BServiceImpl<RerunRule, Long> implements RerunService { | |
| 14 | + | |
| 15 | + @Transactional | |
| 16 | + @Override | |
| 17 | + public void delete(Long aLong) throws ScheduleException { | |
| 18 | + toggleCancel(aLong); | |
| 19 | + } | |
| 20 | + | |
| 21 | + private void toggleCancel(Long id) throws ScheduleException { | |
| 22 | + RerunRule rerunRule = findById(id); | |
| 23 | + if (rerunRule.getIsCancel()) { | |
| 24 | + rerunRule.setIsCancel(false); | |
| 25 | + } else { | |
| 26 | + rerunRule.setIsCancel(true); | |
| 27 | + } | |
| 28 | + } | |
| 29 | +} | ... | ... |
src/main/resources/application-dev.properties
| ... | ... | @@ -8,9 +8,9 @@ spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy |
| 8 | 8 | spring.jpa.database= MYSQL |
| 9 | 9 | spring.jpa.show-sql= true |
| 10 | 10 | spring.datasource.driver-class-name= com.mysql.jdbc.Driver |
| 11 | -spring.datasource.url= jdbc:mysql://192.168.168.201/mh_control?useUnicode=true&characterEncoding=utf-8&useSSL=false | |
| 11 | +spring.datasource.url= jdbc:mysql://127.0.0.1/qp_control?useUnicode=true&characterEncoding=utf-8&useSSL=false | |
| 12 | 12 | spring.datasource.username= root |
| 13 | -spring.datasource.password= 123456 | |
| 13 | +spring.datasource.password= | |
| 14 | 14 | #spring.datasource.url= jdbc:mysql://192.168.168.117/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false |
| 15 | 15 | #spring.datasource.username= root |
| 16 | 16 | #spring.datasource.password= root | ... | ... |