| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | |
| | | @Override |
| | | public void changeCooperationTime(MgtChangeCoopDto mgtChangeCoopDto){ |
| | | Shop shop = this.getById(mgtChangeCoopDto.getShopId()); |
| | | String coopStartTime = mgtChangeCoopDto.getCoopStartTime(); |
| | | String coopEndTime = mgtChangeCoopDto.getCoopEndTime(); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | try { |
| | | Date coopStartDate = simpleDateFormat.parse(coopStartTime); |
| | | Date coopEndDate = simpleDateFormat.parse(coopEndTime); |
| | | Date nowTime = new Date(); |
| | | shop.setCooperationStartTime(coopStartDate); |
| | | shop.setCooperationEndTime(coopEndDate); |
| | | Boolean inTime = false; |
| | | if(coopStartDate.compareTo(nowTime)<0&&coopEndDate.compareTo(nowTime)>0){ |
| | | inTime = true; |
| | | } |
| | | if(shop.getShopStatus()==2&&inTime){ |
| | | shop.setShopStatus(1); |
| | | } |
| | | shop.setUpdateTime(nowTime); |
| | | shop.setUpdateUserId(mgtChangeCoopDto.getUserId()); |
| | | this.saveOrUpdate(shop); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | Date coopStartDate = mgtChangeCoopDto.getCoopStartTime(); |
| | | Date coopEndDate = mgtChangeCoopDto.getCoopEndTime(); |
| | | Date nowTime = new Date(); |
| | | shop.setCooperationStartTime(coopStartDate); |
| | | shop.setCooperationEndTime(coopEndDate); |
| | | Boolean inTime = false; |
| | | if(coopStartDate.compareTo(nowTime)<=0&&coopEndDate.compareTo(nowTime)>=0){ |
| | | inTime = true; |
| | | shop.setCooperativeFlag(1); |
| | | }else{ |
| | | shop.setCooperativeFlag(0); |
| | | } |
| | | if(shop.getShopStatus()==2&&inTime){ |
| | | shop.setShopStatus(1); |
| | | } |
| | | shop.setUpdateTime(nowTime); |
| | | shop.setUpdateUserId(mgtChangeCoopDto.getUserId()); |
| | | this.saveOrUpdate(shop); |
| | | } |
| | | |
| | | /** |