| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- import com.sdtool.business.dao.MallDao
- import com.sdtool.common.api.BusinessExecutor
- import com.sdtool.common.datas.ERPModule
- import com.sdtool.common.entity.base.InvokeCallParams
- import com.sdtool.common.entity.base.InvokeCallResult
- import com.sdtool.common.entity.mall.SelfTakeAddress
- import com.sdtool.common.entity.site.ERPTokenUser
- import com.alibaba.fastjson2.JSON
- import com.dySweetFishPlugin.sql.dao.OperatorWait
- import com.dySweetFishPlugin.sql.dao.TunaService
- import com.sweetfish.convert.json.JsonConvert
- import com.sweetfish.service.RetResult
- import groovy.json.JsonSlurper
- import org.rex.RMap
- import javax.annotation.Resource
- /**
- * @Author: xl Created on 2024-03-27
- * @Content:
- */
- class BE_SelfTakeAddress_Search implements BusinessExecutor<InvokeCallParams, InvokeCallResult> {
- @Resource
- TunaService tunaService
- @Resource
- JsonConvert jsonConvert
- private MallDao mallDao
- @Override
- String scriptName() {
- return "购物商城-获取自提地址列表"
- }
- @Override
- ERPModule module() {
- return ERPModule.MALL_FRONT
- }
- @Override
- boolean needLogin(InvokeCallParams source) {
- return true
- }
- @Override
- void start(long supplierCode) {
- mallDao = tunaService.generate(MallDao.class)
- }
- @Override
- String getPerms(ERPTokenUser currentUser) {
- return ""
- }
- @Override
- OperatorWait getAWait(InvokeCallParams s) {
- return OperatorWait.AWAIT
- }
- @Override
- RetResult<InvokeCallParams> checkExecute(InvokeCallParams source) {
- ERPTokenUser currentUser = source.currentUser
- if (currentUser == null) RetResult.<InvokeCallParams> errorT().retinfo("未登录")
- return RetResult.<InvokeCallParams> successT().result(source)
- }
- @Override
- RetResult<InvokeCallResult> execute(InvokeCallParams source) {
- long supplierCode = source.supplierCode
- String dataSourceId = source.dataSourceId
- JsonSlurper jsonSlurper = new JsonSlurper()
- def invokeData = jsonSlurper.parseText(source.params)
- String keyword = invokeData["keyWord"]
- RMap params = new RMap()
- params.put("keyWord", keyword)
- params.put("orderBy", "defaultFlag desc,id desc")
- List<SelfTakeAddress> selfTakeAddressList = mallDao.querySelfTakeAddress(params, null, dataSourceId, supplierCode)
- def returnDef = selfTakeAddressList.collect {
- [
- id : it.id,
- province : it.province,
- city : it.city,
- area : it.area,
- address : it.address,
- defaultFlag: it.defaultFlag
- ]
- }
- RMap<String, String> collectionData = new RMap<>()
- collectionData.put("total",String.valueOf(returnDef.size()))
- return RetResult.<InvokeCallResult> successT().result(InvokeCallResult.success().data(JSON.toJSONString(returnDef))
- .collection(collectionData)
- )
- }
- }
|