diff --git a/jianshui-admin/src/main/java/com/jianshui/web/controller/sandbox/IndexController.java b/jianshui-admin/src/main/java/com/jianshui/web/controller/sandbox/IndexController.java index 68f44c9..a63ea54 100644 --- a/jianshui-admin/src/main/java/com/jianshui/web/controller/sandbox/IndexController.java +++ b/jianshui-admin/src/main/java/com/jianshui/web/controller/sandbox/IndexController.java @@ -22,7 +22,12 @@ public class IndexController { public AjaxResult encrypt(@RequestBody JSONObject requestBody) { String key = requestBody.getString("key"); String order = requestBody.getString("order"); - String encryptTest = InvoiceEncryptUtil.encrypt(order, key); - return AjaxResult.success("success", encryptTest); + try { + String encryptTest = InvoiceEncryptUtil.encrypt(order, key); + return AjaxResult.success("success", encryptTest); + }catch (Exception e){ + return AjaxResult.error(e.getMessage()); + } + } } diff --git a/jianshui-admin/src/main/java/com/jianshui/web/controller/system/CompanyserviceController.java b/jianshui-admin/src/main/java/com/jianshui/web/controller/system/CompanyserviceController.java index 0314c1c..8de2d7a 100644 --- a/jianshui-admin/src/main/java/com/jianshui/web/controller/system/CompanyserviceController.java +++ b/jianshui-admin/src/main/java/com/jianshui/web/controller/system/CompanyserviceController.java @@ -3,7 +3,9 @@ package com.jianshui.web.controller.system; import java.util.List; import javax.servlet.http.HttpServletResponse; +import com.jianshui.common.constant.RebackType; import com.jianshui.common.core.domain.entity.Companyservice; +import org.apache.commons.lang3.StringUtils; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -56,6 +58,7 @@ public class CompanyserviceController extends BaseController public void export(HttpServletResponse response, Companyservice companyservice) { List list = companyserviceService.selectCompanyserviceList(companyservice); + list.forEach(e -> e.setRebackType(RebackType.getRebackType(e.getRebackType()))); ExcelUtil util = new ExcelUtil(Companyservice.class); util.exportExcel(response, list, "销方信息数据"); } @@ -78,6 +81,12 @@ public class CompanyserviceController extends BaseController @PostMapping public AjaxResult add(@RequestBody Companyservice companyservice) { + if (StringUtils.isBlank(companyservice.getSellertax())){ + return toAjax("企业税号不能为空",false); + } + if (StringUtils.isBlank(companyservice.getSellername())){ + return toAjax("企业名称不能为空",false); + } return toAjax(companyserviceService.insertCompanyservice(companyservice)); } @@ -89,6 +98,13 @@ public class CompanyserviceController extends BaseController @PutMapping public AjaxResult edit(@RequestBody Companyservice companyservice) { + if (StringUtils.isBlank(companyservice.getSellertax())){ + return toAjax("企业税号不能为空",false); + } + if (StringUtils.isBlank(companyservice.getSellername())){ + return toAjax("企业名称不能为空",false); + } + return toAjax(companyserviceService.updateCompanyservice(companyservice)); } diff --git a/jianshui-common/src/main/java/com/jianshui/common/constant/RebackType.java b/jianshui-common/src/main/java/com/jianshui/common/constant/RebackType.java new file mode 100644 index 0000000..e3f8870 --- /dev/null +++ b/jianshui-common/src/main/java/com/jianshui/common/constant/RebackType.java @@ -0,0 +1,32 @@ +package com.jianshui.common.constant; + +public enum RebackType { + REBACK_TYPE_1("1", "系统推送"), + REBACK_TYPE_2("2", "SAP推送"), + REBACK_TYPE_3("3", "数据回写"); + + private String rebackTypeCode; + private String rebackTypeMsg; + + RebackType(String rebackTypeCode, String rebackTypeMsg){ + this.rebackTypeCode = rebackTypeCode; + this.rebackTypeMsg = rebackTypeMsg; + } + + public String getRebackTypeMsg(){ + return rebackTypeMsg; + } + + public String getrebackTypeCode(){ + return rebackTypeCode; + } + + public static String getRebackType(String code){ + for(RebackType rebackType : RebackType.values()){ + if(rebackType.getrebackTypeCode().equals(code)){ + return rebackType.getRebackTypeMsg(); + } + } + return "未知回调方式"; + } +} diff --git a/jianshui-common/src/main/java/com/jianshui/common/constant/ServiceMode.java b/jianshui-common/src/main/java/com/jianshui/common/constant/ServiceMode.java new file mode 100644 index 0000000..a917caa --- /dev/null +++ b/jianshui-common/src/main/java/com/jianshui/common/constant/ServiceMode.java @@ -0,0 +1,32 @@ +package com.jianshui.common.constant; + +public enum ServiceMode { + SERVICE_MODE_0("0", "免费"), + SERVICE_MODE_1("1", "预付费"), + SERVICE_MODE_2("2", "定期结算"); + + private String serviceModeCode; + private String serviceModeMsg; + + ServiceMode(String serviceModeCode, String serviceModeMsg){ + this.serviceModeCode = serviceModeCode; + this.serviceModeMsg = serviceModeMsg; + } + + public String getServiceModeMsg(){ + return serviceModeMsg; + } + + public String getServiceModeCode(){ + return serviceModeCode; + } + + public static String getRebackType(String code){ + for(ServiceMode rebackType : ServiceMode.values()){ + if(rebackType.getServiceModeCode().equals(code)){ + return rebackType.getServiceModeMsg(); + } + } + return "未知服务模式"; + } +} diff --git a/jianshui-common/src/main/java/com/jianshui/common/core/controller/BaseController.java b/jianshui-common/src/main/java/com/jianshui/common/core/controller/BaseController.java index 11efeef..0a79d81 100644 --- a/jianshui-common/src/main/java/com/jianshui/common/core/controller/BaseController.java +++ b/jianshui-common/src/main/java/com/jianshui/common/core/controller/BaseController.java @@ -143,6 +143,17 @@ public class BaseController return result ? success() : error(); } + /** + * 响应返回结果 + * + * @param msg 返回信息 + * @return 操作结果 + */ + protected AjaxResult toAjax(String msg, boolean result) + { + return result ? AjaxResult.success(msg) : AjaxResult.error(msg); + } + /** * 页面跳转 */ diff --git a/jianshui-common/src/main/java/com/jianshui/common/core/domain/entity/Companyservice.java b/jianshui-common/src/main/java/com/jianshui/common/core/domain/entity/Companyservice.java index b31aa2d..5058931 100644 --- a/jianshui-common/src/main/java/com/jianshui/common/core/domain/entity/Companyservice.java +++ b/jianshui-common/src/main/java/com/jianshui/common/core/domain/entity/Companyservice.java @@ -20,6 +20,7 @@ public class Companyservice { /** * 企业编号 */ + @Excel(name = "企业编号") private Long companyid; /** @@ -99,7 +100,7 @@ public class Companyservice { * 回写方式 */ @Excel(name = "回写方式") - private Long rebackType; + private String rebackType; /** 分机号 */ // @Excel(name = "分机号") @@ -281,11 +282,11 @@ public class Companyservice { this.rebackurl = rebackurl; } - public Long getRebackType() { + public String getRebackType() { return rebackType; } - public void setRebackType(Long rebackType) { + public void setRebackType(String rebackType) { this.rebackType = rebackType; } diff --git a/jianshui-common/src/main/java/com/jianshui/common/utils/encrypt/InvoiceEncryptUtil.java b/jianshui-common/src/main/java/com/jianshui/common/utils/encrypt/InvoiceEncryptUtil.java index ca2e2d6..7cab596 100644 --- a/jianshui-common/src/main/java/com/jianshui/common/utils/encrypt/InvoiceEncryptUtil.java +++ b/jianshui-common/src/main/java/com/jianshui/common/utils/encrypt/InvoiceEncryptUtil.java @@ -174,6 +174,10 @@ public class InvoiceEncryptUtil { buf = decoder.decodeBuffer(encryptKey); } catch (IOException e) { e.printStackTrace(); + throw new RuntimeException("加密key处理失败"); + } + if (buf != null && buf.length < 16) { + throw new RuntimeException("加密key长度不够"); } // 前8位为key int i; diff --git a/jianshui-invoice/src/main/java/com/jianshui/invoice/domain/BillInfo.java b/jianshui-invoice/src/main/java/com/jianshui/invoice/domain/BillInfo.java index debee40..5ca0f53 100644 --- a/jianshui-invoice/src/main/java/com/jianshui/invoice/domain/BillInfo.java +++ b/jianshui-invoice/src/main/java/com/jianshui/invoice/domain/BillInfo.java @@ -159,7 +159,7 @@ public class BillInfo extends BaseEntity private String tsfs; /** 清单标志 */ - @Excel(name = "清单标志") + @Excel(name = "清单标志 1清单0非清单") private String qdbz; /** 清单项目名称 */ @@ -167,17 +167,20 @@ public class BillInfo extends BaseEntity private String qdxmmc; /** 代开标志 */ - @Excel(name = "代开标志") + @Excel(name = "代开标志 0 非代开 1 代开") private String dkbz; /** 成品油标志 */ - @Excel(name = "成品油标志") + @Excel(name = "成品油标志 0 非成品油 1 成品油") private String cpybz; /** 开票状态 */ - @Excel(name = "开票状态") + private Integer state; + @Excel(name = "开票状态") + private String billState; + /** 订单来源 */ @Excel(name = "订单来源") private String source; @@ -1327,10 +1330,20 @@ public class BillInfo extends BaseEntity this.state = state; } + public void setBillState(String billState) + { + this.billState = billState; + } + public Integer getState() { return state; } + + public String getBillState() + { + return billState; + } public void setSource(String source) { this.source = source; diff --git a/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/BillInfoServiceImpl.java b/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/BillInfoServiceImpl.java index b8b2fc6..2f1da8e 100644 --- a/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/BillInfoServiceImpl.java +++ b/jianshui-invoice/src/main/java/com/jianshui/invoice/service/impl/BillInfoServiceImpl.java @@ -1,11 +1,11 @@ package com.jianshui.invoice.service.impl; -import java.util.Arrays; -import java.util.List; +import java.util.*; import cn.hutool.core.collection.CollectionUtil; import com.alibaba.fastjson.JSONObject; import com.jianshui.common.core.domain.AjaxResult; +import com.jianshui.common.core.domain.entity.SysDictData; import com.jianshui.common.utils.DateUtils; import com.jianshui.common.utils.DictUtils; import com.jianshui.common.utils.spring.SpringUtils; @@ -15,12 +15,11 @@ import com.jianshui.invoice.mapper.InvoiceMapper; import com.jianshui.queue.consumer.RedisQueueConsumer; import com.jianshui.queue.dto.RedisQueueMessage; import com.jianshui.queue.utils.RedisQueueUtil; +import com.jianshui.system.service.ISysDictTypeService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; - import com.jianshui.common.utils.StringUtils; import org.springframework.transaction.annotation.Transactional; import com.jianshui.invoice.domain.BillDetail; @@ -43,6 +42,9 @@ public class BillInfoServiceImpl implements IBillInfoService { @Autowired private InvoiceMapper invoiceMapper; + @Autowired + private ISysDictTypeService dictTypeService; + /** * 查询开票信息 * @@ -62,7 +64,63 @@ public class BillInfoServiceImpl implements IBillInfoService { */ @Override public List selectBillInfoList(BillInfo billInfo) { - return billInfoMapper.selectBillInfoList(billInfo); + + List billInfos = billInfoMapper.selectBillInfoList(billInfo); + + if (CollectionUtil.isNotEmpty(billInfos)) { + + Map invoiceTypeDictMap = new HashMap<>(); ; + + List invoiceTypeData = dictTypeService.selectDictDataByType("invoice_type"); + + if (CollectionUtil.isNotEmpty(invoiceTypeData)){ + invoiceTypeData.forEach(e->invoiceTypeDictMap.put(e.getDictValue(),e.getDictLabel())); + } + + Map billTypeDictMap = new HashMap<>(); ; + + List billTypeData = dictTypeService.selectDictDataByType("bill_type"); + + if (CollectionUtil.isNotEmpty(billTypeData)){ + billTypeData.forEach(e->billTypeDictMap.put(e.getDictValue(),e.getDictLabel())); + } + + Map invocieStatusDictMap = new HashMap<>(); ; + + List invocieStatusData = dictTypeService.selectDictDataByType("invoice_status"); + + if (CollectionUtil.isNotEmpty(invocieStatusData)){ + invocieStatusData.forEach(e->invocieStatusDictMap.put(e.getDictValue(),e.getDictLabel())); + } + + Map tsfsDictMap = new HashMap<>(); ; + + List tsfsData = dictTypeService.selectDictDataByType("tsfs"); + + if (CollectionUtil.isNotEmpty(tsfsData)){ + tsfsData.forEach(e->tsfsDictMap.put(e.getDictValue(),e.getDictLabel())); + } + + Map sourceDictMap = new HashMap<>(); ; + + List sourceData = dictTypeService.selectDictDataByType("source"); + + if (CollectionUtil.isNotEmpty(sourceData)){ + sourceData.forEach(e->sourceDictMap.put(e.getDictValue(),e.getDictLabel())); + } + + + + + for (BillInfo bill : billInfos) { + bill.setInvoiceType(invoiceTypeDictMap.get(bill.getInvoiceType())); + bill.setBillType(billTypeDictMap.get(bill.getBillType())); + bill.setBillState(invocieStatusDictMap.get(bill.getState()==null?"":bill.getState().toString())); + bill.setTsfs(tsfsDictMap.get(bill.getTsfs())); + bill.setSource(sourceDictMap.get(bill.getSource())); + } + } + return billInfos; } /** diff --git a/jianshui-system/src/main/java/com/jianshui/system/domain/ServiceManage.java b/jianshui-system/src/main/java/com/jianshui/system/domain/ServiceManage.java index 300701f..38872c2 100644 --- a/jianshui-system/src/main/java/com/jianshui/system/domain/ServiceManage.java +++ b/jianshui-system/src/main/java/com/jianshui/system/domain/ServiceManage.java @@ -21,15 +21,20 @@ public class ServiceManage extends BaseEntity private Long id; /** 企业ID */ + @Excel(name = "企业ID") private Long companyId; /** 服务类型 */ + @Excel(name = "服务类型") private String serviceKey; /** 服务状态 */ - @Excel(name = "服务状态") + private Integer state; + @Excel(name = "服务状态") + private String serviceState; + /** 请求报文类型 */ @Excel(name = "请求报文类型") private String requestMessageKey; @@ -87,10 +92,20 @@ public class ServiceManage extends BaseEntity this.state = state; } + public void setServiceState(String serviceState) + { + this.serviceState = serviceState; + } + public Integer getState() { return state; } + + public String getServiceState() + { + return serviceState; + } public void setRequestMessageKey(String requestMessageKey) { this.requestMessageKey = requestMessageKey; diff --git a/jianshui-system/src/main/java/com/jianshui/system/service/impl/ServiceManageServiceImpl.java b/jianshui-system/src/main/java/com/jianshui/system/service/impl/ServiceManageServiceImpl.java index dbf2d43..214a270 100644 --- a/jianshui-system/src/main/java/com/jianshui/system/service/impl/ServiceManageServiceImpl.java +++ b/jianshui-system/src/main/java/com/jianshui/system/service/impl/ServiceManageServiceImpl.java @@ -5,6 +5,7 @@ import java.util.Date; import java.util.List; import com.jianshui.common.constant.Constants; +import com.jianshui.common.constant.ServiceMode; import com.jianshui.common.core.domain.AjaxResult; import com.jianshui.common.core.redis.RedisCache; import com.jianshui.common.exception.jianshui.JianshuiNoServiceException; @@ -13,6 +14,7 @@ import com.jianshui.common.exception.jianshui.JianshuiServiceNoSurplusException; import com.jianshui.common.utils.DateUtils; import com.jianshui.common.utils.MessageUtils; import com.jianshui.common.utils.StringUtils; +import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.jianshui.system.mapper.ServiceManageMapper; @@ -54,7 +56,18 @@ public class ServiceManageServiceImpl implements IServiceManageService { */ @Override public List selectServiceManageList(ServiceManage serviceManage) { - return serviceManageMapper.selectServiceManageList(serviceManage); + + List serviceManages = serviceManageMapper.selectServiceManageList(serviceManage); + + for (ServiceManage manage : serviceManages) { + if (ObjectUtils.isNotEmpty(manage.getState())){ + manage.setServiceState("1".equals(manage.getState().toString())?"已启用":"已停用"); + } + if (StringUtils.isNotBlank(manage.getServiceMode())){ + manage.setServiceMode(ServiceMode.getRebackType(manage.getServiceMode())); + } + } + return serviceManages; } /** diff --git a/jianshui-system/src/main/resources/mapper/system/CompanyserviceMapper.xml b/jianshui-system/src/main/resources/mapper/system/CompanyserviceMapper.xml index 144609b..c2fabfe 100644 --- a/jianshui-system/src/main/resources/mapper/system/CompanyserviceMapper.xml +++ b/jianshui-system/src/main/resources/mapper/system/CompanyserviceMapper.xml @@ -66,7 +66,7 @@ and sellertax = #{sellertax} and sellername like concat('%', #{sellername}, '%') and phone = #{phone} - and reback_type = #{rebackType} + and reback_type = #{rebackType} @@ -106,7 +106,7 @@ identity, rebackurl, - reback_type, + reback_type, createtime, create_user, @@ -125,7 +125,7 @@ #{identity}, #{rebackurl}, - #{rebackType}, + #{rebackType}, #{createTime}, #{createUser}, @@ -149,7 +149,7 @@ rebackurl = #{rebackurl}, - reback_type = #{rebackType}, + reback_type = #{rebackType}, createtime = #{createTime}, diff --git a/jianshui-system/src/main/resources/mapper/system/ServiceManageMapper.xml b/jianshui-system/src/main/resources/mapper/system/ServiceManageMapper.xml index a4c7171..fec1cb6 100644 --- a/jianshui-system/src/main/resources/mapper/system/ServiceManageMapper.xml +++ b/jianshui-system/src/main/resources/mapper/system/ServiceManageMapper.xml @@ -42,6 +42,7 @@