From 10a200a9efc54e2a3c756882d8da3aaf1305aa44 Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期一, 12 八月 2024 15:22:31 +0800 Subject: [PATCH] 2024-08-12 朱宝民 指定时间段内注册虚拟卡农户、代码优化(yearMonth) --- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClientRegisterVC.java | 27 +++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVcOperateMapper.java | 18 ++ pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java | 8 + pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientSv.java | 7 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/qo/CommonQO.java | 31 +++ pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVcOperateMapper.xml | 268 +++++++++++++++++++-------------- pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/VirtualCardSv.java | 51 ++++++ pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/VirtualCardCtrl.java | 33 ++++ 8 files changed, 326 insertions(+), 117 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVcOperateMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVcOperateMapper.java index 95c21b5..f58c98d 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVcOperateMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVcOperateMapper.java @@ -2,7 +2,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dy.pipIrrGlobal.pojoSe.SeVcOperate; +import com.dy.pipIrrGlobal.voSt.VoClientRegisterVC; import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; /** * @author ZhuBaoMin @@ -24,4 +28,18 @@ int updateByPrimaryKeySelective(SeVcOperate record); int updateByPrimaryKey(SeVcOperate record); + + /** + * 鎸囧畾鏃堕棿娈靛唴娉ㄥ唽铏氭嫙鍗$殑鍐滄埛璁板綍鏁伴噺 + * @param params + * @return + */ + Long getRegisterVcClientsCount(Map<?, ?> params); + + /** + * 鎸囧畾鏃堕棿娈靛唴娉ㄥ唽铏氭嫙鍗$殑鍐滄埛 + * @param params + * @return + */ + List<VoClientRegisterVC> getRegisterVcClients(Map<?, ?> params); } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClientRegisterVC.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClientRegisterVC.java new file mode 100644 index 0000000..38f4990 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSt/VoClientRegisterVC.java @@ -0,0 +1,27 @@ +package com.dy.pipIrrGlobal.voSt; + +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import lombok.Data; + +/** + * @author ZhuBaoMin + * @date 2024-08-12 14:37 + * @LastEditTime 2024-08-12 14:37 + * @Description 鍐滄埛娉ㄥ唽铏氭嫙鍗¤鍥� + */ + +@Data +@JsonPropertyOrder({"clientId","clientName"}) +public class VoClientRegisterVC { + private static final long serialVersionUID = 202408121438001L; + + /** + * 鍐滄埛ID + */ + private Long clientId; + + /** + * 鍐滄埛濮撳悕 + */ + private String clientName; +} diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVcOperateMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVcOperateMapper.xml index 0e5b341..6093285 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVcOperateMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVcOperateMapper.xml @@ -1,126 +1,162 @@ <?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"> <mapper namespace="com.dy.pipIrrGlobal.daoSe.SeVcOperateMapper"> - <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeVcOperate"> - <!--@mbg.generated--> - <!--@Table se_vc_operate--> - <id column="id" jdbcType="BIGINT" property="id" /> - <result column="vc_id" jdbcType="BIGINT" property="vcId" /> - <result column="client_id" jdbcType="BIGINT" property="clientId" /> - <result column="operate_type" jdbcType="TINYINT" property="operateType" /> - <result column="recharge_id" jdbcType="BIGINT" property="rechargeId" /> - <result column="operator" jdbcType="BIGINT" property="operator" /> - <result column="operate_time" jdbcType="TIMESTAMP" property="operateTime" /> - </resultMap> - <sql id="Base_Column_List"> - <!--@mbg.generated--> - id, vc_id, client_id, operate_type, recharge_id, `operator`, operate_time - </sql> - <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> - <!--@mbg.generated--> - select - <include refid="Base_Column_List" /> - from se_vc_operate - where id = #{id,jdbcType=BIGINT} - </select> - <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> - <!--@mbg.generated--> - delete from se_vc_operate - where id = #{id,jdbcType=BIGINT} - </delete> - <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcOperate"> - <!--@mbg.generated--> - insert into se_vc_operate (id, vc_id, client_id, - operate_type, recharge_id, `operator`, - operate_time) - values (#{id,jdbcType=BIGINT}, #{vcId,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT}, - #{operateType,jdbcType=TINYINT}, #{rechargeId,jdbcType=BIGINT}, #{operator,jdbcType=BIGINT}, - #{operateTime,jdbcType=TIMESTAMP}) - </insert> - <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcOperate"> - <!--@mbg.generated--> - insert into se_vc_operate - <trim prefix="(" suffix=")" suffixOverrides=","> - <if test="id != null"> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeVcOperate"> + <!--@mbg.generated--> + <!--@Table se_vc_operate--> + <id column="id" jdbcType="BIGINT" property="id"/> + <result column="vc_id" jdbcType="BIGINT" property="vcId"/> + <result column="client_id" jdbcType="BIGINT" property="clientId"/> + <result column="operate_type" jdbcType="TINYINT" property="operateType"/> + <result column="recharge_id" jdbcType="BIGINT" property="rechargeId"/> + <result column="operator" jdbcType="BIGINT" property="operator"/> + <result column="operate_time" jdbcType="TIMESTAMP" property="operateTime"/> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> id, - </if> - <if test="vcId != null"> vc_id, - </if> - <if test="clientId != null"> client_id, - </if> - <if test="operateType != null"> operate_type, - </if> - <if test="rechargeId != null"> recharge_id, - </if> - <if test="operator != null"> `operator`, - </if> - <if test="operateTime != null"> - operate_time, - </if> - </trim> - <trim prefix="values (" suffix=")" suffixOverrides=","> - <if test="id != null"> - #{id,jdbcType=BIGINT}, - </if> - <if test="vcId != null"> - #{vcId,jdbcType=BIGINT}, - </if> - <if test="clientId != null"> - #{clientId,jdbcType=BIGINT}, - </if> - <if test="operateType != null"> - #{operateType,jdbcType=TINYINT}, - </if> - <if test="rechargeId != null"> - #{rechargeId,jdbcType=BIGINT}, - </if> - <if test="operator != null"> - #{operator,jdbcType=BIGINT}, - </if> - <if test="operateTime != null"> - #{operateTime,jdbcType=TIMESTAMP}, - </if> - </trim> - </insert> - <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcOperate"> - <!--@mbg.generated--> - update se_vc_operate - <set> - <if test="vcId != null"> - vc_id = #{vcId,jdbcType=BIGINT}, - </if> - <if test="clientId != null"> - client_id = #{clientId,jdbcType=BIGINT}, - </if> - <if test="operateType != null"> - operate_type = #{operateType,jdbcType=TINYINT}, - </if> - <if test="rechargeId != null"> - recharge_id = #{rechargeId,jdbcType=BIGINT}, - </if> - <if test="operator != null"> - `operator` = #{operator,jdbcType=BIGINT}, - </if> - <if test="operateTime != null"> - operate_time = #{operateTime,jdbcType=TIMESTAMP}, - </if> - </set> - where id = #{id,jdbcType=BIGINT} - </update> - <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcOperate"> - <!--@mbg.generated--> - update se_vc_operate - set vc_id = #{vcId,jdbcType=BIGINT}, - client_id = #{clientId,jdbcType=BIGINT}, - operate_type = #{operateType,jdbcType=TINYINT}, - recharge_id = #{rechargeId,jdbcType=BIGINT}, - `operator` = #{operator,jdbcType=BIGINT}, - operate_time = #{operateTime,jdbcType=TIMESTAMP} - where id = #{id,jdbcType=BIGINT} - </update> + operate_time + </sql> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List"/> + from se_vc_operate + where id = #{id,jdbcType=BIGINT} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete + from se_vc_operate + where id = #{id,jdbcType=BIGINT} + </delete> + <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcOperate"> + <!--@mbg.generated--> + insert into se_vc_operate (id, vc_id, client_id, + operate_type, recharge_id, `operator`, + operate_time) + values (#{id,jdbcType=BIGINT}, #{vcId,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT}, + #{operateType,jdbcType=TINYINT}, #{rechargeId,jdbcType=BIGINT}, #{operator,jdbcType=BIGINT}, + #{operateTime,jdbcType=TIMESTAMP}) + </insert> + <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcOperate"> + <!--@mbg.generated--> + insert into se_vc_operate + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="vcId != null"> + vc_id, + </if> + <if test="clientId != null"> + client_id, + </if> + <if test="operateType != null"> + operate_type, + </if> + <if test="rechargeId != null"> + recharge_id, + </if> + <if test="operator != null"> + `operator`, + </if> + <if test="operateTime != null"> + operate_time, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=BIGINT}, + </if> + <if test="vcId != null"> + #{vcId,jdbcType=BIGINT}, + </if> + <if test="clientId != null"> + #{clientId,jdbcType=BIGINT}, + </if> + <if test="operateType != null"> + #{operateType,jdbcType=TINYINT}, + </if> + <if test="rechargeId != null"> + #{rechargeId,jdbcType=BIGINT}, + </if> + <if test="operator != null"> + #{operator,jdbcType=BIGINT}, + </if> + <if test="operateTime != null"> + #{operateTime,jdbcType=TIMESTAMP}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcOperate"> + <!--@mbg.generated--> + update se_vc_operate + <set> + <if test="vcId != null"> + vc_id = #{vcId,jdbcType=BIGINT}, + </if> + <if test="clientId != null"> + client_id = #{clientId,jdbcType=BIGINT}, + </if> + <if test="operateType != null"> + operate_type = #{operateType,jdbcType=TINYINT}, + </if> + <if test="rechargeId != null"> + recharge_id = #{rechargeId,jdbcType=BIGINT}, + </if> + <if test="operator != null"> + `operator` = #{operator,jdbcType=BIGINT}, + </if> + <if test="operateTime != null"> + operate_time = #{operateTime,jdbcType=TIMESTAMP}, + </if> + </set> + where id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcOperate"> + <!--@mbg.generated--> + update se_vc_operate + set vc_id = #{vcId,jdbcType=BIGINT}, + client_id = #{clientId,jdbcType=BIGINT}, + operate_type = #{operateType,jdbcType=TINYINT}, + recharge_id = #{rechargeId,jdbcType=BIGINT}, + `operator` = #{operator,jdbcType=BIGINT}, + operate_time = #{operateTime,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=BIGINT} + </update> + + <!--鎸囧畾鏃堕棿娈靛唴娉ㄥ唽铏氭嫙鍗$殑鍐滄埛璁板綍鏁伴噺--> + <select id="getRegisterVcClientsCount" resultType="java.lang.Long"> + SELECT COUNT(*) AS recordCount + FROM se_client cli + WHERE EXISTS(SELECT * + FROM se_vc_operate ope + WHERE ope.client_id = cli.id + AND ope.operate_type = 1 + AND ope.operate_time BETWEEN #{timeStart} AND #{timeStop}) + </select> + + <!--鎸囧畾鏃堕棿娈靛唴娉ㄥ唽铏氭嫙鍗$殑鍐滄埛--> + <select id="getRegisterVcClients" resultType="com.dy.pipIrrGlobal.voSt.VoClientRegisterVC"> + SELECT cli.id AS clientId, + cli.name AS clientName + FROM se_client cli + WHERE EXISTS(SELECT * + FROM se_vc_operate ope + WHERE ope.client_id = cli.id + AND ope.operate_type = 1 + AND ope.operate_time BETWEEN #{timeStart} AND #{timeStop}) + ORDER BY cli.id + <trim prefix="limit "> + <if test="start != null and count != null"> + #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} + </if> + </trim> + </select> </mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/VirtualCardCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/VirtualCardCtrl.java index 2740ba8..2ecbfff 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/VirtualCardCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/VirtualCardCtrl.java @@ -1,9 +1,21 @@ package com.dy.pipIrrStatistics.card; +import com.dy.common.aop.SsoAop; +import com.dy.common.webUtil.BaseResponse; +import com.dy.common.webUtil.BaseResponseUtils; +import com.dy.common.webUtil.QueryResultVo; +import com.dy.pipIrrGlobal.voSt.VoClientRegisterVC; +import com.dy.pipIrrStatistics.card.qo.CommonQO; +import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; + +import java.util.List; +import java.util.Objects; /** * @author ZhuBaoMin @@ -19,4 +31,25 @@ public class VirtualCardCtrl { private final VirtualCardSv virtualCardSv; + /** + * 鎸囧畾鏃堕棿娈靛唴娉ㄥ唽铏氭嫙鍗$殑鍐滄埛 + * @param qo + * @param bindingResult + * @return + */ + @GetMapping(path = "/getRegisterVcClients") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoClientRegisterVC>>> getRegisterVcClients(@Valid CommonQO qo, BindingResult bindingResult) { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + + try { + return BaseResponseUtils.buildSuccess(virtualCardSv.getRegisterVcClients(qo)); + } catch (Exception e) { + log.error("鑾峰彇寮�鍗¤褰曞紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } + } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/VirtualCardSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/VirtualCardSv.java index a3fd60c..7718163 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/VirtualCardSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/VirtualCardSv.java @@ -1,7 +1,18 @@ package com.dy.pipIrrStatistics.card; +import com.dy.common.webUtil.QueryResultVo; +import com.dy.pipIrrGlobal.daoSe.SeVcOperateMapper; +import com.dy.pipIrrGlobal.voSt.VoClientRegisterVC; +import com.dy.pipIrrStatistics.card.qo.CommonQO; import lombok.extern.slf4j.Slf4j; +import org.apache.dubbo.common.utils.PojoUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; + +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import java.util.Optional; /** * @author ZhuBaoMin @@ -13,4 +24,44 @@ @Slf4j @Service public class VirtualCardSv { + @Autowired + private SeVcOperateMapper seVcOperateMapper; + + /** + * 鎸囧畾鏃堕棿娈靛唴娉ㄥ唽铏氭嫙鍗$殑鍐滄埛 + * @param qo + * @return + */ + public QueryResultVo<List<VoClientRegisterVC>> getRegisterVcClients(CommonQO qo) { + /** + * 琛ラ綈璧锋鏃堕棿锛屽鏋滃紑濮嬫椂闂翠负绌猴紝鍒欓粯璁や负褰撳墠鏃ユ湡 + */ + String timeStart = qo.getTimeStart(); + String timeStop = qo.getTimeStop(); + if(timeStart != null) { + timeStart = timeStart + " 00:00:00"; + }else { + timeStart = LocalDate.now() + " 00:00:00"; + } + if(timeStop != null) { + timeStop = timeStop + " 23:59:59"; + } + qo.setTimeStart(timeStart); + qo.setTimeStop(timeStop); + + // 鐢熸垚鏌ヨ鍙傛暟 + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; + + // 鑾峰彇绗﹀悎鏉′欢鐨勮褰曟暟 + Long itemTotal = Optional.ofNullable(seVcOperateMapper.getRegisterVcClientsCount(params)).orElse(0L); + + QueryResultVo<List<VoClientRegisterVC>> rsVo = new QueryResultVo<>() ; + + rsVo.pageSize = qo.pageSize ; + rsVo.pageCurr = qo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = seVcOperateMapper.getRegisterVcClients(params); + return rsVo ; + } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/qo/CommonQO.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/qo/CommonQO.java new file mode 100644 index 0000000..02693c5 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/qo/CommonQO.java @@ -0,0 +1,31 @@ +package com.dy.pipIrrStatistics.card.qo; + +import com.dy.common.webUtil.QueryConditionVo; +import com.fasterxml.jackson.annotation.JsonFormat; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author ZhuBaoMin + * @date 2024-08-12 14:54 + * @LastEditTime 2024-08-12 14:54 + * @Description + */ + +@Data +@EqualsAndHashCode(callSuper = false) +public class CommonQO extends QueryConditionVo { + /** + * 寮�濮嬫椂闂� + */ + @JsonFormat(pattern = "yyyy-MM-dd") + private String timeStart; + + /** + * 缁撴潫鏃堕棿 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @NotBlank(message = "缁撴潫鏃堕棿涓嶈兘涓虹┖") + private String timeStop; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientSv.java index 1625593..d339094 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientSv.java @@ -13,6 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.Calendar; @@ -342,8 +344,11 @@ * @param qo * @return */ - public QueryResultVo<List<VoDayClient>> getDayAmountAndMoney(ClientAmountQO qo) { + public QueryResultVo<List<VoDayClient>> getDayAmountAndMoney(ClientAmountQO qo) throws ParseException { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); String yearMonth = qo.getYearMonth(); + yearMonth = yearMonth + "-01"; + yearMonth = dateFormat.format(dateFormat.parse(yearMonth)); Integer year = Integer.parseInt(yearMonth.substring(0,4)); Integer month = Integer.parseInt(yearMonth.substring(5,7)); qo.setYear(year); diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java index 5d50de4..596eeea 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java @@ -12,6 +12,7 @@ import java.text.DecimalFormat; import java.text.ParseException; +import java.text.SimpleDateFormat; import java.time.LocalDate; import java.util.Calendar; import java.util.List; @@ -644,7 +645,11 @@ * @return */ public QueryResultVo<List<VoDayIntakeAmount>> getDayIntakeAmount(IntakeAmountQO qo) throws ParseException { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); String yearMonth = qo.getYearMonth(); + yearMonth = yearMonth + "-01"; + yearMonth = dateFormat.format(dateFormat.parse(yearMonth)); + Integer year = Integer.parseInt(yearMonth.substring(0,4)); Integer month = Integer.parseInt(yearMonth.substring(5,7)); qo.setYear(year); @@ -698,7 +703,10 @@ * @return */ public QueryResultVo<List<VoDayLoss>> getDayLossAmount(IntakeAmountQO qo) throws ParseException { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); String yearMonth = qo.getYearMonth(); + yearMonth = yearMonth + "-01"; + yearMonth = dateFormat.format(dateFormat.parse(yearMonth)); Integer year = Integer.parseInt(yearMonth.substring(0,4)); Integer month = Integer.parseInt(yearMonth.substring(5,7)); qo.setYear(year); -- Gitblit v1.8.0