| | |
| | | * @Date 2023-02-20 09:18:08 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tAgent") |
| | | @RequestMapping("") |
| | | public class TAgentController extends BaseController { |
| | | |
| | | private String PREFIX = "/system/tAgent/"; |
| | |
| | | /** |
| | | * 跳转到首页 |
| | | */ |
| | | @RequestMapping("") |
| | | @RequestMapping("/tAgent") |
| | | public String index(Model model) { |
| | | model.addAttribute("userType", Objects.requireNonNull(ShiroKit.getUser()).getRoleType()); |
| | | return PREFIX + "tAgent.html"; |
| | |
| | | /** |
| | | * 跳转到添加 |
| | | */ |
| | | @RequestMapping("/tAgent_add") |
| | | @RequestMapping("/tAgent/tAgent_add") |
| | | public String tAgentAdd() { |
| | | return PREFIX + "tAgent_add.html"; |
| | | } |
| | |
| | | /** |
| | | * 跳转到修改 |
| | | */ |
| | | @RequestMapping("/tAgent_update/{tAgentId}") |
| | | @RequestMapping("/tAgent/tAgent_update/{tAgentId}") |
| | | public String tAgentUpdate(@PathVariable Integer tAgentId, Model model) { |
| | | TAgent tAgent = tAgentService.selectById(tAgentId); |
| | | model.addAttribute("item",tAgent); |
| | |
| | | /** |
| | | * 跳转详情页面 |
| | | */ |
| | | @RequestMapping("/agentDetail") |
| | | @RequestMapping("/tAgent/agentDetail") |
| | | public String agentDetail(Integer agentId, Model model) { |
| | | tAgentService.detail(agentId,model); |
| | | return PREFIX + "tAgentDetail.html"; |
| | |
| | | /** |
| | | * 跳转区域页面 |
| | | */ |
| | | @RequestMapping("/areaDetail") |
| | | @RequestMapping("/tAgent/areaDetail") |
| | | public String areaDetail(String area,String areaId,Model model) { |
| | | // String[] split1 = areaId.split("/"); |
| | | // List<TRegion> tRegions = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0)); |
| | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list") |
| | | @RequestMapping(value = "/tAgent/list") |
| | | @ResponseBody |
| | | public Object list(String principal,String principalPhone,String createTime,Integer status) { |
| | | EntityWrapper<TAgent> wrapper = tAgentService.getAgentWrapper(principal,principalPhone,createTime,status); |
| | |
| | | /** |
| | | * 获取列表 |
| | | */ |
| | | @RequestMapping(value = "/list-back") |
| | | @RequestMapping(value = "/tAgent/list-back") |
| | | @ResponseBody |
| | | public Object listBack(String condition) { |
| | | return tAgentService.selectList(null); |
| | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @RequestMapping(value = "/add") |
| | | @RequestMapping(value = "/tAgent/add") |
| | | @ResponseBody |
| | | @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRES_NEW) |
| | | public Object add(TAgent tAgent) { |
| | |
| | | registerVO.setUserType("0"); |
| | | registerVO.setUserName(tAgent.getMerchantName()); |
| | | registerVO.setCertId(tAgent.getMerchantIDCode()); |
| | | registerVO.setNotifyUrl(callbackPath + "/tAgent/microenterpriseCallback"); |
| | | registerVO.setNotifyUrl(callbackPath + "/base/tAgent/microenterpriseCallback"); |
| | | TrhRequest<Register> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(registerVO, Register.SERVICE_CODE); |
| | | if("0000".equals(execute.getCode())){ |
| | |
| | | registerVO.setProvCode(tAgent.getProvCodeEnterprise()); |
| | | registerVO.setAreaCode(tAgent.getAreaCodeEnterprise()); |
| | | registerVO.setFileNo(tAgent.getFileNo()); |
| | | registerVO.setNotifyUrl(callbackPath + "/tAgent/microenterpriseCallback"); |
| | | registerVO.setNotifyUrl(callbackPath + "/base/tAgent/microenterpriseCallback"); |
| | | registerVO.setParameter1(tAgent.getId().toString()); |
| | | |
| | | TrhRequest<Register> request = new TrhRequest(); |
| | |
| | | * 注册商户回调 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/microenterpriseCallback") |
| | | @PostMapping("/base/tAgent/microenterpriseCallback") |
| | | public void microenterpriseCallback(@RequestBody InterfaceResponse interfaceResponse, HttpServletResponse response){ |
| | | try { |
| | | if("0000".equals(interfaceResponse.getCode())) { |
| | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @RequestMapping(value = "/delete") |
| | | @RequestMapping(value = "/tAgent/delete") |
| | | @ResponseBody |
| | | public Object delete(@RequestParam Integer tAgentId) { |
| | | tAgentService.deleteById(tAgentId); |
| | |
| | | /** |
| | | * 修改用户状态 |
| | | */ |
| | | @RequestMapping(value = "/update-status") |
| | | @RequestMapping(value = "/tAgent/update-status") |
| | | @ResponseBody |
| | | public Object updateStatus(Integer id,Integer status) { |
| | | TAgent tAgent = tAgentService.selectById(id); |
| | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @RequestMapping(value = "/update") |
| | | @RequestMapping(value = "/tAgent/update") |
| | | @ResponseBody |
| | | public Object update(TAgent tAgent) { |
| | | tAgent.setPrincipal(tAgent.getPrincipal().replace(" ","")); |
| | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @RequestMapping(value = "/detail/{tAgentId}") |
| | | @RequestMapping(value = "/tAgent/detail/{tAgentId}") |
| | | @ResponseBody |
| | | public Object detail(@PathVariable("tAgentId") Integer tAgentId) { |
| | | return tAgentService.selectById(tAgentId); |
| | |
| | | |
| | | |
| | | @ApiOperation(value = "省市区查询",notes="省市区查询") |
| | | @RequestMapping(value = "/area") |
| | | @RequestMapping(value = "/tAgent/area") |
| | | @ResponseBody |
| | | public Object area() { |
| | | return tRegionService.getAreaList(); |
| | | } |
| | | |
| | | @ApiOperation(value = "省查询",notes="省查询") |
| | | @RequestMapping(value = "/areaProvince") |
| | | @RequestMapping(value = "/tAgent/areaProvince") |
| | | @ResponseBody |
| | | public Object areaProvince(Model model) { |
| | | return tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0)); |
| | | } |
| | | |
| | | @ApiOperation(value = "市区查询",notes="市区查询") |
| | | @RequestMapping(value = "/areaCity") |
| | | @RequestMapping(value = "/tAgent/areaCity") |
| | | @ResponseBody |
| | | public Object areaCity(Integer parentId) { |
| | | return tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id",parentId)); |
| | |
| | | |
| | | |
| | | @ApiOperation(value = "导出代理商列表",notes="导出代理商列表") |
| | | @RequestMapping(value = "/export") |
| | | @RequestMapping(value = "/tAgent/export") |
| | | @ResponseBody |
| | | public void export(String principal,String principalPhone,Integer status,String createTime, HttpServletResponse response) { |
| | | try { |
| | |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/uploadFile") |
| | | @RequestMapping(value = "/tAgent/uploadFile") |
| | | public String uploadFile(MultipartFile file){ |
| | | File srcFile = null; |
| | | String originalFilename = file.getOriginalFilename(); |
| | |
| | | * 跳转到企业信息页 |
| | | * @return |
| | | */ |
| | | @GetMapping("/showEnterprisePage") |
| | | @GetMapping("/tAgent/showEnterprisePage") |
| | | public String showEnterprisePage(Model model){ |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | Integer objectId = user.getObjectId(); |
| | |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/withdrawCash") |
| | | @PostMapping("/tAgent/withdrawCash") |
| | | public ResultUtil withdrawCash(){ |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | Integer objectId = user.getObjectId(); |
| | |
| | | InterfaceResponse execute = request.execute(queryBalance, QueryBalance.SERVICE_CODE); |
| | | if("0000".equals(execute.getCode())){ |
| | | JSONObject jsonObject = JSON.parseObject(execute.getResult()); |
| | | double settledAmount = jsonObject.getDoubleValue("settledAmount"); |
| | | Integer settledAmount = jsonObject.getInteger("settledAmount"); |
| | | if(0 == settledAmount){ |
| | | return ResultUtil.error("余额不足"); |
| | | } |
| | |
| | | if(roleType == 3){ |
| | | settlementRecord.setObjectId(tAgent.getId()); |
| | | } |
| | | settlementRecord.setAmount(settledAmount); |
| | | settlementRecord.setAmount(Double.valueOf(settledAmount) / 100); |
| | | settlementRecord.setInsertTime(new Date()); |
| | | settlementRecordService.insert(settlementRecord); |
| | | |
| | | |
| | | Withdraw withdraw = new Withdraw(); |
| | | withdraw.setUserId(tAgent.getMerchantNumber()); |
| | | withdraw.setAmount(settledAmount + ""); |
| | | withdraw.setAmount(String.valueOf(settledAmount)); |
| | | withdraw.setOrderName("账户余额提现"); |
| | | withdraw.setRemark("账户余额提现"); |
| | | withdraw.setNotifyUrl(callbackPath + "/tAgent/withdrawCashCallback"); |
| | | withdraw.setNotifyUrl(callbackPath + "/base/tAgent/withdrawCashCallback"); |
| | | withdraw.setParameter1(settlementRecord.getId().toString()); |
| | | TrhRequest<Withdraw> request1 = new TrhRequest(); |
| | | InterfaceResponse execute1 = request1.execute(withdraw, Withdraw.SERVICE_CODE);//结算(提现) |
| | |
| | | * @param interfaceResponse |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/withdrawCashCallback") |
| | | @PostMapping("/base/tAgent/withdrawCashCallback") |
| | | public void withdrawCashCallback(@RequestBody InterfaceResponse interfaceResponse, HttpServletResponse response) { |
| | | try { |
| | | if("0000".equals(interfaceResponse.getCode())){ |
| | |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/accountRecharge") |
| | | @PostMapping("/tAgent/accountRecharge") |
| | | public ResultUtil accountRecharge(Double amount){ |
| | | try { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | |
| | | deposit.setOrderName("补贴充值"); |
| | | deposit.setPayType("ALI_CB"); |
| | | deposit.setTerminalIp(InetAddress.getLocalHost().getHostAddress()); |
| | | deposit.setFrontUrl(callbackPath + "/tAgent/accountRechargeCallback"); |
| | | deposit.setNotifyUrl(callbackPath + "/tAgent/accountRechargeCallback"); |
| | | deposit.setFrontUrl(callbackPath + "/base/tAgent/accountRechargeCallback"); |
| | | deposit.setNotifyUrl(callbackPath + "/base/tAgent/accountRechargeCallback"); |
| | | deposit.setParameter1(rechargeRecord.getId().toString()); |
| | | TrhRequest<Deposit> request = new TrhRequest(); |
| | | InterfaceResponse execute = request.execute(deposit, Deposit.SERVICE_CODE); |
| | |
| | | * @param interfaceResponse |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/accountRechargeCallback") |
| | | @PostMapping("/base/tAgent/accountRechargeCallback") |
| | | public void accountRechargeCallback(@RequestBody InterfaceResponse interfaceResponse, HttpServletResponse response){ |
| | | try { |
| | | if("0000".equals(interfaceResponse.getCode())){ |