|  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONArray; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.Query; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.zy.asrs.common.domain.dto.DetlDto; | 
|---|
|  |  |  | import com.zy.asrs.common.domain.dto.WrkTraceVo; | 
|---|
|  |  |  | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.jdbc.core.JdbcTemplate; | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | import org.springframework.transaction.interceptor.TransactionAspectSupport; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.io.UnsupportedEncodingException; | 
|---|
|  |  |  | import java.math.BigDecimal; | 
|---|
|  |  |  | import java.net.URLDecoder; | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestParam(required = false) String condition, | 
|---|
|  |  |  | @RequestParam(required = false) String timeRange, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param) { | 
|---|
|  |  |  | LambdaQueryWrapper<Order> wrapper = new LambdaQueryWrapper<>(); | 
|---|
|  |  |  | wrapper.eq(Order::getHostId, getHostId()); | 
|---|
|  |  |  | QueryWrapper<Order> wrapper = new QueryWrapper<>(); | 
|---|
|  |  |  | wrapper.eq("host_id", getHostId()); | 
|---|
|  |  |  | if (!Cools.isEmpty(condition)) { | 
|---|
|  |  |  | wrapper.like(Order::getId, condition); | 
|---|
|  |  |  | wrapper.like("id", condition); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!Cools.isEmpty(timeRange)) { | 
|---|
|  |  |  | String[] range = timeRange.split(RANGE_TIME_LINK); | 
|---|
|  |  |  | wrapper.ge(Order::getCreateTime, DateUtils.convert(range[0])); | 
|---|
|  |  |  | wrapper.le(Order::getCreateTime, DateUtils.convert(range[1])); | 
|---|
|  |  |  | wrapper.ge("create_time", DateUtils.convert(range[0])); | 
|---|
|  |  |  | wrapper.le("create_time", DateUtils.convert(range[1])); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | allLike(Order.class, param.keySet(), wrapper, condition); | 
|---|
|  |  |  | return R.ok(orderService.page(new Page<>(curr, limit), wrapper)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R head(@RequestParam(defaultValue = "1")Integer curr, | 
|---|
|  |  |  | @RequestParam(defaultValue = "10")Integer limit, | 
|---|
|  |  |  | @RequestParam(required = false) String condition, | 
|---|
|  |  |  | @RequestParam(required = false)String orderByField, | 
|---|
|  |  |  | @RequestParam(required = false)String orderByType, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param){ | 
|---|
|  |  |  | LambdaQueryWrapper<Order> wrapper = new LambdaQueryWrapper<>(); | 
|---|
|  |  |  | @RequestParam Map<String, Object> param) throws UnsupportedEncodingException { | 
|---|
|  |  |  | if(!Cools.isEmpty(condition)){ | 
|---|
|  |  |  | condition = condition.trim(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | QueryWrapper<Order> wrapper = new QueryWrapper<>(); | 
|---|
|  |  |  | excludeTrash(param); | 
|---|
|  |  |  | wrapper.eq(Order::getStatus, 1); | 
|---|
|  |  |  | wrapper.eq(Order::getHostId, getHostId()); | 
|---|
|  |  |  | wrapper.eq("status", 1); | 
|---|
|  |  |  | wrapper.eq("host_id", getHostId()); | 
|---|
|  |  |  | if (!Cools.isEmpty(param.get("order_no"))) { | 
|---|
|  |  |  | wrapper.eq(Order::getOrderNo, param.get("order_no")); | 
|---|
|  |  |  | wrapper.eq("order_no", param.get("order_no")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!Cools.isEmpty(param.get("create_time"))) { | 
|---|
|  |  |  | String[] range = param.get("create_time").toString().split(RANGE_TIME_LINK); | 
|---|
|  |  |  | wrapper.ge(Order::getCreateTime, DateUtils.convert(range[0])); | 
|---|
|  |  |  | wrapper.le(Order::getCreateTime, DateUtils.convert(range[1])); | 
|---|
|  |  |  | wrapper.ge("create_time", DateUtils.convert(range[0])); | 
|---|
|  |  |  | wrapper.le("create_time", DateUtils.convert(range[1])); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!Cools.isEmpty(param.get("doc_type"))) { | 
|---|
|  |  |  | wrapper.eq(Order::getDocType, param.get("doc_type")); | 
|---|
|  |  |  | wrapper.eq("doc_type", param.get("doc_type")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!Cools.isEmpty(param.get("docName"))) { | 
|---|
|  |  |  | DocType docType = docTypeService.getOne(new LambdaQueryWrapper<DocType>().eq(DocType::getDocName, param.get("docName"))); | 
|---|
|  |  |  | wrapper.eq(Order::getDocType, docType.getDocId()); | 
|---|
|  |  |  | String docName = URLDecoder.decode(param.get("docName").toString(), "UTF-8"); | 
|---|
|  |  |  | DocType docType = docTypeService.getOne(new LambdaQueryWrapper<DocType>().eq(DocType::getDocName, docName)); | 
|---|
|  |  |  | wrapper.eq("doc_type", docType.getDocId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!Cools.isEmpty(param.get("settle"))) { | 
|---|
|  |  |  | wrapper.eq(Order::getSettle, param.get("settle")); | 
|---|
|  |  |  | wrapper.eq("settle", param.get("settle")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | param.remove("order_no"); | 
|---|
|  |  |  | allLike(Order.class, param.keySet(), wrapper, condition); | 
|---|
|  |  |  | wrapper.orderByDesc("create_time"); | 
|---|
|  |  |  | return R.ok(orderService.page(new Page<>(curr, limit), wrapper)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|