| | |
| | | import com.zy.common.CodeRes; |
| | | import com.zy.common.model.DetlDto; |
| | | import com.zy.common.web.BaseController; |
| | | import com.zy.system.entity.User; |
| | | import com.zy.system.service.UserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.net.URLEncoder; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @RestController |
| | | public class OrderController extends BaseController { |
| | |
| | | private LocOwnerService locOwnerService; |
| | | @Autowired |
| | | private OrderLogService orderLogService; |
| | | |
| | | @Resource |
| | | private UserService userService; |
| | | |
| | | @RequestMapping(value = "/order/nav/list/auth") |
| | | @ManagerAuth |
| | |
| | | @RequestParam Map<String, Object> param){ |
| | | EntityWrapper<Order> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | // 限制销售角色只能看自己创建的单子(销售角色id固定21,不能随意修改) |
| | | User user = getUser(); |
| | | if (user.getRoleId() != 2 && user.getRoleId() != 24) { |
| | | wrapper.eq("create_by", user.getId()); |
| | | } |
| | | // 订单表只存了操作人id,所以操作人姓名查询,只能从姓名先去找id, |
| | | Object userName = param.get("oper_memb"); |
| | | if (userName != null && user.getRoleId() != 21) { |
| | | List<User> users = userService.selectList(new EntityWrapper<User>().like("username", (String) param.get("oper_memb"))); |
| | | if(users.size() > 0){ |
| | | wrapper.in("create_by", users.stream().map(User::getId).collect(Collectors.toList())); |
| | | } |
| | | } |
| | | // 上述已自定义搜索,移除操作人姓名搜索 |
| | | param.remove("oper_memb"); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} else { |
| | | wrapper.orderBy("settle").orderBy("create_time", false); |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/orderQuery/auth") |
| | | @ManagerAuth |
| | | // @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<Order> wrapper = new EntityWrapper<>(); |
| | | wrapper.like("order_no", condition); |
| | | wrapper.le("settle",3); |
| | | Page<Order> page = orderService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (Order order : page.getRecords()){ |