implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-security'
+ implementation 'org.springframework.boot:spring-boot-starter-cache'
implementation 'org.springframework.security:spring-security-oauth2-client'
implementation 'org.springframework.security:spring-security-oauth2-jose'
implementation 'org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:2.1.5.RELEASE'
package com.supwisdom.dlpay;
-import com.supwisdom.dlpay.system.common.DictPool;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationReadyEvent;
-import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.EventListener;
//@Configuration
public class AppPreparedEvent {
- private final DictPool dictPool;
- public AppPreparedEvent(@Autowired DictPool dictPool) {
- this.dictPool = dictPool;
+ public AppPreparedEvent() {
+
}
@EventListener(ApplicationReadyEvent.class)
public void setupDictPool() {
- dictPool.init(); //初始化字典
}
}
package com.supwisdom.dlpay.api.domain;
+import com.supwisdom.dlpay.framework.domain.DictionaryTable;
+
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
+import java.io.Serializable;
/**
* Created by shuwei on 2019/4/9.
*/
@Entity
@Table(name = "TB_SOURCETYPE")
-public class TSourceType {
+public class TSourceType implements DictionaryTable, Serializable {
@Id
@Column(name = "SOURCETYPE", nullable = false, length = 20)
private String sourceType;
public void setTenantid(String tenantid) {
this.tenantid = tenantid;
}
+
+ @Override
+ public String getDictKey() {
+ return this.sourceType;
+ }
+
+ @Override
+ public Object getDictValue() {
+ return this.paydesc;
+ }
}
import com.supwisdom.dlpay.framework.domain.TDictionary;
import com.supwisdom.dlpay.framework.domain.TDictionaryPK;
+import org.springframework.cache.annotation.CacheConfig;
+import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface DictionaryDao extends JpaRepository<TDictionary, TDictionaryPK> {
- List<TDictionary> findAllByDicttype(int dicttype);
+ List<TDictionary> findAllByDicttype(String dicttype);
}
--- /dev/null
+package com.supwisdom.dlpay.framework.domain;
+
+public interface DictionaryTable {
+ String getDictKey();
+
+ Object getDictValue();
+}
import org.springframework.data.redis.core.RedisHash;
-@RedisHash("api_jwt")
+@RedisHash(value = "api_jwt", timeToLive = 3600L)
public class JwtRedis {
@Id
String jti;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
+import java.io.Serializable;
@Entity
@Table(name = "TB_DICTIONARY")
@IdClass(TDictionaryPK.class)
-public class TDictionary {
+public class TDictionary implements DictionaryTable, Serializable {
@Id
- @Column(name = "DICTTYPE", nullable = false, precision = 9)
- private Integer dicttype;
+ @Column(name = "DICTTYPE", nullable = false)
+ private String dicttype;
@Id
@Column(name = "DICTVAL", nullable = false, length = 30)
@NotNull
private String tenantId;
- public Integer getDicttype() {
+ public String getDicttype() {
return dicttype;
}
- public void setDicttype(Integer dicttype) {
+ public void setDicttype(String dicttype) {
this.dicttype = dicttype;
}
public void setDictcaption(String dictcaption) {
this.dictcaption = dictcaption;
}
+
+ @Override
+ public String getDictKey() {
+ return this.dictval;
+ }
+
+ @Override
+ public Object getDictValue() {
+ return this.dictcaption;
+ }
}
public class TDictionaryPK implements Serializable {
@Id
- @Column(name = "DICTTYPE", nullable = false, precision = 9)
- private Integer dicttype;
+ @Column(name = "DICTTYPE", nullable = false)
+ private String dicttype;
@Id
@Column(name = "DICTVAL", nullable = false, length = 30)
private String dictval;
- public Integer getDicttype() {
+ public String getDicttype() {
return dicttype;
}
- public void setDicttype(Integer dicttype) {
+ public void setDicttype(String dicttype) {
this.dicttype = dicttype;
}
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
+import java.io.Serializable;
@Entity
@Table(name = "TB_TRANSCODE")
-public class TTranscode {
+public class TTranscode implements DictionaryTable, Serializable {
@Id
@Column(name = "TRANSCODE", nullable = false, precision = 4)
private Integer transcode;
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
+
+ @Override
+ public String getDictKey() {
+ return String.valueOf(this.transcode);
+ }
+
+ @Override
+ public Object getDictValue() {
+ return this.transname;
+ }
}
--- /dev/null
+package com.supwisdom.dlpay.framework.util;
+
+public class Dictionary {
+ // dictionary 表字典
+ public static final String REVERSE_FLAG = "reverseflagList";
+ public static final String DTL_STATUS = "dtlStatusList";
+
+ /////////////////////////////////////
+ public static final String SOURCE_TYPE = "sourcetypeList";
+ public static final String TRANS_CODE = "transcodeList";
+ public static final String PAY_TYPE = "paytypelist";
+}
+++ /dev/null
-package com.supwisdom.dlpay.system.common;
-
-import com.supwisdom.dlpay.system.service.DictionaryDataService;
-import com.supwisdom.dlpay.util.ConstantUtil;
-import kotlin.Suppress;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
-import java.util.HashMap;
-import java.util.Map;
-
-@Component("dictPool")
-@Scope("singleton")
-public class DictPool {
- private static final HashMap<String, Object> dictmap = new HashMap<>();
-
- private DictionaryDataService dictionaryDataService;
-
- public DictPool(@Autowired DictionaryDataService dataService) {
- this.dictionaryDataService = dataService;
- }
-
- @SuppressWarnings("unchecked")
- public static HashMap<Object, Object> getDictMap(String key) {
- synchronized (dictmap) {
- return (HashMap<Object, Object>) dictmap.get(key);
- }
- }
-
- public static void updateDict(String dictType, Map<String, String> value) {
- synchronized (dictmap) {
- dictmap.put(dictType, value);
- }
- }
-
- public void init() {
- dictmap.put("allSourcetypeList", dictionaryDataService.getSystemAllSourcetype());
- dictmap.put("allReverseflagList", dictionaryDataService.getDictionaryByDicttype(ConstantUtil.DICTTYPE_NO1));
-
- }
-}
package com.supwisdom.dlpay.system.controller;
import com.supwisdom.dlpay.api.bean.JsonResult;
+import com.supwisdom.dlpay.system.service.DictionaryDataService;
+import com.supwisdom.dlpay.system.service.DictionaryProxy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
-import com.supwisdom.dlpay.system.common.DictPool;
+
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.FormParam;
import java.util.Map;
@RestController
public class DictPoolAction {
@Autowired
- private DictPool dictPool;
+ private DictionaryProxy dictionaryProxy;
@GetMapping("/dictpool")
public Map getDictDataByDicttype(@FormParam("dicttype") String dictType, HttpServletRequest request) {
dictType = request.getParameter("dicttype");
- Map res = DictPool.getDictMap(dictType);
- return res;
+ return dictionaryProxy.getDictionaryAsMap(dictType);
}
@GetMapping("/dictrefresh")
public JsonResult refreshDict() {
- dictPool.init();
return JsonResult.ok();
}
import com.supwisdom.dlpay.api.domain.TPersondtl;
import com.supwisdom.dlpay.api.domain.TShopdtl;
+import com.supwisdom.dlpay.api.domain.TSourceType;
+import com.supwisdom.dlpay.framework.domain.TDictionary;
+import com.supwisdom.dlpay.framework.domain.TTranscode;
+import com.supwisdom.dlpay.framework.util.Dictionary;
import com.supwisdom.dlpay.framework.util.PageResult;
import com.supwisdom.dlpay.framework.util.WebConstant;
import com.supwisdom.dlpay.system.bean.ShopdtlSearchBean;
import com.supwisdom.dlpay.system.bean.TreeSelectNode;
import com.supwisdom.dlpay.system.bean.UserdtlSearchBean;
+import com.supwisdom.dlpay.system.service.DictionaryProxy;
import com.supwisdom.dlpay.system.service.DtlDataService;
import com.supwisdom.dlpay.system.service.ShopDataService;
import org.springframework.beans.factory.annotation.Autowired;
@Controller
public class DtlController {
- @Autowired
- private ShopDataService shopDataService;
@Autowired
private DtlDataService dtlDataService;
+ @Autowired
+ private DictionaryProxy dictionaryProxy;
+
/**
* ====================================================
* 个人流水查询
*/
@GetMapping("/dtl/userdtl")
public String userdtlView(Model model) {
- model.addAttribute("paytypelist", shopDataService.getConsumePaytypes());
- model.addAttribute("transcodelist", dtlDataService.getAllTranscodes());
- model.addAttribute("dtlstatuslist", dtlDataService.getAllDtlStatus());
+// model.addAttribute("paytypelist", shopDataService.getConsumePaytypes());
+// model.addAttribute("transcodelist", dtlDataService.getAllTranscodes());
+// model.addAttribute("dtlstatuslist", dtlDataService.getAllDtlStatus());
+
+ model.addAttribute(Dictionary.TRANS_CODE,
+ dictionaryProxy.<TTranscode>getDictionaryAsList(Dictionary.TRANS_CODE));
+ model.addAttribute(Dictionary.DTL_STATUS,
+ dictionaryProxy.<TDictionary>getDictionaryAsList(Dictionary.DTL_STATUS));
+ model.addAttribute(Dictionary.PAY_TYPE,
+ dictionaryProxy.<TSourceType>getDictionaryAsList(Dictionary.SOURCE_TYPE));
return "system/dtl/userdtl";
}
*/
@GetMapping("/dtl/shopdtl")
public String shopdtlView(Model model) {
- model.addAttribute("paytypelist", shopDataService.getConsumePaytypes());
- model.addAttribute("transcodelist", dtlDataService.getAllTranscodes());
- model.addAttribute("dtlstatuslist", dtlDataService.getAllDtlStatus());
+ model.addAttribute(Dictionary.PAY_TYPE,
+ dictionaryProxy.getDictionaryAsList(Dictionary.SOURCE_TYPE));
+ model.addAttribute(Dictionary.TRANS_CODE,
+ dictionaryProxy.getDictionaryAsList(Dictionary.TRANS_CODE));
+ model.addAttribute(Dictionary.DTL_STATUS,
+ dictionaryProxy.getDictionaryAsList(Dictionary.DTL_STATUS));
return "system/dtl/shopdtl";
}
try {
if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
- return paramService.getPaytypePage(paytype, pageNo, pageSize);
+ return paramService.getSourceTypePage(paytype, pageNo, pageSize);
} catch (Exception e) {
e.printStackTrace();
return new PageResult<>(99, "系统查询错误");
return JsonResult.error("参数传递错误");
}
try {
- TSourceType tPaytype = paramService.getPaytype(paytype);
+ TSourceType tPaytype = paramService.getSourceType(paytype);
if (null == tPaytype) {
return JsonResult.error("支付方式不存在!");
}
tPaytype.setEnable(state); //默认切换主状态
}
- if (paramService.saveOrUpdatePaytype(tPaytype)) {
+ if (paramService.saveOrUpdateSourceType(tPaytype)) {
return JsonResult.ok(state ? "启用成功" : "关闭成功");
} else {
return JsonResult.error(!state ? "启用失败" : "关闭失败");
return JsonResult.error("参数传递错误");
}
try {
- TSourceType tPaytype = paramService.getPaytype(paytype);
+ TSourceType tPaytype = paramService.getSourceType(paytype);
if (null == tPaytype) {
return JsonResult.error("支付方式不存在!");
}
tPaytype.setPaydesc(paydesc.trim());
- if (paramService.saveOrUpdatePaytype(tPaytype)) {
+ if (paramService.saveOrUpdateSourceType(tPaytype)) {
return JsonResult.ok("修改成功");
} else {
return JsonResult.error("修改失败");
@ResponseBody
public JsonResult deletePaytype(@RequestParam("paytype") String paytype) {
try {
- TSourceType tPaytype = paramService.getPaytype(paytype);
+ TSourceType tPaytype = paramService.getSourceType(paytype);
if (null == tPaytype) {
return JsonResult.error("支付方式不存在!");
}
- if (paramService.deletePaytype(tPaytype)) {
+ if (paramService.deleteSourceType(tPaytype)) {
return JsonResult.ok("删除成功");
} else {
return JsonResult.error("删除失败");
@RequestParam(value = "anonymousEnable", required = false, defaultValue = "no") String anonymousEnable,
@RequestParam("paydesc") String paydesc) {
try {
- TSourceType tPaytype = paramService.getPaytype(paytype);
+ TSourceType tPaytype = paramService.getSourceType(paytype);
if (null != tPaytype) {
return JsonResult.error("支付方式已经存在");
}
tPaytype.setChargeEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(chargeEnable));
tPaytype.setConsumeEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(consumeEnable));
tPaytype.setAnonymousEnable(ConstantUtil.ENABLE_YES.equalsIgnoreCase(anonymousEnable));
- if (paramService.saveOrUpdatePaytype(tPaytype)) {
+ if (paramService.saveOrUpdateSourceType(tPaytype)) {
return JsonResult.ok("新增成功");
} else {
return JsonResult.error("新增失败");
@GetMapping("/param/checkpaytype")
@ResponseBody
public JsonResult checkPaytype(@RequestParam("paytype") String paytype) {
- TSourceType tPaytype = paramService.getPaytype(paytype);
+ TSourceType tPaytype = paramService.getSourceType(paytype);
if (null != tPaytype) {
return JsonResult.error("支付方式已经存在");
} else {
@GetMapping("/param/load4paytypeconfig")
@PreAuthorize("hasPermission('/param/load4paytypeconfig','')")
public String load4PaytypeConfig(@RequestParam("paytype") String paytype, Model model) {
- List<TPaytypeConfig> configList = paramService.getPaytypeConfigList(paytype);
+ List<TPaytypeConfig> configList = paramService.getSourceTypeConfigList(paytype);
model.addAttribute("configlist", configList);
model.addAttribute("paytype", paytype);
return "system/param/paytypeconfig";
try {
String paytype = param.get(paytypeHtmlKey).trim();
param.remove(paytypeHtmlKey);
- if (paramService.savePaytypeConfig(paytype, param)) {
+ if (paramService.saveSourceTypeConfig(paytype, param)) {
return JsonResult.ok("配置成功");
} else {
return JsonResult.error("配置失败");
import com.supwisdom.dlpay.framework.domain.TShop;
import com.supwisdom.dlpay.framework.domain.TShopacc;
import com.supwisdom.dlpay.framework.service.SystemUtilService;
-import com.supwisdom.dlpay.framework.util.PageResult;
-import com.supwisdom.dlpay.framework.util.StringUtil;
-import com.supwisdom.dlpay.framework.util.TradeDict;
-import com.supwisdom.dlpay.framework.util.WebConstant;
+import com.supwisdom.dlpay.framework.util.*;
import com.supwisdom.dlpay.system.bean.ShopConfigBean;
+import com.supwisdom.dlpay.system.service.DictionaryProxy;
import com.supwisdom.dlpay.system.service.ParamService;
import com.supwisdom.dlpay.system.service.ShopDataService;
import com.supwisdom.dlpay.util.ConstantUtil;
@Autowired
private SystemUtilService systemUtilService;
+ @Autowired
+ private DictionaryProxy dictionaryProxy;
+
@GetMapping("/shop/index")
public String shopView() {
return "system/shop/index";
*/
@GetMapping("/shop/config")
public String shopConfigView(Model model) {
- model.addAttribute("paytypelist", shopDataService.getConsumePaytypes());
+// model.addAttribute("paytypelist", shopDataService.getConsumePaytypes());
+ model.addAttribute(Dictionary.PAY_TYPE,
+ dictionaryProxy.<TSourceType>getDictionaryObject(Dictionary.SOURCE_TYPE));
return "system/shop/config";
}
@GetMapping("/shop/load4addpaytype")
@PreAuthorize("hasPermission('/shop/load4addpaytype','')")
public String load4AddShopPaytype(Model model) {
- model.addAttribute("paytypelist", shopDataService.getConsumePaytypes());
+ model.addAttribute(Dictionary.PAY_TYPE,
+ dictionaryProxy.getDictionaryAsList(Dictionary.SOURCE_TYPE));
return "system/shop/configform";
}
}
try {
TShopacc shopacc = shopDataService.getShopaccByAccno(shopaccno.trim());
- TSourceType tPaytype = paramService.getPaytype(paytype.trim());
+ TSourceType tPaytype = paramService.getSourceType(paytype.trim());
if (null == shopacc) {
return JsonResult.error("商户账户不存在!");
}
package com.supwisdom.dlpay.system.service;
-import java.util.HashMap;
+import com.supwisdom.dlpay.framework.domain.TDictionary;
+import com.supwisdom.dlpay.framework.domain.TTranscode;
-public interface DictionaryDataService {
- HashMap<String, Object> getSystemAllSourcetype();
-
- HashMap<String, Object> getDictionaryByDicttype(int dicttype);
+import java.util.List;
+public interface DictionaryDataService {
+ List<TDictionary> getDictionaryByDictType(String dicttype);
+ List<TTranscode> getTransCode();
}
--- /dev/null
+package com.supwisdom.dlpay.system.service;
+
+import com.supwisdom.dlpay.framework.domain.DictionaryTable;
+import com.supwisdom.dlpay.framework.util.Dictionary;
+import org.springframework.stereotype.Component;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class DictionaryProxy {
+ private final DictionaryDataService dictionaryDataService;
+
+ private final ParamService paramService;
+
+ public DictionaryProxy(DictionaryDataService dictionaryDataService, ParamService paramService) {
+ this.dictionaryDataService = dictionaryDataService;
+ this.paramService = paramService;
+ }
+
+ @SuppressWarnings("UNCHECKED_CAST")
+ public <T> Map<String, T> getDictionaryObject(String dictType) {
+ List<T> list = getDictionaryAsList(dictType);
+ Map<String, T> result = new HashMap<>();
+ for (Object item : list) {
+ if (item instanceof DictionaryTable) {
+ result.put(((DictionaryTable) item).getDictKey(), (T) item);
+ }
+ }
+ return result;
+ }
+
+ public Map<String, Object> getDictionaryAsMap(String dictType) {
+ List list = getDictionaryAsList(dictType);
+ Map<String, Object> result = new HashMap<>();
+ for (Object item : list) {
+ if (item instanceof DictionaryTable) {
+ DictionaryTable it = (DictionaryTable) item;
+ result.put(it.getDictKey(), it.getDictValue());
+ }
+ }
+ return result;
+ }
+
+ @SuppressWarnings("UNCHECKED_CAST")
+ public <T> List<T> getDictionaryAsList(String dictType) {
+ if (Dictionary.SOURCE_TYPE.equals(dictType)) {
+ return (List<T>) paramService.getAllSourceType();
+ } else if (Dictionary.TRANS_CODE.equals(dictType)) {
+ return (List<T>) dictionaryDataService.getTransCode();
+ } else {
+ return (List<T>) dictionaryDataService.getDictionaryByDictType(dictType);
+ }
+ }
+}
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
PageResult<TShopdtl> getShopdtlPage(ShopdtlSearchBean searchBean, int pageNo, int pageSize);
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- List<TTranscode> getAllTranscodes();
-
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- List<TDictionary> getAllDtlStatus();
-
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
List<TreeSelectNode> getTreeSelectShops();
}
boolean deleteApiClient(TApiClient apiClient);
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- PageResult<TSourceType> getPaytypePage(String paytype, int pageNo, int pageSize);
+ PageResult<TSourceType> getSourceTypePage(String paytype, int pageNo, int pageSize);
+
+ @Transactional(readOnly = true)
+ List<TSourceType> getAllSourceType();
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- TSourceType getPaytype(String paytype);
+ TSourceType getSourceType(String paytype);
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- boolean saveOrUpdatePaytype(TSourceType paytype);
+ boolean saveOrUpdateSourceType(TSourceType paytype);
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- boolean deletePaytype(TSourceType paytype);
+ boolean deleteSourceType(TSourceType paytype);
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
- List<TPaytypeConfig> getPaytypeConfigList(String paytype);
+ List<TPaytypeConfig> getSourceTypeConfigList(String paytype);
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
- boolean savePaytypeConfig(String paytype, Map<String, String> param) throws WebCheckException;
-
+ boolean saveSourceTypeConfig(String paytype, Map<String, String> param) throws WebCheckException;
}
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
boolean saveOrUpdateShop(TShop shop) throws WebCheckException;
- @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
- List<TSourceType> getConsumePaytypes();
-
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
PageResult<ShopConfigBean> getShopPaytypeInfos(String shopaccno, String paytype, int pageNo, int pageSize);
package com.supwisdom.dlpay.system.service.impl;
-import com.supwisdom.dlpay.api.dao.SourceTypeDao;
-import com.supwisdom.dlpay.api.domain.TSourceType;
import com.supwisdom.dlpay.framework.dao.DictionaryDao;
+import com.supwisdom.dlpay.framework.dao.TranscodeDao;
import com.supwisdom.dlpay.framework.domain.TDictionary;
-import com.supwisdom.dlpay.framework.util.StringUtil;
+import com.supwisdom.dlpay.framework.domain.TTranscode;
import com.supwisdom.dlpay.system.service.DictionaryDataService;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
-import java.util.HashMap;
+import java.util.ArrayList;
import java.util.List;
@Service
public class DictionaryDataServiceImpl implements DictionaryDataService {
- @Autowired
- private SourceTypeDao sourceTypeDao;
- @Autowired
- private DictionaryDao dictionaryDao;
+ private final DictionaryDao dictionaryDao;
+ private final TranscodeDao transcodeDao;
+
+ public DictionaryDataServiceImpl(DictionaryDao dictionaryDao,
+ TranscodeDao transcodeDao) {
+ this.dictionaryDao = dictionaryDao;
+ this.transcodeDao = transcodeDao;
+ }
@Override
- public HashMap<String, Object> getSystemAllSourcetype() {
- HashMap<String, Object> result = new HashMap<>(0);
- List<TSourceType> list = sourceTypeDao.findAll();
- if (!StringUtil.isEmpty(list)) {
- for (TSourceType tst : list) {
- result.put(tst.getSourceType(), tst.getPaydesc());
- }
+ @Cacheable(cacheNames = "dicationary_cache", key = "#p0")
+ public List<TDictionary> getDictionaryByDictType(String dicttype) {
+ List<TDictionary> list = dictionaryDao.findAllByDicttype(dicttype);
+ if (!list.isEmpty()) {
+ return list;
}
- return result;
+ return new ArrayList<>();
}
+
@Override
- public HashMap<String, Object> getDictionaryByDicttype(int dicttype) {
- HashMap<String, Object> result = new HashMap<>(0);
- List<TDictionary> list = dictionaryDao.findAllByDicttype(dicttype);
- if (!StringUtil.isEmpty(list)) {
- for (TDictionary dict : list) {
- result.put(dict.getDictval() == null ? "" : dict.getDictval(), dict.getDictcaption());
- }
+ @Cacheable(cacheNames = "trans_code_cache")
+ public List<TTranscode> getTransCode() {
+ List<TTranscode> list = transcodeDao.findAll();
+ if (!list.isEmpty()) {
+ return list;
}
- return result;
+ return new ArrayList<>();
}
}
import com.supwisdom.dlpay.api.dao.ShopdtlDao;
import com.supwisdom.dlpay.api.domain.TPersondtl;
import com.supwisdom.dlpay.api.domain.TShopdtl;
-import com.supwisdom.dlpay.framework.dao.DictionaryDao;
import com.supwisdom.dlpay.framework.dao.ShopDao;
import com.supwisdom.dlpay.framework.dao.TranscodeDao;
import com.supwisdom.dlpay.framework.domain.TDictionary;
import com.supwisdom.dlpay.framework.domain.TShop;
import com.supwisdom.dlpay.framework.domain.TTranscode;
import com.supwisdom.dlpay.framework.util.DateUtil;
+import com.supwisdom.dlpay.framework.util.Dictionary;
import com.supwisdom.dlpay.framework.util.PageResult;
import com.supwisdom.dlpay.framework.util.StringUtil;
import com.supwisdom.dlpay.system.bean.ShopdtlSearchBean;
import com.supwisdom.dlpay.system.bean.TreeSelectNode;
import com.supwisdom.dlpay.system.bean.UserdtlSearchBean;
+import com.supwisdom.dlpay.system.service.DictionaryProxy;
import com.supwisdom.dlpay.system.service.DtlDataService;
-import com.supwisdom.dlpay.util.ConstantUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import javax.persistence.criteria.Root;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
@Service
public class DtlDataServiceImpl implements DtlDataService {
@Autowired
private TranscodeDao transcodeDao;
@Autowired
- private DictionaryDao dictionaryDao;
+ private DictionaryProxy dictionaryProxy;
@Autowired
private ShopDao shopDao;
@Override
public Predicate toPredicate(Root<TPersondtl> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {
List<Predicate> predicates = new ArrayList<>();
- if(!StringUtil.isEmpty(searchBean.getStartAccdate())){
- predicates.add(criteriaBuilder.ge(root.get("accdate").as(Integer.class),Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getStartAccdate()))));
+ if (!StringUtil.isEmpty(searchBean.getStartAccdate())) {
+ predicates.add(criteriaBuilder.ge(root.get("accdate").as(Integer.class), Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getStartAccdate()))));
}
- if(!StringUtil.isEmpty(searchBean.getEndAccdate())){
- predicates.add(criteriaBuilder.le(root.get("accdate").as(Integer.class),Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getEndAccdate()))));
+ if (!StringUtil.isEmpty(searchBean.getEndAccdate())) {
+ predicates.add(criteriaBuilder.le(root.get("accdate").as(Integer.class), Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getEndAccdate()))));
}
- if(!StringUtil.isEmpty(searchBean.getStartTransdate())){
- predicates.add(criteriaBuilder.ge(root.get("transdate").as(Integer.class),Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getStartTransdate()))));
+ if (!StringUtil.isEmpty(searchBean.getStartTransdate())) {
+ predicates.add(criteriaBuilder.ge(root.get("transdate").as(Integer.class), Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getStartTransdate()))));
}
- if(!StringUtil.isEmpty(searchBean.getEndTransdate())){
- predicates.add(criteriaBuilder.le(root.get("transdate").as(Integer.class),Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getEndTransdate()))));
+ if (!StringUtil.isEmpty(searchBean.getEndTransdate())) {
+ predicates.add(criteriaBuilder.le(root.get("transdate").as(Integer.class), Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getEndTransdate()))));
}
- if(!StringUtil.isEmpty(searchBean.getPersonname())){
+ if (!StringUtil.isEmpty(searchBean.getPersonname())) {
predicates.add(criteriaBuilder.like(root.get("userName").as(String.class), "%" + searchBean.getPersonname().trim() + "%"));
}
- if(!StringUtil.isEmpty(searchBean.getSourcetype())){
+ if (!StringUtil.isEmpty(searchBean.getSourcetype())) {
predicates.add(criteriaBuilder.equal(root.get("sourceType").as(String.class), searchBean.getSourcetype().trim()));
}
- if(!StringUtil.isEmpty(searchBean.getTradeflag())){
+ if (!StringUtil.isEmpty(searchBean.getTradeflag())) {
predicates.add(criteriaBuilder.equal(root.get("tradeflag").as(String.class), searchBean.getTradeflag().trim()));
}
- if(!StringUtil.isEmpty(searchBean.getTranscode())){
+ if (!StringUtil.isEmpty(searchBean.getTranscode())) {
predicates.add(criteriaBuilder.equal(root.get("transcode").as(String.class), searchBean.getTranscode().trim()));
}
- if(!StringUtil.isEmpty(searchBean.getStatus())){
+ if (!StringUtil.isEmpty(searchBean.getStatus())) {
predicates.add(criteriaBuilder.equal(root.get("status").as(String.class), searchBean.getStatus().trim()));
}
return criteriaBuilder.and(predicates.toArray(new Predicate[0]));
@Override
public PageResult<TShopdtl> getShopdtlPage(ShopdtlSearchBean searchBean, int pageNo, int pageSize) {
Pageable pageable = PageRequest.of(pageNo - 1, pageSize, Sort.by(Sort.Direction.DESC, "refno"));
- Page<TShopdtl> page = shopdtlDao.findAll(new Specification<TShopdtl>() {
- @Override
- public Predicate toPredicate(Root<TShopdtl> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {
- List<Predicate> predicates = new ArrayList<>();
- if(!StringUtil.isEmpty(searchBean.getStartAccdate())){
- predicates.add(criteriaBuilder.ge(root.get("accdate").as(Integer.class),Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getStartAccdate()))));
- }
- if(!StringUtil.isEmpty(searchBean.getEndAccdate())){
- predicates.add(criteriaBuilder.le(root.get("accdate").as(Integer.class),Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getEndAccdate()))));
- }
- if(!StringUtil.isEmpty(searchBean.getStartTransdate())){
- predicates.add(criteriaBuilder.ge(root.get("transdate").as(Integer.class),Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getStartTransdate()))));
+ Page<TShopdtl> page = shopdtlDao.findAll((Specification<TShopdtl>) (root, query, criteriaBuilder) -> {
+ List<Predicate> predicates = new ArrayList<>();
+ if (!StringUtil.isEmpty(searchBean.getStartAccdate())) {
+ predicates.add(criteriaBuilder.ge(root.get("accdate").as(Integer.class), Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getStartAccdate()))));
+ }
+ if (!StringUtil.isEmpty(searchBean.getEndAccdate())) {
+ predicates.add(criteriaBuilder.le(root.get("accdate").as(Integer.class), Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getEndAccdate()))));
+ }
+ if (!StringUtil.isEmpty(searchBean.getStartTransdate())) {
+ predicates.add(criteriaBuilder.ge(root.get("transdate").as(Integer.class), Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getStartTransdate()))));
- }
- if(!StringUtil.isEmpty(searchBean.getEndTransdate())){
- predicates.add(criteriaBuilder.le(root.get("transdate").as(Integer.class),Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getEndTransdate()))));
- }
- if(!StringUtil.isEmpty(searchBean.getShopname())){
- predicates.add(criteriaBuilder.like(root.get("shopname").as(String.class), "%" + searchBean.getShopname().trim() + "%"));
- }
- if(!StringUtil.isEmpty(searchBean.getShopaccno())){
- predicates.add(criteriaBuilder.equal(root.get("shopaccno").as(String.class), searchBean.getShopaccno().trim()));
- }
- if(!StringUtil.isEmpty(searchBean.getSourcetype())){
- predicates.add(criteriaBuilder.equal(root.get("sourceType").as(String.class), searchBean.getSourcetype().trim()));
- }
- if(!StringUtil.isEmpty(searchBean.getTradeflag())){
- predicates.add(criteriaBuilder.equal(root.get("tradeflag").as(String.class), searchBean.getTradeflag().trim()));
- }
- if(!StringUtil.isEmpty(searchBean.getTranscode())){
- predicates.add(criteriaBuilder.equal(root.get("transcode").as(String.class), searchBean.getTranscode().trim()));
- }
- if(!StringUtil.isEmpty(searchBean.getStatus())){
- predicates.add(criteriaBuilder.equal(root.get("status").as(String.class), searchBean.getStatus().trim()));
- }
- return criteriaBuilder.and(predicates.toArray(new Predicate[0]));
}
+ if (!StringUtil.isEmpty(searchBean.getEndTransdate())) {
+ predicates.add(criteriaBuilder.le(root.get("transdate").as(Integer.class), Integer.valueOf(DateUtil.unParseToDateFormat(searchBean.getEndTransdate()))));
+ }
+ if (!StringUtil.isEmpty(searchBean.getShopname())) {
+ predicates.add(criteriaBuilder.like(root.get("shopname").as(String.class), "%" + searchBean.getShopname().trim() + "%"));
+ }
+ if (!StringUtil.isEmpty(searchBean.getShopaccno())) {
+ predicates.add(criteriaBuilder.equal(root.get("shopaccno").as(String.class), searchBean.getShopaccno().trim()));
+ }
+ if (!StringUtil.isEmpty(searchBean.getSourcetype())) {
+ predicates.add(criteriaBuilder.equal(root.get("sourceType").as(String.class), searchBean.getSourcetype().trim()));
+ }
+ if (!StringUtil.isEmpty(searchBean.getTradeflag())) {
+ predicates.add(criteriaBuilder.equal(root.get("tradeflag").as(String.class), searchBean.getTradeflag().trim()));
+ }
+ if (!StringUtil.isEmpty(searchBean.getTranscode())) {
+ predicates.add(criteriaBuilder.equal(root.get("transcode").as(String.class), searchBean.getTranscode().trim()));
+ }
+ if (!StringUtil.isEmpty(searchBean.getStatus())) {
+ predicates.add(criteriaBuilder.equal(root.get("status").as(String.class), searchBean.getStatus().trim()));
+ }
+ return criteriaBuilder.and(predicates.toArray(new Predicate[0]));
}, pageable);
return new PageResult<>(page);
}
- @Override
- public List<TTranscode> getAllTranscodes(){
- return transcodeDao.findAll();
- }
-
- @Override
- public List<TDictionary> getAllDtlStatus(){
- List<TDictionary> list = dictionaryDao.findAllByDicttype(ConstantUtil.DICTTYPE_NO2);
- if(!StringUtil.isEmpty(list)){
- return list;
- }
- return new ArrayList<>(0);
- }
-
@Override
public List<TreeSelectNode> getTreeSelectShops() {
List<TShop> shoplist = shopDao.getNormalShops();
if (fshopid.equals(shop.getFshopid())) {
TreeSelectNode node = new TreeSelectNode();
node.setId(String.valueOf(shop.getShopid()));
- if(!StringUtil.isEmpty(shop.getShopaccno())){
+ if (!StringUtil.isEmpty(shop.getShopaccno())) {
node.setId(shop.getShopaccno()); //替换商户账号
}
node.setName(shop.getShopname());
node.setChecked(false);
node.setAccno(shop.getShopaccno());
List<TreeSelectNode> children = getShopSelectTree(shoplist, shop.getShopid());
- if(null!=children && children.size()>0){
+ if (null != children && children.size() > 0) {
node.setChildren(children);
- }else{
+ } else {
node.setChildren(null);
}
result.add(node);
import com.supwisdom.dlpay.util.ConstantUtil;
import com.supwisdom.dlpay.util.WebCheckException;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
@Autowired
private ApiClientDao apiClientDao;
@Autowired
- private SourceTypeDao paytypeDao;
+ private SourceTypeDao sourceTypeDao;
@Autowired
private PaytypeConfigDao paytypeConfigDao;
}
@Override
- public PageResult<TSourceType> getPaytypePage(String paytype, int pageNo, int pageSize) {
+ public PageResult<TSourceType> getSourceTypePage(String paytype, int pageNo, int pageSize) {
Pageable pageable = PageRequest.of(pageNo - 1, pageSize, Sort.by("sourceType"));
if (!StringUtil.isEmpty(paytype)) {
- return new PageResult<>(paytypeDao.findBySourceTypeContaining(paytype.trim(), pageable));
+ return new PageResult<>(sourceTypeDao.findBySourceTypeContaining(paytype.trim(), pageable));
}
- return new PageResult<>(paytypeDao.findAll(pageable));
+ return new PageResult<>(sourceTypeDao.findAll(pageable));
}
@Override
- public TSourceType getPaytype(String paytype) {
+ @Cacheable(cacheNames = "source_type_cache", key = "#p0")
+ public TSourceType getSourceType(String paytype) {
if (!StringUtil.isEmpty(paytype)) {
- return paytypeDao.getBySourceType(paytype.trim());
+ return sourceTypeDao.getBySourceType(paytype.trim());
}
return null;
}
@Override
- public boolean saveOrUpdatePaytype(TSourceType paytype) {
+ @Cacheable(cacheNames = "source_type_cache")
+ public List<TSourceType> getAllSourceType() {
+ return sourceTypeDao.findAll();
+ }
+
+ @Override
+ @Cacheable(cacheNames = "source_type_cache", key = "#paytype.sourceType")
+ public boolean saveOrUpdateSourceType(TSourceType paytype) {
if (null != paytype) {
- paytypeDao.save(paytype);
+ sourceTypeDao.save(paytype);
return true;
}
return false;
}
@Override
- public boolean deletePaytype(TSourceType paytype) {
+ @CacheEvict(cacheNames = "source_type_cache", key = "#paytype.sourceType")
+ public boolean deleteSourceType(TSourceType paytype) {
if (null != paytype) {
- paytypeDao.delete(paytype);
+ sourceTypeDao.delete(paytype);
return true;
}
return false;
}
@Override
- public List<TPaytypeConfig> getPaytypeConfigList(String paytype) {
+ @Cacheable(cacheNames = "source_type_config_cache", key = "#p0")
+ public List<TPaytypeConfig> getSourceTypeConfigList(String paytype) {
if (!StringUtil.isEmpty(paytype)) {
List<TPaytypeConfig> list = paytypeConfigDao.getByPaytypeOrderByConfigid(paytype.trim());
if (!StringUtil.isEmpty(list))
}
@Override
- public boolean savePaytypeConfig(String paytype, Map<String, String> param) throws WebCheckException {
- TSourceType tPaytype = getPaytype(paytype);
+ @Cacheable(cacheNames = "source_type_config_cache", key = "#p0")
+ public boolean saveSourceTypeConfig(String paytype, Map<String, String> param) throws WebCheckException {
+ TSourceType tPaytype = getSourceType(paytype);
if (null == tPaytype) throw new WebCheckException("支付能力[" + paytype + "]不存在");
for (String key : param.keySet()) {
String value = param.get(key);
}
}
- @Override
- public List<TSourceType> getConsumePaytypes() {
- List<TSourceType> list = paytypeDao.getConsumeSourceTypes();
- if (!StringUtil.isEmpty(list)) {
- return list;
- }
- return new ArrayList<TSourceType>(0);
- }
-
@Override
public PageResult<ShopConfigBean> getShopPaytypeInfos(String shopaccno, String paytype, int pageNo, int pageSize) {
Pageable pageable = PageRequest.of(pageNo - 1, pageSize, Sort.by("shopaccno", "paytype"));
import org.springframework.beans.factory.annotation.Value
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
+import org.springframework.cache.annotation.EnableCaching
import org.springframework.cloud.client.discovery.EnableDiscoveryClient
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
@SpringBootApplication
@EnableDiscoveryClient
@EnableScheduling
+@EnableCaching
class PayApiApplication
fun main(args: Array<String>) {
VALUES (3500, '账户充值', '{tenantid}');
INSERT INTO "tb_dictionary" ("dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES ('cancel', 1, '冲正', '冲正状态', '{tenantid}');
+VALUES ('cancel', 'reverseFlagList', '冲正', '冲正状态', '{tenantid}');
INSERT INTO "tb_dictionary" ("dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES ('reverse', 1, '手工撤销', '冲正状态', '{tenantid}');
+VALUES ('reverse', 'reverseFlagList', '手工撤销', '冲正状态', '{tenantid}');
INSERT INTO "tb_dictionary" ("dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES ('none', 1, ' ', '冲正状态', '{tenantid}');
+VALUES ('none', 'reverseFlagList', '-', '冲正状态', '{tenantid}');
INSERT INTO "tb_dictionary" ("dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES ('init', 2, '初始化', '流水状态', '{tenantid}');
+VALUES ('init', 'dtlStatusList', '初始化', '流水状态', '{tenantid}');
INSERT INTO "tb_dictionary" ("dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES ('success', 2, '交易成功', '流水状态', '{tenantid}');
+VALUES ('success', 'dtlStatusList', '交易成功', '流水状态', '{tenantid}');
INSERT INTO "tb_dictionary" ("dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES ('fail', 2, '交易失败', '流水状态', '{tenantid}');
+VALUES ('fail', 'dtlStatusList', '交易失败', '流水状态', '{tenantid}');
INSERT INTO "tb_dictionary" ("dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES ('wip', 2, '待支付', '流水状态', '{tenantid}');
+VALUES ('wip', 'dtlStatusList','待支付', '流水状态', '{tenantid}');
INSERT INTO "tb_dictionary" ("dictval", "dicttype", "dictcaption", "dicttypename", "tenantid")
-VALUES ('cancel', 2, '交易取消', '流水状态', '{tenantid}');
+VALUES ('cancel','dtlStatusList', '交易取消', '流水状态', '{tenantid}');
----------------------------------------------------
commit;
\ No newline at end of file
data: "dicttype=" + dictType,
contentType: "application/x-www-form-urlencoded",
success: function (data) {
- if (data == null || data == "") {
+ if (data == null || data === "") {
that.storage.removeItem(dictType);
} else {
that.storage.setItem(dictType, JSON.stringify(data));
},
initAll: function (url) {
this.url = url;
- this.addNewDict("allSourcetypeList").addNewDict("allReverseflagList");
+ this.addNewDict("sourcetypeList").addNewDict("reverseFlagList");
},
getDict: function (dictType) {
var dict, that = this;
- if (that.pool[dictType] != undefined) {
+ if (that.pool[dictType] !== undefined) {
return that.pool[dictType];
} else {
dict = that.storage.getItem(dictType);
- if (dict == undefined) {
+ if (dict === undefined) {
return null;
} else {
that.pool[dictType] = JSON.parse(dict);
return code;
} else {
var c = "" + code;
- return dict[c] == undefined ? code : dict[c];
+ return dict[c] === undefined ? code : dict[c];
}
}
}
<div class="layui-inline">
<label class="layui-form-label">记账日期</label>
<div class="layui-input-inline" style="width: 120px;">
- <input type="text" name="startAccdate" id="userdtl-search-startAccdate" placeholder="开始日期"
+ <input type="text" name="startAccdate" id="userdtl-search-startAccdate"
+ placeholder="开始日期"
autocomplete="off" class="layui-input"/>
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-block">
<select name="transStatus" id="userdtl-search-transStatus" class="layui-select">
<option value=""> 全部</option>
- <option th:each="st:${dtlstatuslist}" th:value="${st.dictval}"
+ <option th:each="st:${dtlStatusList}" th:value="${st.dictval}"
th:text="${st.dictcaption}"></option>
</select> 
</div>
<div class="layui-inline">
<label class="layui-form-label">交易日期</label>
<div class="layui-input-inline" style="width: 120px;">
- <input type="text" name="startTransdate" id="userdtl-search-startTransdate" placeholder="开始日期"
+ <input type="text" name="startTransdate" id="userdtl-search-startTransdate"
+ placeholder="开始日期"
autocomplete="off" class="layui-input"/>
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: 120px;">
- <input type="text" name="endTransdate" id="userdtl-search-endTransdate" placeholder="结束日期"
+ <input type="text" name="endTransdate" id="userdtl-search-endTransdate"
+ placeholder="结束日期"
autocomplete="off" class="layui-input"/>
</div>
</div>
<div class="layui-input-block">
<select name="transcode" id="userdtl-search-transcode" class="layui-select">
<option value=""> 全部</option>
- <option th:each="tc:${transcodelist}" th:value="${tc.transcode}"
+ <option th:each="tc:${transcodeList}" th:value="${tc.transcode}"
th:text="${tc.transname}"></option>
</select>
</div>
{field: 'userName', title: '姓名', align: 'center', width: 150},
{field: 'amount', title: '交易金额', align: 'center', width: 120, sort: true},
{
- field: 'transStatus', title: '状态', align: 'center', width: 90, templet: function (item) {
- if (item.transStatus == 'init') {
+ field: 'status',
+ title: '状态',
+ align: 'center',
+ width: 90,
+ templet: function (item) {
+ if (item.status === 'init') {
return '<span class="layui-badge layui-bg-gray">初始化</span>';
- } else if (item.transStatus == 'success') {
+ } else if (item.status === 'success') {
return '<span class="layui-badge layui-bg-green">成功</span>';
- } else if (item.transStatus == 'fail') {
+ } else if (item.status === 'fail') {
return '<span class="layui-badge">失败</span>';
- } else if (item.transStatus == 'wip') {
+ } else if (item.status === 'wip') {
return '<span class="layui-badge layui-bg-orange">待支付</span>';
} else {
- return item.transStatus;
+ return item.status;
}
}
},
{
- field: 'tradeflag', title: '类型', align: 'center', width: 60, templet: function (item) {
- if (item.tradeflag == 'in') {
+ field: 'tradeflag',
+ title: '类型',
+ align: 'center',
+ width: 60,
+ templet: function (item) {
+ if (item.tradeflag === 'in') {
return '<span style="color: green;">收入</span>';
- } else if (item.tradeflag == 'out') {
+ } else if (item.tradeflag === 'out') {
return '<span style="color: red;">支出</span>';
} else {
return item.tradeflag;
width: 130,
sort: true,
templet: function (item) {
- return getTempDictValue('allSourcetypeList', item.sourceType);
+ return getTempDictValue('sourcetypeList', item.sourceType);
}
},
{
- field: 'reverseFlag', title: '冲正状态', align: 'center', width: 100, templet: function (item) {
- return getTempDictValue('allReverseflagList', item.reverseFlag);
+ field: 'reverseFlag',
+ title: '冲正状态',
+ align: 'center',
+ width: 100,
+ templet: function (item) {
+ return getTempDictValue('reverseFlagList', item.reverseFlag);
}
},
{field: 'oppositeAccName', title: '交易对象', align: 'center', width: 250},