
8 changed files with 433 additions and 182 deletions
@ -0,0 +1,20 @@ |
|||
import request from '@/utils/request' |
|||
// 入库导入的记录
|
|||
export default { |
|||
|
|||
// 查询分页列表
|
|||
listPage: function(params) { |
|||
return request({ |
|||
baseURL: '/api', |
|||
url: '/customer/csmcash/listPage', |
|||
method: 'post', |
|||
data: params |
|||
}) |
|||
}, |
|||
// 通过sid查询一条记录
|
|||
fetchBySid: function(sid) { |
|||
return request({ |
|||
url: '/supervise/v1/gdinstoragelog/fetchDetailsBySid/' + sid |
|||
}) |
|||
} |
|||
} |
@ -0,0 +1,48 @@ |
|||
package com.yxt.supervise.customer; |
|||
|
|||
import com.yxt.common.core.result.IResultCodeMsg; |
|||
|
|||
/** |
|||
* 统一返回信息的code和msg,需要更新并安装yxt-common-core项目 |
|||
*/ |
|||
public enum CodeMsgEnum implements IResultCodeMsg { |
|||
|
|||
/** |
|||
* 返回正常 |
|||
*/ |
|||
HTML200("200", "返回正常"), |
|||
/** |
|||
* 页面不存在 |
|||
*/ |
|||
HTML404("404", "页面不存在"), |
|||
/** |
|||
* 服务器错误 |
|||
*/ |
|||
HTML500("500", "服务器错误"), |
|||
/** |
|||
* 回款报表已经生成,不可再次导入 |
|||
*/ |
|||
CASH_5001("cash_5001", "报表已生成,不可再次导入"), |
|||
/** |
|||
* 当日数据已存在,但未生成报表,可修改,是否覆盖 |
|||
*/ |
|||
CASH_5002("cash_5002", "当日数据已存在,是否覆盖"); |
|||
|
|||
private String code; |
|||
private String msg; |
|||
|
|||
private CodeMsgEnum(String code, String msg) { |
|||
this.code = code; |
|||
this.msg = msg; |
|||
} |
|||
|
|||
@Override |
|||
public String getMsg() { |
|||
return msg; |
|||
} |
|||
|
|||
@Override |
|||
public String getCode() { |
|||
return code; |
|||
} |
|||
} |
@ -1,51 +1,26 @@ |
|||
package com.yxt.supervise.customer.biz.csmcash; |
|||
|
|||
import cn.hutool.poi.excel.ExcelReader; |
|||
import cn.hutool.poi.excel.ExcelUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import com.yxt.common.base.config.component.FileUploadComponent; |
|||
import com.yxt.common.core.result.FileUploadResult; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
@Service |
|||
public class CsmCashGdService extends ServiceImpl<CsmCashGdMapper, CsmCashGd> { |
|||
|
|||
@Autowired |
|||
private FileUploadComponent fileUploadComponent; |
|||
@Autowired |
|||
private CsmCashLogService csmCashLogService; |
|||
|
|||
public ResultBean<CsmCashLog> uploadAnd2Db(MultipartFile file) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
|
|||
ResultBean<FileUploadResult> fub = fileUploadComponent.uploadFile(file, "kcxxcx"); |
|||
String filePath = fub.getData().getFilePath(); |
|||
String fp = fileUploadComponent.getUploadPath() + filePath; |
|||
private CsmCashSalesService csmCashSalesService; |
|||
|
|||
ExcelReader reader = ExcelUtil.getReader(fp); |
|||
List<Map<String, Object>> readAll = reader.readAll(); |
|||
String dataDate; |
|||
try { |
|||
Map<String, Object> stringObjectMap = readAll.get(0); |
|||
String odate = (String) stringObjectMap.get("日期"); |
|||
if (StringUtils.isBlank(odate) || 19 != odate.length()) |
|||
return rb.setMsg("读取Excel文件数据异常!"); |
|||
dataDate = odate.substring(0, 10); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return rb.setMsg("解析36524导出的按日汇总对账报表出错,请检查格式"); |
|||
public void initCashByLog(CsmCashLog cashLog) { |
|||
List<CsmCashGd> gdList = this.listByLogsid(cashLog.getSid()); |
|||
csmCashSalesService.clearAndCreateOfDay(cashLog.getDataDate(), gdList); |
|||
} |
|||
CsmCashLog currLog = csmCashLogService.fetchEnableOfDay(dataDate); |
|||
if(currLog.) |
|||
|
|||
CsmCashLog ccl = new CsmCashLog(); |
|||
return rb.success().setData(ccl); |
|||
private List<CsmCashGd> listByLogsid(String logsid) { |
|||
QueryWrapper<CsmCashGd> qw = new QueryWrapper<>(); |
|||
qw.eq("logsid", logsid); |
|||
return baseMapper.selectList(qw); |
|||
} |
|||
} |
|||
|
Loading…
Reference in new issue