工人导入,排序, 报名列表排序,拿出小程序配置到配置文件
This commit is contained in:
parent
d897c32a8f
commit
76f68055a9
@ -1,5 +1,6 @@
|
||||
package com.staffing.web.controller.custom;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@ -8,6 +9,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import com.staffing.common.core.domain.entity.SysUser;
|
||||
import com.staffing.common.core.redis.RedisCache;
|
||||
import com.staffing.common.utils.SecurityUtils;
|
||||
import com.staffing.custom.domain.StEmployeeFundRecord;
|
||||
import com.staffing.custom.domain.StTask;
|
||||
import com.staffing.custom.domain.StTaskSign;
|
||||
import com.staffing.custom.mapper.StTaskMapper;
|
||||
@ -31,6 +33,7 @@ import com.staffing.custom.domain.StEmployee;
|
||||
import com.staffing.custom.service.IStEmployeeService;
|
||||
import com.staffing.common.utils.poi.ExcelUtil;
|
||||
import com.staffing.common.core.page.TableDataInfo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import static com.staffing.common.constant.Constants.DELETED_USER_KEY;
|
||||
import static com.staffing.common.utils.PageUtils.startPage;
|
||||
@ -75,9 +78,80 @@ public class StEmployeeController extends BaseController
|
||||
public void export(HttpServletResponse response, StEmployee stEmployee)
|
||||
{
|
||||
List<StEmployee> list = stEmployeeService.selectStEmployeeList(stEmployee);
|
||||
for (StEmployee employee : list) {
|
||||
employee.setEmployeeTypeStr(employee.getEmployeeType() == 0 ? "灵活用工" : "固定长期用工");
|
||||
|
||||
if (employee.getSex() == null){
|
||||
employee.setSexStr("未知");
|
||||
}else{
|
||||
if (employee.getSex() == 0){
|
||||
employee.setSexStr("男");
|
||||
}else if (employee.getSex() == 1){
|
||||
employee.setSexStr("女");
|
||||
}else if (employee.getSex() == 2){
|
||||
employee.setSexStr("未知");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ExcelUtil<StEmployee> util = new ExcelUtil<StEmployee>(StEmployee.class);
|
||||
util.exportExcel(response, list, "员工数据");
|
||||
}
|
||||
/**
|
||||
* 导出员工列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('employee:export')")
|
||||
@Log(title = "员工", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/exportMoudle")
|
||||
public void exportMoudle(HttpServletResponse response, StEmployee stEmployee)
|
||||
{
|
||||
List<StEmployee> list = new ArrayList<>();
|
||||
StEmployee stEmployee1 = new StEmployee();
|
||||
stEmployee1.setSexStr("男");
|
||||
stEmployee1.setRealName("张三");
|
||||
stEmployee1.setPhone("1313131313");
|
||||
stEmployee1.setIdCard("11011001111111111");
|
||||
stEmployee1.setNation("汉");
|
||||
stEmployee1.setAge(18);
|
||||
stEmployee1.setUseUnit("xxx单位");
|
||||
stEmployee1.setInterviewDate(new Date());
|
||||
stEmployee1.setEntryDate(new Date());
|
||||
stEmployee1.setSupplier("xxx供应商");
|
||||
stEmployee1.setEmployeePrice("10");
|
||||
stEmployee1.setSupplierPrice("20");
|
||||
stEmployee1.setEmployeeTypeStr("灵活用工");
|
||||
|
||||
StEmployee stEmployee2 = new StEmployee();
|
||||
stEmployee2.setSexStr("女");
|
||||
stEmployee2.setRealName("张三");
|
||||
stEmployee2.setPhone("1313131313");
|
||||
stEmployee2.setIdCard("11011001111111111");
|
||||
stEmployee2.setNation("汉");
|
||||
stEmployee2.setAge(18);
|
||||
stEmployee2.setUseUnit("xxx单位");
|
||||
stEmployee2.setInterviewDate(new Date());
|
||||
stEmployee2.setEntryDate(new Date());
|
||||
stEmployee2.setSupplier("xxx供应商");
|
||||
stEmployee2.setEmployeePrice("10");
|
||||
stEmployee2.setSupplierPrice("20");
|
||||
stEmployee2.setEmployeeTypeStr("固定长期用工");
|
||||
list.add(stEmployee1);
|
||||
list.add(stEmployee2);
|
||||
|
||||
ExcelUtil<StEmployee> util = new ExcelUtil<StEmployee>(StEmployee.class);
|
||||
util.exportExcel(response, list, "员工数据");
|
||||
}
|
||||
@Log(title = "员工导入", businessType = BusinessType.IMPORT)
|
||||
@PreAuthorize("@ss.hasPermi('employee:export')")
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(MultipartFile file) throws Exception
|
||||
{
|
||||
ExcelUtil<StEmployee> util = new ExcelUtil<>(StEmployee.class);
|
||||
List<StEmployee> records = util.importExcel(file.getInputStream());
|
||||
|
||||
String message = stEmployeeService.importStEmployee(records);
|
||||
return success(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取员工详细信息
|
||||
@ -102,6 +176,7 @@ public class StEmployeeController extends BaseController
|
||||
return error("手机号已存在");
|
||||
}
|
||||
stEmployee.setUpdateTime(new Date());
|
||||
stEmployee.setCreateTime(new Date());
|
||||
return toAjax(stEmployeeService.insertStEmployee(stEmployee));
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.staffing.common.config.EnvConfig;
|
||||
import com.staffing.common.utils.MinioUtil;
|
||||
import com.staffing.common.utils.QRCodeGenerator;
|
||||
import com.staffing.custom.domain.StTaskSign;
|
||||
@ -38,6 +39,9 @@ public class StTaskController extends BaseController
|
||||
|
||||
@Autowired
|
||||
private MinioUtil minioUtil;
|
||||
|
||||
@Autowired
|
||||
EnvConfig envConfig;
|
||||
/**
|
||||
* 查询任务列表
|
||||
*/
|
||||
@ -52,7 +56,7 @@ public class StTaskController extends BaseController
|
||||
continue;
|
||||
}
|
||||
|
||||
task.setCodePic("https://www.tulkj.cn/file/yonggong/" + task.getCodePic());
|
||||
task.setCodePic(envConfig.getPicPrefix() + task.getCodePic());
|
||||
// task.setCodePic(minioUtil.getObjectURL( "yonggong", task.getCodePic()));
|
||||
}
|
||||
return getDataTable(list);
|
||||
@ -95,19 +99,7 @@ public class StTaskController extends BaseController
|
||||
stTask.setCreateTime(new Date());
|
||||
stTask.setUpdateTime(new Date());
|
||||
stTaskService.insertStTask(stTask);
|
||||
|
||||
String url = "http://www.tulkj.cn:81/index.html?id=" + stTask.getId();
|
||||
InputStream inputStream = QRCodeGenerator.generateQRCodeImage(url, 500, 500);
|
||||
String fileName = System.currentTimeMillis() + stTask.getId() + ".png";
|
||||
try {
|
||||
ObjectWriteResponse objectWriteResponse = minioUtil.putObject("yonggong"
|
||||
, fileName, inputStream, inputStream.available(), "image/png");
|
||||
} catch (Exception e) {
|
||||
logger.error("minioUtil.putObject error", e);
|
||||
}
|
||||
|
||||
stTask.setCodePic(fileName);
|
||||
|
||||
stTaskService.generatePrCode(stTask);
|
||||
return toAjax(stTaskService.updateStTask(stTask));
|
||||
}
|
||||
|
||||
|
@ -168,4 +168,15 @@ minio:
|
||||
ip: 8.155.21.176
|
||||
port: 9000
|
||||
access-key: root
|
||||
secret-key: root_6688
|
||||
secret-key: root_6688
|
||||
|
||||
env:
|
||||
genPicCodeUrl: http://yg.pusonggroup.com:81/index.html?id=
|
||||
picPrefix: https://www.tulkj.cn/file/yonggong/
|
||||
appId: wx7bc7df6eb945a84f
|
||||
secret: 60dc8f7e8c850dfbe0170acefa48070a
|
||||
#env:
|
||||
# genPicCodeUrl: http://www.tulkj.cn:81/index.html?id=
|
||||
# picPrefix: https://www.tulkj.cn/file/yonggong/
|
||||
# appId: wx26e952dad7a8aae5
|
||||
# secret: 60a85e94d921a385ce52faaaed4a103b
|
@ -0,0 +1,65 @@
|
||||
package com.staffing.common.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 读取项目相关配置
|
||||
*
|
||||
* @author staffing
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "env")
|
||||
public class EnvConfig {
|
||||
/**
|
||||
* 二维码 地址内容
|
||||
*/
|
||||
private String genPicCodeUrl;
|
||||
|
||||
/**
|
||||
* minio 文件前缀
|
||||
*/
|
||||
private String picPrefix;
|
||||
|
||||
/**
|
||||
* 小程序
|
||||
*/
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* 小程序
|
||||
*/
|
||||
private String secret;
|
||||
|
||||
public String getGenPicCodeUrl() {
|
||||
return genPicCodeUrl;
|
||||
}
|
||||
|
||||
public void setGenPicCodeUrl(String genPicCodeUrl) {
|
||||
this.genPicCodeUrl = genPicCodeUrl;
|
||||
}
|
||||
|
||||
public String getPicPrefix() {
|
||||
return picPrefix;
|
||||
}
|
||||
|
||||
public void setPicPrefix(String picPrefix) {
|
||||
this.picPrefix = picPrefix;
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getSecret() {
|
||||
return secret;
|
||||
}
|
||||
|
||||
public void setSecret(String secret) {
|
||||
this.secret = secret;
|
||||
}
|
||||
}
|
@ -30,6 +30,52 @@ public class StaffingConfig
|
||||
/** 验证码类型 */
|
||||
private static String captchaType;
|
||||
|
||||
|
||||
/** 二维码 地址内容 */
|
||||
private String genPicCodeUrl;
|
||||
|
||||
/** minio 文件前缀 */
|
||||
private static String picPrefix;
|
||||
|
||||
/** 小程序 */
|
||||
private static boolean appId;
|
||||
|
||||
/** 小程序 */
|
||||
private static String secret;
|
||||
|
||||
|
||||
public String getGenPicCodeUrl() {
|
||||
return genPicCodeUrl;
|
||||
}
|
||||
|
||||
public void setGenPicCodeUrl(String genPicCodeUrl) {
|
||||
this.genPicCodeUrl = genPicCodeUrl;
|
||||
}
|
||||
|
||||
public static String getPicPrefix() {
|
||||
return picPrefix;
|
||||
}
|
||||
|
||||
public static void setPicPrefix(String picPrefix) {
|
||||
StaffingConfig.picPrefix = picPrefix;
|
||||
}
|
||||
|
||||
public static boolean isAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public static void setAppId(boolean appId) {
|
||||
StaffingConfig.appId = appId;
|
||||
}
|
||||
|
||||
public static String getSecret() {
|
||||
return secret;
|
||||
}
|
||||
|
||||
public static void setSecret(String secret) {
|
||||
StaffingConfig.secret = secret;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
|
@ -1,28 +1,34 @@
|
||||
package com.staffing.common.utils;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.staffing.common.config.EnvConfig;
|
||||
import com.staffing.common.core.domain.WxLogin;
|
||||
import com.staffing.common.core.domain.WxPhone;
|
||||
import com.staffing.common.core.domain.WxToken;
|
||||
import com.staffing.common.utils.http.HttpUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class WxUtil {
|
||||
// public final static String appId = "wx7bc7df6eb945a84f";//ps
|
||||
// public final static String secret = "60dc8f7e8c850dfbe0170acefa48070a";//ps
|
||||
public final static String appId = "wx26e952dad7a8aae5";
|
||||
public final static String secret = "60a85e94d921a385ce52faaaed4a103b";
|
||||
// public final static String appId = "wx26e952dad7a8aae5";
|
||||
// public final static String secret = "60a85e94d921a385ce52faaaed4a103b";
|
||||
|
||||
private static WxToken wxToken = null;
|
||||
private WxToken wxToken = null;
|
||||
@Autowired
|
||||
EnvConfig envConfig;
|
||||
|
||||
public static synchronized WxToken getAccessToken(){
|
||||
public synchronized WxToken getAccessToken(){
|
||||
if (wxToken == null || System.currentTimeMillis() > wxToken.getExpiresTime() - 60000){
|
||||
Map<String, String > getParam = new HashMap<>();
|
||||
getParam.put("grant_type", "client_credential");
|
||||
getParam.put("appid", appId);
|
||||
getParam.put("secret", secret);
|
||||
getParam.put("appid", envConfig.getAppId());
|
||||
getParam.put("secret", envConfig.getSecret());
|
||||
String resJson = HttpUtils.sendGet("https://api.weixin.qq.com/cgi-bin/token", HttpUtils.getParam(getParam));
|
||||
wxToken = JSONObject.parseObject(resJson, WxToken.class);
|
||||
wxToken.setExpiresTime(wxToken.getExpires_in() * 1000 + System.currentTimeMillis());
|
||||
@ -36,7 +42,7 @@ public class WxUtil {
|
||||
* @param openId 微信用户唯一表示
|
||||
* @return
|
||||
*/
|
||||
public static WxPhone getPhoneNumber(String code, String openId){
|
||||
public WxPhone getPhoneNumber(String code, String openId){
|
||||
Map<String, String > getParam = new HashMap<>();
|
||||
getParam.put("code", code);
|
||||
getParam.put("openid", openId);
|
||||
@ -50,11 +56,11 @@ public class WxUtil {
|
||||
* wx 登录 获取openId
|
||||
* @return
|
||||
*/
|
||||
public static WxLogin login(String code){
|
||||
public WxLogin login(String code){
|
||||
Map<String, String > getParam = new HashMap<>();
|
||||
getParam.put("grant_type", "authorization_code");
|
||||
getParam.put("appid", appId);
|
||||
getParam.put("secret", secret);
|
||||
getParam.put("appid", envConfig.getAppId());
|
||||
getParam.put("secret", envConfig.getSecret());
|
||||
getParam.put("js_code", code);
|
||||
String url = "https://api.weixin.qq.com/sns/jscode2session";
|
||||
String resJson = HttpUtils.sendGet(url, HttpUtils.getParam(getParam));
|
||||
|
@ -39,6 +39,7 @@ import com.staffing.system.service.ISysConfigService;
|
||||
import com.staffing.system.service.ISysUserService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
@ -67,6 +68,9 @@ public class SysLoginService
|
||||
private IStEmployeeService stEmployeeService;
|
||||
@Autowired
|
||||
private SysPermissionService permissionService;
|
||||
@Autowired
|
||||
private WxUtil wxUtil;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
*
|
||||
@ -142,8 +146,8 @@ public class SysLoginService
|
||||
LoginUser loginUser = null;
|
||||
try
|
||||
{
|
||||
WxLogin login = WxUtil.login(loginCode);
|
||||
WxPhone wxPhone = WxUtil.getPhoneNumber(phoneCode, login.getOpenid());
|
||||
WxLogin login = wxUtil.login(loginCode);
|
||||
WxPhone wxPhone = wxUtil.getPhoneNumber(phoneCode, login.getOpenid());
|
||||
String phoneNumber = wxPhone.getPhoneNumber();
|
||||
|
||||
StEmployee stEmployee = stEmployeeService.selectStEmployeeByPhone(phoneNumber);
|
||||
@ -152,6 +156,8 @@ public class SysLoginService
|
||||
stEmployee.setPhone(phoneNumber);
|
||||
stEmployee.setOpenId(login.getOpenid());
|
||||
stEmployee.setRealName("微信用户");
|
||||
stEmployee.setCreateTime(new Date());
|
||||
stEmployee.setUpdateTime(new Date());
|
||||
stEmployeeService.insertStEmployee(stEmployee);
|
||||
}
|
||||
if (stEmployee.getOpenId() == null){
|
||||
@ -192,8 +198,8 @@ public class SysLoginService
|
||||
LoginUser loginUser = null;
|
||||
try
|
||||
{
|
||||
WxLogin login = WxUtil.login(loginCode);
|
||||
WxPhone wxPhone = WxUtil.getPhoneNumber(phoneCode, login.getOpenid());
|
||||
WxLogin login = wxUtil.login(loginCode);
|
||||
WxPhone wxPhone = wxUtil.getPhoneNumber(phoneCode, login.getOpenid());
|
||||
String phoneNumber = wxPhone.getPhoneNumber();
|
||||
|
||||
SysUser user = userService.selectUserByPhone(phoneNumber);
|
||||
|
@ -34,6 +34,8 @@ public class StEmployee extends BaseEntity
|
||||
|
||||
/** 性别 */
|
||||
@Excel(name = "性别")
|
||||
private String sexStr;
|
||||
|
||||
private Integer sex;
|
||||
|
||||
/** 民族 */
|
||||
@ -42,7 +44,7 @@ public class StEmployee extends BaseEntity
|
||||
|
||||
/** 年龄 */
|
||||
@Excel(name = "年龄")
|
||||
private Long age;
|
||||
private Integer age;
|
||||
|
||||
/** 用工单位 */
|
||||
@Excel(name = "用工单位")
|
||||
@ -70,12 +72,31 @@ public class StEmployee extends BaseEntity
|
||||
@Excel(name = "供应商单价")
|
||||
private String supplierPrice;
|
||||
|
||||
/** 用工类型 */
|
||||
private Integer employeeType;
|
||||
|
||||
/** 用工类型 */
|
||||
@Excel(name = "用工类型")
|
||||
private Long employeeType;
|
||||
private String employeeTypeStr;
|
||||
|
||||
private String openId;
|
||||
|
||||
public String getSexStr() {
|
||||
return sexStr;
|
||||
}
|
||||
|
||||
public void setSexStr(String sexStr) {
|
||||
this.sexStr = sexStr;
|
||||
}
|
||||
|
||||
public String getEmployeeTypeStr() {
|
||||
return employeeTypeStr;
|
||||
}
|
||||
|
||||
public void setEmployeeTypeStr(String employeeTypeStr) {
|
||||
this.employeeTypeStr = employeeTypeStr;
|
||||
}
|
||||
|
||||
public String getOpenId() {
|
||||
return openId;
|
||||
}
|
||||
@ -138,12 +159,12 @@ public class StEmployee extends BaseEntity
|
||||
{
|
||||
return nation;
|
||||
}
|
||||
public void setAge(Long age)
|
||||
public void setAge(Integer age)
|
||||
{
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public Long getAge()
|
||||
public Integer getAge()
|
||||
{
|
||||
return age;
|
||||
}
|
||||
@ -201,12 +222,12 @@ public class StEmployee extends BaseEntity
|
||||
{
|
||||
return supplierPrice;
|
||||
}
|
||||
public void setEmployeeType(Long employeeType)
|
||||
public void setEmployeeType(Integer employeeType)
|
||||
{
|
||||
this.employeeType = employeeType;
|
||||
}
|
||||
|
||||
public Long getEmployeeType()
|
||||
public Integer getEmployeeType()
|
||||
{
|
||||
return employeeType;
|
||||
}
|
||||
|
@ -40,6 +40,8 @@ public interface StEmployeeMapper
|
||||
*/
|
||||
public int insertStEmployee(StEmployee stEmployee);
|
||||
|
||||
public int save(StEmployee stEmployee);
|
||||
|
||||
/**
|
||||
* 修改员工
|
||||
*
|
||||
|
@ -61,4 +61,6 @@ public interface IStEmployeeService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteStEmployeeById(Long id);
|
||||
|
||||
String importStEmployee(List<StEmployee> stEmployees);
|
||||
}
|
||||
|
@ -61,6 +61,8 @@ public interface IStTaskService
|
||||
*/
|
||||
public int updateStTask(StTask stTask);
|
||||
public int updateStTask(StTask stTask, boolean syncRelationsTabel);
|
||||
|
||||
void generatePrCode(StTask stTask);
|
||||
/**
|
||||
* 批量删除任务
|
||||
*
|
||||
|
@ -1,15 +1,21 @@
|
||||
package com.staffing.custom.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.staffing.common.core.domain.entity.SysUser;
|
||||
import com.staffing.common.exception.ServiceException;
|
||||
import com.staffing.common.utils.DateUtils;
|
||||
import com.staffing.common.utils.SecurityUtils;
|
||||
import com.staffing.common.utils.StringUtils;
|
||||
import com.staffing.custom.domain.StEmployeeFundRecord;
|
||||
import com.staffing.custom.domain.StTaskSign;
|
||||
import com.staffing.custom.mapper.StEmployeeFundRecordMapper;
|
||||
import com.staffing.custom.mapper.StTaskSignMapper;
|
||||
import com.staffing.custom.service.IStTaskService;
|
||||
import com.staffing.system.service.impl.SysUserServiceImpl;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -37,6 +43,9 @@ public class StEmployeeServiceImpl implements IStEmployeeService
|
||||
|
||||
@Autowired
|
||||
private IStTaskService stTaskService;
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(StEmployeeServiceImpl.class);
|
||||
|
||||
/**
|
||||
* 查询员工
|
||||
*
|
||||
@ -126,4 +135,55 @@ public class StEmployeeServiceImpl implements IStEmployeeService
|
||||
{
|
||||
return stEmployeeMapper.deleteStEmployeeById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String importStEmployee(List<StEmployee> stEmployees)
|
||||
{
|
||||
if (StringUtils.isNull(stEmployees) || stEmployees.size() == 0)
|
||||
{
|
||||
throw new ServiceException("导入数据不能为空!");
|
||||
}
|
||||
int successNum = 0;
|
||||
int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
for (StEmployee record : stEmployees)
|
||||
{
|
||||
try
|
||||
{
|
||||
record.setCreateTime(new Date());
|
||||
record.setEmployeeType("灵活用工".equals(record.getEmployeeTypeStr()) ? 0 : 1);
|
||||
|
||||
if ("男".equals(record.getSexStr())){
|
||||
record.setSex(0);
|
||||
}else if ("女".equals(record.getSexStr())) {
|
||||
record.setSex(1);
|
||||
}else{
|
||||
record.setSex(2);
|
||||
}
|
||||
int i = stEmployeeMapper.save(record);
|
||||
if (i > 0){
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、数据导入修改成功");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、数据导入失败:";
|
||||
failureMsg.append(msg + e.getMessage());
|
||||
log.error(msg, e);
|
||||
}
|
||||
}
|
||||
if (failureNum > 0)
|
||||
{
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.staffing.common.config.EnvConfig;
|
||||
import com.staffing.common.utils.DateUtils;
|
||||
import com.staffing.common.utils.MinioUtil;
|
||||
import com.staffing.common.utils.QRCodeGenerator;
|
||||
@ -52,6 +53,9 @@ public class StTaskServiceImpl implements IStTaskService
|
||||
@Autowired
|
||||
private RedissonClient redissonClient;
|
||||
|
||||
@Autowired
|
||||
EnvConfig envConfig;
|
||||
|
||||
protected final Logger logger = LoggerFactory.getLogger(StTaskServiceImpl.class);
|
||||
|
||||
@Override
|
||||
@ -128,6 +132,7 @@ public class StTaskServiceImpl implements IStTaskService
|
||||
for (StTask task : stTasks) {
|
||||
if (task.getCodePic() == null){
|
||||
generatePrCode(task);
|
||||
updateStTask(stTask);
|
||||
}
|
||||
}
|
||||
|
||||
@ -355,8 +360,9 @@ public class StTaskServiceImpl implements IStTaskService
|
||||
}
|
||||
}
|
||||
|
||||
public int generatePrCode(StTask stTask){
|
||||
String url = "http://www.tulkj.cn:81/index.html?id=" + stTask.getId();
|
||||
public void generatePrCode(StTask stTask){
|
||||
String url = envConfig.getGenPicCodeUrl() + stTask.getId();
|
||||
// String url = "http://www.tulkj.cn:81/index.html?id=" + stTask.getId();
|
||||
InputStream inputStream = QRCodeGenerator.generateQRCodeImage(url, 500, 500);
|
||||
String fileName = System.currentTimeMillis() + stTask.getId() + ".png";
|
||||
try {
|
||||
@ -367,8 +373,6 @@ public class StTaskServiceImpl implements IStTaskService
|
||||
}
|
||||
|
||||
stTask.setCodePic(fileName);
|
||||
|
||||
return updateStTask(stTask);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -95,6 +95,7 @@ public class StTaskSignServiceImpl implements IStTaskSignService
|
||||
taskSign.setDayPrice(stTask.getDayPrice());
|
||||
taskSign.setEmployeeName(taskSign.getEmployeeName());
|
||||
taskSign.setStatus(-1);//未点名
|
||||
taskSign.setCreateTime(new Date());
|
||||
return AjaxResult.success(insertStTaskSign(taskSign));
|
||||
}finally {
|
||||
// 锁被持有
|
||||
|
@ -36,6 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="idCard != null and idCard != ''"> and id_card like concat('%', #{idCard}, '%')</if>
|
||||
<if test="employeeType != null "> and employee_type = #{employeeType}</if>
|
||||
</where>
|
||||
order by create_time desc , update_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectStEmployeeById" parameterType="Long" resultMap="StEmployeeResult">
|
||||
@ -102,6 +103,63 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="save" parameterType="StEmployee" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into st_employee
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="realName != null and realName != ''">real_name,</if>
|
||||
<if test="phone != null and phone != ''">phone,</if>
|
||||
<if test="idCard != null and idCard != ''">id_card,</if>
|
||||
<if test="sex != null">sex,</if>
|
||||
<if test="nation != null">nation,</if>
|
||||
<if test="age != null">age,</if>
|
||||
<if test="useUnit != null">use_unit,</if>
|
||||
<if test="interviewDate != null">interview_date,</if>
|
||||
<if test="entryDate != null">entry_date,</if>
|
||||
<if test="supplier != null">supplier,</if>
|
||||
<if test="employeePrice != null">employee_price,</if>
|
||||
<if test="supplierPrice != null">supplier_price,</if>
|
||||
<if test="employeeType != null">employee_type,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="openId != null">open_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="realName != null and realName != ''">#{realName},</if>
|
||||
<if test="phone != null and phone != ''">#{phone},</if>
|
||||
<if test="idCard != null and idCard != ''">#{idCard},</if>
|
||||
<if test="sex != null">#{sex},</if>
|
||||
<if test="nation != null">#{nation},</if>
|
||||
<if test="age != null">#{age},</if>
|
||||
<if test="useUnit != null">#{useUnit},</if>
|
||||
<if test="interviewDate != null">#{interviewDate},</if>
|
||||
<if test="entryDate != null">#{entryDate},</if>
|
||||
<if test="supplier != null">#{supplier},</if>
|
||||
<if test="employeePrice != null">#{employeePrice},</if>
|
||||
<if test="supplierPrice != null">#{supplierPrice},</if>
|
||||
<if test="employeeType != null">#{employeeType},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="openId != null">#{openId},</if>
|
||||
</trim>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
<trim prefix="" suffixOverrides=",">
|
||||
<if test="realName != null and realName != ''">real_name = #{realName},</if>
|
||||
<if test="idCard != null and idCard != ''">id_card = #{idCard},</if>
|
||||
<if test="sex != null">sex = #{sex},</if>
|
||||
nation = #{nation},
|
||||
age = #{age},
|
||||
interview_date = #{interviewDate},
|
||||
entry_date = #{entryDate},
|
||||
use_unit = #{useUnit},
|
||||
supplier = #{supplier},
|
||||
employee_price = #{employeePrice},
|
||||
supplier_price = #{supplierPrice},
|
||||
<if test="employeeType != null">employee_type = #{employeeType},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
|
||||
</insert>
|
||||
|
||||
<update id="updateStEmployeeOrNull" parameterType="StEmployee">
|
||||
update st_employee
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
|
@ -29,6 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="employeeId != null "> and employee_id = #{employeeId}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectStTaskSignById" parameterType="Long" resultMap="StTaskSignResult">
|
||||
@ -68,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="idCard != null">id_card,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="taskId != null">#{taskId},</if>
|
||||
@ -80,6 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="idCard != null">#{idCard},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<div class="sidebar-logo-container" :class="{'collapse':collapse}" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground }">
|
||||
<transition name="sidebarLogoFade">
|
||||
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
|
||||
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="">
|
||||
<img v-if="logo" :src="logo" class="sidebar-logo" />
|
||||
<h1 v-else class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
|
||||
</router-link>
|
||||
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
|
||||
<router-link v-else key="expand" class="sidebar-logo-link" to="">
|
||||
<!-- <img v-if="logo" :src="logo" class="sidebar-logo" />-->
|
||||
<h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
|
||||
</router-link>
|
||||
|
@ -84,6 +84,16 @@
|
||||
<!-- v-hasPermi="['employee:employee:export']"-->
|
||||
<!-- >导出</el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="info"
|
||||
plain
|
||||
icon="el-icon-upload"
|
||||
size="mini"
|
||||
@click="handleImport"
|
||||
v-hasPermi="['fund:fund:import']"
|
||||
>导入</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
@ -227,12 +237,43 @@
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
<!-- 用户导入对话框 -->
|
||||
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
|
||||
<el-upload
|
||||
ref="upload"
|
||||
:limit="1"
|
||||
accept=".xlsx, .xls"
|
||||
:headers="upload.headers"
|
||||
:action="upload.url + '?updateSupport=' + upload.updateSupport"
|
||||
:disabled="upload.isUploading"
|
||||
:on-progress="handleFileUploadProgress"
|
||||
:on-success="handleFileSuccess"
|
||||
:auto-upload="false"
|
||||
drag
|
||||
>
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
<div class="el-upload__tip text-center" slot="tip">
|
||||
<!-- <div class="el-upload__tip" slot="tip">-->
|
||||
<!-- <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的流水数据-->
|
||||
<!-- </div>-->
|
||||
<span>仅允许导入xls、xlsx格式文件。</span>
|
||||
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="handleExportMoudle">下载模板</el-link>
|
||||
</div>
|
||||
</el-upload>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitFileForm">确 定</el-button>
|
||||
<el-button @click="upload.open = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listEmployee, getEmployee, delEmployee, addEmployee, updateEmployee } from "@/api/employee/employee";
|
||||
|
||||
import { getToken } from "@/utils/auth";
|
||||
export default {
|
||||
name: "Employee",
|
||||
dicts: ['use_type', 'sys_user_sex'],
|
||||
@ -265,6 +306,7 @@ export default {
|
||||
idCard: null,
|
||||
employeeType: null,
|
||||
},
|
||||
phoneInputDisable: true,
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
@ -281,8 +323,23 @@ export default {
|
||||
employeeType: [
|
||||
{ required: true, message: "用工类型不能为空", trigger: "change" }
|
||||
],
|
||||
phoneInputDisable: true,
|
||||
}
|
||||
|
||||
},
|
||||
// 用户导入参数
|
||||
upload: {
|
||||
// 是否显示弹出层(用户导入)
|
||||
open: false,
|
||||
// 弹出层标题(用户导入)
|
||||
title: "",
|
||||
// 是否禁用上传
|
||||
isUploading: false,
|
||||
// 是否更新已经存在的用户数据
|
||||
updateSupport: 0,
|
||||
// 设置上传的请求头部
|
||||
headers: { Authorization: "Bearer " + getToken() },
|
||||
// 上传的地址
|
||||
url: process.env.VUE_APP_BASE_API + "/employee/employee/importData"
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@ -401,6 +458,32 @@ export default {
|
||||
this.download('employee/employee/export', {
|
||||
...this.queryParams
|
||||
}, `employee_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
handleExportMoudle() {
|
||||
this.download('employee/employee/exportMoudle', {
|
||||
...this.queryParams
|
||||
}, `employee_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
|
||||
handleImport() {
|
||||
this.upload.title = "用户导入";
|
||||
this.upload.open = true;
|
||||
},
|
||||
// 文件上传中处理
|
||||
handleFileUploadProgress(event, file, fileList) {
|
||||
this.upload.isUploading = true;
|
||||
},
|
||||
// 文件上传成功处理
|
||||
handleFileSuccess(response, file, fileList) {
|
||||
this.upload.open = false;
|
||||
this.upload.isUploading = false;
|
||||
this.$refs.upload.clearFiles();
|
||||
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
|
||||
this.getList();
|
||||
},
|
||||
// 提交上传文件
|
||||
submitFileForm() {
|
||||
this.$refs.upload.submit();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -285,7 +285,7 @@
|
||||
<!-- <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的流水数据-->
|
||||
<!-- </div>-->
|
||||
<span>仅允许导入xls、xlsx格式文件。</span>
|
||||
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
|
||||
<!-- <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>-->
|
||||
</div>
|
||||
</el-upload>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
|
Loading…
Reference in New Issue
Block a user