| | |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.WrkDetl; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.service.WrkDetlService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.asrs.service.impl.WrkDetlServiceImpl; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @RestController |
| | | public class WrkMastController extends BaseController { |
| | | |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | @Autowired |
| | | private WrkDetlService wrkDetlService; |
| | | |
| | | @RequestMapping(value = "/wrkMast/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam(required = false)String barcode, |
| | | @RequestParam(required = false)String orderNo, |
| | | @RequestParam(required = false)String condition, |
| | | @RequestParam Map<String, Object> param){ |
| | | excludeTrash(param); |
| | | EntityWrapper<WrkMast> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | allLike(WrkMast.class, param.keySet(), wrapper, condition); |
| | | |
| | | if (!Cools.isEmpty(orderNo)) { |
| | | List<WrkDetl> detls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("order_no", orderNo)); |
| | | if (!Cools.isEmpty(detls)) { |
| | | List<Integer> wrkNos = detls.stream().map(WrkDetl::getWrkNo).collect(Collectors.toList()); |
| | | wrapper.in("wrk_no", wrkNos); |
| | | } |
| | | } |
| | | |
| | | if (!Cools.isEmpty(orderByField)){ |
| | | if (orderByField.endsWith("$")){ |
| | | orderByField = orderByField.substring(0, orderByField.length()-1); |
| | |
| | | wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); |
| | | wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); |
| | | } else { |
| | | if (entry.getKey().equals("orderNo")){ |
| | | continue; |
| | | } |
| | | wrapper.eq(entry.getKey(), val); |
| | | } |
| | | } |
| | |
| | | |
| | | @RequestMapping(value = "/wrkMast/add/pri/auth") |
| | | @ManagerAuth(memo = "工作档增加优先级") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R addPri(@RequestBody List<WrkMast> list) { |
| | | if (list.isEmpty()) { |
| | | return R.error("请至少选择一行数据"); |
| | | } |
| | | for (WrkMast entity : list){ |
| | | entity.setIoPri(entity.getIoPri() + 1); |
| | | if (!wrkMastService.update(entity, new EntityWrapper<WrkMast>().eq("wrk_no", entity.getWrkNo()))) { |
| | | throw new CoolException("优先级更新失败!"); |
| | | } |
| | | wrkMastService.updateBatchById(list); |
| | | } |
| | | // wrkMastService.updateBatchById(list); |
| | | return R.ok(); |
| | | } |
| | | |