MechanicServiceImpl.java 1.81 KB
/*
 * Copyright (c) 2018, 2028, glsx and/or its affiliates. All rights reserved.
 * GLSX PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */
package com.glsx.usercenter.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.glsx.usercenter.constants.Constants;
import com.glsx.usercenter.mapper.DictionaryTypeMapper;
import com.glsx.usercenter.mapper.SysMechanicMapper;
import com.glsx.usercenter.mapper.SysUserServicesMapper;
import com.glsx.usercenter.pojo.user.SysMechanicEntity;
import com.glsx.usercenter.pojo.user.SysUserServices;
import com.glsx.usercenter.service.IMechanicService;

/**  
* @ClassName: IMechanicServiceImpl  
* @Description: TODO(这里用一句话描述这个类的作用)  
* @author Zheng Xiajun  
* @date 2019年10月17日 
*  
*/
@Service
public class MechanicServiceImpl implements IMechanicService {

	@Autowired
	private SysMechanicMapper sysMechanicMapper;


	@Autowired
	private SysUserServicesMapper sysUserServicesMapper;

	/**
	 * 技工认证
	 */
	@Override
	public void verify(SysMechanicEntity sysMechanicEntity) {
		// 修改状态,插入资料
		sysMechanicEntity.setMechanicStatus(Constants.SYS_USER_STATUS_CHECKING);
		sysMechanicMapper.updateByPrimaryKeySelective(sysMechanicEntity);
		String[] items = sysMechanicEntity.getServiceItemsKey();
		for (int i = 0; i < items.length; i++) {
			SysUserServices record = new SysUserServices();
			record.setServiceKey(items[i]);
			record.setUserId(sysMechanicEntity.getUserId());
			sysUserServicesMapper.deleteByUserIdAndServiceId(sysMechanicEntity.getUserId(), items[i]);
			sysUserServicesMapper.insertSelective(record);
		}
	}
}