564 changed files with 101355 additions and 1285 deletions
@ -0,0 +1,28 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.manager.ComplianceCheck; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
public interface ComplianceCheckService { |
||||
|
RestResponse list(Map<String, Object> params); |
||||
|
|
||||
|
// RestResponse selectByPrimaryKey(Integer id);
|
||||
|
|
||||
|
// RestResponse create(InvoiceImage invoiceImage);
|
||||
|
|
||||
|
RestResponse update(ComplianceCheck complianceCheck); |
||||
|
|
||||
|
// RestResponse delete(Integer id);
|
||||
|
|
||||
|
// RestResponse download(Integer id, HttpServletResponse response);
|
||||
|
|
||||
|
RestResponse exportExcel(Map<String, Object> params, HttpServletResponse response); |
||||
|
|
||||
|
// RestResponse downloadImages(Map<String, Object> params, HttpServletResponse response);
|
||||
|
|
||||
|
RestResponse reCheck(); |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,35 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/* |
||||
|
* @author OWTS |
||||
|
* @date 2021/4/23 |
||||
|
* @desc |
||||
|
*/ |
||||
|
public interface DataReportService { |
||||
|
|
||||
|
RestResponse multiInvForMenarini(Map<String, Object> params, HttpServletResponse response); |
||||
|
|
||||
|
|
||||
|
RestResponse advanceReport(Map<String, Object> params, HttpServletResponse response); |
||||
|
|
||||
|
RestResponse agreementReport(Map<String, Object> params, HttpServletResponse response); |
||||
|
|
||||
|
RestResponse signinReport(Map<String, Object> params, HttpServletResponse response); |
||||
|
|
||||
|
RestResponse picReport(Map<String, Object> params, HttpServletResponse response); |
||||
|
|
||||
|
RestResponse invoiceDetailReport(Map<String, Object> params, HttpServletResponse response); |
||||
|
|
||||
|
RestResponse synthesizeReport(Map<String, Object> params, HttpServletResponse response); |
||||
|
|
||||
|
RestResponse meetApplyReport(Map<String, Object> params, HttpServletResponse response); |
||||
|
|
||||
|
RestResponse meetFinishReport(Map<String, Object> params, HttpServletResponse response); |
||||
|
|
||||
|
RestResponse compositeReport(Map<String, Object> params, HttpServletResponse response); |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
public interface EfilesService { |
||||
|
RestResponse list(Map<String, Object> params); |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.ExpenseTypeTicket; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author |
||||
|
* @version 1.0.0 |
||||
|
* @date 2025/07/25 10:19 |
||||
|
**/ |
||||
|
public interface ExpenseTypeTicketService { |
||||
|
RestResponse list(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse create(ExpenseTypeTicket typeTicket); |
||||
|
|
||||
|
RestResponse update(ExpenseTypeTicket typeTicket); |
||||
|
|
||||
|
RestResponse delete(Long id); |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.InvoiceKindMapping; |
||||
|
import com.cmsen.ticket.domain.entity.manager.InvoiceKindMatching; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2024/3/8 16:06 |
||||
|
**/ |
||||
|
public interface InvKindMappingService { |
||||
|
RestResponse list(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse update(InvoiceKindMapping invoiceKindMapping); |
||||
|
|
||||
|
RestResponse insert(InvoiceKindMapping invoiceKindMapping); |
||||
|
|
||||
|
RestResponse delete(Long id); |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.manager.InvoiceKindMatching; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2024/3/8 16:06 |
||||
|
**/ |
||||
|
public interface InvKindMatchingService { |
||||
|
RestResponse list(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse update(InvoiceKindMatching invoiceKindMatching); |
||||
|
|
||||
|
RestResponse insert(InvoiceKindMatching invoiceKindMatching); |
||||
|
|
||||
|
RestResponse delete(Integer id); |
||||
|
} |
||||
@ -0,0 +1,40 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.manager.InvoiceImage; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2021/3/3 14:14 |
||||
|
**/ |
||||
|
public interface InvoiceImageService { |
||||
|
RestResponse list(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse selectImg(Integer id); |
||||
|
|
||||
|
RestResponse selectByPrimaryKey(Integer id); |
||||
|
|
||||
|
RestResponse create(InvoiceImage invoiceImage); |
||||
|
|
||||
|
RestResponse update(InvoiceImage invoiceImage); |
||||
|
|
||||
|
RestResponse delete(Integer id); |
||||
|
|
||||
|
RestResponse deleteBatch(String ids); |
||||
|
|
||||
|
RestResponse download(Integer id, HttpServletResponse response); |
||||
|
|
||||
|
RestResponse exportExcel(Map<String, Object> params, HttpServletResponse response); |
||||
|
|
||||
|
RestResponse downloadImages(Map<String, Object> params, HttpServletResponse response); |
||||
|
|
||||
|
RestResponse downloadXmls(Map<String, Object> params, HttpServletResponse response); |
||||
|
|
||||
|
RestResponse downloadXmlsPoc(Map<String, Object> params, HttpServletResponse response); |
||||
|
|
||||
|
RestResponse getUnMatchImg(String reportId); |
||||
|
} |
||||
@ -0,0 +1,28 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.InvoicePackage; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2023/6/19 16:06 |
||||
|
**/ |
||||
|
public interface InvoicePackageService { |
||||
|
|
||||
|
RestResponse getList(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse getLabelList(String packageNumber); |
||||
|
|
||||
|
RestResponse addPackage(InvoicePackage invoicePackage); |
||||
|
|
||||
|
RestResponse addLabel(String packageNumber, int addAmount); |
||||
|
|
||||
|
RestResponse printLabel(String printer, String ids); |
||||
|
|
||||
|
RestResponse updaePackage(InvoicePackage invoicePackage); |
||||
|
|
||||
|
RestResponse deletePackage(Long id); |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.MtAgreement; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2022/10/9 16:06 |
||||
|
**/ |
||||
|
public interface MtAgreementService { |
||||
|
|
||||
|
RestResponse getList(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse update(MtAgreement mtAgreement); |
||||
|
|
||||
|
RestResponse upload(MultipartFile file); |
||||
|
|
||||
|
RestResponse insert(MtAgreement mtAgreement); |
||||
|
} |
||||
@ -0,0 +1,58 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.MtCheckin; |
||||
|
import com.cmsen.ticket.domain.entity.MtList; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2022/11/17 16:06 |
||||
|
**/ |
||||
|
public interface MtListPcService { |
||||
|
|
||||
|
RestResponse listMeetPic(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse deletePic(Long id); |
||||
|
|
||||
|
RestResponse meetPicUpload(MultipartFile file); |
||||
|
|
||||
|
RestResponse insertPic(MultipartFile file, String reqId, String picType, String expenseName, String extId); |
||||
|
|
||||
|
RestResponse reqList2(String reqName); |
||||
|
|
||||
|
RestResponse valueSetList(String category); |
||||
|
|
||||
|
RestResponse meetingSpeakerList(String reqId); |
||||
|
|
||||
|
RestResponse listMeeting(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse updateMeeting(MtList mtList); |
||||
|
|
||||
|
RestResponse getOrgListByPid(Integer pid, String orgName); |
||||
|
|
||||
|
RestResponse checkinList(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse insertCheckin(MtCheckin mtCheckin); |
||||
|
|
||||
|
RestResponse getEditFlag(String roleId); |
||||
|
|
||||
|
RestResponse meetingDetails(Long id); |
||||
|
|
||||
|
RestResponse meetRevoke(String reqId); |
||||
|
|
||||
|
RestResponse meetReActive(String reqId); |
||||
|
|
||||
|
RestResponse speakerFallBack(Long id); |
||||
|
|
||||
|
RestResponse checkinReset(String reqId); |
||||
|
|
||||
|
RestResponse checkinDel(Long id); |
||||
|
|
||||
|
RestResponse listSignMeet(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse listSignMeetAttend(Map<String, Object> params); |
||||
|
} |
||||
@ -0,0 +1,103 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.dto.SubmitOrderMatchDto; |
||||
|
import com.cmsen.ticket.domain.entity.SupplierOrder; |
||||
|
import com.cmsen.ticket.domain.entity.SupplierOrderHeader; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
public interface PaymentService { |
||||
|
|
||||
|
RestResponse list(Map<String, Object> params); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
RestResponse listCompany(String keyword); |
||||
|
|
||||
|
RestResponse listOrg(String keyword); |
||||
|
|
||||
|
RestResponse codeList(); |
||||
|
|
||||
|
RestResponse getCompOrg(String userId); |
||||
|
|
||||
|
RestResponse getUserList(String keyword); |
||||
|
|
||||
|
RestResponse getSupplierList(String orgCode, String keyword, String isDigital); |
||||
|
|
||||
|
RestResponse create(SupplierOrderHeader supplierOrderHeader); |
||||
|
|
||||
|
RestResponse update(SupplierOrderHeader supplierOrderHeader); |
||||
|
|
||||
|
RestResponse deleteHeader(String billId); |
||||
|
|
||||
|
RestResponse orderList(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse createOrder(SupplierOrder supplierOrder); |
||||
|
|
||||
|
RestResponse updateOrder(SupplierOrder supplierOrder); |
||||
|
|
||||
|
RestResponse deleteOrder(String ids, String orderNo); |
||||
|
|
||||
|
RestResponse listItems(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse submitOrderMatchList(SubmitOrderMatchDto dto); |
||||
|
|
||||
|
RestResponse deleteOrderMatch(Long matchId); |
||||
|
|
||||
|
RestResponse submitBill(String billId); |
||||
|
|
||||
|
RestResponse recallBill(String billId); |
||||
|
|
||||
|
RestResponse backBill(String billId); |
||||
|
|
||||
|
RestResponse matchBill(String billId); |
||||
|
|
||||
|
RestResponse getPayTypeList(String keyword); |
||||
|
|
||||
|
RestResponse getMaterialList(String keyword); |
||||
|
|
||||
|
RestResponse getWhiteCompList(String keyword); |
||||
|
|
||||
|
RestResponse listContracts(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse listPurchaces(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse getFlowType(); |
||||
|
|
||||
|
RestResponse listBrands(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse listReceives(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse listInternals(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse valueSetList(String category, Integer pid, String keywords); |
||||
|
|
||||
|
RestResponse getSysConfig(String code); |
||||
|
|
||||
|
RestResponse getBillName(String businessType, String userName); |
||||
|
|
||||
|
RestResponse getMatchFlag(String roleId, String userId, String costCenter); |
||||
|
|
||||
|
RestResponse getMatchFinFlag(String roleId, String userId); |
||||
|
|
||||
|
RestResponse getTransferUser(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse transferBill(String billId, String owner, String toUserId); |
||||
|
|
||||
|
RestResponse listForTransfer(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse transferBatch(Map<String, Object> params, String current, String target); |
||||
|
|
||||
|
RestResponse transferRecallBatch(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse listOwner(String keyword); |
||||
|
} |
||||
@ -0,0 +1,38 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.User; |
||||
|
import com.cmsen.ticket.domain.entity.VerifiedUser; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2021/3/2 14:32 |
||||
|
**/ |
||||
|
public interface SysAppUserService { |
||||
|
RestResponse list(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse selectByPrimaryKey(Integer id); |
||||
|
|
||||
|
RestResponse create(VerifiedUser user); |
||||
|
|
||||
|
RestResponse update(VerifiedUser user); |
||||
|
|
||||
|
RestResponse delete(Integer id); |
||||
|
|
||||
|
RestResponse export(HttpServletResponse response); |
||||
|
|
||||
|
RestResponse updateData(MultipartFile file); |
||||
|
|
||||
|
RestResponse getUser(String tel); |
||||
|
|
||||
|
RestResponse delUser(Integer userId); |
||||
|
|
||||
|
RestResponse insertUser(User user); |
||||
|
|
||||
|
RestResponse updateUser(User user); |
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.ExpenseType; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2021/3/2 13:22 |
||||
|
**/ |
||||
|
public interface SysExpenseTypeService { |
||||
|
RestResponse list(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse create(ExpenseType expenseType); |
||||
|
|
||||
|
RestResponse update(ExpenseType expenseType); |
||||
|
|
||||
|
RestResponse delete(Integer id); |
||||
|
|
||||
|
RestResponse selectByPaimaryKey(Integer id); |
||||
|
|
||||
|
RestResponse updateIsDel(Integer id, String isDel); |
||||
|
|
||||
|
RestResponse getPidList(Integer pid); |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.ExpenseTypeActive; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2021/3/2 13:33 |
||||
|
**/ |
||||
|
public interface SysExtraFieldsService { |
||||
|
RestResponse list(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse create(ExpenseTypeActive expenseTypeActive); |
||||
|
|
||||
|
RestResponse update(ExpenseTypeActive expenseTypeActive); |
||||
|
|
||||
|
RestResponse delete(Integer id); |
||||
|
|
||||
|
RestResponse selectByPaimaryKey(Integer id); |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.ValueSet; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2021/3/2 14:19 |
||||
|
**/ |
||||
|
public interface SysExtraValueService { |
||||
|
RestResponse list(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse selectByPrimaryKey(Integer id); |
||||
|
|
||||
|
RestResponse create(ValueSet valueSet); |
||||
|
|
||||
|
RestResponse update(ValueSet valueSet); |
||||
|
|
||||
|
RestResponse delete(Integer ids); |
||||
|
|
||||
|
RestResponse export(HttpServletResponse response); |
||||
|
} |
||||
@ -0,0 +1,34 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.project.Project; |
||||
|
import com.cmsen.ticket.domain.entity.project.ProjectTask; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
public interface WorkProjectService { |
||||
|
|
||||
|
RestResponse getProjectList(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse insertProject(Project project); |
||||
|
|
||||
|
RestResponse updateProject(Project project); |
||||
|
|
||||
|
RestResponse deleteProject(Long id); |
||||
|
|
||||
|
RestResponse getAttendeelist(String projectCode); |
||||
|
|
||||
|
RestResponse saveAttendee(Project project); |
||||
|
|
||||
|
RestResponse getTaskList(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse insertTask(ProjectTask projectTask); |
||||
|
|
||||
|
RestResponse updateTask(ProjectTask projectTask); |
||||
|
|
||||
|
RestResponse deleteTask(Long id); |
||||
|
|
||||
|
RestResponse selectUserList(String keyword); |
||||
|
|
||||
|
RestResponse finishTask(Long id); |
||||
|
} |
||||
@ -0,0 +1,190 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service.impl; |
||||
|
|
||||
|
import cn.hutool.core.io.IoUtil; |
||||
|
import cn.hutool.json.JSONUtil; |
||||
|
import com.alibaba.excel.EasyExcel; |
||||
|
import com.alibaba.excel.support.ExcelTypeEnum; |
||||
|
import com.cmsen.common.exception.ServiceException; |
||||
|
import com.cmsen.common.http.ContentEnctype; |
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.common.util.DateFormat; |
||||
|
import com.cmsen.common.util.FileMime; |
||||
|
import com.cmsen.common.util.StringUtil; |
||||
|
import com.cmsen.ticket.application.manager.service.ComplianceCheckService; |
||||
|
import com.cmsen.ticket.domain.entity.RuleConfig; |
||||
|
import com.cmsen.ticket.domain.entity.TicketType; |
||||
|
import com.cmsen.ticket.domain.entity.manager.ComplianceCheck; |
||||
|
import com.cmsen.ticket.domain.entity.manager.InvoiceImage; |
||||
|
import com.cmsen.ticket.domain.mapper.CompanyMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.RuleConfigMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.TicketTypeMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.ComplianceCheckMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.InvoiceImageMapper; |
||||
|
import com.cmsen.ticket.domain.util.PaginationUtil; |
||||
|
import com.cmsen.ticket.domain.util.StringUtils; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import javax.servlet.ServletOutputStream; |
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.*; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class ComplianceCheckServiceImpl implements ComplianceCheckService { |
||||
|
|
||||
|
@Resource |
||||
|
private ComplianceCheckMapper mapper; |
||||
|
|
||||
|
@Resource |
||||
|
private InvoiceImageMapper invoiceImageMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private RuleConfigMapper ruleConfigMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private TicketTypeMapper ticketTypeMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private CompanyMapper companyMapper; |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse list(Map<String, Object> params) { |
||||
|
StringUtils.decoderUrl(params); |
||||
|
PaginationUtil.paginationInit(params); |
||||
|
List<ComplianceCheck> list = mapper.list(params); |
||||
|
int total = mapper.count(params); |
||||
|
return RestResponse.success(PaginationUtil.getPageResult(total, params, list)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse update(ComplianceCheck complianceCheck) { |
||||
|
try { |
||||
|
complianceCheck.setUpdateTime(DateFormat.format(new Date(), DateFormat.DatePatternType.FORMAT_yyyy_MM_dd_HH_mm_ss)); |
||||
|
mapper.updateByPrimaryKeySelective(complianceCheck); |
||||
|
return RestResponse.success(complianceCheck); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("系统错误"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse exportExcel(Map<String, Object> params, HttpServletResponse response) { |
||||
|
ServletOutputStream out = null; |
||||
|
try { |
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx"); |
||||
|
StringUtils.decoderUrl(params); |
||||
|
List<ComplianceCheck> list = mapper.list(params); |
||||
|
out = response.getOutputStream(); |
||||
|
EasyExcel.write(out).excelType(ExcelTypeEnum.XLSX) |
||||
|
.sheet(0, "合规检查") |
||||
|
.head(ComplianceCheck.class) |
||||
|
.doWrite(list); |
||||
|
out.flush(); |
||||
|
return null; |
||||
|
} catch (Exception e) { |
||||
|
response.reset(); |
||||
|
log.error(e.getMessage(), e); |
||||
|
response.setContentType(ContentEnctype.JSON); |
||||
|
return RestResponse.failure(e.getMessage()); |
||||
|
} finally { |
||||
|
IoUtil.close(out); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Transactional |
||||
|
@Override |
||||
|
public RestResponse reCheck() { |
||||
|
try { |
||||
|
List<InvoiceImage> list = invoiceImageMapper.list(null); |
||||
|
List<RuleConfig> ruleConfigs = ruleConfigMapper.selectByClientAndType(1, 0); |
||||
|
Map<String, Map<String, List<RuleConfig>>> ruleMap = getRuleMap(ruleConfigs); |
||||
|
List<ComplianceCheck> records = new ArrayList<>(); |
||||
|
for (InvoiceImage invoice : list) { |
||||
|
ComplianceCheck check = new ComplianceCheck(); |
||||
|
check.setReportId(invoice.getReportId()); |
||||
|
check.setSubmitter(invoice.getReportOwner()); |
||||
|
check.setReimbursement(invoice.getTotal()); |
||||
|
check.setInvoiceType(invoice.getInvoiceType()); |
||||
|
check.setInvoiceDate(invoice.getDate()); |
||||
|
check.setInvoiceNumber(invoice.getNumber()); |
||||
|
validationRules(check, invoice, ruleMap); |
||||
|
records.add(check); |
||||
|
} |
||||
|
mapper.deleteOldRecords(); |
||||
|
if (!records.isEmpty()) { |
||||
|
mapper.insertBatch(records); |
||||
|
} |
||||
|
return RestResponse.success(); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("系统异常"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private void validationRules(ComplianceCheck check, InvoiceImage invoice, Map<String, Map<String, List<RuleConfig>>> ruleMaps) { |
||||
|
List<String> messages = new ArrayList<>(); |
||||
|
if (ruleMaps.containsKey(invoice.getInvoiceType())) { |
||||
|
Map<String, List<RuleConfig>> ruleMap = ruleMaps.get(invoice.getInvoiceType()); |
||||
|
if (ruleMap.containsKey("票号重复规则")) { |
||||
|
int i = invoiceImageMapper.checkInvoiceNum(invoice.getNumber()); |
||||
|
if (i > 1) { |
||||
|
messages.add(ruleMap.get("票号重复规则").get(0).getRuleInfo().getMessageCn()); |
||||
|
} |
||||
|
} |
||||
|
if (ruleMap.containsKey("税号白名单规则")) { |
||||
|
int i = companyMapper.checkTaxId(StringUtils.getStringWithOutSpecialCode(invoice.getSellerTaxId())); |
||||
|
if (i == 0) { |
||||
|
messages.add(ruleMap.get("税号白名单规则").get(0).getRuleInfo().getMessageCn()); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
check.setCheckStatus(messages.isEmpty() ? 1 : 0); |
||||
|
String date = DateFormat.format(new Date(), DateFormat.DatePatternType.FORMAT_yyyy_MM_dd_HH_mm_ss); |
||||
|
check.setUpdateTime(date); |
||||
|
check.setCreateTime(date); |
||||
|
check.setCheckResult(messages.isEmpty() ? 0 : 1); |
||||
|
check.setErrMsg(JSONUtil.toJsonStr(messages)); |
||||
|
check.setDataSource("二次比对"); |
||||
|
} |
||||
|
|
||||
|
//票种-》发票规则-》ruleConfig
|
||||
|
private Map<String, Map<String, List<RuleConfig>>> getRuleMap(List<RuleConfig> ruleConfigs) { |
||||
|
List<TicketType> ticketTypeList = ticketTypeMapper.list(); |
||||
|
Map<String, Map<String, List<RuleConfig>>> result = new HashMap<>(); |
||||
|
|
||||
|
List<RuleConfig> ruleAllType = ruleConfigs.stream().filter(ruleConfig -> StringUtil.isEmpty(ruleConfig.getTicketName())).collect(Collectors.toList()); |
||||
|
Map<String, List<RuleConfig>> ruleAllTypeMap = ruleAllType.stream().collect(Collectors.groupingBy(ruleConfig -> ruleConfig.getRuleInfo().getName())); |
||||
|
ticketTypeList.forEach(ticketType -> { |
||||
|
result.put(ticketType.getValue(), new HashMap<String, List<RuleConfig>>() {{ |
||||
|
putAll(ruleAllTypeMap); |
||||
|
}}); |
||||
|
result.put(ticketType.getLanguage(), new HashMap<String, List<RuleConfig>>() {{ |
||||
|
putAll(ruleAllTypeMap); |
||||
|
}}); |
||||
|
}); |
||||
|
|
||||
|
List<RuleConfig> ruleType = ruleConfigs.stream().filter(ruleConfig -> StringUtil.isNotEmpty(ruleConfig.getTicketName())).collect(Collectors.toList()); |
||||
|
for (RuleConfig rule : ruleType) { |
||||
|
Map<String, List<RuleConfig>> stringListMap = result.get(rule.getTicketName()); |
||||
|
if (!stringListMap.containsKey(rule.getRuleInfo().getName())) { |
||||
|
stringListMap.put(rule.getRuleInfo().getName(), new ArrayList<RuleConfig>() {{ |
||||
|
add(rule); |
||||
|
}}); |
||||
|
Map<String, List<RuleConfig>> stringListMapEn = result.get(rule.getTicketNameEn()); |
||||
|
stringListMapEn.put(rule.getRuleInfo().getName(), new ArrayList<RuleConfig>() {{ |
||||
|
add(rule); |
||||
|
}}); |
||||
|
} |
||||
|
} |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// private
|
||||
|
} |
||||
@ -0,0 +1,342 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service.impl; |
||||
|
|
||||
|
import cn.hutool.core.io.IoUtil; |
||||
|
import com.alibaba.excel.EasyExcel; |
||||
|
import com.alibaba.excel.support.ExcelTypeEnum; |
||||
|
import com.cmsen.common.http.ContentEnctype; |
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.common.util.FileMime; |
||||
|
import com.cmsen.common.util.StringUtil; |
||||
|
import com.cmsen.ticket.application.manager.service.DataReportService; |
||||
|
import com.cmsen.ticket.domain.entity.MenariniReportExportEntity3; |
||||
|
import com.cmsen.ticket.domain.entity.MenariniReportExportEntity4; |
||||
|
import com.cmsen.ticket.domain.entity.reportEntity.*; |
||||
|
import com.cmsen.ticket.domain.mapper.*; |
||||
|
import com.cmsen.ticket.domain.vo.MultiInvExprotEntity; |
||||
|
import com.cmsenframework.security.RequestSecurityPolicy; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import javax.servlet.ServletOutputStream; |
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/* |
||||
|
* @author OWTS |
||||
|
* @date 2021/4/23 |
||||
|
* @desc |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class DataReportServiceImpl implements DataReportService { |
||||
|
|
||||
|
@Resource |
||||
|
private InvoiceMapper invoiceMapper; |
||||
|
|
||||
|
|
||||
|
@Resource |
||||
|
private CustomerMapper customerMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private MtListMapper mtListMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private MtAgreementMapper mtAgreementMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private MtCheckinMapper mtCheckinMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private MtPicMapper mtPicMapper; |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse multiInvForMenarini(Map<String, Object> params, HttpServletResponse response) { |
||||
|
ServletOutputStream out = null; |
||||
|
try { |
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx"); |
||||
|
out = response.getOutputStream(); |
||||
|
List<MultiInvExprotEntity> results = invoiceMapper.selectMultiInvToExport(params); |
||||
|
EasyExcel.write(out).excelType(ExcelTypeEnum.XLSX) |
||||
|
.sheet(0, "多票合并") |
||||
|
.head(MultiInvExprotEntity.class) |
||||
|
.doWrite(results); |
||||
|
out.flush(); |
||||
|
return null; |
||||
|
} catch (Exception e) { |
||||
|
response.reset(); |
||||
|
log.error(e.getMessage(), e); |
||||
|
response.setContentType(ContentEnctype.JSON); |
||||
|
return RestResponse.failure(e.getMessage()); |
||||
|
} finally { |
||||
|
IoUtil.close(out); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse advanceReport(Map<String, Object> params, HttpServletResponse response) { |
||||
|
|
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx"); |
||||
|
|
||||
|
response.reset(); |
||||
|
ServletOutputStream out = null; |
||||
|
try { |
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx"); |
||||
|
out = response.getOutputStream(); |
||||
|
List<AdvanceReport> advanceReport = mtListMapper.selectAdvanceReport(params); |
||||
|
|
||||
|
EasyExcel.write(out).excelType(ExcelTypeEnum.XLSX) |
||||
|
.sheet(0, "事前预申请报告") |
||||
|
.head(AdvanceReport.class) |
||||
|
.doWrite(advanceReport); |
||||
|
out.flush(); |
||||
|
return null; |
||||
|
} catch (Exception e) { |
||||
|
//response.reset();
|
||||
|
log.error(e.getMessage(), e); |
||||
|
response.setContentType(ContentEnctype.JSON); |
||||
|
return RestResponse.failure(e.getMessage()); |
||||
|
} finally { |
||||
|
IoUtil.close(out); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse agreementReport(Map<String, Object> params, HttpServletResponse response) { |
||||
|
|
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx"); |
||||
|
|
||||
|
response.reset(); |
||||
|
ServletOutputStream out = null; |
||||
|
try { |
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx"); |
||||
|
out = response.getOutputStream(); |
||||
|
List<AgreementReport> agreementReport = mtAgreementMapper.selectAgreementReport(params); |
||||
|
|
||||
|
EasyExcel.write(out).excelType(ExcelTypeEnum.XLSX) |
||||
|
.sheet(0, "事中协议报告") |
||||
|
.head(AgreementReport.class) |
||||
|
.doWrite(agreementReport); |
||||
|
out.flush(); |
||||
|
return null; |
||||
|
} catch (Exception e) { |
||||
|
//response.reset();
|
||||
|
log.error(e.getMessage(), e); |
||||
|
response.setContentType(ContentEnctype.JSON); |
||||
|
return RestResponse.failure(e.getMessage()); |
||||
|
} finally { |
||||
|
IoUtil.close(out); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse signinReport(Map<String, Object> params, HttpServletResponse response) { |
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx"); |
||||
|
|
||||
|
response.reset(); |
||||
|
ServletOutputStream out = null; |
||||
|
try { |
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx"); |
||||
|
out = response.getOutputStream(); |
||||
|
List<SigninReport> signinReport = mtCheckinMapper.selectSigninReport(params); |
||||
|
|
||||
|
EasyExcel.write(out).excelType(ExcelTypeEnum.XLSX) |
||||
|
.sheet(0, "事中签到报告") |
||||
|
.head(SigninReport.class) |
||||
|
.doWrite(signinReport); |
||||
|
out.flush(); |
||||
|
return null; |
||||
|
} catch (Exception e) { |
||||
|
//response.reset();
|
||||
|
log.error(e.getMessage(), e); |
||||
|
response.setContentType(ContentEnctype.JSON); |
||||
|
return RestResponse.failure(e.getMessage()); |
||||
|
} finally { |
||||
|
IoUtil.close(out); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse picReport(Map<String, Object> params, HttpServletResponse response) { |
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx"); |
||||
|
|
||||
|
response.reset(); |
||||
|
ServletOutputStream out = null; |
||||
|
try { |
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx"); |
||||
|
out = response.getOutputStream(); |
||||
|
List<PicReport> picReport = mtPicMapper.selectPicReport(params); |
||||
|
|
||||
|
EasyExcel.write(out).excelType(ExcelTypeEnum.XLSX) |
||||
|
.sheet(0, "事中照片报告") |
||||
|
.head(PicReport.class) |
||||
|
.doWrite(picReport); |
||||
|
out.flush(); |
||||
|
return null; |
||||
|
} catch (Exception e) { |
||||
|
//response.reset();
|
||||
|
log.error(e.getMessage(), e); |
||||
|
response.setContentType(ContentEnctype.JSON); |
||||
|
return RestResponse.failure(e.getMessage()); |
||||
|
} finally { |
||||
|
IoUtil.close(out); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse invoiceDetailReport(Map<String, Object> params, HttpServletResponse response) { |
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx"); |
||||
|
|
||||
|
response.reset(); |
||||
|
ServletOutputStream out = null; |
||||
|
try { |
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx"); |
||||
|
out = response.getOutputStream(); |
||||
|
List<InvoiceDetailReport> invoiceDetailReport = invoiceMapper.selectInvoiceDetailReport(params); |
||||
|
|
||||
|
EasyExcel.write(out).excelType(ExcelTypeEnum.XLSX) |
||||
|
.sheet(0, "事后发票明细报告") |
||||
|
.head(InvoiceDetailReport.class) |
||||
|
.doWrite(invoiceDetailReport); |
||||
|
out.flush(); |
||||
|
return null; |
||||
|
} catch (Exception e) { |
||||
|
//response.reset();
|
||||
|
log.error(e.getMessage(), e); |
||||
|
response.setContentType(ContentEnctype.JSON); |
||||
|
return RestResponse.failure(e.getMessage()); |
||||
|
} finally { |
||||
|
IoUtil.close(out); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse synthesizeReport(Map<String, Object> params, HttpServletResponse response) { |
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx"); |
||||
|
|
||||
|
response.reset(); |
||||
|
ServletOutputStream out = null; |
||||
|
try { |
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx"); |
||||
|
out = response.getOutputStream(); |
||||
|
List<SynthesizeReport> synthesizeReport = invoiceMapper.selectSynthesizeReport(params); |
||||
|
|
||||
|
EasyExcel.write(out).excelType(ExcelTypeEnum.XLSX) |
||||
|
.sheet(0, "事后综合报告") |
||||
|
.head(SynthesizeReport.class) |
||||
|
.doWrite(synthesizeReport); |
||||
|
out.flush(); |
||||
|
return null; |
||||
|
} catch (Exception e) { |
||||
|
//response.reset();
|
||||
|
log.error(e.getMessage(), e); |
||||
|
response.setContentType(ContentEnctype.JSON); |
||||
|
return RestResponse.failure(e.getMessage()); |
||||
|
} finally { |
||||
|
IoUtil.close(out); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse meetApplyReport(Map<String, Object> params, HttpServletResponse response) { |
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx"); |
||||
|
|
||||
|
response.reset(); |
||||
|
ServletOutputStream out = null; |
||||
|
try { |
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx"); |
||||
|
out = response.getOutputStream(); |
||||
|
List<MeetApplyReport> meetApplyReport = mtListMapper.selectMeetApplyReport(params); |
||||
|
|
||||
|
EasyExcel.write(out).excelType(ExcelTypeEnum.XLSX) |
||||
|
.sheet(0, "合规会议申请报表") |
||||
|
.head(MeetApplyReport.class) |
||||
|
.doWrite(meetApplyReport); |
||||
|
out.flush(); |
||||
|
return null; |
||||
|
} catch (Exception e) { |
||||
|
//response.reset();
|
||||
|
log.error(e.getMessage(), e); |
||||
|
response.setContentType(ContentEnctype.JSON); |
||||
|
return RestResponse.failure(e.getMessage()); |
||||
|
} finally { |
||||
|
IoUtil.close(out); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse meetFinishReport(Map<String, Object> params, HttpServletResponse response) { |
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx"); |
||||
|
|
||||
|
response.reset(); |
||||
|
ServletOutputStream out = null; |
||||
|
try { |
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx"); |
||||
|
out = response.getOutputStream(); |
||||
|
List<MeetFinishReport> meetFinishReport = mtListMapper.selectMeetFinishReport(params); |
||||
|
|
||||
|
EasyExcel.write(out).excelType(ExcelTypeEnum.XLSX) |
||||
|
.sheet(0, "合规已完成会议报表") |
||||
|
.head(MeetFinishReport.class) |
||||
|
.doWrite(meetFinishReport); |
||||
|
out.flush(); |
||||
|
return null; |
||||
|
} catch (Exception e) { |
||||
|
//response.reset();
|
||||
|
log.error(e.getMessage(), e); |
||||
|
response.setContentType(ContentEnctype.JSON); |
||||
|
return RestResponse.failure(e.getMessage()); |
||||
|
} finally { |
||||
|
IoUtil.close(out); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse compositeReport(Map<String, Object> params, HttpServletResponse response) { |
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx"); |
||||
|
|
||||
|
response.reset(); |
||||
|
ServletOutputStream out = null; |
||||
|
try { |
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx"); |
||||
|
out = response.getOutputStream(); |
||||
|
List<CompositeReport> compositeReport = mtListMapper.selectCompositeReport(params); |
||||
|
|
||||
|
EasyExcel.write(out).excelType(ExcelTypeEnum.XLSX) |
||||
|
.sheet(0, "综合报告") |
||||
|
.head(CompositeReport.class) |
||||
|
.doWrite(compositeReport); |
||||
|
out.flush(); |
||||
|
return null; |
||||
|
} catch (Exception e) { |
||||
|
//response.reset();
|
||||
|
log.error(e.getMessage(), e); |
||||
|
response.setContentType(ContentEnctype.JSON); |
||||
|
return RestResponse.failure(e.getMessage()); |
||||
|
} finally { |
||||
|
IoUtil.close(out); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,30 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service.impl; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.application.manager.service.EfilesService; |
||||
|
import com.cmsen.ticket.domain.entity.Efiles; |
||||
|
import com.cmsen.ticket.domain.entity.SupplierMaterialDefine; |
||||
|
import com.cmsen.ticket.domain.mapper.EfilesMapper; |
||||
|
import com.cmsen.ticket.domain.util.PaginationUtil; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class EfilesServiceImpl implements EfilesService { |
||||
|
@Resource |
||||
|
private EfilesMapper mapper; |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse list(Map<String, Object> params) { |
||||
|
PaginationUtil.paginationInit(params); |
||||
|
|
||||
|
List<Efiles> list = mapper.list(params); |
||||
|
int total = mapper.count(params); |
||||
|
return RestResponse.success(PaginationUtil.getPageResult(total, params, list)); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,53 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service.impl; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.application.manager.service.ExpenseTypeTicketService; |
||||
|
import com.cmsen.ticket.domain.entity.ExpenseTypeTicket; |
||||
|
import com.cmsen.ticket.domain.mapper.ExpenseTypeTicketMapper; |
||||
|
import com.cmsen.ticket.domain.util.PaginationUtil; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author |
||||
|
* @version 1.0.0 |
||||
|
* @date 2025/07/25 10:19 |
||||
|
**/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class ExpenseTypeTicketServiceImpl implements ExpenseTypeTicketService { |
||||
|
@Resource |
||||
|
private ExpenseTypeTicketMapper typeTicketMapper; |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse list(Map<String, Object> params) { |
||||
|
PageHelper.startPage(Integer.parseInt(params.get("pageNum").toString()),Integer.parseInt(params.get("pageSize").toString())); |
||||
|
|
||||
|
List<ExpenseTypeTicket> list = typeTicketMapper.listByParams(params); |
||||
|
int total = typeTicketMapper.countByParams(params); |
||||
|
return RestResponse.success(PaginationUtil.getPageResult(total, params, list)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse create(ExpenseTypeTicket typeTicket) { |
||||
|
typeTicketMapper.insert(typeTicket); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse update(ExpenseTypeTicket typeTicket) { |
||||
|
typeTicketMapper.updateByPrimaryKeySelective(typeTicket); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse delete(Long id) { |
||||
|
typeTicketMapper.deleteByPrimaryKey(id); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,58 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service.impl; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.application.manager.service.InvKindMappingService; |
||||
|
import com.cmsen.ticket.domain.entity.InvoiceKindMapping; |
||||
|
import com.cmsen.ticket.domain.mapper.InvoiceKindMappingMapper; |
||||
|
import com.cmsen.ticket.domain.util.PaginationUtil; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2024/3/8 16:06 |
||||
|
**/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class InvKindMappingServiceImpl implements InvKindMappingService { |
||||
|
|
||||
|
@Resource |
||||
|
private InvoiceKindMappingMapper invoiceKindMappingMapper; |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse list(Map<String, Object> params) { |
||||
|
|
||||
|
PageHelper.startPage(Integer.parseInt(params.get("pageNum").toString()),Integer.parseInt(params.get("pageSize").toString())); |
||||
|
|
||||
|
List<InvoiceKindMapping> list = invoiceKindMappingMapper.list(params); |
||||
|
int count = invoiceKindMappingMapper.count(params); |
||||
|
|
||||
|
return RestResponse.success(PaginationUtil.getPageResult(count, params, list)); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public RestResponse update(InvoiceKindMapping invoiceKindMapping) { |
||||
|
invoiceKindMappingMapper.updateByPrimaryKeySelective(invoiceKindMapping); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse insert(InvoiceKindMapping invoiceKindMapping) { |
||||
|
invoiceKindMappingMapper.insertSelective(invoiceKindMapping); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse delete(Long id) { |
||||
|
invoiceKindMappingMapper.deleteByPrimaryKey(id); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,57 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service.impl; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.application.manager.service.InvKindMatchingService; |
||||
|
import com.cmsen.ticket.domain.entity.manager.InvoiceKindMatching; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.InvoiceKindMatchingMapper; |
||||
|
import com.cmsen.ticket.domain.util.PaginationUtil; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2024/3/8 16:06 |
||||
|
**/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class InvKindMatchingServiceImpl implements InvKindMatchingService { |
||||
|
|
||||
|
@Resource |
||||
|
private InvoiceKindMatchingMapper invoiceKindMatchingMapper; |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse list(Map<String, Object> params) { |
||||
|
|
||||
|
PageHelper.startPage(Integer.parseInt(params.get("pageNum").toString()),Integer.parseInt(params.get("pageSize").toString())); |
||||
|
|
||||
|
List<InvoiceKindMatching> list = invoiceKindMatchingMapper.list(params); |
||||
|
int count = invoiceKindMatchingMapper.count(params); |
||||
|
|
||||
|
return RestResponse.success(PaginationUtil.getPageResult(count, params, list)); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public RestResponse update(InvoiceKindMatching invoiceKindMatching) { |
||||
|
invoiceKindMatchingMapper.updateByPrimaryKeySelective(invoiceKindMatching); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse insert(InvoiceKindMatching invoiceKindMatching) { |
||||
|
invoiceKindMatchingMapper.insertSelective(invoiceKindMatching); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse delete(Integer id) { |
||||
|
invoiceKindMatchingMapper.deleteByPrimaryKey(id); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,387 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service.impl; |
||||
|
|
||||
|
import cn.hutool.core.io.FileUtil; |
||||
|
import cn.hutool.core.io.IoUtil; |
||||
|
import cn.hutool.core.util.ZipUtil; |
||||
|
import com.alibaba.excel.EasyExcel; |
||||
|
import com.alibaba.excel.support.ExcelTypeEnum; |
||||
|
import com.cmsen.common.exception.ServiceException; |
||||
|
import com.cmsen.common.http.ContentEnctype; |
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.common.util.FileMime; |
||||
|
import com.cmsen.common.util.StringUtil; |
||||
|
import com.cmsen.ticket.application.manager.service.InvoiceImageService; |
||||
|
import com.cmsen.ticket.domain.entity.manager.InvoiceImage; |
||||
|
import com.cmsen.ticket.domain.entity.manager.InvoiceImg; |
||||
|
import com.cmsen.ticket.domain.entity.manager.SysConfig; |
||||
|
import com.cmsen.ticket.domain.mapper.CustomerMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.InvoiceImageMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.InvoiceImgMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.SysConfigMapper; |
||||
|
import com.cmsen.ticket.domain.util.PaginationUtil; |
||||
|
import com.cmsen.ticket.domain.util.StringUtils; |
||||
|
import com.cmsenframework.security.RequestSecurityPolicy; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Value; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import javax.servlet.ServletOutputStream; |
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.io.File; |
||||
|
import java.io.InputStream; |
||||
|
import java.io.OutputStream; |
||||
|
import java.net.HttpURLConnection; |
||||
|
import java.net.URL; |
||||
|
import java.net.URLEncoder; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2021/3/3 14:21 |
||||
|
**/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class InvoiceImageServiceImpl implements InvoiceImageService { |
||||
|
@Resource |
||||
|
private InvoiceImageMapper mapper; |
||||
|
|
||||
|
@Resource |
||||
|
private SysConfigMapper sysConfigMapper; |
||||
|
|
||||
|
@Value("${manager-file.uploadPath}") |
||||
|
private String uploadPath; |
||||
|
|
||||
|
@Resource |
||||
|
private CustomerMapper customerMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private InvoiceImgMapper invoiceImgMapper; |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse list(Map<String, Object> params) { |
||||
|
StringUtils.decoderUrl(params); |
||||
|
addDataAuth(params); |
||||
|
PaginationUtil.paginationInit(params); |
||||
|
if(params.get("source").equals("APP")){ |
||||
|
List<InvoiceImage> list = mapper.list(params); |
||||
|
int total = mapper.count(params); |
||||
|
return RestResponse.success(PaginationUtil.getPageResult(total, params, list)); |
||||
|
}else{ |
||||
|
List<InvoiceImg> list = invoiceImgMapper.list(params); |
||||
|
int total = invoiceImgMapper.count(params); |
||||
|
return RestResponse.success(PaginationUtil.getPageResult(total, params, list)); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse selectImg(Integer id) { |
||||
|
return RestResponse.success(invoiceImgMapper.selectByPrimaryKey(id)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse selectByPrimaryKey(Integer id) { |
||||
|
return RestResponse.success(mapper.selectByPrimaryKey(id)); |
||||
|
} |
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
@Override |
||||
|
public RestResponse create(InvoiceImage invoiceImage) { |
||||
|
try { |
||||
|
invoiceImage.setDeductStatus(0); |
||||
|
mapper.insert(invoiceImage); |
||||
|
return RestResponse.success(invoiceImage); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("系统错误"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
@Override |
||||
|
public RestResponse update(InvoiceImage invoiceImage) { |
||||
|
try { |
||||
|
mapper.updateByPrimaryKeySelective(invoiceImage); |
||||
|
return RestResponse.success(invoiceImage); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("系统错误"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
@Override |
||||
|
public RestResponse delete(Integer id) { |
||||
|
try { |
||||
|
mapper.deleteByPrimaryKey(id); |
||||
|
return RestResponse.success(); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("系统错误"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
@Override |
||||
|
public RestResponse deleteBatch(String ids) { |
||||
|
try { |
||||
|
mapper.deleteBatch(ids); |
||||
|
return RestResponse.success(); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("系统错误"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse download(Integer id, HttpServletResponse response) { |
||||
|
OutputStream outputStream = null; |
||||
|
InputStream is = null; |
||||
|
try { |
||||
|
InvoiceImage invoiceImage = mapper.selectByPrimaryKey(id); |
||||
|
String path = StringUtil.isNotEmpty(invoiceImage.getOriginalUri()) ? invoiceImage.getOriginalUri() : invoiceImage.getImgUri(); |
||||
|
if (StringUtil.isEmpty(path)) { |
||||
|
return RestResponse.failure("无效的地址。"); |
||||
|
} |
||||
|
String fileName = path.substring(path.lastIndexOf("/") + 1); |
||||
|
URL url = new URL(path); |
||||
|
HttpURLConnection conn = (HttpURLConnection) url.openConnection(); |
||||
|
conn.setRequestMethod("GET"); |
||||
|
conn.setConnectTimeout(5000); |
||||
|
is = conn.getInputStream(); |
||||
|
response.setHeader("Content-Disposition", "attachment;Filename=" + URLEncoder.encode(fileName, "UTF-8")); |
||||
|
outputStream = response.getOutputStream(); |
||||
|
byte[] bytes = new byte[2048]; |
||||
|
int len; |
||||
|
while ((len = is.read(bytes)) > 0) { |
||||
|
outputStream.write(bytes, 0, len); |
||||
|
} |
||||
|
is.close(); |
||||
|
return null; |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("服务器异常"); |
||||
|
} finally { |
||||
|
IoUtil.close(outputStream); |
||||
|
IoUtil.close(is); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse exportExcel(Map<String, Object> params, HttpServletResponse response) { |
||||
|
ServletOutputStream out = null; |
||||
|
try { |
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx"); |
||||
|
StringUtils.decoderUrl(params); |
||||
|
addDataAuth(params); |
||||
|
List<InvoiceImage> list = mapper.list(params); |
||||
|
out = response.getOutputStream(); |
||||
|
EasyExcel.write(out).excelType(ExcelTypeEnum.XLSX) |
||||
|
.sheet(0, "影像管理") |
||||
|
.head(InvoiceImage.class) |
||||
|
.doWrite(list); |
||||
|
out.flush(); |
||||
|
return null; |
||||
|
} catch (Exception e) { |
||||
|
response.reset(); |
||||
|
log.error(e.getMessage(), e); |
||||
|
response.setContentType(ContentEnctype.JSON); |
||||
|
return RestResponse.failure(e.getMessage()); |
||||
|
} finally { |
||||
|
IoUtil.close(out); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse downloadImages(Map<String, Object> params, HttpServletResponse response) { |
||||
|
try { |
||||
|
SysConfig invImgImagesCount = sysConfigMapper.selectByCode("InvImgImagesCount"); |
||||
|
int count = invImgImagesCount == null ? 1000 : Integer.parseInt(invImgImagesCount.getValue()); |
||||
|
ServletOutputStream out = response.getOutputStream(); |
||||
|
addDataAuth(params); |
||||
|
List<InvoiceImage> list = mapper.list(params); |
||||
|
List<File> files = new ArrayList<>(); |
||||
|
String tempDir = uploadPath + System.currentTimeMillis(); |
||||
|
File fileTemp = new File(tempDir); |
||||
|
fileTemp.mkdir(); |
||||
|
List<String> fileNames = new ArrayList<>(); |
||||
|
for (InvoiceImage invoiceImage : list) { |
||||
|
String fileName = invoiceImage.getFileName(); |
||||
|
String downloadUri = invoiceImage.getDownloadUri(); |
||||
|
if (StringUtil.isNotEmpty(downloadUri)) { |
||||
|
String pathname; |
||||
|
if (downloadUri.contains("/opt")) { |
||||
|
pathname = uploadPath + downloadUri.substring(downloadUri.indexOf("/opt")); |
||||
|
} else { |
||||
|
pathname = uploadPath + downloadUri.substring(downloadUri.lastIndexOf("/")); |
||||
|
} |
||||
|
if (!fileName.equals("null") && new File(pathname).exists() && !fileNames.contains(pathname)) { |
||||
|
fileNames.add(pathname); |
||||
|
String fileTempName = invoiceImage.getReportId() + "_" + invoiceImage.getNumber() + "-" + count + pathname.substring(pathname.lastIndexOf(".")); |
||||
|
File copy = FileUtil.copy(pathname, tempDir + File.separator + fileTempName, true); |
||||
|
// File file = FileUtil.file(pathname);
|
||||
|
files.add(copy); |
||||
|
count--; |
||||
|
} |
||||
|
if (count == 0) { |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
if (files.isEmpty()) { |
||||
|
return RestResponse.failure("无文件,请确认条件。"); |
||||
|
} |
||||
|
File[] filesArray = files.toArray(new File[0]); |
||||
|
String zipFileName = System.currentTimeMillis() + ".zip"; |
||||
|
File zipFile = ZipUtil.zip(FileUtil.file(uploadPath + zipFileName), false, filesArray); |
||||
|
response.setHeader("Content-Disposition", "attachment;Filename=" + URLEncoder.encode(zipFileName, "UTF-8")); |
||||
|
byte[] bytes = FileUtil.readBytes(zipFile); |
||||
|
out.write(bytes); |
||||
|
out.flush(); |
||||
|
IoUtil.close(out); |
||||
|
FileUtil.del(new File(tempDir)); |
||||
|
return null; |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
return RestResponse.failure(e.getMessage()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse downloadXmls(Map<String, Object> params, HttpServletResponse response) { |
||||
|
try { |
||||
|
//得到最大的下载量
|
||||
|
SysConfig invImgImagesCount = sysConfigMapper.selectByCode("InvImgImagesCount"); |
||||
|
int count = invImgImagesCount == null ? 1000 : Integer.parseInt(invImgImagesCount.getValue()); |
||||
|
|
||||
|
ServletOutputStream out = response.getOutputStream(); |
||||
|
addDataAuth(params); |
||||
|
|
||||
|
//加上xml值不为空的条件
|
||||
|
params.put("ext01","Y"); |
||||
|
List<InvoiceImage> list = mapper.list(params); |
||||
|
|
||||
|
List<File> files = new ArrayList<>(); |
||||
|
String tempDir = uploadPath + System.currentTimeMillis(); |
||||
|
File fileTemp = new File(tempDir); |
||||
|
fileTemp.mkdir(); |
||||
|
|
||||
|
List<String> fileNames = new ArrayList<>(); |
||||
|
for (InvoiceImage invoiceImage : list) { |
||||
|
String downloadUri = invoiceImage.getExt01(); |
||||
|
if (StringUtil.isNotEmpty(downloadUri)) { |
||||
|
String pathname; |
||||
|
if (downloadUri.contains("/opt")) { |
||||
|
pathname = uploadPath + downloadUri.substring(downloadUri.indexOf("/opt")); |
||||
|
} else { |
||||
|
pathname = uploadPath + downloadUri.substring(downloadUri.lastIndexOf("/")); |
||||
|
} |
||||
|
if (new File(pathname).exists() && !fileNames.contains(pathname)) { |
||||
|
fileNames.add(pathname); |
||||
|
String fileTempName = invoiceImage.getReportId() + "_" + invoiceImage.getNumber() + "-" + count + pathname.substring(pathname.lastIndexOf(".")); |
||||
|
File copy = FileUtil.copy(pathname, tempDir + File.separator + fileTempName, true); |
||||
|
files.add(copy); |
||||
|
count--; |
||||
|
} |
||||
|
if (count == 0) { |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
if (files.isEmpty()) { |
||||
|
return RestResponse.failure("无文件,请确认条件。"); |
||||
|
} |
||||
|
File[] filesArray = files.toArray(new File[0]); |
||||
|
String zipFileName = System.currentTimeMillis() + ".zip"; |
||||
|
File zipFile = ZipUtil.zip(FileUtil.file(uploadPath + zipFileName), false, filesArray); |
||||
|
response.setHeader("Content-Disposition", "attachment;Filename=" + URLEncoder.encode(zipFileName, "UTF-8")); |
||||
|
byte[] bytes = FileUtil.readBytes(zipFile); |
||||
|
out.write(bytes); |
||||
|
out.flush(); |
||||
|
IoUtil.close(out); |
||||
|
FileUtil.del(new File(tempDir)); |
||||
|
return null; |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
return RestResponse.failure(e.getMessage()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse downloadXmlsPoc(Map<String, Object> params, HttpServletResponse response) { |
||||
|
try { |
||||
|
//得到最大的下载量
|
||||
|
SysConfig invImgImagesCount = sysConfigMapper.selectByCode("InvImgImagesCount"); |
||||
|
int count = invImgImagesCount == null ? 1000 : Integer.parseInt(invImgImagesCount.getValue()); |
||||
|
ServletOutputStream out = response.getOutputStream(); |
||||
|
addDataAuth(params); |
||||
|
List<InvoiceImage> list = mapper.list2(params); |
||||
|
|
||||
|
List<File> files = new ArrayList<>(); |
||||
|
String tempDir = uploadPath + System.currentTimeMillis(); |
||||
|
File fileTemp = new File(tempDir); |
||||
|
fileTemp.mkdir(); |
||||
|
List<String> fileNames = new ArrayList<>(); |
||||
|
for (InvoiceImage invoiceImage : list) { |
||||
|
String downloadUri = invoiceImage.getExt01(); |
||||
|
if (StringUtil.isNotEmpty(downloadUri)) { |
||||
|
String pathname = ""; |
||||
|
SysConfig xmlDownloadPathConfig = sysConfigMapper.selectByCode("HS_XML_DOWNLOAD_PATH"); |
||||
|
String xmlDownloadPath = "HS_XML_DOWNLOAD"; |
||||
|
if(null!=xmlDownloadPathConfig){ |
||||
|
xmlDownloadPath = xmlDownloadPathConfig.getValue(); |
||||
|
} |
||||
|
if (downloadUri.contains("/opt")) { |
||||
|
pathname = uploadPath + downloadUri.substring(downloadUri.indexOf("/opt")); |
||||
|
} else if (downloadUri.contains(xmlDownloadPath)) { |
||||
|
pathname = uploadPath + downloadUri.substring(downloadUri.indexOf("/"+xmlDownloadPath)); |
||||
|
} |
||||
|
log.info("pathname===={}",pathname); |
||||
|
if (new File(pathname).exists() && !fileNames.contains(pathname)) { |
||||
|
fileNames.add(pathname); |
||||
|
String fileTempName = invoiceImage.getNumber() + "-" + count + pathname.substring(pathname.lastIndexOf(".")); |
||||
|
File copy = FileUtil.copy(pathname, tempDir + File.separator + fileTempName, true); |
||||
|
files.add(copy); |
||||
|
count--; |
||||
|
} |
||||
|
if (count == 0) { |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
if (files.isEmpty()) { |
||||
|
return RestResponse.failure("无文件,请确认条件。"); |
||||
|
} |
||||
|
File[] filesArray = files.toArray(new File[0]); |
||||
|
String zipFileName = System.currentTimeMillis() + ".zip"; |
||||
|
File zipFile = ZipUtil.zip(FileUtil.file(uploadPath + zipFileName), false, filesArray); |
||||
|
response.setHeader("Content-Disposition", "attachment;Filename=" + URLEncoder.encode(zipFileName, "UTF-8")); |
||||
|
byte[] bytes = FileUtil.readBytes(zipFile); |
||||
|
out.write(bytes); |
||||
|
out.flush(); |
||||
|
IoUtil.close(out); |
||||
|
FileUtil.del(new File(tempDir)); |
||||
|
return null; |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
return RestResponse.failure(e.getMessage()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse getUnMatchImg(String reportId) { |
||||
|
return RestResponse.success(invoiceImgMapper.getUnMatchImg(reportId)); |
||||
|
} |
||||
|
|
||||
|
private void addDataAuth(Map<String, Object> params) { |
||||
|
params.put("userId", (int) RequestSecurityPolicy.getUserId()); |
||||
|
params.put("companyWord", customerMapper.selectCompanyWord()); |
||||
|
SysConfig invoice_image_source = sysConfigMapper.selectByCode("INVOICE_IMAGE_SOURCE"); |
||||
|
params.put("source", invoice_image_source == null ? "" : invoice_image_source.getValue()); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,223 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service.impl; |
||||
|
|
||||
|
import cn.databytes.btw.*; |
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.application.manager.service.InvoicePackageService; |
||||
|
import com.cmsen.ticket.domain.entity.InvoicePackage; |
||||
|
import com.cmsen.ticket.domain.entity.InvoicePackageLabel; |
||||
|
import com.cmsen.ticket.domain.entity.manager.SysUser; |
||||
|
import com.cmsen.ticket.domain.mapper.InvoicePackageLabelMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.InvoicePackageMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.SysUserMapper; |
||||
|
import com.cmsen.ticket.domain.util.PaginationUtil; |
||||
|
import com.cmsenframework.security.RequestSecurityPolicy; |
||||
|
import com.google.common.collect.Maps; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Value; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.io.File; |
||||
|
import java.text.SimpleDateFormat; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2023/6/19 16:06 |
||||
|
**/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class InvoicePackageServiceImpl implements InvoicePackageService { |
||||
|
|
||||
|
@Value("${template.image.path}") |
||||
|
private String printPath; |
||||
|
|
||||
|
@Resource |
||||
|
private InvoicePackageMapper invoicePackageMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private InvoicePackageLabelMapper invoicePackageLabelMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private SysUserMapper sysUserMapper; |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse getList(Map<String, Object> params) { |
||||
|
|
||||
|
PaginationUtil.paginationInit(params); |
||||
|
List<InvoicePackage> list = invoicePackageMapper.list(params); |
||||
|
int count = invoicePackageMapper.count(params); |
||||
|
return RestResponse.success(PaginationUtil.getPageResult(count, params, list)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse getLabelList(String packageNumber) { |
||||
|
|
||||
|
List<InvoicePackageLabel> list = invoicePackageLabelMapper.selectByPackageNumber(packageNumber); |
||||
|
return RestResponse.success(list); |
||||
|
} |
||||
|
|
||||
|
@Transactional |
||||
|
@Override |
||||
|
public RestResponse addPackage(InvoicePackage invoicePackage) { |
||||
|
InvoicePackage inPackage = invoicePackageMapper.selectByPackageNumber(invoicePackage.getPackageNumber()); |
||||
|
if(inPackage != null){ |
||||
|
return RestResponse.failure("该快递编号已存在,请检查!"); |
||||
|
} |
||||
|
|
||||
|
SysUser sysUser = sysUserMapper.selectByPrimaryKey((int) RequestSecurityPolicy.getUserId()); |
||||
|
SimpleDateFormat dateForm = new SimpleDateFormat("yyyy-MM-dd"); |
||||
|
SimpleDateFormat dateForm2 = new SimpleDateFormat("yyMMdd"); |
||||
|
|
||||
|
invoicePackage.setPackageDate(dateForm.format(new Date())); |
||||
|
invoicePackage.setReceiver(sysUser.getUserName()); |
||||
|
invoicePackage.setIsDel("0"); |
||||
|
invoicePackage.setCreateBy(sysUser.getId().toString()); |
||||
|
invoicePackage.setCreateDate(new Date()); |
||||
|
invoicePackageMapper.insertSelective(invoicePackage); |
||||
|
|
||||
|
Map<String, String> map = Maps.newHashMap(); |
||||
|
String printer = "pdfFactory Pro"; |
||||
|
|
||||
|
List<String> dataList = new ArrayList<>(); |
||||
|
//插入标签
|
||||
|
for(int i = 0; i<Integer.parseInt(invoicePackage.getAmount()); i++){ |
||||
|
InvoicePackageLabel bean = invoicePackageLabelMapper.getNextLabelNumber(); |
||||
|
|
||||
|
InvoicePackageLabel label = new InvoicePackageLabel(); |
||||
|
label.setPackageNumber(invoicePackage.getPackageNumber()); |
||||
|
label.setLabelNumber("FLC"+dateForm2.format(new Date())+bean.getLabelNumber()); |
||||
|
label.setIsPrint("1"); |
||||
|
label.setPrintDate(dateForm.format(new Date())); |
||||
|
invoicePackageLabelMapper.insertSelective(label); |
||||
|
|
||||
|
dataList.add(label.getLabelNumber()); |
||||
|
//打印
|
||||
|
/*map.put("labelNumber", label.getLabelNumber()); |
||||
|
printingMethod(printer,map);*/ |
||||
|
} |
||||
|
|
||||
|
return RestResponse.success(dataList); |
||||
|
} |
||||
|
|
||||
|
@Transactional |
||||
|
@Override |
||||
|
public RestResponse addLabel(String packageNumber, int addAmount) { |
||||
|
InvoicePackage invoicePackage = invoicePackageMapper.selectByPackageNumber(packageNumber); |
||||
|
invoicePackage.setAmount(String.valueOf(Integer.parseInt(invoicePackage.getAmount())+addAmount)); |
||||
|
invoicePackage.setUpdateBy(String.valueOf(RequestSecurityPolicy.getUserId())); |
||||
|
invoicePackage.setUpdateDate(new Date()); |
||||
|
invoicePackageMapper.updateByPrimaryKeySelective(invoicePackage); |
||||
|
|
||||
|
SimpleDateFormat dateForm = new SimpleDateFormat("yyyy-MM-dd"); |
||||
|
SimpleDateFormat dateForm2 = new SimpleDateFormat("yyMMdd"); |
||||
|
|
||||
|
Map<String, String> map = Maps.newHashMap(); |
||||
|
|
||||
|
List<String> dataList = new ArrayList<>(); |
||||
|
//插入标签
|
||||
|
for(int i = 0; i<addAmount; i++){ |
||||
|
InvoicePackageLabel bean = invoicePackageLabelMapper.getNextLabelNumber(); |
||||
|
|
||||
|
InvoicePackageLabel label = new InvoicePackageLabel(); |
||||
|
label.setPackageNumber(packageNumber); |
||||
|
label.setLabelNumber("FLC"+dateForm2.format(new Date())+bean.getLabelNumber()); |
||||
|
label.setIsPrint("1"); |
||||
|
label.setPrintDate(dateForm.format(new Date())); |
||||
|
invoicePackageLabelMapper.insertSelective(label); |
||||
|
|
||||
|
dataList.add(label.getLabelNumber()); |
||||
|
//打印
|
||||
|
/*map.put("labelNumber", label.getLabelNumber()); |
||||
|
printingMethod(printer,map);*/ |
||||
|
} |
||||
|
|
||||
|
return RestResponse.success(dataList); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse printLabel(String printer, String ids) { |
||||
|
Map<String, String> map = Maps.newHashMap(); |
||||
|
|
||||
|
//打印
|
||||
|
String[] idArr = ids.split(","); |
||||
|
for (String id : idArr ) { |
||||
|
InvoicePackageLabel label = invoicePackageLabelMapper.selectByPrimaryKey(Long.parseLong(id)); |
||||
|
|
||||
|
map.put("labelNumber", label.getLabelNumber()); |
||||
|
printingMethod(printer,map); |
||||
|
} |
||||
|
|
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse updaePackage(InvoicePackage invoicePackage) { |
||||
|
|
||||
|
InvoicePackage inPackage = invoicePackageMapper.selectByPackageNumber(invoicePackage.getPackageNumber()); |
||||
|
if(inPackage != null && inPackage.getId() != invoicePackage.getId()){ |
||||
|
return RestResponse.failure("该快递编号已存在,请检查!"); |
||||
|
} |
||||
|
InvoicePackage oldPackage = invoicePackageMapper.selectByPrimaryKey(invoicePackage.getId()); |
||||
|
String oldNumber = oldPackage.getPackageNumber(); |
||||
|
|
||||
|
|
||||
|
invoicePackage.setUpdateDate(new Date()); |
||||
|
invoicePackage.setUpdateBy(String.valueOf(RequestSecurityPolicy.getUserId())); |
||||
|
invoicePackageMapper.updateByPrimaryKeySelective(invoicePackage); |
||||
|
|
||||
|
// 同时需要更新关联关系
|
||||
|
invoicePackageLabelMapper.updateNumber(invoicePackage.getPackageNumber(),oldNumber); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse deletePackage(Long id) { |
||||
|
invoicePackageMapper.deleteByPrimaryKey(id); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
private void printingMethod(String printer, Map<String, String> map) { |
||||
|
log.info("开始打印==={}",map); |
||||
|
// 是否显示客户端
|
||||
|
boolean showClient = true; |
||||
|
// 指定使用的打印机
|
||||
|
String targetPrinter = printer; |
||||
|
try (IBarTenderPrintService printService = new BarTenderPrintService(showClient)) { |
||||
|
// 打开btw格式模板
|
||||
|
ITemplate template = printService.openTemplate( printPath + File.separator + "printTemplate.btw", targetPrinter); |
||||
|
|
||||
|
// 设置使用数据模式
|
||||
|
template.setUseDatabase(false) |
||||
|
.setUseInputDataFile(false) |
||||
|
// 设置模板命名字段数据
|
||||
|
.setData(map); |
||||
|
|
||||
|
// 打印纸张配置
|
||||
|
IPageSetup pageSetup = template.getPageSetup(); |
||||
|
// // 设置纸张大小 单位:Millimeters
|
||||
|
/*if (template1.getTemplateHeight() != null && template1.getTemplateWidth() != null) { |
||||
|
pageSetup.setPaperSize(template1.getTemplateWidth().floatValue(), template1.getTemplateHeight().floatValue()); |
||||
|
}*/ |
||||
|
log.info("大小" + pageSetup.getPaperHeight() + ":" + pageSetup.getPaperWidth()); |
||||
|
// 打印参数配置
|
||||
|
IPrintSetup printSetup = template.getPrintSetup(); |
||||
|
// 设置打印份数
|
||||
|
printSetup.setIdenticalCopiesOfLabel(1); |
||||
|
// 打印输出
|
||||
|
int i = template.printOut(); |
||||
|
|
||||
|
// 打印成功
|
||||
|
log.info("打印成功==={}",map); |
||||
|
} catch (Exception e) { |
||||
|
// 打印失败
|
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,129 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service.impl; |
||||
|
|
||||
|
import com.cmsen.common.exception.ServiceException; |
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.common.util.FileUtil; |
||||
|
import com.cmsen.ticket.application.manager.service.MtAgreementService; |
||||
|
import com.cmsen.ticket.domain.entity.MtAgreement; |
||||
|
import com.cmsen.ticket.domain.entity.MtSpeaker; |
||||
|
import com.cmsen.ticket.domain.mapper.MtAgreementMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.MtSpeakerMapper; |
||||
|
import com.cmsen.ticket.domain.util.FileImgUtil; |
||||
|
import com.cmsen.ticket.domain.util.PaginationUtil; |
||||
|
import com.cmsen.ticket.domain.util.Pdf2JpgHelper; |
||||
|
import com.cmsenframework.security.RequestSecurityPolicy; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Value; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.io.File; |
||||
|
import java.io.InputStream; |
||||
|
import java.text.SimpleDateFormat; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.UUID; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2022/10/9 16:06 |
||||
|
**/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class MtAgreementServiceImpl implements MtAgreementService { |
||||
|
|
||||
|
@Value("${manager-file.uploadPath}") |
||||
|
private String uploadPath; |
||||
|
|
||||
|
@Value("${file.domainName}") |
||||
|
private String domainName; |
||||
|
|
||||
|
@Value("${server.servlet.context-path}") |
||||
|
private String contextPath; |
||||
|
|
||||
|
@Value("${file.filepath}") |
||||
|
private String filePath; |
||||
|
|
||||
|
@Value("${img.img-virtual-Path}") |
||||
|
private String imgVirtualPath; |
||||
|
|
||||
|
@Resource |
||||
|
private MtAgreementMapper mtAgreementMapper; |
||||
|
@Resource |
||||
|
private MtSpeakerMapper mtSpeakerMapper; |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse getList(Map<String, Object> params) { |
||||
|
|
||||
|
PaginationUtil.paginationInit(params); |
||||
|
List<MtAgreement> list = mtAgreementMapper.list(params); |
||||
|
int count = mtAgreementMapper.count(params); |
||||
|
return RestResponse.success(PaginationUtil.getPageResult(count, params, list)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse update(MtAgreement mtAgreement) { |
||||
|
mtAgreementMapper.updateByPrimaryKeySelective(mtAgreement); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse upload(MultipartFile file){ |
||||
|
try{ |
||||
|
if(file != null){ |
||||
|
String originalFilename = file.getOriginalFilename(); |
||||
|
assert originalFilename != null; |
||||
|
|
||||
|
String suffix = originalFilename.substring(originalFilename.lastIndexOf(".")); |
||||
|
|
||||
|
String folder = Pdf2JpgHelper.generateFolderNoFileSep(filePath); |
||||
|
String imgFileName = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + |
||||
|
UUID.randomUUID().toString().replace("-", "") + suffix; |
||||
|
|
||||
|
String imgFilePath = filePath + java.io.File.separator + folder + File.separator + imgFileName; |
||||
|
String imgViewPath = domainName + contextPath + imgVirtualPath + "/" + folder + "/" + imgFileName; |
||||
|
|
||||
|
InputStream inputStream = file.getInputStream(); |
||||
|
FileUtil.saveFile(inputStream, imgFilePath); |
||||
|
|
||||
|
//压缩图片
|
||||
|
FileImgUtil.compressFile2(imgFilePath); |
||||
|
|
||||
|
return RestResponse.success(imgViewPath); |
||||
|
} |
||||
|
return RestResponse.success(); |
||||
|
}catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("系统异常"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse insert(MtAgreement mtAgreement){ |
||||
|
try{ |
||||
|
mtAgreement.setStatus("2"); |
||||
|
mtAgreement.setIsDel("0"); |
||||
|
mtAgreement.setClient(1); |
||||
|
mtAgreement.setCreateBy(String.valueOf(RequestSecurityPolicy.getUserId())); |
||||
|
mtAgreement.setCreateDate(new Date()); |
||||
|
mtAgreement.setExt10("1");//手动上传
|
||||
|
mtAgreementMapper.insertSelective(mtAgreement); |
||||
|
|
||||
|
//保存修改speaker的金额
|
||||
|
mtSpeakerMapper.updateAmount(new MtSpeaker(){{ |
||||
|
setReqId(mtAgreement.getReqId()); |
||||
|
setExtId(mtAgreement.getExtId()); |
||||
|
setExpenseAmount(mtAgreement.getExt02()); |
||||
|
}}); |
||||
|
|
||||
|
return RestResponse.success(); |
||||
|
}catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("系统异常"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,520 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service.impl; |
||||
|
|
||||
|
import cn.hutool.json.JSONUtil; |
||||
|
import com.cmsen.common.exception.ServiceException; |
||||
|
import com.cmsen.common.http.ClientHttp; |
||||
|
import com.cmsen.common.http.ClientHttpRequest; |
||||
|
import com.cmsen.common.http.ContentEnctype; |
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.common.util.DateFormat; |
||||
|
import com.cmsen.common.util.FileUtil; |
||||
|
import com.cmsen.common.util.JsonUtil; |
||||
|
import com.cmsen.common.util.StringUtil; |
||||
|
import com.cmsen.ticket.application.manager.service.MtListPcService; |
||||
|
import com.cmsen.ticket.domain.entity.*; |
||||
|
import com.cmsen.ticket.domain.entity.manager.SigninMeet; |
||||
|
import com.cmsen.ticket.domain.entity.manager.SigninMeetAttend; |
||||
|
import com.cmsen.ticket.domain.entity.manager.SysConfig; |
||||
|
import com.cmsen.ticket.domain.entity.manager.SysRole; |
||||
|
import com.cmsen.ticket.domain.mapper.*; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.SigninMeetAttendMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.SigninMeetMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.SysConfigMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.SysRoleMapper; |
||||
|
import com.cmsen.ticket.domain.util.FileImgUtil; |
||||
|
import com.cmsen.ticket.domain.util.PaginationUtil; |
||||
|
import com.cmsen.ticket.domain.util.Pdf2JpgHelper; |
||||
|
import com.cmsen.ticket.infrastructure.service.YunJianService; |
||||
|
import com.cmsenframework.security.RequestSecurityPolicy; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Qualifier; |
||||
|
import org.springframework.beans.factory.annotation.Value; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.io.File; |
||||
|
import java.io.InputStream; |
||||
|
import java.text.SimpleDateFormat; |
||||
|
import java.util.*; |
||||
|
import java.util.concurrent.Executor; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2022/10/9 16:06 |
||||
|
**/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class MtListPcServiceImpl implements MtListPcService { |
||||
|
|
||||
|
private String token = ""; |
||||
|
|
||||
|
@Value("${manager-file.uploadPath}") |
||||
|
private String uploadPath; |
||||
|
|
||||
|
@Value("${file.domainName}") |
||||
|
private String domainName; |
||||
|
|
||||
|
@Value("${server.servlet.context-path}") |
||||
|
private String contextPath; |
||||
|
|
||||
|
@Value("${file.filepath}") |
||||
|
private String filePath; |
||||
|
|
||||
|
@Value("${img.img-virtual-Path}") |
||||
|
private String imgVirtualPath; |
||||
|
|
||||
|
@Resource |
||||
|
@Qualifier(value = "SystemPool") |
||||
|
private Executor systemPool; |
||||
|
|
||||
|
@Resource |
||||
|
private MtPicMapper mtPicMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private EfilesMapper efilesMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private MtListMapper mtListMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private SysConfigMapper sysConfigMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private ValueSetMapper valueSetMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private MtSpeakerMapper mtSpeakerMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private UserMapper userMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private MtCheckinMapper mtCheckinMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private AttendOrgMapper attendOrgMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private SysRoleMapper sysRoleMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private SigninMeetMapper signinMeetMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private SigninMeetAttendMapper signinMeetAttendMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private YunJianService yunJianService; |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse listMeetPic(Map<String, Object> params) { |
||||
|
|
||||
|
PaginationUtil.paginationInit(params); |
||||
|
List<MtPic> list = mtPicMapper.list(params); |
||||
|
int count = mtPicMapper.count(params); |
||||
|
return RestResponse.success(PaginationUtil.getPageResult(count, params, list)); |
||||
|
} |
||||
|
|
||||
|
@Transactional |
||||
|
@Override |
||||
|
public RestResponse deletePic(Long id) { |
||||
|
|
||||
|
MtPic mtPic = mtPicMapper.selectByPrimaryKey(id); |
||||
|
mtPicMapper.deleteByPrimaryKey(id); |
||||
|
|
||||
|
Map<String, Object> params = new HashMap<String, Object>() {{ |
||||
|
put("type", "3002"); |
||||
|
put("userId", mtPic.getOwner()); |
||||
|
put("reqId", mtPic.getReqId()); |
||||
|
put("status", "0"); |
||||
|
//put("imgUrl", mtPic.getImgUrl());
|
||||
|
put("fileDate", mtPic.getFileDate()); |
||||
|
//put("reuse", "0");
|
||||
|
}}; |
||||
|
efilesMapper.deleteByParams(params); |
||||
|
|
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse meetPicUpload(MultipartFile file) { |
||||
|
try{ |
||||
|
if(file != null){ |
||||
|
String originalFilename = file.getOriginalFilename(); |
||||
|
assert originalFilename != null; |
||||
|
|
||||
|
String suffix = originalFilename.substring(originalFilename.lastIndexOf(".")); |
||||
|
|
||||
|
String folder = Pdf2JpgHelper.generateFolderNoFileSep(filePath); |
||||
|
String imgFileName = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + |
||||
|
UUID.randomUUID().toString().replace("-", "") + suffix; |
||||
|
|
||||
|
String imgFilePath = filePath + java.io.File.separator + folder + File.separator + imgFileName; |
||||
|
String imgViewPath = domainName + contextPath + imgVirtualPath + "/" + folder + "/" + imgFileName; |
||||
|
|
||||
|
InputStream inputStream = file.getInputStream(); |
||||
|
FileUtil.saveFile(inputStream, imgFilePath); |
||||
|
|
||||
|
MtPic mtPic = new MtPic(){{ |
||||
|
setImgUrl(imgViewPath); |
||||
|
setImgFilePath(imgFilePath); |
||||
|
}}; |
||||
|
return RestResponse.success(mtPic); |
||||
|
} |
||||
|
return RestResponse.success(); |
||||
|
|
||||
|
}catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("系统异常"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Transactional |
||||
|
@Override |
||||
|
public RestResponse insertPic(MultipartFile file, String reqId, String picType, String expenseName, String extId) { |
||||
|
try { |
||||
|
if(file == null){ |
||||
|
return RestResponse.failure("请上传会议图片"); |
||||
|
} |
||||
|
|
||||
|
MtPic mtPic = new MtPic(){{ |
||||
|
setReqId(reqId); |
||||
|
setPicType(picType); |
||||
|
setExpenseName(expenseName); |
||||
|
setExtId(extId); |
||||
|
}}; |
||||
|
|
||||
|
MtList mtList = mtListMapper.selectByReqId(mtPic.getReqId()); |
||||
|
|
||||
|
//判断会议时间 2022/9/9
|
||||
|
/* |
||||
|
SysConfig sysConfig = sysConfigMapper.selectByCode("MeetingTimeTol"); |
||||
|
int timeTol = Integer.parseInt(sysConfig.getValue()); |
||||
|
|
||||
|
Date nowTime = new Date(); |
||||
|
|
||||
|
Date date1 = DateFormat.parse(mtList.getStartDate()); |
||||
|
Calendar startDate = Calendar.getInstance(); |
||||
|
startDate.setTime(date1); |
||||
|
startDate.add(Calendar.MINUTE, -timeTol); |
||||
|
date1 = startDate.getTime(); |
||||
|
|
||||
|
Date date2 = DateFormat.parse(mtList.getEndDate()); |
||||
|
Calendar endDate = Calendar.getInstance(); |
||||
|
endDate.setTime(date2); |
||||
|
endDate.add(Calendar.MINUTE, timeTol); |
||||
|
date2 = endDate.getTime(); |
||||
|
|
||||
|
if(nowTime.before(date1) || nowTime.after(date2)){ |
||||
|
return RestResponse.failure("拍照时间不在会议时间控制范围内"); |
||||
|
}*/ |
||||
|
|
||||
|
String originalFilename = file.getOriginalFilename(); |
||||
|
assert originalFilename != null; |
||||
|
|
||||
|
String suffix = originalFilename.substring(originalFilename.lastIndexOf(".")); |
||||
|
|
||||
|
String folder = Pdf2JpgHelper.generateFolderNoFileSep(filePath); |
||||
|
String imgFileName = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + |
||||
|
UUID.randomUUID().toString().replace("-", "") + suffix; |
||||
|
|
||||
|
String imgFilePath = filePath + java.io.File.separator + folder + File.separator + imgFileName; |
||||
|
String imgViewPath = domainName + contextPath + imgVirtualPath + "/" + folder + "/" + imgFileName; |
||||
|
|
||||
|
InputStream inputStream = file.getInputStream(); |
||||
|
FileUtil.saveFile(inputStream, imgFilePath); |
||||
|
|
||||
|
mtPic.setImgUrl(imgViewPath); |
||||
|
|
||||
|
|
||||
|
String userId = ""; |
||||
|
if(StringUtil.isNotBlank(mtList.getExt10())){ |
||||
|
User user = userMapper.selectByEmail(mtList.getExt10()); |
||||
|
if(user != null){ |
||||
|
userId = user.getUserId().toString(); |
||||
|
} |
||||
|
} |
||||
|
String fileDate = DateFormat.format(new Date(), DateFormat.DatePatternType.FORMAT_yyyy_MM_dd_HH_mm_ss); |
||||
|
|
||||
|
mtPic.setIscopy("0"); |
||||
|
mtPic.setFileDate(fileDate); |
||||
|
mtPic.setOwner(userId); |
||||
|
mtPic.setIsDel("0"); |
||||
|
mtPic.setClient(1); |
||||
|
|
||||
|
mtPic.setCreateBy(String.valueOf(RequestSecurityPolicy.getUserId())); |
||||
|
mtPic.setCreateDate(new Date()); |
||||
|
mtPic.setExt10("1");//手动上传
|
||||
|
mtPicMapper.insertSelective(mtPic); |
||||
|
|
||||
|
//水印文本:Request ID+申请名称+活动时间
|
||||
|
//String waterMarkContent = mtList.getReqId() +" "+ mtList.getName()+" "+ mtList.getStartDate();
|
||||
|
//水印文本:x年x月x日后台推送
|
||||
|
String waterMarkContent = new SimpleDateFormat("yyyy-MM-dd").format(new Date()) +"后台推送"; |
||||
|
|
||||
|
//水印图片信息
|
||||
|
String newFileName = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + |
||||
|
UUID.randomUUID().toString().replace("-", "") + ".jpg"; |
||||
|
String newFilePath = filePath + java.io.File.separator + folder + File.separator + newFileName; |
||||
|
String newViewPath = domainName + contextPath + imgVirtualPath + "/" + folder + "/" + newFileName; |
||||
|
log.info("addWatermark参数>>{}>>{}>>{}",imgFilePath,waterMarkContent,newFilePath); |
||||
|
|
||||
|
//先 插入efiles表,后进行图片处理--走异步
|
||||
|
String finalUserId = userId; |
||||
|
Efiles efiles = new Efiles(){{ |
||||
|
setFileDate(fileDate); |
||||
|
setType("3002"); |
||||
|
setUserId(finalUserId); |
||||
|
setReqId(mtPic.getReqId()); |
||||
|
setExpenseName(mtPic.getExpenseName()); |
||||
|
setExtId(mtPic.getExtId()); |
||||
|
setVerifiedData(JsonUtil.toString(mtPic)); |
||||
|
setStatus("0"); |
||||
|
setImgUrl(newViewPath); |
||||
|
setReuse(StringUtil.isNotBlank(mtPic.getExtId()) ? "0" : "1");//会议活动照片:可重复
|
||||
|
setExt01(mtPic.getPicType()); |
||||
|
}}; |
||||
|
efilesMapper.insert(efiles); |
||||
|
|
||||
|
systemPool.execute(() -> { |
||||
|
log.info("====insertPic图片处理==Start===={}"); |
||||
|
//1.压缩图片
|
||||
|
FileImgUtil.compressFile(imgFilePath); |
||||
|
|
||||
|
//2.添加水印
|
||||
|
SysConfig config = sysConfigMapper.selectByCode("Water_Mark_Color"); |
||||
|
FileImgUtil.addWatermark(imgFilePath, waterMarkContent, newFilePath, config); |
||||
|
|
||||
|
log.info("====insertPic图片处理==End===="); |
||||
|
}); |
||||
|
|
||||
|
return RestResponse.success(); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("添加失败"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse reqList2(String reqName) { |
||||
|
List<ValueSet> list = valueSetMapper.selectByCategory3("req1", reqName, ""); |
||||
|
return RestResponse.success(list); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse valueSetList(String category) { |
||||
|
List<ValueSet> list = valueSetMapper.selectByCategory(category); |
||||
|
return RestResponse.success(list); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse meetingSpeakerList(String reqId) { |
||||
|
List<MtSpeaker> mtSpeakers = mtSpeakerMapper.selectAll(reqId); |
||||
|
return RestResponse.success(mtSpeakers); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse listMeeting(Map<String, Object> params) { |
||||
|
|
||||
|
PaginationUtil.paginationInit(params); |
||||
|
List<MtList> list = mtListMapper.list(params); |
||||
|
int count = mtListMapper.count(params); |
||||
|
return RestResponse.success(PaginationUtil.getPageResult(count, params, list)); |
||||
|
} |
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
@Override |
||||
|
public RestResponse updateMeeting(MtList mtList) { |
||||
|
try { |
||||
|
//合规备注--放ext15字段中
|
||||
|
mtListMapper.updateByPrimaryKeySelective(mtList); |
||||
|
return RestResponse.success(); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("系统错误"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse getOrgListByPid(Integer pid, String orgName){ |
||||
|
log.info("getOrgListByPid=={}=={}", pid, orgName); |
||||
|
List<AttendOrg> orgs = attendOrgMapper.getOrgListByPid(pid, orgName, ""); |
||||
|
return RestResponse.success(orgs); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse checkinList(Map<String, Object> params) { |
||||
|
|
||||
|
PaginationUtil.paginationInit(params); |
||||
|
List<MtCheckin> list = mtCheckinMapper.listByParams(params); |
||||
|
int count = mtCheckinMapper.countByParams(params); |
||||
|
return RestResponse.success(PaginationUtil.getPageResult(count, params, list)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse insertCheckin(MtCheckin mtCheckin) { |
||||
|
|
||||
|
if(mtCheckin.getExt09().equals("2")){//药店--有效
|
||||
|
mtCheckin.setStatus("1"); |
||||
|
}else{ |
||||
|
mtCheckin.setStatus("0"); |
||||
|
} |
||||
|
mtCheckin.setExt09(""); |
||||
|
mtCheckin.setExt10("1");//手动签到
|
||||
|
mtCheckin.setCreateBy(String.valueOf(RequestSecurityPolicy.getUserId())); |
||||
|
mtCheckin.setCreateDate(new Date()); |
||||
|
mtCheckin.setIsDel("0"); |
||||
|
mtCheckinMapper.insertSelective(mtCheckin); |
||||
|
|
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse getEditFlag(String roleId) { |
||||
|
SysRole sysRole = sysRoleMapper.selectByPrimaryKey(Integer.parseInt(roleId)); |
||||
|
if(sysRole != null && sysRole.getRoleType().equals("compliadmin")){ |
||||
|
return RestResponse.success(); |
||||
|
}else{ |
||||
|
return RestResponse.failure(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse meetingDetails(Long id) { |
||||
|
MtList mtList = mtListMapper.selectByPrimaryKey(id); |
||||
|
|
||||
|
//获取会议附件
|
||||
|
String reqId = mtList.getReqId(); |
||||
|
List<Efiles2> list = efilesMapper.selectListForExp(reqId, ""); |
||||
|
log.info("====meetingDetails=====fileList==={}",list.size()); |
||||
|
for (Efiles2 efiles : list) { |
||||
|
List<Efiles2> subList = efilesMapper.selecSubtListForExp(reqId,efiles.getType()); |
||||
|
efiles.setSubList(subList); |
||||
|
} |
||||
|
mtList.setEfilesList(list); |
||||
|
|
||||
|
return RestResponse.success(mtList); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse meetRevoke(String reqId) { |
||||
|
//删除所有3001协议 和 9001签到表
|
||||
|
List<Efiles> eList = efilesMapper.selectByStatus(reqId,"3001", "1"); |
||||
|
if(eList != null && eList.size() >0){ |
||||
|
return RestResponse.failure("有已使用协议,禁止撤回"); |
||||
|
} |
||||
|
|
||||
|
//调用云简的逻辑处理
|
||||
|
SysConfig sysConfig = sysConfigMapper.selectByCode("IS_Enable_YJ"); |
||||
|
if(sysConfig != null && sysConfig.getValue().equals("1")){ |
||||
|
MtList mtList = mtListMapper.selectByReqId(reqId); |
||||
|
//云简删除接口
|
||||
|
String reStr = yunJianService.meetRevoke(mtList); |
||||
|
if(!reStr.equals("success")){ |
||||
|
return RestResponse.failure(reStr); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
efilesMapper.delByType(reqId, "3001"); |
||||
|
efilesMapper.delByType(reqId, "9001"); |
||||
|
|
||||
|
//更新mtList状态为0
|
||||
|
mtListMapper.updateStatus(reqId, "0"); |
||||
|
|
||||
|
//更新valueset
|
||||
|
valueSetMapper.updateByExt04(reqId, "1", "1"); |
||||
|
|
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse meetReActive(String reqId) { |
||||
|
//更新valueset
|
||||
|
valueSetMapper.updateByExt04(reqId, "0", "1"); |
||||
|
|
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse speakerFallBack(Long id) { |
||||
|
MtSpeaker mtSpeaker = mtSpeakerMapper.selectByPrimaryKey(id); |
||||
|
mtSpeaker.setStatus("1");//正常
|
||||
|
mtSpeakerMapper.updateByPrimaryKey(mtSpeaker); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse checkinDel(Long id) { |
||||
|
mtCheckinMapper.deleteByPrimaryKey(id); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public RestResponse checkinReset(String reqId) { |
||||
|
|
||||
|
//接口:删除meeting里的签到记录
|
||||
|
SysConfig sysConfig = sysConfigMapper.selectByCode("MeetingURL"); |
||||
|
if(sysConfig != null && StringUtil.isNotBlank(sysConfig.getValue())) { |
||||
|
String meetingURL = sysConfig.getValue().trim(); |
||||
|
|
||||
|
setLocalToken(meetingURL); |
||||
|
|
||||
|
SysConfig sysConfig3 = sysConfigMapper.selectByCode("ClientID"); |
||||
|
|
||||
|
String resultUp = ClientHttp.post(new ClientHttpRequest() {{ |
||||
|
setUrl(meetingURL + "/api/signin/delSignInfo"); |
||||
|
setHeaders("Content-Type", ContentEnctype.JSON); |
||||
|
setHeaders("Authorization", token); |
||||
|
setTimeOut(50000); |
||||
|
setParams(JsonUtil.toString(new HashMap<String, String>() {{ |
||||
|
put("meetingURL", meetingURL);//用于接口的对应验证
|
||||
|
put("client", sysConfig3.getValue());//用于区分ocr系统接收
|
||||
|
put("eventId", reqId); |
||||
|
}})); |
||||
|
}}).getBody().toString(); |
||||
|
log.info("resultUp >>>>>> {}", resultUp); |
||||
|
} |
||||
|
|
||||
|
mtCheckinMapper.deleteByReqId(reqId); |
||||
|
|
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
private void setLocalToken(String meetingURL) { |
||||
|
try { |
||||
|
String result = ClientHttp.post(new ClientHttpRequest() {{ |
||||
|
setUrl(meetingURL + "/api/user/login"); |
||||
|
setParams(JsonUtil.toString(new HashMap<String, String>() {{ |
||||
|
put("userName", "guest"); |
||||
|
put("passWord", "12345"); |
||||
|
}})); |
||||
|
setHeaders("Content-Type", "application/json"); |
||||
|
}}).getBody().toString(); |
||||
|
String accessToken= JSONUtil.toBean(result, Result.class).getResult().getToken(); |
||||
|
this.token = accessToken; |
||||
|
log.info("Get token success >> {}", accessToken); |
||||
|
} catch (Exception e) { |
||||
|
log.error("Get token error >> {}", e.getMessage()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse listSignMeet(Map<String, Object> params) { |
||||
|
PaginationUtil.paginationInit(params); |
||||
|
List<SigninMeet> list = signinMeetMapper.list(params); |
||||
|
int count = signinMeetMapper.count(params); |
||||
|
return RestResponse.success(PaginationUtil.getPageResult(count, params, list)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse listSignMeetAttend(Map<String, Object> params) { |
||||
|
PaginationUtil.paginationInit(params); |
||||
|
List<SigninMeetAttend> list = signinMeetAttendMapper.list(params); |
||||
|
int count = signinMeetAttendMapper.count(params); |
||||
|
return RestResponse.success(PaginationUtil.getPageResult(count, params, list)); |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
@ -0,0 +1,292 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service.impl; |
||||
|
|
||||
|
import cn.hutool.core.io.IoUtil; |
||||
|
import com.alibaba.excel.EasyExcel; |
||||
|
import com.alibaba.excel.support.ExcelTypeEnum; |
||||
|
import com.cmsen.common.exception.ServiceException; |
||||
|
import com.cmsen.common.http.ContentEnctype; |
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.common.util.FileMime; |
||||
|
import com.cmsen.common.util.StringUtil; |
||||
|
import com.cmsen.ticket.application.manager.service.SysAppUserService; |
||||
|
import com.cmsen.ticket.domain.entity.Customer; |
||||
|
import com.cmsen.ticket.domain.entity.User; |
||||
|
import com.cmsen.ticket.domain.entity.VerifiedUser; |
||||
|
import com.cmsen.ticket.domain.mapper.CustomerMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.UserMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.VerifiedUserMapper; |
||||
|
import com.cmsen.ticket.domain.util.PaginationUtil; |
||||
|
import com.cmsen.ticket.domain.util.StringUtils; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import javax.servlet.ServletOutputStream; |
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.io.InputStream; |
||||
|
import java.text.SimpleDateFormat; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2021/3/2 14:58 |
||||
|
**/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class SysAppUserServiceImpl implements SysAppUserService { |
||||
|
@Resource |
||||
|
private VerifiedUserMapper mapper; |
||||
|
|
||||
|
@Resource |
||||
|
private UserMapper userMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private CustomerMapper customerMapper; |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse list(Map<String, Object> params) { |
||||
|
/*StringUtils.decoderUrl(params); |
||||
|
PaginationUtil.paginationInit(params);*/ |
||||
|
PageHelper.startPage(Integer.parseInt(params.get("pageNum").toString()),Integer.parseInt(params.get("pageSize").toString())); |
||||
|
List<VerifiedUser> list = mapper.list(params); |
||||
|
int total = mapper.count(params); |
||||
|
return RestResponse.success(PaginationUtil.getPageResult(total, params, list)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse selectByPrimaryKey(Integer id) { |
||||
|
return RestResponse.success(mapper.selectByPrimaryKey(id)); |
||||
|
} |
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
@Override |
||||
|
public RestResponse create(VerifiedUser user) { |
||||
|
try { |
||||
|
if (!StringUtils.isInteger(user.getTel())) { |
||||
|
return RestResponse.failure("请输入正确的手机号码。"); |
||||
|
} |
||||
|
VerifiedUser verifiedUser = mapper.checkByTel(user.getTel()); |
||||
|
if (verifiedUser != null) { |
||||
|
return RestResponse.failure("该电话号码已存在,请确认后添加。"); |
||||
|
} |
||||
|
user.setValidMode(1); |
||||
|
user.setIsDel("0"); |
||||
|
mapper.insert(user); |
||||
|
return RestResponse.success(user); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("系统错误"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
@Override |
||||
|
public RestResponse update(VerifiedUser user) { |
||||
|
try { |
||||
|
mapper.updateByPrimaryKeySelective(user); |
||||
|
String loginId = user.getLoginId(); |
||||
|
User user1 = userMapper.selectByUser(new User() {{ |
||||
|
setEmail(loginId); |
||||
|
}}); |
||||
|
if (null != user1 && !user1.getTel().equals(user.getLoginId())) { |
||||
|
user1.setEmail(user.getLoginId()); |
||||
|
userMapper.updateByPrimaryKey(user1); |
||||
|
} |
||||
|
return RestResponse.success(user); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("系统错误"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
@Override |
||||
|
public RestResponse delete(Integer id) { |
||||
|
try { |
||||
|
mapper.deleteByPrimaryKey(id); |
||||
|
return RestResponse.success(); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("系统错误"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse export(HttpServletResponse response) { |
||||
|
ServletOutputStream out = null; |
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=user.xlsx"); |
||||
|
try { |
||||
|
Customer customer = customerMapper.queryById(1); |
||||
|
List<VerifiedUser> list = mapper.export(customer.getOrgUnitWord()); |
||||
|
out = response.getOutputStream(); |
||||
|
EasyExcel.write(out).excelType(ExcelTypeEnum.XLSX) |
||||
|
.sheet(0, "用户") |
||||
|
.head(VerifiedUser.class) |
||||
|
.doWrite(list); |
||||
|
out.flush(); |
||||
|
return null; |
||||
|
} catch (Exception e) { |
||||
|
response.reset(); |
||||
|
log.error(e.getMessage(), e); |
||||
|
response.setContentType(ContentEnctype.JSON); |
||||
|
return RestResponse.failure(e.getMessage()); |
||||
|
} finally { |
||||
|
IoUtil.close(out); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Transactional |
||||
|
@Override |
||||
|
public RestResponse updateData(MultipartFile file) { |
||||
|
try { |
||||
|
InputStream inputStream = file.getInputStream(); |
||||
|
List<Map<Integer, String>> sheetRowData = EasyExcel.read(inputStream).sheet(0).doReadSync(); |
||||
|
|
||||
|
//先进行loginId的判断:为空or有重复的
|
||||
|
List<String> loginIdList = new ArrayList<>(); |
||||
|
for (int i = 0; i < sheetRowData.size(); i++) { |
||||
|
Map<Integer, String> sheetRowDatum = sheetRowData.get(i); |
||||
|
if(StringUtil.isEmpty(sheetRowDatum.get(3))){ |
||||
|
return RestResponse.failure("第"+(i+2)+"行的LOGIN_ID为空,请检查!"); |
||||
|
}else{ |
||||
|
String loginId = StringUtil.trim(String.valueOf(sheetRowDatum.get(3))); //Login id
|
||||
|
if(loginIdList.contains(loginId)){ |
||||
|
return RestResponse.failure("LOGIN_ID:"+loginId+"存在重复,请检查!"); |
||||
|
}else{ |
||||
|
loginIdList.add(loginId); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//数据处理
|
||||
|
for (int i = 0; i < sheetRowData.size(); i++) { |
||||
|
Map<Integer, String> sheetRowDatum = sheetRowData.get(i); |
||||
|
String loginId = StringUtil.trim(String.valueOf(sheetRowDatum.get(3))); //Login id
|
||||
|
log.info("第"+(i+2)+"行的LOGIN_ID=={}",loginId); |
||||
|
//根据loginId查询
|
||||
|
VerifiedUser bean = mapper.selectByLoginId(loginId); |
||||
|
if(bean == null){//插入
|
||||
|
VerifiedUser vUser = new VerifiedUser(){{ |
||||
|
setName(String.valueOf(sheetRowDatum.get(1))); |
||||
|
setTel(String.valueOf(sheetRowDatum.get(2))); |
||||
|
setLoginId(loginId); |
||||
|
setClientId(1); |
||||
|
setSimilarNames(String.valueOf(sheetRowDatum.get(4))); |
||||
|
setCorInvSubmit(String.valueOf(sheetRowDatum.get(5)).equals("TRUE") ? true : false); |
||||
|
setManual(String.valueOf(sheetRowDatum.get(6)).equals("TRUE") ? true : false); |
||||
|
setGroup(String.valueOf(sheetRowDatum.get(7))); |
||||
|
setTaxNo(String.valueOf(sheetRowDatum.get(8))); |
||||
|
setType(String.valueOf(sheetRowDatum.get(9))); |
||||
|
setBandler(String.valueOf(sheetRowDatum.get(10))); |
||||
|
setExt01(String.valueOf(sheetRowDatum.get(11))); |
||||
|
setExt02(String.valueOf(sheetRowDatum.get(12))); |
||||
|
setExt03(String.valueOf(sheetRowDatum.get(13))); |
||||
|
setExt04(String.valueOf(sheetRowDatum.get(14))); |
||||
|
setExt05(String.valueOf(sheetRowDatum.get(15))); |
||||
|
setValidMode(Integer.valueOf(sheetRowDatum.get(16))); |
||||
|
setIsDel(String.valueOf(sheetRowDatum.get(17))); |
||||
|
}}; |
||||
|
mapper.insert(vUser); |
||||
|
}else{//更新
|
||||
|
VerifiedUser vUser = new VerifiedUser(){{ |
||||
|
setId(bean.getId()); |
||||
|
if(StringUtil.isNotEmpty(sheetRowDatum.get(1))){ |
||||
|
setName(String.valueOf(sheetRowDatum.get(1))); |
||||
|
} |
||||
|
if(StringUtil.isNotEmpty(sheetRowDatum.get(2))){ |
||||
|
setTel(String.valueOf(sheetRowDatum.get(2))); |
||||
|
} |
||||
|
if(StringUtil.isNotEmpty(sheetRowDatum.get(4))){ |
||||
|
setSimilarNames(String.valueOf(sheetRowDatum.get(4))); |
||||
|
} |
||||
|
if(StringUtil.isNotEmpty(sheetRowDatum.get(5))){ |
||||
|
setCorInvSubmit(String.valueOf(sheetRowDatum.get(5)).equals("TRUE") ? true : false); |
||||
|
} |
||||
|
if(StringUtil.isNotEmpty(sheetRowDatum.get(6))){ |
||||
|
setManual(String.valueOf(sheetRowDatum.get(6)).equals("TRUE") ? true : false); |
||||
|
} |
||||
|
if(StringUtil.isNotEmpty(sheetRowDatum.get(7))){ |
||||
|
setGroup(String.valueOf(sheetRowDatum.get(7))); |
||||
|
} |
||||
|
if(StringUtil.isNotEmpty(sheetRowDatum.get(8))){ |
||||
|
setTaxNo(String.valueOf(sheetRowDatum.get(8))); |
||||
|
} |
||||
|
if(StringUtil.isNotEmpty(sheetRowDatum.get(9))){ |
||||
|
setType(String.valueOf(sheetRowDatum.get(9))); |
||||
|
} |
||||
|
if(StringUtil.isNotEmpty(sheetRowDatum.get(10))){ |
||||
|
setBandler(String.valueOf(sheetRowDatum.get(10))); |
||||
|
} |
||||
|
if(StringUtil.isNotEmpty(sheetRowDatum.get(11))){ |
||||
|
setExt01(String.valueOf(sheetRowDatum.get(11))); |
||||
|
} |
||||
|
if(StringUtil.isNotEmpty(sheetRowDatum.get(12))){ |
||||
|
setExt02(String.valueOf(sheetRowDatum.get(12))); |
||||
|
} |
||||
|
if(StringUtil.isNotEmpty(sheetRowDatum.get(13))){ |
||||
|
setExt03(String.valueOf(sheetRowDatum.get(13))); |
||||
|
} |
||||
|
if(StringUtil.isNotEmpty(sheetRowDatum.get(14))){ |
||||
|
setExt04(String.valueOf(sheetRowDatum.get(14))); |
||||
|
} |
||||
|
if(StringUtil.isNotEmpty(sheetRowDatum.get(15))){ |
||||
|
setExt05(String.valueOf(sheetRowDatum.get(15))); |
||||
|
} |
||||
|
if(StringUtil.isNotEmpty(sheetRowDatum.get(16))){ |
||||
|
setValidMode(Integer.valueOf(sheetRowDatum.get(16))); |
||||
|
} |
||||
|
if(StringUtil.isNotEmpty(sheetRowDatum.get(17))){ |
||||
|
setIsDel(String.valueOf(sheetRowDatum.get(17))); |
||||
|
} |
||||
|
}}; |
||||
|
mapper.updateByPrimaryKeySelective(vUser); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return RestResponse.success(); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("数据更新失败"); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse getUser(String tel) { |
||||
|
List<User> list = userMapper.selectListByTel(tel); |
||||
|
return RestResponse.success(list); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse delUser(Integer userId) { |
||||
|
userMapper.deleteByPrimaryKey(userId); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse insertUser(User user) { |
||||
|
String openId = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date())+String.valueOf((int)(Math.random()*100)); |
||||
|
|
||||
|
user.setOpenid(openId); |
||||
|
user.setCreateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); |
||||
|
user.setIsDel("0"); |
||||
|
user.setClient(1); |
||||
|
user.setChecked(1); |
||||
|
userMapper.insert(user); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse updateUser(User user) { |
||||
|
userMapper.updateByUserId(user); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,98 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service.impl; |
||||
|
|
||||
|
import com.cmsen.common.exception.ServiceException; |
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.application.manager.service.SysExpenseTypeService; |
||||
|
import com.cmsen.ticket.domain.entity.ExpenseType; |
||||
|
import com.cmsen.ticket.domain.mapper.ExpenseTypeMapper; |
||||
|
import com.cmsen.ticket.domain.util.PaginationUtil; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2021/3/2 13:25 |
||||
|
**/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class SysExpenseTypeServiceImpl implements SysExpenseTypeService { |
||||
|
@Resource |
||||
|
private ExpenseTypeMapper mapper; |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse list(Map<String, Object> params) { |
||||
|
PaginationUtil.paginationInit(params); |
||||
|
|
||||
|
List<ExpenseType> list = mapper.listByMap(params); |
||||
|
int total = mapper.count(params); |
||||
|
return RestResponse.success(PaginationUtil.getPageResult(total, params, list)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse selectByPaimaryKey(Integer id) { |
||||
|
return RestResponse.success(mapper.selectByPrimaryKey(id)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse updateIsDel(Integer id, String isDel) { |
||||
|
return RestResponse.success(mapper.updateIsDel(id, isDel)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse getPidList(Integer pid) { |
||||
|
return RestResponse.success(mapper.getPidList(pid)); |
||||
|
} |
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
@Override |
||||
|
public RestResponse create(ExpenseType expenseType) { |
||||
|
try { |
||||
|
ExpenseType bean = mapper.selectByPrimaryKey(expenseType.getId()); |
||||
|
if(bean != null){ |
||||
|
return RestResponse.failure("该expenseId已存在"); |
||||
|
} |
||||
|
mapper.insert(expenseType); |
||||
|
return RestResponse.success(expenseType); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("系统错误"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
@Override |
||||
|
public RestResponse update(ExpenseType expenseType) { |
||||
|
try { |
||||
|
if(!expenseType.getOldId().equals(expenseType.getId())){ |
||||
|
ExpenseType bean = mapper.selectByPrimaryKey(expenseType.getId()); |
||||
|
if(bean != null){ |
||||
|
return RestResponse.failure("该expenseId已存在"); |
||||
|
} |
||||
|
} |
||||
|
mapper.updateByPrimaryKeySelective(expenseType); |
||||
|
return RestResponse.success(expenseType); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("系统错误"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
@Override |
||||
|
public RestResponse delete(Integer id) { |
||||
|
try { |
||||
|
mapper.deleteByPrimaryKey(id); |
||||
|
return RestResponse.success(); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("系统错误"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,74 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service.impl; |
||||
|
|
||||
|
import com.cmsen.common.exception.ServiceException; |
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.application.manager.service.SysExtraFieldsService; |
||||
|
import com.cmsen.ticket.domain.entity.ExpenseTypeActive; |
||||
|
import com.cmsen.ticket.domain.entity.manager.SysUser; |
||||
|
import com.cmsen.ticket.domain.mapper.ExpenseTypeActiveMapper; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2021/3/2 13:49 |
||||
|
**/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class SysExtraFieldsServiceImpl implements SysExtraFieldsService { |
||||
|
@Resource |
||||
|
private ExpenseTypeActiveMapper mapper; |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse list(Map<String, Object> params) { |
||||
|
List<SysUser> list = mapper.list(params); |
||||
|
return RestResponse.success(list); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse selectByPaimaryKey(Integer id) { |
||||
|
return RestResponse.success(mapper.selectByPrimaryKey(id)); |
||||
|
} |
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
@Override |
||||
|
public RestResponse create(ExpenseTypeActive expenseTypeActive) { |
||||
|
try { |
||||
|
mapper.insertSelective(expenseTypeActive); |
||||
|
return RestResponse.success(expenseTypeActive); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("系统错误"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
@Override |
||||
|
public RestResponse update(ExpenseTypeActive expenseTypeActive) { |
||||
|
try { |
||||
|
mapper.updateByPrimaryKeySelective(expenseTypeActive); |
||||
|
return RestResponse.success(expenseTypeActive); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("系统错误"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
@Override |
||||
|
public RestResponse delete(Integer id) { |
||||
|
try { |
||||
|
mapper.deleteByPrimaryKey(id); |
||||
|
return RestResponse.success(); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("系统错误"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,102 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service.impl; |
||||
|
|
||||
|
import cn.hutool.core.io.IoUtil; |
||||
|
import com.alibaba.excel.EasyExcel; |
||||
|
import com.alibaba.excel.support.ExcelTypeEnum; |
||||
|
import com.cmsen.common.exception.ServiceException; |
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.common.util.FileMime; |
||||
|
import com.cmsen.ticket.application.manager.service.SysExtraValueService; |
||||
|
import com.cmsen.ticket.domain.entity.ValueSet; |
||||
|
import com.cmsen.ticket.domain.mapper.ValueSetMapper; |
||||
|
import com.cmsen.ticket.domain.util.PaginationUtil; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import javax.servlet.ServletOutputStream; |
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2021/3/2 14:20 |
||||
|
**/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class SysExtraValueServiceImpl implements SysExtraValueService { |
||||
|
@Resource |
||||
|
private ValueSetMapper mapper; |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse list(Map<String, Object> params) { |
||||
|
PaginationUtil.paginationInit(params); |
||||
|
List<ValueSet> list = mapper.list(params); |
||||
|
int total = mapper.count(params); |
||||
|
return RestResponse.success(PaginationUtil.getPageResult(total, params, list)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse selectByPrimaryKey(Integer id) { |
||||
|
return RestResponse.success(mapper.selectByPrimaryKey(id)); |
||||
|
} |
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
@Override |
||||
|
public RestResponse create(ValueSet valueSet) { |
||||
|
try { |
||||
|
mapper.insert(valueSet); |
||||
|
return RestResponse.success(valueSet); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("系统错误"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
@Override |
||||
|
public RestResponse update(ValueSet valueSet) { |
||||
|
try { |
||||
|
mapper.updateByPrimaryKeySelective(valueSet); |
||||
|
return RestResponse.success(valueSet); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("系统错误"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
@Override |
||||
|
public RestResponse delete(Integer id) { |
||||
|
try { |
||||
|
mapper.deleteByPrimaryKey(id); |
||||
|
return RestResponse.success(); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("系统错误"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse export(HttpServletResponse response) { |
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx"); |
||||
|
ServletOutputStream out = null; |
||||
|
try { |
||||
|
out = response.getOutputStream(); |
||||
|
List<ValueSet> valueSets = mapper.export(); |
||||
|
EasyExcel.write(out).excelType(ExcelTypeEnum.XLSX) |
||||
|
.sheet(0, "值列表") |
||||
|
.head(ValueSet.class) |
||||
|
.doWrite(valueSets); |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
} finally { |
||||
|
IoUtil.close(out); |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,162 @@ |
|||||
|
package com.cmsen.ticket.application.manager.service.impl; |
||||
|
|
||||
|
import com.cmsen.common.exception.ServiceException; |
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.application.manager.service.SysPolicyService; |
||||
|
import com.cmsen.ticket.application.manager.service.WorkProjectService; |
||||
|
import com.cmsen.ticket.domain.entity.ExpenseUse; |
||||
|
import com.cmsen.ticket.domain.entity.manager.SysUser; |
||||
|
import com.cmsen.ticket.domain.entity.project.Project; |
||||
|
import com.cmsen.ticket.domain.entity.project.ProjectAttendee; |
||||
|
import com.cmsen.ticket.domain.entity.project.ProjectHoursReport; |
||||
|
import com.cmsen.ticket.domain.entity.project.ProjectTask; |
||||
|
import com.cmsen.ticket.domain.mapper.ExpenseUseMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.SysUserMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.project.ProjectAttendeeMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.project.ProjectHoursReportMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.project.ProjectMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.project.ProjectTaskMapper; |
||||
|
import com.cmsen.ticket.domain.util.PaginationUtil; |
||||
|
import com.cmsenframework.security.RequestSecurityPolicy; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class WorkProjectServiceImpl implements WorkProjectService { |
||||
|
@Resource |
||||
|
private ProjectMapper projectMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private ProjectTaskMapper projectTaskMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private ProjectAttendeeMapper projectAttendeeMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private SysUserMapper sysUserMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private ProjectHoursReportMapper hoursReportMapper; |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse getProjectList(Map<String, Object> params) { |
||||
|
PaginationUtil.paginationInit(params); |
||||
|
|
||||
|
//得到登录者
|
||||
|
String loginId = String.valueOf(RequestSecurityPolicy.getUserId()); |
||||
|
params.put("loginId",loginId); |
||||
|
List<Project> list = projectMapper.list(params); |
||||
|
int total = projectMapper.count(params); |
||||
|
return RestResponse.success(PaginationUtil.getPageResult(total, params, list)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse insertProject(Project project) { |
||||
|
|
||||
|
//验证项目编号是否存在
|
||||
|
|
||||
|
project.setStatus(0); |
||||
|
project.setCreateBy(String.valueOf(RequestSecurityPolicy.getUserId())); |
||||
|
project.setCreateTime(new Date()); |
||||
|
projectMapper.insert(project); |
||||
|
|
||||
|
List<ProjectAttendee> attendeeList = project.getAttendeeList(); |
||||
|
if (attendeeList != null && !attendeeList.isEmpty()) { |
||||
|
attendeeList.forEach(item -> { |
||||
|
item.setCreateBy(String.valueOf(RequestSecurityPolicy.getUserId())); |
||||
|
item.setCreateTime(new Date()); |
||||
|
}); |
||||
|
//批量插入项目参与人
|
||||
|
|
||||
|
} |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse updateProject(Project project) { |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse deleteProject(Long id) { |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse getAttendeelist(String projectCode) { |
||||
|
return RestResponse.success(projectAttendeeMapper.getAttendeeList(projectCode)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse saveAttendee(Project project) { |
||||
|
//先删除原先的参与人
|
||||
|
projectAttendeeMapper.delAttendeeList(project.getProjectCode()); |
||||
|
|
||||
|
String[] attendeeArr = project.getAttendees().split(","); |
||||
|
for(String attendeeId : attendeeArr){ |
||||
|
ProjectAttendee attendee = new ProjectAttendee(); |
||||
|
attendee.setAttendee(attendeeId); |
||||
|
attendee.setProjectCode(project.getProjectCode()); |
||||
|
attendee.setCreateBy(String.valueOf(RequestSecurityPolicy.getUserId())); |
||||
|
attendee.setCreateTime(new Date()); |
||||
|
|
||||
|
projectAttendeeMapper.insert(attendee); |
||||
|
} |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse getTaskList(Map<String, Object> params) { |
||||
|
PaginationUtil.paginationInit(params); |
||||
|
List<ProjectTask> list = projectTaskMapper.list(params); |
||||
|
int total = projectTaskMapper.count(params); |
||||
|
return RestResponse.success(PaginationUtil.getPageResult(total, params, list)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse insertTask(ProjectTask projectTask) { |
||||
|
projectTask.setStatus(1); |
||||
|
projectTask.setCreateBy(String.valueOf(RequestSecurityPolicy.getUserId())); |
||||
|
projectTask.setCreateTime(new Date()); |
||||
|
projectTaskMapper.insert(projectTask); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse updateTask(ProjectTask projectTask) { |
||||
|
projectTask.setUpdateBy(String.valueOf(RequestSecurityPolicy.getUserId())); |
||||
|
projectTask.setUpdateTime(new Date()); |
||||
|
projectTaskMapper.updateByPrimaryKeySelective(projectTask); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse deleteTask(Long id) { |
||||
|
//检查是否存在工时
|
||||
|
List<ProjectHoursReport> hoursReportList = hoursReportMapper.getByTaskId(id); |
||||
|
if(hoursReportList != null && !hoursReportList.isEmpty()){ |
||||
|
return RestResponse.failure("该任务已存在工时填报,不可删除"); |
||||
|
} |
||||
|
|
||||
|
projectTaskMapper.deleteByPrimaryKey(id); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse selectUserList(String keyword) { |
||||
|
return RestResponse.success(sysUserMapper.selectUserList(keyword)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse finishTask(Long id) { |
||||
|
projectTaskMapper.updateStatus(id, 2); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,50 @@ |
|||||
|
package com.cmsen.ticket.application.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
|
||||
|
public interface AnlyService { |
||||
|
|
||||
|
/** |
||||
|
* 获取当月使用量(对公) |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
public RestResponse corporateInvoiceMonthNum(); |
||||
|
|
||||
|
/** |
||||
|
* 获取当年使用量(对公) |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
public RestResponse corporateInvoiceYearNum(); |
||||
|
|
||||
|
/** |
||||
|
* 获取当月使用量(普通) |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
public RestResponse invoiceMonthNum(); |
||||
|
|
||||
|
/** |
||||
|
* 获取当年使用量(普通) |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
public RestResponse invoiceYearNum(); |
||||
|
|
||||
|
/** |
||||
|
* 票种占比 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
public RestResponse getInvoiceTypeRate(); |
||||
|
|
||||
|
/** |
||||
|
* 查询票量趋势 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
public RestResponse getEveryInvoiceNum(); |
||||
|
|
||||
|
RestResponse getNotes(Integer limit); |
||||
|
} |
||||
@ -0,0 +1,901 @@ |
|||||
|
package com.cmsen.ticket.application.service; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSONArray; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.cmsen.common.util.*; |
||||
|
import com.cmsen.ticket.application.util.CacheKey; |
||||
|
import com.cmsen.ticket.domain.entity.*; |
||||
|
import com.cmsen.ticket.domain.entity.manager.InvoiceImg; |
||||
|
import com.cmsen.ticket.domain.mapper.*; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.InvoiceImageMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.InvoiceImgMapper; |
||||
|
import com.cmsen.ticket.domain.util.Base64Utils; |
||||
|
import com.cmsen.ticket.domain.util.DateUtils; |
||||
|
import com.cmsen.ticket.domain.util.Pdf2JpgHelper; |
||||
|
import com.cmsen.ticket.domain.util.StringUtils; |
||||
|
import com.cmsen.ticket.infrastructure.ocr2.AttachmentVerifyService; |
||||
|
import com.cmsen.ticket.infrastructure.ocr2.IdentifyOcrService; |
||||
|
import com.cmsen.ticket.infrastructure.ocr2.NDOcrService; |
||||
|
import com.cmsen.ticket.infrastructure.ocr2.RuiZhenOCRService; |
||||
|
import com.cmsen.ticket.infrastructure.ocr2.entity.*; |
||||
|
import com.sun.xml.fastinfoset.util.StringArray; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Qualifier; |
||||
|
import org.springframework.beans.factory.annotation.Value; |
||||
|
import org.springframework.scheduling.annotation.Async; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
import org.ujmp.core.doublematrix.calculation.general.decomposition.Inv; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.io.File; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.*; |
||||
|
import java.util.concurrent.Executor; |
||||
|
import java.util.function.Function; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2021/10/2 19:39 |
||||
|
**/ |
||||
|
@Component |
||||
|
@Slf4j |
||||
|
public class AsyncService { |
||||
|
|
||||
|
@Resource |
||||
|
private AttachmentVerifyService attachmentVerifyService; |
||||
|
|
||||
|
@Resource |
||||
|
private ExpenseTypeSubMapper expenseTypeSubMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private FilesOcrMapper filesOcrMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private InvoiceItemsMapper invoiceItemsMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private InvoiceAttendeesMapper invoiceAttendeesMapper; |
||||
|
|
||||
|
|
||||
|
@Resource |
||||
|
private FilesMapper filesMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private FilesConfigMapper filesConfigMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private InvoiceItemMileageMapper invoiceItemMileageMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private InvoiceImageFilesOcrMapper invoiceImageFilesOcrMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private RuiZhenOCRService ruiZhenOCRService; |
||||
|
|
||||
|
@Value("${manager-file.uploadPath}") |
||||
|
private String uploadPath; |
||||
|
|
||||
|
@Value("${manager-file.viewPath}") |
||||
|
private String viewPath; |
||||
|
|
||||
|
@Resource |
||||
|
private InvoiceImageMapper invoiceImageMapper; |
||||
|
@Resource |
||||
|
private InvoiceImgMapper invoiceImgMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private InvoiceImageFilesMapper invoiceImageFilesMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private ReportImagesMapper reportImagesMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private ErrorReportMapper errorReportMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private TicketTypeMappingMapper ticketTypeMappingMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private InvoiceMapper invoiceMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private IdentifyOcrService identifyOcrService; |
||||
|
|
||||
|
@Resource |
||||
|
private NDOcrService ndOcrService; |
||||
|
@Resource |
||||
|
private CorporateInvoiceNdJsonMappingMapper corporateInvoiceNdJsonMappingMapper; |
||||
|
@Resource |
||||
|
private CityMapper cityMapper; |
||||
|
|
||||
|
@Resource |
||||
|
@Qualifier(value = "SystemPool") |
||||
|
private Executor systemPool; |
||||
|
|
||||
|
private final List<String> NOT_INVOICE_TYPES = new ArrayList<String>() {{ |
||||
|
add("10900"); |
||||
|
add("20100"); |
||||
|
add("20105"); |
||||
|
add("10902"); |
||||
|
}}; |
||||
|
|
||||
|
//小程序调用附件识别接口,拿到对应 mq_id
|
||||
|
public void addProcessToMqForInvoiceAttachment(Files files, String base64, Integer expenseTypeId) { |
||||
|
systemPool.execute(() -> { |
||||
|
String processId = attachmentVerifyService.putProcessToMq(base64); |
||||
|
files.setMqId(processId); |
||||
|
StorageCache.write(CacheKey.ATTACHMENT_EXPENSE_TYPE_ID + processId, expenseTypeId, CacheKey.ATTACHMENT_SAVE_TIMEOUT); |
||||
|
StorageCache.write(CacheKey.ATTACHMENT_VERIFY_TYPE + processId, 1, CacheKey.ATTACHMENT_SAVE_TIMEOUT); |
||||
|
StorageCache.write(CacheKey.ATTACHMENT_FINISHED_FLAG + files.getId(), 1, CacheKey.ATTACHMENT_FINISHED_FLAG_TIMEOUT); |
||||
|
filesMapper.updateByPrimaryKeySelective(files); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public void addProcessToMqForInvoiceAttachment_single(Files files, String base64, Integer expenseTypeId, String code) { |
||||
|
systemPool.execute(() -> { |
||||
|
String processId = attachmentVerifyService.putProcessToMq_single(base64, code); |
||||
|
files.setMqId(processId); |
||||
|
StorageCache.write(CacheKey.ATTACHMENT_EXPENSE_TYPE_ID + processId, expenseTypeId, CacheKey.ATTACHMENT_SAVE_TIMEOUT); |
||||
|
StorageCache.write(CacheKey.ATTACHMENT_VERIFY_TYPE + processId, 1, CacheKey.ATTACHMENT_SAVE_TIMEOUT); |
||||
|
StorageCache.write(CacheKey.ATTACHMENT_FINISHED_FLAG + files.getId(), 1, CacheKey.ATTACHMENT_FINISHED_FLAG_TIMEOUT); |
||||
|
filesMapper.updateByPrimaryKeySelective(files); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
//PC 调用附件识别接口,拿到对应 mq_id
|
||||
|
public void addProcessToMqForPCUpload(Long invoiceImageFilesId, String base64) { |
||||
|
String processId = attachmentVerifyService.putProcessToMq(base64); |
||||
|
StorageCache.write(CacheKey.ATTACHMENT_VERIFY_TYPE + processId, 2, CacheKey.ATTACHMENT_SAVE_TIMEOUT); |
||||
|
StorageCache.write(CacheKey.ATTACHMENT_IMAGE_FILE_ID + processId, invoiceImageFilesId, CacheKey.ATTACHMENT_SAVE_TIMEOUT); |
||||
|
} |
||||
|
|
||||
|
public void addProcessForExtract_bak(Files files, String base64) { |
||||
|
IdentifyFileEntity identifyFileEntity = identifyOcrService.filesCrop(base64); |
||||
|
IdentifyFileEntity.JsonData jsonData = identifyFileEntity.getResult().getJson_data(); |
||||
|
if(jsonData != null && StringUtil.isNotBlank(jsonData.getChoice())){ |
||||
|
FilesConfig2 filesConfig2 = filesConfigMapper.selectByExt05(jsonData.getChoice()); |
||||
|
if(filesConfig2 != null){ |
||||
|
FilesOcr filesOcr = new FilesOcr(); |
||||
|
filesOcr.setFilesId(files.getId()); |
||||
|
filesOcr.setInvoiceId(files.getInvoiceId()); |
||||
|
filesOcr.setType(filesConfig2.getType()); |
||||
|
filesOcr.setVerifiedData(JsonUtil.toString(identifyFileEntity)); |
||||
|
filesOcrMapper.insert(filesOcr); |
||||
|
|
||||
|
//更新files的ext01===filesConfig2.getType()
|
||||
|
files.setExt01(filesConfig2.getType()); |
||||
|
filesMapper.updateByPrimaryKeySelective(files); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public String addProcessForExtract(Files files, String imgFilePath, Integer expenseTypeId) { |
||||
|
File imgFile = new File(imgFilePath); |
||||
|
String ndSearchCode = "classify"; |
||||
|
JSONObject jsonDataResult = ndOcrService.ndApiRequest(ndSearchCode,imgFile); |
||||
|
|
||||
|
if(null == jsonDataResult){ |
||||
|
log.error("addProcessForExtract===nd api response not setting or error"); |
||||
|
return "nd api response not setting or error"; |
||||
|
} |
||||
|
List<CorporateInvoiceNdJsonMapping> mappingList = corporateInvoiceNdJsonMappingMapper.listAvailable(ndSearchCode, "main"); |
||||
|
if(mappingList == null){ |
||||
|
log.error("addProcessForExtract==={}的mapping不存在(main)",ndSearchCode); |
||||
|
return ndSearchCode+"的mapping不存在(main)"; |
||||
|
}else{ |
||||
|
//肯定只有一项
|
||||
|
CorporateInvoiceNdJsonMapping entity = mappingList.get(0); |
||||
|
String sourceValue = String.valueOf(jsonDataResult.get(entity.getMappingSource())); |
||||
|
FilesConfig2 filesConfig2 = filesConfigMapper.selectByExt05(sourceValue); |
||||
|
if(filesConfig2 == null){ |
||||
|
log.error("addProcessForExtract==={}的filesConfig不存在",sourceValue); |
||||
|
return sourceValue+"的filesConfig不存在"; |
||||
|
} |
||||
|
String ext07 = filesConfig2.getExt07(); |
||||
|
if(StringUtil.isNotBlank(ext07) && ext07.contains(String.valueOf(expenseTypeId))){//需要进行二次解析
|
||||
|
Map<String, Object> verifiedData = new HashMap<>(); |
||||
|
|
||||
|
ndSearchCode = filesConfig2.getExt06(); |
||||
|
jsonDataResult = ndOcrService.ndApiRequest(ndSearchCode,imgFile); |
||||
|
|
||||
|
if(null == jsonDataResult){ |
||||
|
log.error("addProcessForExtract==={}==nd api response not setting or error",ndSearchCode); |
||||
|
return ndSearchCode+"=nd api response not setting or error"; |
||||
|
} |
||||
|
mappingList = corporateInvoiceNdJsonMappingMapper.listAvailable(ndSearchCode,"main"); |
||||
|
if(mappingList == null){ |
||||
|
log.error("addProcessForExtract==={}的mapping不存在(main)",ndSearchCode); |
||||
|
return ndSearchCode+"的mapping不存在(main)"; |
||||
|
}else{ |
||||
|
for (CorporateInvoiceNdJsonMapping mainMapping : mappingList) { |
||||
|
String key = mainMapping.getMappingDest(); |
||||
|
String value = String.valueOf(jsonDataResult.get(mainMapping.getMappingSource())); |
||||
|
verifiedData.put(key, value); |
||||
|
} |
||||
|
mappingList = corporateInvoiceNdJsonMappingMapper.listAvailable(ndSearchCode,"items"); |
||||
|
if(mappingList == null){ |
||||
|
log.error("addProcessForExtract==={}的mapping不存在(items)",ndSearchCode); |
||||
|
return ndSearchCode+"的mapping不存在(items)"; |
||||
|
}else{ |
||||
|
List<Map<String, Object>> itemList = new ArrayList<>(); |
||||
|
JSONArray itemArr = jsonDataResult.getJSONArray("items"); |
||||
|
if(itemArr != null){ |
||||
|
for (int i = 0; i < itemArr.size(); i++) { |
||||
|
JSONObject itemObject = itemArr.getJSONObject(i); |
||||
|
Map<String, Object> item = new HashMap<>(); |
||||
|
for (CorporateInvoiceNdJsonMapping itemMapping : mappingList) { |
||||
|
String key = itemMapping.getMappingDest(); |
||||
|
String value = String.valueOf(itemObject.get(itemMapping.getMappingSource())); |
||||
|
item.put(key, value); |
||||
|
} |
||||
|
//检查数据项是否符合,去掉不符合的item项
|
||||
|
if(!item.get("amount").equals("") && !item.get("amount").equals("0")){ |
||||
|
itemList.add(item); |
||||
|
} |
||||
|
} |
||||
|
verifiedData.put("itemList", itemList); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
FilesOcr filesOcr = new FilesOcr(); |
||||
|
filesOcr.setFilesId(files.getId()); |
||||
|
filesOcr.setInvoiceId(files.getInvoiceId()); |
||||
|
filesOcr.setType(filesConfig2.getType()); |
||||
|
filesOcr.setVerifiedData(JsonUtil.toString(verifiedData)); |
||||
|
filesOcrMapper.insert(filesOcr); |
||||
|
|
||||
|
//更新files的ext01===filesConfig2.getType()
|
||||
|
files.setExt01(filesConfig2.getType()); |
||||
|
filesMapper.updateByPrimaryKeySelective(files); |
||||
|
log.info("addProcessForExtract===verifiedData=={}",JsonUtil.toString(verifiedData)); |
||||
|
//判断是否需要进行 发送参与人或明细toType
|
||||
|
if(filesConfig2.getCustom3().equals("1")){ |
||||
|
doToType(JsonUtil.toString(verifiedData), filesOcr, filesConfig2, expenseTypeId); |
||||
|
} |
||||
|
|
||||
|
//如果是住宿水单1001
|
||||
|
/*if(filesConfig2.getType().equals("1001")){ |
||||
|
log.info("addProcessForExtract===verifiedData2=={}=={}",verifiedData.get("hotel_name"),verifiedData.get("hotel_city")); |
||||
|
Invoice invoice = invoiceMapper.selectByPrimaryKey(files.getInvoiceId()); |
||||
|
invoice.setSupplier(verifiedData.get("hotel_name").toString()); |
||||
|
String cityName = verifiedData.get("hotel_city").toString(); |
||||
|
City city = cityMapper.selectByName(cityName); |
||||
|
if(city != null){ |
||||
|
invoice.setCity(cityName); |
||||
|
} |
||||
|
invoiceMapper.updateByPrimaryKeySelective(invoice); |
||||
|
}*/ |
||||
|
|
||||
|
}else{//只进行一次解析
|
||||
|
FilesOcr filesOcr = new FilesOcr(); |
||||
|
filesOcr.setFilesId(files.getId()); |
||||
|
filesOcr.setInvoiceId(files.getInvoiceId()); |
||||
|
filesOcr.setType(filesConfig2.getType()); |
||||
|
filesOcrMapper.insert(filesOcr); |
||||
|
|
||||
|
//更新files的ext01===filesConfig2.getType()
|
||||
|
files.setExt01(filesConfig2.getType()); |
||||
|
filesMapper.updateByPrimaryKeySelective(files); |
||||
|
} |
||||
|
} |
||||
|
return "SUCCESS"; |
||||
|
} |
||||
|
|
||||
|
private void doToType(String verifiedData, FilesOcr filesOcr, FilesConfig2 filesConfig, Integer expenseTypeId) { |
||||
|
String classCode = filesOcr.getType(); |
||||
|
Integer toType = filesConfig.getToType(); |
||||
|
if (toType.equals(1)) { |
||||
|
int expenseTypeSubId = 0; |
||||
|
if(filesConfig.getCustom1() != null){ |
||||
|
String[] custom1Arr = filesConfig.getCustom1().split(","); |
||||
|
for(String s : custom1Arr){ |
||||
|
String[] expArr = s.split("/"); |
||||
|
if(expenseTypeId == Integer.parseInt(expArr[0])){ |
||||
|
expenseTypeSubId = Integer.parseInt(expArr[1]); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
ExpenseTypeSub expenseTypeSub = expenseTypeSubMapper.selectByPrimaryKey(expenseTypeSubId); |
||||
|
Invoice invoice = invoiceMapper.selectByPrimaryKey(filesOcr.getInvoiceId()); |
||||
|
JSONArray itemList = JSONObject.parseObject(verifiedData).getJSONArray("itemList"); |
||||
|
switch (classCode) { |
||||
|
case "1001": |
||||
|
for(int i=0; i<itemList.size(); i++){ |
||||
|
JSONObject item = itemList.getJSONObject(i); |
||||
|
InvoiceItems InvoiceItems = new InvoiceItems(); |
||||
|
InvoiceItems.setInvoiceId(filesOcr.getInvoiceId()); |
||||
|
if (null != expenseTypeSub) { |
||||
|
InvoiceItems.setExpenseTypeCode(expenseTypeSub.getCodes()); |
||||
|
InvoiceItems.setExpenseTypeName(expenseTypeSub.getName()); |
||||
|
InvoiceItems.setCategoryCode(expenseTypeSub.getCategoryCode()); |
||||
|
InvoiceItems.setExpenseTypeId(expenseTypeSub.getId()); |
||||
|
InvoiceItems.setSpendCategory(expenseTypeSub.getSpendCategory()); |
||||
|
} |
||||
|
InvoiceItems.setTransactionAmount(item.getString("amount")); |
||||
|
InvoiceItems.setTransactionDate(item.getString("date")); |
||||
|
InvoiceItems.setCustom5(filesConfig.getCustom3()); |
||||
|
InvoiceItems.setFilesId(filesOcr.getFilesId()); |
||||
|
|
||||
|
//得到reportId 2024/1/17
|
||||
|
if(invoice != null){ |
||||
|
InvoiceItems.setReportsId(invoice.getExpenseReprotsId().toString()); |
||||
|
} |
||||
|
|
||||
|
InvoiceItems.setExt05(DateFormat.format(new Date(), DateFormat.DatePatternType.FORMAT_yyyy_MM_dd_HH_mm_ss)); |
||||
|
invoiceItemsMapper.insert(InvoiceItems); |
||||
|
} |
||||
|
break; |
||||
|
case "1004": |
||||
|
for(int i=0; i<itemList.size(); i++){ |
||||
|
JSONObject item = itemList.getJSONObject(i); |
||||
|
InvoiceItems invoiceItems1 = new InvoiceItems(); |
||||
|
invoiceItems1.setInvoiceId(filesOcr.getInvoiceId()); |
||||
|
if (null != expenseTypeSub) { |
||||
|
invoiceItems1.setExpenseTypeCode(expenseTypeSub.getCodes()); |
||||
|
invoiceItems1.setExpenseTypeName(expenseTypeSub.getName()); |
||||
|
invoiceItems1.setCategoryCode(expenseTypeSub.getCategoryCode()); |
||||
|
invoiceItems1.setExpenseTypeId(expenseTypeSub.getId()); |
||||
|
invoiceItems1.setSpendCategory(expenseTypeSub.getSpendCategory()); |
||||
|
} |
||||
|
invoiceItems1.setTransactionAmount(item.getString("amount")); |
||||
|
invoiceItems1.setTransactionDate(item.getString("date")); |
||||
|
invoiceItems1.setRemark(item.getString("car_type") + "," + item.getString("station_geton") + "-" + item.getString("station_getoff")+ "," + item.getString("mileage")); |
||||
|
invoiceItems1.setCustom5(filesConfig.getCustom3()); |
||||
|
invoiceItems1.setFilesId(filesOcr.getFilesId()); |
||||
|
|
||||
|
//得到reportId 2024/1/17
|
||||
|
if(invoice != null){ |
||||
|
invoiceItems1.setReportsId(invoice.getExpenseReprotsId().toString()); |
||||
|
} |
||||
|
|
||||
|
invoiceItems1.setExt05(DateFormat.format(new Date(), DateFormat.DatePatternType.FORMAT_yyyy_MM_dd_HH_mm_ss)); |
||||
|
invoiceItemsMapper.insert(invoiceItems1); |
||||
|
} |
||||
|
break; |
||||
|
default: |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public void addProcessForExtract_single(Files files, String base64, Integer expenseTypeId, String code) { |
||||
|
String response = identifyOcrService.filesCrop_single(base64, code); |
||||
|
|
||||
|
JSONObject res = JSONObject.parseObject(response); |
||||
|
|
||||
|
if(res.getJSONArray("data") != null){ |
||||
|
JSONObject data = res.getJSONArray("data").getJSONObject(0); |
||||
|
Map<String, Object> verifiedData = new HashMap<>(); |
||||
|
JSONObject result = data.getJSONObject("result"); |
||||
|
|
||||
|
List<Map<String, Object>> itemList = new ArrayList<>(); |
||||
|
JSONArray items = result.getJSONArray("items"); |
||||
|
for(int i=0; i<items.size(); i++) { |
||||
|
JSONObject itemObject = items.getJSONObject(i); |
||||
|
|
||||
|
Map<String, Object> item = new HashMap<>(); |
||||
|
item.put("car_type", itemObject.getString("car_type")); |
||||
|
item.put("date", getDateForDiDi(itemObject.getString("time_geton"))); |
||||
|
item.put("city", itemObject.getString("city")); |
||||
|
item.put("station_geton", itemObject.getString("station_geton")); |
||||
|
item.put("station_getoff", itemObject.getString("station_getoff")); |
||||
|
item.put("mileage", itemObject.getString("mileage")); |
||||
|
item.put("amount", itemObject.getString("total")); |
||||
|
|
||||
|
//检查数据项是否符合,去掉不符合的item项
|
||||
|
if(!item.get("amount").equals("") && !item.get("amount").equals("0")){ |
||||
|
itemList.add(item); |
||||
|
} |
||||
|
} |
||||
|
verifiedData.put("itemList", itemList); |
||||
|
|
||||
|
FilesConfig2 filesConfig2 = filesConfigMapper.selByType(code); |
||||
|
|
||||
|
if(!data.getString("classcode").equals(code)){//返回code不一致,要重新赋值
|
||||
|
data.put("classname", filesConfig2.getExt05()); |
||||
|
data.put("classcode", code); |
||||
|
} |
||||
|
|
||||
|
FilesOcr filesOcr = new FilesOcr(); |
||||
|
filesOcr.setFilesId(files.getId()); |
||||
|
filesOcr.setInvoiceId(files.getInvoiceId()); |
||||
|
filesOcr.setType(code); |
||||
|
filesOcr.setVerifiedData(JsonUtil.toString(res)); |
||||
|
filesOcrMapper.insert(filesOcr); |
||||
|
|
||||
|
//更新files的ext01===code
|
||||
|
files.setExt01(code); |
||||
|
filesMapper.updateByPrimaryKeySelective(files); |
||||
|
log.info("addProcessForExtract_single===verifiedData=={}",JsonUtil.toString(res)); |
||||
|
//判断是否需要进行 发送参与人或明细toType
|
||||
|
if(filesConfig2.getCustom3().equals("1")){ |
||||
|
doToType(JsonUtil.toString(verifiedData), filesOcr, filesConfig2, expenseTypeId); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
//处理附件识别返回数据
|
||||
|
@Async(value = "SystemPool") |
||||
|
public void smartInvoiceAttachment(AttachmentMqRes res) { |
||||
|
long start = System.currentTimeMillis(); |
||||
|
String mqId = res.getMqId(); |
||||
|
Files files = filesMapper.selectByMqId(mqId); |
||||
|
try { |
||||
|
int verifyType = (int) Optional.ofNullable(StorageCache.read(CacheKey.ATTACHMENT_VERIFY_TYPE + mqId)).orElse(0); |
||||
|
String content = JsonUtil.toString(res.getContent()); |
||||
|
AttachmentEntity attachmentEntity; |
||||
|
log.info("smartInvoiceAttachment=====content====={}",content); |
||||
|
attachmentEntity = JsonUtil.toClass(content, AttachmentEntity.class); |
||||
|
if (attachmentEntity == null) { |
||||
|
attachmentEntity = new AttachmentEntity(); |
||||
|
attachmentEntity.setSuccess(false); |
||||
|
} else { |
||||
|
List<AttachmentEntity.DataDTO> dataDTOS = attachmentEntity.getData(); |
||||
|
if (dataDTOS == null || dataDTOS.isEmpty() || dataDTOS.get(0).getResults().isEmpty()) { |
||||
|
attachmentEntity.setSuccess(false); |
||||
|
} |
||||
|
attachmentEntity.setSuccess(true); |
||||
|
} |
||||
|
attachmentEntity.setResult(content); |
||||
|
if (1 == verifyType) { |
||||
|
if (files != null) { |
||||
|
List<FilesConfig> filesConfigs = filesConfigMapper.selectAll(); |
||||
|
Map<String, FilesConfig> filesConfigMap = filesConfigs.stream().collect(Collectors.toMap(FilesConfig::getType, Function.identity())); |
||||
|
boolean success = attachmentEntity.isSuccess(); |
||||
|
log.info("smartInvoiceAttachment==attachmentEntity>>{}", attachmentEntity); |
||||
|
if (success) { |
||||
|
List<AttachmentEntity.DataDTO> data = attachmentEntity.getData(); |
||||
|
if (data.isEmpty()) { |
||||
|
log.info("smartInvoiceAttachment==data.isEmpty>>"); |
||||
|
releaseCache(mqId, files); |
||||
|
return; |
||||
|
} |
||||
|
AttachmentEntity.DataDTO dataDTO = data.get(0); |
||||
|
List<AttachmentEntity.DataDTO.ResultsDTO> results = dataDTO.getResults(); |
||||
|
|
||||
|
FilesOcr filesOcr = new FilesOcr(); |
||||
|
filesOcr.setFilesId(files.getId()); |
||||
|
filesOcr.setInvoiceId(files.getInvoiceId()); |
||||
|
filesOcr.setType(dataDTO.getClasscode()); |
||||
|
filesOcr.setVerifiedData(attachmentEntity.getResult()); |
||||
|
|
||||
|
if (results.isEmpty()) { |
||||
|
log.info("smartInvoiceAttachment==results.isEmpty>>"); |
||||
|
releaseCache(mqId, files); |
||||
|
return; |
||||
|
} |
||||
|
AttachmentEntity.DataDTO.ResultsDTO resultsDTO = results.get(0); |
||||
|
String classCode = dataDTO.getClasscode(); |
||||
|
FilesConfig filesConfig = filesConfigMap.get(classCode); |
||||
|
log.info("smartInvoiceAttachment==mqId>>{}==classCode>>{}", mqId, classCode); |
||||
|
switch (classCode) { |
||||
|
case "1001": |
||||
|
filesOcr.setAmount(resultsDTO.getHotelSheet().getTotal()); |
||||
|
filesOcr.setInvDate(StringUtils.formatDate(resultsDTO.getHotelSheet().getCheckInTime())); |
||||
|
break; |
||||
|
case "1002": |
||||
|
filesOcr.setAmount(resultsDTO.getPaidData().getTotal()); |
||||
|
if (resultsDTO.getScreenShot() != null) { |
||||
|
filesOcr.setInvDate(StringUtils.formatDate(resultsDTO.getScreenShot().getTime())); |
||||
|
} else if (resultsDTO.getPosSheet() != null) { |
||||
|
filesOcr.setInvDate(StringUtils.formatDate(resultsDTO.getPosSheet().getConsume_time())); |
||||
|
} |
||||
|
break; |
||||
|
case "1003": |
||||
|
filesOcr.setAmount(resultsDTO.getRestaurantBill().getTotal()); |
||||
|
filesOcr.setInvDate(StringUtils.formatDate(resultsDTO.getRestaurantBill().getTime())); |
||||
|
break; |
||||
|
case "1004": |
||||
|
filesOcr.setAmount(resultsDTO.getDidi().getTotal()); |
||||
|
filesOcr.setInvDate(StringUtils.formatDate(resultsDTO.getDidi().getDate())); |
||||
|
break; |
||||
|
case "2001": |
||||
|
break; |
||||
|
case "9001": |
||||
|
break; |
||||
|
default: |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
if(!classCode.equals("9999")){ |
||||
|
//更新files的ext01===classCode 2022/12/2
|
||||
|
files.setExt01(classCode); |
||||
|
filesMapper.updateByPrimaryKeySelective(files); |
||||
|
|
||||
|
filesOcrMapper.insert(filesOcr); |
||||
|
dealAttachmentWithFilesConfig(resultsDTO, filesOcr, filesConfig, mqId); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} else if (2 == verifyType) { |
||||
|
if (attachmentEntity.isSuccess()) { |
||||
|
List<AttachmentEntity.DataDTO> data = attachmentEntity.getData(); |
||||
|
AttachmentEntity.DataDTO dataDTO = data.get(0); |
||||
|
String classCode = dataDTO.getClasscode(); |
||||
|
InvoiceImageFilesOcr invoiceImageFilesOcr = new InvoiceImageFilesOcr(); |
||||
|
invoiceImageFilesOcr.setType(classCode); |
||||
|
invoiceImageFilesOcr.setPid((Long) Optional.ofNullable(StorageCache.read(CacheKey.ATTACHMENT_IMAGE_FILE_ID + mqId)).orElse(0L)); |
||||
|
invoiceImageFilesOcr.setVerifiedData(attachmentEntity.getResult()); |
||||
|
invoiceImageFilesOcrMapper.insert(invoiceImageFilesOcr); |
||||
|
} |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
log.error("smartInvoiceAttachment", e); |
||||
|
} |
||||
|
|
||||
|
long end = System.currentTimeMillis(); |
||||
|
|
||||
|
log.info("smartInvoiceAttachment dis >> {}", (end - start) / 1000); |
||||
|
|
||||
|
releaseCache(mqId, files); |
||||
|
} |
||||
|
|
||||
|
private void releaseCache(String mqId, Files files) { |
||||
|
//移除已使用队列
|
||||
|
StorageCache.remove(CacheKey.ATTACHMENT_EXPENSE_TYPE_ID + mqId); |
||||
|
StorageCache.remove(CacheKey.ATTACHMENT_VERIFY_TYPE + mqId); |
||||
|
StorageCache.remove(CacheKey.ATTACHMENT_IMAGE_FILE_ID + mqId); |
||||
|
if (files != null) { |
||||
|
StorageCache.remove(CacheKey.ATTACHMENT_FINISHED_FLAG + files.getId()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// @Async(value = "SystemPool")
|
||||
|
public void dealFaceReports(String reportId, String originalFilePath, List<List<String>> images2) { |
||||
|
log.info("dealFaceReports >> >> >> >> >> >> >> >> "); |
||||
|
systemPool.execute(() -> { |
||||
|
try { |
||||
|
boolean hasReportId = StringUtil.isNotBlank(reportId); |
||||
|
String reportLast = reportId; |
||||
|
String originalId = null; |
||||
|
for (List<String> images : images2) { |
||||
|
log.info("Images >> {}", images); |
||||
|
String viewPre = images.get(0); |
||||
|
String savePath = images.get(1); |
||||
|
String fileName = images.get(2); |
||||
|
String value = Base64Util.fileToBase64(savePath); |
||||
|
String reportV = attachmentVerifyService.verifiedReport(value); |
||||
|
log.info("reportV >> {} >> hasReportId >> {}", reportV, hasReportId); |
||||
|
if (!hasReportId && reportV != null) { |
||||
|
reportLast = reportV; |
||||
|
|
||||
|
//检查report是否已经存在,存在则报错
|
||||
|
//int checkCount = invoiceImageMapper.checkHasReportId(reportLast);
|
||||
|
//变更InvoiceImg 2023/11/6
|
||||
|
int checkCount = invoiceImgMapper.checkHasReportId(reportLast); |
||||
|
if (checkCount > 0) { |
||||
|
log.info("dealFaceReports >> reportId已经存在-主 >> {}", reportLast); |
||||
|
return; |
||||
|
} |
||||
|
int mainReportCheckCount = 0; |
||||
|
// int mainReportCheckCount = t10ReportMainMapper.checkHasReportId(reportLast);
|
||||
|
if (mainReportCheckCount == 0) { |
||||
|
ErrorReport errReport = new ErrorReport() {{ |
||||
|
setCreateTime(new Date()); |
||||
|
setStatus("单据号码不存在"); |
||||
|
}}; |
||||
|
errReport.setReportId(reportV); |
||||
|
errorReportMapper.insert(errReport); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
if(reportLast.equals("")){ |
||||
|
log.info("dealFaceReports >> reportLast没有值 >>"); |
||||
|
return; |
||||
|
} |
||||
|
RuiZhenOCREntity ruiZhenOCREntity = ruiZhenOCRService.billsCrop(value); |
||||
|
List<RuiZhenOCREntity.IdentifyResults> resultsList = ruiZhenOCREntity.getResponse().getData().getIdentify_results(); |
||||
|
for (RuiZhenOCREntity.IdentifyResults identifyResults : resultsList) { |
||||
|
String imgUri = StringUtils.formatUrl(viewPath + viewPre, null); |
||||
|
|
||||
|
//ticket type转换 2023/11/30
|
||||
|
if(StringUtil.isNotEmpty(identifyResults.getDetails().getTitle())){ |
||||
|
TicketTypeMapping ticketTypeMapping = ticketTypeMappingMapper.findByRecord(new TicketTypeMapping() {{ |
||||
|
setTicketCode(identifyResults.getType()); |
||||
|
setTitle(identifyResults.getDetails().getTitle()); |
||||
|
setActive(true); |
||||
|
}}); |
||||
|
|
||||
|
if(ticketTypeMapping != null){ |
||||
|
identifyResults.setType(ticketTypeMapping.getTicketCodeMapping()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
log.info("dealFaceReports Type >> >> >>{}",identifyResults.getType()); |
||||
|
|
||||
|
if (NOT_INVOICE_TYPES.contains(identifyResults.getType())) { |
||||
|
InvoiceImageFiles invoiceImageFiles = new InvoiceImageFiles(); |
||||
|
invoiceImageFiles.setOriginalId(null); |
||||
|
invoiceImageFiles.setSource("PC"); |
||||
|
invoiceImageFiles.setFileName(fileName); |
||||
|
invoiceImageFiles.setViewPath(imgUri); |
||||
|
invoiceImageFiles.setReportId(reportLast); |
||||
|
invoiceImageFilesMapper.insert(invoiceImageFiles); |
||||
|
addProcessToMqForPCUpload(invoiceImageFiles.getId(), value); |
||||
|
} else { |
||||
|
List<Integer> region = identifyResults.getRegion(); |
||||
|
String subImage; |
||||
|
try { |
||||
|
subImage = new Base64Utils().getSubImage(value, new Base64Utils.ImageInfo(region.get(0), region.get(1), region.get(2), region.get(3))); |
||||
|
} catch (Exception e) { |
||||
|
try { |
||||
|
subImage = new Base64Utils().getSubImage(value, new Base64Utils.ImageInfo(region.get(1), region.get(0), region.get(3), region.get(2))); |
||||
|
} catch (Exception e1) { |
||||
|
subImage = null; |
||||
|
} |
||||
|
} |
||||
|
if (StringUtil.isEmpty(subImage)) { |
||||
|
subImage = value; |
||||
|
} |
||||
|
|
||||
|
String folder = Pdf2JpgHelper.generateFolder(uploadPath); |
||||
|
String newFileName = reportLast + StringUtil.UUID() + ".jpg"; |
||||
|
String filePath = uploadPath + File.separator + folder + newFileName; |
||||
|
Base64Util.toSaveFile(filePath, subImage); |
||||
|
String vNewPath = StringUtils.formatUrl(viewPath + "/" + folder + "/" + newFileName, null); |
||||
|
|
||||
|
String uuid = StringUtil.UUID(); |
||||
|
Details details = identifyResults.getDetails(); |
||||
|
//InvoiceImage invoiceImage = new InvoiceImage();
|
||||
|
//变更InvoiceImg 2023/11/6
|
||||
|
InvoiceImg invoiceImage = new InvoiceImg(); |
||||
|
invoiceImage.setOriginalId(uuid); |
||||
|
invoiceImage.setSource("PC"); |
||||
|
invoiceImage.setCode(details.getCode()); |
||||
|
//增加10503 code判断 2024.12.5
|
||||
|
if(identifyResults.getType().equals("10503") && |
||||
|
StringUtil.isNotEmpty(details.getNumber()) && details.getNumber().length() == 20){ |
||||
|
invoiceImage.setCode("0000"); |
||||
|
} |
||||
|
invoiceImage.setNumber(details.getNumber()); |
||||
|
invoiceImage.setDate(StringUtil.isEmpty(details.getDate()) ? "" : details.getDate().replace("年", "-").replace("月", "-").replace("日", "")); |
||||
|
invoiceImage.setPretaxAmount(details.getPretax_amount()); |
||||
|
invoiceImage.setTotal(details.getTotal()); |
||||
|
invoiceImage.setTax(details.getTax()); |
||||
|
invoiceImage.setCheckCode(details.getCheck_code()); |
||||
|
invoiceImage.setSeller(details.getSeller()); |
||||
|
invoiceImage.setSellerTaxId(details.getSeller_tax_id()); |
||||
|
invoiceImage.setKind(details.getKind()); |
||||
|
invoiceImage.setBuyer(details.getBuyer()); |
||||
|
invoiceImage.setBuyerTaxId(details.getBuyer_tax_id()); |
||||
|
invoiceImage.setItemNames(details.getItem_names()); |
||||
|
invoiceImage.setCreateDate(new Date()); |
||||
|
invoiceImage.setReportId(reportLast); |
||||
|
invoiceImage.setStatus(0); |
||||
|
invoiceImage.setImgUri(vNewPath); |
||||
|
invoiceImage.setOriginalUri(originalFilePath); |
||||
|
invoiceImage.setCurrency("CNY"); |
||||
|
invoiceImage.setInvoiceType(ruiZhenOCRService.getByType(identifyResults.getType())); |
||||
|
invoiceImage.setPassenger(details.getName()); |
||||
|
invoiceImage.setSeatType(details.getSeat()); |
||||
|
invoiceImage.setStartStation(details.getStation_geton()); |
||||
|
invoiceImage.setEndStation(details.getStation_getoff()); |
||||
|
invoiceImage.setDeductStatus(0); |
||||
|
invoiceImage.setTaxRate(details.getItems().isEmpty() ? "0" : details.getItems().get(0).getTax_rate()); |
||||
|
invoiceImage.setValidStatus(true); |
||||
|
invoiceImage.setDataJson(JsonUtil.toString(identifyResults)); |
||||
|
invoiceImgMapper.insert(invoiceImage); |
||||
|
originalId = invoiceImage.getOriginalId(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
if (StringUtil.isNotBlank(reportLast)) { |
||||
|
ReportImages reportImages = new ReportImages(); |
||||
|
reportImages.setReportId(reportLast); |
||||
|
reportImages.setImgUri(StringUtils.formatUrl(viewPath + viewPre, null)); |
||||
|
reportImages.setSource("INTERFACE"); |
||||
|
reportImages.setCreateDate(new Date()); |
||||
|
reportImagesMapper.insert(reportImages); |
||||
|
} |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
log.error("面单解析异常", e); |
||||
|
} |
||||
|
log.info("dealFaceReports Success >> >> >> >> >> >> >> >> "); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
private void dealAttachmentWithFilesConfig(AttachmentEntity.DataDTO.ResultsDTO resultsDTO, FilesOcr filesOcr, FilesConfig filesConfig, String mqId) { |
||||
|
if (filesConfig == null) { |
||||
|
return; |
||||
|
} |
||||
|
String classCode = filesOcr.getType(); |
||||
|
Integer toType = filesConfig.getToType(); |
||||
|
if (toType.equals(1)) { |
||||
|
InvoiceItems invoiceItems = new InvoiceItems(); |
||||
|
invoiceItems.setInvoiceId(filesOcr.getInvoiceId()); |
||||
|
ExpenseTypeSub expenseTypeSub = null; |
||||
|
if (StorageCache.containsKey(CacheKey.ATTACHMENT_EXPENSE_TYPE_ID + mqId) && StringUtil.isNotEmpty(filesConfig.getCustom1())) { |
||||
|
String[] split = filesConfig.getCustom1().split(","); |
||||
|
for (String idMap : split) { |
||||
|
if (idMap.startsWith(StorageCache.read(CacheKey.ATTACHMENT_EXPENSE_TYPE_ID + mqId).toString())) { |
||||
|
expenseTypeSub = expenseTypeSubMapper.selectByPrimaryKey(Integer.valueOf(idMap.split("/")[1])); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (null == expenseTypeSub) { |
||||
|
expenseTypeSub = new ExpenseTypeSub(); |
||||
|
} |
||||
|
|
||||
|
//得到reportId 2024/1/17
|
||||
|
Invoice invoice = invoiceMapper.selectByPrimaryKey(filesOcr.getInvoiceId()); |
||||
|
if(invoice != null){ |
||||
|
invoiceItems.setReportsId(invoice.getExpenseReprotsId().toString()); |
||||
|
} |
||||
|
|
||||
|
invoiceItems.setExpenseTypeCode(expenseTypeSub.getCodes()); |
||||
|
invoiceItems.setExpenseTypeName(expenseTypeSub.getName()); |
||||
|
invoiceItems.setCategoryCode(expenseTypeSub.getCategoryCode()); |
||||
|
invoiceItems.setExpenseTypeId(expenseTypeSub.getId()); |
||||
|
invoiceItems.setSpendCategory(expenseTypeSub.getSpendCategory()); |
||||
|
invoiceItems.setCustom5(filesConfig.getCustom3()); |
||||
|
invoiceItems.setFilesId(filesOcr.getFilesId()); |
||||
|
invoiceItems.setExt05(DateFormat.format(new Date(), DateFormat.DatePatternType.FORMAT_yyyy_MM_dd_HH_mm_ss)); |
||||
|
|
||||
|
switch (classCode) { |
||||
|
case "1001": |
||||
|
invoiceItems.setTransactionAmount(resultsDTO.getHotelSheet().getTotal()); |
||||
|
invoiceItemsMapper.insert(invoiceItems); |
||||
|
break; |
||||
|
case "1002": |
||||
|
invoiceItems.setTransactionAmount(resultsDTO.getPaidData().getTotal()); |
||||
|
invoiceItemsMapper.insert(invoiceItems); |
||||
|
break; |
||||
|
case "1003": |
||||
|
invoiceItems.setTransactionAmount(resultsDTO.getRestaurantBill().getTotal()); |
||||
|
invoiceItemsMapper.insert(invoiceItems); |
||||
|
break; |
||||
|
case "1004": |
||||
|
invoiceItems.setTransactionAmount(resultsDTO.getDidi().getTotal()); |
||||
|
List<AttachmentEntity.DataDTO.ResultsDTO.Didi.DidiItem> items = resultsDTO.getDidi().getItems(); |
||||
|
for (AttachmentEntity.DataDTO.ResultsDTO.Didi.DidiItem item : items) { |
||||
|
InvoiceItems invoiceItems1 = new InvoiceItems(); |
||||
|
invoiceItems1.setInvoiceId(filesOcr.getInvoiceId()); |
||||
|
invoiceItems1.setExpenseTypeCode(expenseTypeSub.getCodes()); |
||||
|
invoiceItems1.setExpenseTypeName(expenseTypeSub.getName()); |
||||
|
invoiceItems1.setCategoryCode(expenseTypeSub.getCategoryCode()); |
||||
|
invoiceItems1.setExpenseTypeId(expenseTypeSub.getId()); |
||||
|
invoiceItems1.setSpendCategory(expenseTypeSub.getSpendCategory()); |
||||
|
invoiceItems1.setTransactionAmount(item.getTotal()); |
||||
|
invoiceItems1.setTransactionDate(getDateForDiDi(item.getTime_geton())); |
||||
|
invoiceItems1.setRemark(item.getCar_type() + "," + item.getStation_geton() + "-" + item.getStation_getoff() + "," + item.getMileage()); |
||||
|
invoiceItems1.setCustom5(filesConfig.getCustom3()); |
||||
|
invoiceItems1.setFilesId(filesOcr.getFilesId()); |
||||
|
|
||||
|
//得到reportId 2024/1/17
|
||||
|
Invoice invoice1 = invoiceMapper.selectByPrimaryKey(filesOcr.getInvoiceId()); |
||||
|
if(invoice1 != null){ |
||||
|
invoiceItems1.setReportsId(invoice1.getExpenseReprotsId().toString()); |
||||
|
} |
||||
|
invoiceItems1.setExt05(DateFormat.format(new Date(), DateFormat.DatePatternType.FORMAT_yyyy_MM_dd_HH_mm_ss)); |
||||
|
invoiceItemsMapper.insert(invoiceItems1); |
||||
|
} |
||||
|
break; |
||||
|
case "9001": |
||||
|
break; |
||||
|
default: |
||||
|
break; |
||||
|
} |
||||
|
} else if (toType.equals(2)) { |
||||
|
switch (classCode) { |
||||
|
case "1001": |
||||
|
break; |
||||
|
case "1002": |
||||
|
break; |
||||
|
case "1003": |
||||
|
break; |
||||
|
case "1004": |
||||
|
break; |
||||
|
case "9001": |
||||
|
// List<AttachmentEntity.DataDTO.ResultsDTO.AttendanceSheet.AttendeeDetails> details = resultsDTO.getAttendanceSheet().getDetail();
|
||||
|
// for (AttachmentEntity.DataDTO.ResultsDTO.AttendanceSheet.AttendeeDetails detail : details) {
|
||||
|
// if ("True".equals(detail.getAssigned())) {
|
||||
|
// T10Attendee t10Attendee = t10AttendeeMapper.selectByPersonCode(detail.getDoctorCode());
|
||||
|
// if (t10Attendee != null) {
|
||||
|
// InvoiceAttendees invoiceAttendees = new InvoiceAttendees();
|
||||
|
// invoiceAttendees.setInvoiceId(filesOcr.getInvoiceId());
|
||||
|
// invoiceAttendees.setAttendeeId(t10Attendee.getAttendId());
|
||||
|
// invoiceAttendees.setName(t10Attendee.getName());
|
||||
|
// invoiceAttendees.setCustom5(filesConfig.getCustom3());
|
||||
|
// invoiceAttendees.setCount(1);
|
||||
|
// invoiceAttendees.setFilesId(filesOcr.getFilesId());
|
||||
|
// invoiceAttendees.setCreateDate(new Date());
|
||||
|
// invoiceAttendeesMapper.insert(invoiceAttendees);
|
||||
|
// }
|
||||
|
// }
|
||||
|
// }
|
||||
|
break; |
||||
|
default: |
||||
|
break; |
||||
|
} |
||||
|
} else if (toType.equals(3)) { |
||||
|
switch (classCode) { |
||||
|
case "2001": |
||||
|
List<AttachmentEntity.DataDTO.ResultsDTO.PrivateCar.PrivateCarItem> detail = resultsDTO.getPrivateCar().getDetail(); |
||||
|
for (AttachmentEntity.DataDTO.ResultsDTO.PrivateCar.PrivateCarItem item : detail) { |
||||
|
InvoiceItemMileage invoiceItemMileage = new InvoiceItemMileage(); |
||||
|
invoiceItemMileage.setInvoiceId(filesOcr.getInvoiceId()); |
||||
|
//修改 重新获取日期 2022/5/20
|
||||
|
invoiceItemMileage.setItemDate(DateUtils.formatDate(item.getDate())); |
||||
|
//invoiceItemMileage.setItemDate(DateFormat.parse(item.getDate()));
|
||||
|
invoiceItemMileage.setFrom(item.getFrom()); |
||||
|
invoiceItemMileage.setTo(item.getTo()); |
||||
|
invoiceItemMileage.setMileage(new BigDecimal(item.getMileage())); |
||||
|
invoiceItemMileage.setCustom1(item.getMoney()); |
||||
|
//OCR识别的 修改为固定值1 2022/9/22
|
||||
|
//invoiceItemMileage.setCustom5(filesConfig.getCustom3());
|
||||
|
invoiceItemMileage.setCustom5("1"); |
||||
|
invoiceItemMileage.setFilesId(filesOcr.getFilesId()); |
||||
|
invoiceItemMileage.setReason(item.getTarget()); |
||||
|
invoiceItemMileage.setCreateTime(new Date()); |
||||
|
invoiceItemMileageMapper.insert(invoiceItemMileage); |
||||
|
} |
||||
|
break; |
||||
|
default: |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private String getDateForDiDi(String timeGeton) { |
||||
|
Date now = new Date(); |
||||
|
try { |
||||
|
if (timeGeton != null && timeGeton.length() > 5) { |
||||
|
String monthAndDay = timeGeton.substring(0, 5); |
||||
|
int year = now.getYear() + 1900; |
||||
|
Date timeGetonDate = DateFormat.parse(year + "-" + monthAndDay); |
||||
|
if (timeGetonDate.after(now)) { |
||||
|
year--; |
||||
|
return DateFormat.format(DateFormat.parse(year + "-" + monthAndDay), DateFormat.DatePatternType.FORMAT_yyyy_MM_dd); |
||||
|
} |
||||
|
return DateFormat.format(timeGetonDate, DateFormat.DatePatternType.FORMAT_yyyy_MM_dd); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
log.error("Error DiDi Date >> {}", timeGeton); |
||||
|
} |
||||
|
return DateFormat.format(now, DateFormat.DatePatternType.FORMAT_yyyy_MM_dd); |
||||
|
} |
||||
|
|
||||
|
public void getVLHeads(MtPic mtPic, String imgFilePath) { |
||||
|
File imgFile = new File(imgFilePath); |
||||
|
String ndSearchCode = ""; |
||||
|
if(mtPic.getPicType().equals("12")){//会议规模照
|
||||
|
ndSearchCode = "hgy_grouppic"; |
||||
|
} |
||||
|
if(mtPic.getPicType().equals("13")){//会议讲者照
|
||||
|
ndSearchCode = "hgy_spkpic"; |
||||
|
} |
||||
|
JSONObject jsonDataResult = ndOcrService.ndApiRequest(ndSearchCode,imgFile); |
||||
|
|
||||
|
if(null == jsonDataResult){ |
||||
|
log.error("getVLHeads===nd api response not setting or error"); |
||||
|
} |
||||
|
List<CorporateInvoiceNdJsonMapping> mappingList = corporateInvoiceNdJsonMappingMapper.listAvailable(ndSearchCode, "main"); |
||||
|
if(mappingList == null){ |
||||
|
log.error("getVLHeads==={}的mapping不存在(main)",ndSearchCode); |
||||
|
}else{ |
||||
|
for (CorporateInvoiceNdJsonMapping mainMapping : mappingList) { |
||||
|
String key = mainMapping.getMappingDest(); |
||||
|
String value = String.valueOf(jsonDataResult.get(mainMapping.getMappingSource())); |
||||
|
|
||||
|
switch (key){ |
||||
|
case "heads": mtPic.setHeads(value);break; |
||||
|
case "isCopy": mtPic.setIscopy(value.equals("true") ? "1" : "0");mtPic.setExt01(mtPic.getIscopy());break; |
||||
|
case "isScreen": mtPic.setExt04(value.equals("true") ? "1" : "0");break; |
||||
|
case "isBack": mtPic.setExt03(value.equals("true") ? "1" : "0");break; |
||||
|
case "isSpkFace": mtPic.setExt05(value.equals("true") ? "1" : "0");break; |
||||
|
default:break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,78 @@ |
|||||
|
package com.cmsen.ticket.application.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.City; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* (City)表服务接口 |
||||
|
* |
||||
|
* @author ran hao yu |
||||
|
* @since 2020-09-24 16:25:44 |
||||
|
*/ |
||||
|
public interface CityService { |
||||
|
|
||||
|
/** |
||||
|
* 通过ID查询单条数据 |
||||
|
* |
||||
|
* @param id 主键 |
||||
|
* @return 实例对象 |
||||
|
*/ |
||||
|
City queryById(Integer id); |
||||
|
|
||||
|
/** |
||||
|
* 查询多条数据 |
||||
|
* |
||||
|
* @param offset 查询起始位置 |
||||
|
* @param limit 查询条数 |
||||
|
* @return 对象列表 |
||||
|
*/ |
||||
|
List<City> queryAllByLimit(int offset, int limit); |
||||
|
|
||||
|
RestResponse queryAll(City city); |
||||
|
|
||||
|
/** |
||||
|
* 新增数据 |
||||
|
* |
||||
|
* @param city 实例对象 |
||||
|
* @return 实例对象 |
||||
|
*/ |
||||
|
City insert(City city); |
||||
|
|
||||
|
/** |
||||
|
* 修改数据 |
||||
|
* |
||||
|
* @param city 实例对象 |
||||
|
* @return 实例对象 |
||||
|
*/ |
||||
|
City update(City city); |
||||
|
|
||||
|
/** |
||||
|
* 通过主键删除数据 |
||||
|
* |
||||
|
* @param id 主键 |
||||
|
* @return 是否成功 |
||||
|
*/ |
||||
|
boolean deleteById(Integer id); |
||||
|
|
||||
|
int insertBatch(List<City> list); |
||||
|
|
||||
|
int updateBatch(List<City> list); |
||||
|
|
||||
|
RestResponse list(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse create(City city); |
||||
|
|
||||
|
RestResponse updateCity(City city); |
||||
|
|
||||
|
RestResponse delete(Integer id); |
||||
|
|
||||
|
RestResponse export(Map<String, Object> params, HttpServletResponse response); |
||||
|
|
||||
|
RestResponse upload(MultipartFile file); |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,157 @@ |
|||||
|
package com.cmsen.ticket.application.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.Invoice; |
||||
|
import com.cmsen.ticket.domain.entity.InvoiceFilesLog; |
||||
|
import com.cmsen.ticket.domain.entity.concur.*; |
||||
|
import com.cmsen.ticket.domain.util.invoice.ExInvoice; |
||||
|
import com.cmsen.ticket.domain.vo.DeductionsSearch; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.io.File; |
||||
|
import java.io.IOException; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @Author OWTS > |
||||
|
* @Date 2020/11/12 |
||||
|
* @Description |
||||
|
*/ |
||||
|
public interface ConcurService { |
||||
|
|
||||
|
String getToken(); |
||||
|
void updateToken(); |
||||
|
|
||||
|
//OCR to Concur Interface
|
||||
|
ConcurResponse login(ConcurLoginForm loginForm); |
||||
|
|
||||
|
ConcurResponse getUnSendFolder(SendFolderEntity.UnSendRequest request); |
||||
|
|
||||
|
ConcurResponse updateFolder(SendFolderEntity.UpdateFolderRequest request); |
||||
|
|
||||
|
ConcurResponse getUnSendFolderComb(SendFolderEntity.UnSendRequest request); |
||||
|
|
||||
|
ConcurResponse updateFolderComb(SendFolderEntity.UpdateFolderRequest request); |
||||
|
|
||||
|
ConcurResponse getUnSendReport(SendReportEntity.ReportRequest request); |
||||
|
|
||||
|
ConcurResponse getUnSendReportComb(SendReportEntity.ReportRequest request); |
||||
|
|
||||
|
ConcurResponse updateReport(SendReportEntity.UpdateReportRequest report); |
||||
|
|
||||
|
void getImage(String taskId, String taskCreateTime, HttpServletResponse response) throws IOException; |
||||
|
|
||||
|
ConcurResponse getImageAndAttachment(String taskId, String taskCreateTime); |
||||
|
|
||||
|
ConcurResponse getPdf(String taskId, String ext01); |
||||
|
|
||||
|
ConcurResponse updatePdf(List<InvoiceFilesLog> list); |
||||
|
|
||||
|
//Concur to OCR Interface
|
||||
|
Boolean createReport(String type, String taskId, int num); |
||||
|
|
||||
|
Boolean approveReport(String reportId, String action, String remarks); |
||||
|
|
||||
|
String submitReportV4(String reportId, String loginId); |
||||
|
|
||||
|
Boolean approveReportV4(String reportId, String approveType, String comment, String loginId); |
||||
|
|
||||
|
String getReportStatus(String reportId, String email); |
||||
|
|
||||
|
String getReportV4Status(String reportId, String loginId); |
||||
|
|
||||
|
String getTaxRateInfoV4(String reportId, String loginId, String entryId); |
||||
|
|
||||
|
Boolean upReport(Integer policyId, String reportId, String loginId, String reportName); |
||||
|
|
||||
|
Boolean upEntry(Map<String, Object> entity); |
||||
|
|
||||
|
Boolean upEntryByInvoice(Invoice invoice); |
||||
|
|
||||
|
Boolean delEntry(String entryId, String loginId); |
||||
|
|
||||
|
List<String> getDelegators(String userName, String password); |
||||
|
|
||||
|
RestResponse sendWeChatInvoice(Integer reportId); |
||||
|
|
||||
|
RestResponse sendWeChatProcess(Integer reportId); |
||||
|
|
||||
|
RestResponse sendWeChatMeetProcess(String reqId); |
||||
|
|
||||
|
RestResponse callBackWeChat(WeChatCallback callback); |
||||
|
|
||||
|
Boolean checkEntryList(String loginId, String reportId, String entryId); |
||||
|
|
||||
|
int checkEntryReport(String loginId, String entryId); |
||||
|
|
||||
|
Boolean checkEntryExist(String loginId, String entryId); |
||||
|
|
||||
|
String getOrgUnit5(String loginId); |
||||
|
|
||||
|
ItemzationListData getItemizationListData(Map<String, String> parmas); |
||||
|
|
||||
|
List<ItemzationListData> getItemizationListAllData(Map<String, String> parmas); |
||||
|
|
||||
|
ConcurResponse updateItemizationData(UpdateItemzationData updateItemzationData); |
||||
|
|
||||
|
AttendListData getAttendeeListData(Map<String, String> parmas); |
||||
|
|
||||
|
List<AttendListData> getAttendeeListAllData(Map<String, String> parmas); |
||||
|
|
||||
|
ConcurResponse updateAttendeeData(Map<String, String> parmas); |
||||
|
|
||||
|
String addAttendee(AddAttendeeDto attendeeDto); |
||||
|
|
||||
|
ConcurResponse updatePolicy(ListIdEntityDto listIdEntityDto); |
||||
|
|
||||
|
String getImageId(String reportId, String entryId); |
||||
|
|
||||
|
void upInvoiceState(UpInvoiceStateDto upInvoiceStateDto); |
||||
|
|
||||
|
ConcurResponse updateProcessStatus(Map<String, Object> parmas); |
||||
|
|
||||
|
void rollbackProcess(String processId); |
||||
|
|
||||
|
RestResponse deductionListConcur(DeductionsSearch search); |
||||
|
|
||||
|
RestResponse updateDeductions(List<Integer> ids); |
||||
|
|
||||
|
ConcurResponse getDeleteList(); |
||||
|
|
||||
|
ConcurResponse updateDelete(SendReportEntity.InvoiceDeleteRequest request); |
||||
|
|
||||
|
ConcurResponse getLogList(); |
||||
|
|
||||
|
ConcurResponse updateLog(SendReportEntity.InvoiceLogRequest request); |
||||
|
|
||||
|
ExInvoice pdfExtract(File file); |
||||
|
|
||||
|
ExInvoice ofdExtract(File file); |
||||
|
|
||||
|
String getagreeSignUrl(String agreementId); |
||||
|
|
||||
|
Boolean agreeCancel(String agreementId); |
||||
|
|
||||
|
ConcurResponse getPostBoxList(int pageSize); |
||||
|
|
||||
|
ConcurResponse getPostBoxList2(int pageSize); |
||||
|
|
||||
|
ConcurResponse updateStatus(String ocrId, String status); |
||||
|
|
||||
|
ConcurResponse updateReceiptId(String ocrId, String receiptId); |
||||
|
|
||||
|
ConcurResponse updateStatus2(String ocrId, String status, String receiptId); |
||||
|
|
||||
|
ConcurResponse updateMeetProcessStatus(Map<String, Object> parmas); |
||||
|
|
||||
|
Boolean checkPeceiptId(String ocrId, String receiptId); |
||||
|
|
||||
|
void upReceiptV4(Map<String, Object> parmas); |
||||
|
|
||||
|
String upTaxRateV4(Map<String, Object> parmas); |
||||
|
|
||||
|
ConcurResponse getReportIsSend(String reportId); |
||||
|
|
||||
|
ConcurResponse updateReportPaper(Integer expenseReprotsId, String type); |
||||
|
} |
||||
@ -0,0 +1,54 @@ |
|||||
|
package com.cmsen.ticket.application.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.ExpenseReports; |
||||
|
import com.cmsen.ticket.domain.entity.Files; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @author ran hao yu |
||||
|
* @date 2020/7/24 15:56 |
||||
|
* @description 费用报告业务层接口 |
||||
|
*/ |
||||
|
public interface ExpenseReportsService { |
||||
|
/** |
||||
|
* 添加费用报告 |
||||
|
* |
||||
|
* @param expenseReports |
||||
|
* @return |
||||
|
*/ |
||||
|
RestResponse addExpenseReports(ExpenseReports expenseReports); |
||||
|
|
||||
|
RestResponse selectListByExpenseReports(String openID, Map<String, Object> params); |
||||
|
|
||||
|
RestResponse selectListByOpenId(String openID, Map<String, Object> params); |
||||
|
|
||||
|
RestResponse updateByPrimaryKeySelective(ExpenseReports record, HttpServletRequest request); |
||||
|
|
||||
|
RestResponse deleteByPrimaryKey(ExpenseReports record); |
||||
|
|
||||
|
RestResponse refreshByPrimaryKey(ExpenseReports record); |
||||
|
|
||||
|
RestResponse updateExpenseReportStatus(ExpenseReports record); |
||||
|
|
||||
|
RestResponse getConcurReportStatus(String reportKey); |
||||
|
|
||||
|
RestResponse reSend(Integer reportId); |
||||
|
|
||||
|
RestResponse send(Integer reportId); |
||||
|
|
||||
|
RestResponse submit(Integer reportId); |
||||
|
|
||||
|
RestResponse getFilesConfig(String ext01); |
||||
|
|
||||
|
RestResponse uploadInvoiceAttachment(Files files); |
||||
|
|
||||
|
RestResponse getFilesList(String invoiceId); |
||||
|
|
||||
|
RestResponse selectByExpenseReprotsId(Integer expenseReprotsId); |
||||
|
|
||||
|
void updateExpenseReport(Integer expenseReprotsId); |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
package com.cmsen.ticket.application.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.ExpenseTypeActive; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author ran hao yu |
||||
|
* @date 2020/8/4 10:21 |
||||
|
* @description 费用类型动态字段业务层接口 |
||||
|
*/ |
||||
|
public interface ExpenseTypeActiveService { |
||||
|
RestResponse selectList(Integer pid); |
||||
|
|
||||
|
List<ExpenseTypeActive> selectListByTicketType(Integer pid); |
||||
|
|
||||
|
RestResponse selectListByExpenseType(Integer pid); |
||||
|
|
||||
|
List<ExpenseTypeActive> getExpenseTypeActivesForExpenseType(Integer pid); |
||||
|
|
||||
|
List<ExpenseTypeActive> selectExFields(Integer pid, Integer kind); |
||||
|
|
||||
|
List<ExpenseTypeActive> selectExFieldsOut(Integer pid, Integer kind, HttpServletRequest request); |
||||
|
|
||||
|
RestResponse selectListType(String selectName); |
||||
|
|
||||
|
RestResponse selectListValues(Map<String, Object> params); |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.cmsen.ticket.application.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.ExpenseType; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author ran hao yu |
||||
|
* @date 2020/7/31 17:18 |
||||
|
* @description |
||||
|
*/ |
||||
|
public interface ExpenseTypeService { |
||||
|
RestResponse getAllExpenseType(Integer reportId); |
||||
|
|
||||
|
RestResponse selectExtraFields(Integer id); |
||||
|
|
||||
|
List<ExpenseType> generateTree(List<ExpenseType> expenseTypeList); |
||||
|
|
||||
|
RestResponse selectList(Map<String, Object> params); |
||||
|
RestResponse selectList2(Map<String, Object> params); |
||||
|
RestResponse selectList3(Map<String, Object> params); |
||||
|
} |
||||
@ -0,0 +1,88 @@ |
|||||
|
package com.cmsen.ticket.application.service; |
||||
|
|
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.ExpenseUse; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* (ExpenseUse)表服务接口 |
||||
|
* |
||||
|
* @author ran hao yu |
||||
|
* @since 2020-08-20 17:44:52 |
||||
|
*/ |
||||
|
public interface ExpenseUseService { |
||||
|
|
||||
|
/** |
||||
|
* 通过ID查询单条数据 |
||||
|
* |
||||
|
* @param id 主键 |
||||
|
* @return 实例对象 |
||||
|
*/ |
||||
|
ExpenseUse queryById(Integer id); |
||||
|
|
||||
|
/** |
||||
|
* 查询多条数据 |
||||
|
* |
||||
|
* @return 对象列表 |
||||
|
*/ |
||||
|
List<ExpenseUse> queryAllByLimit(); |
||||
|
|
||||
|
/** |
||||
|
* 查询多条数据 |
||||
|
* |
||||
|
* @return 对象列表 |
||||
|
*/ |
||||
|
RestResponse queryAll(ExpenseUse expenseUse, HttpServletRequest request); |
||||
|
|
||||
|
/** |
||||
|
* 新增数据 |
||||
|
* |
||||
|
* @param expenseUse 实例对象 |
||||
|
* @return 实例对象 |
||||
|
*/ |
||||
|
RestResponse insert(ExpenseUse expenseUse); |
||||
|
|
||||
|
/** |
||||
|
* 修改数据 |
||||
|
* |
||||
|
* @param expenseUse 实例对象 |
||||
|
* @return 实例对象 |
||||
|
*/ |
||||
|
ExpenseUse update(ExpenseUse expenseUse); |
||||
|
|
||||
|
/** |
||||
|
* 通过主键删除数据 |
||||
|
* |
||||
|
* @param id 主键 |
||||
|
* @return 是否成功 |
||||
|
*/ |
||||
|
boolean deleteById(Integer id); |
||||
|
|
||||
|
int insertBatch(List<ExpenseUse> list); |
||||
|
|
||||
|
int updateBatch(List<ExpenseUse> list); |
||||
|
|
||||
|
/** |
||||
|
* 停用 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
RestResponse clock(Integer id); |
||||
|
|
||||
|
/** |
||||
|
* 启用 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
RestResponse active(Integer id); |
||||
|
|
||||
|
RestResponse export(HttpServletResponse response); |
||||
|
|
||||
|
RestResponse queryAllUpdate(ExpenseUse expenseUse, HttpServletRequest request); |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
package com.cmsen.ticket.application.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.Files; |
||||
|
import com.cmsen.ticket.domain.entity.Invoice; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author fengql |
||||
|
* @date 2024/1/26 10:33 |
||||
|
* @description |
||||
|
*/ |
||||
|
public interface FileUploadService { |
||||
|
|
||||
|
RestResponse list(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse valid(Invoice invoice, String source); |
||||
|
|
||||
|
RestResponse ruleValid(Invoice invoice, String source); |
||||
|
|
||||
|
RestResponse scanPicture(MultipartFile file, String flag, String source, String proxyId); |
||||
|
|
||||
|
RestResponse insert(Invoice invoice, String source); |
||||
|
|
||||
|
RestResponse invoiceScanPdf(MultipartFile file); |
||||
|
|
||||
|
RestResponse scanFiles(MultipartFile[] files, String proxyId); |
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
package com.cmsen.ticket.application.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.InvoiceAttendees; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2021/7/27 10:08 |
||||
|
**/ |
||||
|
public interface InvoiceAttendeeService { |
||||
|
RestResponse selectByInvoiceId(String invoiceId); |
||||
|
|
||||
|
|
||||
|
RestResponse delete(Long id); |
||||
|
|
||||
|
RestResponse insert(InvoiceAttendees invoiceAttendees); |
||||
|
} |
||||
@ -0,0 +1,35 @@ |
|||||
|
package com.cmsen.ticket.application.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.InvoiceItemMileage; |
||||
|
import com.cmsen.ticket.domain.entity.Mileage; |
||||
|
import com.cmsen.ticket.domain.response.Response; |
||||
|
import com.cmsen.ticket.interfaces.facade.manager.form.SubmitMileageForm; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2021/11/18 14:09 |
||||
|
*/ |
||||
|
public interface InvoiceItemMileageService { |
||||
|
Response<List<InvoiceItemMileage>> list(String invoiceId); |
||||
|
|
||||
|
Response<Object> create(InvoiceItemMileage mileage); |
||||
|
|
||||
|
Response<Object> update(InvoiceItemMileage mileage); |
||||
|
|
||||
|
Response<Object> delete(Long id); |
||||
|
|
||||
|
Response<BigDecimal> calculate(double mileage); |
||||
|
|
||||
|
RestResponse autoCalculate(String invoiceId); |
||||
|
|
||||
|
Response<List<Mileage>> getItemFromMileage(); |
||||
|
|
||||
|
Response<Integer> submitMileage(SubmitMileageForm submitMileageForm); |
||||
|
|
||||
|
Response<Integer> setMlieageStatus(); |
||||
|
} |
||||
@ -0,0 +1,25 @@ |
|||||
|
package com.cmsen.ticket.application.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.InvoiceItems; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2021/7/26 15:48 |
||||
|
**/ |
||||
|
public interface InvoiceItemService { |
||||
|
RestResponse selectByInvoiceId(String invoiceId); |
||||
|
|
||||
|
RestResponse selectItemExpenseTypeByExpenseTypeId(Integer expenseTypeId); |
||||
|
|
||||
|
RestResponse delete(Long id); |
||||
|
|
||||
|
RestResponse insert(InvoiceItems invoiceItems); |
||||
|
|
||||
|
RestResponse insertBatch(InvoiceItems invoiceItems); |
||||
|
|
||||
|
RestResponse update(InvoiceItems invoiceItems); |
||||
|
|
||||
|
RestResponse delByInvoiceId(String invoiceId); |
||||
|
} |
||||
@ -0,0 +1,5 @@ |
|||||
|
package com.cmsen.ticket.application.service; |
||||
|
|
||||
|
public interface InvoicePengFeiNcService { |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,153 @@ |
|||||
|
package com.cmsen.ticket.application.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.*; |
||||
|
import com.cmsen.ticket.infrastructure.ocr2.entity.Details; |
||||
|
import com.cmsen.ticket.infrastructure.ocr2.entity.Item; |
||||
|
import com.cmsen.ticket.infrastructure.ocr2.entity.RuiZhenOCREntity; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
import java.io.IOException; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author ran hao yu |
||||
|
* @date 2020/7/28 10:57 |
||||
|
* @description 发票业务层接口 |
||||
|
*/ |
||||
|
public interface InvoiceService { |
||||
|
|
||||
|
RestResponse selectInvoiceList(Invoice invoice); |
||||
|
|
||||
|
RestResponse selectInvoiceById(String invoiceId); |
||||
|
|
||||
|
RestResponse insert(Invoice invoice); |
||||
|
|
||||
|
RestResponse verify(Invoice invoice); |
||||
|
|
||||
|
//验真
|
||||
|
RestResponse valid(Invoice invoice, String source); |
||||
|
|
||||
|
// 规则校验
|
||||
|
RestResponse ruleValid(Invoice invoice); |
||||
|
|
||||
|
RestResponse uploadInvoiceAttachment(Files files, Integer expenseTypeId); |
||||
|
|
||||
|
RestResponse updateByPrimaryKeySelective(Invoice record); |
||||
|
|
||||
|
RestResponse deleteByPrimaryKey(Invoice invoice, HttpServletRequest request); |
||||
|
|
||||
|
RestResponse batchMoveInvoice(List<Invoice> invoiceList); |
||||
|
|
||||
|
RestResponse scanPicture(Files files,String flag, String source, String proxyId); |
||||
|
|
||||
|
Map<String, Object> scanListPicture(Files files, String flag, String source, String proxyId); |
||||
|
|
||||
|
RestResponse abroadScan(Files files); |
||||
|
|
||||
|
void validationRules(User user, Details details, TicketType ticketType, Invoice invoice, CheckMessage checkMessage); |
||||
|
|
||||
|
void autoInsertCity(RuiZhenOCREntity.IdentifyResults result, Details details, Invoice invoice, List<Item> items); |
||||
|
|
||||
|
RestResponse identify(Files files, Integer expenseReprotsId, Integer expenseTypeId); |
||||
|
|
||||
|
RestResponse lineAbroadScan(Files files); |
||||
|
|
||||
|
RestResponse verifications(InvoiceLines invoices); |
||||
|
RestResponse lineRuleVaild(InvoiceLines invoices); |
||||
|
|
||||
|
RestResponse multiInRuleValid(Invoice invoice); |
||||
|
|
||||
|
RestResponse insertInvoiceContainLines(Invoice invoice); |
||||
|
|
||||
|
RestResponse deleteFileByFileName(String fileName); |
||||
|
|
||||
|
RestResponse calucate(List<InvoiceLines> lines); |
||||
|
|
||||
|
RestResponse deleteLines(Long id); |
||||
|
|
||||
|
String getInvoiceKind(String detail, String kind); |
||||
|
|
||||
|
String[] getTicketTypeCode(String typeCode, String title, boolean cn ,String seller); |
||||
|
|
||||
|
RestResponse selectEfiles(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse selectInEfiles(String invoiceId, String ext01, String isCredit); |
||||
|
|
||||
|
RestResponse saveEfiles(Long[] idArr, String invoiceId); |
||||
|
|
||||
|
RestResponse deleteEfiles(Long id, String invoiceId); |
||||
|
|
||||
|
RestResponse refreshEfiles(String invoiceId); |
||||
|
|
||||
|
RestResponse selectChannel(); |
||||
|
|
||||
|
RestResponse insertNoInvoice(Invoice invoice); |
||||
|
|
||||
|
RestResponse updateNoInvoice(Invoice invoice); |
||||
|
|
||||
|
RestResponse noInRuleValid(Invoice invoice); |
||||
|
|
||||
|
void addFilesLog(List<String> filesPath, InvoiceFilesLog filesLog, List<String> filesType); |
||||
|
|
||||
|
void addFilesLogForHeader(List<String> filesPath, InvoiceFilesLog filesLog, List<String> filesType); |
||||
|
|
||||
|
/** |
||||
|
* 报告头附件合并压缩(区分彩色/灰白附件): |
||||
|
* colorFilesPath 为 efiles.TYPE=3002 的彩色附件,压缩时必须保留彩色; |
||||
|
* grayFilesPath 为其他类型附件,压缩时可置为灰白; |
||||
|
* header_file_zip 配置不等于 1 时不压缩,直接合并所有图片为一个 pdf |
||||
|
* |
||||
|
* @return 最终pdf文件的本地磁盘绝对路径(无附件时返回null) |
||||
|
*/ |
||||
|
String addFilesLogForHeaderColor(List<String> colorFilesPath, List<String> grayFilesPath, |
||||
|
List<String> colorFilesType, List<String> grayFilesType, |
||||
|
InvoiceFilesLog filesLog); |
||||
|
|
||||
|
RestResponse getAllowanceMoney(String city, int days); |
||||
|
|
||||
|
RestResponse allowanceRuleValid(Invoice invoice); |
||||
|
|
||||
|
RestResponse insertAllowance(Invoice invoice); |
||||
|
|
||||
|
RestResponse updateAllowance(Invoice invoice); |
||||
|
|
||||
|
RestResponse mileageRuleValid(Invoice invoice); |
||||
|
|
||||
|
RestResponse insertMileage(Invoice invoice); |
||||
|
|
||||
|
RestResponse updateMileage(Invoice invoice); |
||||
|
|
||||
|
RestResponse getSysConfig(String code); |
||||
|
|
||||
|
RestResponse getSysImageList(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse getReimburseMoney(String mileage); |
||||
|
|
||||
|
RestResponse deleteSysImage(String ids); |
||||
|
|
||||
|
RestResponse getValueSetList(String category); |
||||
|
|
||||
|
void delEntry(String email, ExpenseReports expenseReports, String entryId, Invoice invoice, String opType); |
||||
|
|
||||
|
RestResponse getFilesType(Integer expenseTypeId); |
||||
|
|
||||
|
RestResponse uploadInvoiceAttachmentNew(Files files, Integer expenseTypeId, String fileType); |
||||
|
|
||||
|
RestResponse selInvoiceByImg(Files files); |
||||
|
|
||||
|
List<String> generateSaleListPng(Invoice record); |
||||
|
|
||||
|
String addWatermark(String imgViewPath, String type); |
||||
|
|
||||
|
RestResponse uploadFile(MultipartFile file); |
||||
|
|
||||
|
RestResponse lineUploadFile(MultipartFile file, Integer expenseReprotsId, Integer expenseTypeId); |
||||
|
|
||||
|
RestResponse delCreditEfiles(Long id); |
||||
|
|
||||
|
RestResponse getRelatedList(String expenseTypeIds, Integer expenseReprotsId); |
||||
|
} |
||||
@ -0,0 +1,37 @@ |
|||||
|
package com.cmsen.ticket.application.service; |
||||
|
|
||||
|
import com.cmsen.ticket.domain.dto.MileageListDto; |
||||
|
import com.cmsen.ticket.domain.entity.Mileage; |
||||
|
import com.cmsen.ticket.domain.entity.MileageDetail; |
||||
|
import com.cmsen.ticket.domain.response.Response; |
||||
|
import com.cmsen.ticket.domain.response.ResponsePage; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
*/ |
||||
|
public interface MileageService { |
||||
|
Response<Mileage> getNowMileage(); |
||||
|
|
||||
|
Response<Mileage> getMileageById(Long mileageId); |
||||
|
|
||||
|
Response<ResponsePage<Mileage>> getMileageList(MileageListDto search); |
||||
|
|
||||
|
Response<Mileage> updateMileage(Mileage mileage); |
||||
|
|
||||
|
Response<List<MileageDetail>> getMileageDetail(Long mileageId); |
||||
|
|
||||
|
Response<MileageDetail> addMileageDetail(MileageDetail detail); |
||||
|
|
||||
|
Response<Integer> deleteMileage(Long mileageId); |
||||
|
|
||||
|
Response<Integer> deleteMileageDetail(Long detailId); |
||||
|
|
||||
|
Response<MileageDetail> updateMileageDetail(MileageDetail detail); |
||||
|
|
||||
|
Map regeo(String location); |
||||
|
|
||||
|
Map driving(String origin, String destination, String waypoints); |
||||
|
} |
||||
@ -0,0 +1,124 @@ |
|||||
|
package com.cmsen.ticket.application.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.*; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @author admin |
||||
|
* @description 针对表【mt_list】的数据库操作Service |
||||
|
* @createDate 2022-05-27 11:20:52 |
||||
|
*/ |
||||
|
public interface MtListService { |
||||
|
|
||||
|
RestResponse meetingList(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse checkinList(String reqId); |
||||
|
|
||||
|
RestResponse meetingDetails(Long id); |
||||
|
|
||||
|
RestResponse mtAgreement(String reqId); |
||||
|
|
||||
|
RestResponse expenseDetails(String reqId); |
||||
|
|
||||
|
RestResponse meetingSpeakerList(String reqId); |
||||
|
RestResponse meetingSpeakerList2(String reqId); |
||||
|
|
||||
|
RestResponse meetingSpeakerDetails(Long id); |
||||
|
|
||||
|
RestResponse mtPicture(String reqId); |
||||
|
|
||||
|
RestResponse ExitmeetingDetails(MtList mtList); |
||||
|
|
||||
|
RestResponse mtSignin(Signin signin); |
||||
|
|
||||
|
RestResponse listMeetPic(); |
||||
|
|
||||
|
RestResponse reqList(); |
||||
|
RestResponse reqList2(String reqName); |
||||
|
RestResponse getPicParams(String email); |
||||
|
|
||||
|
RestResponse getPicHeads(MtPic mtPic); |
||||
|
|
||||
|
RestResponse insertPic(MtPic mtPic); |
||||
|
|
||||
|
RestResponse deletePic(Long id); |
||||
|
|
||||
|
RestResponse agreeSelList(String category); |
||||
|
|
||||
|
RestResponse saveAgreement(MtAgreement mtAgreement); |
||||
|
|
||||
|
RestResponse agreeList(String reqId, String extId, String expenseName); |
||||
|
|
||||
|
RestResponse agreeDetail(Long id); |
||||
|
|
||||
|
RestResponse agreeCancel(Long id); |
||||
|
|
||||
|
RestResponse meetFinish(Long id, String code, String pass); |
||||
|
|
||||
|
RestResponse meetingSpeakerCancel(Long id); |
||||
|
|
||||
|
RestResponse meetingSpeakerFinish(Long id, String code); |
||||
|
|
||||
|
RestResponse sendCode(Long id); |
||||
|
|
||||
|
RestResponse attendeeList(String reqId); |
||||
|
|
||||
|
RestResponse attendeeDetail(Long id); |
||||
|
|
||||
|
RestResponse deleteAttendee(Long id); |
||||
|
|
||||
|
RestResponse saveAttendee(MtAttendee mtAttendee); |
||||
|
|
||||
|
RestResponse saveSpeaker(MtSpeaker mtSpeaker); |
||||
|
|
||||
|
RestResponse checkinRefresh(String reqId); |
||||
|
|
||||
|
RestResponse attendeeTypeList(String accessType); |
||||
|
|
||||
|
RestResponse getSpeaker(String extId); |
||||
|
|
||||
|
RestResponse getOrgListByPid(Integer pid, String orgName, String userType); |
||||
|
|
||||
|
RestResponse saveCheckin(MtCheckin mtCheckin); |
||||
|
|
||||
|
RestResponse ruleValid(Long id); |
||||
|
|
||||
|
RestResponse agreeSignUrl(String agreementId); |
||||
|
|
||||
|
RestResponse insertMeetPic(MtPic mtPic); |
||||
|
|
||||
|
RestResponse savePicSpeaker(MtPic mtPic); |
||||
|
|
||||
|
RestResponse selectChannel(); |
||||
|
|
||||
|
RestResponse getSysConfig(String code); |
||||
|
|
||||
|
RestResponse createExpenseReports(ExpenseReports expenseReports); |
||||
|
|
||||
|
RestResponse getEfilesList(String reqId); |
||||
|
|
||||
|
RestResponse reportsRuleValid(ExpenseReports expenseReports); |
||||
|
|
||||
|
RestResponse createMtList(MtList mtList); |
||||
|
|
||||
|
RestResponse updateMtList(MtList mtList); |
||||
|
|
||||
|
RestResponse deleteMtList(Long id); |
||||
|
|
||||
|
RestResponse submitMtList(String reqId); |
||||
|
|
||||
|
RestResponse revokeMtList(String reqId); |
||||
|
|
||||
|
RestResponse addMtExpense(MtExpense mtExpense); |
||||
|
|
||||
|
RestResponse updateMtExpense(MtExpense mtExpense); |
||||
|
|
||||
|
RestResponse deleteMtExpense(Integer id); |
||||
|
|
||||
|
RestResponse selectMtExpenseById(Integer id); |
||||
|
|
||||
|
RestResponse meetingSigninReset(Long id); |
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
package com.cmsen.ticket.application.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.Files; |
||||
|
import com.cmsen.ticket.domain.entity.Invoice; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2021/1/8 14:30 |
||||
|
**/ |
||||
|
public interface PostBoxService { |
||||
|
RestResponse list(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse submit(List<Integer> ids, Integer reportId); |
||||
|
|
||||
|
RestResponse delete(Integer id); |
||||
|
|
||||
|
RestResponse uploadInvoices(Files files); |
||||
|
|
||||
|
RestResponse selectKindList(String keywords); |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
package com.cmsen.ticket.application.service; |
||||
|
|
||||
|
import com.cmsen.ticket.domain.entity.concur.PrcEventEntity; |
||||
|
import com.cmsen.ticket.domain.entity.concur.PrcEventReturn; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS > |
||||
|
* @version 1.0.0 |
||||
|
* @date 2021/6/4 10:17 |
||||
|
* @desc ticket |
||||
|
*/ |
||||
|
public interface PrcEventService { |
||||
|
List<PrcEventReturn> checkInvoices(PrcEventEntity entity); |
||||
|
|
||||
|
/** |
||||
|
* deduction新逻辑,插入到invoice_images_deduction |
||||
|
* @param entity |
||||
|
* @return |
||||
|
*/ |
||||
|
List<PrcEventReturn> addInvoiceImage(PrcEventEntity entity); |
||||
|
} |
||||
@ -0,0 +1,34 @@ |
|||||
|
package com.cmsen.ticket.application.service; |
||||
|
|
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.domain.entity.project.ProjectHoursReport; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
public interface ProjectService { |
||||
|
|
||||
|
RestResponse listWeekHours(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse listWeekDetails(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse listDayDetails(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse saveHours(ProjectHoursReport hoursReport); |
||||
|
|
||||
|
RestResponse listTask(); |
||||
|
|
||||
|
RestResponse checkDay(String reportDate, String reporter); |
||||
|
|
||||
|
RestResponse submitHours(String reporter, String dateRangeStart, String dateRangeEnd); |
||||
|
|
||||
|
RestResponse deleteHour(Long id); |
||||
|
|
||||
|
RestResponse getProjectList(String keyword); |
||||
|
|
||||
|
RestResponse listProWeekHours(Map<String, Object> params); |
||||
|
|
||||
|
RestResponse passHours(String reporter, String dateRangeStart, String dateRangeEnd); |
||||
|
|
||||
|
RestResponse rejectHours(String reporter, String dateRangeStart, String dateRangeEnd); |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
package com.cmsen.ticket.application.service; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.interfaces.facade.form.ConcurProxyUser; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
|
||||
|
/** |
||||
|
* @Author OWTS > |
||||
|
* @Date 2020/12/22 |
||||
|
* @Description |
||||
|
*/ |
||||
|
public interface ProxyUserService { |
||||
|
RestResponse getProxyUsersByUser(HttpServletRequest request, String tel); |
||||
|
|
||||
|
RestResponse switchProxy(Integer proxy); |
||||
|
|
||||
|
RestResponse addProxy(ConcurProxyUser user); |
||||
|
|
||||
|
RestResponse syncProxy(String loginId); |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
package com.cmsen.ticket.application.service; |
||||
|
|
||||
|
/** |
||||
|
* @author ran hao yu |
||||
|
* @date 2020/8/31 16:11 |
||||
|
* @description |
||||
|
*/ |
||||
|
public interface WeChatCardPackService { |
||||
|
} |
||||
@ -0,0 +1,120 @@ |
|||||
|
package com.cmsen.ticket.application.service.impl; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.application.service.AnlyService; |
||||
|
import com.cmsen.ticket.domain.mapper.*; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.text.SimpleDateFormat; |
||||
|
import java.util.*; |
||||
|
|
||||
|
@Service |
||||
|
public class AnlyServiceImpl implements AnlyService { |
||||
|
|
||||
|
@Resource |
||||
|
private CorporateInvoiceMapper corporateInvoiceMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private InvoiceMapper invoiceMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private InvoiceRateMapper invoiceRateMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private InvoiceMonthNumMapper invoiceMonthNumMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private SysNotificationMapper sysNotificationMapper; |
||||
|
|
||||
|
/** |
||||
|
* 获取当月使用量(对公) |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public RestResponse corporateInvoiceMonthNum() { |
||||
|
Map<String, Integer> map = new HashMap<String, Integer>(); |
||||
|
int monthNum = corporateInvoiceMapper.getCorporateMonthNum(2,0); |
||||
|
int monthTruthNum = corporateInvoiceMapper.getCorporateMonthNum(1,1); |
||||
|
map.put("corporateMonthNum", monthNum); |
||||
|
map.put("corporateMonthTruthNum", monthTruthNum); |
||||
|
return RestResponse.success(map); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取当年使用量(对公) |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public RestResponse corporateInvoiceYearNum() { |
||||
|
Map<String, Integer> map = new HashMap<String, Integer>(); |
||||
|
int yearNum = corporateInvoiceMapper.getCorporateYearNum(2,0); |
||||
|
int yearTruthNum = corporateInvoiceMapper.getCorporateYearNum(1,1); |
||||
|
map.put("corporateYearNum", yearNum); |
||||
|
map.put("corporateYearTruthNum", yearTruthNum); |
||||
|
return RestResponse.success(map); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取当月使用量(普通) |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
public RestResponse invoiceMonthNum() { |
||||
|
Map<String, Integer> map = new HashMap<String, Integer>(); |
||||
|
int monthNum = invoiceMapper.getInvoiceMonthNum(2); |
||||
|
int monthTruthNum = invoiceMapper.getInvoiceMonthNum(1); |
||||
|
map.put("invoiceMonthNum", monthNum); |
||||
|
map.put("invoiceMonthTrustNum", monthTruthNum); |
||||
|
return RestResponse.success(map); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取当年使用量(普通) |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
public RestResponse invoiceYearNum() { |
||||
|
Map<String, Integer> map = new HashMap<String, Integer>(); |
||||
|
int yearNum = invoiceMapper.getInvoiceYearNum(2); |
||||
|
int yearTruthNum = invoiceMapper.getInvoiceYearNum(1); |
||||
|
map.put("invoiceYearNum", yearNum); |
||||
|
map.put("invoiceYearTruthNum", yearTruthNum); |
||||
|
return RestResponse.success(map); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 类型占比 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
public RestResponse getInvoiceTypeRate() { |
||||
|
List<Map<String, String>> list = invoiceRateMapper.getInvoiceRate(); |
||||
|
return RestResponse.success(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取发票使用量曲线 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
public RestResponse getEveryInvoiceNum() { |
||||
|
SimpleDateFormat formats = new SimpleDateFormat("yyyy"); |
||||
|
Calendar c = Calendar.getInstance(); |
||||
|
c.add(Calendar.YEAR, -1); |
||||
|
Date date = c.getTime(); |
||||
|
Map<String, List<Map<String, String>>> all = new HashMap<String, List<Map<String, String>>>(); |
||||
|
List<Map<String, String>> nowInvoiceNum = invoiceMonthNumMapper.getInvoiceMonthNum(2); |
||||
|
List<Map<String, String>> lastInvoiceNum = invoiceMonthNumMapper.getInvoiceMonthNum(1); |
||||
|
all.put(formats.format(date), lastInvoiceNum); |
||||
|
all.put(formats.format(new Date()), nowInvoiceNum); |
||||
|
return RestResponse.success(all); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse getNotes(Integer limit) { |
||||
|
return RestResponse.success(sysNotificationMapper.getList(limit)); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,562 @@ |
|||||
|
package com.cmsen.ticket.application.service.impl; |
||||
|
|
||||
|
import cn.hutool.http.HttpUtil; |
||||
|
import com.alibaba.fastjson2.JSONArray; |
||||
|
import com.alibaba.fastjson2.JSONObject; |
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.common.util.DateFormat; |
||||
|
import com.cmsen.common.util.StorageCache; |
||||
|
import com.cmsen.common.util.StringUtil; |
||||
|
import com.cmsen.ticket.application.manager.service.SupplierService; |
||||
|
import com.cmsen.ticket.application.manager.service.impl.SysCorInvoiceServiceImpl; |
||||
|
import com.cmsen.ticket.bestsign.util.InterfaceUtil; |
||||
|
import com.cmsen.ticket.domain.entity.CorporateInvoice; |
||||
|
import com.cmsen.ticket.domain.entity.CorporateInvoiceType; |
||||
|
import com.cmsen.ticket.domain.entity.Supplier; |
||||
|
import com.cmsen.ticket.domain.entity.SupplierMatching; |
||||
|
import com.cmsen.ticket.domain.entity.manager.SysConfig; |
||||
|
import com.cmsen.ticket.domain.entity.manager.SysOrg; |
||||
|
import com.cmsen.ticket.domain.mapper.*; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.SupplierOrderItemMatchingMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.SysConfigMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.SysOrgMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.pengfei.InvoicePengfeiNcHeaderMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.pengfei.InvoicePengfeiNcLineMapper; |
||||
|
import com.cmsen.ticket.domain.response.Response; |
||||
|
import com.cmsen.ticket.domain.util.Pdf2JpgHelper; |
||||
|
import com.cmsen.ticket.domain.vo.BaozunInvoiceVo; |
||||
|
import com.cmsen.ticket.infrastructure.ocr2.OFDUtil; |
||||
|
import com.cmsen.ticket.infrastructure.ocr2.RuiZhenOCRService; |
||||
|
import com.cmsen.ticket.infrastructure.tools.util.DateUtil; |
||||
|
import com.cmsen.ticket.infrastructure.tools.util.MD5Encrypt; |
||||
|
import com.cmsen.ticket.infrastructure.tools.util.SignUtil; |
||||
|
import com.cmsen.ticket.interfaces.facade.form.ScannerPostDate; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Value; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.io.File; |
||||
|
import java.io.IOException; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.net.URLEncoder; |
||||
|
import java.text.SimpleDateFormat; |
||||
|
import java.util.*; |
||||
|
|
||||
|
import static com.cmsen.ticket.infrastructure.task.pengfei.yongyou.SHA256.sign2; |
||||
|
|
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class BaozunCorInvoiceServiceImpl{ |
||||
|
public static final String CONCAT_STRING = "-"; |
||||
|
@Resource |
||||
|
private InterfaceUtil interfaceUtil; |
||||
|
StringBuffer mesg=new StringBuffer(); |
||||
|
|
||||
|
// 消息
|
||||
|
StringBuffer mesg2=new StringBuffer(); |
||||
|
|
||||
|
@Resource |
||||
|
private SysConfigMapper sysConfigMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private CorporateInvoiceMapper corporateInvoiceMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private CorporateInvoiceItemsMapper corporateInvoiceItemsMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private InvoicePengfeiNcHeaderMapper invoicePengfeiNcHeaderMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private InvoicePengfeiNcLineMapper invoicePengfeiNcLineMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private CompanyMapper companyMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private SupplierOrderMapper supplierOrderMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private SupplierMatchingMapper supplierMatchingMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private SupplierMapper supplierMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private SysOrgMapper sysOrgMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private SupplierService supplierService; |
||||
|
|
||||
|
@Resource |
||||
|
private SupplierMaterialUomMapper supplierMaterialUomMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private CorporateInvoiceServiceImpl corporateInvoiceService; |
||||
|
@Resource |
||||
|
private SupplierOrderItemMatchingMapper supplierOrderItemMatchingMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private RuiZhenOCRService ruiZhenOCRService; |
||||
|
|
||||
|
@Resource |
||||
|
private SysCorInvoiceServiceImpl sysCorInvoiceService; |
||||
|
|
||||
|
@Resource |
||||
|
private CorporateInvoiceTypeMapper corporateInvoiceTypeMapper; |
||||
|
|
||||
|
@Value("${manager-file.watchPath}") |
||||
|
private String watchPath; |
||||
|
|
||||
|
@Value("${file.filepath}") |
||||
|
private String invoicePic; |
||||
|
|
||||
|
@Value("${manager-file.uploadPath}") |
||||
|
private String uploadPath; |
||||
|
|
||||
|
public static boolean isServiceX = false; |
||||
|
|
||||
|
|
||||
|
public StringBuffer matchingProcess() throws IOException { |
||||
|
boolean needToSendRPA = true; |
||||
|
mesg2 = new StringBuffer(); |
||||
|
// 宝尊appkey
|
||||
|
SysConfig baozunAppKeyConfig = sysConfigMapper.selectByCode("baozun_appKey"); |
||||
|
String appKey = baozunAppKeyConfig.getValue(); |
||||
|
// 宝尊appSecret
|
||||
|
SysConfig baozunAppSecretConfig = sysConfigMapper.selectByCode("baozun_appSecret"); |
||||
|
String appSecret = baozunAppSecretConfig.getValue(); |
||||
|
// 获取发票url
|
||||
|
SysConfig baozunInvoiceUrlConfig = sysConfigMapper.selectByCode("baozun_api_url"); |
||||
|
String api = baozunInvoiceUrlConfig.getValue(); |
||||
|
SysConfig methodNameConfig = sysConfigMapper.selectByCode("baozun_invoice_method_name"); |
||||
|
String interfaceType = "1"; |
||||
|
String methodName = methodNameConfig.getValue(); |
||||
|
// 获取某组织的发票
|
||||
|
SysConfig corInvoiceOrgConfig = sysConfigMapper.selectByCode("auto_org"); |
||||
|
if(null==corInvoiceOrgConfig){ |
||||
|
log.warn("未配置COR_INVOICE_ORG "); |
||||
|
mesg2.append("未配置COR_INVOICE_ORG "); |
||||
|
return mesg2; |
||||
|
} |
||||
|
String orgCodeValue = corInvoiceOrgConfig.getValue(); |
||||
|
if(StringUtils.isEmpty(orgCodeValue)){ |
||||
|
log.warn("未配置COR_INVOICE_ORG "); |
||||
|
mesg2.append("未配置COR_INVOICE_ORG "); |
||||
|
return mesg2; |
||||
|
} |
||||
|
String[] orgCodes = orgCodeValue.split(","); |
||||
|
|
||||
|
for (String orgCode : orgCodes) { |
||||
|
List<CorporateInvoice> orgCorInvoiceList = corporateInvoiceService.selectByOrg(orgCodes); |
||||
|
for (CorporateInvoice invoice : orgCorInvoiceList) { |
||||
|
try{ |
||||
|
String sellerNo = invoice.getSellerNo(); |
||||
|
String number = invoice.getNumber(); |
||||
|
if("24312000000335155431".equals(number)){ |
||||
|
log.info(number); |
||||
|
} |
||||
|
String invoiceId = invoice.getId(); |
||||
|
String sellerName = invoice.getSeller(); |
||||
|
// String po = invoice.getPo();
|
||||
|
String supplierCode = null; |
||||
|
String res = getResFromApi(appKey,appSecret,interfaceType,methodName, |
||||
|
api,null,null,10,1,number,null); |
||||
|
BaozunInvoiceVo baozunInvoiceRes = JSONObject.parseObject(res,BaozunInvoiceVo.class); |
||||
|
int status = baozunInvoiceRes.getStatus(); |
||||
|
if(1!=status){ |
||||
|
continue; |
||||
|
} |
||||
|
String po = ""; |
||||
|
if(!baozunInvoiceRes.getData().isEmpty()){ |
||||
|
|
||||
|
for (BaozunInvoiceVo.DataInfo datum : baozunInvoiceRes.getData()) { |
||||
|
supplierCode = datum.getVendorCode(); |
||||
|
Supplier supplier =supplierMapper.selectBySupplierCodeOnly(supplierCode); |
||||
|
log.info("supplier===>{}",supplier); |
||||
|
if (supplier==null) { |
||||
|
log.error("供应商不存在supplierCode:=>{}",supplierCode); |
||||
|
}else{ |
||||
|
supplierCode = supplier.getCode(); |
||||
|
} |
||||
|
for (BaozunInvoiceVo.BaoznPoInfo baoznPoInfo : datum.getPoList()) { |
||||
|
po += baoznPoInfo.getPoNumber()+","; |
||||
|
} |
||||
|
if(po.endsWith(",")){ |
||||
|
po = po.substring(0,po.length()-1); |
||||
|
} |
||||
|
corporateInvoiceMapper.updatePo(po,invoiceId); |
||||
|
|
||||
|
// 具体用哪个等待商榷
|
||||
|
SupplierMatching supplierMatching = null; |
||||
|
//
|
||||
|
supplierMatching = supplierMatchingMapper.selectByPrimaryKey(invoiceId); |
||||
|
if(null==supplierMatching){ |
||||
|
supplierMatching = new SupplierMatching(); |
||||
|
supplierMatching.setInvoiceId(invoiceId); |
||||
|
supplierMatching.setOrderNo(po); |
||||
|
supplierMatching.setSupplierCode(supplierCode); |
||||
|
supplierMatching.setOperationTime(new Date()); |
||||
|
supplierMatchingMapper.insert(supplierMatching); |
||||
|
}else{ |
||||
|
supplierMatching.setOrderNo(po); |
||||
|
supplierMatchingMapper.updateByPrimaryKey(supplierMatching); |
||||
|
} |
||||
|
log.info("{}进入物料===========》{}",invoice.getNumber(),invoiceId); |
||||
|
supplierService.materialAutoMatching(invoiceId,supplierCode); |
||||
|
// 单位换算映射
|
||||
|
supplierService.syncUomFromMapping(invoiceId,supplierCode); |
||||
|
// 单位换算处理
|
||||
|
RestResponse uomResponse = supplierService.updateUom(invoiceId, sellerNo); |
||||
|
log.info("{}进入匹配===========》{}",invoice.getNumber(),invoiceId); |
||||
|
RestResponse restResponse1 = supplierService.autoSmartMatching(invoiceId,supplierCode); |
||||
|
// 匹配完成
|
||||
|
// 是否自动审核 auto commit
|
||||
|
SysConfig auto_commitConfig = sysConfigMapper.selectByCode("auto_commit"); |
||||
|
if(null==auto_commitConfig){ |
||||
|
log.warn("未配置auto_commit "); |
||||
|
mesg2.append("未配置auto_commit "); |
||||
|
} |
||||
|
String aotuCommit = auto_commitConfig.getValue(); |
||||
|
if("1".equals(aotuCommit)){ |
||||
|
List<Long> ids = supplierOrderItemMatchingMapper.selectIdsByStatusAndInvoiceId(invoiceId,null); |
||||
|
if(!ids.isEmpty()){ |
||||
|
Response<Object> response2 = supplierService.completeMatching(ids, invoiceId); |
||||
|
}else{ |
||||
|
continue; |
||||
|
} |
||||
|
} |
||||
|
// 自动 审核通过
|
||||
|
// 是否自动审核 auto commit
|
||||
|
SysConfig autoApproveConfig = sysConfigMapper.selectByCode("auto_approve"); |
||||
|
if(null==autoApproveConfig){ |
||||
|
log.warn("未配置auto_approve "); |
||||
|
mesg2.append("未配置auto_approve "); |
||||
|
} |
||||
|
String autoApprove = autoApproveConfig.getValue(); |
||||
|
if("1".equals(autoApprove)){ |
||||
|
Response<Object> passReviewRes= supplierService.passReview(invoiceId,null); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
}catch (Exception e){ |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return mesg2; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public StringBuffer fetchingProcess() throws Exception { |
||||
|
mesg = new StringBuffer(); |
||||
|
// 宝尊掃描用戶id
|
||||
|
SysConfig baozunUserIdConfig = sysConfigMapper.selectByCode("baozun_user_id"); |
||||
|
String userIdStr = baozunUserIdConfig.getValue(); |
||||
|
int userId = Integer.valueOf(userIdStr); |
||||
|
//
|
||||
|
// // 宝尊扫描com
|
||||
|
// SysConfig baozunComIdConfig = sysConfigMapper.selectByCode("baozun_com_id");
|
||||
|
// String com = baozunComIdConfig.getValue();
|
||||
|
String com = null; |
||||
|
// 宝尊appkey
|
||||
|
SysConfig baozunAppKeyConfig = sysConfigMapper.selectByCode("baozun_appKey"); |
||||
|
String appKey = baozunAppKeyConfig.getValue(); |
||||
|
// 宝尊appSecret
|
||||
|
SysConfig baozunAppSecretConfig = sysConfigMapper.selectByCode("baozun_appSecret"); |
||||
|
String appSecret = baozunAppSecretConfig.getValue(); |
||||
|
// 获取发票url
|
||||
|
SysConfig baozunInvoiceUrlConfig = sysConfigMapper.selectByCode("baozun_api_url"); |
||||
|
String api = baozunInvoiceUrlConfig.getValue(); |
||||
|
// 获取发票methodName
|
||||
|
SysConfig methodNameConfig = sysConfigMapper.selectByCode("baozun_invoice_method_name"); |
||||
|
String interfaceType = "1"; |
||||
|
String methodName = methodNameConfig.getValue(); |
||||
|
int pageSize = 50; |
||||
|
int currentPage = 1; |
||||
|
// 添加协议级请求参数
|
||||
|
Date now = new Date(); |
||||
|
String nowDate = cn.hutool.core.date.DateUtil.format(now, DateFormat.DatePatternType.FORMAT_yyyy_MM_dd); |
||||
|
|
||||
|
String searchDate = cn.hutool.core.date.DateUtil.format(now, DateFormat.DatePatternType.FORMAT_yyyy_MM_dd_HH_mm_ss); |
||||
|
Calendar now1 = Calendar.getInstance(); |
||||
|
now1.setTime(now); |
||||
|
now1.add(Calendar.DAY_OF_MONTH, -1); |
||||
|
String beforeDate = cn.hutool.core.date.DateUtil.format(now1.getTime(), DateFormat.DatePatternType.FORMAT_yyyy_MM_dd_HH_mm_ss); |
||||
|
|
||||
|
// 预设API 参数
|
||||
|
SysConfig baozunApiParamsConfig = sysConfigMapper.selectByCode("baozun_api_params"); |
||||
|
if(null!=baozunApiParamsConfig){ |
||||
|
String paramsConfigValue = baozunApiParamsConfig.getValue(); |
||||
|
int daysDiff = Integer.parseInt(paramsConfigValue); |
||||
|
now1 = Calendar.getInstance(); |
||||
|
now1.setTime(now); |
||||
|
now1.add(Calendar.DAY_OF_MONTH, -daysDiff); |
||||
|
beforeDate = cn.hutool.core.date.DateUtil.format(now1.getTime(), DateFormat.DatePatternType.FORMAT_yyyy_MM_dd_HH_mm_ss); |
||||
|
} |
||||
|
String res = getResFromApi(appKey,appSecret,interfaceType,methodName, |
||||
|
api,beforeDate,searchDate,pageSize,currentPage,null,null); |
||||
|
log.info("res1:{}",res); |
||||
|
String folder = Pdf2JpgHelper.generateFolder(invoicePic + File.separator); |
||||
|
|
||||
|
CorporateInvoiceType corporateInvoiceType = corporateInvoiceTypeMapper.selectByPrimaryKey(2); |
||||
|
|
||||
|
ScannerPostDate postDate = new ScannerPostDate(); |
||||
|
postDate.setHashKey("1"); |
||||
|
|
||||
|
boolean flag = true; |
||||
|
|
||||
|
BaozunInvoiceVo baozunInvoiceRes = JSONObject.parseObject(res,BaozunInvoiceVo.class); |
||||
|
int status = baozunInvoiceRes.getStatus(); |
||||
|
if(1!=status){ |
||||
|
// 失败
|
||||
|
mesg.append(beforeDate) |
||||
|
.append("-") |
||||
|
.append(searchDate) |
||||
|
.append(methodName+"接口返回错误"+baozunInvoiceRes.getErrorMessage()); |
||||
|
return mesg; |
||||
|
} |
||||
|
while(1==status&&flag) { |
||||
|
// 成功
|
||||
|
List<BaozunInvoiceVo.DataInfo> dataInfos = baozunInvoiceRes.getData(); |
||||
|
int maxTotal = baozunInvoiceRes.getTotalPage(); |
||||
|
|
||||
|
if (null != dataInfos && !dataInfos.isEmpty()) { |
||||
|
for (BaozunInvoiceVo.DataInfo dataInfo : dataInfos) { |
||||
|
if(null==dataInfo)continue; |
||||
|
String settlementType = dataInfo.getSettlementType(); |
||||
|
if("1".equals(settlementType)){ |
||||
|
continue; |
||||
|
} |
||||
|
String costCenter = dataInfo.getCostCenter(); |
||||
|
String venderCode = dataInfo.getVendorCode(); |
||||
|
SysOrg org = sysOrgMapper.selectByCode(costCenter); |
||||
|
if(null==org){ |
||||
|
// 不存在
|
||||
|
log.warn("宝尊不存在的组织 sys_org表costCenter=》{}",costCenter); |
||||
|
mesg.append("不存在的组织 sys_org表costCenter=》"+costCenter); |
||||
|
continue; |
||||
|
} |
||||
|
int orgId = org.getId(); |
||||
|
List<BaozunInvoiceVo.BaozunInvoiceInfo> invoiceList = dataInfo.getInvoiceList(); |
||||
|
for (BaozunInvoiceVo.BaozunInvoiceInfo baozunInvoiceInfo : invoiceList) { |
||||
|
String url = baozunInvoiceInfo.getInvoiceUrl(); |
||||
|
String number = baozunInvoiceInfo.getInvoiceNumber(); |
||||
|
// 查找nunber是否存在
|
||||
|
List<CorporateInvoice> corporateInvoices = corporateInvoiceMapper.selectByInvoiceNumber(number); |
||||
|
if(!corporateInvoices.isEmpty()){ |
||||
|
continue; |
||||
|
} |
||||
|
// String pdfUrlName = url.substring(url.lastIndexOf("/")+1);
|
||||
|
String uploadFilePath = invoicePic +File.separator + folder; |
||||
|
// String uploadFilePath = invoicePic +File.separator + folder+File.separator+pdfUrlName;
|
||||
|
log.info("download url =>{}",url); |
||||
|
File file = HttpUtil.downloadFileFromUrl(url, uploadFilePath); |
||||
|
log.info("downloadfilepath=>{}",file.getAbsolutePath()); |
||||
|
// String suffix = file.getName().substring(file.getName().lastIndexOf("."));
|
||||
|
if (!file.exists()) { |
||||
|
// 文件不存在
|
||||
|
mesg.append("文件下载后不存在"); |
||||
|
} else { |
||||
|
if (file.getName().toLowerCase().endsWith("pdf")) { |
||||
|
log.info("download pdf =>{}",url); |
||||
|
sysCorInvoiceService.eleFirstOcrLeft(folder, invoicePic, file.getAbsolutePath(), postDate, watchPath, userId, orgId, file.getName(), corporateInvoiceType, null, com,uploadPath); |
||||
|
} else { |
||||
|
log.info("download jpeg =>{}",url); |
||||
|
String newFileName = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + StringUtil.UUID() + ".jpeg"; |
||||
|
String newImagePath = watchPath + newFileName; |
||||
|
StorageCache.write(newFileName, com, 1000 * 60 * 30); |
||||
|
StorageCache.write("Owner." + newFileName, userId, 1000 * 60 * 30); |
||||
|
StorageCache.write("HashKey." + newFileName, "1", 1000 * 60 * 30); |
||||
|
StorageCache.write("CorType." + newFileName, corporateInvoiceType, 1000 * 60 * 30); |
||||
|
StorageCache.write("PdfUrl." + newFileName, file.getAbsolutePath(), 1000 * 60 * 30); |
||||
|
StorageCache.write("scannerLogs." + newFileName, 0, 1000 * 60 * 30); |
||||
|
log.info("fileName===>{}", file.getName()); |
||||
|
OFDUtil.dealOFDToJPEG(file.getAbsolutePath(), newImagePath); |
||||
|
} |
||||
|
|
||||
|
// 发票识别验真成功后 更新 根据venderCode supplier表中的tax_no
|
||||
|
Supplier supplier =supplierMapper.selectBySupplierCodeOnly(venderCode); |
||||
|
if(null==supplier){ |
||||
|
// 不存在
|
||||
|
log.warn("宝尊不存在的供应商supplier表supplier_code=》{}",venderCode); |
||||
|
mesg.append("不存在的供应商supplier表supplier_code=》"+venderCode); |
||||
|
continue; |
||||
|
} |
||||
|
String supplierTaxNo = supplier.getTaxNo(); |
||||
|
if(StringUtils.isEmpty(supplierTaxNo.trim())){ |
||||
|
if(null!=supplier){ |
||||
|
corporateInvoices = corporateInvoiceMapper.selectByInvoiceNumber(number); |
||||
|
for (CorporateInvoice corporateInvoice : corporateInvoices) { |
||||
|
// 更新 他的税号
|
||||
|
Integer corStatus = corporateInvoice.getStatus(); |
||||
|
if(0==corStatus||1==corStatus){ |
||||
|
// 满足验真条件
|
||||
|
String taxNo = corporateInvoice.getSellerNo(); |
||||
|
supplier.setTaxNo(taxNo); |
||||
|
supplierMapper.updateByPrimaryKey(supplier); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
currentPage = currentPage + 1; |
||||
|
if (currentPage >= maxTotal) { |
||||
|
flag = false; |
||||
|
} |
||||
|
if (flag) { |
||||
|
res = getResFromApi(appKey, appSecret, interfaceType, methodName, |
||||
|
api, beforeDate, searchDate, pageSize, currentPage, null, null); |
||||
|
log.info("res 2:{}",res); |
||||
|
baozunInvoiceRes = JSONObject.parseObject(res, BaozunInvoiceVo.class); |
||||
|
status = baozunInvoiceRes.getStatus(); |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
flag = false; |
||||
|
mesg.append(beforeDate) |
||||
|
.append("-") |
||||
|
.append(searchDate) |
||||
|
.append("无 data 数据"); |
||||
|
} |
||||
|
} |
||||
|
return mesg; |
||||
|
} |
||||
|
|
||||
|
private String getResFromApi(String appKey,String appSecret,String interfaceType,String methodName, |
||||
|
String api,String startDate,String endDate,int pageSize,int currentPage |
||||
|
,String invoiceNumber,String vendorCode) throws IOException { |
||||
|
String timestamp = DateUtil.now(); |
||||
|
StringBuffer sb1 = new StringBuffer(); |
||||
|
sb1.append(appSecret) |
||||
|
.append("interfaceType") |
||||
|
.append(interfaceType) |
||||
|
.append("methodName") |
||||
|
.append(methodName) |
||||
|
.append("requestTime") |
||||
|
.append(timestamp) |
||||
|
.append("sourceApp") |
||||
|
.append(appKey) |
||||
|
.append("version") |
||||
|
.append("1.0"); |
||||
|
JSONObject params = new JSONObject(); |
||||
|
if(null!=startDate&&null!=endDate){ |
||||
|
params.put("startCreateTime",startDate); |
||||
|
params.put("endCreateTime",endDate); |
||||
|
} |
||||
|
if(null!=vendorCode){ |
||||
|
params.put("vendorCode",vendorCode); |
||||
|
} |
||||
|
if(null!=invoiceNumber){ |
||||
|
params.put("invoiceNumber",invoiceNumber); |
||||
|
} |
||||
|
params.put("pageSize",pageSize); |
||||
|
params.put("currentPage",currentPage); |
||||
|
String request = params.toJSONString(); |
||||
|
sb1.append(request); |
||||
|
sb1.append(appSecret); |
||||
|
byte[] bytes = MD5Encrypt.encryptMD5(sb1.toString()); |
||||
|
// 第五步:把二进制转化为大写的十六进制
|
||||
|
String sign = SignUtil.byte2hex(bytes); |
||||
|
Map<String, String> paramBody = new HashMap<String, String>(); |
||||
|
paramBody.put("body", request); |
||||
|
paramBody.put("Content-Type", "application/json"); |
||||
|
paramBody.put("Authorization", ""); |
||||
|
|
||||
|
String apiPath =api |
||||
|
+"?interfaceType=1" + |
||||
|
"&methodName=" + methodName + |
||||
|
"&requestTime=" + timestamp + |
||||
|
"&sign=" + sign + |
||||
|
"&sourceApp=" + appKey + |
||||
|
"&version=1.0"; |
||||
|
String[] response = interfaceUtil.httpPostMan2(apiPath, paramBody); |
||||
|
log.info("宝尊 api ==={} body ===={},", apiPath, paramBody); |
||||
|
log.info("宝尊 code ==={} response ===={},", response[1], response[0]); |
||||
|
if (Integer.parseInt(response[1]) != 200) { |
||||
|
log.error("宝尊 交互网络异常,响应状态异常:" + response[1] + ",响应体为:" + response[0]); |
||||
|
return null; |
||||
|
} else { |
||||
|
return response[0]; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
public String[] getInvoicePoByUrl(String invoiceId,String invoice_po_url){ |
||||
|
String resPo[] = new String[2]; |
||||
|
if(StringUtils.isEmpty(invoice_po_url)){ |
||||
|
return null; |
||||
|
} |
||||
|
Map<String, String> paramBody = new HashMap<String, String>(); |
||||
|
// paramBody.put("body", data);
|
||||
|
paramBody.put("Content-Type", "application/json"); |
||||
|
paramBody.put("Authorization", ""); |
||||
|
|
||||
|
String[] response = interfaceUtil.httpPostMan2(invoice_po_url, paramBody); |
||||
|
if (Integer.parseInt(response[1]) != 200) { |
||||
|
log.error("getInvoicePoByUrl 交互网络异常,响应状态:" + response[1] + ",响应体为:" + response[0]); |
||||
|
// mesg.append(response[0]);
|
||||
|
} else { |
||||
|
// resPo = response[0]
|
||||
|
JSONObject jsonObject = JSONObject.parseObject(response[0]); |
||||
|
JSONArray dataObject = jsonObject.getJSONArray("data"); |
||||
|
JSONObject dataOne = (JSONObject) dataObject.get(0); |
||||
|
// String costCenter = dataOne.get
|
||||
|
JSONArray poList = dataOne.getJSONArray("poList"); |
||||
|
JSONObject poOne = (JSONObject) poList.get(0); |
||||
|
|
||||
|
// vendorCode = supplierCode
|
||||
|
String poNumber = poOne.getString("poNumber"); |
||||
|
resPo[0] = poNumber; |
||||
|
resPo[1] = poNumber; |
||||
|
} |
||||
|
|
||||
|
return resPo; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public String getYYUrl(){ |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
public String getYYToken(String appKey,String tenantId){ |
||||
|
String token = null; |
||||
|
// URLEncode( Base64( HmacSHA256( parameterMap ) ) )
|
||||
|
|
||||
|
String timestamp = String.valueOf(new Date().getTime()); |
||||
|
String suiteKeyValue = "suiteKey"+appKey; |
||||
|
String tenantIdValue = "tenantId"+tenantId; |
||||
|
String timestampValue = "timestamp"+timestamp; |
||||
|
String message = suiteKeyValue+tenantIdValue+timestampValue; |
||||
|
String token1 = sign2(appKey,timestamp,message); |
||||
|
token = URLEncoder.encode(token1); |
||||
|
return token; |
||||
|
} |
||||
|
|
||||
|
public static void main(String asd[]){ |
||||
|
String ncTotal = "294.98"; |
||||
|
String invoiceTotal = "295.00"; |
||||
|
BigDecimal nc = new BigDecimal(ncTotal); |
||||
|
BigDecimal invoice = new BigDecimal(invoiceTotal); |
||||
|
System.out.println(nc.compareTo(invoice)>0); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,232 @@ |
|||||
|
package com.cmsen.ticket.application.service.impl; |
||||
|
|
||||
|
import cn.hutool.core.io.IoUtil; |
||||
|
import com.alibaba.excel.EasyExcel; |
||||
|
import com.alibaba.excel.support.ExcelTypeEnum; |
||||
|
import com.cmsen.common.exception.ServiceException; |
||||
|
import com.cmsen.common.http.ContentEnctype; |
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.common.util.DateFormat; |
||||
|
import com.cmsen.common.util.FileMime; |
||||
|
import com.cmsen.common.util.StringUtil; |
||||
|
import com.cmsen.ticket.application.service.CityService; |
||||
|
import com.cmsen.ticket.domain.entity.City; |
||||
|
import com.cmsen.ticket.domain.mapper.CityMapper; |
||||
|
import com.cmsen.ticket.domain.util.PaginationUtil; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import javax.servlet.ServletOutputStream; |
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.io.InputStream; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* (City)表服务实现类 |
||||
|
* |
||||
|
* @author ran hao yu |
||||
|
* @since 2020-09-24 16:25:44 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class CityServiceImpl implements CityService { |
||||
|
@Resource |
||||
|
private CityMapper cityMapper; |
||||
|
|
||||
|
/** |
||||
|
* 通过ID查询单条数据 |
||||
|
* |
||||
|
* @param id 主键 |
||||
|
* @return 实例对象 |
||||
|
*/ |
||||
|
@Override |
||||
|
public City queryById(Integer id) { |
||||
|
return this.cityMapper.queryById(id); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询多条数据 |
||||
|
* |
||||
|
* @param offset 查询起始位置 |
||||
|
* @param limit 查询条数 |
||||
|
* @return 对象列表 |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<City> queryAllByLimit(int offset, int limit) { |
||||
|
return this.cityMapper.queryAllByLimit(offset, limit); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse queryAll(City city) { |
||||
|
if ("".equals(city.getCity()) || city.getCity() == null) { |
||||
|
return RestResponse.failure("搜索关键字不能为空"); |
||||
|
} else { |
||||
|
List<City> cities = cityMapper.queryAll(city); |
||||
|
return RestResponse.success(cities); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增数据 |
||||
|
* |
||||
|
* @param city 实例对象 |
||||
|
* @return 实例对象 |
||||
|
*/ |
||||
|
@Override |
||||
|
public City insert(City city) { |
||||
|
this.cityMapper.insert(city); |
||||
|
return city; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改数据 |
||||
|
* |
||||
|
* @param city 实例对象 |
||||
|
* @return 实例对象 |
||||
|
*/ |
||||
|
@Override |
||||
|
public City update(City city) { |
||||
|
this.cityMapper.update(city); |
||||
|
return this.queryById(city.getId()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 通过主键删除数据 |
||||
|
* |
||||
|
* @param id 主键 |
||||
|
* @return 是否成功 |
||||
|
*/ |
||||
|
@Override |
||||
|
public boolean deleteById(Integer id) { |
||||
|
return this.cityMapper.deleteById(id) > 0; |
||||
|
} |
||||
|
|
||||
|
public int insertBatch(List<City> list) { |
||||
|
return cityMapper.insertBatch(list); |
||||
|
} |
||||
|
|
||||
|
public int updateBatch(List<City> list) { |
||||
|
return cityMapper.updateBatch(list); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse list(Map<String, Object> params) { |
||||
|
params.put("pageNum",params.get("pageNo").toString()); |
||||
|
PageHelper.startPage(Integer.parseInt(params.get("pageNum").toString()),Integer.parseInt(params.get("pageSize").toString())); |
||||
|
|
||||
|
List<City> list = cityMapper.list(params); |
||||
|
int count = cityMapper.count(params); |
||||
|
|
||||
|
return RestResponse.success(PaginationUtil.getPageResult(count, params, list)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse create(City city) { |
||||
|
city.setClient(1); |
||||
|
city.setIsDel("0"); |
||||
|
city.setCreateTime(DateFormat.format(new Date(), DateFormat.DatePatternType.FORMAT_yyyy_MM_dd_HH_mm_ss)); |
||||
|
cityMapper.insert(city); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse updateCity(City city) { |
||||
|
cityMapper.update(city); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse delete(Integer id) { |
||||
|
cityMapper.deleteById(id); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse export(Map<String, Object> params, HttpServletResponse response) { |
||||
|
|
||||
|
response.reset(); |
||||
|
ServletOutputStream out = null; |
||||
|
try { |
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=export.xlsx"); |
||||
|
out = response.getOutputStream(); |
||||
|
List<City> list = cityMapper.list(params); |
||||
|
EasyExcel.write(out).excelType(ExcelTypeEnum.XLSX) |
||||
|
.sheet(0, "城市") |
||||
|
.head(City.class) |
||||
|
.doWrite(list); |
||||
|
out.flush(); |
||||
|
return null; |
||||
|
} catch (Exception e) { |
||||
|
response.setContentType(ContentEnctype.JSON); |
||||
|
return RestResponse.failure(e.getMessage()); |
||||
|
} finally { |
||||
|
IoUtil.close(out); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Transactional |
||||
|
@Override |
||||
|
public RestResponse upload(MultipartFile file) { |
||||
|
try { |
||||
|
InputStream inputStream = file.getInputStream(); |
||||
|
List<Map<Integer, String>> sheetRowData = EasyExcel.read(inputStream).sheet(0).doReadSync(); |
||||
|
//先进行判断:为空
|
||||
|
for (int i = 0; i < sheetRowData.size(); i++) { |
||||
|
Map<Integer, String> sheetRowDatum = sheetRowData.get(i); |
||||
|
if(StringUtil.isEmpty(sheetRowDatum.get(0))){ |
||||
|
return RestResponse.failure("第"+(i+2)+"行的城市名为空,请检查!"); |
||||
|
} |
||||
|
if(StringUtil.isEmpty(sheetRowDatum.get(1))){ |
||||
|
return RestResponse.failure("第"+(i+2)+"行的CODE为空,请检查!"); |
||||
|
} |
||||
|
} |
||||
|
//数据处理
|
||||
|
for (int i = 0; i < sheetRowData.size(); i++) { |
||||
|
Map<Integer, String> sheetRowDatum = sheetRowData.get(i); |
||||
|
String cityName = StringUtil.trim(String.valueOf(sheetRowDatum.get(0))); //城市名
|
||||
|
String code = StringUtil.trim(String.valueOf(sheetRowDatum.get(1))); //CODE
|
||||
|
|
||||
|
City bean = cityMapper.selectByCode(code); |
||||
|
if(bean == null){//插入
|
||||
|
City city = new City(){{ |
||||
|
setClient(1); |
||||
|
setCity(cityName); |
||||
|
setCode(code); |
||||
|
setIsDel("0"); |
||||
|
setCreateTime(DateFormat.format(new Date(), DateFormat.DatePatternType.FORMAT_yyyy_MM_dd_HH_mm_ss)); |
||||
|
setStaType(StringUtil.trim(String.valueOf(sheetRowDatum.get(2)))); |
||||
|
setStaName(StringUtil.trim(String.valueOf(sheetRowDatum.get(3)))); |
||||
|
setCustomer1(StringUtil.trim(String.valueOf(sheetRowDatum.get(4)))); |
||||
|
setCustomer2(StringUtil.trim(String.valueOf(sheetRowDatum.get(5)))); |
||||
|
setCustomer3(StringUtil.trim(String.valueOf(sheetRowDatum.get(6)))); |
||||
|
setCustomer4(StringUtil.trim(String.valueOf(sheetRowDatum.get(7)))); |
||||
|
}}; |
||||
|
cityMapper.insert(city); |
||||
|
}else{//更新
|
||||
|
City city = new City(){{ |
||||
|
setId(bean.getId()); |
||||
|
setCity(cityName); |
||||
|
setStaType(StringUtil.trim(String.valueOf(sheetRowDatum.get(2)))); |
||||
|
setStaName(StringUtil.trim(String.valueOf(sheetRowDatum.get(3)))); |
||||
|
setCustomer1(StringUtil.trim(String.valueOf(sheetRowDatum.get(4)))); |
||||
|
setCustomer2(StringUtil.trim(String.valueOf(sheetRowDatum.get(5)))); |
||||
|
setCustomer3(StringUtil.trim(String.valueOf(sheetRowDatum.get(6)))); |
||||
|
setCustomer4(StringUtil.trim(String.valueOf(sheetRowDatum.get(7)))); |
||||
|
}}; |
||||
|
cityMapper.update(city); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return RestResponse.success(); |
||||
|
} catch (Exception e) { |
||||
|
throw new ServiceException("数据导入失败"); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,40 @@ |
|||||
|
package com.cmsen.ticket.application.service.impl; |
||||
|
|
||||
|
import com.cmsen.ticket.domain.util.PendantHotMountJsAdapter; |
||||
|
|
||||
|
import javax.script.ScriptException; |
||||
|
import java.io.FileNotFoundException; |
||||
|
import java.io.FileReader; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2021/9/3 22:09 |
||||
|
**/ |
||||
|
public class ConcurAdapterService { |
||||
|
|
||||
|
public static Map<String, Object> dealDate(Map<String, Object> params) { |
||||
|
try { |
||||
|
FileReader fileReader = new FileReader("D:\\WorkSpace\\IDEA\\fees-invoice\\fees-invoice-mini-backend\\src\\test\\resources\\testScript.cjs"); |
||||
|
// 创建加载器并带入脚本
|
||||
|
PendantHotMountJsAdapter jsAdapter = new PendantHotMountJsAdapter( |
||||
|
fileReader |
||||
|
); |
||||
|
jsAdapter.setVariable("ClazzObject", params); |
||||
|
|
||||
|
// 设置输出对象1
|
||||
|
Map<String, Object> mapObject = new HashMap<>(); |
||||
|
|
||||
|
// 调用脚本中函数方法
|
||||
|
Map<String, Object> testMapObject = (Map<String, Object>) jsAdapter.invoke("testMapObject", mapObject); |
||||
|
params.putAll(testMapObject); |
||||
|
} catch (ScriptException e) { |
||||
|
System.err.println("脚本语法错误:" + e.getMessage()); |
||||
|
} catch (NoSuchMethodException | FileNotFoundException e) { |
||||
|
System.err.println("方法不存在: " + e.getMessage()); |
||||
|
} |
||||
|
return params; |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,242 @@ |
|||||
|
package com.cmsen.ticket.application.service.impl; |
||||
|
|
||||
|
import com.cmsen.common.exception.ServiceException; |
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.common.util.StringUtil; |
||||
|
import com.cmsen.ticket.application.service.ExpenseTypeActiveService; |
||||
|
import com.cmsen.ticket.domain.entity.*; |
||||
|
import com.cmsen.ticket.domain.mapper.*; |
||||
|
import com.cmsen.ticket.domain.util.PaginationUtil; |
||||
|
import com.cmsenframework.security.RequestSecurityPolicy; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.util.Assert; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* @author ran hao yu |
||||
|
* @date 2020/8/4 10:25 |
||||
|
* @description |
||||
|
*/ |
||||
|
@Service |
||||
|
|
||||
|
public class ExpenseTypeActiveServiceImpl implements ExpenseTypeActiveService { |
||||
|
@Resource |
||||
|
private ExpenseTypeActiveMapper expenseTypeActiveMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private CustomerMapper customerMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private UserMapper userMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private ValueSetMapper valueSetMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private ExpenseTypeActiveTtListConfigMapper expenseTypeActiveTtListConfigMapper; |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse selectList(Integer pid) { |
||||
|
try { |
||||
|
if (pid == null) { |
||||
|
throw new ServiceException("pid为空"); |
||||
|
} else { |
||||
|
List<ExpenseTypeActive> expenseTypeActives = expenseTypeActiveMapper.selectList(pid); |
||||
|
return RestResponse.success(expenseTypeActives); |
||||
|
} |
||||
|
} catch (ServiceException e) { |
||||
|
throw new ServiceException(e); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public List<ExpenseTypeActive> selectListByTicketType(Integer pid) { |
||||
|
try { |
||||
|
if (pid == null) { |
||||
|
throw new ServiceException("Pid不能为空"); |
||||
|
} |
||||
|
return expenseTypeActiveMapper.selectListByTicketType(pid); |
||||
|
} catch (ServiceException e) { |
||||
|
throw new ServiceException("系统错误"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private List<ExpenseTypeActive> generateTree(List<ExpenseTypeActive> expenseTypeActives) { |
||||
|
List<ExpenseTypeActive> orgList = new ArrayList<>(); |
||||
|
for (ExpenseTypeActive sysMenu : expenseTypeActives) { |
||||
|
if (sysMenu.getExPid().equals(0)) { |
||||
|
orgList.add(sysMenu); |
||||
|
addSubs(sysMenu, expenseTypeActives); |
||||
|
} |
||||
|
} |
||||
|
return orgList; |
||||
|
} |
||||
|
|
||||
|
private List<ExpenseTypeActive> generateTree2(List<ExpenseTypeActive> expenseTypeActives, List<ExpenseTypeActive> result) { |
||||
|
List<ExpenseTypeActive> orgList = new ArrayList<>(); |
||||
|
for (ExpenseTypeActive sysMenu : expenseTypeActives) { |
||||
|
if (sysMenu.getExPid().equals(0)) { |
||||
|
orgList.add(sysMenu); |
||||
|
result.add(sysMenu); |
||||
|
addSubs2(sysMenu, expenseTypeActives, result); |
||||
|
} |
||||
|
} |
||||
|
return orgList; |
||||
|
} |
||||
|
|
||||
|
private ExpenseTypeActive addSubs2(ExpenseTypeActive org, List<ExpenseTypeActive> list, List<ExpenseTypeActive> result) { |
||||
|
for (ExpenseTypeActive sysOrg : list) { |
||||
|
if (org.getId().equals(sysOrg.getExPid())) { |
||||
|
org.setChildId(sysOrg.getId()); |
||||
|
result.add(sysOrg); |
||||
|
org.getChild().add(addSubs2(sysOrg, list, result)); |
||||
|
} |
||||
|
} |
||||
|
return org; |
||||
|
} |
||||
|
|
||||
|
private ExpenseTypeActive addSubs(ExpenseTypeActive org, List<ExpenseTypeActive> list) { |
||||
|
for (ExpenseTypeActive sysOrg : list) { |
||||
|
if (org.getId().equals(sysOrg.getExPid())) { |
||||
|
org.setChildId(sysOrg.getId()); |
||||
|
org.getChild().add(addSubs(sysOrg, list)); |
||||
|
} |
||||
|
} |
||||
|
return org; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse selectListByExpenseType(Integer pid) { |
||||
|
if (pid == null) { |
||||
|
throw new ServiceException("Pid不能为空"); |
||||
|
} |
||||
|
List<ExpenseTypeActive> vo = getExpenseTypeActivesForExpenseType(pid); |
||||
|
return RestResponse.success(vo); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<ExpenseTypeActive> getExpenseTypeActivesForExpenseType(Integer pid) { |
||||
|
List<ExpenseTypeActive> expenseTypeActives1 = expenseTypeActiveMapper.selectExListByIdAndKind(pid, 2, (int) RequestSecurityPolicy.getUserId()); |
||||
|
List<ExpenseTypeActive> vo = new ArrayList<>(); |
||||
|
generateTree2(expenseTypeActives1, vo); |
||||
|
vo.parallelStream().forEach(v -> { |
||||
|
List<ExpenseTypeActive> child = v.getChild(); |
||||
|
child.clear(); |
||||
|
List<ValueSet> subs = v.getSubs(); |
||||
|
if (v.getType().equals("select") && !subs.isEmpty()) { |
||||
|
for (ValueSet sub : subs) { |
||||
|
if ("default".equals(sub.getExt01())) { |
||||
|
v.setTargetId(sub.getId()); |
||||
|
v.setDefaultValue(sub.getValueName()); |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
return vo; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<ExpenseTypeActive> selectExFields(Integer pid, Integer kind) { |
||||
|
List<ExpenseTypeActive> list = expenseTypeActiveMapper.selectExListByIdAndKind(pid, kind, null); |
||||
|
List<ExpenseTypeActive> vo = new ArrayList<>(); |
||||
|
generateTree2(list, vo); |
||||
|
vo.forEach(v -> { |
||||
|
List<ExpenseTypeActive> child = v.getChild(); |
||||
|
child.clear(); |
||||
|
}); |
||||
|
return vo; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<ExpenseTypeActive> selectExFieldsOut(Integer pid, Integer kind, HttpServletRequest request) { |
||||
|
List<ExpenseTypeActive> list = expenseTypeActiveMapper.selectExListByIdAndKind(pid, kind, (int) RequestSecurityPolicy.getUserId()); |
||||
|
for (ExpenseTypeActive expenseTypeActive : list) { |
||||
|
List<ExpenseTypeActive> collect = list.stream().filter(ex -> ex.getExPid().equals(expenseTypeActive.getId())).collect(Collectors.toList()); |
||||
|
if (!collect.isEmpty()) { |
||||
|
expenseTypeActive.setChildId(collect.get(0).getId()); |
||||
|
} |
||||
|
} |
||||
|
User user = userMapper.selectByUser(new User() {{ |
||||
|
setUserId((int) RequestSecurityPolicy.getUserId()); |
||||
|
}}); |
||||
|
Customer customer = customerMapper.queryById(user.getClient()); |
||||
|
if (StringUtil.isNotEmpty(customer.getOrgUnitWord())) { |
||||
|
String org = ""; |
||||
|
// String org = t10EmployeeMapper.selectOrgByUser(user.getEmail(), customer.getOrgUnitWord());
|
||||
|
Integer orgId; |
||||
|
for (ExpenseTypeActive expenseTypeActive : list) { |
||||
|
if (expenseTypeActive.getSelectName().equals("Org")) { |
||||
|
ValueSet valueSet = valueSetMapper.selectByValueName(org); |
||||
|
expenseTypeActive.setDefaultValue(org); |
||||
|
if (valueSet != null) { |
||||
|
expenseTypeActive.setTargetId(valueSet.getId()); |
||||
|
} |
||||
|
List<ValueSet> subs = expenseTypeActive.getSubs(); |
||||
|
subs.removeIf(sub -> !(sub.getValueName().equals(org) || sub.getLang().equals(org))); |
||||
|
orgId = expenseTypeActive.getId(); |
||||
|
for (ExpenseTypeActive expenseTypeActive1 : list) { |
||||
|
if (expenseTypeActive1.getExPid().equals(orgId)) { |
||||
|
if (subs.isEmpty()) { |
||||
|
expenseTypeActive1.setSubs(new ArrayList<>()); |
||||
|
} else { |
||||
|
expenseTypeActive1.getSubs().removeIf(sub -> !sub.getPid().equals(subs.get(0).getId())); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return list; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse selectListType(String selectName) { |
||||
|
ExpenseTypeActiveTtListConfig config = expenseTypeActiveTtListConfigMapper.selectBySelectName(selectName); |
||||
|
Assert.notNull(config, "列表未配置"); |
||||
|
List<ValueSet> res = valueSetMapper.selectByCategory(config.getType()); |
||||
|
return RestResponse.success(res); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse selectListValues(Map<String, Object> params) { |
||||
|
ExpenseTypeActiveTtListConfig config = expenseTypeActiveTtListConfigMapper.selectBySelectName(params.get("selectName").toString()); |
||||
|
Assert.notNull(config, "列表未配置"); |
||||
|
|
||||
|
params.put("category",config.getValue()); |
||||
|
PaginationUtil.paginationInit(params); |
||||
|
List<ValueSet> res = valueSetMapper.selectForListValues2(params); |
||||
|
return RestResponse.success(res); |
||||
|
} |
||||
|
|
||||
|
public RestResponse selectByExpenseType(Integer pid) { |
||||
|
|
||||
|
if (pid == null) { |
||||
|
throw new ServiceException("Pid不能为空"); |
||||
|
} |
||||
|
List<ExpenseTypeActive> expenseTypeActives1 = expenseTypeActiveMapper.selectExListByIdAndKind(pid, 5, (int) RequestSecurityPolicy.getUserId()); |
||||
|
List<ExpenseTypeActive> vo = new ArrayList<>(); |
||||
|
generateTree2(expenseTypeActives1, vo); |
||||
|
vo.parallelStream().forEach(v -> { |
||||
|
List<ExpenseTypeActive> child = v.getChild(); |
||||
|
child.clear(); |
||||
|
List<ValueSet> subs = v.getSubs(); |
||||
|
if (v.getType().equals("select") && !subs.isEmpty()) { |
||||
|
for (ValueSet sub : subs) { |
||||
|
if ("default".equals(sub.getExt01())) { |
||||
|
v.setTargetId(sub.getId()); |
||||
|
v.setDefaultValue(sub.getValueName()); |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
return RestResponse.success(vo); |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,280 @@ |
|||||
|
package com.cmsen.ticket.application.service.impl; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.common.util.JsonUtil; |
||||
|
import com.cmsen.common.util.StringUtil; |
||||
|
import com.cmsen.ticket.application.service.ExpenseTypeService; |
||||
|
import com.cmsen.ticket.domain.entity.*; |
||||
|
import com.cmsen.ticket.domain.mapper.*; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.PreferencesMapper; |
||||
|
import com.cmsenframework.security.RequestSecurityPolicy; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* @author ran hao yu |
||||
|
* @date 2020/7/31 17:19 |
||||
|
* @description |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class ExpenseTypeServiceImpl implements ExpenseTypeService { |
||||
|
@Resource |
||||
|
private ExpenseTypeMapper expenseTypeMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private ExpenseTypeActiveMapper expenseTypeActiveMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private ExpenseReportsMapper expenseReportsMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private TicketTypeMapper ticketTypeMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private PreferencesMapper preferencesMapper; |
||||
|
@Resource |
||||
|
private MtListMapper mtListMapper; |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse getAllExpenseType(Integer reportId) { |
||||
|
ExpenseReports expenseReports = expenseReportsMapper.selectByPrimaryKey(reportId); |
||||
|
List<ExpenseType> expenseTypes = expenseTypeMapper.list(new ExpenseType() {{ |
||||
|
setPolicyId(expenseReports.getPolicyId()); |
||||
|
}}); |
||||
|
expenseTypes = generateTree(expenseTypes); |
||||
|
return RestResponse.success(expenseTypes); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse selectList(Map<String, Object> params) { |
||||
|
ExpenseReports expenseReports = expenseReportsMapper.selectByPrimaryKey(Integer.valueOf(params.get("reportId").toString())); |
||||
|
|
||||
|
List<ExpenseType> expenseTypes = expenseTypeMapper.list(new ExpenseType() {{ |
||||
|
setPolicyId(expenseReports.getPolicyId()); |
||||
|
//增加提示字段 2022/7/27 根据登录者的LANGUAGE_TYPE进行判断
|
||||
|
setUserId(Integer.valueOf(String.valueOf(RequestSecurityPolicy.getUserId()))); |
||||
|
}}); |
||||
|
List<ExpenseType> result = new ArrayList<>(); |
||||
|
String consumeType = params.get("consumeType").toString(); |
||||
|
String ticketType = params.get("ticketType").toString(); |
||||
|
TicketType ticketType1 = ticketTypeMapper.selectByName(ticketType); |
||||
|
if (ticketType1 != null) { |
||||
|
Preferences preferences3 = preferencesMapper.selectByTicketTypeAndConsumeType(ticketType1.getId(), consumeType); |
||||
|
if (preferences3 != null) { |
||||
|
List<String> exTypes = Arrays.stream(preferences3.getExpenseTypes().split(",")).collect(Collectors.toList()); |
||||
|
List<ExpenseType> collect = expenseTypes.stream().filter(expenseType -> expenseType.getPid().equals(0) || |
||||
|
exTypes.contains(String.valueOf(expenseType.getId()))).collect(Collectors.toList()); |
||||
|
generateTree(collect); |
||||
|
for (ExpenseType c : collect) { |
||||
|
if (!c.getSubs().isEmpty()) { |
||||
|
result.add(c); |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
Preferences preferences = preferencesMapper.selectByTicketTypeAndNullConsumeType(ticketType1.getId()); |
||||
|
if (preferences != null && StringUtil.isNotEmpty(preferences.getExpenseTypes())) { |
||||
|
List<String> exTypes = Arrays.stream(preferences.getExpenseTypes().split(",")).collect(Collectors.toList()); |
||||
|
List<ExpenseType> collect = expenseTypes.stream().filter(expenseType -> expenseType.getPid().equals(0) || |
||||
|
exTypes.contains(String.valueOf(expenseType.getId()))).collect(Collectors.toList()); |
||||
|
generateTree(collect); |
||||
|
for (ExpenseType c : collect) { |
||||
|
if (!c.getSubs().isEmpty()) { |
||||
|
result.add(c); |
||||
|
} |
||||
|
} |
||||
|
} else if (preferences == null && StringUtil.isNotEmpty(consumeType)) { |
||||
|
Preferences preferences1 = preferencesMapper.selectByConsumeTypeAndNullTicketType(consumeType); |
||||
|
if (preferences1 != null && StringUtil.isNotEmpty(preferences1.getExpenseTypes())) { |
||||
|
List<String> exTypes = Arrays.stream(preferences1.getExpenseTypes().split(",")).collect(Collectors.toList()); |
||||
|
List<ExpenseType> collect = expenseTypes.stream().filter(expenseType -> expenseType.getPid().equals(0) || |
||||
|
exTypes.contains(String.valueOf(expenseType.getId()))).collect(Collectors.toList()); |
||||
|
generateTree(collect); |
||||
|
for (ExpenseType c : collect) { |
||||
|
if (!c.getSubs().isEmpty()) { |
||||
|
result.add(c); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (result.isEmpty() && ticketType1.getId() != 48) { |
||||
|
List<ExpenseType> collect = expenseTypes.stream().filter(expenseType -> "0".equals(expenseType.getIsDel())).collect(Collectors.toList()); |
||||
|
result = generateTree(collect); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return RestResponse.success(result); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse selectList2(Map<String, Object> params) { |
||||
|
ExpenseReports expenseReports = expenseReportsMapper.selectByPrimaryKey(Integer.valueOf(params.get("reportId").toString())); |
||||
|
|
||||
|
List<ExpenseType> expenseTypes = expenseTypeMapper.list2(new ExpenseType() {{ |
||||
|
setPolicyId(expenseReports.getPolicyId()); |
||||
|
//增加提示字段 2022/7/27 根据登录者的LANGUAGE_TYPE进行判断
|
||||
|
setUserId(Integer.valueOf(String.valueOf(RequestSecurityPolicy.getUserId()))); |
||||
|
}}); |
||||
|
log.info("expenseTypes.size()===={}",expenseTypes.size()); |
||||
|
List<ExpenseType> result = new ArrayList<>(); |
||||
|
String consumeType = params.get("consumeType").toString(); |
||||
|
String ticketType = params.get("ticketType").toString(); |
||||
|
TicketType ticketType1 = ticketTypeMapper.selectByName(ticketType); |
||||
|
if (ticketType1 != null) { |
||||
|
Preferences preferences3 = preferencesMapper.selectByTicketTypeAndConsumeType(ticketType1.getId(), consumeType); |
||||
|
if (preferences3 != null) { |
||||
|
List<String> exTypes = Arrays.stream(preferences3.getExpenseTypes().split(",")).collect(Collectors.toList()); |
||||
|
List<ExpenseType> collect = expenseTypes.stream().filter(expenseType -> expenseType.getPid().equals(0) || |
||||
|
exTypes.contains(String.valueOf(expenseType.getId()))).collect(Collectors.toList()); |
||||
|
generateTree(collect); |
||||
|
for (ExpenseType c : collect) { |
||||
|
if (!c.getSubs().isEmpty()) { |
||||
|
result.add(c); |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
Preferences preferences = preferencesMapper.selectByTicketTypeAndNullConsumeType(ticketType1.getId()); |
||||
|
if (preferences != null && StringUtil.isNotEmpty(preferences.getExpenseTypes())) { |
||||
|
List<String> exTypes = Arrays.stream(preferences.getExpenseTypes().split(",")).collect(Collectors.toList()); |
||||
|
List<ExpenseType> collect = expenseTypes.stream().filter(expenseType -> expenseType.getPid().equals(0) || |
||||
|
exTypes.contains(String.valueOf(expenseType.getId()))).collect(Collectors.toList()); |
||||
|
generateTree(collect); |
||||
|
for (ExpenseType c : collect) { |
||||
|
if (!c.getSubs().isEmpty()) { |
||||
|
result.add(c); |
||||
|
} |
||||
|
} |
||||
|
} else if (preferences == null && StringUtil.isNotEmpty(consumeType)) { |
||||
|
Preferences preferences1 = preferencesMapper.selectByConsumeTypeAndNullTicketType(consumeType); |
||||
|
if (preferences1 != null && StringUtil.isNotEmpty(preferences1.getExpenseTypes())) { |
||||
|
List<String> exTypes = Arrays.stream(preferences1.getExpenseTypes().split(",")).collect(Collectors.toList()); |
||||
|
List<ExpenseType> collect = expenseTypes.stream().filter(expenseType -> expenseType.getPid().equals(0) || |
||||
|
exTypes.contains(String.valueOf(expenseType.getId()))).collect(Collectors.toList()); |
||||
|
generateTree(collect); |
||||
|
for (ExpenseType c : collect) { |
||||
|
if (!c.getSubs().isEmpty()) { |
||||
|
result.add(c); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (result.isEmpty() && ticketType1.getId() != 48) { |
||||
|
if(ticketType1.getId() == 47){ |
||||
|
List<ExpenseType> collect = expenseTypes.stream().filter(expenseType -> "0".equals(expenseType.getExt01())).collect(Collectors.toList()); |
||||
|
result = generateTree(collect); |
||||
|
}else{ |
||||
|
List<ExpenseType> collect = expenseTypes.stream().filter(expenseType -> "0".equals(expenseType.getIsDel())).collect(Collectors.toList()); |
||||
|
result = generateTree(collect); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return RestResponse.success(result); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse selectList3(Map<String, Object> params) { |
||||
|
MtList mtList = mtListMapper.selectByReqId(params.get("reqId").toString()); |
||||
|
List<ExpenseType> expenseTypes = expenseTypeMapper.list2(new ExpenseType() {{ |
||||
|
setPolicyId(mtList.getPolicyId()); |
||||
|
//增加提示字段 2022/7/27 根据登录者的LANGUAGE_TYPE进行判断
|
||||
|
setUserId(Integer.valueOf(String.valueOf(RequestSecurityPolicy.getUserId()))); |
||||
|
}}); |
||||
|
log.info("expenseTypes.size()===={}",expenseTypes.size()); |
||||
|
List<ExpenseType> result = new ArrayList<>(); |
||||
|
String consumeType = params.get("consumeType").toString(); |
||||
|
String ticketType = params.get("ticketType").toString(); |
||||
|
TicketType ticketType1 = ticketTypeMapper.selectByName(ticketType); |
||||
|
if (ticketType1 != null) { |
||||
|
Preferences preferences3 = preferencesMapper.selectByTicketTypeAndConsumeType(ticketType1.getId(), consumeType); |
||||
|
if (preferences3 != null) { |
||||
|
List<String> exTypes = Arrays.stream(preferences3.getExpenseTypes().split(",")).collect(Collectors.toList()); |
||||
|
List<ExpenseType> collect = expenseTypes.stream().filter(expenseType -> expenseType.getPid().equals(0) || |
||||
|
exTypes.contains(String.valueOf(expenseType.getId()))).collect(Collectors.toList()); |
||||
|
generateTree(collect); |
||||
|
for (ExpenseType c : collect) { |
||||
|
if (!c.getSubs().isEmpty()) { |
||||
|
result.add(c); |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
Preferences preferences = preferencesMapper.selectByTicketTypeAndNullConsumeType(ticketType1.getId()); |
||||
|
if (preferences != null && StringUtil.isNotEmpty(preferences.getExpenseTypes())) { |
||||
|
List<String> exTypes = Arrays.stream(preferences.getExpenseTypes().split(",")).collect(Collectors.toList()); |
||||
|
List<ExpenseType> collect = expenseTypes.stream().filter(expenseType -> expenseType.getPid().equals(0) || |
||||
|
exTypes.contains(String.valueOf(expenseType.getId()))).collect(Collectors.toList()); |
||||
|
generateTree(collect); |
||||
|
for (ExpenseType c : collect) { |
||||
|
if (!c.getSubs().isEmpty()) { |
||||
|
result.add(c); |
||||
|
} |
||||
|
} |
||||
|
} else if (preferences == null && StringUtil.isNotEmpty(consumeType)) { |
||||
|
Preferences preferences1 = preferencesMapper.selectByConsumeTypeAndNullTicketType(consumeType); |
||||
|
if (preferences1 != null && StringUtil.isNotEmpty(preferences1.getExpenseTypes())) { |
||||
|
List<String> exTypes = Arrays.stream(preferences1.getExpenseTypes().split(",")).collect(Collectors.toList()); |
||||
|
List<ExpenseType> collect = expenseTypes.stream().filter(expenseType -> expenseType.getPid().equals(0) || |
||||
|
exTypes.contains(String.valueOf(expenseType.getId()))).collect(Collectors.toList()); |
||||
|
generateTree(collect); |
||||
|
for (ExpenseType c : collect) { |
||||
|
if (!c.getSubs().isEmpty()) { |
||||
|
result.add(c); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (result.isEmpty() && ticketType1.getId() != 48) { |
||||
|
if(ticketType1.getId() == 47 || ticketType1.getId() == 301){ |
||||
|
List<ExpenseType> collect = expenseTypes.stream().filter(expenseType -> "0".equals(expenseType.getExt01())).collect(Collectors.toList()); |
||||
|
result = generateTree(collect); |
||||
|
}else{ |
||||
|
List<ExpenseType> collect = expenseTypes.stream().filter(expenseType -> "0".equals(expenseType.getIsDel())).collect(Collectors.toList()); |
||||
|
result = generateTree(collect); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return RestResponse.success(result); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse selectExtraFields(Integer id) { |
||||
|
List<ExpenseTypeActive> expenseTypeActives1 = expenseTypeActiveMapper.selectExListByIdAndKind(id, 2, null); |
||||
|
String otherFields = JsonUtil.toString(expenseTypeActives1); |
||||
|
return RestResponse.success(otherFields); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<ExpenseType> generateTree(List<ExpenseType> expenseTypeList) { |
||||
|
List<ExpenseType> orgList = new ArrayList<>(); |
||||
|
for (ExpenseType sysMenu : expenseTypeList) { |
||||
|
if (sysMenu.getPid().equals(0)) { |
||||
|
orgList.add(sysMenu); |
||||
|
addSubs(sysMenu, expenseTypeList); |
||||
|
} |
||||
|
} |
||||
|
return orgList; |
||||
|
} |
||||
|
|
||||
|
private ExpenseType addSubs(ExpenseType org, List<ExpenseType> list) { |
||||
|
for (ExpenseType sysOrg : list) { |
||||
|
if (org.getId().equals(sysOrg.getPid())) { |
||||
|
org.getSubs().add(addSubs(sysOrg, list)); |
||||
|
} |
||||
|
} |
||||
|
return org; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,214 @@ |
|||||
|
package com.cmsen.ticket.application.service.impl; |
||||
|
|
||||
|
import cn.hutool.core.io.IoUtil; |
||||
|
import com.alibaba.excel.EasyExcel; |
||||
|
import com.alibaba.excel.support.ExcelTypeEnum; |
||||
|
import com.cmsen.common.exception.ServiceException; |
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.common.util.FileMime; |
||||
|
import com.cmsen.common.util.StringUtil; |
||||
|
import com.cmsen.ticket.application.service.ExpenseUseService; |
||||
|
import com.cmsen.ticket.domain.entity.ExpenseUse; |
||||
|
import com.cmsen.ticket.domain.entity.User; |
||||
|
import com.cmsen.ticket.domain.entity.VerifiedUser; |
||||
|
import com.cmsen.ticket.domain.mapper.ExpenseUseMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.UserMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.VerifiedUserMapper; |
||||
|
import com.cmsenframework.security.RequestSecurityPolicy; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import javax.servlet.ServletOutputStream; |
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* (ExpenseUse)表服务实现类 |
||||
|
* |
||||
|
* @author ran hao yu |
||||
|
* @since 2020-08-20 17:44:52 |
||||
|
*/ |
||||
|
@Service("expenseUseService") |
||||
|
public class ExpenseUseServiceImpl implements ExpenseUseService { |
||||
|
@Resource |
||||
|
private ExpenseUseMapper expenseUseDao; |
||||
|
|
||||
|
@Resource |
||||
|
private VerifiedUserMapper verifiedUserMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private UserMapper userMapper; |
||||
|
|
||||
|
/** |
||||
|
* 通过ID查询单条数据 |
||||
|
* |
||||
|
* @param id 主键 |
||||
|
* @return 实例对象 |
||||
|
*/ |
||||
|
@Override |
||||
|
public ExpenseUse queryById(Integer id) { |
||||
|
return this.expenseUseDao.queryById(id); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询多条数据 |
||||
|
* |
||||
|
* @return 对象列表 |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<ExpenseUse> queryAllByLimit() { |
||||
|
return this.expenseUseDao.queryAllByLimit(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse queryAll(ExpenseUse expenseUse, HttpServletRequest request) { |
||||
|
User user = userMapper.selectByUser(new User() {{ |
||||
|
setUserId((int) RequestSecurityPolicy.getUserId()); |
||||
|
}}); |
||||
|
expenseUse.setClientId(user.getClient()); |
||||
|
List<ExpenseUse> expenseUses = expenseUseDao.queryAll(expenseUse); |
||||
|
VerifiedUser verifiedUser = verifiedUserMapper.checkByTel(user.getTel()); |
||||
|
List<ExpenseUse> indexes = new ArrayList<>(); |
||||
|
if (StringUtil.isNotEmpty(verifiedUser.getGroup())) { |
||||
|
for (ExpenseUse eu : expenseUses) { |
||||
|
if (StringUtil.isNotEmpty(eu.getGroups())) { |
||||
|
List<String> collect = Arrays.stream(eu.getGroups().split(";")).collect(Collectors.toList()); |
||||
|
if (collect.contains(verifiedUser.getGroup())) { |
||||
|
indexes.add(eu); |
||||
|
} |
||||
|
} else { |
||||
|
indexes.add(eu); |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
indexes.addAll(expenseUses); |
||||
|
} |
||||
|
return RestResponse.success(indexes); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse queryAllUpdate(ExpenseUse expenseUse, HttpServletRequest request) { |
||||
|
User user = userMapper.selectByUser(new User() {{ |
||||
|
setUserId((int) RequestSecurityPolicy.getUserId()); |
||||
|
}}); |
||||
|
expenseUse.setClientId(user.getClient()); |
||||
|
List<ExpenseUse> expenseUses = expenseUseDao.queryAll(expenseUse); |
||||
|
|
||||
|
List<ExpenseUse> indexes = new ArrayList<>(); |
||||
|
indexes.addAll(expenseUses); |
||||
|
|
||||
|
return RestResponse.success(indexes); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增数据 |
||||
|
* |
||||
|
* @param expenseUse 实例对象 |
||||
|
* @return 实例对象 |
||||
|
*/ |
||||
|
public RestResponse insert(ExpenseUse expenseUse) { |
||||
|
try { |
||||
|
expenseUse.setIsDel("0"); |
||||
|
expenseUse.setClientId(1); |
||||
|
this.expenseUseDao.insert(expenseUse); |
||||
|
return RestResponse.success("添加成功"); |
||||
|
} catch (ServiceException e) { |
||||
|
throw new ServiceException(e); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改数据 |
||||
|
* |
||||
|
* @param expenseUse 实例对象 |
||||
|
* @return 实例对象 |
||||
|
*/ |
||||
|
@Override |
||||
|
public ExpenseUse update(ExpenseUse expenseUse) { |
||||
|
this.expenseUseDao.update(expenseUse); |
||||
|
return this.queryById(expenseUse.getId()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 通过主键删除数据 |
||||
|
* |
||||
|
* @param id 主键 |
||||
|
* @return 是否成功 |
||||
|
*/ |
||||
|
@Override |
||||
|
public boolean deleteById(Integer id) { |
||||
|
return this.expenseUseDao.deleteById(id) > 0; |
||||
|
} |
||||
|
|
||||
|
public int insertBatch(List<ExpenseUse> list) { |
||||
|
return expenseUseDao.insertBatch(list); |
||||
|
} |
||||
|
|
||||
|
public int updateBatch(List<ExpenseUse> list) { |
||||
|
return expenseUseDao.updateBatch(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 启用 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public RestResponse active(Integer id) { |
||||
|
try { |
||||
|
ExpenseUse expenseUse = queryById(id); |
||||
|
if (expenseUse == null) { |
||||
|
throw new ServiceException("id无效", 0001); |
||||
|
} |
||||
|
expenseUseDao.active(id); |
||||
|
return RestResponse.success(); |
||||
|
} catch (ServiceException e) { |
||||
|
throw new ServiceException(e); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse export(HttpServletResponse response) { |
||||
|
response.setContentType(FileMime.XLSX.getMimeType()); |
||||
|
response.setHeader("Content-Disposition", "attachment;filename=report.xlsx"); |
||||
|
ServletOutputStream out = null; |
||||
|
try { |
||||
|
out = response.getOutputStream(); |
||||
|
List<ExpenseUse> expenseUses = expenseUseDao.queryAllByLimit(); |
||||
|
EasyExcel.write(out).excelType(ExcelTypeEnum.XLSX) |
||||
|
.sheet(0, "费控政策") |
||||
|
.head(ExpenseUse.class) |
||||
|
.doWrite(expenseUses); |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
} finally { |
||||
|
IoUtil.close(out); |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 停用 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public RestResponse clock(Integer id) { |
||||
|
try { |
||||
|
ExpenseUse expenseUse = queryById(id); |
||||
|
if (expenseUse == null) { |
||||
|
throw new ServiceException("id无效", 0001); |
||||
|
} |
||||
|
expenseUseDao.clock(id); |
||||
|
return RestResponse.success(); |
||||
|
} catch (ServiceException e) { |
||||
|
throw new ServiceException(e); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
@ -0,0 +1,464 @@ |
|||||
|
package com.cmsen.ticket.application.service.impl; |
||||
|
|
||||
|
import cn.hutool.core.date.DateUtil; |
||||
|
import cn.hutool.json.JSONUtil; |
||||
|
import com.alibaba.fastjson.JSON; |
||||
|
import com.alibaba.fastjson.JSONArray; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.cmsen.common.util.DateFormat; |
||||
|
import com.cmsen.common.util.StringUtil; |
||||
|
import com.cmsen.ticket.application.service.*; |
||||
|
import com.cmsen.ticket.application.util.ExpFormConvertUtil; |
||||
|
import com.cmsen.ticket.application.util.FormFillUtil; |
||||
|
import com.cmsen.ticket.common.AjaxJson; |
||||
|
import com.cmsen.ticket.domain.entity.*; |
||||
|
import com.cmsen.ticket.domain.entity.hly.FormItem; |
||||
|
import com.cmsen.ticket.domain.entity.hly.ReportReceive; |
||||
|
import com.cmsen.ticket.domain.entity.manager.SysConfig; |
||||
|
import com.cmsen.ticket.domain.entity.request.RequestResponse; |
||||
|
import com.cmsen.ticket.domain.mapper.*; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.SysConfigMapper; |
||||
|
import com.cmsen.ticket.domain.util.FileImgUtil; |
||||
|
import com.cmsen.ticket.domain.util.Pdf2JpgHelper; |
||||
|
import com.cmsen.ticket.domain.util.hly.DownloadPicFromUrlReport; |
||||
|
import com.cmsen.ticket.domain.util.hly.SSLClientReport; |
||||
|
import com.cmsen.ticket.domain.vo.EntryImageVO; |
||||
|
import com.cmsen.ticket.meeting.MeetInterface; |
||||
|
import com.cmsenframework.security.RequestSecurityPolicy; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.http.impl.client.CloseableHttpClient; |
||||
|
import org.springframework.beans.factory.annotation.Qualifier; |
||||
|
import org.springframework.beans.factory.annotation.Value; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.io.File; |
||||
|
import java.io.FileInputStream; |
||||
|
import java.io.IOException; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.text.ParseException; |
||||
|
import java.text.SimpleDateFormat; |
||||
|
import java.util.*; |
||||
|
import java.util.concurrent.Executor; |
||||
|
|
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class HLYInterfaceServiceImpl implements HLYInterfaceService { |
||||
|
|
||||
|
@Resource |
||||
|
@Qualifier(value = "SystemPool") |
||||
|
private Executor systemPool; |
||||
|
@Value("${file.filepath}") |
||||
|
private String filePath; |
||||
|
@Value("${file.domainName}") |
||||
|
private String domainName; |
||||
|
@Value("${server.servlet.context-path}") |
||||
|
private String contextPath; |
||||
|
@Value("${img.img-virtual-Path}") |
||||
|
private String imgVirtualPath; |
||||
|
@Value("${manager-file.uploadPath}") |
||||
|
private String uploadPath; |
||||
|
@Resource |
||||
|
private UserMapper userMapper; |
||||
|
@Resource |
||||
|
private ExpenseReportsMapper expenseReportsMapper; |
||||
|
@Resource |
||||
|
private InvoiceMapper invoiceMapper; |
||||
|
@Resource |
||||
|
private FilesMapper filesMapper; |
||||
|
@Resource |
||||
|
private InvoiceFilesLogMapper invoiceFilesLogMapper; |
||||
|
@Resource |
||||
|
private InvoiceService invoiceService; |
||||
|
@Resource |
||||
|
private ExpenseTypeActiveMapper expenseTypeActiveMapper; |
||||
|
@Resource |
||||
|
private ExpenseReportsService expenseReportsService; |
||||
|
@Resource |
||||
|
private ExpenseTypeMapper expenseTypeMapper; |
||||
|
@Resource |
||||
|
private SysConfigMapper sysConfigMapper; |
||||
|
@Resource |
||||
|
private ValueSetMapper valueSetMapper; |
||||
|
@Resource |
||||
|
private InvoiceLogMapper invoiceLogMapper; |
||||
|
|
||||
|
private final static String policyFieldsStrs = "[{\"id\":30,\"value\":\"ou1\",\"valueName\":\"ou1\",\"pid\":\"\",\"isDel\":\"\",\"selectName\":\"ou1\",\"category\":\"\",\"required\":1,\"sort\":11,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":3,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext01\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]},{\"id\":31,\"value\":\"ou2\",\"valueName\":\"ou2\",\"pid\":\"\",\"isDel\":\"\",\"selectName\":\"ou2\",\"category\":\"\",\"required\":1,\"sort\":12,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":3,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext02\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]},{\"id\":32,\"value\":\"ou3\",\"valueName\":\"ou3\",\"pid\":\"\",\"isDel\":\"\",\"selectName\":\"ou3\",\"category\":\"\",\"required\":1,\"sort\":13,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":3,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext03\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]},{\"id\":33,\"value\":\"ou4\",\"valueName\":\"ou4\",\"pid\":\"\",\"isDel\":\"\",\"selectName\":\"ou4\",\"category\":\"\",\"required\":1,\"sort\":14,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":3,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext04\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]},{\"id\":34,\"value\":\"ou5\",\"valueName\":\"ou5\",\"pid\":\"\",\"isDel\":\"\",\"selectName\":\"ou5\",\"category\":\"\",\"required\":1,\"sort\":15,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":3,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext05\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]},{\"id\":35,\"value\":\"WBS\",\"valueName\":\"WBS\",\"pid\":\"\",\"isDel\":\"\",\"selectName\":\"WBS\",\"category\":\"\",\"required\":1,\"sort\":20,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":3,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext06\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]},{\"id\":36,\"value\":\"费用期间\",\"valueName\":\"费用期间\",\"pid\":\"\",\"isDel\":\"\",\"selectName\":\"expperiod\",\"category\":\"expperiod1\",\"required\":1,\"sort\":25,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":3,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext07\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]},{\"id\":37,\"value\":\"业务描述\",\"valueName\":\"业务描述\",\"pid\":\"\",\"isDel\":\"\",\"selectName\":\"biz\",\"category\":\"\",\"required\":1,\"sort\":30,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":3,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext08\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]},{\"id\":38,\"value\":\"备注\",\"valueName\":\"备注\",\"pid\":\"\",\"isDel\":\"\",\"selectName\":\"hbz\",\"category\":\"\",\"required\":1,\"sort\":35,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":3,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext09\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]}]"; |
||||
|
private final static String expenseFieldsStrs = "[{\"id\":100,\"value\":\"ext31\",\"valueName\":\"iou1\",\"pid\":\"11\",\"isDel\":\"\",\"selectName\":\"iou1\",\"category\":\"\",\"required\":1,\"sort\":11,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":2,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext01\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]},{\"id\":101,\"value\":\"ext32\",\"valueName\":\"iou2\",\"pid\":\"11\",\"isDel\":\"\",\"selectName\":\"iou2\",\"category\":\"\",\"required\":1,\"sort\":12,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":2,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext02\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]},{\"id\":110,\"value\":\"ext33\",\"valueName\":\"iou3\",\"pid\":\"11\",\"isDel\":\"\",\"selectName\":\"iou3\",\"category\":\"\",\"required\":1,\"sort\":13,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":2,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext03\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]},{\"id\":111,\"value\":\"ext34\",\"valueName\":\"iou4\",\"pid\":\"11\",\"isDel\":\"\",\"selectName\":\"iou4\",\"category\":\"\",\"required\":1,\"sort\":14,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":2,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext04\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]},{\"id\":112,\"value\":\"ext35\",\"valueName\":\"iou5\",\"pid\":\"11\",\"isDel\":\"\",\"selectName\":\"iou5\",\"category\":\"\",\"required\":1,\"sort\":15,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":2,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext05\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]},{\"id\":113,\"value\":\"ext36\",\"valueName\":\"iou6\",\"pid\":\"11\",\"isDel\":\"\",\"selectName\":\"iou6\",\"category\":\"\",\"required\":1,\"sort\":16,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":2,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext06\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]},{\"id\":114,\"value\":\"EventCode\",\"valueName\":\"EventCode\",\"pid\":\"11\",\"isDel\":\"\",\"selectName\":\"eventcode\",\"category\":\"\",\"required\":1,\"sort\":17,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":2,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext17\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]},{\"id\":115,\"value\":\"EventFull\",\"valueName\":\"EventFull\",\"pid\":\"11\",\"isDel\":\"\",\"selectName\":\"eventfull\",\"category\":\"\",\"required\":1,\"sort\":18,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":2,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext13\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]}]"; |
||||
|
private final static String expenseFieldsStrs2 = "[{\"id\":100,\"value\":\"ext31\",\"valueName\":\"iou1\",\"pid\":\"11\",\"isDel\":\"\",\"selectName\":\"iou1\",\"category\":\"\",\"required\":1,\"sort\":11,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":2,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext01\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]},{\"id\":101,\"value\":\"ext32\",\"valueName\":\"iou2\",\"pid\":\"11\",\"isDel\":\"\",\"selectName\":\"iou2\",\"category\":\"\",\"required\":1,\"sort\":12,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":2,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext02\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]},{\"id\":110,\"value\":\"ext33\",\"valueName\":\"iou3\",\"pid\":\"11\",\"isDel\":\"\",\"selectName\":\"iou3\",\"category\":\"\",\"required\":1,\"sort\":13,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":2,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext03\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]},{\"id\":111,\"value\":\"ext34\",\"valueName\":\"iou4\",\"pid\":\"11\",\"isDel\":\"\",\"selectName\":\"iou4\",\"category\":\"\",\"required\":1,\"sort\":14,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":2,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext04\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]},{\"id\":112,\"value\":\"ext35\",\"valueName\":\"iou5\",\"pid\":\"11\",\"isDel\":\"\",\"selectName\":\"iou5\",\"category\":\"\",\"required\":1,\"sort\":15,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":2,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext05\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]},{\"id\":113,\"value\":\"ext36\",\"valueName\":\"iou6\",\"pid\":\"11\",\"isDel\":\"\",\"selectName\":\"iou6\",\"category\":\"\",\"required\":1,\"sort\":16,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":2,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext06\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]},{\"id\":114,\"value\":\"EventCode\",\"valueName\":\"EventCode\",\"pid\":\"11\",\"isDel\":\"\",\"selectName\":\"eventcode\",\"category\":\"\",\"required\":1,\"sort\":17,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":2,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext17\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]},{\"id\":115,\"value\":\"EventFull\",\"valueName\":\"EventFull\",\"pid\":\"11\",\"isDel\":\"\",\"selectName\":\"eventfull\",\"category\":\"\",\"required\":1,\"sort\":18,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":2,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext13\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]},{\"id\":116,\"value\":\"SubType\",\"valueName\":\"SubType\",\"pid\":\"11\",\"isDel\":\"\",\"selectName\":\"subtype\",\"category\":\"\",\"required\":1,\"sort\":19,\"type\":\"input\",\"defaultValue\":\"\",\"kind\":2,\"exPid\":0,\"childId\":\"\",\"child\":[],\"subs\":[],\"binding\":\"Ext10\",\"targetId\":\"\",\"editAble\":true,\"pickArr\":[],\"pickerFields\":[],\"childField\":[],\"mutiIndex\":[0,0],\"mutiArray\":[[],[]]}]"; |
||||
|
|
||||
|
@Transactional |
||||
|
@Override |
||||
|
public AjaxJson saveDatas(String resBody) { |
||||
|
log.info("HLYInterface===saveDatas=={}",resBody); |
||||
|
/*JSONObject body = JSONObject.parseObject(resBody); |
||||
|
String data = body.getString("data");*/ |
||||
|
ReportReceive reportReceive = JSONUtil.toBean(resBody, ReportReceive.class); |
||||
|
if(reportReceive != null){ |
||||
|
if(StringUtil.isBlank(reportReceive.getExt10()) || reportReceive.getExt10() == null){ |
||||
|
return AjaxJson.error("单据号为空"); |
||||
|
} |
||||
|
//检查改报告是否已经存在,存在则不处理
|
||||
|
ExpenseReports bean = expenseReportsMapper.selectByInvoiceId(reportReceive.getExt10()); |
||||
|
if(bean == null){ |
||||
|
|
||||
|
//进行数据的处理
|
||||
|
ExpenseReports expenseReports = new ExpenseReports(); |
||||
|
expenseReports.setOwnerId(reportReceive.getLoginId()); |
||||
|
expenseReports.setExpenseReprotsName(reportReceive.getExt09()); |
||||
|
expenseReports.setInvoiceId(reportReceive.getExt10()); |
||||
|
expenseReports.setExt01(reportReceive.getExt41()); |
||||
|
expenseReports.setExpenseCreatetime(new SimpleDateFormat("yyyy-MM-dd").format(new Date())); |
||||
|
expenseReports.setExpenseUse("Chiesi"); |
||||
|
expenseReports.setReimburseTotalMoney(new BigDecimal("0")); |
||||
|
expenseReports.setExpenseReimburseTotal(0); |
||||
|
expenseReports.setIsDel("0"); |
||||
|
User user = userMapper.selectByEmail(reportReceive.getLoginId()); |
||||
|
if(user != null){ |
||||
|
expenseReports.setOpenId(user.getOpenid()); |
||||
|
expenseReports.setUserId(user.getUserId()); |
||||
|
} |
||||
|
|
||||
|
expenseReports.setCreateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); |
||||
|
expenseReports.setExpenseReportStatus(0); |
||||
|
expenseReports.setIsSend(0); |
||||
|
expenseReports.setPolicyId(1); |
||||
|
expenseReports.setSource("APP"); |
||||
|
expenseReports.setOtherFields("[]"); |
||||
|
expenseReports.setExt02("0");//记录是否全部推送完成:0-未完成,1全部推送完成
|
||||
|
expenseReports.setExt03("0");//推送concur状态:0-未完成,1-全部推送完成
|
||||
|
|
||||
|
//处理policyFields的值
|
||||
|
List<FormItem> itemList = JSON.parseArray(policyFieldsStrs, FormItem.class); |
||||
|
|
||||
|
//重构数据
|
||||
|
/*ValueSet valueSet = valueSetMapper.selectByName("expperiod1",reportReceive.getExt18()); |
||||
|
if(valueSet != null){ |
||||
|
reportReceive.setExt18(valueSet.getValueCode()); |
||||
|
}*/ |
||||
|
reportReceive.setExt19(reportReceive.getExt19()+"_"+reportReceive.getExt20()); |
||||
|
reportReceive.setExt20(""); |
||||
|
String resultJson = FormFillUtil.fillDefaultValue(itemList, reportReceive); |
||||
|
expenseReports.setPolicyFields(resultJson); |
||||
|
expenseReports.setUpdateTime(new Date()); |
||||
|
|
||||
|
int insert = expenseReportsMapper.insert(expenseReports); |
||||
|
|
||||
|
log.info("HLYInterface===expenseReports==保存=={}",insert); |
||||
|
|
||||
|
if(insert > 0) { |
||||
|
systemPool.execute(() ->{ |
||||
|
try { |
||||
|
log.info("HLYInterface===reportReceive.getData()个数===={}",reportReceive.getData().size()); |
||||
|
|
||||
|
for (ReportReceive.ReportReceiveLine receive : reportReceive.getData()) { |
||||
|
|
||||
|
log.info("HLYInterface===receive===={}",receive); |
||||
|
|
||||
|
List<String> filesPath = new ArrayList<>(); |
||||
|
List<String> filesType = new ArrayList<>(); |
||||
|
|
||||
|
String id = receive.getId(); |
||||
|
if(null == id){ |
||||
|
id = UUID.randomUUID().toString(); |
||||
|
} |
||||
|
|
||||
|
//1.发票pdf先下载,防止过期
|
||||
|
String imgViewPath = ""; |
||||
|
String pdfUrl = receive.getExt01(); |
||||
|
if(StringUtil.isNotBlank(pdfUrl)){ |
||||
|
imgViewPath = fileDownLoad(pdfUrl,id); |
||||
|
if(null != imgViewPath){ |
||||
|
filesPath.add(imgViewPath); |
||||
|
filesType.add("Y"); |
||||
|
} |
||||
|
} |
||||
|
log.info("HLYInterface===下载图片===={}",imgViewPath); |
||||
|
|
||||
|
//2.发票附件pdf或图片类型 可多个;隔开
|
||||
|
String fjUrl = receive.getExt03(); |
||||
|
if(StringUtil.isNotEmpty(fjUrl)){ |
||||
|
String[] fjUrls = fjUrl.split(";"); |
||||
|
String fjViewPath = ""; |
||||
|
for (String fj : fjUrls) { |
||||
|
fjViewPath = fileDownLoad(fj,id); |
||||
|
if(null != fjViewPath){ |
||||
|
filesPath.add(fjViewPath); |
||||
|
filesType.add("Y"); |
||||
|
|
||||
|
//添加水印
|
||||
|
String newViewPath = invoiceService.addWatermark(fjViewPath, "0"); |
||||
|
filesPath.add(newViewPath); |
||||
|
filesType.add("Y"); |
||||
|
} |
||||
|
log.info("HLYInterface===下载附件===={}",fjViewPath); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
Invoice invoice = new Invoice(); |
||||
|
|
||||
|
if(StringUtil.isNotBlank(receive.getFYRQ())){ |
||||
|
invoice.setTradeDate(receive.getFYRQ()); |
||||
|
} |
||||
|
if(StringUtil.isNotBlank(receive.getExt06())){ |
||||
|
invoice.setInvoiceDate(receive.getExt06()); |
||||
|
}else{ |
||||
|
invoice.setInvoiceDate(invoice.getTradeDate()); |
||||
|
} |
||||
|
|
||||
|
//保存记录到invoice表
|
||||
|
invoice.setInvoiceId(id); |
||||
|
ExpenseType expenseType = new ExpenseType(); |
||||
|
expenseType.setCode(receive.getFYDL()); |
||||
|
expenseType.setPolicyId(1); |
||||
|
ExpenseType expenseType1 = expenseTypeMapper.selectByCode(expenseType); |
||||
|
if(expenseType1 != null){ |
||||
|
invoice.setExpenseTypeId(expenseType1.getId()); |
||||
|
} |
||||
|
|
||||
|
invoice.setCity(receive.getDD()); |
||||
|
invoice.setExpenseType(receive.getFYXL()); |
||||
|
invoice.setReimburseMoney(receive.getBSJE() != null ? new BigDecimal(receive.getBSJE()) : new BigDecimal(0)); |
||||
|
|
||||
|
invoice.setCurrency(receive.getCurrency()); |
||||
|
invoice.setSupplier(receive.getGYS()); |
||||
|
invoice.setInvoiceStatus(receive.getType()); |
||||
|
invoice.setTaxRate(receive.getTax()); |
||||
|
invoice.setImgPath(imgViewPath); |
||||
|
invoice.setPaymentType(receive.getExt02()); |
||||
|
invoice.setInvoiceCode(receive.getExt04()); |
||||
|
invoice.setInvoiceNum(receive.getExt05()); |
||||
|
invoice.setInvoiceType(StringUtil.isNotBlank(receive.getExt07()) ? receive.getExt07() : "定额发票"); |
||||
|
invoice.setSecondInvoiceId(receive.getExt27()); |
||||
|
invoice.setExpenseReprotsName(expenseReports.getExpenseReprotsName()); |
||||
|
invoice.setInvoiceMoney(invoice.getReimburseMoney()); |
||||
|
invoice.setExpenseReprotsId(expenseReports.getExpenseReprotsId()); |
||||
|
invoice.setIsDel("0"); |
||||
|
invoice.setIsSend(1); |
||||
|
if(user != null){ |
||||
|
invoice.setOpenId(user.getOpenid()); |
||||
|
invoice.setUserId(user.getUserId()); |
||||
|
} |
||||
|
invoice.setCreateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); |
||||
|
invoice.setClient(1); |
||||
|
invoice.setNeedValid(false); |
||||
|
invoice.setValidStatus(true); |
||||
|
invoice.setValidCount(0); |
||||
|
invoice.setValidDayCount(0); |
||||
|
invoice.setLoginId(expenseReports.getOwnerId()); |
||||
|
invoice.setOtherFields("[]"); |
||||
|
|
||||
|
//重构数据
|
||||
|
if(StringUtil.isNotBlank(receive.getExt31())){ |
||||
|
receive.setExt31(getExtCode(receive.getExt31(), id)); |
||||
|
} |
||||
|
if(StringUtil.isNotBlank(receive.getExt32())){ |
||||
|
receive.setExt32(getExtCode(receive.getExt32(), id)); |
||||
|
} |
||||
|
if(StringUtil.isNotBlank(receive.getExt33())){ |
||||
|
receive.setExt33(getExtCode(receive.getExt33(), id)); |
||||
|
} |
||||
|
if(StringUtil.isNotBlank(receive.getExt34())){ |
||||
|
receive.setExt34(getExtCode(receive.getExt34(), id)); |
||||
|
} |
||||
|
if(StringUtil.isNotBlank(receive.getExt35())){ |
||||
|
receive.setExt35(getExtCode(receive.getExt35(), id)); |
||||
|
} |
||||
|
if(StringUtil.isNotBlank(receive.getExt36())){ |
||||
|
receive.setExt36(getExtCode(receive.getExt36(), id)); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
//处理expenseFields的值
|
||||
|
//根据expenseTypeId得到扩展字段的内容
|
||||
|
List<ExpenseTypeActive> activeList = expenseTypeActiveMapper.selectList(invoice.getExpenseTypeId()); |
||||
|
String finalJson; |
||||
|
if(StringUtil.isBlank(receive.getExt23())){ |
||||
|
finalJson = ExpFormConvertUtil.processFormJson(expenseFieldsStrs, activeList, receive); |
||||
|
}else{ |
||||
|
finalJson = ExpFormConvertUtil.processFormJson(expenseFieldsStrs2, activeList, receive); |
||||
|
} |
||||
|
invoice.setExpenseFields(finalJson); |
||||
|
|
||||
|
//处理附件合并 invoice_files_log
|
||||
|
//进行图片的压缩
|
||||
|
String pdfViewPath = ""; |
||||
|
if(!filesPath.isEmpty()){ |
||||
|
FileImgUtil.compressFiles(filesPath, filePath); |
||||
|
|
||||
|
InvoiceFilesLog filesLog = new InvoiceFilesLog(){{ |
||||
|
setTableName("invoice,files"); |
||||
|
setMethods("新增"); |
||||
|
setInvoiceId(invoice.getInvoiceId()); |
||||
|
setEntryId(""); |
||||
|
setImagePath(""); |
||||
|
setStatus("0"); |
||||
|
setCreateBy(invoice.getLoginId()); |
||||
|
setCreateDate(new Date()); |
||||
|
}}; |
||||
|
pdfViewPath = addFilesLog(filesPath, filesLog, filesType); |
||||
|
|
||||
|
log.info("HLYInterface===InvoiceFilesLog==保存成功=={}", pdfViewPath); |
||||
|
} |
||||
|
|
||||
|
invoice.setOriginalPath(pdfViewPath); |
||||
|
invoice.setUpdateTime(new Date()); |
||||
|
invoiceMapper.insertSelective(invoice); |
||||
|
|
||||
|
log.info("HLYInterface===invoice==保存成功=="); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
//处理完成,设置expense_report.ext02 = 1
|
||||
|
expenseReportsMapper.updateExt02(expenseReports.getExpenseReprotsId()); |
||||
|
//执行report的更新
|
||||
|
expenseReportsService.updateExpenseReport(expenseReports.getExpenseReprotsId()); |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
throw new RuntimeException(e); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return AjaxJson.success("成功"); |
||||
|
} |
||||
|
|
||||
|
public String getExtCode(String ext07, String id){ |
||||
|
String code = ext07; |
||||
|
ValueSet valueSet = valueSetMapper.selectByExt07("ou", ext07); |
||||
|
if(valueSet != null){ |
||||
|
code = valueSet.getValueCode(); |
||||
|
}else{ |
||||
|
//插入日志
|
||||
|
InvoiceLog invoiceLog = new InvoiceLog(){{ |
||||
|
setInvoiceId(id); |
||||
|
setExt01(ext07); |
||||
|
setExt02("未找到mapping值"); |
||||
|
}}; |
||||
|
invoiceLogMapper.insertSelective(invoiceLog); |
||||
|
} |
||||
|
return code; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public AjaxJson getReportKey(String hlyReportId) { |
||||
|
if(StringUtil.isBlank(hlyReportId) || hlyReportId == null){ |
||||
|
return AjaxJson.error("单据号为空"); |
||||
|
} |
||||
|
|
||||
|
ExpenseReports expenseReports = expenseReportsMapper.selectByInvoiceId(hlyReportId); |
||||
|
if(expenseReports == null){ |
||||
|
return AjaxJson.error("不存在该单据"); |
||||
|
} |
||||
|
|
||||
|
return AjaxJson.success(expenseReports.getReportKey()); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public String addFilesLog(List<String> filesPath, InvoiceFilesLog filesLog, List<String> filesType){ |
||||
|
//将所有的附件合并成一个pdf 2022/10/18
|
||||
|
String folder = Pdf2JpgHelper.generateFolderNoFileSep(filePath); |
||||
|
String pdfFileName = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + |
||||
|
UUID.randomUUID().toString().replace("-", "") + ".pdf"; |
||||
|
String pdfFilePath = filePath + File.separator + folder + File.separator + pdfFileName; |
||||
|
String pdfViewPath = domainName + contextPath + imgVirtualPath + "/" + folder + "/" + pdfFileName; |
||||
|
|
||||
|
String correctFlag = "0";//0-不修色,1-修色
|
||||
|
//获取图片修色开关
|
||||
|
SysConfig sysConfig = sysConfigMapper.selectByCode("CorrectFlag"); |
||||
|
if(sysConfig != null && StringUtil.isNotBlank(sysConfig.getValue())){ |
||||
|
correctFlag = sysConfig.getValue(); |
||||
|
} |
||||
|
log.info("invoiceFilesLog size ==={},pdfViewPath==={}",filesPath.size(),pdfViewPath); |
||||
|
FileImgUtil.toPdf(filesPath, filePath, pdfFilePath, filesType, correctFlag); |
||||
|
|
||||
|
log.info("invoiceFilesLog 插入开始===="); |
||||
|
//附件log插入 2022/10/18
|
||||
|
filesLog.setImagePath(pdfViewPath); |
||||
|
invoiceFilesLogMapper.insertSelective(filesLog); |
||||
|
|
||||
|
log.info("invoiceFilesLog 插入OK===="); |
||||
|
|
||||
|
return pdfViewPath; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public String fileDownLoad(String url,String id){ |
||||
|
log.info("fileDownLoad》》》》》》》》》》》{}》》》》》》{}",url,id); |
||||
|
CloseableHttpClient client = null; |
||||
|
try { |
||||
|
String folder = Pdf2JpgHelper.generateFolder(filePath); |
||||
|
|
||||
|
String newFileName = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + |
||||
|
UUID.randomUUID().toString().replace("-", ""); |
||||
|
String imgFilePath = filePath + "/" + folder + newFileName; |
||||
|
String imgViewPath = domainName + contextPath + imgVirtualPath + "/" + folder + newFileName; |
||||
|
|
||||
|
client = new SSLClientReport(url); |
||||
|
url = url.replace("&", "&"); |
||||
|
|
||||
|
log.info("fileDownLoad》》》》》》》imgFilePath》》》》{}",imgFilePath); |
||||
|
|
||||
|
String fileType = DownloadPicFromUrlReport.httpGetImg(client, url, imgFilePath); |
||||
|
if("error".equals(fileType)){ |
||||
|
fileType = DownloadPicFromUrlReport.httpGetImg(client, url, imgFilePath); |
||||
|
if("error".equals(fileType)){ |
||||
|
fileType = DownloadPicFromUrlReport.httpGetImg(client, url, imgFilePath); |
||||
|
} |
||||
|
} |
||||
|
if(null==fileType){ |
||||
|
log.info("文件格式解析出错》》》》》》》》》》》》》》》》》{}",id); |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
log.info("fileDownLoad》》》》》》》fileType》》》》{}",fileType); |
||||
|
|
||||
|
String imgUrlPath = imgFilePath+"."+fileType; |
||||
|
imgViewPath = imgViewPath+"."+fileType; |
||||
|
//pdf格式,需要转换
|
||||
|
if("pdf".equalsIgnoreCase(fileType)){ |
||||
|
|
||||
|
FileInputStream fileInputStream = null; |
||||
|
fileInputStream = new FileInputStream(imgUrlPath); |
||||
|
|
||||
|
List<List<String>> images = new ArrayList<>(); |
||||
|
|
||||
|
images.addAll(Pdf2JpgHelper.pdfToImages2(fileInputStream, uploadPath, true)); |
||||
|
|
||||
|
String[] imageArr = new String[images.size()]; |
||||
|
int i = 0; |
||||
|
for (List<String> images2 : images) { |
||||
|
String image = images2.get(0).replace("\\", "/"); |
||||
|
imageArr[i++] = uploadPath + image; |
||||
|
} |
||||
|
|
||||
|
String newFileName2 = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + |
||||
|
UUID.randomUUID().toString().replace("-", "") + ".jpg"; |
||||
|
String imgFilePath2 = filePath + "/" + folder + newFileName2; |
||||
|
String imgViewPath2 = domainName + contextPath + imgVirtualPath + "/" + folder + newFileName2; |
||||
|
log.info("fileDownLoad==图片转换=={}=={}=={}=={}",folder,newFileName2,imgFilePath2,imgViewPath2); |
||||
|
FileImgUtil.merge(imageArr, "jpg", imgFilePath2); |
||||
|
|
||||
|
imgViewPath = imgViewPath2; |
||||
|
} |
||||
|
|
||||
|
return imgViewPath; |
||||
|
}catch (Exception e){ |
||||
|
log.error("下载pdf到本地异常:=",e.getMessage()); |
||||
|
e.printStackTrace(); |
||||
|
return null; |
||||
|
}finally { |
||||
|
if (client != null) { |
||||
|
try { |
||||
|
client.close(); |
||||
|
} catch (IOException e) { |
||||
|
log.info("图片PDF下载出错》》》》》》》》》》》》》》》》》{},{}",url,id); |
||||
|
log.info(e.getMessage()); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,76 @@ |
|||||
|
package com.cmsen.ticket.application.service.impl; |
||||
|
|
||||
|
import com.cmsen.common.exception.ServiceException; |
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.common.util.StringUtil; |
||||
|
import com.cmsen.ticket.application.service.ConcurService; |
||||
|
import com.cmsen.ticket.application.service.InvoiceAttendeeService; |
||||
|
import com.cmsen.ticket.domain.entity.InvoiceAttendees; |
||||
|
import com.cmsen.ticket.domain.entity.User; |
||||
|
import com.cmsen.ticket.domain.entity.concur.AddAttendeeDto; |
||||
|
import com.cmsen.ticket.domain.entity.manager.SysConfig; |
||||
|
import com.cmsen.ticket.domain.mapper.InvoiceAttendeesMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.UserMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.SysConfigMapper; |
||||
|
import com.cmsen.ticket.domain.util.PaginationUtil; |
||||
|
import com.cmsenframework.security.RequestSecurityPolicy; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2021/7/27 15:18 |
||||
|
**/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class InvoiceAttendeeServiceImpl implements InvoiceAttendeeService { |
||||
|
|
||||
|
@Resource |
||||
|
private InvoiceAttendeesMapper invoiceAttendeesMapper; |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse selectByInvoiceId(String invoiceId) { |
||||
|
return RestResponse.success(invoiceAttendeesMapper.selectAttendsByInvoiceId(invoiceId)); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Transactional |
||||
|
@Override |
||||
|
public RestResponse delete(Long id) { |
||||
|
try { |
||||
|
int i = invoiceAttendeesMapper.deleteByPrimaryKey(id); |
||||
|
return i > 0 ? RestResponse.success() : RestResponse.failure("删除失败"); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("删除失败"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Transactional |
||||
|
@Override |
||||
|
public RestResponse insert(InvoiceAttendees invoiceAttendees) { |
||||
|
try { |
||||
|
//判断attendeeId是否已经存在
|
||||
|
int checkNum = invoiceAttendeesMapper.checkAttendees(invoiceAttendees.getInvoiceId(), invoiceAttendees.getAttendeeId()); |
||||
|
if(checkNum == 0){ |
||||
|
invoiceAttendees.setCreateDate(new Date()); |
||||
|
invoiceAttendees.setCustom5("1"); |
||||
|
int i = invoiceAttendeesMapper.insert(invoiceAttendees); |
||||
|
return i > 0 ? RestResponse.success() : RestResponse.failure("新增失败"); |
||||
|
}else{ |
||||
|
return RestResponse.success("已存在"); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("新增失败"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,314 @@ |
|||||
|
package com.cmsen.ticket.application.service.impl; |
||||
|
|
||||
|
import com.cmsen.common.exception.ServiceException; |
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.common.util.StringUtil; |
||||
|
import com.cmsen.ticket.application.service.InvoiceItemMileageService; |
||||
|
import com.cmsen.ticket.domain.entity.*; |
||||
|
import com.cmsen.ticket.domain.mapper.*; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.SysConfigMapper; |
||||
|
import com.cmsen.ticket.domain.response.Response; |
||||
|
import com.cmsen.ticket.domain.util.StringUtils; |
||||
|
import com.cmsen.ticket.interfaces.facade.manager.form.SubmitMileageForm; |
||||
|
import com.cmsenframework.security.RequestSecurityPolicy; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.text.SimpleDateFormat; |
||||
|
import java.util.Date; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2021/11/18 14:30 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class InvoiceItemMileageServiceImpl implements InvoiceItemMileageService { |
||||
|
|
||||
|
@Resource |
||||
|
private InvoiceItemMileageMapper invoiceItemMileageMapper; |
||||
|
|
||||
|
|
||||
|
@Resource |
||||
|
private InvoiceItemMileageConfigMapper invoiceItemMileageConfigMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private BandConfigMapper bandConfigMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private MileageMapper mileageMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private MileageDetailMapper mileageDetailMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private ExpenseTypeMapper expenseTypeMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private SysConfigMapper sysConfigMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private UserMapper userMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private VerifiedUserMapper verifiedUserMapper; |
||||
|
|
||||
|
@Override |
||||
|
public Response<List<InvoiceItemMileage>> list(String invoiceId) { |
||||
|
List<InvoiceItemMileage> list = invoiceItemMileageMapper.listByInvoiceId(invoiceId); |
||||
|
|
||||
|
//导入的里程是否可以修改
|
||||
|
String message = ""; |
||||
|
String ext02 = "N";//控制是否可以手工添加里程
|
||||
|
String ext03 = "N";//控制是否可以编辑导入的里程
|
||||
|
int userId = (int) RequestSecurityPolicy.getUserId(); |
||||
|
BandConfig mileage = bandConfigMapper.selectByUserId(userId); |
||||
|
if(mileage != null && StringUtil.isNotBlank(mileage.getExt02())){ |
||||
|
ext02 = mileage.getExt02(); |
||||
|
} |
||||
|
if(mileage != null && StringUtil.isNotBlank(mileage.getExt03())){ |
||||
|
ext03 = mileage.getExt03(); |
||||
|
} |
||||
|
message = ext02+","+ext03; |
||||
|
return Response.success(200, message, list); |
||||
|
} |
||||
|
|
||||
|
@Transactional |
||||
|
@Override |
||||
|
public Response<Object> create(InvoiceItemMileage mileage) { |
||||
|
try { |
||||
|
mileage.setRecMileage(BigDecimal.valueOf(0)); |
||||
|
mileage.setCustom5("0");//手工新增 2022/9/22
|
||||
|
mileage.setCreateTime(new Date()); |
||||
|
int i = invoiceItemMileageMapper.insertSelective(mileage); |
||||
|
if (i > 0) { |
||||
|
return Response.success(); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("Unknown Error"); |
||||
|
} |
||||
|
return Response.failure("Created Failure"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Response<Object> update(InvoiceItemMileage mileage) { |
||||
|
try { |
||||
|
int i = invoiceItemMileageMapper.updateByPrimaryKeySelective(mileage); |
||||
|
if (i > 0) { |
||||
|
return Response.success(); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("Unknown Error"); |
||||
|
} |
||||
|
return Response.failure("Updated Failure"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Response<Object> delete(Long id) { |
||||
|
try { |
||||
|
InvoiceItemMileage invoiceItemMileage = invoiceItemMileageMapper.selectByPrimaryKey(id); |
||||
|
if (invoiceItemMileage != null && StringUtils.isInteger(invoiceItemMileage.getCustom4())) { |
||||
|
Mileage mileage = mileageMapper.selectByPrimaryKey(Long.valueOf(invoiceItemMileage.getCustom4())); |
||||
|
if (mileage != null && mileage.getUsedStatus()) { |
||||
|
mileage.setUsedStatus(false); |
||||
|
mileageMapper.updateByPrimaryKeySelective(mileage); |
||||
|
} |
||||
|
} |
||||
|
invoiceItemMileageMapper.deleteByPrimaryKey(id); |
||||
|
return Response.success(); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("Unknown Error"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Response<BigDecimal> calculate(double mileage) { |
||||
|
int userId = (int) RequestSecurityPolicy.getUserId(); |
||||
|
String level = ""; |
||||
|
// String level = t10EmployeeMapper.selectLevelByUserId(userId);
|
||||
|
// InvoiceItemMileageConfig config = invoiceItemMileageConfigMapper.selectByCode(level);
|
||||
|
BandConfig config = bandConfigMapper.selectByCode(level); |
||||
|
if (config == null) { |
||||
|
config = bandConfigMapper.selectByCode("Default"); |
||||
|
} |
||||
|
BigDecimal res = new BigDecimal(mileage).multiply(new BigDecimal(config.getRate())).setScale(2, BigDecimal.ROUND_HALF_UP); |
||||
|
return Response.success(res); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse autoCalculate(String invoiceId) { |
||||
|
try{ |
||||
|
CheckMessage.Message msg = new CheckMessage.Message(); |
||||
|
int userId = (int) RequestSecurityPolicy.getUserId(); |
||||
|
//int userId = 190;
|
||||
|
BigDecimal mileageCount = BigDecimal.ZERO; |
||||
|
List<InvoiceItemMileage> invoiceItemMileages = invoiceItemMileageMapper.listByInvoiceId(invoiceId); |
||||
|
for (InvoiceItemMileage invoiceItemMileage : invoiceItemMileages) { |
||||
|
mileageCount = mileageCount.add(invoiceItemMileage.getMileage()); |
||||
|
} |
||||
|
//获取里程费率
|
||||
|
User user1 = userMapper.selectByPrimaryKey(userId); |
||||
|
VerifiedUser verifiedUser = verifiedUserMapper.checkByTel(user1.getTel()); |
||||
|
//获取费率
|
||||
|
BandConfig mileage = bandConfigMapper.selectRate(verifiedUser.getBandler(), "0", "Mileage"); |
||||
|
BandConfig mileageSalary = bandConfigMapper.selectRate(verifiedUser.getBandler(), "0", "MileageSalary"); |
||||
|
if (verifiedUser.getBandler() == null) { |
||||
|
throw new ServiceException("没有职级,请联系管理员"); |
||||
|
// msg.setMessage("没有职级,请联系管理员");
|
||||
|
// return RestResponse.success(msg);
|
||||
|
} else { |
||||
|
if (mileage == null) { |
||||
|
mileage = bandConfigMapper.selectRate("Default", "0", "Mileage"); |
||||
|
if (mileage == null) { |
||||
|
throw new ServiceException("没有里程费率值,请联系管理员"); |
||||
|
// msg.setMessage("没有里程费率值,请联系管理员");
|
||||
|
// return RestResponse.success(msg);
|
||||
|
} |
||||
|
} |
||||
|
if (mileageSalary == null) { |
||||
|
throw new ServiceException("没有工资费率值,请联系管理员"); |
||||
|
// msg.setMessage("没有工资费率值,请联系管理员");
|
||||
|
// return RestResponse.success(msg);
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//MILEAGE_MAX
|
||||
|
if (mileage.getExt01() != null) { |
||||
|
BigDecimal max = new BigDecimal(mileage.getExt01()); |
||||
|
if (mileageCount.compareTo(max) == 1) { |
||||
|
mileageCount = max; |
||||
|
} |
||||
|
} |
||||
|
BigDecimal rate = new BigDecimal(mileage.getRate()); |
||||
|
BigDecimal rateSalary = new BigDecimal(mileageSalary.getRate()); |
||||
|
|
||||
|
//里程工资-保留2位小数 2022/6/16
|
||||
|
mileageCount = mileageCount.setScale(2, BigDecimal.ROUND_HALF_UP); |
||||
|
|
||||
|
//新的金额计算公式 费率乘里程汇总
|
||||
|
BigDecimal res = mileageCount.multiply(rate.add(rateSalary)); |
||||
|
//报销金额-保留2位小数 2022/6/17
|
||||
|
res = res.setScale(2, BigDecimal.ROUND_HALF_UP); |
||||
|
|
||||
|
Map<String, BigDecimal> result = new HashMap<>(); |
||||
|
result.put("mileage", mileageCount); |
||||
|
result.put("money", res); |
||||
|
return RestResponse.success(result); |
||||
|
}catch(Exception e){ |
||||
|
log.error(e.getMessage()); |
||||
|
return RestResponse.failure("系统错误"); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Response<List<Mileage>> getItemFromMileage() { |
||||
|
int userId = (int) RequestSecurityPolicy.getUserId(); |
||||
|
List<Mileage> mileages = mileageMapper.getItemFromMileage(userId); |
||||
|
return Response.success(mileages); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public Response<Integer> setMlieageStatus() { |
||||
|
int userId = (int) RequestSecurityPolicy.getUserId(); |
||||
|
int i = mileageMapper.updateUnusedId(userId); |
||||
|
return Response.success(i); |
||||
|
} |
||||
|
|
||||
|
@Transactional |
||||
|
@Override |
||||
|
public Response<Integer> submitMileage(SubmitMileageForm submitMileageForm) { |
||||
|
int count = 0; |
||||
|
try { |
||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
||||
|
|
||||
|
List<Mileage> mileages = submitMileageForm.getMileages(); |
||||
|
for (Mileage mileage : mileages) { |
||||
|
InvoiceItemMileage invoiceItemMileage = new InvoiceItemMileage(); |
||||
|
invoiceItemMileage.setInvoiceId(submitMileageForm.getInvoiceId()); |
||||
|
//invoiceItemMileage.setItemDate(mileage.getMileageDate());//重新赋值 2022/5/9
|
||||
|
invoiceItemMileage.setItemDate(sdf.parse(mileage.getName())); |
||||
|
invoiceItemMileage.setFrom(mileage.getLocationStart()); |
||||
|
invoiceItemMileage.setTo(mileage.getLocationEnd()); |
||||
|
invoiceItemMileage.setMileage(BigDecimal.valueOf(mileage.getMileageSum())); |
||||
|
invoiceItemMileage.setRecMileage(BigDecimal.valueOf(mileage.getMileageSum()));//增加 2022/9/23
|
||||
|
//invoiceItemMileage.setReason(mileage.getName());//重新赋值 2022/5/9
|
||||
|
invoiceItemMileage.setReason(mileage.getRemark()); |
||||
|
//根据mileage的source进行判断获取 2022/9/22
|
||||
|
//invoiceItemMileage.setCustom5("1");
|
||||
|
invoiceItemMileage.setCustom5(mileage.getSource().equals("GPS") ? "2" : "3"); |
||||
|
invoiceItemMileage.setCustom4(String.valueOf(mileage.getId())); |
||||
|
invoiceItemMileage.setCreateTime(new Date()); |
||||
|
int insert = invoiceItemMileageMapper.insert(invoiceItemMileage); |
||||
|
count += insert; |
||||
|
if (insert > 0) { |
||||
|
mileage.setUsedStatus(true); |
||||
|
mileageMapper.updateByPrimaryKeySelective(mileage); |
||||
|
} |
||||
|
} |
||||
|
return Response.success(count); |
||||
|
} catch (Exception e) { |
||||
|
log.error("", e); |
||||
|
throw new ServiceException("Submitted Failed"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private Map<String, BigDecimal> calculate(String invoiceId, int userId) { |
||||
|
try { |
||||
|
BigDecimal mileage = BigDecimal.ZERO; |
||||
|
List<InvoiceItemMileage> invoiceItemMileages = invoiceItemMileageMapper.listByInvoiceId(invoiceId); |
||||
|
for (InvoiceItemMileage invoiceItemMileage : invoiceItemMileages) { |
||||
|
mileage = mileage.add(invoiceItemMileage.getMileage()); |
||||
|
} |
||||
|
// ExpenseType expenseType = expenseTypeMapper.selectByPrimaryKeyAll(expanseTypeId);
|
||||
|
// SysConfig sysConfig = sysConfigMapper.selectByCode("MILEAGE_MAX");
|
||||
|
|
||||
|
//获取里程费率
|
||||
|
User user = userMapper.selectByPrimaryKey(userId); |
||||
|
VerifiedUser verifiedUser = verifiedUserMapper.checkByTel(user.getTel()); |
||||
|
//获取费率
|
||||
|
BandConfig bandConfig = bandConfigMapper.selectRate(verifiedUser.getBandler(), "0", "Mileage"); |
||||
|
// String level = t10EmployeeMapper.selectLevelByUserId(userId);
|
||||
|
|
||||
|
// InvoiceItemMileageConfig config = invoiceItemMileageConfigMapper.selectByCode(level);
|
||||
|
// BandConfig config = bandConfigMapper.selectByCode(level);// 乘里程
|
||||
|
// if (config == null) {
|
||||
|
// config = bandConfigMapper.selectByCode("Default");
|
||||
|
// }
|
||||
|
// BigDecimal res = mileage.multiply(new BigDecimal(config.getMileage())).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
|
if (bandConfig == null) { |
||||
|
bandConfig = bandConfigMapper.selectRate("Default", "0", "Mileage"); |
||||
|
} |
||||
|
//MILEAGE_MAX
|
||||
|
BigDecimal max = new BigDecimal(bandConfig.getExt01()); |
||||
|
if (mileage.compareTo(max) == 1) { |
||||
|
mileage = max; |
||||
|
} |
||||
|
|
||||
|
BigDecimal rate = new BigDecimal(bandConfig.getRate()); |
||||
|
//新的金额计算公式 费率乘里程汇总
|
||||
|
BigDecimal res = mileage.multiply(rate); |
||||
|
|
||||
|
Map<String, BigDecimal> result = new HashMap<>(); |
||||
|
result.put("mileage", mileage); |
||||
|
result.put("money", res); |
||||
|
return result; |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage()); |
||||
|
throw new ServiceException("里程计算异常"); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,144 @@ |
|||||
|
package com.cmsen.ticket.application.service.impl; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import com.cmsen.common.exception.ProcessingTransactional; |
||||
|
import com.cmsen.common.exception.ServiceException; |
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.common.util.DateFormat; |
||||
|
import com.cmsen.common.util.StringUtil; |
||||
|
import com.cmsen.ticket.application.service.InvoiceItemService; |
||||
|
import com.cmsen.ticket.domain.entity.InvoiceItems; |
||||
|
import com.cmsen.ticket.domain.mapper.ExpenseTypeSubMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.InvoiceItemsMapper; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2021/7/26 16:03 |
||||
|
**/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class InvoiceItemServiceImpl implements InvoiceItemService { |
||||
|
|
||||
|
@Resource |
||||
|
private InvoiceItemsMapper invoiceItemsMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private ExpenseTypeSubMapper expenseTypeSubMapper; |
||||
|
|
||||
|
private static final Long dayMin = 24 * 60 * 60 * 1000L; |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public RestResponse selectByInvoiceId(String invoiceId) { |
||||
|
return RestResponse.success(invoiceItemsMapper.selectByInvoiceId(invoiceId)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse selectItemExpenseTypeByExpenseTypeId(Integer expenseTypeId) { |
||||
|
return RestResponse.success(expenseTypeSubMapper.selectItemExpenseTypeByExpenseTypeId(expenseTypeId)); |
||||
|
} |
||||
|
|
||||
|
@Transactional |
||||
|
@Override |
||||
|
public RestResponse delete(Long id) { |
||||
|
return ProcessingTransactional.delete(() -> { |
||||
|
int i = invoiceItemsMapper.deleteByPrimaryKey(id); |
||||
|
return i > 0 ? RestResponse.success() : RestResponse.failure("删除失败"); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
@Transactional |
||||
|
@Override |
||||
|
public RestResponse insert(InvoiceItems invoiceItems) { |
||||
|
try { |
||||
|
invoiceItems.setCustom5("1"); |
||||
|
invoiceItems.setExt05(DateFormat.format(new Date(), DateFormat.DatePatternType.FORMAT_yyyy_MM_dd_HH_mm_ss)); |
||||
|
int insert = invoiceItemsMapper.insert(invoiceItems); |
||||
|
return insert > 0 ? RestResponse.success() : RestResponse.failure("添加失败"); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("添加失败"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Transactional |
||||
|
@Override |
||||
|
public RestResponse insertBatch(InvoiceItems invoiceItems) { |
||||
|
try { |
||||
|
List<String> dataList = dataList(invoiceItems.getStartDate(), invoiceItems.getEndDate()); |
||||
|
if (StringUtil.isEmpty(invoiceItems.getTransactionAmount())) { |
||||
|
invoiceItems.setTransactionAmount("0"); |
||||
|
} |
||||
|
//String money = new BigDecimal(invoiceItems.getTransactionAmount()).divide(new BigDecimal(dataList.size()), BigDecimal.ROUND_HALF_UP).toString();
|
||||
|
int dataSize = dataList.size(); |
||||
|
BigDecimal money = new BigDecimal(invoiceItems.getTransactionAmount()).divide(new BigDecimal(dataSize), 2, BigDecimal.ROUND_HALF_UP); |
||||
|
money = money.setScale(2, BigDecimal.ROUND_HALF_UP); |
||||
|
|
||||
|
List<InvoiceItems> insertBatch = new ArrayList<>(); |
||||
|
for(int i = 0; i < dataSize; i++){ |
||||
|
InvoiceItems invoiceItems1 = new InvoiceItems(); |
||||
|
BeanUtil.copyProperties(invoiceItems, invoiceItems1); |
||||
|
invoiceItems1.setTransactionDate(dataList.get(i)); |
||||
|
if(i == (dataSize-1)){ |
||||
|
money = new BigDecimal(invoiceItems.getTransactionAmount()).subtract(money.multiply(new BigDecimal(dataSize-1))); |
||||
|
} |
||||
|
invoiceItems1.setTransactionAmount(money.toString()); |
||||
|
invoiceItems1.setId(null); |
||||
|
invoiceItems1.setCustom5("1"); |
||||
|
invoiceItems.setExt05(DateFormat.format(new Date(), DateFormat.DatePatternType.FORMAT_yyyy_MM_dd_HH_mm_ss)); |
||||
|
insertBatch.add(invoiceItems1); |
||||
|
} |
||||
|
invoiceItemsMapper.insertBatch(insertBatch); |
||||
|
return RestResponse.success(); |
||||
|
} catch (ServiceException e1) { |
||||
|
throw e1; |
||||
|
} catch (Exception e) { |
||||
|
log.error("", e); |
||||
|
throw new ServiceException("添加异常"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Transactional |
||||
|
@Override |
||||
|
public RestResponse update(InvoiceItems invoiceItems) { |
||||
|
try { |
||||
|
int i = invoiceItemsMapper.updateByPrimaryKeySelective(invoiceItems); |
||||
|
return i > 0 ? RestResponse.success() : RestResponse.failure("更新失败"); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("更新失败"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse delByInvoiceId(String invoiceId) { |
||||
|
invoiceItemsMapper.delByInvoiceId(invoiceId); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
private List<String> dataList(String startDate, String endDate) { |
||||
|
List<String> dateList = new ArrayList<>(); |
||||
|
Date start = DateFormat.parse(startDate); |
||||
|
Date end = DateFormat.parse(endDate); |
||||
|
if (start.after(end)) { |
||||
|
throw new ServiceException("开始日期应该在结束日期之前"); |
||||
|
} |
||||
|
while (start.before(end)) { |
||||
|
dateList.add(DateFormat.format(start, DateFormat.DatePatternType.FORMAT_yyyy_MM_dd)); |
||||
|
start = new Date(start.getTime() + dayMin); |
||||
|
} |
||||
|
// dateList.add(endDate);
|
||||
|
return dateList; |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,165 @@ |
|||||
|
package com.cmsen.ticket.application.service.impl; |
||||
|
|
||||
|
import com.cmsen.common.exception.ServiceException; |
||||
|
import com.cmsen.common.util.DateFormat; |
||||
|
import com.cmsen.ticket.application.service.MileageService; |
||||
|
import com.cmsen.ticket.domain.dto.MileageListDto; |
||||
|
import com.cmsen.ticket.domain.entity.Mileage; |
||||
|
import com.cmsen.ticket.domain.entity.MileageDetail; |
||||
|
import com.cmsen.ticket.domain.entity.manager.SysConfig; |
||||
|
import com.cmsen.ticket.domain.mapper.MileageDetailMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.MileageMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.SysConfigMapper; |
||||
|
import com.cmsen.ticket.domain.response.Response; |
||||
|
import com.cmsen.ticket.domain.response.ResponsePage; |
||||
|
import com.cmsen.ticket.domain.util.AmapUtil; |
||||
|
import com.cmsenframework.security.RequestSecurityPolicy; |
||||
|
import lombok.extern.log4j.Log4j2; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.Collections; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
*/ |
||||
|
@Log4j2 |
||||
|
@Service |
||||
|
public class MileageServiceImpl implements MileageService { |
||||
|
|
||||
|
@Resource |
||||
|
private MileageMapper mileageMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private MileageDetailMapper mileageDetailMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private SysConfigMapper sysConfigMapper; |
||||
|
|
||||
|
@Override |
||||
|
public Response<Mileage> getNowMileage() { |
||||
|
int userId = (int) RequestSecurityPolicy.getUserId(); |
||||
|
Mileage mileage = mileageMapper.getNowMileage(userId); |
||||
|
if (mileage == null) { |
||||
|
mileage = new Mileage(); |
||||
|
Date todayDate = new Date(); |
||||
|
//mileage.setName(DateFormat.format(todayDate, DateFormat.DatePatternType.FORMAT_yyyy年MM月dd日));
|
||||
|
mileage.setName(DateFormat.format(todayDate, DateFormat.DatePatternType.FORMAT_yyyy_MM_dd)); |
||||
|
mileage.setMoney(0d); |
||||
|
mileage.setMileageSum(0d); |
||||
|
mileage.setMileageDate(todayDate); |
||||
|
mileage.setMileageSum(0d); |
||||
|
mileage.setLocationStart(""); |
||||
|
mileage.setLocationEnd(""); |
||||
|
mileage.setStatus(false); |
||||
|
mileage.setUsedStatus(false); |
||||
|
mileage.setUserId(userId); |
||||
|
mileage.setCreateTime(todayDate); |
||||
|
mileage.setUpdateTime(todayDate); |
||||
|
mileage.setMileageSumAffirm(0d); |
||||
|
mileage.setRemark(""); |
||||
|
mileage.setImage(""); |
||||
|
mileage.setSource("GPS"); |
||||
|
mileageMapper.insert(mileage); |
||||
|
} |
||||
|
return Response.success(mileage); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Response<Mileage> getMileageById(Long mileageId) { |
||||
|
return Response.success(mileageMapper.selectByPrimaryKey(mileageId)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Response<ResponsePage<Mileage>> getMileageList(MileageListDto search) { |
||||
|
search.setUserId((int) RequestSecurityPolicy.getUserId()); |
||||
|
search.setSource("GPS"); |
||||
|
List<Mileage> list = mileageMapper.getMileageList(search); |
||||
|
int count = mileageMapper.getCountMileageList(search); |
||||
|
return Response.success(ResponsePage.getPageInfo(search, count, list)); |
||||
|
} |
||||
|
|
||||
|
@Transactional |
||||
|
@Override |
||||
|
public Response<Mileage> updateMileage(Mileage mileage) { |
||||
|
try { |
||||
|
mileage.setUpdateTime(new Date()); |
||||
|
mileageMapper.updateByPrimaryKeySelective(mileage); |
||||
|
return Response.success(mileage); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e); |
||||
|
throw new ServiceException("Updated failed"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Response<List<MileageDetail>> getMileageDetail(Long mileageId) { |
||||
|
return Response.success(mileageDetailMapper.selectByMileageId(mileageId)); |
||||
|
} |
||||
|
|
||||
|
@Transactional |
||||
|
@Override |
||||
|
public Response<MileageDetail> addMileageDetail(MileageDetail detail) { |
||||
|
try { |
||||
|
detail.setUpdateTime(new Date()); |
||||
|
detail.setCreateTime(detail.getUpdateTime()); |
||||
|
mileageDetailMapper.insert(detail); |
||||
|
return Response.success(detail); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e); |
||||
|
throw new ServiceException("Insert failed"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Transactional |
||||
|
@Override |
||||
|
public Response<Integer> deleteMileage(Long mileageId) { |
||||
|
try { |
||||
|
int i = mileageMapper.deleteByPrimaryKey(mileageId); |
||||
|
return Response.success(i); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e); |
||||
|
throw new ServiceException("Deleted failed"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Transactional |
||||
|
@Override |
||||
|
public Response<Integer> deleteMileageDetail(Long detailId) { |
||||
|
try { |
||||
|
int i = mileageDetailMapper.deleteByPrimaryKey(detailId); |
||||
|
return Response.success(i); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e); |
||||
|
throw new ServiceException("Deleted failed"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Response<MileageDetail> updateMileageDetail(MileageDetail detail) { |
||||
|
try { |
||||
|
detail.setUpdateTime(new Date()); |
||||
|
mileageDetailMapper.updateByPrimaryKeySelective(detail); |
||||
|
return Response.success(detail); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e); |
||||
|
throw new ServiceException("Updated failed"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Map regeo(String location) { |
||||
|
SysConfig sysConfig = sysConfigMapper.selectByCode("lbs_code"); |
||||
|
return AmapUtil.regeo(location, sysConfig.getValue()); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Map driving(String origin, String destination, String waypoints) { |
||||
|
SysConfig sysConfig = sysConfigMapper.selectByCode("lbs_code"); |
||||
|
return AmapUtil.driving(origin, destination, waypoints, sysConfig.getValue()); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,400 @@ |
|||||
|
package com.cmsen.ticket.application.service.impl; |
||||
|
|
||||
|
|
||||
|
import com.cmsen.common.exception.ServiceException; |
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.common.util.Base64Util; |
||||
|
import com.cmsen.common.util.JsonUtil; |
||||
|
import com.cmsen.common.util.StringUtil; |
||||
|
import com.cmsen.ticket.application.service.ConcurService; |
||||
|
import com.cmsen.ticket.application.service.PostBoxService; |
||||
|
import com.cmsen.ticket.domain.entity.*; |
||||
|
import com.cmsen.ticket.domain.mapper.*; |
||||
|
import com.cmsen.ticket.domain.util.Base64Utils; |
||||
|
import com.cmsen.ticket.domain.util.PaginationUtil; |
||||
|
import com.cmsen.ticket.domain.util.Pdf2JpgHelper; |
||||
|
import com.cmsen.ticket.infrastructure.ocr2.RuiZhenOCRService; |
||||
|
import com.cmsen.ticket.infrastructure.ocr2.entity.*; |
||||
|
import com.cmsen.ticket.infrastructure.service.PostboxOCRService; |
||||
|
import com.cmsenframework.security.RequestSecurityPolicy; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Value; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
import java.text.SimpleDateFormat; |
||||
|
import java.util.*; |
||||
|
|
||||
|
/** |
||||
|
* @author OWTS |
||||
|
* @version 1.0.0 |
||||
|
* @date 2021/1/8 14:34 |
||||
|
**/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class PostBoxServiceImpl implements PostBoxService { |
||||
|
|
||||
|
@Value("${file.filepath}") |
||||
|
private String filePath; |
||||
|
@Value("${file.domainName}") |
||||
|
private String domainName; |
||||
|
@Value("${server.servlet.context-path}") |
||||
|
private String contextPath; |
||||
|
@Value("${img.img-virtual-Path}") |
||||
|
private String imgVirtualPath; |
||||
|
@Value("${manager-file.uploadPath}") |
||||
|
private String uploadPath; |
||||
|
@Resource |
||||
|
private PostBoxMapper postBoxMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private ExpenseReportsMapper expenseReportsMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private RuiZhenOCRService ruiZhenOCRService; |
||||
|
|
||||
|
@Resource |
||||
|
private PostboxOCRService postboxOCRService; |
||||
|
|
||||
|
@Resource |
||||
|
private InvoiceKindMappingMapper invoiceKindMappingMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private ConcurService concurService; |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse list(Map<String, Object> params) { |
||||
|
Integer userId = (int) (RequestSecurityPolicy.getUserId()); |
||||
|
params.put("userId", userId); |
||||
|
|
||||
|
PaginationUtil.paginationInit(params); |
||||
|
List<PostBox> list = postBoxMapper.list(params); |
||||
|
|
||||
|
return RestResponse.success(list); |
||||
|
} |
||||
|
|
||||
|
/*public RestResponse list(HttpServletRequest request, Map<String, Object> params) { |
||||
|
Integer userId = (int) (RequestSecurityPolicy.getUserId()); |
||||
|
params.put("userId", userId); |
||||
|
User user = userMapper.selectByPrimaryKey(userId); |
||||
|
String lang = user.getLanguageType(); |
||||
|
List<PostBox> list = postBoxMapper.list(params); |
||||
|
List<PostBoxVo> result = new ArrayList<>(); |
||||
|
PostBoxVo submit = new PostBoxVo(); |
||||
|
submit.setTitle(lang.equals("cn") ? "已使用" : "Used"); |
||||
|
PostBoxVo notSubmit = new PostBoxVo(); |
||||
|
notSubmit.setTitle(lang.equals("cn") ? "未使用" : "NotUsed"); |
||||
|
|
||||
|
PostBoxVo notValid = new PostBoxVo(); |
||||
|
notValid.setTitle(lang.equals("cn") ? "未验真" : "NotVaild"); |
||||
|
|
||||
|
list.forEach(pb -> { |
||||
|
if(pb.getValidStatus()){ |
||||
|
if (pb.getSubmit()) { |
||||
|
submit.getResult().add(pb); |
||||
|
} else { |
||||
|
notSubmit.getResult().add(pb); |
||||
|
} |
||||
|
}else{ |
||||
|
notValid.getResult().add(pb); |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
result.add(notValid); |
||||
|
result.add(notSubmit); |
||||
|
result.add(submit); |
||||
|
return RestResponse.success(result); |
||||
|
}*/ |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse submit(List<Integer> ids, Integer reportId) { |
||||
|
ExpenseReports expenseReports = expenseReportsMapper.selectByPrimaryKey(reportId); |
||||
|
if (expenseReports == null) { |
||||
|
return RestResponse.failure("费用报告不存在"); |
||||
|
} |
||||
|
//List<Invoice> invoiceList = new ArrayList<>();
|
||||
|
List<PostBox> postBoxList = new ArrayList<>(); |
||||
|
ids.forEach(id -> { |
||||
|
try { |
||||
|
PostBox postBox = postBoxMapper.selectByPrimaryKey(id); |
||||
|
|
||||
|
//postBox.setOtherFields("[]");
|
||||
|
postBox.setExpenseFields("[]"); |
||||
|
postBox.setReimburseMoney(postBox.getInvoiceMoney()); |
||||
|
postBox.setInvoiceId(StringUtil.UUID()); |
||||
|
postBox.setDescr(""); |
||||
|
|
||||
|
String identifyResult = postBox.getIdentifyResult(); |
||||
|
RuiZhenOCREntity ocrEntity = JsonUtil.toClass(identifyResult, RuiZhenOCREntity.class); |
||||
|
List<RuiZhenOCREntity.IdentifyResults> resultsList = ocrEntity.getResponse().getData().getIdentify_results(); |
||||
|
for (RuiZhenOCREntity.IdentifyResults result : resultsList) { |
||||
|
Details details = result.getDetails(); |
||||
|
|
||||
|
postBox.setBuyerCode(details.getBuyer_tax_id()); |
||||
|
postBox.setSellerCode(details.getSeller_tax_id()); |
||||
|
postBox.setDetails(details.getItem_names()); |
||||
|
} |
||||
|
//单票-电子发票增加:
|
||||
|
postBox.setInvoiceTypeCode(postBox.getTicketType()); |
||||
|
|
||||
|
//多票行-电子发票增加:
|
||||
|
postBox.setDate(postBox.getInvoiceDate()); |
||||
|
postBox.setKind(postBox.getConsumeType()); |
||||
|
postBox.setNumber(postBox.getInvoiceNum()); |
||||
|
postBox.setTypeCode(postBox.getTicketType()); |
||||
|
postBox.setTitle(postBox.getInvoiceType()); |
||||
|
|
||||
|
postBoxList.add(postBox); |
||||
|
|
||||
|
|
||||
|
/*User user = userMapper.selectByUser(new User() {{ |
||||
|
setUserId((int) RequestSecurityPolicy.getUserId()); |
||||
|
}}); |
||||
|
String lang = user.getLanguageType(); |
||||
|
String identifyResult = postBox.getIdentifyResult(); |
||||
|
RuiZhenOCREntity ocrEntity = JsonUtil.toClass(identifyResult, RuiZhenOCREntity.class); |
||||
|
List<RuiZhenOCREntity.IdentifyResults> resultsList = ocrEntity.getResponse().getData().getIdentify_results(); |
||||
|
for (RuiZhenOCREntity.IdentifyResults result : resultsList) { |
||||
|
Details details = result.getDetails(); |
||||
|
//通过code查询发票类型
|
||||
|
String typeDesc = "其他发票"; |
||||
|
TicketType ticketType = ticketTypeMapper.selectByCode(result.getType()); |
||||
|
if (ticketType != null) { |
||||
|
typeDesc = ticketType.getValue(); |
||||
|
} |
||||
|
String invoiceDate = StringUtil.isEmpty(details.getDate()) ? "" : details.getDate().replace("年", "-").replace("月", "-").replace("日", ""); |
||||
|
if (StringUtil.isEmpty(invoiceDate)) { |
||||
|
invoiceDate = "请选择"; |
||||
|
} |
||||
|
|
||||
|
Invoice invoice = new Invoice(); |
||||
|
invoice.setValidMode(user.getValidMode()); |
||||
|
|
||||
|
invoice.setTitle(typeDesc); |
||||
|
invoice.setInvoiceId(StringUtil.UUID()); |
||||
|
invoice.setCurrency("CNY"); |
||||
|
invoice.setIsSend(1); |
||||
|
invoice.setIsVerification(0); |
||||
|
invoice.setImgPath(postBox.getFilePath()); |
||||
|
invoice.setCompanyId(user.getCompanyId()); |
||||
|
invoice.setClient(user.getClient()); |
||||
|
invoice.setInvoiceTypeCode(result.getType()); |
||||
|
invoice.setPreTax(details.getPretax_amount()); |
||||
|
invoice.setInvoiceDate(invoiceDate); |
||||
|
invoice.setTradeDate(invoiceDate); |
||||
|
invoice.setCheckCode(details.getCheck_code()); |
||||
|
String money = StringUtil.isEmpty(details.getTotal()) ? "0" : details.getTotal(); |
||||
|
invoice.setInvoiceMoney(new BigDecimal(money)); |
||||
|
invoice.setInvoiceType(typeDesc); |
||||
|
invoice.setConsumeType(invoiceService.getInvoiceKind(details.getItem_names(), details.getKind())); |
||||
|
invoice.setReimburseMoney(invoice.getInvoiceMoney()); |
||||
|
invoice.setSupplier(details.getSeller()); |
||||
|
//全电票code判断:10100、10102、10107 2022/6/1
|
||||
|
String typeCode = result.getType(); |
||||
|
String invoiceCode = details.getCode(); |
||||
|
if(StringUtil.isEmpty(details.getCode()) && !typeCode.equals("10100") && !typeCode.equals("10102") && !typeCode.equals("10107")){ |
||||
|
invoiceCode = "0000"; |
||||
|
} |
||||
|
invoice.setInvoiceCode(invoiceCode); |
||||
|
//invoice.setInvoiceCode(StringUtil.isEmpty(details.getCode()) ? "0000" : details.getCode());
|
||||
|
invoice.setInvoiceNum(details.getNumber()); |
||||
|
invoice.setIsDel("0"); |
||||
|
invoice.setMileage(details.getMileage()); |
||||
|
invoice.setGetOnTime(details.getTime_geton()); |
||||
|
invoice.setDebusTime(details.getTime_getoff()); |
||||
|
boolean needVerify = ruiZhenOCRService.isNeedVerify(result.getType()); |
||||
|
invoice.setIsVatInvoice(needVerify ? 1 : 0); |
||||
|
invoice.setIsNeedVerify(needVerify ? 1 : 0); |
||||
|
invoice.setInvoiceStatus(result.getType().equals("10100") ? "2" : "1"); |
||||
|
invoice.setIsSend(1); |
||||
|
|
||||
|
CheckMessage checkMessage = new CheckMessage(); |
||||
|
List<CheckMessage.Message> messages = new ArrayList<>(); |
||||
|
checkMessage.setSubmit(true); |
||||
|
checkMessage.setMessageList(messages); |
||||
|
|
||||
|
// invoice.setCheckResult(checkMessage);
|
||||
|
|
||||
|
invoice.setOtherFields("[]"); |
||||
|
invoice.setExpenseFields("[]"); |
||||
|
|
||||
|
invoice.setDataJson(JsonUtil.toString(result)); |
||||
|
|
||||
|
if ("10503".equals(result.getType())) { |
||||
|
invoice.setInvoiceCode(details.getSerial_number()); |
||||
|
} |
||||
|
|
||||
|
invoice.setOriginalPath(postBox.getOriginalPath()); |
||||
|
|
||||
|
invoice.setTax(details.getTax()); |
||||
|
List<Item> items = details.getItems(); |
||||
|
if (items != null && !items.isEmpty()) { |
||||
|
if (ticketType != null && StringUtil.isNotEmpty(ticketType.getTaxRate())) { |
||||
|
items.get(0).setTax_rate(ticketType.getTaxRate()); |
||||
|
details.setTax_rate(ticketType.getTaxRate()); |
||||
|
} |
||||
|
invoice.setTaxRate(items.get(0).getTax_rate()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtil.isNotEmpty(invoice.getTaxRate()) && invoice.getTaxRate().equals("0%")) { |
||||
|
invoice.setTax("0"); |
||||
|
} |
||||
|
|
||||
|
invoice.setNeedValid(needVerify); |
||||
|
invoice.setValidStatus(false); |
||||
|
invoice.setValidCount(0); |
||||
|
invoice.setValidDayCount(0); |
||||
|
|
||||
|
//增加返回内容 2022/8/19
|
||||
|
invoice.setBuyer(details.getBuyer()); |
||||
|
invoice.setBuyerCode(details.getBuyer_tax_id()); |
||||
|
invoice.setSeller(details.getSeller()); |
||||
|
invoice.setBuyerCode(details.getSeller_tax_id()); |
||||
|
|
||||
|
invoice.setKind(invoiceService.getInvoiceKind(details.getItem_names(), details.getKind())); |
||||
|
invoice.setDetails(details.getItem_names()); |
||||
|
|
||||
|
invoiceService.autoInsertCity(result, details, invoice, items); |
||||
|
|
||||
|
|
||||
|
if (ticketType != null) { |
||||
|
//添加发票类型 扩展字段
|
||||
|
List<ExpenseTypeActive> expenseTypeActives = expenseTypeActiveService.selectExFields(ticketType.getId(), 1); |
||||
|
if (!expenseTypeActives.isEmpty()) { |
||||
|
expenseTypeActives.forEach(ex -> ex.setDefaultValue(result.getValueByKey(ex.getSelectName()))); |
||||
|
} |
||||
|
invoice.setOtherFields(JsonUtil.toString(expenseTypeActives)); |
||||
|
} |
||||
|
invoiceList.add(invoice); |
||||
|
}*/ |
||||
|
|
||||
|
|
||||
|
//更新为已使用
|
||||
|
postBox.setSubmit(true); |
||||
|
postBoxMapper.updateByPrimaryKeySelective(postBox); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("系统错误"); |
||||
|
} |
||||
|
} |
||||
|
); |
||||
|
return RestResponse.success(postBoxList); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
@Override |
||||
|
public RestResponse delete(Integer id) { |
||||
|
try { |
||||
|
PostBox postBox = postBoxMapper.selectByPrimaryKey(id); |
||||
|
if(postBox.getIsSend().equals("0")){ |
||||
|
postBoxMapper.deleteByPrimaryKey(id); |
||||
|
}else if(postBox.getIsSend().equals("1") || postBox.getIsSend().equals("9")){//已发送
|
||||
|
return RestResponse.failure("不可删除'已发送'发票",401); |
||||
|
}else{ |
||||
|
//查询接口-看concur是否已经删除
|
||||
|
boolean flag = concurService.checkPeceiptId(String.valueOf(id), postBox.getReceiptId()); |
||||
|
if(flag){//存在-不可删除
|
||||
|
return RestResponse.failure("不可删除'已同步'发票",402); |
||||
|
}else{ |
||||
|
postBoxMapper.deleteByPrimaryKey(id); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return RestResponse.success(); |
||||
|
} catch (Exception e) { |
||||
|
throw new ServiceException("系统错误"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse uploadInvoices(Files files) { |
||||
|
log.info("uploadInvoices >>>>>>>"); |
||||
|
List<String> picList = files.getPicList(); |
||||
|
if (picList != null && !picList.isEmpty()) { |
||||
|
|
||||
|
Integer userId = Integer.valueOf(String.valueOf(RequestSecurityPolicy.getUserId())); |
||||
|
String folder = Pdf2JpgHelper.generateFolder(filePath); |
||||
|
try { |
||||
|
for (String value : picList) { |
||||
|
|
||||
|
//进行图片识别
|
||||
|
RuiZhenOCREntity ocrEntity = ruiZhenOCRService.billsCrop(value); |
||||
|
List<RuiZhenOCREntity.IdentifyResults> resultsList = ocrEntity.getResponse().getData().getIdentify_results(); |
||||
|
for (RuiZhenOCREntity.IdentifyResults result : resultsList) { |
||||
|
if (result.getType().equals("10900")) { |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
//保存发票
|
||||
|
List<Integer> region = result.getRegion(); |
||||
|
String subImage; |
||||
|
try { |
||||
|
subImage = new Base64Utils().getSubImage(value, new Base64Utils.ImageInfo(region.get(0), region.get(1), region.get(2), region.get(3))); |
||||
|
} catch (Exception e) { |
||||
|
try { |
||||
|
subImage = new Base64Utils().getSubImage(value, new Base64Utils.ImageInfo(region.get(1), region.get(0), region.get(3), region.get(2))); |
||||
|
} catch (Exception e1) { |
||||
|
subImage = null; |
||||
|
} |
||||
|
} |
||||
|
if (StringUtil.isEmpty(subImage)) { |
||||
|
subImage = value; |
||||
|
} |
||||
|
String newFileName = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + |
||||
|
UUID.randomUUID().toString().replace("-", "") + ".jpg"; |
||||
|
String imgFilePath = filePath + "/" + folder + newFileName; |
||||
|
String imgViewPath = domainName + contextPath + imgVirtualPath + "/" + folder + newFileName; |
||||
|
Base64Util.toSaveFile(imgFilePath, subImage); |
||||
|
|
||||
|
log.info("picList >> imgFilePath>>{}>>{}", imgFilePath, imgViewPath); |
||||
|
Details details = result.getDetails(); |
||||
|
PostBox postBox = new PostBox(); |
||||
|
postBox.setSubject(""); |
||||
|
postBox.setFilePath(imgViewPath); |
||||
|
postBox.setIdentifyResult(JsonUtil.toString(ocrEntity)); |
||||
|
postBox.setFrom(""); |
||||
|
postBox.setReceiveDate(""); |
||||
|
postBox.setBuyer(details.getBuyer()); |
||||
|
postBox.setInvoiceMoney(details.getTotal()); |
||||
|
postBox.setInvoiceDate(StringUtil.isEmpty(details.getDate()) ? "" : details.getDate()); |
||||
|
postBox.setInvoiceNum(details.getNumber()); |
||||
|
postBox.setOriginalPath(imgViewPath); |
||||
|
int i = postBoxMapper.checkRepeat(details.getNumber()); |
||||
|
if (i > 0) { |
||||
|
postBox.setRepeat(true); |
||||
|
} |
||||
|
postBox.setTicketType(result.getType()); |
||||
|
postBox.setCreateTime(new Date()); |
||||
|
postBox.setExt01("0");//0:OCR解析
|
||||
|
postBox.setUserId(userId); |
||||
|
|
||||
|
postBoxMapper.insertSelective(postBox); |
||||
|
log.info("insertPostBox >>SUCCESS>>{}", postBox); |
||||
|
|
||||
|
//记录保存invoice数据
|
||||
|
com.cmsen.ticket.domain.entity.Invoice invoice = postboxOCRService.updatePostbox(postBox.getId()); |
||||
|
//增加验真逻辑
|
||||
|
postboxOCRService.verifyPostbox(invoice, postBox.getId()); |
||||
|
} |
||||
|
} |
||||
|
return RestResponse.success(); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("系统错误"); |
||||
|
} |
||||
|
} |
||||
|
return RestResponse.failure("无效的图片集合"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse selectKindList(String keywords) { |
||||
|
List<InvoiceKindMapping> list = invoiceKindMappingMapper.selectKindList(keywords); |
||||
|
return RestResponse.success(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
File diff suppressed because it is too large
@ -0,0 +1,225 @@ |
|||||
|
package com.cmsen.ticket.application.service.impl; |
||||
|
|
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.common.util.JsonUtil; |
||||
|
import com.cmsen.common.util.StringUtil; |
||||
|
import com.cmsen.ticket.application.service.ExpenseTypeService; |
||||
|
import com.cmsen.ticket.application.service.ProjectService; |
||||
|
import com.cmsen.ticket.domain.entity.*; |
||||
|
import com.cmsen.ticket.domain.entity.manager.SysUser; |
||||
|
import com.cmsen.ticket.domain.entity.project.ProjectHoursReport; |
||||
|
import com.cmsen.ticket.domain.entity.project.ProjectTask; |
||||
|
import com.cmsen.ticket.domain.entity.project.response.WeekHours; |
||||
|
import com.cmsen.ticket.domain.mapper.*; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.PreferencesMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.SysUserMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.project.ProjectHoursReportMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.project.ProjectMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.project.ProjectTaskMapper; |
||||
|
import com.cmsen.ticket.domain.util.PaginationUtil; |
||||
|
import com.cmsen.ticket.domain.util.WeekIntervalUtil; |
||||
|
import com.cmsenframework.security.RequestSecurityPolicy; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.*; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class ProjectServiceImpl implements ProjectService { |
||||
|
|
||||
|
@Resource |
||||
|
private ProjectHoursReportMapper hoursReportMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private ProjectTaskMapper taskMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private SysUserMapper sysUserMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private ProjectMapper projectMapper; |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse listWeekHours(Map<String, Object> params) { |
||||
|
//得到sys_user的id
|
||||
|
SysUser sysUser = sysUserMapper.selectByUserId((int) RequestSecurityPolicy.getUserId()); |
||||
|
if(sysUser == null){ |
||||
|
return RestResponse.failure("账号id未同步,请联系管理员同步"); |
||||
|
} |
||||
|
params.put("reporter", sysUser.getId()); |
||||
|
|
||||
|
int count = Integer.parseInt(params.get("pageSize").toString()); |
||||
|
int begin = (Integer.parseInt(params.get("pageNo").toString())-1) * count; |
||||
|
|
||||
|
List<WeekHours> returnList = new ArrayList<>(); |
||||
|
//根据分页取周的区间列表
|
||||
|
List<String> weekIntervals = WeekIntervalUtil.getPreviousWeeksInterval(begin,count); |
||||
|
for(String week : weekIntervals){ |
||||
|
String[] weekArr = week.split("~"); |
||||
|
params.put("dateRangeStart",weekArr[0]); |
||||
|
params.put("dateRangeEnd",weekArr[1]); |
||||
|
|
||||
|
//查询统计区间的审核工时、待提交工时
|
||||
|
WeekHours weekHours = hoursReportMapper.getWeekHours(params); |
||||
|
weekHours.setDateRangeStart(weekArr[0]); |
||||
|
weekHours.setDateRangeEnd(weekArr[1]); |
||||
|
weekHours.setReporter(sysUser.getId().toString()); |
||||
|
//判断状态
|
||||
|
if(weekHours.getApproveHours().compareTo(new BigDecimal(0)) > 0 && weekHours.getUnSubmitHours().compareTo(new BigDecimal(0)) == 0){ |
||||
|
weekHours.setStatus(1); |
||||
|
}else if(weekHours.getApproveHours().compareTo(new BigDecimal(0)) == 0 && weekHours.getUnSubmitHours().compareTo(new BigDecimal(0)) == 0){ |
||||
|
weekHours.setStatus(2); |
||||
|
}else{ |
||||
|
weekHours.setStatus(0); |
||||
|
} |
||||
|
returnList.add(weekHours); |
||||
|
} |
||||
|
return RestResponse.success(returnList); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse listWeekDetails(Map<String, Object> params) { |
||||
|
List<ProjectHoursReport> reportList = hoursReportMapper.getListDetailHours(params); |
||||
|
return RestResponse.success(reportList); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse listDayDetails(Map<String, Object> params) { |
||||
|
List<ProjectHoursReport> reportList = hoursReportMapper.getListDetailHours(params); |
||||
|
return RestResponse.success(reportList); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse saveHours(ProjectHoursReport hoursReport) { |
||||
|
Map<String, String> specifyWeek = WeekIntervalUtil.getWeekRange(hoursReport.getReportDate()); |
||||
|
|
||||
|
hoursReport.setDateRangeStart(specifyWeek.get("weekStart")); |
||||
|
hoursReport.setDateRangeEnd(specifyWeek.get("weekEnd")); |
||||
|
if(hoursReport.getId() == null){ |
||||
|
//得到sys_user的id
|
||||
|
SysUser sysUser = sysUserMapper.selectByUserId((int) RequestSecurityPolicy.getUserId()); |
||||
|
if(sysUser == null){ |
||||
|
return RestResponse.failure("账号id未同步,请联系管理员同步"); |
||||
|
} |
||||
|
hoursReport.setReporter(sysUser.getId().toString()); |
||||
|
hoursReport.setStatus(0); |
||||
|
hoursReport.setReportTime(new Date()); |
||||
|
hoursReportMapper.insert(hoursReport); |
||||
|
}else{ |
||||
|
hoursReport.setUpdateTime(new Date()); |
||||
|
hoursReportMapper.updateByPrimaryKeySelective(hoursReport); |
||||
|
} |
||||
|
|
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse listTask() { |
||||
|
SysUser sysUser = sysUserMapper.selectByUserId((int) RequestSecurityPolicy.getUserId()); |
||||
|
if(sysUser == null){ |
||||
|
return RestResponse.failure("账号id未同步,请联系管理员同步"); |
||||
|
} |
||||
|
|
||||
|
List<ProjectTask> taskList = taskMapper.getRespTask(sysUser.getId().toString()); |
||||
|
return RestResponse.success(taskList); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse checkDay(String reportDate, String reporter) { |
||||
|
Map<String, String> specifyWeek = WeekIntervalUtil.getWeekRange(reportDate); |
||||
|
Map<String, Object> params = new HashMap<>(); |
||||
|
params.put("dateRangeStart",specifyWeek.get("weekStart")); |
||||
|
params.put("dateRangeEnd",specifyWeek.get("weekEnd")); |
||||
|
params.put("reporter",reporter); |
||||
|
int count = hoursReportMapper.checkDay(params); |
||||
|
return RestResponse.success(count); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse submitHours(String reporter, String dateRangeStart, String dateRangeEnd) { |
||||
|
Map<String, Object> params = new HashMap<>(); |
||||
|
params.put("reporter",reporter); |
||||
|
params.put("dateRangeStart",dateRangeStart); |
||||
|
params.put("dateRangeEnd",dateRangeEnd); |
||||
|
|
||||
|
hoursReportMapper.submitHours(params); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse deleteHour(Long id) { |
||||
|
hoursReportMapper.deleteByPrimaryKey(id); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse getProjectList(String keyword) { |
||||
|
//得到sys_user的id
|
||||
|
SysUser sysUser = sysUserMapper.selectByUserId((int) RequestSecurityPolicy.getUserId()); |
||||
|
if(sysUser == null){ |
||||
|
return RestResponse.failure("账号id未同步,请联系管理员同步"); |
||||
|
} |
||||
|
|
||||
|
return RestResponse.success(projectMapper.searchByKeyword(keyword, sysUser.getId().toString())); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse listProWeekHours(Map<String, Object> params) { |
||||
|
PaginationUtil.paginationInit(params); |
||||
|
|
||||
|
//得到sys_user的id
|
||||
|
SysUser sysUser = sysUserMapper.selectByUserId((int) RequestSecurityPolicy.getUserId()); |
||||
|
if(sysUser == null){ |
||||
|
return RestResponse.failure("账号id未同步,请联系管理员同步"); |
||||
|
} |
||||
|
if(params.get("projectCode") == ""){//还没有传projectCode值
|
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
params.put("approver", sysUser.getId()); |
||||
|
|
||||
|
List<ProjectHoursReport> returnList = hoursReportMapper.listProWeekHours(params); |
||||
|
|
||||
|
return RestResponse.success(returnList); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse passHours(String reporter, String dateRangeStart, String dateRangeEnd) { |
||||
|
Map<String, Object> params = new HashMap<>(); |
||||
|
params.put("reporter",reporter); |
||||
|
params.put("dateRangeStart",dateRangeStart); |
||||
|
params.put("dateRangeEnd",dateRangeEnd); |
||||
|
|
||||
|
//得到sys_user的id
|
||||
|
SysUser sysUser = sysUserMapper.selectByUserId((int) RequestSecurityPolicy.getUserId()); |
||||
|
if(sysUser == null){ |
||||
|
return RestResponse.failure("账号id未同步,请联系管理员同步"); |
||||
|
} |
||||
|
params.put("approver", sysUser.getId()); |
||||
|
|
||||
|
hoursReportMapper.passHours(params); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse rejectHours(String reporter, String dateRangeStart, String dateRangeEnd) { |
||||
|
Map<String, Object> params = new HashMap<>(); |
||||
|
params.put("reporter",reporter); |
||||
|
params.put("dateRangeStart",dateRangeStart); |
||||
|
params.put("dateRangeEnd",dateRangeEnd); |
||||
|
|
||||
|
//得到sys_user的id
|
||||
|
SysUser sysUser = sysUserMapper.selectByUserId((int) RequestSecurityPolicy.getUserId()); |
||||
|
if(sysUser == null){ |
||||
|
return RestResponse.failure("账号id未同步,请联系管理员同步"); |
||||
|
} |
||||
|
params.put("approver", sysUser.getId()); |
||||
|
|
||||
|
hoursReportMapper.rejectHours(params); |
||||
|
return RestResponse.success(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,115 @@ |
|||||
|
package com.cmsen.ticket.application.service.impl; |
||||
|
|
||||
|
import com.cmsen.common.exception.ServiceException; |
||||
|
import com.cmsen.common.http.response.RestResponse; |
||||
|
import com.cmsen.ticket.application.service.ConcurService; |
||||
|
import com.cmsen.ticket.application.service.ProxyUserService; |
||||
|
import com.cmsen.ticket.application.service.UserService; |
||||
|
import com.cmsen.ticket.domain.entity.Customer; |
||||
|
import com.cmsen.ticket.domain.entity.ProxyUser; |
||||
|
import com.cmsen.ticket.domain.entity.User; |
||||
|
import com.cmsen.ticket.domain.mapper.CustomerMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.ProxyUserMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.UserMapper; |
||||
|
import com.cmsen.ticket.domain.mapper.manager.SysConfigMapper; |
||||
|
import com.cmsen.ticket.domain.util.StringUtils; |
||||
|
import com.cmsen.ticket.interfaces.facade.form.ConcurProxyUser; |
||||
|
import com.cmsenframework.security.RequestSecurityPolicy; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class ProxyUserServiceImpl implements ProxyUserService { |
||||
|
|
||||
|
private static final long ExpiryIn = 3600 * 24; |
||||
|
@Resource |
||||
|
private UserMapper userMapper; |
||||
|
@Resource |
||||
|
private ProxyUserMapper proxyUserMapper; |
||||
|
@Resource |
||||
|
private ConcurService concurService; |
||||
|
@Resource |
||||
|
private UserService userService; |
||||
|
@Resource |
||||
|
private CustomerMapper customerMapper; |
||||
|
|
||||
|
@Resource |
||||
|
private SysConfigMapper sysConfigMapper; |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse getProxyUsersByUser(HttpServletRequest request, String tel) { |
||||
|
List<User> users = userMapper.selectByPloxy(tel); |
||||
|
return RestResponse.success(users); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse switchProxy(Integer proxyId) { |
||||
|
User user = userMapper.selectByProxyId(proxyId); |
||||
|
if (user == null) { |
||||
|
return RestResponse.failure("无效的代理用户"); |
||||
|
} |
||||
|
if (!StringUtils.isInteger(user.getTel())) { |
||||
|
user.setTel("wechat" + user.getTel()); |
||||
|
} |
||||
|
Customer customer = customerMapper.queryById(1); |
||||
|
String userDetail = userService.getUserDetail("wechat" + user.getTel(), null); |
||||
|
Map<String, Object> data = new HashMap<>(); |
||||
|
Map<String, Object> tokenInfo = new HashMap<>(); |
||||
|
tokenInfo.put("token", userDetail); |
||||
|
tokenInfo.put("ExpiryIn", ExpiryIn); |
||||
|
data.put("tokenInfo", tokenInfo); |
||||
|
data.put("openId", user.getOpenid()); |
||||
|
data.put("tel", user.getTel().replace("wechat", "")); |
||||
|
data.put("client", user.getClient()); |
||||
|
data.put("userInfo", user); |
||||
|
data.put("manual", user.isManual()); |
||||
|
data.put("multiInv", customer.getMultiInv()); |
||||
|
data.put("manualFieldConfig", customer.getManualFieldConfig()); |
||||
|
data.put("userType", user.getType()); |
||||
|
data.put("forceValid", customer.getForceValid()); |
||||
|
data.put("expenseTypeActive", customer.getExpenseTypeActive()); |
||||
|
data.put("locationMandantory", sysConfigMapper.selectByCode("LOCATION_MANDANTORY").getValue()); |
||||
|
return RestResponse.success(data); |
||||
|
} |
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
@Override |
||||
|
public RestResponse addProxy(ConcurProxyUser user) { |
||||
|
try { |
||||
|
List<String> delegators = concurService.getDelegators(user.getEmail(), user.getPassword()); |
||||
|
if (delegators.isEmpty()) { |
||||
|
return RestResponse.success("无代理用户", 201); |
||||
|
} |
||||
|
List<Integer> ids = userMapper.selectIdsByEmails(delegators); |
||||
|
Integer userId = Integer.valueOf(String.valueOf(RequestSecurityPolicy.getUserId())); |
||||
|
ids.forEach(id -> { |
||||
|
ProxyUser proxyUser = new ProxyUser() {{ |
||||
|
setMainId(userId); |
||||
|
setProxyId(id); |
||||
|
}}; |
||||
|
int i = proxyUserMapper.checkExist(proxyUser); |
||||
|
if (i < 1) { |
||||
|
proxyUserMapper.insert(proxyUser); |
||||
|
} |
||||
|
}); |
||||
|
return RestResponse.success(); |
||||
|
} catch (Exception e) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
throw new ServiceException("服务异常"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public RestResponse syncProxy(String loginId) { |
||||
|
log.info("syncProxy======{}",loginId); |
||||
|
return null; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
package com.cmsen.ticket.application.service.impl; |
||||
|
|
||||
|
import com.cmsen.ticket.application.service.WeChatCardPackService; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
/** |
||||
|
* @author ran hao yu |
||||
|
* @date 2020/8/31 16:12 |
||||
|
* @description |
||||
|
*/ |
||||
|
@Service |
||||
|
public class WeChatCardPackServiceImpl implements WeChatCardPackService { |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,191 @@ |
|||||
|
package com.cmsen.ticket.bestsign; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.cmsen.ticket.bestsign.client.BestSignClient; |
||||
|
import com.cmsen.ticket.bestsign.entity.TokenPojo; |
||||
|
import com.cmsen.ticket.bestsign.util.InterfaceUtils; |
||||
|
import com.cmsen.ticket.domain.entity.MtSpeaker; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.apache.commons.codec.binary.Base64; |
||||
|
import org.springframework.http.HttpEntity; |
||||
|
import org.springframework.http.HttpHeaders; |
||||
|
import org.springframework.http.HttpMethod; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; |
||||
|
import org.springframework.util.LinkedMultiValueMap; |
||||
|
import org.springframework.util.MultiValueMap; |
||||
|
import org.springframework.web.client.RestTemplate; |
||||
|
|
||||
|
import java.util.HashMap; |
||||
|
import java.util.LinkedHashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
@Slf4j |
||||
|
public class SignInterface { |
||||
|
|
||||
|
private static String accessToken = ""; |
||||
|
|
||||
|
public static void getToken(Map<String,String> mtParam) { |
||||
|
try { |
||||
|
log.info("getToken mtParam ==={}",mtParam); |
||||
|
Map<String, Object> map = new LinkedHashMap<>(); |
||||
|
map.put("clientId",mtParam.get("BS_clientId")); |
||||
|
map.put("clientSecret",mtParam.get("BS_accessKey")); |
||||
|
|
||||
|
JSONObject json2 = new JSONObject(); |
||||
|
|
||||
|
Map<String,String> param = new HashMap<String,String>(); |
||||
|
param.put("body", json2.toJSON(map).toString()); |
||||
|
param.put("Content-Type","application/json"); |
||||
|
param.put("Authorization",""); |
||||
|
|
||||
|
log.info("getToken param ==={}",param); |
||||
|
|
||||
|
String[] response = InterfaceUtils.httpPostMan2(mtParam.get("BS_host")+mtParam.get("BS_getToken"),param); |
||||
|
log.info("getToken response code ==={}",response[1]); |
||||
|
if (Integer.parseInt(response[1]) != 200) { |
||||
|
log.error("getToken 交互网络异常,响应状态:" + response[1] + ",响应体为:" + response[0]); |
||||
|
}else { |
||||
|
TokenPojo entity = JSONObject.toJavaObject(JSONObject.parseObject(response[0]), TokenPojo.class); |
||||
|
accessToken = entity.getData().getAccessToken(); |
||||
|
log.info("getToken response accessToken ==={}",accessToken); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
} |
||||
|
public static String getHLYToken(Map<String,String> mtParam){ |
||||
|
String clientId = mtParam.get("HLY_clientId");//"e8ee586f-f3ff-46c4-bb27-e82e166ccfbd";//需要替换
|
||||
|
String securet = mtParam.get("HLY_accessKey");//"ZmFmYTVjYTYtMDNlMS00MjRiLWI1YTYtMWJiMDc4OGFmODc0";//需要替换
|
||||
|
String tokenUrl = mtParam.get("HLY_getToken");//"https://api.huilianyi.com/gateway/oauth/token";//需要替换
|
||||
|
|
||||
|
int MAX_TIME_OUT = 1000 * 120; |
||||
|
HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory(); |
||||
|
httpRequestFactory.setConnectionRequestTimeout(MAX_TIME_OUT); |
||||
|
httpRequestFactory.setConnectTimeout(MAX_TIME_OUT); |
||||
|
httpRequestFactory.setReadTimeout(MAX_TIME_OUT); |
||||
|
RestTemplate restTemplate = new RestTemplate(); |
||||
|
restTemplate.setRequestFactory(httpRequestFactory); |
||||
|
|
||||
|
HttpHeaders httpHeaders = new HttpHeaders(); |
||||
|
String authStr = clientId.concat(":").concat(securet); |
||||
|
String authStrEnc = new String(Base64.encodeBase64(authStr.getBytes())); |
||||
|
httpHeaders.set("Authorization", "Basic ".concat(authStrEnc)); |
||||
|
|
||||
|
MultiValueMap<String, String> formData = new LinkedMultiValueMap(); |
||||
|
formData.add("grant_type", "client_credentials"); |
||||
|
formData.add("scope", "write"); |
||||
|
|
||||
|
HttpEntity httpEntity = new HttpEntity(formData, httpHeaders); |
||||
|
ResponseEntity<String> exchange = restTemplate.exchange(tokenUrl, HttpMethod.POST, httpEntity, String.class); |
||||
|
String respone = exchange.getBody(); |
||||
|
|
||||
|
TokenPojo entity = JSONObject.parseObject(respone, TokenPojo.class); |
||||
|
String token = entity.getAccess_token(); |
||||
|
return token; |
||||
|
} |
||||
|
|
||||
|
public static String getHLYToken2(Map<String,String> mtParam){ |
||||
|
String token; |
||||
|
// map.put("HLY_clientId",appId);
|
||||
|
// map.put("HLY_accessKey",appSecret);
|
||||
|
// map.put("HLY_getToken",tokenUrl);
|
||||
|
String clientId = mtParam.get("HLY_clientId");//需要替换
|
||||
|
String securet = mtParam.get("HLY_accessKey");//需要替换
|
||||
|
String tokenUrl = mtParam.get("HLY_getToken");//需要替换
|
||||
|
|
||||
|
int MAX_TIME_OUT = 1000 * 120; |
||||
|
HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory(); |
||||
|
httpRequestFactory.setConnectionRequestTimeout(MAX_TIME_OUT); |
||||
|
httpRequestFactory.setConnectTimeout(MAX_TIME_OUT); |
||||
|
httpRequestFactory.setReadTimeout(MAX_TIME_OUT); |
||||
|
RestTemplate restTemplate = new RestTemplate(); |
||||
|
restTemplate.setRequestFactory(httpRequestFactory); |
||||
|
|
||||
|
HttpHeaders httpHeaders = new HttpHeaders(); |
||||
|
String authStr = clientId.concat(":").concat(securet); |
||||
|
String authStrEnc = new String(Base64.encodeBase64(authStr.getBytes())); |
||||
|
httpHeaders.set("Authorization", "Basic ".concat(authStrEnc)); |
||||
|
|
||||
|
MultiValueMap<String, String> formData = new LinkedMultiValueMap(); |
||||
|
formData.add("grant_type", "client_credentials"); |
||||
|
formData.add("scope", "write"); |
||||
|
|
||||
|
HttpEntity httpEntity = new HttpEntity(formData, httpHeaders); |
||||
|
ResponseEntity<String> exchange = restTemplate.exchange(tokenUrl, HttpMethod.POST, httpEntity, String.class); |
||||
|
String respone = exchange.getBody(); |
||||
|
token = JSONObject.parseObject(respone).getString("access_token"); |
||||
|
return token; |
||||
|
} |
||||
|
|
||||
|
public static String checkSpeaker(MtSpeaker mtSpeaker, Map<String,String> mtParam) { |
||||
|
BestSignClient bestSignClient = new BestSignClient(); |
||||
|
log.info("checkSpeaker mtParam ==={}",mtParam); |
||||
|
|
||||
|
getToken(mtParam); |
||||
|
|
||||
|
Map<String, Object> map = new LinkedHashMap<>(); |
||||
|
map.put("devAccountId", mtSpeaker.getTel()); |
||||
|
map.put("account", mtSpeaker.getTel()); |
||||
|
map.put("name", mtSpeaker.getName()); |
||||
|
map.put("idCardNumber", mtSpeaker.getUid()); |
||||
|
|
||||
|
JSONObject json2 = new JSONObject(); |
||||
|
log.info("输出Json:{}",json2.toJSON(map).toString()); |
||||
|
log.info("输出Token:{}",accessToken); |
||||
|
|
||||
|
String requestData = bestSignClient.executeRequest(mtParam.get("BS_commitPerson"),accessToken,"POST",json2.toJSON(map).toString(),mtParam); |
||||
|
|
||||
|
return requestData; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 上传附件 |
||||
|
* @param sendMap |
||||
|
* @param mtParam |
||||
|
* @return |
||||
|
*/ |
||||
|
public static String upMtListFile(Map<String,String> sendMap, Map<String,String> mtParam,List<String> efiles) { |
||||
|
BestSignClient bestSignClient = new BestSignClient(); |
||||
|
log.info("upMtListFile mtParam ==={}",sendMap); |
||||
|
log.info("upMtListFile mtParam ==={}",mtParam); |
||||
|
String token = getHLYToken(mtParam); |
||||
|
|
||||
|
JSONObject json2 = new JSONObject(); |
||||
|
log.info("输出Json:{}",json2.toJSON(sendMap).toString()); |
||||
|
log.info("输出Token:{}",token); |
||||
|
|
||||
|
String requestData = bestSignClient.executeRequestFile(mtParam.get("HLY_upMFiles"),token,"POST",sendMap,mtParam,efiles); |
||||
|
|
||||
|
return requestData; |
||||
|
} |
||||
|
public static void main(String[] args){ |
||||
|
Map<String,String> mtParam = new HashMap<>(); |
||||
|
mtParam.put("HLY_clientId","9f93d113-eb0e-437f-811d-509562bca337"); |
||||
|
mtParam.put("HLY_accessKey","ZDgzYzZiZGItNjRmNi00MGMzLThhZjItNmU5ODE2MTBjNTc2"); |
||||
|
mtParam.put("HLY_getToken","https://api.huilianyi.com/gateway/oauth/token"); |
||||
|
String clientId = mtParam.get("HLY_clientId");//"e8ee586f-f3ff-46c4-bb27-e82e166ccfbd";//需要替换
|
||||
|
String securet = mtParam.get("HLY_accessKey");//"ZmFmYTVjYTYtMDNlMS00MjRiLWI1YTYtMWJiMDc4OGFmODc0";//需要替换
|
||||
|
String tokenUrl = mtParam.get("HLY_getToken");//"https://api.huilianyi.com/gateway/oauth/token";//需要替换
|
||||
|
String token = getHLYToken(mtParam); |
||||
|
System.out.println(token); |
||||
|
/*Map<String,String> sendMap = new HashMap<>(); |
||||
|
sendMap.put("businessCode","EA04311758"); |
||||
|
sendMap.put("entityType","1001"); |
||||
|
sendMap.put("operatorEmployeeId","H022"); |
||||
|
sendMap.put("attachmentIds","11"); |
||||
|
Map<String,String> mtParam = new HashMap<>(); |
||||
|
mtParam.put("BS_clientId","1655448202011557709"); |
||||
|
mtParam.put("BS_accessKey","7f70b20632fb44488ddd7a53724caed6"); |
||||
|
mtParam.put("BS_host","https://api.huilianyi.com/gateway"); |
||||
|
mtParam.put("BS_getToken","/gateway/oauth/token"); |
||||
|
mtParam.put("BS_privateKey","MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCP3acgKKSrFlQDH00xl8yKiMNmBlguVX517M06QmxvrOwqJQB04H1WRiBHX4b08wVsABkLzLG+v8bt+/CqzXn4aK8U1i3NzEBnXmAiygFL/eH3Tq3vQU4AOrC/LKXs6GjJWW/7lp3YQy6uqAAvG0DOV5UgYdsiTMM2NSCciyyux0hnBkm64a28aTHATvxXGIjqyV5gST8tXtN6r4cf1YvoUwdDGjwX2D6z96mTISQYr4FYdZ1HG1YKfjK1wHUDOHgedwRC/9jgcjyYUD6jtrLl/q+fJKiLkUCDCvM1BHl+BP71ACssStUk4Y2vGDYjP2rPxiRUdd+iF3RqzmLwgqBzAgMBAAECggEAc3brZoUYPHQsM2FQ/EegE2PWp7DZ3z4gxBatVF/xVeQMm3qdFjECh1a7G22RDFFr/ZVKhMzhr32N9H1rWDqX9QZX1rpbgru2yP/W2rUUO2Bllq5gLRFVwBtateTouu6BA3EzzlHBF8w70FPn6ebOqY1jk9zWGn5Pgtc6+Ek/MHpu197i+IyJvjN2Ll4vURzpqssnFpe09Y9+1XwWjSGJOb29yUHANsAKUA6e9L6jj27ynAdcj0AZVIvsNkJhZUv4QeVpNZ6LcsAv74s8DxnCqFp2SJfkbkNY7LtGXSrjvOXkTTKPSDLjMX2e3X5fvS41bMq91p7QruwAZkr+OvnjAQKBgQDHnb5goLv89B95lTSs56Z85faWD2VV3/jdPo+dXiIOx1fP5kqcEZkzKAnuFefQ0iSfH3NpHqfCIZm5THsKlobAXVs/U0u0sDGhzj/sGQ5sW9vnaQ2AOzBhwlKKUEiPzCcG85KUxuZ5mxsnGZPJqeJ9+kwCMlSA4dwqTNKVtKH88wKBgQC4gJkmyNdfwLREJPzvPgPW4dmSkh+0a8Lo/yau1eTZKaZNxTD1TAEBRtd69yPDUFeayOgnEo+yUNEKnN+KhOzfpl7ngu6YBt10lGd0IJOo+XBiLJHZkd/3ZOS5MnHDrzihaUf0Epf0qssxaBFlRyZ4VQuop+Hl3sTOLpy91HeugQKBgQCAwFcN/j6ijldK1ZkvOQ8imjUtXurOs/LRyUtahl/TRnJ2LyTKe3NkEpwtC8YE47YpSGDpWZN83K1JXnIyRxrNMqnrM2+uMMMiiWSjhRnPfIRfQ1wo7IRtWahhfB0BWv2FN0/BVHVN1GR0GMRBG6lx9iJWfF4S7xtR0VE2rFabTwKBgQCEu59yk5K+RDhrveBpjUfd02VfWNiOR+hVDxqZNTAKOzh1QqPSFPe0H27t+9YysR4VMOwzD9tpAVMiO3FmifKPg3VLQJq9rFKtiAZVOQqBydHcDwxuZc+mf2M9CNlnWit3k/I72RSQ5D6CMMgzAFjgwO4+S2jsorMbUdVZi/z+AQKBgQCZ1etliFSDLQZKlxiLw03LKMxpKohJdySrWWJS9rhIi36ns8LQWez3VsSUgzJqvH7IytMjNicrhs0nTjHklS1a891034+IfgCe80fVrwTuDS7JqYLcIYmL9Q/YXBPtwN2ERTz7Jx6UMVup0W1ckkvINIFukgoxxhyRd3M2MkA3lA=="); |
||||
|
mtParam.put("BS_upMFiles","/zuul/api/open/attachment/upload/bill/attachments"); |
||||
|
List<String> fileStr = new JsonArray<>(); |
||||
|
fileStr.add("D:\\home\\image\\pdf\\1.jpg"); |
||||
|
String str = SignInterface.upMtListFile(sendMap,mtParam,fileStr);*/ |
||||
|
// File f = new File("D:\\home\\image\\pdf\\1.jpg");
|
||||
|
// System.out.println(f.getName());
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,262 @@ |
|||||
|
package com.cmsen.ticket.domain.collect.entity; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 采集公司(CollectCompany)实体类 |
||||
|
* |
||||
|
* @author makejava |
||||
|
* @since 2023-10-17 21:23:18 |
||||
|
*/ |
||||
|
public class CollectCompany implements Serializable { |
||||
|
private static final long serialVersionUID = -11625057281167246L; |
||||
|
/** |
||||
|
* UUID |
||||
|
*/ |
||||
|
private String id; |
||||
|
/** |
||||
|
* 公司名称 |
||||
|
*/ |
||||
|
private String companyName; |
||||
|
/** |
||||
|
* 税号 |
||||
|
*/ |
||||
|
private String taxNo; |
||||
|
/** |
||||
|
* 扩展1 |
||||
|
*/ |
||||
|
private String ext1; |
||||
|
/** |
||||
|
* 扩展2 |
||||
|
*/ |
||||
|
private String ext2; |
||||
|
/** |
||||
|
* 扩展3 |
||||
|
*/ |
||||
|
private String ext3; |
||||
|
/** |
||||
|
* 扩展4 |
||||
|
*/ |
||||
|
private String ext4; |
||||
|
/** |
||||
|
* 扩展5 |
||||
|
*/ |
||||
|
private String ext5; |
||||
|
/** |
||||
|
* 扩展6 |
||||
|
*/ |
||||
|
private String ext6; |
||||
|
/** |
||||
|
* 扩展7 |
||||
|
*/ |
||||
|
private String ext7; |
||||
|
/** |
||||
|
* 扩展8 |
||||
|
*/ |
||||
|
private String ext8; |
||||
|
/** |
||||
|
* 扩展9 |
||||
|
*/ |
||||
|
private String ext9; |
||||
|
/** |
||||
|
* 扩展10 |
||||
|
*/ |
||||
|
private String ext10; |
||||
|
/** |
||||
|
* 是否可用 |
||||
|
*/ |
||||
|
private String delFlag; |
||||
|
/** |
||||
|
* 创建者 |
||||
|
*/ |
||||
|
private String createBy; |
||||
|
/** |
||||
|
* 修改时间 |
||||
|
*/ |
||||
|
private Date updateDate; |
||||
|
/** |
||||
|
* 修改者 |
||||
|
*/ |
||||
|
private String updateBy; |
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createDate; |
||||
|
/** |
||||
|
* 备注信息 |
||||
|
*/ |
||||
|
private String remarks; |
||||
|
private String pageNo; |
||||
|
private String pageSize; |
||||
|
|
||||
|
public String getPageNo() { |
||||
|
return pageNo; |
||||
|
} |
||||
|
|
||||
|
public void setPageNo(String pageNo) { |
||||
|
this.pageNo = pageNo; |
||||
|
} |
||||
|
|
||||
|
public String getPageSize() { |
||||
|
return pageSize; |
||||
|
} |
||||
|
|
||||
|
public void setPageSize(String pageSize) { |
||||
|
this.pageSize = pageSize; |
||||
|
} |
||||
|
|
||||
|
public String getId() { |
||||
|
return id; |
||||
|
} |
||||
|
|
||||
|
public void setId(String id) { |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
public String getCompanyName() { |
||||
|
return companyName; |
||||
|
} |
||||
|
|
||||
|
public void setCompanyName(String companyName) { |
||||
|
this.companyName = companyName; |
||||
|
} |
||||
|
|
||||
|
public String getTaxNo() { |
||||
|
return taxNo; |
||||
|
} |
||||
|
|
||||
|
public void setTaxNo(String taxNo) { |
||||
|
this.taxNo = taxNo; |
||||
|
} |
||||
|
|
||||
|
public String getExt1() { |
||||
|
return ext1; |
||||
|
} |
||||
|
|
||||
|
public void setExt1(String ext1) { |
||||
|
this.ext1 = ext1; |
||||
|
} |
||||
|
|
||||
|
public String getExt2() { |
||||
|
return ext2; |
||||
|
} |
||||
|
|
||||
|
public void setExt2(String ext2) { |
||||
|
this.ext2 = ext2; |
||||
|
} |
||||
|
|
||||
|
public String getExt3() { |
||||
|
return ext3; |
||||
|
} |
||||
|
|
||||
|
public void setExt3(String ext3) { |
||||
|
this.ext3 = ext3; |
||||
|
} |
||||
|
|
||||
|
public String getExt4() { |
||||
|
return ext4; |
||||
|
} |
||||
|
|
||||
|
public void setExt4(String ext4) { |
||||
|
this.ext4 = ext4; |
||||
|
} |
||||
|
|
||||
|
public String getExt5() { |
||||
|
return ext5; |
||||
|
} |
||||
|
|
||||
|
public void setExt5(String ext5) { |
||||
|
this.ext5 = ext5; |
||||
|
} |
||||
|
|
||||
|
public String getExt6() { |
||||
|
return ext6; |
||||
|
} |
||||
|
|
||||
|
public void setExt6(String ext6) { |
||||
|
this.ext6 = ext6; |
||||
|
} |
||||
|
|
||||
|
public String getExt7() { |
||||
|
return ext7; |
||||
|
} |
||||
|
|
||||
|
public void setExt7(String ext7) { |
||||
|
this.ext7 = ext7; |
||||
|
} |
||||
|
|
||||
|
public String getExt8() { |
||||
|
return ext8; |
||||
|
} |
||||
|
|
||||
|
public void setExt8(String ext8) { |
||||
|
this.ext8 = ext8; |
||||
|
} |
||||
|
|
||||
|
public String getExt9() { |
||||
|
return ext9; |
||||
|
} |
||||
|
|
||||
|
public void setExt9(String ext9) { |
||||
|
this.ext9 = ext9; |
||||
|
} |
||||
|
|
||||
|
public String getExt10() { |
||||
|
return ext10; |
||||
|
} |
||||
|
|
||||
|
public void setExt10(String ext10) { |
||||
|
this.ext10 = ext10; |
||||
|
} |
||||
|
|
||||
|
public String getDelFlag() { |
||||
|
return delFlag; |
||||
|
} |
||||
|
|
||||
|
public void setDelFlag(String delFlag) { |
||||
|
this.delFlag = delFlag; |
||||
|
} |
||||
|
|
||||
|
public String getCreateBy() { |
||||
|
return createBy; |
||||
|
} |
||||
|
|
||||
|
public void setCreateBy(String createBy) { |
||||
|
this.createBy = createBy; |
||||
|
} |
||||
|
|
||||
|
public Date getUpdateDate() { |
||||
|
return updateDate; |
||||
|
} |
||||
|
|
||||
|
public void setUpdateDate(Date updateDate) { |
||||
|
this.updateDate = updateDate; |
||||
|
} |
||||
|
|
||||
|
public String getUpdateBy() { |
||||
|
return updateBy; |
||||
|
} |
||||
|
|
||||
|
public void setUpdateBy(String updateBy) { |
||||
|
this.updateBy = updateBy; |
||||
|
} |
||||
|
|
||||
|
public Date getCreateDate() { |
||||
|
return createDate; |
||||
|
} |
||||
|
|
||||
|
public void setCreateDate(Date createDate) { |
||||
|
this.createDate = createDate; |
||||
|
} |
||||
|
|
||||
|
public String getRemarks() { |
||||
|
return remarks; |
||||
|
} |
||||
|
|
||||
|
public void setRemarks(String remarks) { |
||||
|
this.remarks = remarks; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
@ -0,0 +1,322 @@ |
|||||
|
package com.cmsen.ticket.domain.collect.entity; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 采集任务(CollectTask)实体类 |
||||
|
* |
||||
|
* @author makejava |
||||
|
* @since 2023-10-17 21:48:44 |
||||
|
*/ |
||||
|
public class CollectTask implements Serializable { |
||||
|
private static final long serialVersionUID = 685122192985236622L; |
||||
|
/** |
||||
|
* UUID |
||||
|
*/ |
||||
|
private String id; |
||||
|
/** |
||||
|
* 开始日期 |
||||
|
*/ |
||||
|
private String startDate; |
||||
|
/** |
||||
|
* 结束日期 |
||||
|
*/ |
||||
|
private String endDate; |
||||
|
/** |
||||
|
* 归集类型 |
||||
|
*/ |
||||
|
private String collectType; |
||||
|
/** |
||||
|
* 税号 |
||||
|
*/ |
||||
|
private String taxNo; |
||||
|
/** |
||||
|
* 归集号 |
||||
|
*/ |
||||
|
private String collectData; |
||||
|
/** |
||||
|
* 业务号 |
||||
|
*/ |
||||
|
private String serialNo; |
||||
|
/** |
||||
|
* 是否下载 |
||||
|
*/ |
||||
|
private String downFlag; |
||||
|
/** |
||||
|
* 是否可用 |
||||
|
*/ |
||||
|
private String delFlag; |
||||
|
/** |
||||
|
* 扩展1 |
||||
|
*/ |
||||
|
private String ext1; |
||||
|
/** |
||||
|
* 扩展2 |
||||
|
*/ |
||||
|
private String ext2; |
||||
|
/** |
||||
|
* 扩展3 |
||||
|
*/ |
||||
|
private String ext3; |
||||
|
/** |
||||
|
* 扩展4 |
||||
|
*/ |
||||
|
private String ext4; |
||||
|
/** |
||||
|
* 扩展5 |
||||
|
*/ |
||||
|
private String ext5; |
||||
|
/** |
||||
|
* 扩展6 |
||||
|
*/ |
||||
|
private String ext6; |
||||
|
/** |
||||
|
* 扩展7 |
||||
|
*/ |
||||
|
private String ext7; |
||||
|
/** |
||||
|
* 扩展8 |
||||
|
*/ |
||||
|
private String ext8; |
||||
|
/** |
||||
|
* 扩展9 |
||||
|
*/ |
||||
|
private String ext9; |
||||
|
/** |
||||
|
* 扩展10 |
||||
|
*/ |
||||
|
private String ext10; |
||||
|
/** |
||||
|
* 创建者 |
||||
|
*/ |
||||
|
private String createBy; |
||||
|
/** |
||||
|
* 修改时间 |
||||
|
*/ |
||||
|
private Date updateDate; |
||||
|
/** |
||||
|
* 修改者 |
||||
|
*/ |
||||
|
private String updateBy; |
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createDate; |
||||
|
/** |
||||
|
* 备注信息 |
||||
|
*/ |
||||
|
private String remarks; |
||||
|
private String pageNo; |
||||
|
private String pageSize; |
||||
|
|
||||
|
public String getPageNo() { |
||||
|
return pageNo; |
||||
|
} |
||||
|
|
||||
|
public void setPageNo(String pageNo) { |
||||
|
this.pageNo = pageNo; |
||||
|
} |
||||
|
|
||||
|
public String getPageSize() { |
||||
|
return pageSize; |
||||
|
} |
||||
|
|
||||
|
public void setPageSize(String pageSize) { |
||||
|
this.pageSize = pageSize; |
||||
|
} |
||||
|
|
||||
|
public String getId() { |
||||
|
return id; |
||||
|
} |
||||
|
|
||||
|
public void setId(String id) { |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
public String getStartDate() { |
||||
|
return startDate; |
||||
|
} |
||||
|
|
||||
|
public void setStartDate(String startDate) { |
||||
|
this.startDate = startDate; |
||||
|
} |
||||
|
|
||||
|
public String getEndDate() { |
||||
|
return endDate; |
||||
|
} |
||||
|
|
||||
|
public void setEndDate(String endDate) { |
||||
|
this.endDate = endDate; |
||||
|
} |
||||
|
|
||||
|
public String getCollectType() { |
||||
|
return collectType; |
||||
|
} |
||||
|
|
||||
|
public void setCollectType(String collectType) { |
||||
|
this.collectType = collectType; |
||||
|
} |
||||
|
|
||||
|
public String getTaxNo() { |
||||
|
return taxNo; |
||||
|
} |
||||
|
|
||||
|
public void setTaxNo(String taxNo) { |
||||
|
this.taxNo = taxNo; |
||||
|
} |
||||
|
|
||||
|
public String getCollectData() { |
||||
|
return collectData; |
||||
|
} |
||||
|
|
||||
|
public void setCollectData(String collectData) { |
||||
|
this.collectData = collectData; |
||||
|
} |
||||
|
|
||||
|
public String getSerialNo() { |
||||
|
return serialNo; |
||||
|
} |
||||
|
|
||||
|
public void setSerialNo(String serialNo) { |
||||
|
this.serialNo = serialNo; |
||||
|
} |
||||
|
|
||||
|
public String getDownFlag() { |
||||
|
return downFlag; |
||||
|
} |
||||
|
|
||||
|
public void setDownFlag(String downFlag) { |
||||
|
this.downFlag = downFlag; |
||||
|
} |
||||
|
|
||||
|
public String getDelFlag() { |
||||
|
return delFlag; |
||||
|
} |
||||
|
|
||||
|
public void setDelFlag(String delFlag) { |
||||
|
this.delFlag = delFlag; |
||||
|
} |
||||
|
|
||||
|
public String getExt1() { |
||||
|
return ext1; |
||||
|
} |
||||
|
|
||||
|
public void setExt1(String ext1) { |
||||
|
this.ext1 = ext1; |
||||
|
} |
||||
|
|
||||
|
public String getExt2() { |
||||
|
return ext2; |
||||
|
} |
||||
|
|
||||
|
public void setExt2(String ext2) { |
||||
|
this.ext2 = ext2; |
||||
|
} |
||||
|
|
||||
|
public String getExt3() { |
||||
|
return ext3; |
||||
|
} |
||||
|
|
||||
|
public void setExt3(String ext3) { |
||||
|
this.ext3 = ext3; |
||||
|
} |
||||
|
|
||||
|
public String getExt4() { |
||||
|
return ext4; |
||||
|
} |
||||
|
|
||||
|
public void setExt4(String ext4) { |
||||
|
this.ext4 = ext4; |
||||
|
} |
||||
|
|
||||
|
public String getExt5() { |
||||
|
return ext5; |
||||
|
} |
||||
|
|
||||
|
public void setExt5(String ext5) { |
||||
|
this.ext5 = ext5; |
||||
|
} |
||||
|
|
||||
|
public String getExt6() { |
||||
|
return ext6; |
||||
|
} |
||||
|
|
||||
|
public void setExt6(String ext6) { |
||||
|
this.ext6 = ext6; |
||||
|
} |
||||
|
|
||||
|
public String getExt7() { |
||||
|
return ext7; |
||||
|
} |
||||
|
|
||||
|
public void setExt7(String ext7) { |
||||
|
this.ext7 = ext7; |
||||
|
} |
||||
|
|
||||
|
public String getExt8() { |
||||
|
return ext8; |
||||
|
} |
||||
|
|
||||
|
public void setExt8(String ext8) { |
||||
|
this.ext8 = ext8; |
||||
|
} |
||||
|
|
||||
|
public String getExt9() { |
||||
|
return ext9; |
||||
|
} |
||||
|
|
||||
|
public void setExt9(String ext9) { |
||||
|
this.ext9 = ext9; |
||||
|
} |
||||
|
|
||||
|
public String getExt10() { |
||||
|
return ext10; |
||||
|
} |
||||
|
|
||||
|
public void setExt10(String ext10) { |
||||
|
this.ext10 = ext10; |
||||
|
} |
||||
|
|
||||
|
public String getCreateBy() { |
||||
|
return createBy; |
||||
|
} |
||||
|
|
||||
|
public void setCreateBy(String createBy) { |
||||
|
this.createBy = createBy; |
||||
|
} |
||||
|
|
||||
|
public Date getUpdateDate() { |
||||
|
return updateDate; |
||||
|
} |
||||
|
|
||||
|
public void setUpdateDate(Date updateDate) { |
||||
|
this.updateDate = updateDate; |
||||
|
} |
||||
|
|
||||
|
public String getUpdateBy() { |
||||
|
return updateBy; |
||||
|
} |
||||
|
|
||||
|
public void setUpdateBy(String updateBy) { |
||||
|
this.updateBy = updateBy; |
||||
|
} |
||||
|
|
||||
|
public Date getCreateDate() { |
||||
|
return createDate; |
||||
|
} |
||||
|
|
||||
|
public void setCreateDate(Date createDate) { |
||||
|
this.createDate = createDate; |
||||
|
} |
||||
|
|
||||
|
public String getRemarks() { |
||||
|
return remarks; |
||||
|
} |
||||
|
|
||||
|
public void setRemarks(String remarks) { |
||||
|
this.remarks = remarks; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
@ -0,0 +1,55 @@ |
|||||
|
package com.cmsen.ticket.domain.collect.service; |
||||
|
|
||||
|
import com.cmsen.ticket.domain.collect.entity.CollectCompany; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 采集公司(CollectCompany)表服务接口 |
||||
|
* |
||||
|
* @author makejava |
||||
|
* @since 2023-10-17 21:23:26 |
||||
|
*/ |
||||
|
public interface CollectCompanyService { |
||||
|
|
||||
|
/** |
||||
|
* 通过ID查询单条数据 |
||||
|
* |
||||
|
* @param id 主键 |
||||
|
* @return 实例对象 |
||||
|
*/ |
||||
|
CollectCompany queryById(String id); |
||||
|
|
||||
|
/** |
||||
|
* 分页查询 |
||||
|
* |
||||
|
* @param collectCompany 筛选条件 |
||||
|
* @return 查询结果 |
||||
|
*/ |
||||
|
List<CollectCompany> queryByPage(CollectCompany collectCompany); |
||||
|
|
||||
|
/** |
||||
|
* 新增数据 |
||||
|
* |
||||
|
* @param collectCompany 实例对象 |
||||
|
* @return 实例对象 |
||||
|
*/ |
||||
|
CollectCompany insert(CollectCompany collectCompany); |
||||
|
|
||||
|
/** |
||||
|
* 修改数据 |
||||
|
* |
||||
|
* @param collectCompany 实例对象 |
||||
|
* @return 实例对象 |
||||
|
*/ |
||||
|
CollectCompany update(CollectCompany collectCompany); |
||||
|
|
||||
|
/** |
||||
|
* 通过主键删除数据 |
||||
|
* |
||||
|
* @param id 主键 |
||||
|
* @return 是否成功 |
||||
|
*/ |
||||
|
boolean deleteById(String id); |
||||
|
|
||||
|
} |
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue