解决账户报表统计的bug

This commit is contained in:
季圣华
2021-01-07 23:49:48 +08:00
parent 2b0d8d7d4e
commit ab680f9ff9
5 changed files with 39 additions and 4 deletions

View File

@@ -196,6 +196,10 @@
type: "get", type: "get",
url: "/account/getStatistics", url: "/account/getStatistics",
dataType: "json", dataType: "json",
data: ({
name: name,
serialNo: serialNo
}),
success: function (res) { success: function (res) {
if (res && res.code === 200) { if (res && res.code === 200) {
if(res.data) { if(res.data) {

View File

@@ -179,10 +179,12 @@ public class AccountController {
* @return * @return
*/ */
@GetMapping(value = "/getStatistics") @GetMapping(value = "/getStatistics")
public BaseResponseInfo getStatistics(HttpServletRequest request) throws Exception { public BaseResponseInfo getStatistics(@RequestParam("name") String name,
@RequestParam("serialNo") String serialNo,
HttpServletRequest request) throws Exception {
BaseResponseInfo res = new BaseResponseInfo(); BaseResponseInfo res = new BaseResponseInfo();
try { try {
Map<String, Object> map = accountService.getStatistics(); Map<String, Object> map = accountService.getStatistics(name, serialNo);
res.code = 200; res.code = 200;
res.data = map; res.data = map;
} catch(Exception e){ } catch(Exception e){

View File

@@ -11,6 +11,10 @@ import java.util.List;
public interface AccountMapperEx { public interface AccountMapperEx {
List<Account> getAccountByParam(
@Param("name") String name,
@Param("serialNo") String serialNo);
List<AccountVo4List> selectByConditionAccount( List<AccountVo4List> selectByConditionAccount(
@Param("name") String name, @Param("name") String name,
@Param("serialNo") String serialNo, @Param("serialNo") String serialNo,
@@ -32,4 +36,5 @@ public interface AccountMapperEx {
@Param("accountId") Long accountId); @Param("accountId") Long accountId);
int batchDeleteAccountByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]); int batchDeleteAccountByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
} }

View File

@@ -84,7 +84,16 @@ public class AccountService {
JshException.readFail(logger, e); JshException.readFail(logger, e);
} }
return list; return list;
}
public List<Account> getAccountByParam(String name, String serialNo) throws Exception{
List<Account> list=null;
try{
list=accountMapperEx.getAccountByParam(name, serialNo);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
} }
public List<AccountVo4List> select(String name, String serialNo, String remark, int offset, int rows) throws Exception{ public List<AccountVo4List> select(String name, String serialNo, String remark, int offset, int rows) throws Exception{
@@ -547,10 +556,10 @@ public class AccountService {
} }
public Map<String, Object> getStatistics() { public Map<String, Object> getStatistics(String name, String serialNo) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
try { try {
List<Account> list = getAccount(); List<Account> list = getAccountByParam(name, serialNo);
String timeStr = Tools.getCurrentMonth(); String timeStr = Tools.getCurrentMonth();
BigDecimal allMonthAmount = BigDecimal.ZERO; BigDecimal allMonthAmount = BigDecimal.ZERO;
BigDecimal allCurrentAmount = BigDecimal.ZERO; BigDecimal allCurrentAmount = BigDecimal.ZERO;

View File

@@ -15,6 +15,20 @@
<result column="AMList" jdbcType="VARCHAR" property="amList" /> <result column="AMList" jdbcType="VARCHAR" property="amList" />
</resultMap> </resultMap>
<select id="getAccountByParam" resultType="com.jsh.erp.datasource.entities.Account">
select *
FROM jsh_account
where 1=1
<if test="name != null and name !=''">
<bind name="bindName" value="'%'+name+'%'"/>
and name like #{bindName}
</if>
<if test="serialNo != null and serialNo !=''">
<bind name="bindSerialNo" value="'%'+serialNo+'%'"/>
and serial_no like #{bindSerialNo}
</if>
</select>
<select id="selectByConditionAccount" parameterType="com.jsh.erp.datasource.entities.AccountExample" resultMap="ResultListMap"> <select id="selectByConditionAccount" parameterType="com.jsh.erp.datasource.entities.AccountExample" resultMap="ResultListMap">
select * select *
FROM jsh_account FROM jsh_account
@@ -173,6 +187,7 @@
and ifnull(dh.delete_flag,'0') !='1' and ifnull(dh.delete_flag,'0') !='1'
) cc ) cc
</select> </select>
<update id="batchDeleteAccountByIds"> <update id="batchDeleteAccountByIds">
update jsh_account update jsh_account
set delete_flag='1' set delete_flag='1'