| | |
| | | PageParam param = pageParamService.getActivatePeriod(); |
| | | Integer period = param.getValue(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.add(Calendar.DATE,-period); |
| | | calendar.add(Calendar.DAY_OF_MONTH,-period); |
| | | |
| | | QueryWrapper<BattWarehouse> query = Wrappers.query(); |
| | | query.eq("on_plan",0); |
| | | //为活化过 或者 活化时间超过活化周期 |
| | | query.isNull("activate_time").or().le("activate_time",calendar); |
| | | //未活化过 或者 活化时间超过活化周期 |
| | | query.isNull("activate_time").or().le("activate_time",calendar.getTime()); |
| | | return mapper.selectList(query); |
| | | } |
| | | |
| | | public List<BattWarehouse> getChargeList() { |
| | | Integer period = 1; |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.add(Calendar.MONTH,-period); |
| | | |
| | | QueryWrapper<BattWarehouse> query = Wrappers.query(); |
| | | query.eq("charge_on_plan",0); |
| | | //未充电过 或者 充电时间超过充电周期 |
| | | query.isNull("charge_time").or().le("charge_time",calendar.getTime()); |
| | | return mapper.selectList(query); |
| | | } |
| | | |
| | | public List<BattWarehouse> getDischargeList() { |
| | | Integer period = 2; |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.add(Calendar.MONTH,-period); |
| | | |
| | | QueryWrapper<BattWarehouse> query = Wrappers.query(); |
| | | query.eq("discharge_on_plan",0); |
| | | //未放电过 或者 放电时间超过放电周期 |
| | | query.isNull("discharge_time").or().le("discharge_time",calendar.getTime()); |
| | | return mapper.selectList(query); |
| | | } |
| | | |
| | |
| | | mapper.insertBatchSomeColumn(listNew); |
| | | } |
| | | |
| | | public void updateBatchById(List<BattWarehouse> list) { |
| | | mapper.updateBatchById(list); |
| | | public void updateActivateBatchById(List<BattWarehouse> list) { |
| | | mapper.updateActivateBatchById(list); |
| | | } |
| | | |
| | | public void updateChargeBatchById(List<BattWarehouse> list) { |
| | | mapper.updateChargeBatchById(list); |
| | | } |
| | | |
| | | public void updateDischargeBatchById(List<BattWarehouse> list) { |
| | | mapper.updateDischargeBatchById(list); |
| | | } |
| | | |
| | | public BattWarehouse getByTaskNo(String taskNo) { |
| | | QueryWrapper<BattWarehouse> query = Wrappers.query(); |
| | | query.eq("task_no",taskNo); |
| | | query.eq("task_no",taskNo).or().eq("charge_task_no",taskNo).or().eq("discharge_task_no",taskNo); |
| | | query.last(" limit 1"); |
| | | return mapper.selectOne(query); |
| | | } |
| | |
| | | update.eq("id",id); |
| | | mapper.update((BattWarehouse) ActionUtil.objeNull,update); |
| | | } |
| | | |
| | | public void finishChargeById(Integer id) { |
| | | UpdateWrapper<BattWarehouse> update = Wrappers.update(); |
| | | update.set("charge_task_no",null); |
| | | update.set("charge_on_plan",0); |
| | | update.set("charge_time",Calendar.getInstance().getTime()); |
| | | update.eq("id",id); |
| | | mapper.update((BattWarehouse) ActionUtil.objeNull,update); |
| | | } |
| | | |
| | | public void finishDischargeById(Integer id) { |
| | | UpdateWrapper<BattWarehouse> update = Wrappers.update(); |
| | | update.set("discharge_task_no",null); |
| | | update.set("discharge_on_plan",0); |
| | | update.set("discharge_time",Calendar.getInstance().getTime()); |
| | | update.eq("id",id); |
| | | mapper.update((BattWarehouse) ActionUtil.objeNull,update); |
| | | } |
| | | } |