package project.web.api; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang3.ObjectUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import kernel.exception.BusinessException; import kernel.util.StringUtils; import kernel.web.ApplicationUtil; import kernel.web.BaseAction; import kernel.web.ResultObject; import project.Constants; import project.RedisKeys; import project.c2c.C2cAdvert; import project.c2c.C2cAdvertService; import project.c2c.C2cOrder; import project.c2c.C2cOrderService; import project.c2c.C2cPaymentMethod; import project.c2c.C2cPaymentMethodConfig; import project.c2c.C2cPaymentMethodConfigService; import project.c2c.C2cPaymentMethodService; import project.c2c.C2cTranslate; import project.c2c.C2cTranslateService; import project.c2c.C2cUser; import project.c2c.C2cUserService; import project.log.LogService; import project.redis.RedisHandler; import project.syspara.SysparaService; import security.SecUser; import security.internal.SecUserService; /** * C2C支付方式 */ @RestController @CrossOrigin public class C2cPaymentMethodController extends BaseAction { private Logger logger = LoggerFactory.getLogger(C2cPaymentMethodController.class); @Autowired private C2cPaymentMethodService c2cPaymentMethodService; @Autowired private C2cPaymentMethodConfigService c2cPaymentMethodConfigService; @Autowired private SecUserService secUserService; @Autowired private LogService logService; @Autowired private C2cAdvertService c2cAdvertService; @Autowired private C2cUserService c2cUserService; @Autowired private SysparaService sysparaService; @Autowired private C2cTranslateService c2cTranslateService; @Autowired private RedisHandler redisHandler; @Autowired private C2cOrderService c2cOrderService; private final String action = "/api/c2cPaymentMethod!"; /** * 获取 支付方式类型 列表 */ @RequestMapping(action + "method_type.action") public Object method_type(HttpServletRequest request) { String language = request.getParameter("language"); ResultObject resultObject = new ResultObject(); try { Map data = this.c2cAdvertService.getC2cSyspara("c2c_payment_method_type"); // 多语言 for (String typeId : data.keySet()) { String name = data.get(typeId); if (null != name) { C2cTranslate trans = this.c2cTranslateService.get(name, language); if (null != trans) { data.put(typeId, trans.getTranslate()); } } } resultObject.setData(data); } catch (BusinessException e) { resultObject.setCode("1"); resultObject.setMsg(e.getMessage()); } catch (Throwable t) { resultObject.setCode("1"); resultObject.setMsg("程序错误"); logger.error("error:", t); } return resultObject; } /** * 获取 支付方式 列表 */ @RequestMapping(action + "list.action") public Object list(HttpServletRequest request) { String language = request.getParameter("language"); ResultObject resultObject = new ResultObject(); resultObject = this.readSecurityContextFromSession(resultObject); if (!"0".equals(resultObject.getCode())) { return resultObject; } try { String partyId = this.getLoginPartyId(); if (null == partyId) { throw new BusinessException("请重新登录"); } List list = new ArrayList(); Map map = this.c2cPaymentMethodService.getByPartyId(partyId); if (null != map && 0 != map.size()) { for (C2cPaymentMethod method : map.values()) { if (null != method) { if (StringUtils.isNotEmpty(method.getMethodImg())) { String path = Constants.WEB_URL + "/public/showimg!showImg.action?imagePath=" + method.getMethodImg(); method.setMethodImg(path); } list.add(this.c2cTranslateService.translatePm(method, language)); } } } resultObject.setData(list); } catch (BusinessException e) { resultObject.setCode("1"); resultObject.setMsg(e.getMessage()); } catch (Throwable t) { resultObject.setCode("1"); resultObject.setMsg("程序错误"); logger.error("error:", t); } return resultObject; } /** * 获取 支付方式 详情 */ @RequestMapping(action + "get.action") public Object get(HttpServletRequest request) { String id = request.getParameter("id"); String language = request.getParameter("language"); ResultObject resultObject = new ResultObject(); resultObject = this.readSecurityContextFromSession(resultObject); if (!"0".equals(resultObject.getCode())) { return resultObject; } try { C2cPaymentMethod method = this.c2cPaymentMethodService.get(id); if (null == method) { throw new BusinessException("支付方式不存在"); } if (StringUtils.isNotEmpty(method.getMethodImg())) { String path = Constants.WEB_URL + "/public/showimg!showImg.action?imagePath=" + method.getMethodImg(); method.setMethodImg(path); } if (StringUtils.isNotEmpty(method.getQrcode())) { String path = Constants.WEB_URL + "/public/showimg!showImg.action?imagePath=" + method.getQrcode(); method.setQrcodePath(path); } resultObject.setData(this.c2cTranslateService.translatePm(method, language)); } catch (BusinessException e) { resultObject.setCode("1"); resultObject.setMsg(e.getMessage()); } catch (Throwable t) { resultObject.setCode("1"); resultObject.setMsg("程序错误"); logger.error("error:", t); } return resultObject; } /** * 获取 承兑商广告 支付方式列表 * * 广告id */ @RequestMapping(action + "getAdPayments.action") public Object getAdPayments(HttpServletRequest request) { String id = request.getParameter("id"); String language = request.getParameter("language"); ResultObject resultObject = new ResultObject(); resultObject = this.readSecurityContextFromSession(resultObject); if (!"0".equals(resultObject.getCode())) { return resultObject; } try { if (StringUtils.isEmptyString(id)) { throw new BusinessException("广告id不正确"); } C2cAdvert c2cAdvert = this.c2cAdvertService.get(id); if (null == c2cAdvert) { throw new BusinessException("广告不存在"); } C2cUser c2cUser = this.c2cUserService.get(c2cAdvert.getC2cUserId()); if (null == c2cUser) { throw new BusinessException("承兑商不存在"); } List list = new ArrayList(); Map map = this.c2cPaymentMethodService.getByPartyId(c2cUser.getC2cUserPartyId()); if (null != map && !map.isEmpty()) { for (C2cPaymentMethod method : map.values()) { if (null != method) { list.add(this.c2cTranslateService.translatePm(method, language)); } } } if (null == list || 0 == list.size()) { throw new BusinessException("承兑商支付方式未配置"); } String[] payTypes = c2cAdvert.getPayType().split(","); List resList = new ArrayList(); for (int i = 0; i < list.size(); i++) { C2cPaymentMethod method = list.get(i); for (String type : payTypes) { if (method.getMethodConfigId().equals(type)) { resList.add(method); break; } } } if (null == resList || 0 == resList.size()) { throw new BusinessException("承兑商广告支付方式未配置"); } for (int i = 0; i < resList.size(); i++) { C2cPaymentMethod method = resList.get(i); if (null != method) { if (StringUtils.isNotEmpty(method.getMethodImg())) { String path = Constants.WEB_URL + "/public/showimg!showImg.action?imagePath=" + method.getMethodImg(); method.setMethodImg(path); } } } resultObject.setData(resList); } catch (BusinessException e) { resultObject.setCode("1"); resultObject.setMsg(e.getMessage()); } catch (Throwable t) { resultObject.setCode("1"); resultObject.setMsg("程序错误"); logger.error("error:", t); } return resultObject; } /** * 获取 用户支付方式列表(需匹配承兑商广告支付方式) * * 广告id */ @RequestMapping(action + "getUserPaymentsByAd.action") public Object getUserPaymentsByAd(HttpServletRequest request) { String id = request.getParameter("id"); String language = request.getParameter("language"); ResultObject resultObject = new ResultObject(); resultObject = this.readSecurityContextFromSession(resultObject); if (!"0".equals(resultObject.getCode())) { return resultObject; } try { if (StringUtils.isEmptyString(id)) { throw new BusinessException("广告id不正确"); } C2cAdvert c2cAdvert = this.c2cAdvertService.get(id); if (null == c2cAdvert) { throw new BusinessException("广告不存在"); } String partyId = this.getLoginPartyId(); if (null == partyId) { throw new BusinessException("请重新登录"); } List list = new ArrayList(); Map map = this.c2cPaymentMethodService.getByPartyId(partyId); if (null != map && !map.isEmpty()) { for (C2cPaymentMethod method : map.values()) { if (null != method) { list.add(this.c2cTranslateService.translatePm(method, language)); } } } if (null == list || 0 == list.size()) { throw new BusinessException("用户支付方式未配置"); } String[] payTypes = c2cAdvert.getPayType().split(","); List resList = new ArrayList(); for (int i = 0; i < list.size(); i++) { C2cPaymentMethod method = list.get(i); for (String type : payTypes) { if (method.getMethodConfigId().equals(type)) { resList.add(method); break; } } } if (null == resList || 0 == resList.size()) { throw new BusinessException("用户广告支付方式未配置"); } for (int i = 0; i < resList.size(); i++) { C2cPaymentMethod method = resList.get(i); if (null != method) { if (StringUtils.isNotEmpty(method.getMethodImg())) { String path = Constants.WEB_URL + "/public/showimg!showImg.action?imagePath=" + method.getMethodImg(); method.setMethodImg(path); } } } resultObject.setData(resList); } catch (BusinessException e) { resultObject.setCode("1"); resultObject.setMsg(e.getMessage()); } catch (Throwable t) { resultObject.setCode("1"); resultObject.setMsg("程序错误"); logger.error("error:", t); } return resultObject; } /** * 新增 支付方式 */ @RequestMapping(action + "add.action") public Object add(HttpServletRequest request) { String method_config_id = request.getParameter("method_config_id"); String real_name = request.getParameter("real_name"); String param_value1 = request.getParameter("param_value1"); String param_value2 = request.getParameter("param_value2"); String param_value3 = request.getParameter("param_value3"); String param_value4 = request.getParameter("param_value4"); String param_value5 = request.getParameter("param_value5"); String param_value6 = request.getParameter("param_value6"); String param_value7 = request.getParameter("param_value7"); String param_value8 = request.getParameter("param_value8"); String param_value9 = request.getParameter("param_value9"); String param_value10 = request.getParameter("param_value10"); String param_value11 = request.getParameter("param_value11"); String param_value12 = request.getParameter("param_value12"); String param_value13 = request.getParameter("param_value13"); String param_value14 = request.getParameter("param_value14"); String param_value15 = request.getParameter("param_value15"); String qrcode = request.getParameter("qrcode"); String remark = request.getParameter("remark"); ResultObject resultObject = new ResultObject(); resultObject = this.readSecurityContextFromSession(resultObject); if (!"0".equals(resultObject.getCode())) { return resultObject; } try { if (StringUtils.isNullOrEmpty(method_config_id)) { throw new BusinessException("支付方式模板不正确"); } if (StringUtils.isNullOrEmpty(real_name)) { throw new BusinessException("真实姓名必填"); } if (StringUtils.isNullOrEmpty(param_value1)) { throw new BusinessException("参数值1必填"); } C2cPaymentMethodConfig methodConfig = this.c2cPaymentMethodConfigService.get(method_config_id); if (null == methodConfig) { throw new BusinessException("支付方式模板不存在"); } String partyId = this.getLoginPartyId(); if (null == partyId) { throw new BusinessException("请重新登录"); } // C2C用户和承兑商添加支付方式最大数量 Map methodMap = this.c2cPaymentMethodService.getByPartyId(partyId); Object obj = this.sysparaService.find("c2c_payment_method_count_max"); if (null != obj) { if (methodMap.size() >= Integer.valueOf(this.sysparaService.find("c2c_payment_method_count_max").getValue()).intValue()) { throw new BusinessException("支付方式数量已达上限"); } } C2cPaymentMethod method = new C2cPaymentMethod(); method.setId(ApplicationUtil.getCurrentTimeUUID()); method.setPartyId(partyId); method.setMethodConfigId(method_config_id); method.setMethodType(methodConfig.getMethodType()); method.setMethodName(methodConfig.getMethodName()); method.setMethodImg(methodConfig.getMethodImg()); method.setRealName(real_name); method.setParamName1(methodConfig.getParamName1()); method.setParamValue1(param_value1); method.setParamName2(methodConfig.getParamName2()); method.setParamValue2(param_value2); method.setParamName3(methodConfig.getParamName3()); method.setParamValue3(param_value3); method.setParamName4(methodConfig.getParamName4()); method.setParamValue4(param_value4); method.setParamName5(methodConfig.getParamName5()); method.setParamValue5(param_value5); method.setParamName6(methodConfig.getParamName6()); method.setParamValue6(param_value6); method.setParamName7(methodConfig.getParamName7()); method.setParamValue7(param_value7); method.setParamName8(methodConfig.getParamName8()); method.setParamValue8(param_value8); method.setParamName9(methodConfig.getParamName9()); method.setParamValue9(param_value9); method.setParamName10(methodConfig.getParamName10()); method.setParamValue10(param_value10); method.setParamName11(methodConfig.getParamName11()); method.setParamValue11(param_value11); method.setParamName12(methodConfig.getParamName12()); method.setParamValue12(param_value12); method.setParamName13(methodConfig.getParamName13()); method.setParamValue13(param_value13); method.setParamName14(methodConfig.getParamName14()); method.setParamValue14(param_value14); method.setParamName15(methodConfig.getParamName15()); method.setParamValue15(param_value15); method.setQrcode(qrcode); method.setRemark(remark); method.setCreateTime(new Date()); method.setUpdateTime(new Date()); this.c2cPaymentMethodService.save(method); C2cPaymentMethod methodSaved = c2cPaymentMethodService.getC2cPaymentMethod(method.getId().toString()); if (null != methodSaved) { this.redisHandler.setSync(RedisKeys.C2C_PAYMENT_METHOD_ID + methodSaved.getId().toString(), methodSaved); Map map = (Map) this.redisHandler.get(RedisKeys.C2C_PAYMENT_METHOD_PARTY_ID + methodSaved.getPartyId().toString()); if (null == map) { map = new ConcurrentHashMap(); } map.put(methodSaved.getId().toString(), methodSaved); this.redisHandler.setSync(RedisKeys.C2C_PAYMENT_METHOD_PARTY_ID + methodSaved.getPartyId().toString(), map); Map map1 = (Map) this.redisHandler.get(RedisKeys.C2C_PAYMENT_METHOD_ID_TYPE); if (null == map1) { map1 = new ConcurrentHashMap(); } map1.put(methodSaved.getId().toString(), String.valueOf(methodSaved.getMethodType())); this.redisHandler.setSync(RedisKeys.C2C_PAYMENT_METHOD_ID_TYPE, map1); } String log = MessageFormat.format("ip:" + this.getIp(getRequest()) + ",用户新增支付方式,id:{0},用户PARTY_ID:{1},支付方式模板id:{2},支付方式类型:{3},支付方式名称:{4},支付方式图片:{5},真实姓名:{6}," + "参数名1:{7},参数值1:{8},参数名2:{9},参数值2:{10},参数名3:{11},参数值3:{12},参数名4:{13},参数值4:{14},参数名5:{15},参数值5:{16}," + "参数名6:{17},参数值6:{18},参数名7:{19},参数值7:{20},参数名8:{21},参数值8:{22},参数名9:{23},参数值9:{24},参数名10:{25},参数值10:{26}," + "参数名11:{27},参数值11:{28},参数名12:{29},参数值12:{30},参数名13:{31},参数值13:{32},参数名14:{33},参数值14:{34},参数名15:{35},参数值15:{36}," + "支付二维码:{37},备注:{38},创建时间:{39},更新时间:{40}", method.getId(), method.getPartyId(), method.getMethodConfigId(), method.getMethodType(), method.getMethodName(), method.getMethodImg(), method.getRealName(), method.getParamName1(), method.getParamValue1(), method.getParamName2(), method.getParamValue2(), method.getParamName3(), method.getParamValue3(), method.getParamName4(), method.getParamValue4(), method.getParamName5(), method.getParamValue5(), method.getParamName6(), method.getParamValue6(), method.getParamName7(), method.getParamValue7(), method.getParamName8(), method.getParamValue8(), method.getParamName9(), method.getParamValue9(), method.getParamName10(), method.getParamValue10(), method.getParamName11(), method.getParamValue11(), method.getParamName12(), method.getParamValue12(), method.getParamName13(), method.getParamValue13(), method.getParamName14(), method.getParamValue14(), method.getParamName15(), method.getParamValue15(), method.getQrcode(), method.getRemark(), method.getCreateTime(), method.getUpdateTime()); SecUser sec = this.secUserService.findUserByPartyId(partyId); this.saveLog(sec, sec.getUsername(), log, Constants.LOG_CATEGORY_C2C); } catch (BusinessException e) { resultObject.setCode("1"); resultObject.setMsg(e.getMessage()); } catch (Throwable t) { resultObject.setCode("1"); resultObject.setMsg("程序错误"); logger.error("error:", t); } return resultObject; } /** * 删除支付方式 */ @RequestMapping(action + "delete.action") public Object delete(HttpServletRequest request) { ResultObject resultObject = new ResultObject(); String id = request.getParameter("id"); List order = c2cOrderService.getByPayId(id); if(ObjectUtils.isNotEmpty(order)) { resultObject.setCode("1"); resultObject.setMsg("当前支付方式有未处理完成的订单!"); } this.c2cPaymentMethodService.delete(id); return resultObject; } /** * 修改 支付方式 */ @RequestMapping(action + "update.action") public Object update(HttpServletRequest request) { String id = request.getParameter("id"); String real_name = request.getParameter("real_name"); String param_value1 = request.getParameter("param_value1"); String param_value2 = request.getParameter("param_value2"); String param_value3 = request.getParameter("param_value3"); String param_value4 = request.getParameter("param_value4"); String param_value5 = request.getParameter("param_value5"); String param_value6 = request.getParameter("param_value6"); String param_value7 = request.getParameter("param_value7"); String param_value8 = request.getParameter("param_value8"); String param_value9 = request.getParameter("param_value9"); String param_value10 = request.getParameter("param_value10"); String param_value11 = request.getParameter("param_value11"); String param_value12 = request.getParameter("param_value12"); String param_value13 = request.getParameter("param_value13"); String param_value14 = request.getParameter("param_value14"); String param_value15 = request.getParameter("param_value15"); String qrcode = request.getParameter("qrcode"); String remark = request.getParameter("remark"); ResultObject resultObject = new ResultObject(); resultObject = this.readSecurityContextFromSession(resultObject); if (!"0".equals(resultObject.getCode())) { return resultObject; } try { if (StringUtils.isNullOrEmpty(real_name)) { throw new BusinessException("真实姓名必填"); } if (StringUtils.isNullOrEmpty(param_value1)) { throw new BusinessException("参数值1必填"); } C2cPaymentMethod method = this.c2cPaymentMethodService.get(id); if (null == method) { throw new BusinessException("支付方式不存在"); } String partyId = this.getLoginPartyId(); if (!method.getPartyId().equals(partyId)) { throw new BusinessException("支付方式不匹配该用户"); } String log = MessageFormat.format("ip:" + this.getIp(getRequest()) + ",用户修改支付方式,id:{0},原用户PARTY_ID:{1},原支付方式模板:{2},原支付方式类型:{3},原支付方式名称:{4},原支付方式图片:{5},原真实姓名:{6}," + "原参数名1:{7},原参数值1:{8},原参数名2:{9},原参数值2:{10},原参数名3:{11},原参数值3:{12},原参数名4:{13},原参数值4:{14},原参数名5:{15},原参数值5:{16}," + "原参数名6:{17},原参数值6:{18},原参数名7:{19},原参数值7:{20},原参数名8:{21},原参数值8:{22},原参数名9:{23},原参数值9:{24},原参数名10:{25},原参数值10:{26}," + "原参数名11:{27},原参数值11:{28},原参数名12:{29},原参数值12:{30},原参数名13:{31},原参数值13:{32},原参数名14:{33},原参数值14:{34},原参数名15:{35},原参数值15:{36}," + "原支付二维码:{37},原备注:{38},原创建时间:{39},原更新时间:{40}", method.getId(), method.getPartyId(), method.getMethodConfigId(), method.getMethodType(), method.getMethodName(), method.getMethodImg(), method.getRealName(), method.getParamName1(), method.getParamValue1(), method.getParamName2(), method.getParamValue2(), method.getParamName3(), method.getParamValue3(), method.getParamName4(), method.getParamValue4(), method.getParamName5(), method.getParamValue5(), method.getParamName6(), method.getParamValue6(), method.getParamName7(), method.getParamValue7(), method.getParamName8(), method.getParamValue8(), method.getParamName9(), method.getParamValue9(), method.getParamName10(), method.getParamValue10(), method.getParamName11(), method.getParamValue11(), method.getParamName12(), method.getParamValue12(), method.getParamName13(), method.getParamValue13(), method.getParamName14(), method.getParamValue14(), method.getParamName15(), method.getParamValue15(), method.getQrcode(), method.getRemark(), method.getCreateTime(), method.getUpdateTime()); method.setRealName(real_name); method.setParamValue1(param_value1); method.setParamValue2(param_value2); method.setParamValue3(param_value3); method.setParamValue4(param_value4); method.setParamValue5(param_value5); method.setParamValue6(param_value6); method.setParamValue7(param_value7); method.setParamValue8(param_value8); method.setParamValue9(param_value9); method.setParamValue10(param_value10); method.setParamValue11(param_value11); method.setParamValue12(param_value12); method.setParamValue13(param_value13); method.setParamValue14(param_value14); method.setParamValue15(param_value15); method.setQrcode(qrcode); method.setRemark(remark); method.setUpdateTime(new Date()); boolean state = this.c2cPaymentMethodService.update(method); if (state) { this.redisHandler.setSync(RedisKeys.C2C_PAYMENT_METHOD_ID + method.getId().toString(), method); Map map = (Map) this.redisHandler.get(RedisKeys.C2C_PAYMENT_METHOD_PARTY_ID + method.getPartyId().toString()); if (null == map) { map = new ConcurrentHashMap(); } else { map.remove(method.getId().toString()); } map.put(method.getId().toString(), method); this.redisHandler.setSync(RedisKeys.C2C_PAYMENT_METHOD_PARTY_ID + method.getPartyId().toString(), map); Map map1 = (Map) this.redisHandler.get(RedisKeys.C2C_PAYMENT_METHOD_ID_TYPE); if (null == map1) { map1 = new ConcurrentHashMap(); } else { map1.remove(method.getId().toString()); } map1.put(method.getId().toString(), String.valueOf(method.getMethodType())); this.redisHandler.setSync(RedisKeys.C2C_PAYMENT_METHOD_ID_TYPE, map1); } log += MessageFormat.format(",id:{0},新用户PARTY_ID:{1},新支付方式模板:{2},新支付方式类型:{3},新支付方式名称:{4},新支付方式图片:{5},新真实姓名:{6}," + "新参数名1:{7},新参数值1:{8},新参数名2:{9},新参数值2:{10},新参数名3:{11},新参数值3:{12},新参数名4:{13},新参数值4:{14},新参数名5:{15},新参数值5:{16}," + "新参数名6:{17},新参数值6:{18},新参数名7:{19},新参数值7:{20},新参数名8:{21},新参数值8:{22},新参数名9:{23},新参数值9:{24},新参数名10:{25},新参数值10:{26}," + "新参数名11:{27},新参数值11:{28},新参数名12:{29},新参数值12:{30},新参数名13:{31},新参数值13:{32},新参数名14:{33},新参数值14:{34},新参数名15:{35},新参数值15:{36}," + "新支付二维码:{37},新备注:{38},新创建时间:{39},新更新时间:{40}", method.getId(), method.getPartyId(), method.getMethodConfigId(), method.getMethodType(), method.getMethodName(), method.getMethodImg(), method.getRealName(), method.getParamName1(), method.getParamValue1(), method.getParamName2(), method.getParamValue2(), method.getParamName3(), method.getParamValue3(), method.getParamName4(), method.getParamValue4(), method.getParamName5(), method.getParamValue5(), method.getParamName6(), method.getParamValue6(), method.getParamName7(), method.getParamValue7(), method.getParamName8(), method.getParamValue8(), method.getParamName9(), method.getParamValue9(), method.getParamName10(), method.getParamValue10(), method.getParamName11(), method.getParamValue11(), method.getParamName12(), method.getParamValue12(), method.getParamName13(), method.getParamValue13(), method.getParamName14(), method.getParamValue14(), method.getParamName15(), method.getParamValue15(), method.getQrcode(), method.getRemark(), method.getCreateTime(), method.getUpdateTime()); SecUser sec = this.secUserService.findUserByPartyId(partyId); this.saveLog(sec, sec.getUsername(), log, Constants.LOG_CATEGORY_C2C); } catch (BusinessException e) { resultObject.setCode("1"); resultObject.setMsg(e.getMessage()); } catch (Throwable t) { resultObject.setCode("1"); resultObject.setMsg("程序错误"); logger.error("error:", t); } return resultObject; } public void saveLog(SecUser secUser, String operator, String context, String category) { project.log.Log log = new project.log.Log(); log.setCategory(category); log.setOperator(operator); log.setUsername(secUser.getUsername()); log.setPartyId(secUser.getPartyId()); log.setLog(context); log.setCreateTime(new Date()); this.logService.saveSync(log); } }