jiangqs
2023-06-14 d7452d46f66a58caaad0442fbcca6953336c18ea
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java
@@ -33,8 +33,6 @@
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;
@@ -275,28 +273,24 @@
    @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);
    }
    /**