Compare commits

...

2 Commits

Author SHA1 Message Date
mx
66431bba67 Merge branch 'main' of http://124.236.46.74:9103/mengxu/staffing into main
# Conflicts:
#	staffing-admin/src/main/java/com/staffing/web/controller/merchant/MerchantUserController.java
2025-02-27 18:45:00 +08:00
mx
20e666c244 帮报名 2025-02-27 18:43:57 +08:00
15 changed files with 235 additions and 32 deletions

View File

@ -136,12 +136,11 @@ public class EmployeeTaskController extends BaseController
user.setPhonenumber(taskSign.getPhone());
user.setIdCard(taskSign.getIdCard());
tokenService.refreshToken(SecurityUtils.getLoginUser());
taskSign.setEmployeeId(userId);
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.enums.BusinessType;
import com.staffing.common.utils.poi.ExcelUtil;
import com.staffing.custom.domain.StEmployeeFundRecord;
import com.staffing.custom.domain.StTask;
import com.staffing.custom.domain.StTaskSign;
import com.staffing.custom.domain.*;
import com.staffing.custom.service.IStEmployeeFundRecordService;
import com.staffing.custom.service.IStTaskService;
import com.staffing.custom.service.IStTaskSignService;
@ -40,6 +38,8 @@ public class MerchantTaskController extends BaseController
private IStTaskSignService stTaskSignService;
@Autowired
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.SysUser;
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.utils.SecurityUtils;
import com.staffing.common.utils.sign.Base64;
import com.staffing.common.utils.uuid.IdUtils;
import com.staffing.custom.domain.StEmployee;
import com.staffing.custom.domain.StTaskSign;
import com.staffing.custom.service.IStEmployeeService;
import com.staffing.framework.web.service.SysLoginService;
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.ISysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.FastByteArrayOutputStream;
import org.springframework.web.bind.annotation.*;
@ -207,6 +210,18 @@ public class MerchantUserController extends BaseController
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
return AjaxResult.success(menuService.buildMenus(menus));
}
/**
* 查询员工列表
*/
@GetMapping("/list")
public TableDataInfo list(StEmployee stEmployee)
{
List<StTaskSign> list = stEmployeeService.selectStEmployeeListAndSign(stEmployee);
return getDataTable(list);
}
@GetMapping("verifyToken")
public AjaxResult verifyToken()
{

View File

@ -6,9 +6,9 @@ spring:
druid:
# 主库数据源
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
password: Ps123456
password: rwWhYfCe3Tzhatep
# 从库数据源
slave:
# 从数据源开关/默认关闭

View File

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

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.WxPhone;
import com.staffing.common.core.domain.WxToken;
import com.staffing.common.core.redis.RedisCache;
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;
import java.util.concurrent.TimeUnit;
@Component
public class WxUtil {
@ -23,8 +25,13 @@ public class WxUtil {
@Autowired
EnvConfig envConfig;
public synchronized WxToken getAccessToken(){
if (wxToken == null || System.currentTimeMillis() > wxToken.getExpiresTime() - 60000){
@Autowired
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<>();
getParam.put("grant_type", "client_credential");
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));
wxToken = JSONObject.parseObject(resJson, WxToken.class);
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<>();
getParam.put("code", code);
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));
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 = "供应商单价")
private String supplierPrice;
/** 用工类型 */
/** 0灵活 1 固定 用工类型 */
private Integer employeeType;
/** 用工类型 */
@ -81,6 +81,18 @@ public class StEmployee extends BaseEntity
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() {
return sexStr;
}
@ -232,6 +244,15 @@ public class StEmployee extends BaseEntity
return employeeType;
}
public String getKeyWord() {
return keyWord;
}
public void setKeyWord(String keyWord) {
this.keyWord = keyWord;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

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

View File

@ -2,6 +2,7 @@ package com.staffing.custom.service;
import java.util.List;
import com.staffing.custom.domain.StEmployee;
import com.staffing.custom.domain.StTaskSign;
/**
* 员工Service接口
@ -28,7 +29,7 @@ public interface IStEmployeeService
* @return 员工集合
*/
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 com.staffing.common.core.domain.AjaxResult;
import com.staffing.custom.domain.StEmployee;
import com.staffing.custom.domain.StTaskSign;
/**
@ -65,4 +66,6 @@ public interface IStTaskSignService
* @return 结果
*/
public int deleteStTaskSignById(Long id);
AjaxResult addEmployeeAndSign(StEmployee stEmployee);
}

View File

@ -1,7 +1,6 @@
package com.staffing.custom.service.impl;
import java.util.Date;
import java.util.List;
import java.util.*;
import com.staffing.common.core.domain.entity.SysUser;
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.service.IStEmployeeService;
import static com.staffing.common.utils.PageUtils.startPage;
/**
* 员工Service业务层处理
*
@ -73,6 +74,37 @@ public class StEmployeeServiceImpl implements IStEmployeeService
{
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.utils.OrderUtils;
import com.staffing.common.utils.SecurityUtils;
import com.staffing.custom.domain.StEmployee;
import com.staffing.custom.domain.StEmployeeFundRecord;
import com.staffing.custom.domain.StTask;
import com.staffing.custom.mapper.StEmployeeFundRecordMapper;
import com.staffing.custom.service.IStEmployeeFundRecordService;
import com.staffing.custom.service.IStEmployeeService;
import com.staffing.custom.service.IStTaskService;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
@ -20,6 +22,7 @@ import org.springframework.stereotype.Service;
import com.staffing.custom.mapper.StTaskSignMapper;
import com.staffing.custom.domain.StTaskSign;
import com.staffing.custom.service.IStTaskSignService;
import org.springframework.transaction.annotation.Transactional;
import static com.staffing.common.core.domain.AjaxResult.error;
@ -42,6 +45,8 @@ public class StTaskSignServiceImpl implements IStTaskSignService
private StEmployeeFundRecordMapper stEmployeeFundRecordMapper;
@Autowired
private RedissonClient redissonClient;
@Autowired
private IStEmployeeService stEmployeeService;
/**
* 查询签到
*
@ -79,9 +84,10 @@ public class StTaskSignServiceImpl implements IStTaskSignService
try{
lock.lock();
SysUser user = SecurityUtils.getLoginUser().getUser();
long userId = user.getUserId();
taskSign.setEmployeeId(userId);
// 放外层因为可能帮报名
// SysUser user = SecurityUtils.getLoginUser().getUser();
// long userId = user.getUserId();
// taskSign.setEmployeeId(userId);
StTask stTask = stTaskService.selectStTaskById(taskSign.getTaskId());
if (stTask.getUseNum() <= stTask.getListSign().size()){
@ -92,8 +98,9 @@ public class StTaskSignServiceImpl implements IStTaskSignService
return error("无法重复报名");
}
}
taskSign.setTaskName(stTask.getTaskName());
taskSign.setDayPrice(stTask.getDayPrice());
taskSign.setEmployeeName(taskSign.getEmployeeName());
// taskSign.setEmployeeName(taskSign.getEmployeeName());
taskSign.setStatus(-1);//未点名
taskSign.setCreateTime(new Date());
return AjaxResult.success(insertStTaskSign(taskSign));
@ -220,4 +227,24 @@ public class StTaskSignServiceImpl implements IStTaskSignService
{
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="idCard != null and idCard != ''"> and id_card like concat('%', #{idCard}, '%')</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>
order by create_time desc , update_time desc
</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="status != null "> and status = #{status}</if>
</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 id="selectStTaskSignById" parameterType="Long" resultMap="StTaskSignResult">