帮报名

This commit is contained in:
mx 2025-02-27 18:43:57 +08:00
parent 76f68055a9
commit 20e666c244
15 changed files with 234 additions and 32 deletions

View File

@ -95,12 +95,11 @@ public class EmployeeTaskController extends BaseController
user.setPhonenumber(taskSign.getPhone()); user.setPhonenumber(taskSign.getPhone());
user.setIdCard(taskSign.getIdCard()); user.setIdCard(taskSign.getIdCard());
tokenService.refreshToken(SecurityUtils.getLoginUser()); tokenService.refreshToken(SecurityUtils.getLoginUser());
taskSign.setEmployeeId(userId);
return stTaskSignService.baoming(taskSign); return stTaskSignService.baoming(taskSign);
} }
/** /**
* 修改签到 * 修改签到
*/ */

View File

@ -8,9 +8,7 @@ import com.staffing.common.core.domain.AjaxResult;
import com.staffing.common.core.page.TableDataInfo; import com.staffing.common.core.page.TableDataInfo;
import com.staffing.common.enums.BusinessType; import com.staffing.common.enums.BusinessType;
import com.staffing.common.utils.poi.ExcelUtil; import com.staffing.common.utils.poi.ExcelUtil;
import com.staffing.custom.domain.StEmployeeFundRecord; import com.staffing.custom.domain.*;
import com.staffing.custom.domain.StTask;
import com.staffing.custom.domain.StTaskSign;
import com.staffing.custom.service.IStEmployeeFundRecordService; import com.staffing.custom.service.IStEmployeeFundRecordService;
import com.staffing.custom.service.IStTaskService; import com.staffing.custom.service.IStTaskService;
import com.staffing.custom.service.IStTaskSignService; import com.staffing.custom.service.IStTaskSignService;
@ -40,6 +38,8 @@ public class MerchantTaskController extends BaseController
private IStTaskSignService stTaskSignService; private IStTaskSignService stTaskSignService;
@Autowired @Autowired
private IStEmployeeFundRecordService employeeFundRecordService; private IStEmployeeFundRecordService employeeFundRecordService;
/** /**
* 查询任务列表 * 查询任务列表
*/ */
@ -93,4 +93,44 @@ public class MerchantTaskController extends BaseController
} }
@PutMapping("/baomingBatch")
@PreAuthorize("@ss.hasPermi('task:edit')")
public AjaxResult baomingBatch(@RequestBody BaomingBatchBo baomingBatchBo)
{
if (baomingBatchBo.getList() == null || baomingBatchBo.getList().size() == 0){
return AjaxResult.error("所选人员为空");
}
if (baomingBatchBo.getTaskId() == null || baomingBatchBo.getTaskId() == 0){
return AjaxResult.error("任务id为空");
}
for (StTaskSign stTaskSign : baomingBatchBo.getList()) {
stTaskSign.setTaskId(baomingBatchBo.getTaskId());
AjaxResult baoming = stTaskSignService.baoming(stTaskSign);
if (baoming.isError()){
return baoming;
}
}
return AjaxResult.success();
}
/**
* 修改签到
*/
@GetMapping("/cancelBaoming")
@PreAuthorize("@ss.hasPermi('task:edit')")
public AjaxResult cancelBaoming(StTaskSign taskSign)
{
return toAjax(stTaskSignService.deleteStTaskSignById(taskSign.getId()));
}
/**
* 新增员工
*/
@PutMapping("addEmployeeAndSign")
@PreAuthorize("@ss.hasPermi('task:edit')")
public AjaxResult addEmployeeAndSign(@RequestBody StEmployee stEmployee)
{
return stTaskSignService.addEmployeeAndSign(stEmployee);
}
} }

View File

@ -9,11 +9,13 @@ import com.staffing.common.core.domain.AjaxResult;
import com.staffing.common.core.domain.entity.SysMenu; import com.staffing.common.core.domain.entity.SysMenu;
import com.staffing.common.core.domain.entity.SysUser; import com.staffing.common.core.domain.entity.SysUser;
import com.staffing.common.core.domain.model.LoginBody; import com.staffing.common.core.domain.model.LoginBody;
import com.staffing.common.core.page.TableDataInfo;
import com.staffing.common.core.redis.RedisCache; import com.staffing.common.core.redis.RedisCache;
import com.staffing.common.utils.SecurityUtils; import com.staffing.common.utils.SecurityUtils;
import com.staffing.common.utils.sign.Base64; import com.staffing.common.utils.sign.Base64;
import com.staffing.common.utils.uuid.IdUtils; import com.staffing.common.utils.uuid.IdUtils;
import com.staffing.custom.domain.StEmployee; import com.staffing.custom.domain.StEmployee;
import com.staffing.custom.domain.StTaskSign;
import com.staffing.custom.service.IStEmployeeService; import com.staffing.custom.service.IStEmployeeService;
import com.staffing.framework.web.service.SysLoginService; import com.staffing.framework.web.service.SysLoginService;
import com.staffing.framework.web.service.SysPermissionService; import com.staffing.framework.web.service.SysPermissionService;
@ -21,6 +23,7 @@ import com.staffing.framework.web.service.TokenService;
import com.staffing.system.service.ISysConfigService; import com.staffing.system.service.ISysConfigService;
import com.staffing.system.service.ISysMenuService; import com.staffing.system.service.ISysMenuService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.FastByteArrayOutputStream; import org.springframework.util.FastByteArrayOutputStream;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -207,5 +210,16 @@ public class MerchantUserController extends BaseController
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId); List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
return AjaxResult.success(menuService.buildMenus(menus)); return AjaxResult.success(menuService.buildMenus(menus));
} }
/**
* 查询员工列表
*/
@GetMapping("/list")
public TableDataInfo list(StEmployee stEmployee)
{
List<StTaskSign> list = stEmployeeService.selectStEmployeeListAndSign(stEmployee);
return getDataTable(list);
}
} }

View File

@ -6,9 +6,9 @@ spring:
druid: druid:
# 主库数据源 # 主库数据源
master: master:
url: jdbc:mysql://192.168.18.119:3308/staffing?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://124.236.46.74:9100/staffing?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root username: root
password: Ps123456 password: rwWhYfCe3Tzhatep
# 从库数据源 # 从库数据源
slave: slave:
# 从数据源开关/默认关闭 # 从数据源开关/默认关闭

View File

@ -68,13 +68,13 @@ spring:
# redis 配置 # redis 配置
redis: redis:
# 地址 # 地址
host: 192.168.18.119 host: 8.155.21.176
# 端口默认为6379 # 端口默认为6379
port: 6378 port: 6379
# 数据库索引 # 数据库索引
database: 0 database: 0
# 密码 # 密码
password: 12345 password: ps12345
# 连接超时时间 # 连接超时时间
timeout: 10s timeout: 10s
lettuce: lettuce:
@ -170,13 +170,13 @@ minio:
access-key: root 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: #env:
# genPicCodeUrl: http://www.tulkj.cn:81/index.html?id= # genPicCodeUrl: http://yg.pusonggroup.com:81/index.html?id=
# picPrefix: https://www.tulkj.cn/file/yonggong/ # picPrefix: https://www.tulkj.cn/file/yonggong/
# appId: wx26e952dad7a8aae5 # appId: wx7bc7df6eb945a84f
# secret: 60a85e94d921a385ce52faaaed4a103b # secret: 60dc8f7e8c850dfbe0170acefa48070a
env:
genPicCodeUrl: http://www.tulkj.cn:81/index.html?id=
picPrefix: https://www.tulkj.cn/file/yonggong/
appId: wx26e952dad7a8aae5
secret: 60a85e94d921a385ce52faaaed4a103b

View File

@ -5,12 +5,14 @@ import com.staffing.common.config.EnvConfig;
import com.staffing.common.core.domain.WxLogin; import com.staffing.common.core.domain.WxLogin;
import com.staffing.common.core.domain.WxPhone; import com.staffing.common.core.domain.WxPhone;
import com.staffing.common.core.domain.WxToken; import com.staffing.common.core.domain.WxToken;
import com.staffing.common.core.redis.RedisCache;
import com.staffing.common.utils.http.HttpUtils; import com.staffing.common.utils.http.HttpUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit;
@Component @Component
public class WxUtil { public class WxUtil {
@ -23,8 +25,13 @@ public class WxUtil {
@Autowired @Autowired
EnvConfig envConfig; EnvConfig envConfig;
public synchronized WxToken getAccessToken(){ @Autowired
if (wxToken == null || System.currentTimeMillis() > wxToken.getExpiresTime() - 60000){ private RedisCache redisCache;
private String TOKENKEY = "WX_TOKEN";
public synchronized String getAccessToken(){
String token = redisCache.getCacheObject(TOKENKEY);
if (token == null){
Map<String, String > getParam = new HashMap<>(); Map<String, String > getParam = new HashMap<>();
getParam.put("grant_type", "client_credential"); getParam.put("grant_type", "client_credential");
getParam.put("appid", envConfig.getAppId()); getParam.put("appid", envConfig.getAppId());
@ -32,8 +39,19 @@ public class WxUtil {
String resJson = HttpUtils.sendGet("https://api.weixin.qq.com/cgi-bin/token", HttpUtils.getParam(getParam)); String resJson = HttpUtils.sendGet("https://api.weixin.qq.com/cgi-bin/token", HttpUtils.getParam(getParam));
wxToken = JSONObject.parseObject(resJson, WxToken.class); wxToken = JSONObject.parseObject(resJson, WxToken.class);
wxToken.setExpiresTime(wxToken.getExpires_in() * 1000 + System.currentTimeMillis()); wxToken.setExpiresTime(wxToken.getExpires_in() * 1000 + System.currentTimeMillis());
redisCache.setCacheObject(TOKENKEY, wxToken.getAccess_token(), wxToken.getExpires_in(), TimeUnit.MINUTES);
} }
return wxToken; return token;
// if (wxToken == null || System.currentTimeMillis() > wxToken.getExpiresTime() - 60000){
// Map<String, String > getParam = new HashMap<>();
// getParam.put("grant_type", "client_credential");
// 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());
// }
// return wxToken;
} }
/** /**
@ -46,7 +64,7 @@ public class WxUtil {
Map<String, String > getParam = new HashMap<>(); Map<String, String > getParam = new HashMap<>();
getParam.put("code", code); getParam.put("code", code);
getParam.put("openid", openId); getParam.put("openid", openId);
String url = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=" + getAccessToken().getAccess_token(); String url = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=" + getAccessToken();
String resJson = HttpUtils.sendPost(url, JSONObject.toJSONString(getParam)); String resJson = HttpUtils.sendPost(url, JSONObject.toJSONString(getParam));
WxPhone wxPhone = JSONObject.parseObject(resJson, WxPhone.class); WxPhone wxPhone = JSONObject.parseObject(resJson, WxPhone.class);

View File

@ -0,0 +1,25 @@
package com.staffing.custom.domain;
import java.util.List;
public class BaomingBatchBo {
private List<StTaskSign> list;
private Long taskId;
public List<StTaskSign> getList() {
return list;
}
public void setList(List<StTaskSign> list) {
this.list = list;
}
public Long getTaskId() {
return taskId;
}
public void setTaskId(Long taskId) {
this.taskId = taskId;
}
}

View File

@ -72,7 +72,7 @@ public class StEmployee extends BaseEntity
@Excel(name = "供应商单价") @Excel(name = "供应商单价")
private String supplierPrice; private String supplierPrice;
/** 用工类型 */ /** 0灵活 1 固定 用工类型 */
private Integer employeeType; private Integer employeeType;
/** 用工类型 */ /** 用工类型 */
@ -81,6 +81,18 @@ public class StEmployee extends BaseEntity
private String openId; private String openId;
private String keyWord;
private Long taskId;
public Long getTaskId() {
return taskId;
}
public void setTaskId(Long taskId) {
this.taskId = taskId;
}
public String getSexStr() { public String getSexStr() {
return sexStr; return sexStr;
} }
@ -232,6 +244,15 @@ public class StEmployee extends BaseEntity
return employeeType; return employeeType;
} }
public String getKeyWord() {
return keyWord;
}
public void setKeyWord(String keyWord) {
this.keyWord = keyWord;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -62,6 +62,20 @@ public class StTaskSign extends BaseEntity
@Excel(name = "二次核验备注") @Excel(name = "二次核验备注")
private String remark; private String remark;
/**
* 排序类型 1 为正序 空为倒叙
*/
private Integer orderType;
public Integer getOrderType() {
return orderType;
}
public void setOrderType(Integer orderType) {
this.orderType = orderType;
}
public String getStatusStr() { public String getStatusStr() {
return statusStr; return statusStr;
} }

View File

@ -2,6 +2,7 @@ package com.staffing.custom.service;
import java.util.List; import java.util.List;
import com.staffing.custom.domain.StEmployee; import com.staffing.custom.domain.StEmployee;
import com.staffing.custom.domain.StTaskSign;
/** /**
* 员工Service接口 * 员工Service接口
@ -28,7 +29,7 @@ public interface IStEmployeeService
* @return 员工集合 * @return 员工集合
*/ */
public List<StEmployee> selectStEmployeeList(StEmployee stEmployee); public List<StEmployee> selectStEmployeeList(StEmployee stEmployee);
List<StTaskSign> selectStEmployeeListAndSign(StEmployee stEmployee);
/** /**
* 新增员工 * 新增员工
* *

View File

@ -3,6 +3,7 @@ package com.staffing.custom.service;
import java.util.List; import java.util.List;
import com.staffing.common.core.domain.AjaxResult; import com.staffing.common.core.domain.AjaxResult;
import com.staffing.custom.domain.StEmployee;
import com.staffing.custom.domain.StTaskSign; import com.staffing.custom.domain.StTaskSign;
/** /**
@ -65,4 +66,6 @@ public interface IStTaskSignService
* @return 结果 * @return 结果
*/ */
public int deleteStTaskSignById(Long id); public int deleteStTaskSignById(Long id);
AjaxResult addEmployeeAndSign(StEmployee stEmployee);
} }

View File

@ -1,7 +1,6 @@
package com.staffing.custom.service.impl; package com.staffing.custom.service.impl;
import java.util.Date; import java.util.*;
import java.util.List;
import com.staffing.common.core.domain.entity.SysUser; import com.staffing.common.core.domain.entity.SysUser;
import com.staffing.common.exception.ServiceException; import com.staffing.common.exception.ServiceException;
@ -23,6 +22,8 @@ import com.staffing.custom.mapper.StEmployeeMapper;
import com.staffing.custom.domain.StEmployee; import com.staffing.custom.domain.StEmployee;
import com.staffing.custom.service.IStEmployeeService; import com.staffing.custom.service.IStEmployeeService;
import static com.staffing.common.utils.PageUtils.startPage;
/** /**
* 员工Service业务层处理 * 员工Service业务层处理
* *
@ -73,6 +74,37 @@ public class StEmployeeServiceImpl implements IStEmployeeService
{ {
return stEmployeeMapper.selectStEmployeeList(stEmployee); return stEmployeeMapper.selectStEmployeeList(stEmployee);
} }
@Override
public List<StTaskSign> selectStEmployeeListAndSign(StEmployee stEmployee)
{
Map<Long, StTaskSign> result = new LinkedHashMap();
StTaskSign param = new StTaskSign();
param.setTaskId(stEmployee.getTaskId());
param.setOrderType(1);
List<StTaskSign> stTaskSignsTemp = stTaskSignMapper.selectStTaskSignList(param);
for (StTaskSign stTaskSign : stTaskSignsTemp) {
stTaskSign.setStatus(0);
result.put(stTaskSign.getEmployeeId(), stTaskSign);
}
startPage();
List<StEmployee> stEmployees = stEmployeeMapper.selectStEmployeeList(stEmployee);
for (StEmployee stEmployee1 : stEmployees) {
if (result.containsKey(stEmployee1.getId())){
continue;
}
StTaskSign stTaskSign = new StTaskSign();
stTaskSign.setTaskId(stEmployee1.getTaskId());
stTaskSign.setEmployeeName(stEmployee1.getRealName());
stTaskSign.setPhone(stEmployee1.getPhone());
stTaskSign.setIdCard(stEmployee1.getIdCard());
stTaskSign.setEmployeeId(stEmployee1.getId());
stTaskSign.setStatus(2);
result.put(stEmployee1.getId(), stTaskSign);
}
return new ArrayList<>(result.values());
}
/** /**
* 新增员工 * 新增员工

View File

@ -8,10 +8,12 @@ import com.staffing.common.core.domain.AjaxResult;
import com.staffing.common.core.domain.entity.SysUser; import com.staffing.common.core.domain.entity.SysUser;
import com.staffing.common.utils.OrderUtils; import com.staffing.common.utils.OrderUtils;
import com.staffing.common.utils.SecurityUtils; import com.staffing.common.utils.SecurityUtils;
import com.staffing.custom.domain.StEmployee;
import com.staffing.custom.domain.StEmployeeFundRecord; import com.staffing.custom.domain.StEmployeeFundRecord;
import com.staffing.custom.domain.StTask; import com.staffing.custom.domain.StTask;
import com.staffing.custom.mapper.StEmployeeFundRecordMapper; import com.staffing.custom.mapper.StEmployeeFundRecordMapper;
import com.staffing.custom.service.IStEmployeeFundRecordService; import com.staffing.custom.service.IStEmployeeFundRecordService;
import com.staffing.custom.service.IStEmployeeService;
import com.staffing.custom.service.IStTaskService; import com.staffing.custom.service.IStTaskService;
import org.redisson.api.RLock; import org.redisson.api.RLock;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
@ -20,6 +22,7 @@ import org.springframework.stereotype.Service;
import com.staffing.custom.mapper.StTaskSignMapper; import com.staffing.custom.mapper.StTaskSignMapper;
import com.staffing.custom.domain.StTaskSign; import com.staffing.custom.domain.StTaskSign;
import com.staffing.custom.service.IStTaskSignService; import com.staffing.custom.service.IStTaskSignService;
import org.springframework.transaction.annotation.Transactional;
import static com.staffing.common.core.domain.AjaxResult.error; import static com.staffing.common.core.domain.AjaxResult.error;
@ -42,6 +45,8 @@ public class StTaskSignServiceImpl implements IStTaskSignService
private StEmployeeFundRecordMapper stEmployeeFundRecordMapper; private StEmployeeFundRecordMapper stEmployeeFundRecordMapper;
@Autowired @Autowired
private RedissonClient redissonClient; private RedissonClient redissonClient;
@Autowired
private IStEmployeeService stEmployeeService;
/** /**
* 查询签到 * 查询签到
* *
@ -79,9 +84,10 @@ public class StTaskSignServiceImpl implements IStTaskSignService
try{ try{
lock.lock(); lock.lock();
SysUser user = SecurityUtils.getLoginUser().getUser(); // 放外层因为可能帮报名
long userId = user.getUserId(); // SysUser user = SecurityUtils.getLoginUser().getUser();
taskSign.setEmployeeId(userId); // long userId = user.getUserId();
// taskSign.setEmployeeId(userId);
StTask stTask = stTaskService.selectStTaskById(taskSign.getTaskId()); StTask stTask = stTaskService.selectStTaskById(taskSign.getTaskId());
if (stTask.getUseNum() <= stTask.getListSign().size()){ if (stTask.getUseNum() <= stTask.getListSign().size()){
@ -92,8 +98,9 @@ public class StTaskSignServiceImpl implements IStTaskSignService
return error("无法重复报名"); return error("无法重复报名");
} }
} }
taskSign.setTaskName(stTask.getTaskName());
taskSign.setDayPrice(stTask.getDayPrice()); taskSign.setDayPrice(stTask.getDayPrice());
taskSign.setEmployeeName(taskSign.getEmployeeName()); // taskSign.setEmployeeName(taskSign.getEmployeeName());
taskSign.setStatus(-1);//未点名 taskSign.setStatus(-1);//未点名
taskSign.setCreateTime(new Date()); taskSign.setCreateTime(new Date());
return AjaxResult.success(insertStTaskSign(taskSign)); return AjaxResult.success(insertStTaskSign(taskSign));
@ -220,4 +227,24 @@ public class StTaskSignServiceImpl implements IStTaskSignService
{ {
return stTaskSignMapper.deleteStTaskSignById(id); return stTaskSignMapper.deleteStTaskSignById(id);
} }
@Override
@Transactional
public AjaxResult addEmployeeAndSign(StEmployee stEmployee){
StEmployee stEmployee1 = stEmployeeService.selectStEmployeeByPhone(stEmployee.getPhone());
if (stEmployee1 != null){
return AjaxResult.error("手机号已存在");
}
stEmployee.setUpdateTime(new Date());
stEmployee.setCreateTime(new Date());
stEmployeeService.insertStEmployee(stEmployee);
StTaskSign taskSign = new StTaskSign();
taskSign.setTaskId(stEmployee.getTaskId());
taskSign.setEmployeeId(stEmployee.getId());
taskSign.setEmployeeName(stEmployee.getRealName());
taskSign.setPhone(stEmployee.getPhone());
taskSign.setIdCard(stEmployee.getIdCard());
return baoming(taskSign);
}
} }

View File

@ -35,6 +35,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="phone != null and phone != ''"> and phone like concat('%', #{phone}, '%')</if> <if test="phone != null and phone != ''"> and phone like concat('%', #{phone}, '%')</if>
<if test="idCard != null and idCard != ''"> and id_card like concat('%', #{idCard}, '%')</if> <if test="idCard != null and idCard != ''"> and id_card like concat('%', #{idCard}, '%')</if>
<if test="employeeType != null "> and employee_type = #{employeeType}</if> <if test="employeeType != null "> and employee_type = #{employeeType}</if>
<if test="keyWord != null and keyWord != ''"> and (real_name like concat('%', #{keyWord}, '%') or phone like concat('%', #{keyWord}, '%'))</if>
</where> </where>
order by create_time desc , update_time desc order by create_time desc , update_time desc
</select> </select>

View File

@ -29,7 +29,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="employeeId != null "> and employee_id = #{employeeId}</if> <if test="employeeId != null "> and employee_id = #{employeeId}</if>
<if test="status != null "> and status = #{status}</if> <if test="status != null "> and status = #{status}</if>
</where> </where>
order by create_time desc <if test="orderType == 1">
order by create_time
</if>
<if test="orderType == null">
order by create_time desc
</if>
</select> </select>
<select id="selectStTaskSignById" parameterType="Long" resultMap="StTaskSignResult"> <select id="selectStTaskSignById" parameterType="Long" resultMap="StTaskSignResult">