| | |
| | | public Map<String, Object> detail(Long id) { |
| | | List<Map<String, Object>> rows = query(""" |
| | | select id, openid, name, mobile, id_card_no, gender, work_unit, talent_level, |
| | | source_area_type, talent_card_no, register_time, status, work_address, contact_address, advisor_id |
| | | source_area_type, talent_card_no, register_time, status, work_address, contact_address, advisor_id, service_staff_id |
| | | from talent_user |
| | | where deleted = 0 and id = ? |
| | | """, id); |
| | |
| | | } |
| | | |
| | | @Transactional(readOnly = true) |
| | | public List<Map<String, Object>> availableServiceStaff() { |
| | | return query(""" |
| | | select id, display_name, mobile, position_name |
| | | from admin_operator |
| | | where deleted = 0 and status = 1 |
| | | order by display_name, id |
| | | """); |
| | | } |
| | | |
| | | @Transactional |
| | | public Map<String, Object> updateStatus(Long id, Byte status) { |
| | | if (status == null || (status != 0 && status != 1)) { |
| | | throw new BusinessException(ErrorCode.BAD_REQUEST, "状态只能为0停用或1启用"); |
| | | } |
| | | int updated = jdbcTemplate.update("update talent_user set status = ? where id = ? and deleted = 0", status, id); |
| | | if (updated == 0) throw new BusinessException(ErrorCode.NOT_FOUND, "持卡人不存在"); |
| | | return detail(id); |
| | | } |
| | | |
| | | @Transactional |
| | | public Map<String, Object> updateServiceStaff(Long id, Long staffId) { |
| | | if (staffId != null) { |
| | | Integer staffCount = jdbcTemplate.queryForObject(""" |
| | | select count(*) from admin_operator where id = ? and deleted = 0 and status = 1 |
| | | """, Integer.class, staffId); |
| | | if (staffCount == null || staffCount == 0) { |
| | | throw new BusinessException(ErrorCode.BAD_REQUEST, "服务人员不存在或已停用"); |
| | | } |
| | | } |
| | | int updated = jdbcTemplate.update(""" |
| | | update talent_user set service_staff_id = ? |
| | | where id = ? and deleted = 0 |
| | | """, staffId, id); |
| | | if (updated == 0) { |
| | | throw new BusinessException(ErrorCode.NOT_FOUND, "持卡人不存在"); |
| | | } |
| | | return detail(id); |
| | | } |
| | | |
| | | @Transactional(readOnly = true) |
| | | public byte[] exportExcel(String keyword, String mobile, String cardNo, String level, Integer status, |
| | | LocalDate registerStart, LocalDate registerEnd) { |
| | | List<Object[]> rows = new ArrayList<>(); |