Index: forgon-core/src/main/java/com/forgon/strategyMode/MinuteDateState.java =================================================================== diff -u -r17458 -r17468 --- forgon-core/src/main/java/com/forgon/strategyMode/MinuteDateState.java (.../statusMode/MinuteDateState.java) (revision 17458) +++ forgon-core/src/main/java/com/forgon/strategyMode/MinuteDateState.java (.../strategyMode/MinuteDateStrategy.java) (revision 17468) @@ -1,4 +1,4 @@ -package com.forgon.statusMode; +package com.forgon.strategyMode; import com.forgon.tools.date.DateTools; @@ -7,12 +7,12 @@ /** * @author zhonghaowen - * @apiNote 获取当天最后的时间状态模式实现类(需要转换的时间格式是年月日时分) + * @apiNote 获取当天最后的时间策略模式实现类(需要转换的时间格式是年月日时分) * @since 2017-03-21 */ -public class MinuteDateState implements DateState { +public class MinuteDateStrategy implements DateStrategy { @Override - public Date handleTime(String needToTransferTime, SimpleDateFormat sdf, String retryConvertFormat) { + public Date handleTodayEndOfTime(String needToTransferTime, SimpleDateFormat sdf, String retryConvertFormat) { return DateTools.convertTime(needToTransferTime + ":59", sdf, retryConvertFormat); } } Index: forgon-core/src/main/java/com/forgon/strategyMode/HourDateState.java =================================================================== diff -u -r17458 -r17468 --- forgon-core/src/main/java/com/forgon/strategyMode/HourDateState.java (.../statusMode/HourDateState.java) (revision 17458) +++ forgon-core/src/main/java/com/forgon/strategyMode/HourDateState.java (.../strategyMode/HourDateStrategy.java) (revision 17468) @@ -1,4 +1,4 @@ -package com.forgon.statusMode; +package com.forgon.strategyMode; import com.forgon.tools.date.DateTools; @@ -7,14 +7,14 @@ /** * @author zhonghaowen - * @apiNote 获取当天最后的时间状态模式实现类(需要转换的时间格式是年月日时) + * @apiNote 获取当天最后的时间策略模式实现类(需要转换的时间格式是年月日时) * @since 2017-03-21 */ -public class HourDateState implements DateState { +public class HourDateStrategy implements DateStrategy { @Override - public Date handleTime(String needToTransferTime, SimpleDateFormat sdf, String retryConvertFormat) { + public Date handleTodayEndOfTime(String needToTransferTime, SimpleDateFormat sdf, String retryConvertFormat) { return DateTools.convertTime(needToTransferTime + ":59:59", sdf, retryConvertFormat); } } Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanManagerImpl.java =================================================================== diff -u -r17458 -r17468 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanManagerImpl.java (.../InvoicePlanManagerImpl.java) (revision 17458) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanManagerImpl.java (.../InvoicePlanManagerImpl.java) (revision 17468) @@ -17,7 +17,7 @@ import com.forgon.disinfectsystem.entity.invoicemanager.enums.BorrowConfirmStatus; import com.forgon.exception.OperationException; -import com.forgon.statusMode.DateStateContext; +import com.forgon.strategyMode.DateStrategyContext; import com.forgon.tools.StrutsParamUtils; import com.forgon.tools.util.IntegerUtils; @@ -1004,9 +1004,9 @@ //如果convertTime方法转换出错,尝试重新再转换(花都区人民医院要求:发货时间精确到上午和下午的时分,而之前默认的方法是精确到时分秒,所以要尝试再次转换) Date out_beginTime = DateTools.convertTime(applyDateArray[0] + " 00:00:00", sdf, DateTools.COMMON_DATE_HM); String timeSearchFmt = CssdUtils.getSystemSetConfigByName("timeSearchFmt"); - DateStateContext dateStateContext = new DateStateContext(); - dateStateContext.setDateState(timeSearchFmt); - Date out_endTime = dateStateContext.handleTime(applyDateArray[1], sdf, DateTools.COMMON_DATE_HM); + DateStrategyContext dateStrategyContext = new DateStrategyContext(); + dateStrategyContext.setDateState(timeSearchFmt); + Date out_endTime = dateStrategyContext.handleTodayEndOfTime(applyDateArray[1], sdf, DateTools.COMMON_DATE_HM); String where7 = String.format("(applicationTime between %s and %s or po in (select recyclingApplication from RecyclingRecord where recyclingTime between %s and %s))", dateQueryAdapter.dateAdapter(out_beginTime), dateQueryAdapter.dateAdapter(out_endTime), Index: forgon-core/src/main/java/com/forgon/strategyMode/SecondsDateState.java =================================================================== diff -u -r17458 -r17468 --- forgon-core/src/main/java/com/forgon/strategyMode/SecondsDateState.java (.../statusMode/SecondsDateState.java) (revision 17458) +++ forgon-core/src/main/java/com/forgon/strategyMode/SecondsDateState.java (.../strategyMode/SecondsDateStrategy.java) (revision 17468) @@ -1,4 +1,4 @@ -package com.forgon.statusMode; +package com.forgon.strategyMode; import com.forgon.tools.date.DateTools; @@ -7,13 +7,13 @@ /** * @author zhonghaowen - * @apiNote 获取当天最后的时间状态模式实现类(需要转换的时间格式是年月日时秒) + * @apiNote 获取当天最后的时间策略模式实现类(需要转换的时间格式是年月日时秒) * @since 2017-03-21 */ -public class SecondsDateState implements DateState { +public class SecondsDateStrategy implements DateStrategy { @Override - public Date handleTime(String needToTransferTime, SimpleDateFormat sdf, String retryConvertFormat) { + public Date handleTodayEndOfTime(String needToTransferTime, SimpleDateFormat sdf, String retryConvertFormat) { return DateTools.convertTime(needToTransferTime + " 23:59:59", sdf, retryConvertFormat); } } Index: forgon-core/src/main/java/com/forgon/strategyMode/DateStateContext.java =================================================================== diff -u -r17458 -r17468 --- forgon-core/src/main/java/com/forgon/strategyMode/DateStateContext.java (.../statusMode/DateStateContext.java) (revision 17458) +++ forgon-core/src/main/java/com/forgon/strategyMode/DateStateContext.java (.../strategyMode/DateStrategyContext.java) (revision 17468) @@ -1,4 +1,4 @@ -package com.forgon.statusMode; +package com.forgon.strategyMode; import org.apache.commons.lang3.ObjectUtils; @@ -7,37 +7,38 @@ /** * @author zhonghaowen - * @apiNote 获取当天最后的时间状态模式使用类 + * @apiNote 获取对应时间的策略模式使用类 * @since 2017-03-21 */ -public class DateStateContext { +public class DateStrategyContext { - private DateState dateState; + private DateStrategy dateStrategy; - public DateStateContext() { + public DateStrategyContext() { //默认用年月日时分秒 - this.dateState = new SecondsDateState(); + this.dateStrategy = new SecondsDateStrategy(); } /** - * 根据日期格式修改对应的状态 + * 根据日期格式修改对应的策略 + * * @param timeFmt 日期格式 */ public void setDateState(String timeFmt) { //如果是年月日时分 if (ObjectUtils.equals("Y-m-d H:i", timeFmt)) { - this.dateState = new MinuteDateState(); + this.dateStrategy = new MinuteDateStrategy(); } //如果是年月日时 else if (ObjectUtils.equals("Y-m-d H", timeFmt)) { - this.dateState = new HourDateState(); + this.dateStrategy = new HourDateStrategy(); } } /** - * @see DateState#handleTime(String, SimpleDateFormat, String) + * @see DateStrategy#handleTodayEndOfTime(String, SimpleDateFormat, String) */ - public Date handleTime(String needToTransferTime, SimpleDateFormat sdf, String retryConvertFormat) { - return dateState.handleTime(needToTransferTime, sdf, retryConvertFormat); + public Date handleTodayEndOfTime(String needToTransferTime, SimpleDateFormat sdf, String retryConvertFormat) { + return dateStrategy.handleTodayEndOfTime(needToTransferTime, sdf, retryConvertFormat); } } Index: forgon-core/src/main/java/com/forgon/strategyMode/DateState.java =================================================================== diff -u -r17458 -r17468 --- forgon-core/src/main/java/com/forgon/strategyMode/DateState.java (.../statusMode/DateState.java) (revision 17458) +++ forgon-core/src/main/java/com/forgon/strategyMode/DateState.java (.../strategyMode/DateStrategy.java) (revision 17468) @@ -1,14 +1,14 @@ -package com.forgon.statusMode; +package com.forgon.strategyMode; import java.text.SimpleDateFormat; import java.util.Date; /** * @author zhonghaowen - * @apiNote 获取当天最后的时间状态模式 + * @apiNote 获取对应时间的策略模式 * @since 2017-03-21 */ -public interface DateState { +public interface DateStrategy { /** * 获取该时间当天最后的时间(23时59分59秒) @@ -19,6 +19,6 @@ * @param retryConvertFormat 转换失败时,再次尝试的转换格式 * @return 转换后的时间 */ - Date handleTime(String needToTransferTime, SimpleDateFormat sdf, String retryConvertFormat); + Date handleTodayEndOfTime(String needToTransferTime, SimpleDateFormat sdf, String retryConvertFormat); } Fisheye: Tag 17468 refers to a dead (removed) revision in file `forgon-core/src/main/java/com/forgon/statusMode/DateStateContext.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 17468 refers to a dead (removed) revision in file `forgon-core/src/main/java/com/forgon/statusMode/HourDateState.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 17468 refers to a dead (removed) revision in file `forgon-core/src/main/java/com/forgon/statusMode/DateState.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 17468 refers to a dead (removed) revision in file `forgon-core/src/main/java/com/forgon/statusMode/MinuteDateState.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 17468 refers to a dead (removed) revision in file `forgon-core/src/main/java/com/forgon/statusMode/SecondsDateState.java'. Fisheye: No comparison available. Pass `N' to diff?