移动端加入

This commit is contained in:
2025-02-15 10:45:23 +08:00
parent 324b01042f
commit 75acf69848
10 changed files with 216 additions and 85 deletions

View File

@@ -88,8 +88,6 @@ public class SysOaFinanceController extends BaseController {
BigDecimal finance0 = iSysOaFinanceService.findFinanceByTime(bo, params0);
Map<String, Object> ajax = new HashMap<>();
ajax.put("income", finance1);
ajax.put("out", finance0);
@@ -155,6 +153,7 @@ public class SysOaFinanceController extends BaseController {
outMap.put("beginTime", firstDay);
outMap.put("endTime", lastDay);
outMap.put("payType",bo.getPayType());
outMap.put("receiveAccountId",bo.getReceiveAccountId());
BigDecimal financeOutReduce = iSysOaFinanceService.findFinanceByTime(bo, outMap);
//收入
@@ -163,6 +162,7 @@ public class SysOaFinanceController extends BaseController {
comeMap.put("beginTime", firstDay);
comeMap.put("endTime", lastDay);
comeMap.put("payType",bo.getPayType());
comeMap.put("receiveAccountId",bo.getReceiveAccountId());
BigDecimal financeComeReduce = iSysOaFinanceService.findFinanceByTime(bo, comeMap);
//收入减支出
BigDecimal subtract = financeComeReduce.subtract(financeOutReduce);

View File

@@ -62,6 +62,7 @@ public interface SysOaFinanceMapper extends BaseMapperPlus<SysOaFinanceMapper, S
* @param params
* @return
*/
List<SysOaFinance> findFinanceByTime(Map params);
/**

View File

@@ -23,6 +23,7 @@ import com.ruoyi.oa.domain.SysOaAttendance;
import com.ruoyi.oa.mapper.SysOaAttendanceMapper;
import com.ruoyi.oa.service.ISysOaAttendanceService;
import javax.validation.constraints.NotNull;
import java.util.*;
import java.util.stream.Collectors;
@@ -97,16 +98,14 @@ public class SysOaAttendanceServiceImpl implements ISysOaAttendanceService {
sysOaAttendanceBo.setProjectId(null);
// 如果这个时间为空,则默认查询当月记录
Date firstDay;
Date lastDay;
if (Objects.isNull(bo.getSelectTime())) {
firstDay = getFirstDay(new Date());
Date lastDay = getLastDay(bo.getSelectTime());
List<SysOaAttendanceVo> sysOaAttendanceVos;
} else {
firstDay = getFirstDay(bo.getSelectTime());
}
lastDay = getLastDay(firstDay);
List<SysOaAttendanceVo> sysOaAttendanceVos = baseMapper.queryListByTime(sysOaAttendanceBo.getUserId(), sysOaAttendanceBo.getAttendanceDay(), firstDay, lastDay);
Date day = getFirstDay(bo.getSelectTime());
firstDay = getFormatDay(bo.getSelectTime(), bo.getAttendanceDay());
sysOaAttendanceVos = baseMapper.queryListByTime(sysOaAttendanceBo.getUserId(), sysOaAttendanceBo.getAttendanceDay(), day, lastDay);
if (sysOaAttendanceVos.isEmpty()) {
bo.setCreateTime(firstDay);
@@ -120,7 +119,11 @@ public class SysOaAttendanceServiceImpl implements ISysOaAttendanceService {
} else {
SysOaAttendanceVo sysOaAttendanceVo = sysOaAttendanceVos.get(0);
sysOaAttendanceVo.setProjectId(bo.getProjectId());
sysOaAttendanceVo.setCreateTime(firstDay);
sysOaAttendanceVo.setDelFlag(0L);
sysOaAttendanceVo.setDayLength(bo.getDayLength()!=null?bo.getDayLength():0);
sysOaAttendanceVo.setHour(bo.getHour()!=null?bo.getHour():0);
return baseMapper.updateDelAttendance(BeanUtil.toBean(sysOaAttendanceVo, SysOaAttendance.class)) > 0;
}
@@ -260,6 +263,11 @@ public class SysOaAttendanceServiceImpl implements ISysOaAttendanceService {
return DateUtils.parseDate(firstDay);
}
private Date getFormatDay(Date time, Long attendanceDay) {
String firstDay = DateUtils.parseDateToStr("yyyy-MM-" + attendanceDay, time);
return DateUtils.parseDate(firstDay);
}
private Date getLastDay(Date time) {
String format = "yyyy-MM-";
// 计算某月的天数

View File

@@ -92,6 +92,7 @@ public class SysOaFinanceServiceImpl implements ISysOaFinanceService {
paramsMap.put("beginTime", params.get("beginTime"));
paramsMap.put("endTime", params.get("endTime"));
paramsMap.put("payType", params.get("payType"));
paramsMap.put("receiveAccountId",params.get("receiveAccountId"));
List<SysOaFinance> financeByTime = baseMapper.findFinanceByTime(paramsMap);
//遍历子表将价格遍历为数组并用map方法求和该方法类型使用map比较妥当
ArrayList<BigDecimal> objects = new ArrayList<>();

View File

@@ -82,7 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateDelAttendance" parameterType="com.ruoyi.oa.domain.SysOaAttendance">
update fad_oa.sys_oa_attendance
<trim prefix="SET" suffixOverrides=",">
<if test="projectId != null and projectId!=''">project_id=#{projectId},</if>
<if test="projectId != null">project_id=#{projectId},</if>
<if test="userId != null and userId!=''">user_id = #{userId},</if>
<if test="attendanceDay != null and attendanceDay!=''">attendance_day = #{attendanceDay},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
@@ -90,6 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="dayLength != null and dayLength!=''">day_length = #{dayLength},</if>
<if test="hour != null and hour!=''">hour = #{hour},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>

View File

@@ -161,9 +161,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="findFinanceByTime" resultMap="SysOaFinanceResult">
<include refid="selectFinanceVo" />
where a.finance_type = #{financeType}
<if test=" payType!=NULL and payType!=null and payType !='0' ">
<if test=" payType!=NULL and payType!=null and payType !='0' and payType!=0 ">
and a.pay_type = #{payType}
</if>
<if test=" receiveAccountId!=NULL and receiveAccountId!=null and receiveAccountId!='-1' ">
and a.receive_account_id = #{receiveAccountId}
</if>
and a.project_id = 0
and date_format(a.finance_time,'%Y-%m-%d %H:%i:%s') >= date_format(#{beginTime},'%Y-%m-%d %H:%i:%s')
and date_format(a.finance_time,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%Y-%m-%d %H:%i:%s')

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.oa.mapper.SysOaProjectMapper">
<resultMap type="com.ruoyi.oa.domain.SysOaProject" id="SysOaProjectResult">
@@ -82,7 +82,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectPageOutList" resultMap="SysOaOutWarehouseListVoResult">
select sop.project_id, project_name,soow.warehouse_id,soow.id as soow_id,soow.amount,soow.create_time as out_create_time,sow.name
select sop.project_id,
project_name,
soow.warehouse_id,
soow.id as soow_id,
soow.amount,
soow.create_time as out_create_time,
sow.name
from sys_oa_project sop
left join sys_oa_out_warehouse soow on soow.project_id = sop.project_id
left join sys_oa_warehouse sow on sow.id = soow.warehouse_id
@@ -90,21 +96,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="getProjectDataByMonth" resultType="com.ruoyi.oa.domain.vo.SysOaProjectVo">
select sum(soa.day_length+soa.hour/8) as labor_cost ,color,sop.project_name from sys_oa_project sop
left join sys_oa_attendance soa on sop.project_id = soa.project_id
select sum(soa.day_length + soa.hour / 8) as labor_cost, color, sop.project_name
from sys_oa_project sop
left join sys_oa_attendance soa on sop.project_id = soa.project_id
where soa.create_time between #{firstDay} and #{lastDay}
and soa.del_flag = '0'
and soa.del_flag = '0'
group by sop.project_id
</select>
<select id="getProjectDataByMonthAndDate" resultType="com.ruoyi.oa.domain.vo.SysOaProjectVo">
select sum(soa.day_length+soa.hour/8) as labor_cost ,color,sop.project_name,date_format(soa.create_time,'%Y-%m-%d') as create_time from sys_oa_project sop
left join sys_oa_attendance soa on sop.project_id = soa.project_id
select sum(soa.day_length + soa.hour / 8) as labor_cost,
color,
sop.project_name,
date_format(soa.create_time, '%Y-%m-%d') as create_time
from sys_oa_project sop
left join sys_oa_attendance soa on sop.project_id = soa.project_id
where soa.create_time between #{firstDay} and #{lastDay}
and soa.del_flag = '0'
group by sop.project_id,create_time
</select>
</mapper>