| | |
| | | import com.kidgrow.common.model.SysOrganization; |
| | | import com.kidgrow.common.model.SysUser; |
| | | import com.kidgrow.common.utils.StringUtils; |
| | | import com.kidgrow.oprationcenter.model.ProductOrderDetail; |
| | | import com.kidgrow.oprationcenter.model.ProductOrderRecord; |
| | | import com.kidgrow.oprationcenter.service.IBusinessRecordsService; |
| | | import com.kidgrow.oprationcenter.service.IProductOrderDetailService; |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.validation.Valid; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | * 删除 |
| | | */ |
| | | @ApiOperation(value = "删除") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @DeleteMapping("/{id}") |
| | | public ResultBody delete(@PathVariable Long id) { |
| | | boolean v = productOrderRecordService.removeById(id); |
| | | if (v) { |
| | | if (!businessRecordsService.recordBusinessData("删除订单明细:" + id, id.toString())) { |
| | | //log.error(String.format("删除订单明细id为:{1}",id)); |
| | | ProductOrderRecord productOrderRecord=productOrderRecordService.getById(id); |
| | | if (productOrderRecord != null) { |
| | | Map<String,Object> detailSelect=new HashMap<String,Object>(); |
| | | detailSelect.put("pro_id",productOrderRecord.getProId()); |
| | | detailSelect.put("order_id",productOrderRecord.getOrderId()); |
| | | List<ProductOrderDetail> productOrderDetailList=productOrderDetailService.listByMap(detailSelect); |
| | | if (productOrderDetailList != null&&productOrderDetailList.size()>0) { |
| | | ProductOrderDetail productOrderDetail=productOrderDetailList.get(0); |
| | | if (productOrderDetail.getAilightCount() == productOrderRecord.getAilightCount()&& |
| | | productOrderDetail.getRecordCount()==productOrderRecord.getRecordCount()) { |
| | | //读片量和报告量都没有改变 可以删除 |
| | | //删记录 |
| | | boolean isdel= productOrderRecordService.removeById(id); |
| | | //删套餐 |
| | | boolean isdelDetail=productOrderDetailService.removeById(productOrderDetail.getId()); |
| | | //写记录 |
| | | boolean record=businessRecordsService.recordBusinessData("删除订单明细:" + id, id.toString()); |
| | | log.info(String.format("删除订单明细id为:{1}",id)); |
| | | if (isdelDetail&&isdel) { |
| | | return ResultBody.ok().msg("套餐删除成功!"); |
| | | } |
| | | else |
| | | { |
| | | return ResultBody.failed().msg("当前套餐删除失败!"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return ResultBody.failed().msg("当前套餐已经使用,无法删除!"); |
| | | } |
| | | } |
| | | return ResultBody.ok().msg("删除成功"); |
| | | } else { |
| | | return ResultBody.failed().msg("删除失败"); |
| | | else |
| | | { |
| | | return ResultBody.failed().msg("无相关套餐记录!"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return ResultBody.failed().msg("不存在该条记录!"); |
| | | } |
| | | } |
| | | |